Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-05-23 03:23:31 +05:30 committed by GitHub
commit c247beaf69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
511 changed files with 70095 additions and 830 deletions

View file

@ -8,6 +8,9 @@ on:
target: target:
required: true required: true
type: string type: string
subtarget:
required: true
type: string
testing: testing:
type: boolean type: boolean
build_toolchain: build_toolchain:
@ -50,7 +53,7 @@ permissions:
jobs: jobs:
setup_build: setup_build:
name: Setup build ${{ inputs.target }} name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
@ -109,7 +112,7 @@ jobs:
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
build: build:
name: Build ${{ inputs.target }} name: Build ${{ inputs.target }}/${{ inputs.subtarget }}
needs: setup_build needs: setup_build
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -157,13 +160,6 @@ jobs:
run: | run: |
chown -R buildbot:buildbot openwrt chown -R buildbot:buildbot openwrt
- name: Initialization environment
run: |
TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1)
SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2)
echo "TARGET=$TARGET" >> "$GITHUB_ENV"
echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV"
- name: Prepare prebuilt tools - name: Prepare prebuilt tools
shell: su buildbot -c "sh -e {0}" shell: su buildbot -c "sh -e {0}"
working-directory: openwrt working-directory: openwrt
@ -213,7 +209,7 @@ jobs:
fi fi
fi fi
SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums"
if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then
TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")"
TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
@ -235,16 +231,16 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: openwrt/.ccache path: openwrt/.ccache
key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.setup_build.outputs.ccache_hash }} key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ needs.setup_build.outputs.ccache_hash }}
restore-keys: | restore-keys: |
ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}- ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-
- name: Download external toolchain/sdk - name: Download external toolchain/sdk
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal'
shell: su buildbot -c "sh -e {0}" shell: su buildbot -c "sh -e {0}"
working-directory: openwrt working-directory: openwrt
run: | run: |
wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \
| tar --xz -xf - | tar --xz -xf -
- name: Configure testing kernel - name: Configure testing kernel
@ -289,7 +285,7 @@ jobs:
./scripts/ext-toolchain.sh \ ./scripts/ext-toolchain.sh \
--toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \
--overwrite-config \ --overwrite-config \
--config ${{ env.TARGET }}/${{ env.SUBTARGET }} --config ${{ inputs.target }}/${{ inputs.subtarget }}
- name: Adapt external sdk to external toolchain format - name: Adapt external sdk to external toolchain format
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk'
@ -331,7 +327,7 @@ jobs:
./scripts/ext-toolchain.sh \ ./scripts/ext-toolchain.sh \
--toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \
--overwrite-config \ --overwrite-config \
--config ${{ env.TARGET }}/${{ env.SUBTARGET }} --config ${{ inputs.target }}/${{ inputs.subtarget }}
- name: Configure internal toolchain - name: Configure internal toolchain
if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal' if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal'
@ -342,8 +338,8 @@ jobs:
echo CONFIG_AUTOREMOVE=y >> .config echo CONFIG_AUTOREMOVE=y >> .config
echo CONFIG_CCACHE=y >> .config echo CONFIG_CCACHE=y >> .config
echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
make defconfig make defconfig
@ -435,5 +431,5 @@ jobs:
if: failure() if: failure()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
path: "openwrt/logs" path: "openwrt/logs"

View file

@ -6,6 +6,9 @@ on:
target: target:
required: true required: true
type: string type: string
subtarget:
required: true
type: string
testing: testing:
type: boolean type: boolean
use_openwrt_container: use_openwrt_container:
@ -85,17 +88,6 @@ jobs:
run: | run: |
chown -R buildbot:buildbot openwrt chown -R buildbot:buildbot openwrt
- name: Opt-out from Git stricter repository ownership checks
run: |
git config --global --add safe.directory '*'
- name: Initialization environment
run: |
TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1)
SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2)
echo "TARGET=$TARGET" >> "$GITHUB_ENV"
echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV"
- name: Prepare prebuilt tools - name: Prepare prebuilt tools
shell: su buildbot -c "sh -e {0}" shell: su buildbot -c "sh -e {0}"
working-directory: openwrt working-directory: openwrt
@ -122,8 +114,8 @@ jobs:
echo CONFIG_AUTOREMOVE=y >> .config echo CONFIG_AUTOREMOVE=y >> .config
echo CONFIG_CCACHE=y >> .config echo CONFIG_CCACHE=y >> .config
echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
make defconfig make defconfig
@ -138,18 +130,19 @@ jobs:
run: make target/linux/refresh V=s run: make target/linux/refresh V=s
- name: Validate Refreshed Kernel Patches - name: Validate Refreshed Kernel Patches
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt working-directory: openwrt
run: | run: |
. .github/workflows/scripts/ci_helpers.sh . .github/workflows/scripts/ci_helpers.sh
if git diff --name-only --exit-code; then if git diff --name-only --exit-code; then
success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok" success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok"
else else
err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)" err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)"
err "You can also check the provided artifacts with the refreshed patch from this CI run." err "You can also check the provided artifacts with the refreshed patch from this CI run."
mkdir ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
for f in $(git diff --name-only); do for f in $(git diff --name-only); do
cp --parents $f ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed/ cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/
done done
exit 1 exit 1
fi fi
@ -158,5 +151,5 @@ jobs:
if: failure() if: failure()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
path: openwrt/${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed

View file

@ -17,7 +17,8 @@ jobs:
packages: read packages: read
uses: ./.github/workflows/build.yml uses: ./.github/workflows/build.yml
with: with:
target: x86/64 target: x86
subtarget: 64
build_full: true build_full: true
include_feeds: true include_feeds: true
coverity_compiler_template_list: >- coverity_compiler_template_list: >-

View file

@ -64,8 +64,9 @@ jobs:
if echo "$CHANGED_FILES" | grep -v -q target/linux || if echo "$CHANGED_FILES" | grep -v -q target/linux ||
echo "$CHANGED_FILES" | grep -q target/linux/generic || echo "$CHANGED_FILES" | grep -q target/linux/generic ||
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
[[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"'"'"${TARGET}"'"' JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
FIRST=0 FIRST=0
fi fi
done done
@ -77,8 +78,9 @@ jobs:
if echo "$CHANGED_FILES" | grep -v -q target/linux || if echo "$CHANGED_FILES" | grep -v -q target/linux ||
echo "$CHANGED_FILES" | grep -q target/linux/generic || echo "$CHANGED_FILES" | grep -q target/linux/generic ||
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
[[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
JSON_TARGETS="$JSON_TARGETS"'"'"${TARGET}"'"' JSON_TARGETS="$JSON_TARGETS""$TUPLE"
FIRST=0 FIRST=0
fi fi
done done
@ -104,10 +106,11 @@ jobs:
strategy: strategy:
fail-fast: False fail-fast: False
matrix: matrix:
target: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
uses: ./.github/workflows/build.yml uses: ./.github/workflows/build.yml
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
build_kernel: true build_kernel: true
build_all_kmods: true build_all_kmods: true
@ -120,8 +123,9 @@ jobs:
strategy: strategy:
fail-fast: False fail-fast: False
matrix: matrix:
target: ${{fromJson(needs.determine_targets.outputs.targets)}} include: ${{fromJson(needs.determine_targets.outputs.targets)}}
uses: ./.github/workflows/check-kernel-patches.yml uses: ./.github/workflows/check-kernel-patches.yml
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}

View file

@ -37,11 +37,14 @@ jobs:
fail-fast: False fail-fast: False
matrix: matrix:
include: include:
- target: malta/be - target: malta
- target: x86/64 subtarget: be
- target: x86
subtarget: 64
uses: ./.github/workflows/build.yml uses: ./.github/workflows/build.yml
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
build_kernel: true build_kernel: true
build_all_kmods: true build_all_kmods: true
build_all_modules: true build_all_modules: true

View file

@ -40,8 +40,9 @@ jobs:
JSON='[' JSON='['
FIRST=1 FIRST=1
for TARGET in $TARGETS; do for TARGET in $TARGETS; do
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
[[ $FIRST -ne 1 ]] && JSON="$JSON"',' [[ $FIRST -ne 1 ]] && JSON="$JSON"','
JSON="$JSON"'"'"${TARGET}"'"' JSON="$JSON""$TUPLE"
FIRST=0 FIRST=0
done done
JSON="$JSON"']' JSON="$JSON"']'
@ -61,8 +62,9 @@ jobs:
strategy: strategy:
fail-fast: False fail-fast: False
matrix: matrix:
target: ${{fromJson(needs.determine_targets.outputs.target)}} include: ${{fromJson(needs.determine_targets.outputs.target)}}
uses: ./.github/workflows/build.yml uses: ./.github/workflows/build.yml
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
subtarget: ${{ matrix.subtarget }}
build_toolchain: true build_toolchain: true

View file

@ -44,7 +44,7 @@ documentation.
``` ```
binutils bzip2 diff find flex gawk gcc-6+ getopt grep install libc-dev libz-dev binutils bzip2 diff find flex gawk gcc-6+ getopt grep install libc-dev libz-dev
make4.1+ perl python3.6+ rsync subversion unzip which make4.1+ perl python3.7+ rsync subversion unzip which
``` ```
### Quickstart ### Quickstart

View file

@ -410,7 +410,7 @@ endef
define Build/netgear-dni define Build/netgear-dni
$(STAGING_DIR_HOST)/bin/mkdniimg \ $(STAGING_DIR_HOST)/bin/mkdniimg \
-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ -B $(NETGEAR_BOARD_ID) -v $(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \
$(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \ $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
-r "$(1)" \ -r "$(1)" \
-i $@ -o $@.new -i $@ -o $@.new
@ -423,7 +423,7 @@ define Build/netgear-encrypted-factory
--output-file $@ \ --output-file $@ \
--model $(NETGEAR_ENC_MODEL) \ --model $(NETGEAR_ENC_MODEL) \
--region $(NETGEAR_ENC_REGION) \ --region $(NETGEAR_ENC_REGION) \
--version V1.0.0.0.$(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ --version V1.0.0.0.$(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \
--encryption-block-size 0x20000 \ --encryption-block-size 0x20000 \
--openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \ --openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \
--key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \ --key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \
@ -581,6 +581,7 @@ define Build/tplink-v2-image
endef endef
define Build/uImage define Build/uImage
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
mkimage \ mkimage \
-A $(LINUX_KARCH) \ -A $(LINUX_KARCH) \
-O linux \ -O linux \

View file

@ -405,6 +405,7 @@ define Device/Init
BOARD_NAME := BOARD_NAME :=
UIMAGE_MAGIC := UIMAGE_MAGIC :=
UIMAGE_NAME := UIMAGE_NAME :=
UIMAGE_TIME :=
DEVICE_COMPAT_VERSION := 1.0 DEVICE_COMPAT_VERSION := 1.0
DEVICE_COMPAT_MESSAGE := DEVICE_COMPAT_MESSAGE :=
SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
@ -425,7 +426,7 @@ DEFAULT_DEVICE_VARS := \
DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \ DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \
DEVICE_DTS_LOADADDR \ DEVICE_DTS_LOADADDR \
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
UBOOT_PATH IMAGE_SIZE \ UBOOT_PATH IMAGE_SIZE \
FACTORY_IMG_NAME FACTORY_SIZE \ FACTORY_IMG_NAME FACTORY_SIZE \
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \

2
include/kernel-6.1 Normal file
View file

@ -0,0 +1,2 @@
LINUX_VERSION-6.1 = .29
LINUX_KERNEL_HASH-6.1.29 = 1e736cc9bd6036379a1d915e518abd4c2c94ad0fd1ea0da961c3489308b8fcfb

View file

@ -75,6 +75,7 @@ endif
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
$(call Kernel/SetInitramfs/PreConfigure) $(call Kernel/SetInitramfs/PreConfigure)
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
@ -99,6 +100,7 @@ define Kernel/SetNoInitramfs
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
endef endef
define Kernel/Configure/Default define Kernel/Configure/Default
@ -153,17 +155,12 @@ define Kernel/CopyImage
} }
endef endef
# Always add "modules" so a proper Module.symvers file is written that
# also contains symbols from the kernel modules. Without these symbols
# external packages that depend on exported symbols from kernel modules
# will fail to build.
define Kernel/CompileImage/Default define Kernel/CompileImage/Default
rm -f $(TARGET_DIR)/init rm -f $(TARGET_DIR)/init
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
$(call Kernel/CopyImage) $(call Kernel/CopyImage)
endef endef
# Here as well, always add "modules", see comment above.
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
define Kernel/CompileImage/Initramfs define Kernel/CompileImage/Initramfs
$(call Kernel/Configure/Initramfs) $(call Kernel/Configure/Initramfs)
@ -185,7 +182,7 @@ endif
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
endif endif
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
$(call Kernel/CopyImage,-initramfs) $(call Kernel/CopyImage,-initramfs)
endef endef
else else

View file

@ -175,25 +175,21 @@ $(eval $(call SetupHostCommand,install,Please install GNU 'install', \
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
perl --version | grep "perl.*v5")) perl --version | grep "perl.*v5"))
$(eval $(call CleanupPython2)) $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \
python3.11 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \
python3.10 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \
python3.9 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \ python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-9])\.?'))
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \ $(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \
python3.11 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \
python3.10 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \
python3.9 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \
python3.8 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \ python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-9])\.?'))
$(eval $(call TestHostCommand,python3-distutils, \ $(eval $(call TestHostCommand,python3-distutils, \
Please install the Python3 distutils module, \ Please install the Python3 distutils module, \

View file

@ -30,6 +30,8 @@ define Require
printf "Checking '$(1)'... " printf "Checking '$(1)'... "
if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \ if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
echo 'ok.'; \ echo 'ok.'; \
elif $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
echo 'updated.'; \
else \ else \
echo 'failed.'; \ echo 'failed.'; \
echo "$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR)/.prereq-error; \ echo "$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
@ -75,18 +77,6 @@ define RequireCHeader
$$(eval $$(call Require,$(1),$(2))) $$(eval $$(call Require,$(1),$(2)))
endef endef
define CleanupPython2
define Require/python2-cleanup
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
$(STAGING_DIR_HOST)/bin/python -V 2>&1 | \
grep -q 'Python 2'; then \
rm $(STAGING_DIR_HOST)/bin/python; \
fi
endef
$$(eval $$(call Require,python2-cleanup))
endef
define QuoteHostCommand define QuoteHostCommand
'$(subst ','"'"',$(strip $(1)))' '$(subst ','"'"',$(strip $(1)))'
endef endef
@ -107,7 +97,7 @@ endef
# 3+: candidates # 3+: candidates
define SetupHostCommand define SetupHostCommand
define Require/$(1) define Require/$(1)
[ -f "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0; \ mkdir -p "$(STAGING_DIR_HOST)/bin"; \
for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \ for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \
$(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \ $(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \
$(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \ $(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \
@ -117,9 +107,13 @@ define SetupHostCommand
bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \ bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
command -v "$$$$$$$${cmd%% *}")"; \ command -v "$$$$$$$${cmd%% *}")"; \
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \ if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
mkdir -p "$(STAGING_DIR_HOST)/bin"; \ case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \
*" -> $$$$$$$$bin"*) \
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
;; \
esac; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \ ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
exit 0; \ exit 1; \
fi; \ fi; \
fi; \ fi; \
done; \ done; \

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=tfa-layerscape PKG_NAME:=tfa-layerscape
PKG_VERSION:=21.08 PKG_VERSION:=lf-6.1.1-1.0.0
PKG_RELEASE:=6 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/atf PKG_SOURCE_URL:=https://github.com/nxp-qoriq/atf
PKG_SOURCE_VERSION:=LSDK-21.08 PKG_SOURCE_VERSION:=lf-6.1.1-1.0.0
PKG_MIRROR_HASH:=893f2d28a77dcc9d4413a619b4719ca5f1f4dc78dd824a8488e7d543e66bcf95 PKG_MIRROR_HASH:=c0e3c7d0cc9ee5f9ae68cd705ce7f07f714c4fe3fd4a5a79de5699e7865b759f
PKG_BUILD_DEPENDS:=tfa-layerscape/host PKG_BUILD_DEPENDS:=tfa-layerscape/host
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
@ -25,18 +25,19 @@ HOST_CFLAGS += -Wall -Werror -pedantic -std=c99
define Host/Compile define Host/Compile
$(MAKE) -C \ $(MAKE) -C \
$(HOST_BUILD_DIR)/tools/fiptool \ $(HOST_BUILD_DIR)/tools/fiptool \
PLAT_FIPTOOL_HELPER_MK="$(HOST_BUILD_DIR)/tools/nxp/plat_fiptool/plat_fiptool.mk" \
CFLAGS="$(HOST_CFLAGS)" \ CFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \
HOSTCCFLAGS="$(HOST_CFLAGS)" HOSTCCFLAGS="$(HOST_CFLAGS)"
$(MAKE) -C \ $(MAKE) -C \
$(HOST_BUILD_DIR)/tools/nxp \ $(HOST_BUILD_DIR)/tools/nxp/create_pbl \
CFLAGS="$(HOST_CFLAGS)" CFLAGS="$(HOST_CFLAGS)"
endef endef
define Host/Install define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/fiptool-layerscape $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/fiptool-layerscape
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/nxp/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/nxp/create_pbl/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/nxp/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/nxp/create_pbl/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap
endef endef
define Trusted-Firmware-A/Default define Trusted-Firmware-A/Default

View file

@ -1,6 +1,6 @@
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -801,10 +801,6 @@ CRTTOOL ?= ${CRTTOOLPATH}/cert_create$ @@ -914,10 +914,6 @@ CRTTOOL ?= ${CRTTOOLPATH}/cert_create$
ENCTOOLPATH ?= tools/encrypt_fw ENCTOOLPATH ?= tools/encrypt_fw
ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT} ENCTOOL ?= ${ENCTOOLPATH}/encrypt_fw${BIN_EXT}
@ -11,7 +11,7 @@
# Variables for use with sptool # Variables for use with sptool
SPTOOLPATH ?= tools/sptool SPTOOLPATH ?= tools/sptool
SPTOOL ?= ${SPTOOLPATH}/sptool${BIN_EXT} SPTOOL ?= ${SPTOOLPATH}/sptool${BIN_EXT}
@@ -1160,13 +1156,6 @@ endif @@ -1322,13 +1318,6 @@ endif
clean: clean:
@echo " CLEAN" @echo " CLEAN"
$(call SHELL_REMOVE_DIR,${BUILD_PLAT}) $(call SHELL_REMOVE_DIR,${BUILD_PLAT})
@ -25,7 +25,7 @@
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean ${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
@@ -1175,13 +1164,6 @@ realclean distclean: @@ -1337,13 +1326,6 @@ realclean distclean:
@echo " REALCLEAN" @echo " REALCLEAN"
$(call SHELL_REMOVE_DIR,${BUILD_BASE}) $(call SHELL_REMOVE_DIR,${BUILD_BASE})
$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
@ -39,37 +39,33 @@
${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean ${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
@@ -1238,7 +1220,7 @@ certificates: ${CRT_DEPS} ${CRTTOOL} @@ -1400,7 +1382,7 @@ certificates: ${CRT_DEPS} ${CRTTOOL}
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
endif endif
-${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} -${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
+${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} +${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS}
$(eval ${CHECK_FIP_CMD})
${Q}${FIPTOOL} create ${FIP_ARGS} $@ ${Q}${FIPTOOL} create ${FIP_ARGS} $@
${Q}${FIPTOOL} info $@ ${Q}${FIPTOOL} info $@
@${ECHO_BLANK_LINE} @@ -1417,7 +1399,7 @@ fwu_certificates: ${FWU_CRT_DEPS} ${CRTT
@@ -1254,7 +1236,7 @@ fwu_certificates: ${FWU_CRT_DEPS} ${CRTT
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
endif endif
-${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} -${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
+${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} +${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS}
$(eval ${CHECK_FWU_FIP_CMD})
${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@
${Q}${FIPTOOL} info $@ ${Q}${FIPTOOL} info $@
@${ECHO_BLANK_LINE} @@ -1425,19 +1407,9 @@ ${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP
@@ -1279,24 +1261,10 @@ ${BUILD_PLAT}/${DDR_FIP_NAME}: ${DDR_FIP
@echo "Built $@ successfully" @echo "Built $@ successfully"
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
-fiptool: ${FIPTOOL} -fiptool: ${FIPTOOL}
fip: ${BUILD_PLAT}/${FIP_NAME} fip: ${BUILD_PLAT}/${FIP_NAME}
fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
fip_ddr: ${BUILD_PLAT}/${DDR_FIP_NAME}
-.PHONY: ${FIPTOOL} -${FIPTOOL}: FORCE
-${FIPTOOL}:
- @${ECHO_BLANK_LINE}
- @echo "Building $@"
-ifdef UNIX_MK -ifdef UNIX_MK
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH} - ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH}
-else -else
@ -77,14 +73,13 @@
-# to pass the gnumake flags to nmake. -# to pass the gnumake flags to nmake.
- ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) - ${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
-endif -endif
- @${ECHO_BLANK_LINE}
- -
sptool: ${SPTOOL} sptool: ${SPTOOL}
.PHONY: ${SPTOOL} ${SPTOOL}: FORCE
${SPTOOL}: ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" SPTOOL=${SPTOOL} --no-print-directory -C ${SPTOOLPATH}
--- a/tools/fiptool/Makefile --- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile
@@ -38,7 +38,7 @@ all: ${PROJECT} @@ -48,7 +48,7 @@ all: ${PROJECT}
${PROJECT}: ${OBJECTS} Makefile ${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@" @echo " HOSTLD $@"
@ -93,3 +88,19 @@
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
@echo "Built $@ successfully" @echo "Built $@ successfully"
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
--- a/tools/nxp/plat_fiptool/plat_fiptool.mk 2023-05-20 22:28:28.079945619 +0200
+++ b/tools/nxp/plat_fiptool/plat_fiptool.mk 2023-05-20 22:26:59.443307771 +0200
@@ -22,11 +22,11 @@ INCLUDE_PATHS += -I${PLAT_DEF_UUID_OID_C
$(shell rm ${PLAT_DEF_UUID_CONFIG_FILE_PATH}/${PLAT_DEF_UUID_CONFIG_FILE_NAME}.o)
ifeq (${PLAT_DEF_OID},yes)
-HOSTCCFLAGS += -DPLAT_DEF_OID
+override HOSTCCFLAGS += -DPLAT_DEF_OID
endif
ifeq (${PLAT_DEF_UUID},yes)
-HOSTCCFLAGS += -DPLAT_DEF_FIP_UUID
+override HOSTCCFLAGS += -DPLAT_DEF_FIP_UUID
PLAT_OBJECTS += ${PLAT_DEF_UUID_CONFIG_FILE_PATH}/${PLAT_DEF_UUID_CONFIG_FILE_NAME}.o
endif

View file

@ -11,14 +11,14 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
tools/nxp/pbl_ch3.mk | 5 ----- tools/nxp/pbl_ch3.mk | 5 -----
2 files changed, 8 deletions(-) 2 files changed, 8 deletions(-)
--- a/tools/nxp/pbl_ch2.mk --- a/tools/nxp/create_pbl/pbl_ch2.mk
+++ b/tools/nxp/pbl_ch2.mk +++ b/tools/nxp/create_pbl/pbl_ch2.mk
@@ -19,8 +19,6 @@ ifeq ($(RCW),"") @@ -19,8 +19,6 @@ ifeq ($(RCW),"")
else else
# Generate header for bl2.bin # Generate header for bl2.bin
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE} $(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
- # Compile create_pbl tool - # Compile create_pbl tool
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\ - ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
# Add bl2.bin to RCW # Add bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\ ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\ -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\
@ -26,18 +26,18 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}" ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
else else
# -a option appends the image for Chassis 3 devices in case of non secure boot # -a option appends the image for Chassis 3 devices in case of non secure boot
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH}; - ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \ ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \
-o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ; -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;
# Swapping of RCW is required for QSPi Chassis 2 devices # Swapping of RCW is required for QSPi Chassis 2 devices
--- a/tools/nxp/pbl_ch3.mk --- a/tools/nxp/create_pbl/pbl_ch3.mk
+++ b/tools/nxp/pbl_ch3.mk +++ b/tools/nxp/create_pbl/pbl_ch3.mk
@@ -26,9 +26,6 @@ else @@ -26,9 +26,6 @@ else
# Generate header for bl2.bin # Generate header for bl2.bin
$(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE} $(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE}
- # Compile create_pbl tool - # Compile create_pbl tool
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\ - ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};\
- -
# Add Block Copy command for bl2.bin to RCW # Add Block Copy command for bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\ ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\
@ -46,7 +46,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
ifeq ($(RCW),"") ifeq ($(RCW),"")
${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}" ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}"
else else
- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH}; - ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${CREATE_PBL_TOOL_PATH};
- -
# Add Block Copy command and populate boot loc ptrfor bl2.bin to RCW # Add Block Copy command and populate boot loc ptrfor bl2.bin to RCW
${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \ ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \

View file

@ -0,0 +1,232 @@
From 8c6a66feb721f18c930c7df03d1fbb7304107af6 Mon Sep 17 00:00:00 2001
From: Wojciech Dubowik <Wojciech.Dubowik@protonmail.ch>
Date: Thu, 20 Apr 2023 16:21:25 +0200
Subject: [PATCH] tfa-layerscape: Restore ls1012afrdm support
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@protonmail.ch>
---
plat/nxp/soc-ls1012a/ls1012afrdm/ddr_init.c | 34 +++++++
plat/nxp/soc-ls1012a/ls1012afrdm/plat_def.h | 92 +++++++++++++++++++
plat/nxp/soc-ls1012a/ls1012afrdm/platform.mk | 25 +++++
.../soc-ls1012a/ls1012afrdm/platform_def.h | 13 +++
plat/nxp/soc-ls1012a/ls1012afrdm/policy.h | 16 ++++
5 files changed, 180 insertions(+)
create mode 100644 plat/nxp/soc-ls1012a/ls1012afrdm/ddr_init.c
create mode 100644 plat/nxp/soc-ls1012a/ls1012afrdm/plat_def.h
create mode 100644 plat/nxp/soc-ls1012a/ls1012afrdm/platform.mk
create mode 100644 plat/nxp/soc-ls1012a/ls1012afrdm/platform_def.h
create mode 100644 plat/nxp/soc-ls1012a/ls1012afrdm/policy.h
diff --git a/plat/nxp/soc-ls1012a/ls1012afrdm/ddr_init.c b/plat/nxp/soc-ls1012a/ls1012afrdm/ddr_init.c
new file mode 100644
index 000000000..8cb518540
--- /dev/null
+++ b/plat/nxp/soc-ls1012a/ls1012afrdm/ddr_init.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2018-2022 NXP
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <common/debug.h>
+#include <fsl_mmdc.h>
+
+#include <platform_def.h>
+
+long long init_ddr(void)
+{
+ static const struct fsl_mmdc_info mparam = {
+ .mdctl = U(0x04180000),
+ .mdpdc = U(0x00030035),
+ .mdotc = U(0x12554000),
+ .mdcfg0 = U(0xbabf7954),
+ .mdcfg1 = U(0xdb328f64),
+ .mdcfg2 = U(0x01ff00db),
+ .mdmisc = U(0x00001680),
+ .mdref = U(0x0f3c8000),
+ .mdrwd = U(0x00002000),
+ .mdor = U(0x00bf1023),
+ .mdasp = U(0x0000003f),
+ .mpodtctrl = U(0x0000022a),
+ .mpzqhwctrl = U(0xa1390003),
+ };
+
+ mmdc_init(&mparam, NXP_DDR_ADDR);
+ NOTICE("DDR Init Done\n");
+
+ return NXP_DRAM0_SIZE;
+}
diff --git a/plat/nxp/soc-ls1012a/ls1012afrdm/plat_def.h b/plat/nxp/soc-ls1012a/ls1012afrdm/plat_def.h
new file mode 100644
index 000000000..eb745a0a3
--- /dev/null
+++ b/plat/nxp/soc-ls1012a/ls1012afrdm/plat_def.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2022 NXP
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLAT_DEF_H
+#define PLAT_DEF_H
+
+#include <arch.h>
+/*
+ * Required without TBBR.
+ * To include the defines for DDR PHY
+ * Images.
+ */
+#include <tbbr_img_def.h>
+
+#include <policy.h>
+#include <soc.h>
+
+/* DDR Related definition */
+#define PLAT_DEF_DRAM0_SIZE 0x20000000 /* 512 MB */
+
+#define NXP_SYSCLK_FREQ 125000000
+#define NXP_DDRCLK_FREQ 100000000
+
+/* UART related definition */
+#define NXP_CONSOLE_ADDR NXP_UART_ADDR
+#define NXP_CONSOLE_BAUDRATE 115200
+
+#define NXP_SPD_EEPROM0 0x51
+
+/* Size of cacheable stacks */
+#if defined(IMAGE_BL2)
+#if defined(TRUSTED_BOARD_BOOT)
+#define PLATFORM_STACK_SIZE 0x2000
+#else
+#define PLATFORM_STACK_SIZE 0x1000
+#endif
+#elif defined(IMAGE_BL31)
+#define PLATFORM_STACK_SIZE 0x1000
+#endif
+
+/* SD block buffer */
+#define NXP_SD_BLOCK_BUF_SIZE (0x00100000)
+#define NXP_SD_BLOCK_BUF_ADDR ULL(0x80000000)
+
+#define BL2_LIMIT (NXP_OCRAM_ADDR + NXP_OCRAM_SIZE)
+
+/* IO defines as needed by IO driver framework */
+#define MAX_IO_DEVICES 3
+#define MAX_IO_BLOCK_DEVICES 1
+#define MAX_IO_HANDLES 4
+
+/*
+ * FIP image defines - Offset at which FIP Image would be present
+ * Image would include Bl31 , Bl33 and Bl32 (optional)
+ */
+#ifdef POLICY_FUSE_PROVISION
+#define MAX_FIP_DEVICES 2
+#endif
+
+#ifndef MAX_FIP_DEVICES
+#define MAX_FIP_DEVICES 1
+#endif
+
+#ifdef PLAT_FIP_OFFSET
+#undef PLAT_FIP_OFFSET
+#endif
+#ifdef PLAT_FIP_MAX_SIZE
+#undef PLAT_FIP_MAX_SIZE
+#endif
+#define PLAT_FIP_OFFSET 0x60000
+#define PLAT_FIP_MAX_SIZE 0x170000
+
+/*
+ * ID of the secure physical generic timer interrupt used by the BL32.
+ */
+#define BL32_IRQ_SEC_PHY_TIMER 29
+
+/*
+ * Define properties of Group 1 Secure and Group 0 interrupts as per GICv3
+ * terminology. On a GICv2 system or mode, the lists will be merged and treated
+ * as Group 0 interrupts.
+ */
+#define PLAT_LS_G1S_IRQ_PROPS(grp) \
+ INTR_PROP_DESC(BL32_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \
+ GIC_INTR_CFG_LEVEL)
+
+#define PLAT_LS_G0_IRQ_PROPS(grp)
+
+#endif
diff --git a/plat/nxp/soc-ls1012a/ls1012afrdm/platform.mk b/plat/nxp/soc-ls1012a/ls1012afrdm/platform.mk
new file mode 100644
index 000000000..270e92420
--- /dev/null
+++ b/plat/nxp/soc-ls1012a/ls1012afrdm/platform.mk
@@ -0,0 +1,25 @@
+#
+# Copyright 2018-2022 NXP
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# board-specific build parameters
+BOOT_MODE := qspi
+BOARD := ls1012afrdm
+
+# DDR Compilation Configs
+DDRC_NUM_CS := 1
+
+# On-Board Flash Details
+QSPI_FLASH_SZ := 0x4000000
+
+BL2_SOURCES += ${BOARD_PATH}/ddr_init.c
+
+SUPPORTED_BOOT_MODE := qspi
+
+# Adding platform board build info
+include plat/nxp/common/plat_make_helper/plat_common_def.mk
+
+# Adding SoC build info
+include plat/nxp/soc-ls1012a/soc.mk
diff --git a/plat/nxp/soc-ls1012a/ls1012afrdm/platform_def.h b/plat/nxp/soc-ls1012a/ls1012afrdm/platform_def.h
new file mode 100644
index 000000000..7daf1c02c
--- /dev/null
+++ b/plat/nxp/soc-ls1012a/ls1012afrdm/platform_def.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2022 NXP
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLATFORM_DEF_H
+#define PLATFORM_DEF_H
+
+#include <plat_def.h>
+#include <plat_default_def.h>
+
+#endif /* PLATFORM_DEF_H */
diff --git a/plat/nxp/soc-ls1012a/ls1012afrdm/policy.h b/plat/nxp/soc-ls1012a/ls1012afrdm/policy.h
new file mode 100644
index 000000000..a782d01c7
--- /dev/null
+++ b/plat/nxp/soc-ls1012a/ls1012afrdm/policy.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2018-2022 NXP
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef POLICY_H
+#define POLICY_H
+
+/*
+ * Set this to 0x0 to leave the default SMMU page size in sACR
+ * Set this to 0x1 to change the SMMU page size to 64K
+ */
+#define POLICY_SMMU_PAGESZ_64K 0x0
+
+#endif /* POLICY_H */
--
2.34.1

View file

@ -27,6 +27,9 @@ araknis,an-700-ap-i-ac|\
arduino,yun|\ arduino,yun|\
buffalo,bhr-4grv2|\ buffalo,bhr-4grv2|\
devolo,magic-2-wifi|\ devolo,magic-2-wifi|\
dlink,dir-859-a1|\
dlink,dir-859-a3|\
dlink,dir-869-a1|\
engenius,eap1200h|\ engenius,eap1200h|\
engenius,eap1750h|\ engenius,eap1750h|\
engenius,eap300-v2|\ engenius,eap300-v2|\

View file

@ -52,6 +52,10 @@ xiaomi,redmi-router-ax6000-ubootmod)
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1" ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1" ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
;; ;;
zyxel,ex5601-t0)
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
;;
esac esac
config_load ubootenv config_load ubootenv

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=uboot-layerscape PKG_NAME:=uboot-layerscape
PKG_VERSION:=21.08 PKG_VERSION:=lf-6.1.1-1.0.0
PKG_RELEASE:=7 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot PKG_SOURCE_URL:=https://github.com/nxp-qoriq/u-boot
PKG_SOURCE_VERSION:=LSDK-21.08 PKG_SOURCE_VERSION:=lf-6.1.1-1.0.0
PKG_MIRROR_HASH:=54909a98bdcc26c7f9b35b35fcae09b977ecbf044be7bffa6dad9306c47cccf6 PKG_MIRROR_HASH:=f4a3a262fd8923af72dede0348a512c05b756e3925279553eaf1c6667b186fb4
include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View file

@ -1,33 +0,0 @@
Index: uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
===================================================================
--- uboot-layerscape-lf-6.1.1-1.0.0.orig/arch/arm/cpu/armv8/sec_firmware.c
+++ uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
@@ -473,12 +473,6 @@ int fdt_fixup_kaslr(void *fdt)
return 0;
}
- ret = sec_firmware_get_random(rand, 8);
- if (ret < 0) {
- printf("WARNING: No random number to set kaslr-seed\n");
- return 0;
- }
-
err = fdt_check_header(fdt);
if (err < 0) {
printf("fdt_chosen: %s\n", fdt_strerror(err));
@@ -490,6 +484,15 @@ int fdt_fixup_kaslr(void *fdt)
if (nodeoffset < 0)
return 0;
+ if (fdt_find_or_add_subnode(fdt, nodeoffset, "kaslr-seed"))
+ return 0;
+
+ ret = sec_firmware_get_random(rand, 8);
+ if (ret < 0) {
+ printf("WARNING: No random number to set kaslr-seed\n");
+ return 0;
+ }
+
err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand,
sizeof(rand));
if (err < 0) {

View file

@ -1,8 +0,0 @@
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -1,5 +1,4 @@
CONFIG_ARM=y
-CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_MALLOC_F_LEN=0x6000

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=intel-microcode PKG_NAME:=intel-microcode
PKG_VERSION:=20221108 PKG_VERSION:=20230512
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz
PKG_SOURCE_URL:=@DEBIAN/pool/non-free/i/intel-microcode/ PKG_SOURCE_URL:=@DEBIAN/pool/non-free-firmware/i/intel-microcode/
PKG_HASH:=9c40fc5cbb386a4e1154f8f316422b28fccc9eaabdea707a80643f9bed3f9064 PKG_HASH:=e6717a42d7b6e92280565fbb180cd0d11bc5d14874ef06ff1bed2b7a11d17c67
PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1
PKG_BUILD_DEPENDS:=iucode-tool/host PKG_BUILD_DEPENDS:=iucode-tool/host

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=fman-ucode PKG_NAME:=fman-ucode
PKG_VERSION:=21.08 PKG_VERSION:=lf-6.1.1-1.0.0
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/NXP/qoriq-fm-ucode.git PKG_SOURCE_URL:=https://github.com/nxp-qoriq/qoriq-fm-ucode
PKG_SOURCE_VERSION:=LSDK-21.08 PKG_SOURCE_VERSION:=lf-6.1.1-1.0.0
PKG_MIRROR_HASH:=fc3c249c20b823e9554764f875c3d600b05f2e3659262d79f081e6765e891c96 PKG_MIRROR_HASH:=3614200837945460374570a48822a3efb96a64b93724e7f973e61008baeccf3a
PKG_FLAGS:=nonshared PKG_FLAGS:=nonshared

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ls-rcw PKG_NAME:=ls-rcw
PKG_VERSION:=21.08 PKG_VERSION:=lf-6.1.1-1.0.0
PKG_RELEASE:=4 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/rcw PKG_SOURCE_URL:=https://github.com/nxp-qoriq/rcw
PKG_SOURCE_VERSION:=LSDK-21.08 PKG_SOURCE_VERSION:=lf-6.1.1-1.0.0
PKG_MIRROR_HASH:=5b6ae3937d8c64f24c2d09d21e892e60b9f60de3573ca64ef19fa71072e6e346 PKG_MIRROR_HASH:=3127285549a0a7dd3cded20c2fbfb67b06943faa8dab529f61936dc1bea177db
PKG_FLAGS:=nonshared PKG_FLAGS:=nonshared

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=ppfe PKG_NAME:=ppfe
PKG_VERSION:=21.08 PKG_VERSION:=lf-6.1.1-1.0.0
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/NXP/qoriq-engine-pfe-bin.git PKG_SOURCE_URL:=https://github.com/nxp-qoriq/qoriq-engine-pfe-bin
PKG_SOURCE_VERSION:=LSDK-21.08 PKG_SOURCE_VERSION:=lf-6.1.1-1.0.0
PKG_MIRROR_HASH:=f2591b12bc02dbfcf113dcb79cce2fc703d8492b7309ad75b3c4915b76966c64 PKG_MIRROR_HASH:=eb1e3efe08980e70594060c84c1620a1dde53e00e96bae63d15dceb236c0bfa8
PKG_FLAGS:=nonshared PKG_FLAGS:=nonshared

View file

@ -897,10 +897,12 @@ define KernelPackage/crypto-sha1/mpc85xx
AUTOLOAD+=$(call AutoLoad,09,sha1-ppc-spe) AUTOLOAD+=$(call AutoLoad,09,sha1-ppc-spe)
endef endef
ifndef CONFIG_TARGET_uml
define KernelPackage/crypto-sha1/x86_64 define KernelPackage/crypto-sha1/x86_64
FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3) AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3)
endef endef
endif
ifdef KernelPackage/crypto-sha1/$(ARCH) ifdef KernelPackage/crypto-sha1/$(ARCH)
KernelPackage/crypto-sha1/$(CRYPTO_TARGET)=\ KernelPackage/crypto-sha1/$(CRYPTO_TARGET)=\
@ -935,10 +937,12 @@ define KernelPackage/crypto-sha256/mpc85xx
AUTOLOAD+=$(call AutoLoad,09,sha256-ppc-spe) AUTOLOAD+=$(call AutoLoad,09,sha256-ppc-spe)
endef endef
ifndef CONFIG_TARGET_uml
define KernelPackage/crypto-sha256/x86_64 define KernelPackage/crypto-sha256/x86_64
FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3) AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3)
endef endef
endif
ifdef KernelPackage/crypto-sha256/$(ARCH) ifdef KernelPackage/crypto-sha256/$(ARCH)
KernelPackage/crypto-sha256/$(CRYPTO_TARGET)=\ KernelPackage/crypto-sha256/$(CRYPTO_TARGET)=\
@ -977,10 +981,12 @@ endef
KernelPackage/crypto-sha512/tegra=$(KernelPackage/crypto-sha512/arm) KernelPackage/crypto-sha512/tegra=$(KernelPackage/crypto-sha512/arm)
ifndef CONFIG_TARGET_uml
define KernelPackage/crypto-sha512/x86_64 define KernelPackage/crypto-sha512/x86_64
FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3) AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3)
endef endef
endif
ifdef KernelPackage/crypto-sha512/$(ARCH) ifdef KernelPackage/crypto-sha512/$(ARCH)
KernelPackage/crypto-sha512/$(CRYPTO_TARGET)=\ KernelPackage/crypto-sha512/$(CRYPTO_TARGET)=\

View file

@ -10,7 +10,7 @@ FS_MENU:=Filesystems
define KernelPackage/fs-9p define KernelPackage/fs-9p
SUBMENU:=$(FS_MENU) SUBMENU:=$(FS_MENU)
TITLE:=Plan 9 Resource Sharing Support TITLE:=Plan 9 Resource Sharing Support
DEPENDS:=+kmod-9pnet DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs
KCONFIG:=\ KCONFIG:=\
CONFIG_9P_FS \ CONFIG_9P_FS \
CONFIG_9P_FS_POSIX_ACL=n \ CONFIG_9P_FS_POSIX_ACL=n \
@ -269,7 +269,9 @@ define KernelPackage/fs-fscache
CONFIG_FSCACHE_OBJECT_LIST=n \ CONFIG_FSCACHE_OBJECT_LIST=n \
CONFIG_CACHEFILES \ CONFIG_CACHEFILES \
CONFIG_CACHEFILES_DEBUG=n \ CONFIG_CACHEFILES_DEBUG=n \
CONFIG_CACHEFILES_HISTOGRAM=n CONFIG_CACHEFILES_HISTOGRAM=n \
CONFIG_CACHEFILES_ERROR_INJECTION=n@ge5.17 \
CONFIG_CACHEFILES_ONDEMAND=n@ge5.19
FILES:= \ FILES:= \
$(LINUX_DIR)/fs/fscache/fscache.ko \ $(LINUX_DIR)/fs/fscache/fscache.ko \
$(LINUX_DIR)/fs/cachefiles/cachefiles.ko $(LINUX_DIR)/fs/cachefiles/cachefiles.ko

View file

@ -52,7 +52,7 @@ define KernelPackage/hwmon-adt7410
$(LINUX_DIR)/drivers/hwmon/adt7x10.ko \ $(LINUX_DIR)/drivers/hwmon/adt7x10.ko \
$(LINUX_DIR)/drivers/hwmon/adt7410.ko $(LINUX_DIR)/drivers/hwmon/adt7410.ko
AUTOLOAD:=$(call AutoLoad,60,adt7x10 adt7410) AUTOLOAD:=$(call AutoLoad,60,adt7x10 adt7410)
$(call AddDepends/hwmon,+kmod-i2c-core) $(call AddDepends/hwmon,+kmod-i2c-core +LINUX_6_1:kmod-regmap-core)
endef endef
define KernelPackage/hwmon-adt7410/description define KernelPackage/hwmon-adt7410/description

View file

@ -84,6 +84,20 @@ endef
$(eval $(call KernelPackage,i2c-algo-pcf)) $(eval $(call KernelPackage,i2c-algo-pcf))
I2C_CCGS_UCSI_MODULES:= \
CONFIG_I2C_CCGX_UCSI:drivers/i2c/busses/i2c-ccgx-ucsi
define KernelPackage/i2c-ccgs-ucsi
$(call i2c_defaults,$(I2C_CCGS_UCSI_MODULES),58)
TITLE:=Cypress CCGx Type-C controller
DEPENDS:=+kmod-i2c-core +kmod-regmap-core
HIDDEN:=y
endef
$(eval $(call KernelPackage,i2c-ccgs-ucsi))
I2C_DWCORE_MODULES:= \ I2C_DWCORE_MODULES:= \
CONFIG_I2C_DESIGNWARE_CORE:drivers/i2c/busses/i2c-designware-core CONFIG_I2C_DESIGNWARE_CORE:drivers/i2c/busses/i2c-designware-core
@ -103,7 +117,7 @@ I2C_DWPCI_MODULES:= \
define KernelPackage/i2c-designware-pci define KernelPackage/i2c-designware-pci
$(call i2c_defaults,$(I2C_DWPCI_MODULES),59) $(call i2c_defaults,$(I2C_DWPCI_MODULES),59)
TITLE:=Synopsys DesignWare PCI TITLE:=Synopsys DesignWare PCI
DEPENDS:=@PCI_SUPPORT +kmod-i2c-designware-core DEPENDS:=@PCI_SUPPORT +kmod-i2c-designware-core +kmod-i2c-ccgs-ucsi
endef endef
define KernelPackage/i2c-designware-pci/description define KernelPackage/i2c-designware-pci/description

View file

@ -134,6 +134,7 @@ define KernelPackage/lib-zstd
FILES:= \ FILES:= \
$(LINUX_DIR)/crypto/zstd.ko \ $(LINUX_DIR)/crypto/zstd.ko \
$(LINUX_DIR)/lib/xxhash.ko \ $(LINUX_DIR)/lib/xxhash.ko \
$(LINUX_DIR)/lib/zstd/zstd_common.ko@ge6.1 \
$(LINUX_DIR)/lib/zstd/zstd_compress.ko \ $(LINUX_DIR)/lib/zstd/zstd_compress.ko \
$(LINUX_DIR)/lib/zstd/zstd_decompress.ko $(LINUX_DIR)/lib/zstd/zstd_decompress.ko
AUTOLOAD:=$(call AutoProbe,xxhash zstd zstd_compress zstd_decompress) AUTOLOAD:=$(call AutoProbe,xxhash zstd zstd_compress zstd_decompress)

View file

@ -1448,13 +1448,15 @@ $(eval $(call KernelPackage,sfc-falcon))
define KernelPackage/wwan define KernelPackage/wwan
SUBMENU:=$(NETWORK_DEVICES_MENU) SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=WWAN Driver Core TITLE:=WWAN Driver Core
KCONFIG:=CONFIG_WWAN KCONFIG:= \
CONFIG_WWAN \
CONFIG_WWAN_DEBUGFS=y@ge5.17
FILES:=$(LINUX_DIR)/drivers/net/wwan/wwan.ko FILES:=$(LINUX_DIR)/drivers/net/wwan/wwan.ko
AUTOLOAD:=$(call AutoProbe,wwan) AUTOLOAD:=$(call AutoProbe,wwan)
endef endef
define KernelPackage/wwan/description define KernelPackage/wwan/description
his driver provides a common framework for WWAN drivers. This driver provides a common framework for WWAN drivers.
endef endef
$(eval $(call KernelPackage,wwan)) $(eval $(call KernelPackage,wwan))

View file

@ -1165,15 +1165,15 @@ define KernelPackage/nft-offload
DEPENDS:=@IPV6 +kmod-nf-flow +kmod-nft-nat DEPENDS:=@IPV6 +kmod-nf-flow +kmod-nft-nat
KCONFIG:= \ KCONFIG:= \
CONFIG_NF_FLOW_TABLE_INET \ CONFIG_NF_FLOW_TABLE_INET \
CONFIG_NF_FLOW_TABLE_IPV4 \ CONFIG_NF_FLOW_TABLE_IPV4@lt5.17 \
CONFIG_NF_FLOW_TABLE_IPV6 \ CONFIG_NF_FLOW_TABLE_IPV6@lt5.17 \
CONFIG_NFT_FLOW_OFFLOAD CONFIG_NFT_FLOW_OFFLOAD
FILES:= \ FILES:= \
$(LINUX_DIR)/net/netfilter/nf_flow_table_inet.ko \ $(LINUX_DIR)/net/netfilter/nf_flow_table_inet.ko \
$(LINUX_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko \ $(LINUX_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko@lt5.17 \
$(LINUX_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko \ $(LINUX_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko@lt5.17 \
$(LINUX_DIR)/net/netfilter/nft_flow_offload.ko $(LINUX_DIR)/net/netfilter/nft_flow_offload.ko
AUTOLOAD:=$(call AutoProbe,nf_flow_table_inet nf_flow_table_ipv4 nf_flow_table_ipv6 nft_flow_offload) AUTOLOAD:=$(call AutoProbe,nf_flow_table_inet nf_flow_table_ipv4@lt5.17 nf_flow_table_ipv6@lt5.17 nft_flow_offload)
endef endef
$(eval $(call KernelPackage,nft-offload)) $(eval $(call KernelPackage,nft-offload))

View file

@ -46,6 +46,7 @@ define KernelPackage/bonding
SUBMENU:=$(NETWORK_SUPPORT_MENU) SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=Ethernet bonding driver TITLE:=Ethernet bonding driver
KCONFIG:=CONFIG_BONDING KCONFIG:=CONFIG_BONDING
DEPENDS:=PACKAGE_kmod-tls:kmod-tls
FILES:=$(LINUX_DIR)/drivers/net/bonding/bonding.ko FILES:=$(LINUX_DIR)/drivers/net/bonding/bonding.ko
AUTOLOAD:=$(call AutoLoad,40,bonding) AUTOLOAD:=$(call AutoLoad,40,bonding)
MODPARAMS.bonding:=max_bonds=0 MODPARAMS.bonding:=max_bonds=0
@ -91,7 +92,9 @@ define KernelPackage/vxlan
+kmod-udptunnel4 \ +kmod-udptunnel4 \
+IPV6:kmod-udptunnel6 +IPV6:kmod-udptunnel6
KCONFIG:=CONFIG_VXLAN KCONFIG:=CONFIG_VXLAN
FILES:=$(LINUX_DIR)/drivers/net/vxlan.ko FILES:= \
$(LINUX_DIR)/drivers/net/vxlan.ko@lt5.18 \
$(LINUX_DIR)/drivers/net/vxlan/vxlan.ko@ge5.18
AUTOLOAD:=$(call AutoLoad,13,vxlan) AUTOLOAD:=$(call AutoLoad,13,vxlan)
endef endef
@ -1042,6 +1045,24 @@ endef
$(eval $(call KernelPackage,tcp-bbr)) $(eval $(call KernelPackage,tcp-bbr))
define KernelPackage/tls
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=In-kernel TLS Support with HW Offload
KCONFIG:=CONFIG_TLS \
CONFIG_TLS_DEVICE=y
FILES:=$(LINUX_DIR)/net/tls/tls.ko
AUTOLOAD:=$(call AutoProbe,tls)
endef
define KernelPackage/tls/description
Kernel module for in-kernel TLS protocol support and hw offload
(to supported interfaces).
This allows symmetric encryption handling of the TLS protocol to
be done in-kernel and it's HW offload when available.
endef
$(eval $(call KernelPackage,tls))
define KernelPackage/tcp-hybla define KernelPackage/tcp-hybla
SUBMENU:=$(NETWORK_SUPPORT_MENU) SUBMENU:=$(NETWORK_SUPPORT_MENU)
@ -1295,7 +1316,8 @@ define KernelPackage/9pnet
CONFIG_NET_9P \ CONFIG_NET_9P \
CONFIG_NET_9P_DEBUG=n \ CONFIG_NET_9P_DEBUG=n \
CONFIG_NET_9P_XEN=n \ CONFIG_NET_9P_XEN=n \
CONFIG_NET_9P_VIRTIO CONFIG_NET_9P_VIRTIO \
CONFIG_NET_9P_FD=n@ge5.17
FILES:= \ FILES:= \
$(LINUX_DIR)/net/9p/9pnet.ko \ $(LINUX_DIR)/net/9p/9pnet.ko \
$(LINUX_DIR)/net/9p/9pnet_virtio.ko $(LINUX_DIR)/net/9p/9pnet_virtio.ko

View file

@ -57,7 +57,8 @@ define KernelPackage/bluetooth
$(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \ $(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \
$(LINUX_DIR)/drivers/bluetooth/btusb.ko \ $(LINUX_DIR)/drivers/bluetooth/btusb.ko \
$(LINUX_DIR)/drivers/bluetooth/btintel.ko \ $(LINUX_DIR)/drivers/bluetooth/btintel.ko \
$(LINUX_DIR)/drivers/bluetooth/btrtl.ko $(LINUX_DIR)/drivers/bluetooth/btrtl.ko \
$(LINUX_DIR)/drivers/bluetooth/btmtk.ko@ge5.17
AUTOLOAD:=$(call AutoProbe,bluetooth rfcomm bnep hidp hci_uart btusb) AUTOLOAD:=$(call AutoProbe,bluetooth rfcomm bnep hidp hci_uart btusb)
endef endef

View file

@ -1155,7 +1155,9 @@ $(eval $(call KernelPackage,usb-net-aqc111))
define KernelPackage/usb-net-asix define KernelPackage/usb-net-asix
TITLE:=Kernel module for USB-to-Ethernet Asix convertors TITLE:=Kernel module for USB-to-Ethernet Asix convertors
DEPENDS:=+kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b DEPENDS:= \
+kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b \
+LINUX_6_1:kmod-phylink
KCONFIG:=CONFIG_USB_NET_AX8817X KCONFIG:=CONFIG_USB_NET_AX8817X
FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/asix.ko FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/asix.ko
AUTOLOAD:=$(call AutoProbe,asix) AUTOLOAD:=$(call AutoProbe,asix)

View file

@ -82,6 +82,8 @@ define KernelPackage/vfio
CONFIG_VFIO \ CONFIG_VFIO \
CONFIG_VFIO_NOIOMMU=n \ CONFIG_VFIO_NOIOMMU=n \
CONFIG_VFIO_MDEV=n CONFIG_VFIO_MDEV=n
MODPARAMS.vfio:=\
enable_unsafe_noiommu_mode=n
FILES:= \ FILES:= \
$(LINUX_DIR)/drivers/vfio/vfio.ko \ $(LINUX_DIR)/drivers/vfio/vfio.ko \
$(LINUX_DIR)/drivers/vfio/vfio_virqfd.ko \ $(LINUX_DIR)/drivers/vfio/vfio_virqfd.ko \
@ -102,7 +104,7 @@ define KernelPackage/vfio-pci
DEPENDS:=@TARGET_x86_64 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass DEPENDS:=@TARGET_x86_64 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass
KCONFIG:= \ KCONFIG:= \
CONFIG_VFIO_PCI \ CONFIG_VFIO_PCI \
CONFIG_VFIO_PCI_IGD=y CONFIG_VFIO_PCI_IGD=n
FILES:= \ FILES:= \
$(LINUX_DIR)/drivers/vfio/pci/vfio-pci-core.ko \ $(LINUX_DIR)/drivers/vfio/pci/vfio-pci-core.ko \
$(LINUX_DIR)/drivers/vfio/pci/vfio-pci.ko $(LINUX_DIR)/drivers/vfio/pci/vfio-pci.ko

View file

@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211 PKG_NAME:=mac80211
PKG_VERSION:=6.1.24 PKG_VERSION:=6.1.24
PKG_RELEASE:=2 PKG_RELEASE:=3
# PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ # PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648 PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648

View file

@ -1,64 +0,0 @@
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
Date: Mon, 8 Jun 2015 16:11:40 +0200
Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is needed by OpenWrt which expects all PHYs to be created after
module loads successfully.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -459,6 +459,7 @@ struct brcmf_fw {
u32 curpos;
unsigned int board_index;
void (*done)(struct device *dev, int err, struct brcmf_fw_request *req);
+ struct completion *completion;
};
#ifdef CONFIG_EFI
@@ -686,6 +687,8 @@ static void brcmf_fw_request_done(const
fwctx->req = NULL;
}
fwctx->done(fwctx->dev, ret, fwctx->req);
+ if (fwctx->completion)
+ complete(fwctx->completion);
kfree(fwctx);
}
@@ -751,6 +754,8 @@ int brcmf_fw_get_firmwares(struct device
{
struct brcmf_fw_item *first = &req->items[0];
struct brcmf_fw *fwctx;
+ struct completion completion;
+ unsigned long time_left;
char *alt_path = NULL;
int ret;
@@ -768,6 +773,9 @@ int brcmf_fw_get_firmwares(struct device
fwctx->dev = dev;
fwctx->req = req;
fwctx->done = fw_cb;
+
+ init_completion(&completion);
+ fwctx->completion = &completion;
/* First try alternative board-specific path if any */
if (fwctx->req->board_types[0])
@@ -787,6 +795,12 @@ int brcmf_fw_get_firmwares(struct device
if (ret < 0)
brcmf_fw_request_done(NULL, fwctx);
+
+ time_left = wait_for_completion_timeout(&completion,
+ msecs_to_jiffies(5000));
+ if (!time_left && fwctx)
+ fwctx->completion = NULL;
+
return 0;
}

View file

@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libcap PKG_NAME:=libcap
PKG_VERSION:=2.68 PKG_VERSION:=2.69
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2 PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
PKG_HASH:=90be3b6d41be5f81ae4b03ec76012b0d27c829293684f6c05b65d5f9cce724b2 PKG_HASH:=f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb
PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at> PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at>
PKG_LICENSE:=GPL-2.0-only PKG_LICENSE:=GPL-2.0-only

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=json-c PKG_NAME:=json-c
PKG_VERSION:=0.16 PKG_VERSION:=0.16
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz
PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/ PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/

View file

@ -0,0 +1,184 @@
From 6eca65617aacd19f4928acd5766b8dd20eda0b34 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 13 Aug 2022 20:37:03 -0700
Subject: [PATCH] Fix build with clang-15+
Fixes
json_util.c:63:35: error: a function declaration without a prototype is deprecated in all versions of C [-We
rror,-Wstrict-prototypes]
const char *json_util_get_last_err()
^
void
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
json_util.c | 2 +-
tests/test1.c | 6 +++---
tests/test4.c | 2 +-
tests/test_cast.c | 2 +-
tests/test_charcase.c | 2 +-
tests/test_parse.c | 8 ++++----
tests/test_printbuf.c | 4 ++--
tests/test_util_file.c | 6 +++---
8 files changed, 16 insertions(+), 16 deletions(-)
--- a/json_util.c
+++ b/json_util.c
@@ -60,7 +60,7 @@ static int _json_object_to_fd(int fd, st
static char _last_err[256] = "";
-const char *json_util_get_last_err()
+const char *json_util_get_last_err(void)
{
if (_last_err[0] == '\0')
return NULL;
--- a/tests/test1.c
+++ b/tests/test1.c
@@ -58,7 +58,7 @@ static const char *to_json_string(json_o
#endif
json_object *make_array(void);
-json_object *make_array()
+json_object *make_array(void)
{
json_object *my_array;
@@ -74,7 +74,7 @@ json_object *make_array()
}
void test_array_del_idx(void);
-void test_array_del_idx()
+void test_array_del_idx(void)
{
int rc;
size_t ii;
@@ -140,7 +140,7 @@ void test_array_del_idx()
}
void test_array_list_expand_internal(void);
-void test_array_list_expand_internal()
+void test_array_list_expand_internal(void)
{
int rc;
size_t ii;
--- a/tests/test4.c
+++ b/tests/test4.c
@@ -28,7 +28,7 @@ void print_hex(const char *s)
}
static void test_lot_of_adds(void);
-static void test_lot_of_adds()
+static void test_lot_of_adds(void)
{
int ii;
char key[50];
--- a/tests/test_cast.c
+++ b/tests/test_cast.c
@@ -94,7 +94,7 @@ static void getit(struct json_object *ne
printf("new_obj.%s json_object_get_double()=%f\n", field, json_object_get_double(o));
}
-static void checktype_header()
+static void checktype_header(void)
{
printf("json_object_is_type: %s,%s,%s,%s,%s,%s,%s\n", json_type_to_name(json_type_null),
json_type_to_name(json_type_boolean), json_type_to_name(json_type_double),
--- a/tests/test_charcase.c
+++ b/tests/test_charcase.c
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
}
/* make sure only lowercase forms are parsed in strict mode */
-static void test_case_parse()
+static void test_case_parse(void)
{
struct json_tokener *tok;
json_object *new_obj;
--- a/tests/test_parse.c
+++ b/tests/test_parse.c
@@ -92,7 +92,7 @@ static void single_basic_parse(const cha
if (getenv("TEST_PARSE_CHUNKSIZE") != NULL)
single_incremental_parse(test_string, clear_serializer);
}
-static void test_basic_parse()
+static void test_basic_parse(void)
{
single_basic_parse("\"\003\"", 0);
single_basic_parse("/* hello */\"foo\"", 0);
@@ -195,7 +195,7 @@ static void test_basic_parse()
single_basic_parse("[18446744073709551616]", 1);
}
-static void test_utf8_parse()
+static void test_utf8_parse(void)
{
// json_tokener_parse doesn't support checking for byte order marks.
// It's the responsibility of the caller to detect and skip a BOM.
@@ -222,7 +222,7 @@ static int clear_serializer(json_object
return JSON_C_VISIT_RETURN_CONTINUE;
}
-static void test_verbose_parse()
+static void test_verbose_parse(void)
{
json_object *new_obj;
enum json_tokener_error error = json_tokener_success;
@@ -562,7 +562,7 @@ struct incremental_step
{NULL, -1, -1, json_tokener_success, 0},
};
-static void test_incremental_parse()
+static void test_incremental_parse(void)
{
json_object *new_obj;
enum json_tokener_error jerr;
--- a/tests/test_printbuf.c
+++ b/tests/test_printbuf.c
@@ -16,7 +16,7 @@ static void test_printbuf_memset_length(
#define __func__ __FUNCTION__
#endif
-static void test_basic_printbuf_memset()
+static void test_basic_printbuf_memset(void)
{
struct printbuf *pb;
@@ -29,7 +29,7 @@ static void test_basic_printbuf_memset()
printf("%s: end test\n", __func__);
}
-static void test_printbuf_memset_length()
+static void test_printbuf_memset_length(void)
{
struct printbuf *pb;
--- a/tests/test_util_file.c
+++ b/tests/test_util_file.c
@@ -35,7 +35,7 @@ static void test_read_fd_equal(const cha
#define PATH_MAX 256
#endif
-static void test_write_to_file()
+static void test_write_to_file(void)
{
json_object *jso;
@@ -231,7 +231,7 @@ static void test_read_valid_nested_with_
close(d);
}
-static void test_read_nonexistant()
+static void test_read_nonexistant(void)
{
const char *filename = "./not_present.json";
@@ -249,7 +249,7 @@ static void test_read_nonexistant()
}
}
-static void test_read_closed()
+static void test_read_closed(void)
{
// Test reading from a closed fd
int d = open("/dev/null", O_RDONLY, 0);

View file

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=libxml2 PKG_NAME:=libxml2
PKG_VERSION:=2.11.3 PKG_VERSION:=2.11.4
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION))
PKG_HASH:=f1acae1664bda006cd81bfc238238217043d586d06659d5c0e3d1bcebe040870 PKG_HASH:=737e1d7f8ab3f139729ca13a2494fd17bf30ddb4b7a427cf336252cab57f57f7
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING PKG_LICENSE_FILES:=COPYING

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=nettle PKG_NAME:=nettle
PKG_VERSION:=3.8.1 PKG_VERSION:=3.9
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_BUILD_FLAGS:=no-mips16 PKG_BUILD_FLAGS:=no-mips16
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/nettle PKG_SOURCE_URL:=@GNU/nettle
PKG_HASH:=364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe PKG_HASH:=0ee7adf5a7201610bb7fe0acbb7c9b3be83be44904dd35ebbcd965cd896bfeaa
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING PKG_LICENSE_FILES:=COPYING

View file

@ -1,6 +1,6 @@
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -4704,6 +4704,7 @@ $as_echo_n "checking build system compil @@ -4719,6 +4719,7 @@ $as_echo_n "checking build system compil
# remove anything that might look like compiler output to our "||" expression # remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF cat >conftest.c <<EOF
@ -8,7 +8,7 @@
int int
main () main ()
{ {
@@ -4736,6 +4737,7 @@ $as_echo_n "checking build system compil @@ -4751,6 +4752,7 @@ $as_echo_n "checking build system compil
# remove anything that might look like compiler output to our "||" expression # remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF cat >conftest.c <<EOF
@ -16,7 +16,7 @@
int int
main () main ()
{ {
@@ -4772,6 +4774,7 @@ $as_echo_n "checking build system compil @@ -4787,6 +4789,7 @@ $as_echo_n "checking build system compil
# remove anything that might look like compiler output to our "||" expression # remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF cat >conftest.c <<EOF
@ -24,7 +24,7 @@
int int
main () main ()
{ {
@@ -4822,6 +4825,7 @@ else @@ -4837,6 +4840,7 @@ else
gmp_cv_prog_exeext_for_build="$EXEEXT" gmp_cv_prog_exeext_for_build="$EXEEXT"
else else
cat >conftest.c <<EOF cat >conftest.c <<EOF

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=pcre2 PKG_NAME:=pcre2
PKG_VERSION:=10.37 PKG_VERSION:=10.42
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/pcre/$(PKG_NAME)/$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/PCRE2Project/pcre2/releases/download/$(PKG_NAME)-$(PKG_VERSION)
PKG_HASH:=4d95a96e8b80529893b4562be12648d798b957b1ba1aae39606bbc2ab956d270 PKG_HASH:=8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840
PKG_MAINTAINER:=Shane Peelar <lookatyouhacker@gmail.com> PKG_MAINTAINER:=Shane Peelar <lookatyouhacker@gmail.com>
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause

View file

@ -119,6 +119,7 @@ validate_section_dropbear()
'enable:bool:1' \ 'enable:bool:1' \
'Interface:string' \ 'Interface:string' \
'GatewayPorts:bool:0' \ 'GatewayPorts:bool:0' \
'ForceCommand:string' \
'RootPasswordAuth:bool:1' \ 'RootPasswordAuth:bool:1' \
'RootLogin:bool:1' \ 'RootLogin:bool:1' \
'rsakeyfile:file' \ 'rsakeyfile:file' \
@ -158,6 +159,7 @@ dropbear_instance()
procd_set_param command "$PROG" -F -P "$pid_file" procd_set_param command "$PROG" -F -P "$pid_file"
[ "${PasswordAuth}" -eq 0 ] && procd_append_param command -s [ "${PasswordAuth}" -eq 0 ] && procd_append_param command -s
[ "${GatewayPorts}" -eq 1 ] && procd_append_param command -a [ "${GatewayPorts}" -eq 1 ] && procd_append_param command -a
[ -n "${ForceCommand}" ] && procd_append_param command -c "${ForceCommand}"
[ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g [ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g
[ "${RootLogin}" -eq 0 ] && procd_append_param command -w [ "${RootLogin}" -eq 0 ] && procd_append_param command -w
if [ -n "${rsakeyfile}" ]; then if [ -n "${rsakeyfile}" ]; then

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd PKG_NAME:=lldpd
PKG_VERSION:=1.0.16 PKG_VERSION:=1.0.17
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/
PKG_HASH:=7753c6e31e938923185f4e10c4ab328929729e22ee4a9687d08881fb82c092ee PKG_HASH:=89ae691a4917ac9e0ec3b8b2c1e634cc402d43b804f98850c73bd1c7df380882
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be> PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=ISC PKG_LICENSE:=ISC

View file

@ -5,14 +5,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=busybox PKG_NAME:=busybox
PKG_VERSION:=1.36.0 PKG_VERSION:=1.36.1
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_FLAGS:=essential PKG_FLAGS:=essential
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.busybox.net/downloads \ PKG_SOURCE_URL:=https://www.busybox.net/downloads \
http://sources.buildroot.net http://sources.buildroot.net
PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_HASH:=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314
PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=f2fs-tools PKG_NAME:=f2fs-tools
PKG_VERSION:=1.15.0 PKG_VERSION:=1.16.0
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/
PKG_HASH:=147d471040b44900283ce2c935f1d35d13d7f40008e7cb8fab2b69f54da01a4f PKG_HASH:=208c7a07e95383fbd7b466b5681590789dcb41f41bf197369c41a95383b57c5e
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0-only PKG_LICENSE:=GPL-2.0-only
@ -143,7 +143,6 @@ Package/f2fsck-selinux/install = $(Package/f2fsck/install)
define Package/f2fs-tools/install define Package/f2fs-tools/install
$(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/f2fstat $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fibmap.f2fs $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fibmap.f2fs $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/parse.f2fs $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/parse.f2fs $(1)/usr/sbin
endef endef

View file

@ -1,88 +0,0 @@
From 9af8ee5baceab59d46154c96da62b52935f363fe Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Mon, 27 Jun 2022 20:43:11 +0200
Subject: [PATCH] configure.ac: fix AC_ARG_WITH
In the new version the configuration no longer respects the
--without/--with blkid/selinux parameters. Add the tests for
"with_blkid" and "with_selinux" back to configure.ac as described
in the manual.
Link: https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/External-Software.html
Fixes: c48335416a09 ("configure.ac: Enable cross-compilation")
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
configure.ac | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -39,12 +39,16 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign
# Test configure options.
AC_ARG_WITH([selinux],
- AS_HELP_STRING([--without-selinux],
- [Ignore presence of libselinux and disable selinux support]))
+ [AS_HELP_STRING([--without-selinux],
+ [Ignore presence of libselinux and disable selinux support])],
+ [],
+ [with_selinux=check])
AC_ARG_WITH([blkid],
- AS_HELP_STRING([--without-blkid],
- [Ignore presence of libblkid and disable blkid support]))
+ [AS_HELP_STRING([--without-blkid],
+ [Ignore presence of libblkid and disable blkid support])],
+ [],
+ [with_blkid=check])
# Checks for programs.
AC_PROG_CC
@@ -55,11 +59,17 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
[$PATH:/sbin])
# Checks for libraries.
-AC_CHECK_LIB([blkid], [blkid_probe_all],
- [AC_SUBST([libblkid_LIBS], ["-lblkid"])
- AC_DEFINE([HAVE_LIBBLKID], [1],
- [Define if you have libblkid])
- ], [], [])
+AS_IF([test "x$with_blkid" != xno],
+ [AC_CHECK_LIB([blkid], [blkid_probe_all],
+ [AC_SUBST([libblkid_LIBS], ["-lblkid"])
+ AC_DEFINE([HAVE_LIBBLKID], [1],
+ [Define if you have libblkid])
+ ],
+ [if test "x$with_blkid" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-blkid was given, but test for blkid failed])
+ fi
+ ], -lblkid)])
AC_CHECK_LIB([lzo2], [main],
[AC_SUBST([liblzo2_LIBS], ["-llzo2"])
@@ -73,11 +83,17 @@ AC_CHECK_LIB([lz4], [main],
[Define if you have liblz4])
], [], [])
-AC_CHECK_LIB([selinux], [getcon],
- [AC_SUBST([libselinux_LIBS], ["-lselinux"])
- AC_DEFINE([HAVE_LIBSELINUX], [1],
- [Define if you have libselinux])
- ], [], [])
+AS_IF([test "x$with_selinux" != xno],
+ [AC_CHECK_LIB([selinux], [getcon],
+ [AC_SUBST([libselinux_LIBS], ["-lselinux"])
+ AC_DEFINE([HAVE_LIBSELINUX], [1],
+ [Define if you have libselinux])
+ ],
+ [if test "x$with_selinux" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-selinux was given, but test for selinux failed])
+ fi
+ ], -lselinux)])
AC_CHECK_LIB([uuid], [uuid_clear],
[AC_SUBST([libuuid_LIBS], ["-luuid"])

View file

@ -1,80 +0,0 @@
From 821a1d3fcce31c234512a8f4dc4fc97dfbd7ae32 Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Mon, 4 Jul 2022 09:46:10 +0200
Subject: [PATCH] configure.ac: fix cross compilation
AC_CHECK_LIB seems to not work correctly with OpenWrt. Add possibility
to disable lz4 and lzo2 manually.
Fixes errors in the form of:
Package f2fsck is missing dependencies for the following libraries:
liblz4.so.1
liblzo2.so.2
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
configure.ac | 44 ++++++++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 10 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,18 @@ AC_ARG_WITH([blkid],
[],
[with_blkid=check])
+AC_ARG_WITH([lzo2],
+ [AS_HELP_STRING([--without-lzo2],
+ [Ignore presence of liblzo2 and disable lzo2 support])],
+ [],
+ [with_lzo2=check])
+
+AC_ARG_WITH([lz4],
+ [AS_HELP_STRING([--without-lz4],
+ [Ignore presence of liblz4 and disable lz4 support])],
+ [],
+ [with_lz4=check])
+
# Checks for programs.
AC_PROG_CC
AM_PROG_AR
@@ -71,17 +83,29 @@ AS_IF([test "x$with_blkid" != xno],
fi
], -lblkid)])
-AC_CHECK_LIB([lzo2], [main],
- [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
- AC_DEFINE([HAVE_LIBLZO2], [1],
- [Define if you have liblzo2])
- ], [], [])
-
-AC_CHECK_LIB([lz4], [main],
- [AC_SUBST([liblz4_LIBS], ["-llz4"])
- AC_DEFINE([HAVE_LIBLZ4], [1],
- [Define if you have liblz4])
- ], [], [])
+AS_IF([test "x$with_lzo2" != xno],
+ [AC_CHECK_LIB([lzo2], [main],
+ [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
+ AC_DEFINE([HAVE_LIBLZO2], [1],
+ [Define if you have liblzo2])
+ ],
+ [if test "x$with_lzo2" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-lzo2 was given, but test for lzo2 failed])
+ fi
+ ], -llzo2)])
+
+AS_IF([test "x$with_lz4" != xno],
+ [AC_CHECK_LIB([lz4], [main],
+ [AC_SUBST([liblz4_LIBS], ["-llz4"])
+ AC_DEFINE([HAVE_LIBLZ4], [1],
+ [Define if you have liblz4])
+ ],
+ [if test "x$with_lz4" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-lz4 was given, but test for lz4 failed])
+ fi
+ ], -llz4)])
AS_IF([test "x$with_selinux" != xno],
[AC_CHECK_LIB([selinux], [getcon],

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=util-linux PKG_NAME:=util-linux
PKG_VERSION:=2.39 PKG_VERSION:=2.39
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.39 PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.39
@ -485,6 +485,7 @@ endef
define Package/taskset define Package/taskset
$(call Package/util-linux/Default) $(call Package/util-linux/Default)
TITLE:=set or retrieve a process's CPU affinity TITLE:=set or retrieve a process's CPU affinity
ALTERNATIVES:=200:/usr/bin/taskset:/usr/bin/util-linux-taskset
endef endef
define Package/taskset/description define Package/taskset/description
@ -851,7 +852,7 @@ endef
define Package/taskset/install define Package/taskset/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/taskset $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/taskset $(1)/usr/bin/util-linux-taskset
endef endef
define Package/unshare/install define Package/unshare/install

View file

@ -1,24 +1,36 @@
From 2558932c65524d953e4c86d7fda2282a582aa5ec Mon Sep 17 00:00:00 2001 From 2558932c65524d953e4c86d7fda2282a582aa5ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de> From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Wed, 17 May 2023 16:50:47 +0200 Date: Wed, 17 May 2023 16:50:47 +0200
Subject: [PATCH] test_enosys: add support for mips Subject: [PATCH] test_enosys: add support for mips, powerpc and arc
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
--- ---
tests/helpers/test_enosys.c | 2 ++ tests/helpers/test_enosys.c | 14 ++
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
--- a/tests/helpers/test_enosys.c --- a/tests/helpers/test_enosys.c
+++ b/tests/helpers/test_enosys.c +++ b/tests/helpers/test_enosys.c
@@ -53,6 +53,8 @@ @@ -53,6 +53,20 @@
# else # else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64LE # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64LE
# endif # endif
+#elif __powerpc__
+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC
+#elif __mips__ +#elif __mips__
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPS +# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPS
+# else
+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPSEL
+# endif
+#elif __arc__
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2BE
+# else
+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2
+# endif
#else #else
# error Unknown target architecture # error Unknown target architecture
#endif #endif

View file

@ -1,14 +0,0 @@
--- a/lib/randutils.c
+++ b/lib/randutils.c
@@ -26,6 +26,11 @@
#define THREAD_LOCAL static
#endif
+/* force /dev/urandom to avoid hanging on early boot */
+#undef HAVE_GETRANDOM
+#undef SYS_getrandom
+#undef __NR_getrandom
+
#ifdef HAVE_GETRANDOM
# include <sys/random.h>
#elif defined (__linux__)

View file

@ -312,10 +312,10 @@ mvswitch_config_init(struct phy_device *pdev)
priv->orig_features = dev->features; priv->orig_features = dev->features;
#ifdef HEADER_MODE #ifdef HEADER_MODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)
dev->extra_priv_flags |= IFF_NO_IP_ALIGN;
#else
dev->priv_flags |= IFF_NO_IP_ALIGN; dev->priv_flags |= IFF_NO_IP_ALIGN;
#else
dev->extra_priv_flags |= IFF_NO_IP_ALIGN;
#endif #endif
dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX; dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
#else #else
@ -376,10 +376,10 @@ mvswitch_detach(struct phy_device *pdev)
dev->eth_mangle_rx = NULL; dev->eth_mangle_rx = NULL;
dev->eth_mangle_tx = NULL; dev->eth_mangle_tx = NULL;
dev->features = priv->orig_features; dev->features = priv->orig_features;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)
dev->extra_priv_flags &= ~IFF_NO_IP_ALIGN;
#else
dev->priv_flags &= ~IFF_NO_IP_ALIGN; dev->priv_flags &= ~IFF_NO_IP_ALIGN;
#else
dev->extra_priv_flags &= ~IFF_NO_IP_ALIGN;
#endif #endif
} }

View file

@ -33,7 +33,7 @@
+obj-$(CONFIG_NET_AR231X) += ar231x.o +obj-$(CONFIG_NET_AR231X) += ar231x.o
--- /dev/null --- /dev/null
+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
@@ -0,0 +1,1119 @@ @@ -0,0 +1,1117 @@
+/* +/*
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device. + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
+ * + *
@ -156,8 +156,6 @@
+MODULE_DESCRIPTION("AR231x Ethernet driver"); +MODULE_DESCRIPTION("AR231x Ethernet driver");
+#endif +#endif
+ +
+#define virt_to_phys(x) ((u32)(x) & 0x1fffffff)
+
+/* prototypes */ +/* prototypes */
+static void ar231x_halt(struct net_device *dev); +static void ar231x_halt(struct net_device *dev);
+static void rx_tasklet_func(unsigned long data); +static void rx_tasklet_func(unsigned long data);

View file

@ -350,13 +350,13 @@
+ switch (read_len) { + switch (read_len) {
+ case 4: + case 4:
+ spi_data |= buf[3] << 24; + spi_data |= buf[3] << 24;
+ /* fall through */ + fallthrough;
+ case 3: + case 3:
+ spi_data |= buf[2] << 16; + spi_data |= buf[2] << 16;
+ /* fall through */ + fallthrough;
+ case 2: + case 2:
+ spi_data |= buf[1] << 8; + spi_data |= buf[1] << 8;
+ /* fall through */ + fallthrough;
+ case 1: + case 1:
+ spi_data |= buf[0] & 0xff; + spi_data |= buf[0] & 0xff;
+ break; + break;

View file

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/atheros/ar231x/ar231x.c --- a/drivers/net/ethernet/atheros/ar231x/ar231x.c
+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
@@ -135,6 +135,7 @@ static int ar231x_mdiobus_write(struct m @@ -133,6 +133,7 @@ static int ar231x_mdiobus_write(struct m
static int ar231x_mdiobus_reset(struct mii_bus *bus); static int ar231x_mdiobus_reset(struct mii_bus *bus);
static int ar231x_mdiobus_probe(struct net_device *dev); static int ar231x_mdiobus_probe(struct net_device *dev);
static void ar231x_adjust_link(struct net_device *dev); static void ar231x_adjust_link(struct net_device *dev);
@ -8,7 +8,7 @@
#ifndef ERR #ifndef ERR
#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args) #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
@@ -166,6 +167,32 @@ static const struct net_device_ops ar231 @@ -164,6 +165,32 @@ static const struct net_device_ops ar231
#endif #endif
}; };
@ -41,7 +41,7 @@
static int ar231x_probe(struct platform_device *pdev) static int ar231x_probe(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_ @@ -271,6 +298,24 @@ static int ar231x_probe(struct platform_
mdiobus_register(sp->mii_bus); mdiobus_register(sp->mii_bus);
@ -66,7 +66,7 @@
if (ar231x_mdiobus_probe(dev) != 0) { if (ar231x_mdiobus_probe(dev) != 0) {
printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name); printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
rx_tasklet_cleanup(dev); rx_tasklet_cleanup(dev);
@@ -326,8 +371,10 @@ static int ar231x_remove(struct platform @@ -324,8 +369,10 @@ static int ar231x_remove(struct platform
rx_tasklet_cleanup(dev); rx_tasklet_cleanup(dev);
ar231x_init_cleanup(dev); ar231x_init_cleanup(dev);
unregister_netdev(dev); unregister_netdev(dev);
@ -79,7 +79,7 @@
kfree(dev); kfree(dev);
return 0; return 0;
} }
@@ -870,7 +917,8 @@ static int ar231x_open(struct net_device @@ -868,7 +915,8 @@ static int ar231x_open(struct net_device
sp->eth_regs->mac_control |= MAC_CONTROL_RE; sp->eth_regs->mac_control |= MAC_CONTROL_RE;
@ -89,7 +89,7 @@
return 0; return 0;
} }
@@ -951,7 +999,8 @@ static int ar231x_close(struct net_devic @@ -949,7 +997,8 @@ static int ar231x_close(struct net_devic
#endif #endif
@ -99,7 +99,7 @@
return 0; return 0;
} }
@@ -995,6 +1044,9 @@ static int ar231x_ioctl(struct net_devic @@ -993,6 +1042,9 @@ static int ar231x_ioctl(struct net_devic
{ {
struct ar231x_private *sp = netdev_priv(dev); struct ar231x_private *sp = netdev_priv(dev);

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca956x.dtsi" #include "qca9563_dlink_dir-8x9-a1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ { / {
model = "D-Link DIR-859 A1"; model = "D-Link DIR-859 A1";
@ -40,122 +37,4 @@
linux,default-trigger = "phy0tpt"; linux,default-trigger = "phy0tpt";
}; };
}; };
keys {
compatible = "gpio-keys";
wps {
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
reset {
linux,code = <KEY_RESTART>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_switch_reset {
gpio-export,name = "dir-859-a1:reset:switch";
gpio-export,output = <1>;
gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
};
};
};
&pcie {
status = "okay";
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x000000 0x40000>;
read-only;
};
partition@40000 {
label = "bdcfg";
reg = <0x040000 0x10000>;
read-only;
};
partition@50000 {
label = "devdata";
reg = <0x050000 0x10000>;
read-only;
};
partition@60000 {
label = "devconf";
reg = <0x060000 0x10000>;
read-only;
};
partition@70000 {
compatible = "seama";
label = "firmware";
reg = <0x070000 0xf80000>;
};
art: partition@ff0000 {
label = "art";
reg = <0xff0000 0x010000>;
read-only;
};
};
};
};
&mdio0 {
status = "okay";
phy0: ethernet-phy@0 {
reg = <0>;
phy-mode = "sgmii";
qca,mib-poll-interval = <500>;
qca,ar8327-initvals = <
0x04 0x00080080 /* PORT0 PAD MODE CTRL */
0x10 0x81000080 /* POWER_ON_STRAP */
0x50 0xcc35cc35 /* LED_CTRL0 */
0x54 0xcb37cb37 /* LED_CTRL1 */
0x58 0x00000000 /* LED_CTRL2 */
0x5c 0x00f3cf00 /* LED_CTRL3 */
0x7c 0x0000007e /* PORT0_STATUS */
>;
};
};
&eth0 {
status = "okay";
pll-data = <0x03000101 0x00000101 0x00001919>;
phy-mode = "sgmii";
phy-handle = <&phy0>;
};
&wmac {
status = "okay";
qca,no-eeprom;
}; };

View file

@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca9563_dlink_dir-8x9-a1.dtsi"
#include <dt-bindings/leds/common.h>
/ {
compatible = "dlink,dir-859-a3", "qca,qca9563";
model = "D-Link DIR-859 A3";
aliases {
label-mac-device = &wmac;
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "green:power";
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_POWER;
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
wan {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
wlan {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WLAN;
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wps {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WPS;
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
};
};
&ath10k {
nvmem-cells = <&calibration_ath10k>, <&macaddr_bdcfg_ethaddr 2>;
nvmem-cell-names = "calibration", "mac-address";
};
&bdcfg {
macaddr_bdcfg_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;
};
};
&wmac {
nvmem-cells = <&calibration_ath9k>, <&macaddr_bdcfg_ethaddr 0>;
nvmem-cell-names = "calibration", "mac-address";
};

View file

@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca9563_dlink_dir-8x9-a1.dtsi"
/ {
model = "D-Link DIR-869 A1";
compatible = "dlink,dir-869-a1", "qca,qca9563";
aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_orange;
led-running = &led_power_white;
led-upgrade = &led_power_orange;
};
leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
label = "orange:power";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
led_power_white: power_white {
label = "white:power";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
};
};

View file

@ -0,0 +1,152 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca956x.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
keys {
compatible = "gpio-keys";
wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
};
&pcie {
status = "okay";
ath10k: wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&calibration_ath10k>, <&macaddr_devdata_94>;
nvmem-cell-names = "calibration", "mac-address-ascii";
};
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x000000 0x040000>;
read-only;
};
bdcfg: partition@40000 {
compatible = "u-boot,env";
label = "bdcfg";
reg = <0x040000 0x010000>;
};
partition@50000 {
label = "devdata";
reg = <0x050000 0x010000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_devdata_94: macaddr@94 {
reg = <0x94 0x11>;
};
macaddr_devdata_b0: macaddr@b0 {
reg = <0xb0 0x11>;
};
};
partition@60000 {
label = "devconf";
reg = <0x060000 0x010000>;
read-only;
};
partition@70000 {
compatible = "seama";
label = "firmware";
reg = <0x070000 0xf80000>;
};
partition@ff0000 {
label = "art";
reg = <0xff0000 0x010000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
calibration_ath9k: calibration@1000 {
reg = <0x1000 0x440>;
};
calibration_ath10k: calibration@5000 {
reg = <0x5000 0x844>;
};
};
};
};
};
&mdio0 {
status = "okay";
phy0: ethernet-phy@0 {
reg = <0>;
phy-mode = "sgmii";
qca,mib-poll-interval = <500>;
reset-gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
qca,ar8327-initvals = <
0x04 0x00080080 /* PORT0 PAD MODE CTRL */
0x10 0x81000080 /* POWER_ON_STRAP */
0x50 0xcc35cc35 /* LED_CTRL0 */
0x54 0xcb37cb37 /* LED_CTRL1 */
0x58 0x00000000 /* LED_CTRL2 */
0x5c 0x00f3cf00 /* LED_CTRL3 */
0x7c 0x0000007e /* PORT0_STATUS */
>;
};
};
&eth0 {
status = "okay";
pll-data = <0x03000101 0x00000101 0x00001919>;
phy-mode = "sgmii";
phy-handle = <&phy0>;
};
&wmac {
status = "okay";
nvmem-cells = <&calibration_ath9k>, <&macaddr_devdata_b0>;
nvmem-cell-names = "calibration", "mac-address-ascii";
};

View file

@ -119,8 +119,8 @@
}; };
&wifi_ath10k { &wifi_ath10k {
nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_5000>; nvmem-cells = <&macaddr_mac_0>, <&cal_caldata_5000>, <&cal_caldata_5000>;
nvmem-cell-names = "mac-address", "calibration"; nvmem-cell-names = "mac-address", "calibration", "pre-calibration";
mac-address-increment = <1>; mac-address-increment = <1>;
}; };

View file

@ -1352,11 +1352,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += pktlen; dev->stats.rx_bytes += pktlen;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
skb = build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag));
#else
skb = napi_build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag)); skb = napi_build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag));
#endif
if (!skb) { if (!skb) {
skb_free_frag(ring->buf[i].rx_buf); skb_free_frag(ring->buf[i].rx_buf);
goto next; goto next;

View file

@ -234,6 +234,9 @@ dlink,dap-1365-a1)
dlink,dir-859-a1) dlink,dir-859-a1)
ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20" ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20"
;; ;;
dlink,dir-859-a3)
ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20"
;;
engenius,ens202ext-v1|\ engenius,ens202ext-v1|\
engenius,enstationac-v1) engenius,enstationac-v1)
ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_rssimon "wlan0" "200000" "1"

View file

@ -291,6 +291,8 @@ ath79_setup_interfaces()
dlink,dir-842-c2|\ dlink,dir-842-c2|\
dlink,dir-842-c3|\ dlink,dir-842-c3|\
dlink,dir-859-a1|\ dlink,dir-859-a1|\
dlink,dir-859-a3|\
dlink,dir-869-a1|\
engenius,epg5000|\ engenius,epg5000|\
engenius,esr1200|\ engenius,esr1200|\
engenius,esr1750|\ engenius,esr1750|\
@ -656,6 +658,14 @@ ath79_setup_macs()
label_mac=$lan_mac label_mac=$lan_mac
;; ;;
dlink,dir-859-a1|\ dlink,dir-859-a1|\
dlink,dir-869-a1)
lan_mac=$(mtd_get_mac_text "devdata" 0xc9)
wan_mac=$(mtd_get_mac_text "devdata" 0x79)
;;
dlink,dir-859-a3)
lan_mac=$(get_mac_label)
wan_mac=$(macaddr_add "$lan_mac" 3)
;;
qihoo,c301|\ qihoo,c301|\
wd,mynet-n600|\ wd,mynet-n600|\
wd,mynet-n750) wd,mynet-n750)

View file

@ -30,7 +30,6 @@ case "$FIRMWARE" in
dlink,dir-842-c1|\ dlink,dir-842-c1|\
dlink,dir-842-c2|\ dlink,dir-842-c2|\
dlink,dir-842-c3|\ dlink,dir-842-c3|\
dlink,dir-859-a1|\
nec,wf1200cr|\ nec,wf1200cr|\
nec,wg1200cr|\ nec,wg1200cr|\
wd,mynet-n600|\ wd,mynet-n600|\

View file

@ -68,10 +68,6 @@ case "$FIRMWARE" in
caldata_extract "art" 0x5000 0x844 caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1) ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1)
;; ;;
dlink,dir-859-a1)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
;;
engenius,ecb1200|\ engenius,ecb1200|\
engenius,ecb1750) engenius,ecb1750)
caldata_extract "art" 0x5000 0x844 caldata_extract "art" 0x5000 0x844

View file

@ -22,6 +22,9 @@ dlink,dap-3662-a1)
fixwrgg fixwrgg
;; ;;
dlink,dir-629-a1|\ dlink,dir-629-a1|\
dlink,dir-859-a1|\
dlink,dir-859-a3|\
dlink,dir-869-a1|\
qihoo,c301) qihoo,c301)
fix_seama_header fix_seama_header
;; ;;

View file

@ -15,6 +15,8 @@ CONFIG_MARVELL_PHY=y
CONFIG_MICREL_PHY=y CONFIG_MICREL_PHY=y
CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_REDBOOT_PARTS=y
CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_U_BOOT_ENV=y
CONFIG_PHY_AR7100_USB=y CONFIG_PHY_AR7100_USB=y
CONFIG_PHY_AR7200_USB=y CONFIG_PHY_AR7200_USB=y
CONFIG_REALTEK_PHY=y CONFIG_REALTEK_PHY=y

View file

@ -707,6 +707,7 @@ define Device/tplink_tl-wr1043nd-v1
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-switch-rtl8366rb DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-switch-rtl8366rb
TPLINK_HWID := 0x10430001 TPLINK_HWID := 0x10430001
SUPPORTED_DEVICES += tl-wr1043nd SUPPORTED_DEVICES += tl-wr1043nd
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr1043nd-v1 TARGET_DEVICES += tplink_tl-wr1043nd-v1
@ -789,6 +790,7 @@ define Device/tplink_tl-wr710n-v1
DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x07100001 TPLINK_HWID := 0x07100001
SUPPORTED_DEVICES += tl-wr710n SUPPORTED_DEVICES += tl-wr710n
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr710n-v1 TARGET_DEVICES += tplink_tl-wr710n-v1
@ -801,6 +803,7 @@ define Device/tplink_tl-wr710n-v2.1
TPLINK_HWID := 0x07100002 TPLINK_HWID := 0x07100002
TPLINK_HWREV := 0x2 TPLINK_HWREV := 0x2
SUPPORTED_DEVICES += tl-wr710n SUPPORTED_DEVICES += tl-wr710n
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr710n-v2.1 TARGET_DEVICES += tplink_tl-wr710n-v2.1
@ -822,6 +825,7 @@ define Device/tplink_tl-wr810n-v2
DEVICE_VARIANT := v2 DEVICE_VARIANT := v2
TPLINK_HWID := 0x8100002 TPLINK_HWID := 0x8100002
SUPPORTED_DEVICES += tl-wr810n-v2 SUPPORTED_DEVICES += tl-wr810n-v2
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr810n-v2 TARGET_DEVICES += tplink_tl-wr810n-v2
@ -851,6 +855,7 @@ define Device/tplink_tl-wr842n-v1
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x8420001 TPLINK_HWID := 0x8420001
SUPPORTED_DEVICES += tl-mr3420 SUPPORTED_DEVICES += tl-mr3420
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr842n-v1 TARGET_DEVICES += tplink_tl-wr842n-v1
@ -862,6 +867,7 @@ define Device/tplink_tl-wr842n-v2
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x8420002 TPLINK_HWID := 0x8420002
SUPPORTED_DEVICES += tl-wr842n-v2 SUPPORTED_DEVICES += tl-wr842n-v2
DEFAULT := n
endef endef
TARGET_DEVICES += tplink_tl-wr842n-v2 TARGET_DEVICES += tplink_tl-wr842n-v2

View file

@ -1143,18 +1143,41 @@ define Device/dlink_dir-842-c3
endef endef
TARGET_DEVICES += dlink_dir-842-c3 TARGET_DEVICES += dlink_dir-842-c3
define Device/dlink_dir-859-a1 define Device/dlink_dir-859-ax
$(Device/seama) $(Device/seama)
SOC := qca9563 SOC := qca9563
DEVICE_VENDOR := D-Link DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-859 DEVICE_MODEL := DIR-859
DEVICE_VARIANT := A1
IMAGE_SIZE := 15872k IMAGE_SIZE := 15872k
DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859 SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859
endef endef
define Device/dlink_dir-859-a1
$(Device/dlink_dir-859-ax)
DEVICE_VARIANT := A1
endef
TARGET_DEVICES += dlink_dir-859-a1 TARGET_DEVICES += dlink_dir-859-a1
define Device/dlink_dir-859-a3
$(Device/dlink_dir-859-ax)
DEVICE_VARIANT := A3
endef
TARGET_DEVICES += dlink_dir-859-a3
define Device/dlink_dir-869-a1
$(Device/seama)
SOC := qca9563
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-869
DEVICE_VARIANT := A1
IMAGE_SIZE := 15872k
DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
SEAMA_SIGNATURE := wrgac54_dlink.2015_dir869
SUPPORTED_DEVICES += dir-869-a1
endef
TARGET_DEVICES += dlink_dir-869-a1
define Device/elecom_wrc-1750ghbk2-i define Device/elecom_wrc-1750ghbk2-i
SOC := qca9563 SOC := qca9563
DEVICE_VENDOR := ELECOM DEVICE_VENDOR := ELECOM
@ -2911,6 +2934,7 @@ define Device/wd_mynet-wifi-rangeextender
IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | cybertan-trx | \ IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | cybertan-trx | \
addpattern | append-metadata addpattern | append-metadata
SUPPORTED_DEVICES += mynet-rext SUPPORTED_DEVICES += mynet-rext
DEFAULT := n
endef endef
TARGET_DEVICES += wd_mynet-wifi-rangeextender TARGET_DEVICES += wd_mynet-wifi-rangeextender
@ -3001,6 +3025,7 @@ define Device/ziking_cpe46b
DEVICE_MODEL := CPE46B DEVICE_MODEL := CPE46B
IMAGE_SIZE := 8000k IMAGE_SIZE := 8000k
DEVICE_PACKAGES := kmod-i2c-gpio DEVICE_PACKAGES := kmod-i2c-gpio
DEFAULT := n
endef endef
TARGET_DEVICES += ziking_cpe46b TARGET_DEVICES += ziking_cpe46b

View file

@ -426,8 +426,8 @@ TARGET_DEVICES += zte_mf282
define Device/zte_mf286 define Device/zte_mf286
$(Device/zte_mf28x_common) $(Device/zte_mf28x_common)
DEVICE_MODEL := MF286 DEVICE_MODEL := MF286
DEVICE_PACKAGES += ath10k-firmware-qca988x-ct kmod-usb-net-qmi-wwan \ DEVICE_PACKAGES += ath10k-firmware-qca988x-ct ath10k-firmware-qca9888-ct \
kmod-usb-serial-option uqmi kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi
endef endef
TARGET_DEVICES += zte_mf286 TARGET_DEVICES += zte_mf286

View file

@ -5,6 +5,7 @@ define Device/ubnt_airrouter
SOC := ar7241 SOC := ar7241
DEVICE_MODEL := AirRouter DEVICE_MODEL := AirRouter
SUPPORTED_DEVICES += airrouter SUPPORTED_DEVICES += airrouter
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_airrouter TARGET_DEVICES += ubnt_airrouter
@ -14,6 +15,7 @@ define Device/ubnt_nanobridge-m
DEVICE_MODEL := NanoBridge M DEVICE_MODEL := NanoBridge M
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += bullet-m SUPPORTED_DEVICES += bullet-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_nanobridge-m TARGET_DEVICES += ubnt_nanobridge-m
@ -24,6 +26,7 @@ define Device/ubnt_bullet-m-ar7240
DEVICE_VARIANT := XM (AR7240) DEVICE_VARIANT := XM (AR7240)
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += bullet-m SUPPORTED_DEVICES += bullet-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_bullet-m-ar7240 TARGET_DEVICES += ubnt_bullet-m-ar7240
@ -34,6 +37,7 @@ define Device/ubnt_bullet-m-ar7241
DEVICE_VARIANT := XM (AR7241) DEVICE_VARIANT := XM (AR7241)
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += bullet-m ubnt,bullet-m SUPPORTED_DEVICES += bullet-m ubnt,bullet-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_bullet-m-ar7241 TARGET_DEVICES += ubnt_bullet-m-ar7241
@ -43,6 +47,7 @@ define Device/ubnt_picostation-m
DEVICE_MODEL := Picostation M DEVICE_MODEL := Picostation M
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += bullet-m SUPPORTED_DEVICES += bullet-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_picostation-m TARGET_DEVICES += ubnt_picostation-m
@ -52,6 +57,7 @@ define Device/ubnt_nanostation-m
DEVICE_MODEL := Nanostation M DEVICE_MODEL := Nanostation M
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += nanostation-m SUPPORTED_DEVICES += nanostation-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_nanostation-m TARGET_DEVICES += ubnt_nanostation-m
@ -61,6 +67,7 @@ define Device/ubnt_nanostation-loco-m
DEVICE_MODEL := Nanostation Loco M DEVICE_MODEL := Nanostation Loco M
DEVICE_PACKAGES += rssileds DEVICE_PACKAGES += rssileds
SUPPORTED_DEVICES += bullet-m SUPPORTED_DEVICES += bullet-m
DEFAULT := n
endef endef
TARGET_DEVICES += ubnt_nanostation-loco-m TARGET_DEVICES += ubnt_nanostation-loco-m

View file

@ -76,5 +76,6 @@ define Device/pqi_air-pen
DEVICE_PACKAGES := kmod-usb-chipidea2 DEVICE_PACKAGES := kmod-usb-chipidea2
IMAGE_SIZE := 7680k IMAGE_SIZE := 7680k
SUPPORTED_DEVICES += pqi-air-pen SUPPORTED_DEVICES += pqi-air-pen
DEFAULT := n
endef endef
TARGET_DEVICES += pqi_air-pen TARGET_DEVICES += pqi_air-pen

View file

@ -10,6 +10,7 @@ define Device/linksys_wrt300n-v1.1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := EWC2 DEVICE_ID := EWC2
VERSION := 1.51.2 VERSION := 1.51.2
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt300n-v1.1 TARGET_DEVICES += linksys_wrt300n-v1.1
@ -20,6 +21,7 @@ define Device/linksys_wrt310n-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := 310N DEVICE_ID := 310N
VERSION := 1.0.10 VERSION := 1.0.10
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt310n-v1 TARGET_DEVICES += linksys_wrt310n-v1
@ -30,6 +32,7 @@ define Device/linksys_wrt350n-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := EWCG DEVICE_ID := EWCG
VERSION := 1.04.1 VERSION := 1.04.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt350n-v1 TARGET_DEVICES += linksys_wrt350n-v1

View file

@ -7,6 +7,7 @@ define Device/asus_wl-300g
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "WL300g " PRODUCTID := "WL300g "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-300g TARGET_DEVICES += asus_wl-300g
@ -15,6 +16,7 @@ define Device/asus_wl-320gp
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "WL320gP " PRODUCTID := "WL320gP "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-320gp TARGET_DEVICES += asus_wl-320gp
@ -23,6 +25,7 @@ define Device/asus_wl-330ge
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "WL-330gE " PRODUCTID := "WL-330gE "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-330ge TARGET_DEVICES += asus_wl-330ge
@ -31,6 +34,7 @@ define Device/asus_wl-500gd
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := "WL500gx " PRODUCTID := "WL500gx "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-500gd TARGET_DEVICES += asus_wl-500gd
@ -40,6 +44,7 @@ define Device/asus_wl-500gp-v1
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := "WL500gp " PRODUCTID := "WL500gp "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-500gp-v1 TARGET_DEVICES += asus_wl-500gp-v1
@ -49,6 +54,7 @@ define Device/asus_wl-500gp-v2
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := "WL500gpv2 " PRODUCTID := "WL500gpv2 "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-500gp-v2 TARGET_DEVICES += asus_wl-500gp-v2
@ -57,6 +63,7 @@ define Device/asus_wl-500w
DEVICE_PACKAGES := kmod-b43 kmod-usb-uhci kmod-usb2-pci DEVICE_PACKAGES := kmod-b43 kmod-usb-uhci kmod-usb2-pci
$(Device/asus) $(Device/asus)
PRODUCTID := "WL500W " PRODUCTID := "WL500W "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-500w TARGET_DEVICES += asus_wl-500w
@ -65,6 +72,7 @@ define Device/asus_wl-520gu
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := "WL520gu " PRODUCTID := "WL520gu "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-520gu TARGET_DEVICES += asus_wl-520gu
@ -73,6 +81,7 @@ define Device/asus_wl-550ge
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "WL550gE " PRODUCTID := "WL550gE "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-550ge TARGET_DEVICES += asus_wl-550ge
@ -81,6 +90,7 @@ define Device/asus_wl-hdd25
DEVICE_PACKAGES := kmod-b43 $(USB1_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB1_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := "WLHDD " PRODUCTID := "WLHDD "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_wl-hdd25 TARGET_DEVICES += asus_wl-hdd25
@ -99,6 +109,7 @@ define Device/edimax_ps1208-mfg
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
IMAGES := bin IMAGES := bin
IMAGE/bin := append-rootfs | trx-with-loader | edimax-bin IMAGE/bin := append-rootfs | trx-with-loader | edimax-bin
DEFAULT := n
endef endef
TARGET_DEVICES += edimax_ps1208-mfg TARGET_DEVICES += edimax_ps1208-mfg
@ -109,6 +120,7 @@ define Device/huawei_e970
KERNEL_NAME = vmlinux.gz KERNEL_NAME = vmlinux.gz
IMAGES := bin IMAGES := bin
IMAGE/bin := append-rootfs | trx-without-loader | huawei-bin IMAGE/bin := append-rootfs | trx-without-loader | huawei-bin
DEFAULT := n
endef endef
TARGET_DEVICES += huawei_e970 TARGET_DEVICES += huawei_e970
@ -118,6 +130,7 @@ define Device/linksys_wrt54g3g
$(Device/linksys) $(Device/linksys)
DEVICE_ID := W54F DEVICE_ID := W54F
VERSION := 2.20.1 VERSION := 2.20.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54g3g TARGET_DEVICES += linksys_wrt54g3g
@ -126,6 +139,7 @@ define Device/linksys_wrt54g3g-em
$(Device/linksys) $(Device/linksys)
DEVICE_ID := W3GN DEVICE_ID := W3GN
VERSION := 2.20.1 VERSION := 2.20.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54g3g-em TARGET_DEVICES += linksys_wrt54g3g-em
@ -140,6 +154,7 @@ define Device/linksys_wrt54g3gv2-vf
DEVICE_ID := 3G2V DEVICE_ID := 3G2V
VERSION := 3.00.24 VERSION := 3.00.24
SERIAL := 6 SERIAL := 6
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54g3gv2-vf TARGET_DEVICES += linksys_wrt54g3gv2-vf
@ -149,6 +164,7 @@ define Device/linksys_wrt54g
$(Device/linksys) $(Device/linksys)
DEVICE_ID := W54G DEVICE_ID := W54G
VERSION := 4.71.1 VERSION := 4.71.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54g TARGET_DEVICES += linksys_wrt54g
@ -163,6 +179,7 @@ define Device/linksys_wrt54gs
FILESYSTEMS := $(FS_128K) FILESYSTEMS := $(FS_128K)
DEVICE_ID := W54S DEVICE_ID := W54S
VERSION := 4.80.1 VERSION := 4.80.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54gs TARGET_DEVICES += linksys_wrt54gs
@ -173,6 +190,7 @@ define Device/linksys_wrt54gs-v4
$(Device/linksys) $(Device/linksys)
DEVICE_ID := W54s DEVICE_ID := W54s
VERSION := 1.09.1 VERSION := 1.09.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt54gs-v4 TARGET_DEVICES += linksys_wrt54gs-v4
@ -183,6 +201,7 @@ define Device/linksys_wrtsl54gs
FILESYSTEMS := $(FS_128K) FILESYSTEMS := $(FS_128K)
DEVICE_ID := W54U DEVICE_ID := W54U
VERSION := 2.08.1 VERSION := 2.08.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrtsl54gs TARGET_DEVICES += linksys_wrtsl54gs
@ -192,6 +211,7 @@ define Device/linksys_wrt150n
$(Device/linksys) $(Device/linksys)
DEVICE_ID := N150 DEVICE_ID := N150
VERSION := 1.51.3 VERSION := 1.51.3
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt150n TARGET_DEVICES += linksys_wrt150n
@ -202,6 +222,7 @@ define Device/linksys_wrt160n-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := N150 DEVICE_ID := N150
VERSION := 1.50.1 VERSION := 1.50.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt160n-v1 TARGET_DEVICES += linksys_wrt160n-v1
@ -213,6 +234,7 @@ define Device/linksys_wrt300n-v1
IMAGES := bin trx IMAGES := bin trx
DEVICE_ID := EWCB DEVICE_ID := EWCB
VERSION := 1.03.6 VERSION := 1.03.6
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt300n-v1 TARGET_DEVICES += linksys_wrt300n-v1
@ -221,6 +243,7 @@ define Device/motorola_wa840g
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/motorola) $(Device/motorola)
MOTOROLA_DEVICE := 2 MOTOROLA_DEVICE := 2
DEFAULT := n
endef endef
TARGET_DEVICES += motorola_wa840g TARGET_DEVICES += motorola_wa840g
@ -229,6 +252,7 @@ define Device/motorola_we800g
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/motorola) $(Device/motorola)
MOTOROLA_DEVICE := 3 MOTOROLA_DEVICE := 3
DEFAULT := n
endef endef
TARGET_DEVICES += motorola_we800g TARGET_DEVICES += motorola_we800g
@ -237,6 +261,7 @@ define Device/motorola_wr850g
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/motorola) $(Device/motorola)
MOTOROLA_DEVICE := 1 MOTOROLA_DEVICE := 1
DEFAULT := n
endef endef
TARGET_DEVICES += motorola_wr850g TARGET_DEVICES += motorola_wr850g
@ -247,6 +272,7 @@ define Device/netgear_wgr614-v8
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H072T00_NETGEAR NETGEAR_BOARD_ID := U12H072T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wgr614-v8 TARGET_DEVICES += netgear_wgr614-v8
@ -257,6 +283,7 @@ define Device/netgear_wgt634u
FILESYSTEMS := $(FS_128K) FILESYSTEMS := $(FS_128K)
IMAGES := bin IMAGES := bin
IMAGE/bin := append-rootfs | trx-with-loader | prepend-with-elf IMAGE/bin := append-rootfs | trx-with-loader | prepend-with-elf
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wgt634u TARGET_DEVICES += netgear_wgt634u
@ -267,6 +294,7 @@ define Device/netgear_wndr3300-v1
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H093T00_NETGEAR NETGEAR_BOARD_ID := U12H093T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wndr3300-v1 TARGET_DEVICES += netgear_wndr3300-v1
@ -277,6 +305,7 @@ define Device/netgear_wnr834b-v2
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H081T00_NETGEAR NETGEAR_BOARD_ID := U12H081T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wnr834b-v2 TARGET_DEVICES += netgear_wnr834b-v2
@ -286,6 +315,7 @@ define Device/usrobotics_usr5461
DEVICE_PACKAGES := kmod-b43 $(USB1_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB1_PACKAGES)
IMAGES := bin IMAGES := bin
IMAGE/bin := append-rootfs | trx-with-loader | usrobotics-bin IMAGE/bin := append-rootfs | trx-with-loader | usrobotics-bin
DEFAULT := n
endef endef
TARGET_DEVICES += usrobotics_usr5461 TARGET_DEVICES += usrobotics_usr5461

View file

@ -24,6 +24,7 @@ define Device/asus_rt-n10
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "RT-N10 " PRODUCTID := "RT-N10 "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n10 TARGET_DEVICES += asus_rt-n10
@ -33,6 +34,7 @@ define Device/asus_rt-n10p
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N10P PRODUCTID := RT-N10P
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n10p TARGET_DEVICES += asus_rt-n10p
@ -41,6 +43,7 @@ define Device/asus_rt-n10p-v2
DEVICE_VARIANT := v2 DEVICE_VARIANT := v2
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N10PV2 PRODUCTID := RT-N10PV2
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n10p-v2 TARGET_DEVICES += asus_rt-n10p-v2
@ -50,6 +53,7 @@ define Device/asus_rt-n10u
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N10U PRODUCTID := RT-N10U
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n10u TARGET_DEVICES += asus_rt-n10u
@ -59,6 +63,7 @@ define Device/asus_rt-n10u-b
DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES) DEVICE_PACKAGES := kmod-b43 $(USB2_PACKAGES)
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N10U PRODUCTID := RT-N10U
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n10u-b TARGET_DEVICES += asus_rt-n10u-b
@ -68,6 +73,7 @@ define Device/asus_rt-n12
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := "RT-N12 " PRODUCTID := "RT-N12 "
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n12 TARGET_DEVICES += asus_rt-n12
@ -76,6 +82,7 @@ define Device/asus_rt-n12-b1
DEVICE_VARIANT := B1 DEVICE_VARIANT := B1
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N12B1 PRODUCTID := RT-N12B1
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n12-b1 TARGET_DEVICES += asus_rt-n12-b1
@ -84,6 +91,7 @@ define Device/asus_rt-n12-c1
DEVICE_VARIANT := C1 DEVICE_VARIANT := C1
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N12C1 PRODUCTID := RT-N12C1
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n12-c1 TARGET_DEVICES += asus_rt-n12-c1
@ -92,6 +100,7 @@ define Device/asus_rt-n12-d1
DEVICE_VARIANT := D1 DEVICE_VARIANT := D1
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N12D1 PRODUCTID := RT-N12D1
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n12-d1 TARGET_DEVICES += asus_rt-n12-d1
@ -99,6 +108,7 @@ define Device/asus_rt-n12hp
DEVICE_MODEL := RT-N12HP DEVICE_MODEL := RT-N12HP
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N12HP PRODUCTID := RT-N12HP
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n12hp TARGET_DEVICES += asus_rt-n12hp
@ -131,6 +141,7 @@ define Device/asus_rt-n53
DEVICE_PACKAGES := kmod-b43 DEVICE_PACKAGES := kmod-b43
$(Device/asus) $(Device/asus)
PRODUCTID := RT-N53 PRODUCTID := RT-N53
DEFAULT := n
endef endef
TARGET_DEVICES += asus_rt-n53 TARGET_DEVICES += asus_rt-n53
@ -168,6 +179,7 @@ define Device/linksys_wrt310n-v2
$(Device/linksys) $(Device/linksys)
DEVICE_ID := 310N DEVICE_ID := 310N
VERSION := 2.0.1 VERSION := 2.0.1
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt310n-v2 TARGET_DEVICES += linksys_wrt310n-v2
@ -178,6 +190,7 @@ define Device/linksys_wrt320n-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := 320N DEVICE_ID := 320N
VERSION := 1.0.5 VERSION := 1.0.5
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_wrt320n-v1 TARGET_DEVICES += linksys_wrt320n-v1
@ -187,6 +200,7 @@ define Device/linksys_e900-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := E900 DEVICE_ID := E900
VERSION := 1.0.4 VERSION := 1.0.4
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e900-v1 TARGET_DEVICES += linksys_e900-v1
@ -197,6 +211,7 @@ define Device/linksys_e1000
$(Device/linksys) $(Device/linksys)
DEVICE_ID := E100 DEVICE_ID := E100
VERSION := 1.1.3 VERSION := 1.1.3
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e1000 TARGET_DEVICES += linksys_e1000
@ -206,6 +221,7 @@ define Device/linksys_e1200-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := E120 DEVICE_ID := E120
VERSION := 1.0.3 VERSION := 1.0.3
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e1200-v1 TARGET_DEVICES += linksys_e1200-v1
@ -215,6 +231,7 @@ define Device/linksys_e1200-v2
$(Device/linksys) $(Device/linksys)
DEVICE_ID := E122 DEVICE_ID := E122
VERSION := 1.0.4 VERSION := 1.0.4
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e1200-v2 TARGET_DEVICES += linksys_e1200-v2
@ -224,6 +241,7 @@ define Device/linksys_e1500-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := E150 DEVICE_ID := E150
VERSION := 1.0.5 VERSION := 1.0.5
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e1500-v1 TARGET_DEVICES += linksys_e1500-v1
@ -244,6 +262,7 @@ define Device/linksys_e2000-v1
$(Device/linksys) $(Device/linksys)
DEVICE_ID := 32XN DEVICE_ID := 32XN
VERSION := 1.0.4 VERSION := 1.0.4
DEFAULT := n
endef endef
TARGET_DEVICES += linksys_e2000-v1 TARGET_DEVICES += linksys_e2000-v1
@ -323,6 +342,7 @@ define Device/netgear_wgr614-v10-na
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H139T01_NETGEAR NETGEAR_BOARD_ID := U12H139T01_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wgr614-v10-na TARGET_DEVICES += netgear_wgr614-v10-na
@ -332,6 +352,7 @@ define Device/netgear_wgr614-v10
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H139T01_NETGEAR NETGEAR_BOARD_ID := U12H139T01_NETGEAR
NETGEAR_REGION := 1 NETGEAR_REGION := 1
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wgr614-v10 TARGET_DEVICES += netgear_wgr614-v10
@ -350,6 +371,7 @@ define Device/netgear_wn3000rp
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H163T01_NETGEAR NETGEAR_BOARD_ID := U12H163T01_NETGEAR
NETGEAR_REGION := 1 NETGEAR_REGION := 1
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wn3000rp TARGET_DEVICES += netgear_wn3000rp
@ -420,6 +442,7 @@ define Device/netgear_wnr1000-v3
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H139T00_NETGEAR NETGEAR_BOARD_ID := U12H139T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wnr1000-v3 TARGET_DEVICES += netgear_wnr1000-v3
@ -430,6 +453,7 @@ define Device/netgear_wnr2000v2
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H114T00_NETGEAR NETGEAR_BOARD_ID := U12H114T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wnr2000v2 TARGET_DEVICES += netgear_wnr2000v2
@ -482,6 +506,7 @@ define Device/netgear_wnr3500-v2
$(Device/netgear) $(Device/netgear)
NETGEAR_BOARD_ID := U12H127T00_NETGEAR NETGEAR_BOARD_ID := U12H127T00_NETGEAR
NETGEAR_REGION := 2 NETGEAR_REGION := 2
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_wnr3500-v2 TARGET_DEVICES += netgear_wnr3500-v2

View file

@ -210,6 +210,7 @@ define Device/adb_a4001n
CHIP_ID := 6328 CHIP_ID := 6328
FLASH_MB := 8 FLASH_MB := 8
DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += adb_a4001n TARGET_DEVICES += adb_a4001n
@ -222,6 +223,7 @@ define Device/adb_a4001n1
CHIP_ID := 6328 CHIP_ID := 6328
FLASH_MB := 16 FLASH_MB := 16
DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += adb_a4001n1 TARGET_DEVICES += adb_a4001n1
@ -234,6 +236,7 @@ define Device/adb_pdg-a4001n-a-000-1a1-ax
CHIP_ID := 6328 CHIP_ID := 6328
FLASH_MB := 16 FLASH_MB := 16
DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += adb_pdg-a4001n-a-000-1a1-ax TARGET_DEVICES += adb_pdg-a4001n-a-000-1a1-ax
@ -269,6 +272,7 @@ define Device/alcatel_rg100a
CHIP_ID := 6358 CHIP_ID := 6358
BLOCK_SIZE := 0x20000 BLOCK_SIZE := 0x20000
DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += alcatel_rg100a TARGET_DEVICES += alcatel_rg100a
@ -448,6 +452,7 @@ define Device/comtrend_ct-6373
CFE_BOARD_ID := CT6373-1 CFE_BOARD_ID := CT6373-1
CHIP_ID := 6358 CHIP_ID := 6358
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += comtrend_ct-6373 TARGET_DEVICES += comtrend_ct-6373
@ -532,6 +537,7 @@ define Device/d-link_dsl-2650u
CFE_BOARD_ID := 96358VW2 CFE_BOARD_ID := 96358VW2
CHIP_ID := 6358 CHIP_ID := 6358
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += d-link_dsl-2650u TARGET_DEVICES += d-link_dsl-2650u
@ -593,6 +599,7 @@ define Device/d-link_dsl-2750u-c1
CHIP_ID := 6328 CHIP_ID := 6328
FLASH_MB := 8 FLASH_MB := 8
DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += d-link_dsl-2750u-c1 TARGET_DEVICES += d-link_dsl-2750u-c1
@ -618,6 +625,7 @@ define Device/d-link_dva-g3810bn-tl
CFE_BOARD_ID := 96358VW CFE_BOARD_ID := 96358VW
CHIP_ID := 6358 CHIP_ID := 6358
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += d-link_dva-g3810bn-tl TARGET_DEVICES += d-link_dva-g3810bn-tl
@ -765,6 +773,7 @@ define Device/huawei_echolife-hg622
BLOCK_SIZE := 0x20000 BLOCK_SIZE := 0x20000
FLASH_MB := 16 FLASH_MB := 16
DEVICE_PACKAGES := $(RT28_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(RT28_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += huawei_echolife-hg622 TARGET_DEVICES += huawei_echolife-hg622
@ -825,6 +834,7 @@ define Device/netgear_cvg834g
HCS_MAGIC_BYTES := 0xa020 HCS_MAGIC_BYTES := 0xa020
HCS_REV_MIN := 0001 HCS_REV_MIN := 0001
HCS_REV_MAJ := 0022 HCS_REV_MAJ := 0022
DEFAULT := n
endef endef
TARGET_DEVICES += netgear_cvg834g TARGET_DEVICES += netgear_cvg834g
@ -930,6 +940,7 @@ define Device/pirelli_a226g
CHIP_ID := 6358 CHIP_ID := 6358
CFE_EXTRAS += --signature2 IMAGE --tag-version 8 CFE_EXTRAS += --signature2 IMAGE --tag-version 8
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += pirelli_a226g TARGET_DEVICES += pirelli_a226g
@ -941,6 +952,7 @@ define Device/pirelli_a226m
CHIP_ID := 6358 CHIP_ID := 6358
CFE_EXTRAS += --signature2 IMAGE --tag-version 8 CFE_EXTRAS += --signature2 IMAGE --tag-version 8
DEVICE_PACKAGES := $(USB2_PACKAGES) DEVICE_PACKAGES := $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += pirelli_a226m TARGET_DEVICES += pirelli_a226m
@ -965,6 +977,7 @@ define Device/pirelli_agpf-s0
CFE_EXTRAS += --signature2 IMAGE --tag-version 8 CFE_EXTRAS += --signature2 IMAGE --tag-version 8
BLOCK_SIZE := 0x20000 BLOCK_SIZE := 0x20000
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += pirelli_agpf-s0 TARGET_DEVICES += pirelli_agpf-s0
@ -1009,6 +1022,7 @@ define Device/sagem_fast-2704n
CHIP_ID := 6318 CHIP_ID := 6318
FLASH_MB := 8 FLASH_MB := 8
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += sagem_fast-2704n TARGET_DEVICES += sagem_fast-2704n
@ -1046,6 +1060,7 @@ define Device/sfr_neufbox-4-sercomm-r0
CHIP_ID := 6358 CHIP_ID := 6358
CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))"
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += sfr_neufbox-4-sercomm-r0 TARGET_DEVICES += sfr_neufbox-4-sercomm-r0
@ -1058,6 +1073,7 @@ define Device/sfr_neufbox-4-foxconn-r1
CHIP_ID := 6358 CHIP_ID := 6358
CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))"
DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += sfr_neufbox-4-foxconn-r1 TARGET_DEVICES += sfr_neufbox-4-foxconn-r1
@ -1096,6 +1112,7 @@ define Device/t-com_speedport-w-303v
CFE_BOARD_ID := 96358-502V CFE_BOARD_ID := 96358-502V
CHIP_ID := 6358 CHIP_ID := 6358
DEVICE_PACKAGES := $(B43_PACKAGES) DEVICE_PACKAGES := $(B43_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += t-com_speedport-w-303v TARGET_DEVICES += t-com_speedport-w-303v
@ -1182,6 +1199,7 @@ define Device/telsey_cpva642
CFE_EXTRAS += --signature "Telsey Tlc" --signature2 "99.99.999" --second-image-flag "0" CFE_EXTRAS += --signature "Telsey Tlc" --signature2 "99.99.999" --second-image-flag "0"
FLASH_MB := 8 FLASH_MB := 8
DEVICE_PACKAGES := $(RT63_PACKAGES) $(USB2_PACKAGES) DEVICE_PACKAGES := $(RT63_PACKAGES) $(USB2_PACKAGES)
DEFAULT := n
endef endef
TARGET_DEVICES += telsey_cpva642 TARGET_DEVICES += telsey_cpva642

View file

@ -0,0 +1,187 @@
From 6c7f552a48b49a8612786a28a2239fbc24fac289 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Fri, 30 Dec 2022 14:52:51 -0700
Subject: [PATCH 19/29] mm: add vma_has_recency()
Add vma_has_recency() to indicate whether a VMA may exhibit temporal
locality that the LRU algorithm relies on.
This function returns false for VMAs marked by VM_SEQ_READ or
VM_RAND_READ. While the former flag indicates linear access, i.e., a
special case of spatial locality, both flags indicate a lack of temporal
locality, i.e., the reuse of an area within a relatively small duration.
"Recency" is chosen over "locality" to avoid confusion between temporal
and spatial localities.
Before this patch, the active/inactive LRU only ignored the accessed bit
from VMAs marked by VM_SEQ_READ. After this patch, the active/inactive
LRU and MGLRU share the same logic: they both ignore the accessed bit if
vma_has_recency() returns false.
For the active/inactive LRU, the following fio test showed a [6, 8]%
increase in IOPS when randomly accessing mapped files under memory
pressure.
kb=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
kb=$((kb - 8*1024*1024))
modprobe brd rd_nr=1 rd_size=$kb
dd if=/dev/zero of=/dev/ram0 bs=1M
mkfs.ext4 /dev/ram0
mount /dev/ram0 /mnt/
swapoff -a
fio --name=test --directory=/mnt/ --ioengine=mmap --numjobs=8 \
--size=8G --rw=randrw --time_based --runtime=10m \
--group_reporting
The discussion that led to this patch is here [1]. Additional test
results are available in that thread.
[1] https://lore.kernel.org/r/Y31s%2FK8T85jh05wH@google.com/
Link: https://lkml.kernel.org/r/20221230215252.2628425-1-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrea Righi <andrea.righi@canonical.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mm_inline.h | 9 +++++++++
mm/memory.c | 8 ++++----
mm/rmap.c | 42 +++++++++++++++++----------------------
mm/vmscan.c | 5 ++++-
4 files changed, 35 insertions(+), 29 deletions(-)
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -578,4 +578,12 @@ pte_install_uffd_wp_if_needed(struct vm_
#endif
}
+static inline bool vma_has_recency(struct vm_area_struct *vma)
+{
+ if (vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))
+ return false;
+
+ return true;
+}
+
#endif
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1435,8 +1435,7 @@ again:
force_flush = 1;
set_page_dirty(page);
}
- if (pte_young(ptent) &&
- likely(!(vma->vm_flags & VM_SEQ_READ)))
+ if (pte_young(ptent) && likely(vma_has_recency(vma)))
mark_page_accessed(page);
}
rss[mm_counter(page)]--;
@@ -5170,8 +5169,8 @@ static inline void mm_account_fault(stru
#ifdef CONFIG_LRU_GEN
static void lru_gen_enter_fault(struct vm_area_struct *vma)
{
- /* the LRU algorithm doesn't apply to sequential or random reads */
- current->in_lru_fault = !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ));
+ /* the LRU algorithm only applies to accesses with recency */
+ current->in_lru_fault = vma_has_recency(vma);
}
static void lru_gen_exit_fault(void)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -823,25 +823,14 @@ static bool folio_referenced_one(struct
}
if (pvmw.pte) {
- if (lru_gen_enabled() && pte_young(*pvmw.pte) &&
- !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) {
+ if (lru_gen_enabled() && pte_young(*pvmw.pte)) {
lru_gen_look_around(&pvmw);
referenced++;
}
if (ptep_clear_flush_young_notify(vma, address,
- pvmw.pte)) {
- /*
- * Don't treat a reference through
- * a sequentially read mapping as such.
- * If the folio has been used in another mapping,
- * we will catch it; if this other mapping is
- * already gone, the unmap path will have set
- * the referenced flag or activated the folio.
- */
- if (likely(!(vma->vm_flags & VM_SEQ_READ)))
- referenced++;
- }
+ pvmw.pte))
+ referenced++;
} else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
if (pmdp_clear_flush_young_notify(vma, address,
pvmw.pmd))
@@ -875,7 +864,20 @@ static bool invalid_folio_referenced_vma
struct folio_referenced_arg *pra = arg;
struct mem_cgroup *memcg = pra->memcg;
- if (!mm_match_cgroup(vma->vm_mm, memcg))
+ /*
+ * Ignore references from this mapping if it has no recency. If the
+ * page has been used in another mapping, we will catch it; if this
+ * other mapping is already gone, the unmap path will have set the
+ * referenced flag or activated the page in zap_pte_range().
+ */
+ if (!vma_has_recency(vma))
+ return true;
+
+ /*
+ * If we are reclaiming on behalf of a cgroup, skip counting on behalf
+ * of references from different cgroups.
+ */
+ if (memcg && !mm_match_cgroup(vma->vm_mm, memcg))
return true;
return false;
@@ -906,6 +908,7 @@ int folio_referenced(struct folio *folio
.arg = (void *)&pra,
.anon_lock = folio_lock_anon_vma_read,
.try_lock = true,
+ .invalid_vma = invalid_folio_referenced_vma,
};
*vm_flags = 0;
@@ -921,15 +924,6 @@ int folio_referenced(struct folio *folio
return 1;
}
- /*
- * If we are reclaiming on behalf of a cgroup, skip
- * counting on behalf of references from different
- * cgroups
- */
- if (memcg) {
- rwc.invalid_vma = invalid_folio_referenced_vma;
- }
-
rmap_walk(folio, &rwc);
*vm_flags = pra.vm_flags;
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3766,7 +3766,10 @@ static int should_skip_vma(unsigned long
if (is_vm_hugetlb_page(vma))
return true;
- if (vma->vm_flags & (VM_LOCKED | VM_SPECIAL | VM_SEQ_READ | VM_RAND_READ))
+ if (!vma_has_recency(vma))
+ return true;
+
+ if (vma->vm_flags & (VM_LOCKED | VM_SPECIAL))
return true;
if (vma == get_gate_vma(vma->vm_mm))

View file

@ -0,0 +1,125 @@
From 686c3d4f71de9e0e7a27f03a5617a712385f90cd Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Fri, 30 Dec 2022 14:52:52 -0700
Subject: [PATCH 20/29] mm: support POSIX_FADV_NOREUSE
This patch adds POSIX_FADV_NOREUSE to vma_has_recency() so that the LRU
algorithm can ignore access to mapped files marked by this flag.
The advantages of POSIX_FADV_NOREUSE are:
1. Unlike MADV_SEQUENTIAL and MADV_RANDOM, it does not alter the
default readahead behavior.
2. Unlike MADV_SEQUENTIAL and MADV_RANDOM, it does not split VMAs and
therefore does not take mmap_lock.
3. Unlike MADV_COLD, setting it has a negligible cost, regardless of
how many pages it affects.
Its limitations are:
1. Like POSIX_FADV_RANDOM and POSIX_FADV_SEQUENTIAL, it currently does
not support range. IOW, its scope is the entire file.
2. It currently does not ignore access through file descriptors.
Specifically, for the active/inactive LRU, given a file page shared
by two users and one of them having set POSIX_FADV_NOREUSE on the
file, this page will be activated upon the second user accessing
it. This corner case can be covered by checking POSIX_FADV_NOREUSE
before calling mark_page_accessed() on the read path. But it is
considered not worth the effort.
There have been a few attempts to support POSIX_FADV_NOREUSE, e.g., [1].
This time the goal is to fill a niche: a few desktop applications, e.g.,
large file transferring and video encoding/decoding, want fast file
streaming with mmap() rather than direct IO. Among those applications, an
SVT-AV1 regression was reported when running with MGLRU [2]. The
following test can reproduce that regression.
kb=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
kb=$((kb - 8*1024*1024))
modprobe brd rd_nr=1 rd_size=$kb
dd if=/dev/zero of=/dev/ram0 bs=1M
mkfs.ext4 /dev/ram0
mount /dev/ram0 /mnt/
swapoff -a
fallocate -l 8G /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
wget http://ultravideo.cs.tut.fi/video/Bosphorus_3840x2160_120fps_420_8bit_YUV_Y4M.7z
7z e -o/mnt/ Bosphorus_3840x2160_120fps_420_8bit_YUV_Y4M.7z
SvtAv1EncApp --preset 12 -w 3840 -h 2160 \
-i /mnt/Bosphorus_3840x2160.y4m
For MGLRU, the following change showed a [9-11]% increase in FPS,
which makes it on par with the active/inactive LRU.
patch Source/App/EncApp/EbAppMain.c <<EOF
31a32
> #include <fcntl.h>
35d35
< #include <fcntl.h> /* _O_BINARY */
117a118
> posix_fadvise(config->mmap.fd, 0, 0, POSIX_FADV_NOREUSE);
EOF
[1] https://lore.kernel.org/r/1308923350-7932-1-git-send-email-andrea@betterlinux.com/
[2] https://openbenchmarking.org/result/2209259-PTS-MGLRU8GB57
Link: https://lkml.kernel.org/r/20221230215252.2628425-2-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrea Righi <andrea.righi@canonical.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/fs.h | 2 ++
include/linux/mm_inline.h | 3 +++
mm/fadvise.c | 5 ++++-
3 files changed, 9 insertions(+), 1 deletion(-)
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -166,6 +166,8 @@ typedef int (dio_iodone_t)(struct kiocb
/* File supports DIRECT IO */
#define FMODE_CAN_ODIRECT ((__force fmode_t)0x400000)
+#define FMODE_NOREUSE ((__force fmode_t)0x400000)
+
/* File was opened by fanotify and shouldn't generate fanotify events */
#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -583,6 +583,9 @@ static inline bool vma_has_recency(struc
if (vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))
return false;
+ if (vma->vm_file && (vma->vm_file->f_mode & FMODE_NOREUSE))
+ return false;
+
return true;
}
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -80,7 +80,7 @@ int generic_fadvise(struct file *file, l
case POSIX_FADV_NORMAL:
file->f_ra.ra_pages = bdi->ra_pages;
spin_lock(&file->f_lock);
- file->f_mode &= ~FMODE_RANDOM;
+ file->f_mode &= ~(FMODE_RANDOM | FMODE_NOREUSE);
spin_unlock(&file->f_lock);
break;
case POSIX_FADV_RANDOM:
@@ -107,6 +107,9 @@ int generic_fadvise(struct file *file, l
force_page_cache_readahead(mapping, file, start_index, nrpages);
break;
case POSIX_FADV_NOREUSE:
+ spin_lock(&file->f_lock);
+ file->f_mode |= FMODE_NOREUSE;
+ spin_unlock(&file->f_lock);
break;
case POSIX_FADV_DONTNEED:
__filemap_fdatawrite_range(mapping, offset, endbyte,

View file

@ -0,0 +1,348 @@
From 348fdbada9fb3f0bf1a53651be46319105af187f Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:18:59 -0700
Subject: [PATCH 21/29] mm: multi-gen LRU: rename lru_gen_struct to
lru_gen_folio
Patch series "mm: multi-gen LRU: memcg LRU", v3.
Overview
========
An memcg LRU is a per-node LRU of memcgs. It is also an LRU of LRUs,
since each node and memcg combination has an LRU of folios (see
mem_cgroup_lruvec()).
Its goal is to improve the scalability of global reclaim, which is
critical to system-wide memory overcommit in data centers. Note that
memcg reclaim is currently out of scope.
Its memory bloat is a pointer to each lruvec and negligible to each
pglist_data. In terms of traversing memcgs during global reclaim, it
improves the best-case complexity from O(n) to O(1) and does not affect
the worst-case complexity O(n). Therefore, on average, it has a sublinear
complexity in contrast to the current linear complexity.
The basic structure of an memcg LRU can be understood by an analogy to
the active/inactive LRU (of folios):
1. It has the young and the old (generations), i.e., the counterparts
to the active and the inactive;
2. The increment of max_seq triggers promotion, i.e., the counterpart
to activation;
3. Other events trigger similar operations, e.g., offlining an memcg
triggers demotion, i.e., the counterpart to deactivation.
In terms of global reclaim, it has two distinct features:
1. Sharding, which allows each thread to start at a random memcg (in
the old generation) and improves parallelism;
2. Eventual fairness, which allows direct reclaim to bail out at will
and reduces latency without affecting fairness over some time.
The commit message in patch 6 details the workflow:
https://lore.kernel.org/r/20221222041905.2431096-7-yuzhao@google.com/
The following is a simple test to quickly verify its effectiveness.
Test design:
1. Create multiple memcgs.
2. Each memcg contains a job (fio).
3. All jobs access the same amount of memory randomly.
4. The system does not experience global memory pressure.
5. Periodically write to the root memory.reclaim.
Desired outcome:
1. All memcgs have similar pgsteal counts, i.e., stddev(pgsteal)
over mean(pgsteal) is close to 0%.
2. The total pgsteal is close to the total requested through
memory.reclaim, i.e., sum(pgsteal) over sum(requested) is close
to 100%.
Actual outcome [1]:
MGLRU off MGLRU on
stddev(pgsteal) / mean(pgsteal) 75% 20%
sum(pgsteal) / sum(requested) 425% 95%
####################################################################
MEMCGS=128
for ((memcg = 0; memcg < $MEMCGS; memcg++)); do
mkdir /sys/fs/cgroup/memcg$memcg
done
start() {
echo $BASHPID > /sys/fs/cgroup/memcg$memcg/cgroup.procs
fio -name=memcg$memcg --numjobs=1 --ioengine=mmap \
--filename=/dev/zero --size=1920M --rw=randrw \
--rate=64m,64m --random_distribution=random \
--fadvise_hint=0 --time_based --runtime=10h \
--group_reporting --minimal
}
for ((memcg = 0; memcg < $MEMCGS; memcg++)); do
start &
done
sleep 600
for ((i = 0; i < 600; i++)); do
echo 256m >/sys/fs/cgroup/memory.reclaim
sleep 6
done
for ((memcg = 0; memcg < $MEMCGS; memcg++)); do
grep "pgsteal " /sys/fs/cgroup/memcg$memcg/memory.stat
done
####################################################################
[1]: This was obtained from running the above script (touches less
than 256GB memory) on an EPYC 7B13 with 512GB DRAM for over an
hour.
This patch (of 8):
The new name lru_gen_folio will be more distinct from the coming
lru_gen_memcg.
Link: https://lkml.kernel.org/r/20221222041905.2431096-1-yuzhao@google.com
Link: https://lkml.kernel.org/r/20221222041905.2431096-2-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mm_inline.h | 4 ++--
include/linux/mmzone.h | 6 +++---
mm/vmscan.c | 34 +++++++++++++++++-----------------
mm/workingset.c | 4 ++--
4 files changed, 24 insertions(+), 24 deletions(-)
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -178,7 +178,7 @@ static inline void lru_gen_update_size(s
int zone = folio_zonenum(folio);
int delta = folio_nr_pages(folio);
enum lru_list lru = type * LRU_INACTIVE_FILE;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
VM_WARN_ON_ONCE(old_gen != -1 && old_gen >= MAX_NR_GENS);
VM_WARN_ON_ONCE(new_gen != -1 && new_gen >= MAX_NR_GENS);
@@ -224,7 +224,7 @@ static inline bool lru_gen_add_folio(str
int gen = folio_lru_gen(folio);
int type = folio_is_file_lru(folio);
int zone = folio_zonenum(folio);
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
VM_WARN_ON_ONCE_FOLIO(gen != -1, folio);
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -404,7 +404,7 @@ enum {
* The number of pages in each generation is eventually consistent and therefore
* can be transiently negative when reset_batch_size() is pending.
*/
-struct lru_gen_struct {
+struct lru_gen_folio {
/* the aging increments the youngest generation number */
unsigned long max_seq;
/* the eviction increments the oldest generation numbers */
@@ -461,7 +461,7 @@ struct lru_gen_mm_state {
struct lru_gen_mm_walk {
/* the lruvec under reclaim */
struct lruvec *lruvec;
- /* unstable max_seq from lru_gen_struct */
+ /* unstable max_seq from lru_gen_folio */
unsigned long max_seq;
/* the next address within an mm to scan */
unsigned long next_addr;
@@ -524,7 +524,7 @@ struct lruvec {
unsigned long flags;
#ifdef CONFIG_LRU_GEN
/* evictable pages divided into generations */
- struct lru_gen_struct lrugen;
+ struct lru_gen_folio lrugen;
/* to concurrently iterate lru_gen_mm_list */
struct lru_gen_mm_state mm_state;
#endif
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3190,7 +3190,7 @@ static int get_nr_gens(struct lruvec *lr
static bool __maybe_unused seq_is_valid(struct lruvec *lruvec)
{
- /* see the comment on lru_gen_struct */
+ /* see the comment on lru_gen_folio */
return get_nr_gens(lruvec, LRU_GEN_FILE) >= MIN_NR_GENS &&
get_nr_gens(lruvec, LRU_GEN_FILE) <= get_nr_gens(lruvec, LRU_GEN_ANON) &&
get_nr_gens(lruvec, LRU_GEN_ANON) <= MAX_NR_GENS;
@@ -3596,7 +3596,7 @@ struct ctrl_pos {
static void read_ctrl_pos(struct lruvec *lruvec, int type, int tier, int gain,
struct ctrl_pos *pos)
{
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
int hist = lru_hist_from_seq(lrugen->min_seq[type]);
pos->refaulted = lrugen->avg_refaulted[type][tier] +
@@ -3611,7 +3611,7 @@ static void read_ctrl_pos(struct lruvec
static void reset_ctrl_pos(struct lruvec *lruvec, int type, bool carryover)
{
int hist, tier;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
bool clear = carryover ? NR_HIST_GENS == 1 : NR_HIST_GENS > 1;
unsigned long seq = carryover ? lrugen->min_seq[type] : lrugen->max_seq + 1;
@@ -3688,7 +3688,7 @@ static int folio_update_gen(struct folio
static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio, bool reclaiming)
{
int type = folio_is_file_lru(folio);
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
int new_gen, old_gen = lru_gen_from_seq(lrugen->min_seq[type]);
unsigned long new_flags, old_flags = READ_ONCE(folio->flags);
@@ -3733,7 +3733,7 @@ static void update_batch_size(struct lru
static void reset_batch_size(struct lruvec *lruvec, struct lru_gen_mm_walk *walk)
{
int gen, type, zone;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
walk->batched = 0;
@@ -4253,7 +4253,7 @@ static bool inc_min_seq(struct lruvec *l
{
int zone;
int remaining = MAX_LRU_BATCH;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
int new_gen, old_gen = lru_gen_from_seq(lrugen->min_seq[type]);
if (type == LRU_GEN_ANON && !can_swap)
@@ -4289,7 +4289,7 @@ static bool try_to_inc_min_seq(struct lr
{
int gen, type, zone;
bool success = false;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
DEFINE_MIN_SEQ(lruvec);
VM_WARN_ON_ONCE(!seq_is_valid(lruvec));
@@ -4310,7 +4310,7 @@ next:
;
}
- /* see the comment on lru_gen_struct */
+ /* see the comment on lru_gen_folio */
if (can_swap) {
min_seq[LRU_GEN_ANON] = min(min_seq[LRU_GEN_ANON], min_seq[LRU_GEN_FILE]);
min_seq[LRU_GEN_FILE] = max(min_seq[LRU_GEN_ANON], lrugen->min_seq[LRU_GEN_FILE]);
@@ -4332,7 +4332,7 @@ static void inc_max_seq(struct lruvec *l
{
int prev, next;
int type, zone;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
spin_lock_irq(&lruvec->lru_lock);
@@ -4390,7 +4390,7 @@ static bool try_to_inc_max_seq(struct lr
bool success;
struct lru_gen_mm_walk *walk;
struct mm_struct *mm = NULL;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
VM_WARN_ON_ONCE(max_seq > READ_ONCE(lrugen->max_seq));
@@ -4455,7 +4455,7 @@ static bool should_run_aging(struct lruv
unsigned long old = 0;
unsigned long young = 0;
unsigned long total = 0;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
for (type = !can_swap; type < ANON_AND_FILE; type++) {
@@ -4740,7 +4740,7 @@ static bool sort_folio(struct lruvec *lr
int delta = folio_nr_pages(folio);
int refs = folio_lru_refs(folio);
int tier = lru_tier_from_refs(refs);
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
VM_WARN_ON_ONCE_FOLIO(gen >= MAX_NR_GENS, folio);
@@ -4840,7 +4840,7 @@ static int scan_folios(struct lruvec *lr
int scanned = 0;
int isolated = 0;
int remaining = MAX_LRU_BATCH;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
VM_WARN_ON_ONCE(!list_empty(list));
@@ -5240,7 +5240,7 @@ done:
static bool __maybe_unused state_is_valid(struct lruvec *lruvec)
{
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
if (lrugen->enabled) {
enum lru_list lru;
@@ -5522,7 +5522,7 @@ static void lru_gen_seq_show_full(struct
int i;
int type, tier;
int hist = lru_hist_from_seq(seq);
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
for (tier = 0; tier < MAX_NR_TIERS; tier++) {
seq_printf(m, " %10d", tier);
@@ -5572,7 +5572,7 @@ static int lru_gen_seq_show(struct seq_f
unsigned long seq;
bool full = !debugfs_real_fops(m->file)->write;
struct lruvec *lruvec = v;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
int nid = lruvec_pgdat(lruvec)->node_id;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
@@ -5826,7 +5826,7 @@ void lru_gen_init_lruvec(struct lruvec *
{
int i;
int gen, type, zone;
- struct lru_gen_struct *lrugen = &lruvec->lrugen;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
lrugen->max_seq = MIN_NR_GENS + 1;
lrugen->enabled = lru_gen_enabled();
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -223,7 +223,7 @@ static void *lru_gen_eviction(struct fol
unsigned long token;
unsigned long min_seq;
struct lruvec *lruvec;
- struct lru_gen_struct *lrugen;
+ struct lru_gen_folio *lrugen;
int type = folio_is_file_lru(folio);
int delta = folio_nr_pages(folio);
int refs = folio_lru_refs(folio);
@@ -252,7 +252,7 @@ static void lru_gen_refault(struct folio
unsigned long token;
unsigned long min_seq;
struct lruvec *lruvec;
- struct lru_gen_struct *lrugen;
+ struct lru_gen_folio *lrugen;
struct mem_cgroup *memcg;
struct pglist_data *pgdat;
int type = folio_is_file_lru(folio);

View file

@ -0,0 +1,162 @@
From afd37e73db04c7e6b47411120ac5f6a7eca51fec Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:00 -0700
Subject: [PATCH 22/29] mm: multi-gen LRU: rename lrugen->lists[] to
lrugen->folios[]
lru_gen_folio will be chained into per-node lists by the coming
lrugen->list.
Link: https://lkml.kernel.org/r/20221222041905.2431096-3-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mm_inline.h | 4 ++--
include/linux/mmzone.h | 8 ++++----
mm/vmscan.c | 20 ++++++++++----------
3 files changed, 16 insertions(+), 16 deletions(-)
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -256,9 +256,9 @@ static inline bool lru_gen_add_folio(str
lru_gen_update_size(lruvec, folio, -1, gen);
/* for folio_rotate_reclaimable() */
if (reclaiming)
- list_add_tail(&folio->lru, &lrugen->lists[gen][type][zone]);
+ list_add_tail(&folio->lru, &lrugen->folios[gen][type][zone]);
else
- list_add(&folio->lru, &lrugen->lists[gen][type][zone]);
+ list_add(&folio->lru, &lrugen->folios[gen][type][zone]);
return true;
}
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -312,7 +312,7 @@ enum lruvec_flags {
* They form a sliding window of a variable size [MIN_NR_GENS, MAX_NR_GENS]. An
* offset within MAX_NR_GENS, i.e., gen, indexes the LRU list of the
* corresponding generation. The gen counter in folio->flags stores gen+1 while
- * a page is on one of lrugen->lists[]. Otherwise it stores 0.
+ * a page is on one of lrugen->folios[]. Otherwise it stores 0.
*
* A page is added to the youngest generation on faulting. The aging needs to
* check the accessed bit at least twice before handing this page over to the
@@ -324,8 +324,8 @@ enum lruvec_flags {
* rest of generations, if they exist, are considered inactive. See
* lru_gen_is_active().
*
- * PG_active is always cleared while a page is on one of lrugen->lists[] so that
- * the aging needs not to worry about it. And it's set again when a page
+ * PG_active is always cleared while a page is on one of lrugen->folios[] so
+ * that the aging needs not to worry about it. And it's set again when a page
* considered active is isolated for non-reclaiming purposes, e.g., migration.
* See lru_gen_add_folio() and lru_gen_del_folio().
*
@@ -412,7 +412,7 @@ struct lru_gen_folio {
/* the birth time of each generation in jiffies */
unsigned long timestamps[MAX_NR_GENS];
/* the multi-gen LRU lists, lazily sorted on eviction */
- struct list_head lists[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES];
+ struct list_head folios[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES];
/* the multi-gen LRU sizes, eventually consistent */
long nr_pages[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES];
/* the exponential moving average of refaulted */
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4261,7 +4261,7 @@ static bool inc_min_seq(struct lruvec *l
/* prevent cold/hot inversion if force_scan is true */
for (zone = 0; zone < MAX_NR_ZONES; zone++) {
- struct list_head *head = &lrugen->lists[old_gen][type][zone];
+ struct list_head *head = &lrugen->folios[old_gen][type][zone];
while (!list_empty(head)) {
struct folio *folio = lru_to_folio(head);
@@ -4272,7 +4272,7 @@ static bool inc_min_seq(struct lruvec *l
VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio) != zone, folio);
new_gen = folio_inc_gen(lruvec, folio, false);
- list_move_tail(&folio->lru, &lrugen->lists[new_gen][type][zone]);
+ list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]);
if (!--remaining)
return false;
@@ -4300,7 +4300,7 @@ static bool try_to_inc_min_seq(struct lr
gen = lru_gen_from_seq(min_seq[type]);
for (zone = 0; zone < MAX_NR_ZONES; zone++) {
- if (!list_empty(&lrugen->lists[gen][type][zone]))
+ if (!list_empty(&lrugen->folios[gen][type][zone]))
goto next;
}
@@ -4765,7 +4765,7 @@ static bool sort_folio(struct lruvec *lr
/* promoted */
if (gen != lru_gen_from_seq(lrugen->min_seq[type])) {
- list_move(&folio->lru, &lrugen->lists[gen][type][zone]);
+ list_move(&folio->lru, &lrugen->folios[gen][type][zone]);
return true;
}
@@ -4774,7 +4774,7 @@ static bool sort_folio(struct lruvec *lr
int hist = lru_hist_from_seq(lrugen->min_seq[type]);
gen = folio_inc_gen(lruvec, folio, false);
- list_move_tail(&folio->lru, &lrugen->lists[gen][type][zone]);
+ list_move_tail(&folio->lru, &lrugen->folios[gen][type][zone]);
WRITE_ONCE(lrugen->protected[hist][type][tier - 1],
lrugen->protected[hist][type][tier - 1] + delta);
@@ -4786,7 +4786,7 @@ static bool sort_folio(struct lruvec *lr
if (folio_test_locked(folio) || folio_test_writeback(folio) ||
(type == LRU_GEN_FILE && folio_test_dirty(folio))) {
gen = folio_inc_gen(lruvec, folio, true);
- list_move(&folio->lru, &lrugen->lists[gen][type][zone]);
+ list_move(&folio->lru, &lrugen->folios[gen][type][zone]);
return true;
}
@@ -4853,7 +4853,7 @@ static int scan_folios(struct lruvec *lr
for (zone = sc->reclaim_idx; zone >= 0; zone--) {
LIST_HEAD(moved);
int skipped = 0;
- struct list_head *head = &lrugen->lists[gen][type][zone];
+ struct list_head *head = &lrugen->folios[gen][type][zone];
while (!list_empty(head)) {
struct folio *folio = lru_to_folio(head);
@@ -5253,7 +5253,7 @@ static bool __maybe_unused state_is_vali
int gen, type, zone;
for_each_gen_type_zone(gen, type, zone) {
- if (!list_empty(&lrugen->lists[gen][type][zone]))
+ if (!list_empty(&lrugen->folios[gen][type][zone]))
return false;
}
}
@@ -5298,7 +5298,7 @@ static bool drain_evictable(struct lruve
int remaining = MAX_LRU_BATCH;
for_each_gen_type_zone(gen, type, zone) {
- struct list_head *head = &lruvec->lrugen.lists[gen][type][zone];
+ struct list_head *head = &lruvec->lrugen.folios[gen][type][zone];
while (!list_empty(head)) {
bool success;
@@ -5835,7 +5835,7 @@ void lru_gen_init_lruvec(struct lruvec *
lrugen->timestamps[i] = jiffies;
for_each_gen_type_zone(gen, type, zone)
- INIT_LIST_HEAD(&lrugen->lists[gen][type][zone]);
+ INIT_LIST_HEAD(&lrugen->folios[gen][type][zone]);
lruvec->mm_state.seq = MIN_NR_GENS;
init_waitqueue_head(&lruvec->mm_state.wait);

View file

@ -0,0 +1,187 @@
From ce45f1c4b32cf69b166f56ef5bc6c761e06ed4e5 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:01 -0700
Subject: [PATCH 23/29] mm: multi-gen LRU: remove eviction fairness safeguard
Recall that the eviction consumes the oldest generation: first it
bucket-sorts folios whose gen counters were updated by the aging and
reclaims the rest; then it increments lrugen->min_seq.
The current eviction fairness safeguard for global reclaim has a
dilemma: when there are multiple eligible memcgs, should it continue
or stop upon meeting the reclaim goal? If it continues, it overshoots
and increases direct reclaim latency; if it stops, it loses fairness
between memcgs it has taken memory away from and those it has yet to.
With memcg LRU, the eviction, while ensuring eventual fairness, will
stop upon meeting its goal. Therefore the current eviction fairness
safeguard for global reclaim will not be needed.
Note that memcg LRU only applies to global reclaim. For memcg reclaim,
the eviction will continue, even if it is overshooting. This becomes
unconditional due to code simplification.
Link: https://lkml.kernel.org/r/20221222041905.2431096-4-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 82 +++++++++++++++--------------------------------------
1 file changed, 23 insertions(+), 59 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -448,6 +448,11 @@ static bool cgroup_reclaim(struct scan_c
return sc->target_mem_cgroup;
}
+static bool global_reclaim(struct scan_control *sc)
+{
+ return !sc->target_mem_cgroup || mem_cgroup_is_root(sc->target_mem_cgroup);
+}
+
/**
* writeback_throttling_sane - is the usual dirty throttling mechanism available?
* @sc: scan_control in question
@@ -498,6 +503,11 @@ static bool cgroup_reclaim(struct scan_c
return false;
}
+static bool global_reclaim(struct scan_control *sc)
+{
+ return true;
+}
+
static bool writeback_throttling_sane(struct scan_control *sc)
{
return true;
@@ -4996,8 +5006,7 @@ static int isolate_folios(struct lruvec
return scanned;
}
-static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swappiness,
- bool *need_swapping)
+static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swappiness)
{
int type;
int scanned;
@@ -5086,9 +5095,6 @@ retry:
goto retry;
}
- if (need_swapping && type == LRU_GEN_ANON)
- *need_swapping = true;
-
return scanned;
}
@@ -5127,67 +5133,26 @@ done:
return min_seq[!can_swap] + MIN_NR_GENS <= max_seq ? nr_to_scan : 0;
}
-static bool should_abort_scan(struct lruvec *lruvec, unsigned long seq,
- struct scan_control *sc, bool need_swapping)
+static unsigned long get_nr_to_reclaim(struct scan_control *sc)
{
- int i;
- DEFINE_MAX_SEQ(lruvec);
-
- if (!current_is_kswapd()) {
- /* age each memcg at most once to ensure fairness */
- if (max_seq - seq > 1)
- return true;
-
- /* over-swapping can increase allocation latency */
- if (sc->nr_reclaimed >= sc->nr_to_reclaim && need_swapping)
- return true;
-
- /* give this thread a chance to exit and free its memory */
- if (fatal_signal_pending(current)) {
- sc->nr_reclaimed += MIN_LRU_BATCH;
- return true;
- }
-
- if (cgroup_reclaim(sc))
- return false;
- } else if (sc->nr_reclaimed - sc->last_reclaimed < sc->nr_to_reclaim)
- return false;
-
- /* keep scanning at low priorities to ensure fairness */
- if (sc->priority > DEF_PRIORITY - 2)
- return false;
-
- /*
- * A minimum amount of work was done under global memory pressure. For
- * kswapd, it may be overshooting. For direct reclaim, the allocation
- * may succeed if all suitable zones are somewhat safe. In either case,
- * it's better to stop now, and restart later if necessary.
- */
- for (i = 0; i <= sc->reclaim_idx; i++) {
- unsigned long wmark;
- struct zone *zone = lruvec_pgdat(lruvec)->node_zones + i;
-
- if (!managed_zone(zone))
- continue;
-
- wmark = current_is_kswapd() ? high_wmark_pages(zone) : low_wmark_pages(zone);
- if (wmark > zone_page_state(zone, NR_FREE_PAGES))
- return false;
- }
+ /* don't abort memcg reclaim to ensure fairness */
+ if (!global_reclaim(sc))
+ return -1;
- sc->nr_reclaimed += MIN_LRU_BATCH;
+ /* discount the previous progress for kswapd */
+ if (current_is_kswapd())
+ return sc->nr_to_reclaim + sc->last_reclaimed;
- return true;
+ return max(sc->nr_to_reclaim, compact_gap(sc->order));
}
static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
{
struct blk_plug plug;
bool need_aging = false;
- bool need_swapping = false;
unsigned long scanned = 0;
unsigned long reclaimed = sc->nr_reclaimed;
- DEFINE_MAX_SEQ(lruvec);
+ unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
lru_add_drain();
@@ -5211,7 +5176,7 @@ static void lru_gen_shrink_lruvec(struct
if (!nr_to_scan)
goto done;
- delta = evict_folios(lruvec, sc, swappiness, &need_swapping);
+ delta = evict_folios(lruvec, sc, swappiness);
if (!delta)
goto done;
@@ -5219,7 +5184,7 @@ static void lru_gen_shrink_lruvec(struct
if (scanned >= nr_to_scan)
break;
- if (should_abort_scan(lruvec, max_seq, sc, need_swapping))
+ if (sc->nr_reclaimed >= nr_to_reclaim)
break;
cond_resched();
@@ -5669,7 +5634,7 @@ static int run_eviction(struct lruvec *l
if (sc->nr_reclaimed >= nr_to_reclaim)
return 0;
- if (!evict_folios(lruvec, sc, swappiness, NULL))
+ if (!evict_folios(lruvec, sc, swappiness))
return 0;
cond_resched();

View file

@ -0,0 +1,287 @@
From e20b7386fccc18c791796eb1dc1a91eee3ccf801 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:02 -0700
Subject: [PATCH 24/29] mm: multi-gen LRU: remove aging fairness safeguard
Recall that the aging produces the youngest generation: first it scans
for accessed folios and updates their gen counters; then it increments
lrugen->max_seq.
The current aging fairness safeguard for kswapd uses two passes to
ensure the fairness to multiple eligible memcgs. On the first pass,
which is shared with the eviction, it checks whether all eligible
memcgs are low on cold folios. If so, it requires a second pass, on
which it ages all those memcgs at the same time.
With memcg LRU, the aging, while ensuring eventual fairness, will run
when necessary. Therefore the current aging fairness safeguard for
kswapd will not be needed.
Note that memcg LRU only applies to global reclaim. For memcg reclaim,
the aging can be unfair to different memcgs, i.e., their
lrugen->max_seq can be incremented at different paces.
Link: https://lkml.kernel.org/r/20221222041905.2431096-5-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 126 ++++++++++++++++++++++++----------------------------
1 file changed, 59 insertions(+), 67 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -136,7 +136,6 @@ struct scan_control {
#ifdef CONFIG_LRU_GEN
/* help kswapd make better choices among multiple memcgs */
- unsigned int memcgs_need_aging:1;
unsigned long last_reclaimed;
#endif
@@ -4458,7 +4457,7 @@ done:
return true;
}
-static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq, unsigned long *min_seq,
+static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
struct scan_control *sc, bool can_swap, unsigned long *nr_to_scan)
{
int gen, type, zone;
@@ -4467,6 +4466,13 @@ static bool should_run_aging(struct lruv
unsigned long total = 0;
struct lru_gen_folio *lrugen = &lruvec->lrugen;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
+ DEFINE_MIN_SEQ(lruvec);
+
+ /* whether this lruvec is completely out of cold folios */
+ if (min_seq[!can_swap] + MIN_NR_GENS > max_seq) {
+ *nr_to_scan = 0;
+ return true;
+ }
for (type = !can_swap; type < ANON_AND_FILE; type++) {
unsigned long seq;
@@ -4495,8 +4501,6 @@ static bool should_run_aging(struct lruv
* stalls when the number of generations reaches MIN_NR_GENS. Hence, the
* ideal number of generations is MIN_NR_GENS+1.
*/
- if (min_seq[!can_swap] + MIN_NR_GENS > max_seq)
- return true;
if (min_seq[!can_swap] + MIN_NR_GENS < max_seq)
return false;
@@ -4515,40 +4519,54 @@ static bool should_run_aging(struct lruv
return false;
}
-static bool age_lruvec(struct lruvec *lruvec, struct scan_control *sc, unsigned long min_ttl)
+static bool lruvec_is_sizable(struct lruvec *lruvec, struct scan_control *sc)
{
- bool need_aging;
- unsigned long nr_to_scan;
- int swappiness = get_swappiness(lruvec, sc);
+ int gen, type, zone;
+ unsigned long total = 0;
+ bool can_swap = get_swappiness(lruvec, sc);
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
DEFINE_MIN_SEQ(lruvec);
- VM_WARN_ON_ONCE(sc->memcg_low_reclaim);
+ for (type = !can_swap; type < ANON_AND_FILE; type++) {
+ unsigned long seq;
- mem_cgroup_calculate_protection(NULL, memcg);
+ for (seq = min_seq[type]; seq <= max_seq; seq++) {
+ gen = lru_gen_from_seq(seq);
- if (mem_cgroup_below_min(memcg))
- return false;
+ for (zone = 0; zone < MAX_NR_ZONES; zone++)
+ total += max(READ_ONCE(lrugen->nr_pages[gen][type][zone]), 0L);
+ }
+ }
- need_aging = should_run_aging(lruvec, max_seq, min_seq, sc, swappiness, &nr_to_scan);
+ /* whether the size is big enough to be helpful */
+ return mem_cgroup_online(memcg) ? (total >> sc->priority) : total;
+}
- if (min_ttl) {
- int gen = lru_gen_from_seq(min_seq[LRU_GEN_FILE]);
- unsigned long birth = READ_ONCE(lruvec->lrugen.timestamps[gen]);
+static bool lruvec_is_reclaimable(struct lruvec *lruvec, struct scan_control *sc,
+ unsigned long min_ttl)
+{
+ int gen;
+ unsigned long birth;
+ struct mem_cgroup *memcg = lruvec_memcg(lruvec);
+ DEFINE_MIN_SEQ(lruvec);
- if (time_is_after_jiffies(birth + min_ttl))
- return false;
+ VM_WARN_ON_ONCE(sc->memcg_low_reclaim);
- /* the size is likely too small to be helpful */
- if (!nr_to_scan && sc->priority != DEF_PRIORITY)
- return false;
- }
+ /* see the comment on lru_gen_folio */
+ gen = lru_gen_from_seq(min_seq[LRU_GEN_FILE]);
+ birth = READ_ONCE(lruvec->lrugen.timestamps[gen]);
- if (need_aging)
- try_to_inc_max_seq(lruvec, max_seq, sc, swappiness, false);
+ if (time_is_after_jiffies(birth + min_ttl))
+ return false;
- return true;
+ if (!lruvec_is_sizable(lruvec, sc))
+ return false;
+
+ mem_cgroup_calculate_protection(NULL, memcg);
+
+ return !mem_cgroup_below_min(memcg);
}
/* to protect the working set of the last N jiffies */
@@ -4557,46 +4575,32 @@ static unsigned long lru_gen_min_ttl __r
static void lru_gen_age_node(struct pglist_data *pgdat, struct scan_control *sc)
{
struct mem_cgroup *memcg;
- bool success = false;
unsigned long min_ttl = READ_ONCE(lru_gen_min_ttl);
VM_WARN_ON_ONCE(!current_is_kswapd());
sc->last_reclaimed = sc->nr_reclaimed;
- /*
- * To reduce the chance of going into the aging path, which can be
- * costly, optimistically skip it if the flag below was cleared in the
- * eviction path. This improves the overall performance when multiple
- * memcgs are available.
- */
- if (!sc->memcgs_need_aging) {
- sc->memcgs_need_aging = true;
+ /* check the order to exclude compaction-induced reclaim */
+ if (!min_ttl || sc->order || sc->priority == DEF_PRIORITY)
return;
- }
-
- set_mm_walk(pgdat);
memcg = mem_cgroup_iter(NULL, NULL, NULL);
do {
struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
- if (age_lruvec(lruvec, sc, min_ttl))
- success = true;
+ if (lruvec_is_reclaimable(lruvec, sc, min_ttl)) {
+ mem_cgroup_iter_break(NULL, memcg);
+ return;
+ }
cond_resched();
} while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)));
- clear_mm_walk();
-
- /* check the order to exclude compaction-induced reclaim */
- if (success || !min_ttl || sc->order)
- return;
-
/*
* The main goal is to OOM kill if every generation from all memcgs is
* younger than min_ttl. However, another possibility is all memcgs are
- * either below min or empty.
+ * either too small or below min.
*/
if (mutex_trylock(&oom_lock)) {
struct oom_control oc = {
@@ -5104,33 +5108,27 @@ retry:
* reclaim.
*/
static unsigned long get_nr_to_scan(struct lruvec *lruvec, struct scan_control *sc,
- bool can_swap, bool *need_aging)
+ bool can_swap)
{
unsigned long nr_to_scan;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
- DEFINE_MIN_SEQ(lruvec);
if (mem_cgroup_below_min(memcg) ||
(mem_cgroup_below_low(memcg) && !sc->memcg_low_reclaim))
return 0;
- *need_aging = should_run_aging(lruvec, max_seq, min_seq, sc, can_swap, &nr_to_scan);
- if (!*need_aging)
+ if (!should_run_aging(lruvec, max_seq, sc, can_swap, &nr_to_scan))
return nr_to_scan;
/* skip the aging path at the default priority */
if (sc->priority == DEF_PRIORITY)
- goto done;
+ return nr_to_scan;
- /* leave the work to lru_gen_age_node() */
- if (current_is_kswapd())
- return 0;
+ try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false);
- if (try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false))
- return nr_to_scan;
-done:
- return min_seq[!can_swap] + MIN_NR_GENS <= max_seq ? nr_to_scan : 0;
+ /* skip this lruvec as it's low on cold folios */
+ return 0;
}
static unsigned long get_nr_to_reclaim(struct scan_control *sc)
@@ -5149,9 +5147,7 @@ static unsigned long get_nr_to_reclaim(s
static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
{
struct blk_plug plug;
- bool need_aging = false;
unsigned long scanned = 0;
- unsigned long reclaimed = sc->nr_reclaimed;
unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
lru_add_drain();
@@ -5172,13 +5168,13 @@ static void lru_gen_shrink_lruvec(struct
else
swappiness = 0;
- nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness, &need_aging);
+ nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness);
if (!nr_to_scan)
- goto done;
+ break;
delta = evict_folios(lruvec, sc, swappiness);
if (!delta)
- goto done;
+ break;
scanned += delta;
if (scanned >= nr_to_scan)
@@ -5190,10 +5186,6 @@ static void lru_gen_shrink_lruvec(struct
cond_resched();
}
- /* see the comment in lru_gen_age_node() */
- if (sc->nr_reclaimed - reclaimed >= MIN_LRU_BATCH && !need_aging)
- sc->memcgs_need_aging = false;
-done:
clear_mm_walk();
blk_finish_plug(&plug);

View file

@ -0,0 +1,161 @@
From 107d54931df3c28d81648122e219bf0034ef4e99 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:03 -0700
Subject: [PATCH 25/29] mm: multi-gen LRU: shuffle should_run_aging()
Move should_run_aging() next to its only caller left.
Link: https://lkml.kernel.org/r/20221222041905.2431096-6-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 124 ++++++++++++++++++++++++++--------------------------
1 file changed, 62 insertions(+), 62 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4457,68 +4457,6 @@ done:
return true;
}
-static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
- struct scan_control *sc, bool can_swap, unsigned long *nr_to_scan)
-{
- int gen, type, zone;
- unsigned long old = 0;
- unsigned long young = 0;
- unsigned long total = 0;
- struct lru_gen_folio *lrugen = &lruvec->lrugen;
- struct mem_cgroup *memcg = lruvec_memcg(lruvec);
- DEFINE_MIN_SEQ(lruvec);
-
- /* whether this lruvec is completely out of cold folios */
- if (min_seq[!can_swap] + MIN_NR_GENS > max_seq) {
- *nr_to_scan = 0;
- return true;
- }
-
- for (type = !can_swap; type < ANON_AND_FILE; type++) {
- unsigned long seq;
-
- for (seq = min_seq[type]; seq <= max_seq; seq++) {
- unsigned long size = 0;
-
- gen = lru_gen_from_seq(seq);
-
- for (zone = 0; zone < MAX_NR_ZONES; zone++)
- size += max(READ_ONCE(lrugen->nr_pages[gen][type][zone]), 0L);
-
- total += size;
- if (seq == max_seq)
- young += size;
- else if (seq + MIN_NR_GENS == max_seq)
- old += size;
- }
- }
-
- /* try to scrape all its memory if this memcg was deleted */
- *nr_to_scan = mem_cgroup_online(memcg) ? (total >> sc->priority) : total;
-
- /*
- * The aging tries to be lazy to reduce the overhead, while the eviction
- * stalls when the number of generations reaches MIN_NR_GENS. Hence, the
- * ideal number of generations is MIN_NR_GENS+1.
- */
- if (min_seq[!can_swap] + MIN_NR_GENS < max_seq)
- return false;
-
- /*
- * It's also ideal to spread pages out evenly, i.e., 1/(MIN_NR_GENS+1)
- * of the total number of pages for each generation. A reasonable range
- * for this average portion is [1/MIN_NR_GENS, 1/(MIN_NR_GENS+2)]. The
- * aging cares about the upper bound of hot pages, while the eviction
- * cares about the lower bound of cold pages.
- */
- if (young * MIN_NR_GENS > total)
- return true;
- if (old * (MIN_NR_GENS + 2) < total)
- return true;
-
- return false;
-}
-
static bool lruvec_is_sizable(struct lruvec *lruvec, struct scan_control *sc)
{
int gen, type, zone;
@@ -5102,6 +5040,68 @@ retry:
return scanned;
}
+static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
+ struct scan_control *sc, bool can_swap, unsigned long *nr_to_scan)
+{
+ int gen, type, zone;
+ unsigned long old = 0;
+ unsigned long young = 0;
+ unsigned long total = 0;
+ struct lru_gen_folio *lrugen = &lruvec->lrugen;
+ struct mem_cgroup *memcg = lruvec_memcg(lruvec);
+ DEFINE_MIN_SEQ(lruvec);
+
+ /* whether this lruvec is completely out of cold folios */
+ if (min_seq[!can_swap] + MIN_NR_GENS > max_seq) {
+ *nr_to_scan = 0;
+ return true;
+ }
+
+ for (type = !can_swap; type < ANON_AND_FILE; type++) {
+ unsigned long seq;
+
+ for (seq = min_seq[type]; seq <= max_seq; seq++) {
+ unsigned long size = 0;
+
+ gen = lru_gen_from_seq(seq);
+
+ for (zone = 0; zone < MAX_NR_ZONES; zone++)
+ size += max(READ_ONCE(lrugen->nr_pages[gen][type][zone]), 0L);
+
+ total += size;
+ if (seq == max_seq)
+ young += size;
+ else if (seq + MIN_NR_GENS == max_seq)
+ old += size;
+ }
+ }
+
+ /* try to scrape all its memory if this memcg was deleted */
+ *nr_to_scan = mem_cgroup_online(memcg) ? (total >> sc->priority) : total;
+
+ /*
+ * The aging tries to be lazy to reduce the overhead, while the eviction
+ * stalls when the number of generations reaches MIN_NR_GENS. Hence, the
+ * ideal number of generations is MIN_NR_GENS+1.
+ */
+ if (min_seq[!can_swap] + MIN_NR_GENS < max_seq)
+ return false;
+
+ /*
+ * It's also ideal to spread pages out evenly, i.e., 1/(MIN_NR_GENS+1)
+ * of the total number of pages for each generation. A reasonable range
+ * for this average portion is [1/MIN_NR_GENS, 1/(MIN_NR_GENS+2)]. The
+ * aging cares about the upper bound of hot pages, while the eviction
+ * cares about the lower bound of cold pages.
+ */
+ if (young * MIN_NR_GENS > total)
+ return true;
+ if (old * (MIN_NR_GENS + 2) < total)
+ return true;
+
+ return false;
+}
+
/*
* For future optimizations:
* 1. Defer try_to_inc_max_seq() to workqueues to reduce latency for memcg

View file

@ -0,0 +1,868 @@
From fa6363828d314e837c5f79e97ea5e8c0d2f7f062 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:04 -0700
Subject: [PATCH 26/29] mm: multi-gen LRU: per-node lru_gen_folio lists
For each node, memcgs are divided into two generations: the old and
the young. For each generation, memcgs are randomly sharded into
multiple bins to improve scalability. For each bin, an RCU hlist_nulls
is virtually divided into three segments: the head, the tail and the
default.
An onlining memcg is added to the tail of a random bin in the old
generation. The eviction starts at the head of a random bin in the old
generation. The per-node memcg generation counter, whose reminder (mod
2) indexes the old generation, is incremented when all its bins become
empty.
There are four operations:
1. MEMCG_LRU_HEAD, which moves an memcg to the head of a random bin in
its current generation (old or young) and updates its "seg" to
"head";
2. MEMCG_LRU_TAIL, which moves an memcg to the tail of a random bin in
its current generation (old or young) and updates its "seg" to
"tail";
3. MEMCG_LRU_OLD, which moves an memcg to the head of a random bin in
the old generation, updates its "gen" to "old" and resets its "seg"
to "default";
4. MEMCG_LRU_YOUNG, which moves an memcg to the tail of a random bin
in the young generation, updates its "gen" to "young" and resets
its "seg" to "default".
The events that trigger the above operations are:
1. Exceeding the soft limit, which triggers MEMCG_LRU_HEAD;
2. The first attempt to reclaim an memcg below low, which triggers
MEMCG_LRU_TAIL;
3. The first attempt to reclaim an memcg below reclaimable size
threshold, which triggers MEMCG_LRU_TAIL;
4. The second attempt to reclaim an memcg below reclaimable size
threshold, which triggers MEMCG_LRU_YOUNG;
5. Attempting to reclaim an memcg below min, which triggers
MEMCG_LRU_YOUNG;
6. Finishing the aging on the eviction path, which triggers
MEMCG_LRU_YOUNG;
7. Offlining an memcg, which triggers MEMCG_LRU_OLD.
Note that memcg LRU only applies to global reclaim, and the
round-robin incrementing of their max_seq counters ensures the
eventual fairness to all eligible memcgs. For memcg reclaim, it still
relies on mem_cgroup_iter().
Link: https://lkml.kernel.org/r/20221222041905.2431096-7-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 10 +
include/linux/mm_inline.h | 17 ++
include/linux/mmzone.h | 117 +++++++++++-
mm/memcontrol.c | 16 ++
mm/folio_alloc.c | 1 +
mm/vmscan.c | 373 +++++++++++++++++++++++++++++++++----
6 files changed, 499 insertions(+), 35 deletions(-)
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -790,6 +790,11 @@ static inline void obj_cgroup_put(struct
percpu_ref_put(&objcg->refcnt);
}
+static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg)
+{
+ return !memcg || css_tryget(&memcg->css);
+}
+
static inline void mem_cgroup_put(struct mem_cgroup *memcg)
{
if (memcg)
@@ -1290,6 +1295,11 @@ static inline void obj_cgroup_put(struct
{
}
+static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg)
+{
+ return true;
+}
+
static inline void mem_cgroup_put(struct mem_cgroup *memcg)
{
}
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -122,6 +122,18 @@ static inline bool lru_gen_in_fault(void
return current->in_lru_fault;
}
+#ifdef CONFIG_MEMCG
+static inline int lru_gen_memcg_seg(struct lruvec *lruvec)
+{
+ return READ_ONCE(lruvec->lrugen.seg);
+}
+#else
+static inline int lru_gen_memcg_seg(struct lruvec *lruvec)
+{
+ return 0;
+}
+#endif
+
static inline int lru_gen_from_seq(unsigned long seq)
{
return seq % MAX_NR_GENS;
@@ -297,6 +309,11 @@ static inline bool lru_gen_in_fault(void
return false;
}
+static inline int lru_gen_memcg_seg(struct lruvec *lruvec)
+{
+ return 0;
+}
+
static inline bool lru_gen_add_folio(struct lruvec *lruvec, struct folio *folio, bool reclaiming)
{
return false;
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -7,6 +7,7 @@
#include <linux/spinlock.h>
#include <linux/list.h>
+#include <linux/list_nulls.h>
#include <linux/wait.h>
#include <linux/bitops.h>
#include <linux/cache.h>
@@ -367,6 +368,15 @@ struct page_vma_mapped_walk;
#define LRU_GEN_MASK ((BIT(LRU_GEN_WIDTH) - 1) << LRU_GEN_PGOFF)
#define LRU_REFS_MASK ((BIT(LRU_REFS_WIDTH) - 1) << LRU_REFS_PGOFF)
+/* see the comment on MEMCG_NR_GENS */
+enum {
+ MEMCG_LRU_NOP,
+ MEMCG_LRU_HEAD,
+ MEMCG_LRU_TAIL,
+ MEMCG_LRU_OLD,
+ MEMCG_LRU_YOUNG,
+};
+
#ifdef CONFIG_LRU_GEN
enum {
@@ -426,6 +436,14 @@ struct lru_gen_folio {
atomic_long_t refaulted[NR_HIST_GENS][ANON_AND_FILE][MAX_NR_TIERS];
/* whether the multi-gen LRU is enabled */
bool enabled;
+#ifdef CONFIG_MEMCG
+ /* the memcg generation this lru_gen_folio belongs to */
+ u8 gen;
+ /* the list segment this lru_gen_folio belongs to */
+ u8 seg;
+ /* per-node lru_gen_folio list for global reclaim */
+ struct hlist_nulls_node list;
+#endif
};
enum {
@@ -479,12 +497,87 @@ void lru_gen_init_lruvec(struct lruvec *
void lru_gen_look_around(struct page_vma_mapped_walk *pvmw);
#ifdef CONFIG_MEMCG
+
+/*
+ * For each node, memcgs are divided into two generations: the old and the
+ * young. For each generation, memcgs are randomly sharded into multiple bins
+ * to improve scalability. For each bin, the hlist_nulls is virtually divided
+ * into three segments: the head, the tail and the default.
+ *
+ * An onlining memcg is added to the tail of a random bin in the old generation.
+ * The eviction starts at the head of a random bin in the old generation. The
+ * per-node memcg generation counter, whose reminder (mod MEMCG_NR_GENS) indexes
+ * the old generation, is incremented when all its bins become empty.
+ *
+ * There are four operations:
+ * 1. MEMCG_LRU_HEAD, which moves an memcg to the head of a random bin in its
+ * current generation (old or young) and updates its "seg" to "head";
+ * 2. MEMCG_LRU_TAIL, which moves an memcg to the tail of a random bin in its
+ * current generation (old or young) and updates its "seg" to "tail";
+ * 3. MEMCG_LRU_OLD, which moves an memcg to the head of a random bin in the old
+ * generation, updates its "gen" to "old" and resets its "seg" to "default";
+ * 4. MEMCG_LRU_YOUNG, which moves an memcg to the tail of a random bin in the
+ * young generation, updates its "gen" to "young" and resets its "seg" to
+ * "default".
+ *
+ * The events that trigger the above operations are:
+ * 1. Exceeding the soft limit, which triggers MEMCG_LRU_HEAD;
+ * 2. The first attempt to reclaim an memcg below low, which triggers
+ * MEMCG_LRU_TAIL;
+ * 3. The first attempt to reclaim an memcg below reclaimable size threshold,
+ * which triggers MEMCG_LRU_TAIL;
+ * 4. The second attempt to reclaim an memcg below reclaimable size threshold,
+ * which triggers MEMCG_LRU_YOUNG;
+ * 5. Attempting to reclaim an memcg below min, which triggers MEMCG_LRU_YOUNG;
+ * 6. Finishing the aging on the eviction path, which triggers MEMCG_LRU_YOUNG;
+ * 7. Offlining an memcg, which triggers MEMCG_LRU_OLD.
+ *
+ * Note that memcg LRU only applies to global reclaim, and the round-robin
+ * incrementing of their max_seq counters ensures the eventual fairness to all
+ * eligible memcgs. For memcg reclaim, it still relies on mem_cgroup_iter().
+ */
+#define MEMCG_NR_GENS 2
+#define MEMCG_NR_BINS 8
+
+struct lru_gen_memcg {
+ /* the per-node memcg generation counter */
+ unsigned long seq;
+ /* each memcg has one lru_gen_folio per node */
+ unsigned long nr_memcgs[MEMCG_NR_GENS];
+ /* per-node lru_gen_folio list for global reclaim */
+ struct hlist_nulls_head fifo[MEMCG_NR_GENS][MEMCG_NR_BINS];
+ /* protects the above */
+ spinlock_t lock;
+};
+
+void lru_gen_init_pgdat(struct pglist_data *pgdat);
+
void lru_gen_init_memcg(struct mem_cgroup *memcg);
void lru_gen_exit_memcg(struct mem_cgroup *memcg);
-#endif
+void lru_gen_online_memcg(struct mem_cgroup *memcg);
+void lru_gen_offline_memcg(struct mem_cgroup *memcg);
+void lru_gen_release_memcg(struct mem_cgroup *memcg);
+void lru_gen_rotate_memcg(struct lruvec *lruvec, int op);
+
+#else /* !CONFIG_MEMCG */
+
+#define MEMCG_NR_GENS 1
+
+struct lru_gen_memcg {
+};
+
+static inline void lru_gen_init_pgdat(struct pglist_data *pgdat)
+{
+}
+
+#endif /* CONFIG_MEMCG */
#else /* !CONFIG_LRU_GEN */
+static inline void lru_gen_init_pgdat(struct pglist_data *pgdat)
+{
+}
+
static inline void lru_gen_init_lruvec(struct lruvec *lruvec)
{
}
@@ -494,6 +587,7 @@ static inline void lru_gen_look_around(s
}
#ifdef CONFIG_MEMCG
+
static inline void lru_gen_init_memcg(struct mem_cgroup *memcg)
{
}
@@ -501,7 +595,24 @@ static inline void lru_gen_init_memcg(st
static inline void lru_gen_exit_memcg(struct mem_cgroup *memcg)
{
}
-#endif
+
+static inline void lru_gen_online_memcg(struct mem_cgroup *memcg)
+{
+}
+
+static inline void lru_gen_offline_memcg(struct mem_cgroup *memcg)
+{
+}
+
+static inline void lru_gen_release_memcg(struct mem_cgroup *memcg)
+{
+}
+
+static inline void lru_gen_rotate_memcg(struct lruvec *lruvec, int op)
+{
+}
+
+#endif /* CONFIG_MEMCG */
#endif /* CONFIG_LRU_GEN */
@@ -1219,6 +1330,8 @@ typedef struct pglist_data {
#ifdef CONFIG_LRU_GEN
/* kswap mm walk data */
struct lru_gen_mm_walk mm_walk;
+ /* lru_gen_folio list */
+ struct lru_gen_memcg memcg_lru;
#endif
CACHELINE_PADDING(_pad2_);
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -477,6 +477,16 @@ static void mem_cgroup_update_tree(struc
struct mem_cgroup_per_node *mz;
struct mem_cgroup_tree_per_node *mctz;
+ if (lru_gen_enabled()) {
+ struct lruvec *lruvec = &memcg->nodeinfo[nid]->lruvec;
+
+ /* see the comment on MEMCG_NR_GENS */
+ if (soft_limit_excess(memcg) && lru_gen_memcg_seg(lruvec) != MEMCG_LRU_HEAD)
+ lru_gen_rotate_memcg(lruvec, MEMCG_LRU_HEAD);
+
+ return;
+ }
+
mctz = soft_limit_tree.rb_tree_per_node[nid];
if (!mctz)
return;
@@ -3522,6 +3532,9 @@ unsigned long mem_cgroup_soft_limit_recl
struct mem_cgroup_tree_per_node *mctz;
unsigned long excess;
+ if (lru_gen_enabled())
+ return 0;
+
if (order > 0)
return 0;
@@ -5382,6 +5395,7 @@ static int mem_cgroup_css_online(struct
if (unlikely(mem_cgroup_is_root(memcg)))
queue_delayed_work(system_unbound_wq, &stats_flush_dwork,
2UL*HZ);
+ lru_gen_online_memcg(memcg);
return 0;
offline_kmem:
memcg_offline_kmem(memcg);
@@ -5413,6 +5427,7 @@ static void mem_cgroup_css_offline(struc
memcg_offline_kmem(memcg);
reparent_shrinker_deferred(memcg);
wb_memcg_offline(memcg);
+ lru_gen_offline_memcg(memcg);
drain_all_stock(memcg);
@@ -5424,6 +5439,7 @@ static void mem_cgroup_css_released(stru
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
invalidate_reclaim_iterators(memcg);
+ lru_gen_release_memcg(memcg);
}
static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7957,6 +7957,7 @@ static void __init free_area_init_node(i
pgdat_set_deferred_range(pgdat);
free_area_init_core(pgdat);
+ lru_gen_init_pgdat(pgdat);
}
static void __init free_area_init_memoryless_node(int nid)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -54,6 +54,8 @@
#include <linux/shmem_fs.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
+#include <linux/rculist_nulls.h>
+#include <linux/random.h>
#include <asm/tlbflush.h>
#include <asm/div64.h>
@@ -134,11 +136,6 @@ struct scan_control {
/* Always discard instead of demoting to lower tier memory */
unsigned int no_demotion:1;
-#ifdef CONFIG_LRU_GEN
- /* help kswapd make better choices among multiple memcgs */
- unsigned long last_reclaimed;
-#endif
-
/* Allocation order */
s8 order;
@@ -3160,6 +3157,9 @@ DEFINE_STATIC_KEY_ARRAY_FALSE(lru_gen_ca
for ((type) = 0; (type) < ANON_AND_FILE; (type)++) \
for ((zone) = 0; (zone) < MAX_NR_ZONES; (zone)++)
+#define get_memcg_gen(seq) ((seq) % MEMCG_NR_GENS)
+#define get_memcg_bin(bin) ((bin) % MEMCG_NR_BINS)
+
static struct lruvec *get_lruvec(struct mem_cgroup *memcg, int nid)
{
struct pglist_data *pgdat = NODE_DATA(nid);
@@ -4443,8 +4443,7 @@ done:
if (sc->priority <= DEF_PRIORITY - 2)
wait_event_killable(lruvec->mm_state.wait,
max_seq < READ_ONCE(lrugen->max_seq));
-
- return max_seq < READ_ONCE(lrugen->max_seq);
+ return false;
}
VM_WARN_ON_ONCE(max_seq != READ_ONCE(lrugen->max_seq));
@@ -4517,8 +4516,6 @@ static void lru_gen_age_node(struct pgli
VM_WARN_ON_ONCE(!current_is_kswapd());
- sc->last_reclaimed = sc->nr_reclaimed;
-
/* check the order to exclude compaction-induced reclaim */
if (!min_ttl || sc->order || sc->priority == DEF_PRIORITY)
return;
@@ -5107,8 +5104,7 @@ static bool should_run_aging(struct lruv
* 1. Defer try_to_inc_max_seq() to workqueues to reduce latency for memcg
* reclaim.
*/
-static unsigned long get_nr_to_scan(struct lruvec *lruvec, struct scan_control *sc,
- bool can_swap)
+static long get_nr_to_scan(struct lruvec *lruvec, struct scan_control *sc, bool can_swap)
{
unsigned long nr_to_scan;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
@@ -5125,10 +5121,8 @@ static unsigned long get_nr_to_scan(stru
if (sc->priority == DEF_PRIORITY)
return nr_to_scan;
- try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false);
-
/* skip this lruvec as it's low on cold folios */
- return 0;
+ return try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false) ? -1 : 0;
}
static unsigned long get_nr_to_reclaim(struct scan_control *sc)
@@ -5137,29 +5131,18 @@ static unsigned long get_nr_to_reclaim(s
if (!global_reclaim(sc))
return -1;
- /* discount the previous progress for kswapd */
- if (current_is_kswapd())
- return sc->nr_to_reclaim + sc->last_reclaimed;
-
return max(sc->nr_to_reclaim, compact_gap(sc->order));
}
-static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
+static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
{
- struct blk_plug plug;
+ long nr_to_scan;
unsigned long scanned = 0;
unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
- lru_add_drain();
-
- blk_start_plug(&plug);
-
- set_mm_walk(lruvec_pgdat(lruvec));
-
while (true) {
int delta;
int swappiness;
- unsigned long nr_to_scan;
if (sc->may_swap)
swappiness = get_swappiness(lruvec, sc);
@@ -5169,7 +5152,7 @@ static void lru_gen_shrink_lruvec(struct
swappiness = 0;
nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness);
- if (!nr_to_scan)
+ if (nr_to_scan <= 0)
break;
delta = evict_folios(lruvec, sc, swappiness);
@@ -5186,10 +5169,250 @@ static void lru_gen_shrink_lruvec(struct
cond_resched();
}
+ /* whether try_to_inc_max_seq() was successful */
+ return nr_to_scan < 0;
+}
+
+static int shrink_one(struct lruvec *lruvec, struct scan_control *sc)
+{
+ bool success;
+ unsigned long scanned = sc->nr_scanned;
+ unsigned long reclaimed = sc->nr_reclaimed;
+ int seg = lru_gen_memcg_seg(lruvec);
+ struct mem_cgroup *memcg = lruvec_memcg(lruvec);
+ struct pglist_data *pgdat = lruvec_pgdat(lruvec);
+
+ /* see the comment on MEMCG_NR_GENS */
+ if (!lruvec_is_sizable(lruvec, sc))
+ return seg != MEMCG_LRU_TAIL ? MEMCG_LRU_TAIL : MEMCG_LRU_YOUNG;
+
+ mem_cgroup_calculate_protection(NULL, memcg);
+
+ if (mem_cgroup_below_min(memcg))
+ return MEMCG_LRU_YOUNG;
+
+ if (mem_cgroup_below_low(memcg)) {
+ /* see the comment on MEMCG_NR_GENS */
+ if (seg != MEMCG_LRU_TAIL)
+ return MEMCG_LRU_TAIL;
+
+ memcg_memory_event(memcg, MEMCG_LOW);
+ }
+
+ success = try_to_shrink_lruvec(lruvec, sc);
+
+ shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, sc->priority);
+
+ vmpressure(sc->gfp_mask, memcg, false, sc->nr_scanned - scanned,
+ sc->nr_reclaimed - reclaimed);
+
+ sc->nr_reclaimed += current->reclaim_state->reclaimed_slab;
+ current->reclaim_state->reclaimed_slab = 0;
+
+ return success ? MEMCG_LRU_YOUNG : 0;
+}
+
+#ifdef CONFIG_MEMCG
+
+static void shrink_many(struct pglist_data *pgdat, struct scan_control *sc)
+{
+ int gen;
+ int bin;
+ int first_bin;
+ struct lruvec *lruvec;
+ struct lru_gen_folio *lrugen;
+ const struct hlist_nulls_node *pos;
+ int op = 0;
+ struct mem_cgroup *memcg = NULL;
+ unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
+
+ bin = first_bin = prandom_u32_max(MEMCG_NR_BINS);
+restart:
+ gen = get_memcg_gen(READ_ONCE(pgdat->memcg_lru.seq));
+
+ rcu_read_lock();
+
+ hlist_nulls_for_each_entry_rcu(lrugen, pos, &pgdat->memcg_lru.fifo[gen][bin], list) {
+ if (op)
+ lru_gen_rotate_memcg(lruvec, op);
+
+ mem_cgroup_put(memcg);
+
+ lruvec = container_of(lrugen, struct lruvec, lrugen);
+ memcg = lruvec_memcg(lruvec);
+
+ if (!mem_cgroup_tryget(memcg)) {
+ op = 0;
+ memcg = NULL;
+ continue;
+ }
+
+ rcu_read_unlock();
+
+ op = shrink_one(lruvec, sc);
+
+ if (sc->nr_reclaimed >= nr_to_reclaim)
+ goto success;
+
+ rcu_read_lock();
+ }
+
+ rcu_read_unlock();
+
+ /* restart if raced with lru_gen_rotate_memcg() */
+ if (gen != get_nulls_value(pos))
+ goto restart;
+
+ /* try the rest of the bins of the current generation */
+ bin = get_memcg_bin(bin + 1);
+ if (bin != first_bin)
+ goto restart;
+success:
+ if (op)
+ lru_gen_rotate_memcg(lruvec, op);
+
+ mem_cgroup_put(memcg);
+}
+
+static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
+{
+ struct blk_plug plug;
+
+ VM_WARN_ON_ONCE(global_reclaim(sc));
+
+ lru_add_drain();
+
+ blk_start_plug(&plug);
+
+ set_mm_walk(lruvec_pgdat(lruvec));
+
+ if (try_to_shrink_lruvec(lruvec, sc))
+ lru_gen_rotate_memcg(lruvec, MEMCG_LRU_YOUNG);
+
+ clear_mm_walk();
+
+ blk_finish_plug(&plug);
+}
+
+#else /* !CONFIG_MEMCG */
+
+static void shrink_many(struct pglist_data *pgdat, struct scan_control *sc)
+{
+ BUILD_BUG();
+}
+
+static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
+{
+ BUILD_BUG();
+}
+
+#endif
+
+static void set_initial_priority(struct pglist_data *pgdat, struct scan_control *sc)
+{
+ int priority;
+ unsigned long reclaimable;
+ struct lruvec *lruvec = mem_cgroup_lruvec(NULL, pgdat);
+
+ if (sc->priority != DEF_PRIORITY || sc->nr_to_reclaim < MIN_LRU_BATCH)
+ return;
+ /*
+ * Determine the initial priority based on ((total / MEMCG_NR_GENS) >>
+ * priority) * reclaimed_to_scanned_ratio = nr_to_reclaim, where the
+ * estimated reclaimed_to_scanned_ratio = inactive / total.
+ */
+ reclaimable = node_page_state(pgdat, NR_INACTIVE_FILE);
+ if (get_swappiness(lruvec, sc))
+ reclaimable += node_page_state(pgdat, NR_INACTIVE_ANON);
+
+ reclaimable /= MEMCG_NR_GENS;
+
+ /* round down reclaimable and round up sc->nr_to_reclaim */
+ priority = fls_long(reclaimable) - 1 - fls_long(sc->nr_to_reclaim - 1);
+
+ sc->priority = clamp(priority, 0, DEF_PRIORITY);
+}
+
+static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *sc)
+{
+ struct blk_plug plug;
+ unsigned long reclaimed = sc->nr_reclaimed;
+
+ VM_WARN_ON_ONCE(!global_reclaim(sc));
+
+ lru_add_drain();
+
+ blk_start_plug(&plug);
+
+ set_mm_walk(pgdat);
+
+ set_initial_priority(pgdat, sc);
+
+ if (current_is_kswapd())
+ sc->nr_reclaimed = 0;
+
+ if (mem_cgroup_disabled())
+ shrink_one(&pgdat->__lruvec, sc);
+ else
+ shrink_many(pgdat, sc);
+
+ if (current_is_kswapd())
+ sc->nr_reclaimed += reclaimed;
+
clear_mm_walk();
blk_finish_plug(&plug);
+
+ /* kswapd should never fail */
+ pgdat->kswapd_failures = 0;
+}
+
+#ifdef CONFIG_MEMCG
+void lru_gen_rotate_memcg(struct lruvec *lruvec, int op)
+{
+ int seg;
+ int old, new;
+ int bin = prandom_u32_max(MEMCG_NR_BINS);
+ struct pglist_data *pgdat = lruvec_pgdat(lruvec);
+
+ spin_lock(&pgdat->memcg_lru.lock);
+
+ VM_WARN_ON_ONCE(hlist_nulls_unhashed(&lruvec->lrugen.list));
+
+ seg = 0;
+ new = old = lruvec->lrugen.gen;
+
+ /* see the comment on MEMCG_NR_GENS */
+ if (op == MEMCG_LRU_HEAD)
+ seg = MEMCG_LRU_HEAD;
+ else if (op == MEMCG_LRU_TAIL)
+ seg = MEMCG_LRU_TAIL;
+ else if (op == MEMCG_LRU_OLD)
+ new = get_memcg_gen(pgdat->memcg_lru.seq);
+ else if (op == MEMCG_LRU_YOUNG)
+ new = get_memcg_gen(pgdat->memcg_lru.seq + 1);
+ else
+ VM_WARN_ON_ONCE(true);
+
+ hlist_nulls_del_rcu(&lruvec->lrugen.list);
+
+ if (op == MEMCG_LRU_HEAD || op == MEMCG_LRU_OLD)
+ hlist_nulls_add_head_rcu(&lruvec->lrugen.list, &pgdat->memcg_lru.fifo[new][bin]);
+ else
+ hlist_nulls_add_tail_rcu(&lruvec->lrugen.list, &pgdat->memcg_lru.fifo[new][bin]);
+
+ pgdat->memcg_lru.nr_memcgs[old]--;
+ pgdat->memcg_lru.nr_memcgs[new]++;
+
+ lruvec->lrugen.gen = new;
+ WRITE_ONCE(lruvec->lrugen.seg, seg);
+
+ if (!pgdat->memcg_lru.nr_memcgs[old] && old == get_memcg_gen(pgdat->memcg_lru.seq))
+ WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1);
+
+ spin_unlock(&pgdat->memcg_lru.lock);
}
+#endif
/******************************************************************************
* state change
@@ -5647,11 +5870,11 @@ static int run_cmd(char cmd, int memcg_i
if (!mem_cgroup_disabled()) {
rcu_read_lock();
+
memcg = mem_cgroup_from_id(memcg_id);
-#ifdef CONFIG_MEMCG
- if (memcg && !css_tryget(&memcg->css))
+ if (!mem_cgroup_tryget(memcg))
memcg = NULL;
-#endif
+
rcu_read_unlock();
if (!memcg)
@@ -5799,6 +6022,19 @@ void lru_gen_init_lruvec(struct lruvec *
}
#ifdef CONFIG_MEMCG
+
+void lru_gen_init_pgdat(struct pglist_data *pgdat)
+{
+ int i, j;
+
+ spin_lock_init(&pgdat->memcg_lru.lock);
+
+ for (i = 0; i < MEMCG_NR_GENS; i++) {
+ for (j = 0; j < MEMCG_NR_BINS; j++)
+ INIT_HLIST_NULLS_HEAD(&pgdat->memcg_lru.fifo[i][j], i);
+ }
+}
+
void lru_gen_init_memcg(struct mem_cgroup *memcg)
{
INIT_LIST_HEAD(&memcg->mm_list.fifo);
@@ -5822,7 +6058,69 @@ void lru_gen_exit_memcg(struct mem_cgrou
}
}
}
-#endif
+
+void lru_gen_online_memcg(struct mem_cgroup *memcg)
+{
+ int gen;
+ int nid;
+ int bin = prandom_u32_max(MEMCG_NR_BINS);
+
+ for_each_node(nid) {
+ struct pglist_data *pgdat = NODE_DATA(nid);
+ struct lruvec *lruvec = get_lruvec(memcg, nid);
+
+ spin_lock(&pgdat->memcg_lru.lock);
+
+ VM_WARN_ON_ONCE(!hlist_nulls_unhashed(&lruvec->lrugen.list));
+
+ gen = get_memcg_gen(pgdat->memcg_lru.seq);
+
+ hlist_nulls_add_tail_rcu(&lruvec->lrugen.list, &pgdat->memcg_lru.fifo[gen][bin]);
+ pgdat->memcg_lru.nr_memcgs[gen]++;
+
+ lruvec->lrugen.gen = gen;
+
+ spin_unlock(&pgdat->memcg_lru.lock);
+ }
+}
+
+void lru_gen_offline_memcg(struct mem_cgroup *memcg)
+{
+ int nid;
+
+ for_each_node(nid) {
+ struct lruvec *lruvec = get_lruvec(memcg, nid);
+
+ lru_gen_rotate_memcg(lruvec, MEMCG_LRU_OLD);
+ }
+}
+
+void lru_gen_release_memcg(struct mem_cgroup *memcg)
+{
+ int gen;
+ int nid;
+
+ for_each_node(nid) {
+ struct pglist_data *pgdat = NODE_DATA(nid);
+ struct lruvec *lruvec = get_lruvec(memcg, nid);
+
+ spin_lock(&pgdat->memcg_lru.lock);
+
+ VM_WARN_ON_ONCE(hlist_nulls_unhashed(&lruvec->lrugen.list));
+
+ gen = lruvec->lrugen.gen;
+
+ hlist_nulls_del_rcu(&lruvec->lrugen.list);
+ pgdat->memcg_lru.nr_memcgs[gen]--;
+
+ if (!pgdat->memcg_lru.nr_memcgs[gen] && gen == get_memcg_gen(pgdat->memcg_lru.seq))
+ WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1);
+
+ spin_unlock(&pgdat->memcg_lru.lock);
+ }
+}
+
+#endif /* CONFIG_MEMCG */
static int __init init_lru_gen(void)
{
@@ -5849,6 +6147,10 @@ static void lru_gen_shrink_lruvec(struct
{
}
+static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *sc)
+{
+}
+
#endif /* CONFIG_LRU_GEN */
static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
@@ -5862,7 +6164,7 @@ static void shrink_lruvec(struct lruvec
bool proportional_reclaim;
struct blk_plug plug;
- if (lru_gen_enabled()) {
+ if (lru_gen_enabled() && !global_reclaim(sc)) {
lru_gen_shrink_lruvec(lruvec, sc);
return;
}
@@ -6105,6 +6407,11 @@ static void shrink_node(pg_data_t *pgdat
struct lruvec *target_lruvec;
bool reclaimable = false;
+ if (lru_gen_enabled() && global_reclaim(sc)) {
+ lru_gen_shrink_node(pgdat, sc);
+ return;
+ }
+
target_lruvec = mem_cgroup_lruvec(sc->target_mem_cgroup, pgdat);
again:

View file

@ -0,0 +1,196 @@
From 93147736b5b3a21bea24313bfc7a696829932009 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:05 -0700
Subject: [PATCH 27/29] mm: multi-gen LRU: clarify scan_control flags
Among the flags in scan_control:
1. sc->may_swap, which indicates swap constraint due to memsw.max, is
supported as usual.
2. sc->proactive, which indicates reclaim by memory.reclaim, may not
opportunistically skip the aging path, since it is considered less
latency sensitive.
3. !(sc->gfp_mask & __GFP_IO), which indicates IO constraint, lowers
swappiness to prioritize file LRU, since clean file folios are more
likely to exist.
4. sc->may_writefolio and sc->may_unmap, which indicates opportunistic
reclaim, are rejected, since unmapped clean folios are already
prioritized. Scanning for more of them is likely futile and can
cause high reclaim latency when there is a large number of memcgs.
The rest are handled by the existing code.
Link: https://lkml.kernel.org/r/20221222041905.2431096-8-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 55 +++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 27 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3185,6 +3185,9 @@ static int get_swappiness(struct lruvec
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
struct pglist_data *pgdat = lruvec_pgdat(lruvec);
+ if (!sc->may_swap)
+ return 0;
+
if (!can_demote(pgdat->node_id, sc) &&
mem_cgroup_get_nr_swap_pages(memcg) < MIN_LRU_BATCH)
return 0;
@@ -4226,7 +4229,7 @@ static void walk_mm(struct lruvec *lruve
} while (err == -EAGAIN);
}
-static struct lru_gen_mm_walk *set_mm_walk(struct pglist_data *pgdat)
+static struct lru_gen_mm_walk *set_mm_walk(struct pglist_data *pgdat, bool force_alloc)
{
struct lru_gen_mm_walk *walk = current->reclaim_state->mm_walk;
@@ -4234,7 +4237,7 @@ static struct lru_gen_mm_walk *set_mm_wa
VM_WARN_ON_ONCE(walk);
walk = &pgdat->mm_walk;
- } else if (!pgdat && !walk) {
+ } else if (!walk && force_alloc) {
VM_WARN_ON_ONCE(current_is_kswapd());
walk = kzalloc(sizeof(*walk), __GFP_HIGH | __GFP_NOMEMALLOC | __GFP_NOWARN);
@@ -4420,7 +4423,7 @@ static bool try_to_inc_max_seq(struct lr
goto done;
}
- walk = set_mm_walk(NULL);
+ walk = set_mm_walk(NULL, true);
if (!walk) {
success = iterate_mm_list_nowalk(lruvec, max_seq);
goto done;
@@ -4489,8 +4492,6 @@ static bool lruvec_is_reclaimable(struct
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MIN_SEQ(lruvec);
- VM_WARN_ON_ONCE(sc->memcg_low_reclaim);
-
/* see the comment on lru_gen_folio */
gen = lru_gen_from_seq(min_seq[LRU_GEN_FILE]);
birth = READ_ONCE(lruvec->lrugen.timestamps[gen]);
@@ -4746,12 +4747,8 @@ static bool isolate_folio(struct lruvec
{
bool success;
- /* unmapping inhibited */
- if (!sc->may_unmap && folio_mapped(folio))
- return false;
-
/* swapping inhibited */
- if (!(sc->may_writepage && (sc->gfp_mask & __GFP_IO)) &&
+ if (!(sc->gfp_mask & __GFP_IO) &&
(folio_test_dirty(folio) ||
(folio_test_anon(folio) && !folio_test_swapcache(folio))))
return false;
@@ -4848,9 +4845,8 @@ static int scan_folios(struct lruvec *lr
__count_vm_events(PGSCAN_ANON + type, isolated);
/*
- * There might not be eligible pages due to reclaim_idx, may_unmap and
- * may_writepage. Check the remaining to prevent livelock if it's not
- * making progress.
+ * There might not be eligible pages due to reclaim_idx. Check the
+ * remaining to prevent livelock if it's not making progress.
*/
return isolated || !remaining ? scanned : 0;
}
@@ -5110,8 +5106,7 @@ static long get_nr_to_scan(struct lruvec
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
- if (mem_cgroup_below_min(memcg) ||
- (mem_cgroup_below_low(memcg) && !sc->memcg_low_reclaim))
+ if (mem_cgroup_below_min(memcg))
return 0;
if (!should_run_aging(lruvec, max_seq, sc, can_swap, &nr_to_scan))
@@ -5139,17 +5134,14 @@ static bool try_to_shrink_lruvec(struct
long nr_to_scan;
unsigned long scanned = 0;
unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
+ int swappiness = get_swappiness(lruvec, sc);
+
+ /* clean file folios are more likely to exist */
+ if (swappiness && !(sc->gfp_mask & __GFP_IO))
+ swappiness = 1;
while (true) {
int delta;
- int swappiness;
-
- if (sc->may_swap)
- swappiness = get_swappiness(lruvec, sc);
- else if (!cgroup_reclaim(sc) && get_swappiness(lruvec, sc))
- swappiness = 1;
- else
- swappiness = 0;
nr_to_scan = get_nr_to_scan(lruvec, sc, swappiness);
if (nr_to_scan <= 0)
@@ -5279,12 +5271,13 @@ static void lru_gen_shrink_lruvec(struct
struct blk_plug plug;
VM_WARN_ON_ONCE(global_reclaim(sc));
+ VM_WARN_ON_ONCE(!sc->may_writepage || !sc->may_unmap);
lru_add_drain();
blk_start_plug(&plug);
- set_mm_walk(lruvec_pgdat(lruvec));
+ set_mm_walk(NULL, sc->proactive);
if (try_to_shrink_lruvec(lruvec, sc))
lru_gen_rotate_memcg(lruvec, MEMCG_LRU_YOUNG);
@@ -5340,11 +5333,19 @@ static void lru_gen_shrink_node(struct p
VM_WARN_ON_ONCE(!global_reclaim(sc));
+ /*
+ * Unmapped clean folios are already prioritized. Scanning for more of
+ * them is likely futile and can cause high reclaim latency when there
+ * is a large number of memcgs.
+ */
+ if (!sc->may_writepage || !sc->may_unmap)
+ goto done;
+
lru_add_drain();
blk_start_plug(&plug);
- set_mm_walk(pgdat);
+ set_mm_walk(NULL, sc->proactive);
set_initial_priority(pgdat, sc);
@@ -5362,7 +5363,7 @@ static void lru_gen_shrink_node(struct p
clear_mm_walk();
blk_finish_plug(&plug);
-
+done:
/* kswapd should never fail */
pgdat->kswapd_failures = 0;
}
@@ -5934,7 +5935,7 @@ static ssize_t lru_gen_seq_write(struct
set_task_reclaim_state(current, &sc.reclaim_state);
flags = memalloc_noreclaim_save();
blk_start_plug(&plug);
- if (!set_mm_walk(NULL)) {
+ if (!set_mm_walk(NULL, true)) {
err = -ENOMEM;
goto done;
}

View file

@ -0,0 +1,34 @@
From cf3297e4c7a928da8b2b2f0baff2f9c69ea57952 Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Wed, 21 Dec 2022 21:19:06 -0700
Subject: [PATCH 28/29] mm: multi-gen LRU: simplify arch_has_hw_pte_young()
check
Scanning page tables when hardware does not set the accessed bit has
no real use cases.
Link: https://lkml.kernel.org/r/20221222041905.2431096-9-yuzhao@google.com
Signed-off-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4418,7 +4418,7 @@ static bool try_to_inc_max_seq(struct lr
* handful of PTEs. Spreading the work out over a period of time usually
* is less efficient, but it avoids bursty page faults.
*/
- if (!force_scan && !(arch_has_hw_pte_young() && get_cap(LRU_GEN_MM_WALK))) {
+ if (!arch_has_hw_pte_young() || !get_cap(LRU_GEN_MM_WALK)) {
success = iterate_mm_list_nowalk(lruvec, max_seq);
goto done;
}

View file

@ -0,0 +1,88 @@
From cc67f962cc53f6e1dfa92eb85b7b26fe83a3c66f Mon Sep 17 00:00:00 2001
From: Yu Zhao <yuzhao@google.com>
Date: Mon, 13 Feb 2023 00:53:22 -0700
Subject: [PATCH 29/29] mm: multi-gen LRU: avoid futile retries
Recall that the per-node memcg LRU has two generations and they alternate
when the last memcg (of a given node) is moved from one to the other.
Each generation is also sharded into multiple bins to improve scalability.
A reclaimer starts with a random bin (in the old generation) and, if it
fails, it will retry, i.e., to try the rest of the bins.
If a reclaimer fails with the last memcg, it should move this memcg to the
young generation first, which causes the generations to alternate, and
then retry. Otherwise, the retries will be futile because all other bins
are empty.
Link: https://lkml.kernel.org/r/20230213075322.1416966-1-yuzhao@google.com
Fixes: e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reported-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5208,18 +5208,20 @@ static int shrink_one(struct lruvec *lru
static void shrink_many(struct pglist_data *pgdat, struct scan_control *sc)
{
+ int op;
int gen;
int bin;
int first_bin;
struct lruvec *lruvec;
struct lru_gen_folio *lrugen;
+ struct mem_cgroup *memcg;
const struct hlist_nulls_node *pos;
- int op = 0;
- struct mem_cgroup *memcg = NULL;
unsigned long nr_to_reclaim = get_nr_to_reclaim(sc);
bin = first_bin = prandom_u32_max(MEMCG_NR_BINS);
restart:
+ op = 0;
+ memcg = NULL;
gen = get_memcg_gen(READ_ONCE(pgdat->memcg_lru.seq));
rcu_read_lock();
@@ -5243,14 +5245,22 @@ restart:
op = shrink_one(lruvec, sc);
- if (sc->nr_reclaimed >= nr_to_reclaim)
- goto success;
-
rcu_read_lock();
+
+ if (sc->nr_reclaimed >= nr_to_reclaim)
+ break;
}
rcu_read_unlock();
+ if (op)
+ lru_gen_rotate_memcg(lruvec, op);
+
+ mem_cgroup_put(memcg);
+
+ if (sc->nr_reclaimed >= nr_to_reclaim)
+ return;
+
/* restart if raced with lru_gen_rotate_memcg() */
if (gen != get_nulls_value(pos))
goto restart;
@@ -5259,11 +5269,6 @@ restart:
bin = get_memcg_bin(bin + 1);
if (bin != first_bin)
goto restart;
-success:
- if (op)
- lru_gen_rotate_memcg(lruvec, op);
-
- mem_cgroup_put(memcg);
}
static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)

View file

@ -0,0 +1,65 @@
From 63db0cb35e1cb3b3c134906d1062f65513fdda2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Tue, 4 Oct 2022 10:37:09 +0200
Subject: [PATCH] mtd: core: simplify (a bit) code find partition-matching
dynamic OF node
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
1. Don't hardcode "partition-" string twice
2. Use simpler logic & use ->name to avoid of_property_read_string()
3. Use mtd_get_of_node() helper
Cc: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-1-zajec5@gmail.com
---
drivers/mtd/mtdcore.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -551,18 +551,16 @@ static void mtd_check_of_node(struct mtd
struct device_node *partitions, *parent_dn, *mtd_dn = NULL;
const char *pname, *prefix = "partition-";
int plen, mtd_name_len, offset, prefix_len;
- struct mtd_info *parent;
bool found = false;
/* Check if MTD already has a device node */
- if (dev_of_node(&mtd->dev))
+ if (mtd_get_of_node(mtd))
return;
/* Check if a partitions node exist */
if (!mtd_is_partition(mtd))
return;
- parent = mtd->parent;
- parent_dn = of_node_get(dev_of_node(&parent->dev));
+ parent_dn = of_node_get(mtd_get_of_node(mtd->parent));
if (!parent_dn)
return;
@@ -575,15 +573,15 @@ static void mtd_check_of_node(struct mtd
/* Search if a partition is defined with the same name */
for_each_child_of_node(partitions, mtd_dn) {
- offset = 0;
-
/* Skip partition with no/wrong prefix */
- if (!of_node_name_prefix(mtd_dn, "partition-"))
+ if (!of_node_name_prefix(mtd_dn, prefix))
continue;
/* Label have priority. Check that first */
- if (of_property_read_string(mtd_dn, "label", &pname)) {
- of_property_read_string(mtd_dn, "name", &pname);
+ if (!of_property_read_string(mtd_dn, "label", &pname)) {
+ offset = 0;
+ } else {
+ pname = mtd_dn->name;
offset = prefix_len;
}

View file

@ -0,0 +1,84 @@
From ddb8cefb7af288950447ca6eeeafb09977dab56f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Tue, 4 Oct 2022 10:37:10 +0200
Subject: [PATCH] mtd: core: try to find OF node for every MTD partition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
So far this feature was limited to the top-level "nvmem-cells" node.
There are multiple parsers creating partitions and subpartitions
dynamically. Extend that code to handle them too.
This allows finding partition-* node for every MTD (sub)partition.
Random example:
partitions {
compatible = "brcm,bcm947xx-cfe-partitions";
partition-firmware {
compatible = "brcm,trx";
partition-loader {
};
};
};
Cc: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-2-zajec5@gmail.com
---
drivers/mtd/mtdcore.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -551,20 +551,22 @@ static void mtd_check_of_node(struct mtd
struct device_node *partitions, *parent_dn, *mtd_dn = NULL;
const char *pname, *prefix = "partition-";
int plen, mtd_name_len, offset, prefix_len;
- bool found = false;
/* Check if MTD already has a device node */
if (mtd_get_of_node(mtd))
return;
- /* Check if a partitions node exist */
if (!mtd_is_partition(mtd))
return;
+
parent_dn = of_node_get(mtd_get_of_node(mtd->parent));
if (!parent_dn)
return;
- partitions = of_get_child_by_name(parent_dn, "partitions");
+ if (mtd_is_partition(mtd->parent))
+ partitions = of_node_get(parent_dn);
+ else
+ partitions = of_get_child_by_name(parent_dn, "partitions");
if (!partitions)
goto exit_parent;
@@ -588,19 +590,11 @@ static void mtd_check_of_node(struct mtd
plen = strlen(pname) - offset;
if (plen == mtd_name_len &&
!strncmp(mtd->name, pname + offset, plen)) {
- found = true;
+ mtd_set_of_node(mtd, mtd_dn);
break;
}
}
- if (!found)
- goto exit_partitions;
-
- /* Set of_node only for nvmem */
- if (of_device_is_compatible(mtd_dn, "nvmem-cells"))
- mtd_set_of_node(mtd, mtd_dn);
-
-exit_partitions:
of_node_put(partitions);
exit_parent:
of_node_put(parent_dn);

View file

@ -0,0 +1,47 @@
From 26422ac78e9d8767bd4aabfbae616b15edbf6a1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Sat, 22 Oct 2022 23:13:18 +0200
Subject: [PATCH] mtd: core: set ROOT_DEV for partitions marked as rootfs in DT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds support for "linux,rootfs" binding that is used to mark flash
partition containing rootfs. It's useful for devices using device tree
that don't have bootloader passing root info in cmdline.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221022211318.32009-2-zajec5@gmail.com
---
drivers/mtd/mtdcore.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -28,6 +28,7 @@
#include <linux/leds.h>
#include <linux/debugfs.h>
#include <linux/nvmem-provider.h>
+#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
@@ -737,6 +738,17 @@ int add_mtd_device(struct mtd_info *mtd)
not->add(mtd);
mutex_unlock(&mtd_table_mutex);
+
+ if (of_find_property(mtd_get_of_node(mtd), "linux,rootfs", NULL)) {
+ if (IS_BUILTIN(CONFIG_MTD)) {
+ pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name);
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
+ } else {
+ pr_warn("mtd: can't set mtd%d (%s) as root device - mtd must be builtin\n",
+ mtd->index, mtd->name);
+ }
+ }
+
/* We _know_ we aren't being removed, because
our caller is still holding us here. So none
of this try_ nonsense, and no bitching about it

View file

@ -0,0 +1,229 @@
From aec4d5f5ffd0f0092bd9dc21ea90e0bc237d4b74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Sat, 15 Oct 2022 11:29:50 +0200
Subject: [PATCH] mtd: parsers: add TP-Link SafeLoader partitions table parser
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This parser deals with most TP-Link home routers. It reads info about
partitions and registers them in the MTD subsystem.
Example from TP-Link Archer C5 V2:
spi-nor spi0.0: s25fl128s1 (16384 Kbytes)
15 tplink-safeloader partitions found on MTD device spi0.0
Creating 15 MTD partitions on "spi0.0":
0x000000000000-0x000000040000 : "fs-uboot"
0x000000040000-0x000000440000 : "os-image"
0x000000440000-0x000000e40000 : "rootfs"
0x000000e40000-0x000000e40200 : "default-mac"
0x000000e40200-0x000000e40400 : "pin"
0x000000e40400-0x000000e40600 : "product-info"
0x000000e50000-0x000000e60000 : "partition-table"
0x000000e60000-0x000000e60200 : "soft-version"
0x000000e61000-0x000000e70000 : "support-list"
0x000000e70000-0x000000e80000 : "profile"
0x000000e80000-0x000000e90000 : "default-config"
0x000000e90000-0x000000ee0000 : "user-config"
0x000000ee0000-0x000000fe0000 : "log"
0x000000fe0000-0x000000ff0000 : "radio_bk"
0x000000ff0000-0x000001000000 : "radio"
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221015092950.27467-2-zajec5@gmail.com
---
drivers/mtd/parsers/Kconfig | 15 +++
drivers/mtd/parsers/Makefile | 1 +
drivers/mtd/parsers/tplink_safeloader.c | 150 ++++++++++++++++++++++++
3 files changed, 166 insertions(+)
create mode 100644 drivers/mtd/parsers/tplink_safeloader.c
--- a/drivers/mtd/parsers/Kconfig
+++ b/drivers/mtd/parsers/Kconfig
@@ -123,6 +123,21 @@ config MTD_AFS_PARTS
for your particular device. It won't happen automatically. The
'physmap' map driver (CONFIG_MTD_PHYSMAP) does this, for example.
+config MTD_PARSER_TPLINK_SAFELOADER
+ tristate "TP-Link Safeloader partitions parser"
+ depends on MTD && (ARCH_BCM_5301X || ATH79 || SOC_MT7620 || SOC_MT7621 || COMPILE_TEST)
+ help
+ TP-Link home routers use flash partitions to store various data. Info
+ about flash space layout is stored in a partitions table using a
+ custom ASCII-based format.
+
+ That format was first found in devices with SafeLoader bootloader and
+ was named after it. Later it was adapted to CFE and U-Boot
+ bootloaders.
+
+ This driver reads partitions table, parses it and creates MTD
+ partitions.
+
config MTD_PARSER_TRX
tristate "Parser for TRX format partitions"
depends on MTD && (BCM47XX || ARCH_BCM_5301X || ARCH_MEDIATEK || RALINK || COMPILE_TEST)
--- a/drivers/mtd/parsers/Makefile
+++ b/drivers/mtd/parsers/Makefile
@@ -10,6 +10,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) +=
ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o
obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
+obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o
obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o
obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpart.o
obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o
--- /dev/null
+++ b/drivers/mtd/parsers/tplink_safeloader.c
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright © 2022 Rafał Miłecki <rafal@milecki.pl>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+
+#define TPLINK_SAFELOADER_DATA_OFFSET 4
+#define TPLINK_SAFELOADER_MAX_PARTS 32
+
+struct safeloader_cmn_header {
+ __be32 size;
+ uint32_t unused;
+} __packed;
+
+static void *mtd_parser_tplink_safeloader_read_table(struct mtd_info *mtd)
+{
+ struct safeloader_cmn_header hdr;
+ struct device_node *np;
+ size_t bytes_read;
+ size_t offset;
+ size_t size;
+ char *buf;
+ int err;
+
+ np = mtd_get_of_node(mtd);
+ if (mtd_is_partition(mtd))
+ of_node_get(np);
+ else
+ np = of_get_child_by_name(np, "partitions");
+
+ if (of_property_read_u32(np, "partitions-table-offset", (u32 *)&offset)) {
+ pr_err("Failed to get partitions table offset\n");
+ goto err_put;
+ }
+
+ err = mtd_read(mtd, offset, sizeof(hdr), &bytes_read, (uint8_t *)&hdr);
+ if (err && !mtd_is_bitflip(err)) {
+ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset);
+ goto err_put;
+ }
+
+ size = be32_to_cpu(hdr.size);
+
+ buf = kmalloc(size + 1, GFP_KERNEL);
+ if (!buf)
+ goto err_put;
+
+ err = mtd_read(mtd, offset + sizeof(hdr), size, &bytes_read, buf);
+ if (err && !mtd_is_bitflip(err)) {
+ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset + sizeof(hdr));
+ goto err_kfree;
+ }
+
+ buf[size] = '\0';
+
+ of_node_put(np);
+
+ return buf;
+
+err_kfree:
+ kfree(buf);
+err_put:
+ of_node_put(np);
+ return NULL;
+}
+
+static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd,
+ const struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+{
+ struct mtd_partition *parts;
+ char name[65];
+ size_t offset;
+ size_t bytes;
+ char *buf;
+ int idx;
+ int err;
+
+ parts = kcalloc(TPLINK_SAFELOADER_MAX_PARTS, sizeof(*parts), GFP_KERNEL);
+ if (!parts) {
+ err = -ENOMEM;
+ goto err_out;
+ }
+
+ buf = mtd_parser_tplink_safeloader_read_table(mtd);
+ if (!buf) {
+ err = -ENOENT;
+ goto err_out;
+ }
+
+ for (idx = 0, offset = TPLINK_SAFELOADER_DATA_OFFSET;
+ idx < TPLINK_SAFELOADER_MAX_PARTS &&
+ sscanf(buf + offset, "partition %64s base 0x%llx size 0x%llx%zn\n",
+ name, &parts[idx].offset, &parts[idx].size, &bytes) == 3;
+ idx++, offset += bytes + 1) {
+ parts[idx].name = kstrdup(name, GFP_KERNEL);
+ if (!parts[idx].name) {
+ err = -ENOMEM;
+ goto err_free;
+ }
+ }
+
+ if (idx == TPLINK_SAFELOADER_MAX_PARTS)
+ pr_warn("Reached maximum number of partitions!\n");
+
+ kfree(buf);
+
+ *pparts = parts;
+
+ return idx;
+
+err_free:
+ for (idx -= 1; idx >= 0; idx--)
+ kfree(parts[idx].name);
+err_out:
+ return err;
+};
+
+static void mtd_parser_tplink_safeloader_cleanup(const struct mtd_partition *pparts,
+ int nr_parts)
+{
+ int i;
+
+ for (i = 0; i < nr_parts; i++)
+ kfree(pparts[i].name);
+
+ kfree(pparts);
+}
+
+static const struct of_device_id mtd_parser_tplink_safeloader_of_match_table[] = {
+ { .compatible = "tplink,safeloader-partitions" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mtd_parser_tplink_safeloader_of_match_table);
+
+static struct mtd_part_parser mtd_parser_tplink_safeloader = {
+ .parse_fn = mtd_parser_tplink_safeloader_parse,
+ .cleanup = mtd_parser_tplink_safeloader_cleanup,
+ .name = "tplink-safeloader",
+ .of_match_table = mtd_parser_tplink_safeloader_of_match_table,
+};
+module_mtd_part_parser(mtd_parser_tplink_safeloader);
+
+MODULE_LICENSE("GPL");

View file

@ -0,0 +1,35 @@
From ebed787a0becb9354f0a23620a5130cccd6c730c Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Thu, 19 Jan 2023 03:45:43 +0000
Subject: [PATCH] mtd: spinand: macronix: use scratch buffer for DMA operation
The mx35lf1ge4ab_get_eccsr() function uses an SPI DMA operation to
read the eccsr, hence the buffer should not be on stack. Since commit
380583227c0c7f ("spi: spi-mem: Add extra sanity checks on the op param")
the kernel emmits a warning and blocks such operations.
Use the scratch buffer to get eccsr instead of trying to directly read
into a stack-allocated variable.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/Y8i85zM0u4XdM46z@makrotopia.org
---
drivers/mtd/nand/spi/macronix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(s
* in order to avoid forcing the wear-leveling layer to move
* data around if it's not necessary.
*/
- if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
+ if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf))
return nanddev_get_ecc_conf(nand)->strength;
+ eccsr = *spinand->scratchbuf;
if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength ||
!eccsr))
return nanddev_get_ecc_conf(nand)->strength;

View file

@ -0,0 +1,47 @@
From 281f7a6c1a33fffcde32001bacbb4f672140fbf9 Mon Sep 17 00:00:00 2001
From: Michael Walle <michael@walle.cc>
Date: Wed, 8 Mar 2023 09:20:21 +0100
Subject: [PATCH] mtd: core: prepare mtd_otp_nvmem_add() to handle
-EPROBE_DEFER
NVMEM soon will get the ability for nvmem layouts and these might
not be ready when nvmem_register() is called and thus it might
return -EPROBE_DEFER. Don't print the error message in this case.
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230308082021.870459-4-michael@walle.cc
---
drivers/mtd/mtdcore.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -953,8 +953,8 @@ static int mtd_otp_nvmem_add(struct mtd_
nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
mtd_nvmem_user_otp_reg_read);
if (IS_ERR(nvmem)) {
- dev_err(dev, "Failed to register OTP NVMEM device\n");
- return PTR_ERR(nvmem);
+ err = PTR_ERR(nvmem);
+ goto err;
}
mtd->otp_user_nvmem = nvmem;
}
@@ -971,7 +971,6 @@ static int mtd_otp_nvmem_add(struct mtd_
nvmem = mtd_otp_nvmem_register(mtd, "factory-otp", size,
mtd_nvmem_fact_otp_reg_read);
if (IS_ERR(nvmem)) {
- dev_err(dev, "Failed to register OTP NVMEM device\n");
err = PTR_ERR(nvmem);
goto err;
}
@@ -983,7 +982,7 @@ static int mtd_otp_nvmem_add(struct mtd_
err:
nvmem_unregister(mtd->otp_user_nvmem);
- return err;
+ return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n");
}
/**

View file

@ -0,0 +1,56 @@
From: Qingfang DENG <qingfang.deng@siflower.com.cn>
Date: Fri, 3 Feb 2023 09:16:11 +0800
Subject: [PATCH] net: page_pool: use in_softirq() instead
We use BH context only for synchronization, so we don't care if it's
actually serving softirq or not.
As a side node, in case of threaded NAPI, in_serving_softirq() will
return false because it's in process context with BH off, making
page_pool_recycle_in_cache() unreachable.
Signed-off-by: Qingfang DENG <qingfang.deng@siflower.com.cn>
---
--- a/include/net/page_pool.h
+++ b/include/net/page_pool.h
@@ -386,7 +386,7 @@ static inline void page_pool_nid_changed
static inline void page_pool_ring_lock(struct page_pool *pool)
__acquires(&pool->ring.producer_lock)
{
- if (in_serving_softirq())
+ if (in_softirq())
spin_lock(&pool->ring.producer_lock);
else
spin_lock_bh(&pool->ring.producer_lock);
@@ -395,7 +395,7 @@ static inline void page_pool_ring_lock(s
static inline void page_pool_ring_unlock(struct page_pool *pool)
__releases(&pool->ring.producer_lock)
{
- if (in_serving_softirq())
+ if (in_softirq())
spin_unlock(&pool->ring.producer_lock);
else
spin_unlock_bh(&pool->ring.producer_lock);
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -511,8 +511,8 @@ static void page_pool_return_page(struct
static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
{
int ret;
- /* BH protection not needed if current is serving softirq */
- if (in_serving_softirq())
+ /* BH protection not needed if current is softirq */
+ if (in_softirq())
ret = ptr_ring_produce(&pool->ring, page);
else
ret = ptr_ring_produce_bh(&pool->ring, page);
@@ -570,7 +570,7 @@ __page_pool_put_page(struct page_pool *p
page_pool_dma_sync_for_device(pool, page,
dma_sync_size);
- if (allow_direct && in_serving_softirq() &&
+ if (allow_direct && in_softirq() &&
page_pool_recycle_in_cache(page, pool))
return NULL;

View file

@ -0,0 +1,41 @@
From 7390609b0121a1b982c5ecdfcd72dc328e5784ee Mon Sep 17 00:00:00 2001
From: Michael Walle <michael@walle.cc>
Date: Mon, 6 Feb 2023 13:43:42 +0000
Subject: [PATCH] net: add helper eth_addr_add()
Add a helper to add an offset to a ethernet address. This comes in handy
if you have a base ethernet address for multiple interfaces.
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230206134356.839737-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/etherdevice.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -508,6 +508,20 @@ static inline void eth_addr_inc(u8 *addr
}
/**
+ * eth_addr_add() - Add (or subtract) an offset to/from the given MAC address.
+ *
+ * @offset: Offset to add.
+ * @addr: Pointer to a six-byte array containing Ethernet address to increment.
+ */
+static inline void eth_addr_add(u8 *addr, long offset)
+{
+ u64 u = ether_addr_to_u64(addr);
+
+ u += offset;
+ u64_to_ether_addr(u, addr);
+}
+
+/**
* is_etherdev_addr - Tell if given Ethernet address belongs to the device.
* @dev: Pointer to a device structure
* @addr: Pointer to a six-byte array containing the Ethernet address

View file

@ -0,0 +1,394 @@
From 4765a9722e09765866e131ec31f7b9cf4c1f4854 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Sun, 19 Mar 2023 12:57:50 +0000
Subject: [PATCH] net: pcs: add driver for MediaTek SGMII PCS
The SGMII core found in several MediaTek SoCs is identical to what can
also be found in MediaTek's MT7531 Ethernet switch IC.
As this has not always been clear, both drivers developed different
implementations to deal with the PCS.
Recently Alexander Couzens pointed out this fact which lead to the
development of this shared driver.
Add a dedicated driver, mostly by copying the code now found in the
Ethernet driver. The now redundant code will be removed by a follow-up
commit.
Suggested-by: Alexander Couzens <lynxis@fe80.eu>
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
MAINTAINERS | 8 +
drivers/net/pcs/Kconfig | 7 +
drivers/net/pcs/Makefile | 1 +
drivers/net/pcs/pcs-mtk-lynxi.c | 305 ++++++++++++++++++++++++++++++
include/linux/pcs/pcs-mtk-lynxi.h | 13 ++
5 files changed, 334 insertions(+)
create mode 100644 drivers/net/pcs/pcs-mtk-lynxi.c
create mode 100644 include/linux/pcs/pcs-mtk-lynxi.h
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12926,6 +12926,14 @@ L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/ethernet/mediatek/
+MEDIATEK ETHERNET PCS DRIVER
+M: Alexander Couzens <lynxis@fe80.eu>
+M: Daniel Golle <daniel@makrotopia.org>
+L: netdev@vger.kernel.org
+S: Maintained
+F: drivers/net/pcs/pcs-mtk-lynxi.c
+F: include/linux/pcs/pcs-mtk-lynxi.h
+
MEDIATEK I2C CONTROLLER DRIVER
M: Qii Wang <qii.wang@mediatek.com>
L: linux-i2c@vger.kernel.org
--- a/drivers/net/pcs/Kconfig
+++ b/drivers/net/pcs/Kconfig
@@ -32,4 +32,11 @@ config PCS_ALTERA_TSE
This module provides helper functions for the Altera Triple Speed
Ethernet SGMII PCS, that can be found on the Intel Socfpga family.
+config PCS_MTK_LYNXI
+ tristate
+ select REGMAP
+ help
+ This module provides helpers to phylink for managing the LynxI PCS
+ which is part of MediaTek's SoC and Ethernet switch ICs.
+
endmenu
--- a/drivers/net/pcs/Makefile
+++ b/drivers/net/pcs/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_PCS_XPCS) += pcs_xpcs.o
obj-$(CONFIG_PCS_LYNX) += pcs-lynx.o
obj-$(CONFIG_PCS_RZN1_MIIC) += pcs-rzn1-miic.o
obj-$(CONFIG_PCS_ALTERA_TSE) += pcs-altera-tse.o
+obj-$(CONFIG_PCS_MTK_LYNXI) += pcs-mtk-lynxi.o
--- /dev/null
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
@@ -0,0 +1,305 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018-2019 MediaTek Inc.
+/* A library for MediaTek SGMII circuit
+ *
+ * Author: Sean Wang <sean.wang@mediatek.com>
+ * Author: Alexander Couzens <lynxis@fe80.eu>
+ * Author: Daniel Golle <daniel@makrotopia.org>
+ *
+ */
+
+#include <linux/mdio.h>
+#include <linux/of.h>
+#include <linux/pcs/pcs-mtk-lynxi.h>
+#include <linux/phylink.h>
+#include <linux/regmap.h>
+
+/* SGMII subsystem config registers */
+/* BMCR (low 16) BMSR (high 16) */
+#define SGMSYS_PCS_CONTROL_1 0x0
+#define SGMII_BMCR GENMASK(15, 0)
+#define SGMII_BMSR GENMASK(31, 16)
+
+#define SGMSYS_PCS_DEVICE_ID 0x4
+#define SGMII_LYNXI_DEV_ID 0x4d544950
+
+#define SGMSYS_PCS_ADVERTISE 0x8
+#define SGMII_ADVERTISE GENMASK(15, 0)
+#define SGMII_LPA GENMASK(31, 16)
+
+#define SGMSYS_PCS_SCRATCH 0x14
+#define SGMII_DEV_VERSION GENMASK(31, 16)
+
+/* Register to programmable link timer, the unit in 2 * 8ns */
+#define SGMSYS_PCS_LINK_TIMER 0x18
+#define SGMII_LINK_TIMER_MASK GENMASK(19, 0)
+#define SGMII_LINK_TIMER_VAL(ns) FIELD_PREP(SGMII_LINK_TIMER_MASK, \
+ ((ns) / 2 / 8))
+
+/* Register to control remote fault */
+#define SGMSYS_SGMII_MODE 0x20
+#define SGMII_IF_MODE_SGMII BIT(0)
+#define SGMII_SPEED_DUPLEX_AN BIT(1)
+#define SGMII_SPEED_MASK GENMASK(3, 2)
+#define SGMII_SPEED_10 FIELD_PREP(SGMII_SPEED_MASK, 0)
+#define SGMII_SPEED_100 FIELD_PREP(SGMII_SPEED_MASK, 1)
+#define SGMII_SPEED_1000 FIELD_PREP(SGMII_SPEED_MASK, 2)
+#define SGMII_DUPLEX_HALF BIT(4)
+#define SGMII_REMOTE_FAULT_DIS BIT(8)
+
+/* Register to reset SGMII design */
+#define SGMSYS_RESERVED_0 0x34
+#define SGMII_SW_RESET BIT(0)
+
+/* Register to set SGMII speed, ANA RG_ Control Signals III */
+#define SGMII_PHY_SPEED_MASK GENMASK(3, 2)
+#define SGMII_PHY_SPEED_1_25G FIELD_PREP(SGMII_PHY_SPEED_MASK, 0)
+#define SGMII_PHY_SPEED_3_125G FIELD_PREP(SGMII_PHY_SPEED_MASK, 1)
+
+/* Register to power up QPHY */
+#define SGMSYS_QPHY_PWR_STATE_CTRL 0xe8
+#define SGMII_PHYA_PWD BIT(4)
+
+/* Register to QPHY wrapper control */
+#define SGMSYS_QPHY_WRAP_CTRL 0xec
+#define SGMII_PN_SWAP_MASK GENMASK(1, 0)
+#define SGMII_PN_SWAP_TX_RX (BIT(0) | BIT(1))
+
+/* struct mtk_pcs_lynxi - This structure holds each sgmii regmap andassociated
+ * data
+ * @regmap: The register map pointing at the range used to setup
+ * SGMII modes
+ * @dev: Pointer to device owning the PCS
+ * @ana_rgc3: The offset of register ANA_RGC3 relative to regmap
+ * @interface: Currently configured interface mode
+ * @pcs: Phylink PCS structure
+ * @flags: Flags indicating hardware properties
+ */
+struct mtk_pcs_lynxi {
+ struct regmap *regmap;
+ u32 ana_rgc3;
+ phy_interface_t interface;
+ struct phylink_pcs pcs;
+ u32 flags;
+};
+
+static struct mtk_pcs_lynxi *pcs_to_mtk_pcs_lynxi(struct phylink_pcs *pcs)
+{
+ return container_of(pcs, struct mtk_pcs_lynxi, pcs);
+}
+
+static void mtk_pcs_lynxi_get_state(struct phylink_pcs *pcs,
+ struct phylink_link_state *state)
+{
+ struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
+ unsigned int bm, adv;
+
+ /* Read the BMSR and LPA */
+ regmap_read(mpcs->regmap, SGMSYS_PCS_CONTROL_1, &bm);
+ regmap_read(mpcs->regmap, SGMSYS_PCS_ADVERTISE, &adv);
+
+ phylink_mii_c22_pcs_decode_state(state, FIELD_GET(SGMII_BMSR, bm),
+ FIELD_GET(SGMII_LPA, adv));
+}
+
+static int mtk_pcs_lynxi_config(struct phylink_pcs *pcs, unsigned int mode,
+ phy_interface_t interface,
+ const unsigned long *advertising,
+ bool permit_pause_to_mac)
+{
+ struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
+ bool mode_changed = false, changed, use_an;
+ unsigned int rgc3, sgm_mode, bmcr;
+ int advertise, link_timer;
+
+ advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
+ advertising);
+ if (advertise < 0)
+ return advertise;
+
+ /* Clearing IF_MODE_BIT0 switches the PCS to BASE-X mode, and
+ * we assume that fixes it's speed at bitrate = line rate (in
+ * other words, 1000Mbps or 2500Mbps).
+ */
+ if (interface == PHY_INTERFACE_MODE_SGMII) {
+ sgm_mode = SGMII_IF_MODE_SGMII;
+ if (phylink_autoneg_inband(mode)) {
+ sgm_mode |= SGMII_REMOTE_FAULT_DIS |
+ SGMII_SPEED_DUPLEX_AN;
+ use_an = true;
+ } else {
+ use_an = false;
+ }
+ } else if (phylink_autoneg_inband(mode)) {
+ /* 1000base-X or 2500base-X autoneg */
+ sgm_mode = SGMII_REMOTE_FAULT_DIS;
+ use_an = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+ advertising);
+ } else {
+ /* 1000base-X or 2500base-X without autoneg */
+ sgm_mode = 0;
+ use_an = false;
+ }
+
+ if (use_an)
+ bmcr = BMCR_ANENABLE;
+ else
+ bmcr = 0;
+
+ if (mpcs->interface != interface) {
+ link_timer = phylink_get_link_timer_ns(interface);
+ if (link_timer < 0)
+ return link_timer;
+
+ /* PHYA power down */
+ regmap_set_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL,
+ SGMII_PHYA_PWD);
+
+ /* Reset SGMII PCS state */
+ regmap_set_bits(mpcs->regmap, SGMSYS_RESERVED_0,
+ SGMII_SW_RESET);
+
+ if (mpcs->flags & MTK_SGMII_FLAG_PN_SWAP)
+ regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_WRAP_CTRL,
+ SGMII_PN_SWAP_MASK,
+ SGMII_PN_SWAP_TX_RX);
+
+ if (interface == PHY_INTERFACE_MODE_2500BASEX)
+ rgc3 = SGMII_PHY_SPEED_3_125G;
+ else
+ rgc3 = SGMII_PHY_SPEED_1_25G;
+
+ /* Configure the underlying interface speed */
+ regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3,
+ SGMII_PHY_SPEED_MASK, rgc3);
+
+ /* Setup the link timer */
+ regmap_write(mpcs->regmap, SGMSYS_PCS_LINK_TIMER,
+ SGMII_LINK_TIMER_VAL(link_timer));
+
+ mpcs->interface = interface;
+ mode_changed = true;
+ }
+
+ /* Update the advertisement, noting whether it has changed */
+ regmap_update_bits_check(mpcs->regmap, SGMSYS_PCS_ADVERTISE,
+ SGMII_ADVERTISE, advertise, &changed);
+
+ /* Update the sgmsys mode register */
+ regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE,
+ SGMII_REMOTE_FAULT_DIS | SGMII_SPEED_DUPLEX_AN |
+ SGMII_IF_MODE_SGMII, sgm_mode);
+
+ /* Update the BMCR */
+ regmap_update_bits(mpcs->regmap, SGMSYS_PCS_CONTROL_1,
+ BMCR_ANENABLE, bmcr);
+
+ /* Release PHYA power down state
+ * Only removing bit SGMII_PHYA_PWD isn't enough.
+ * There are cases when the SGMII_PHYA_PWD register contains 0x9 which
+ * prevents SGMII from working. The SGMII still shows link but no traffic
+ * can flow. Writing 0x0 to the PHYA_PWD register fix the issue. 0x0 was
+ * taken from a good working state of the SGMII interface.
+ * Unknown how much the QPHY needs but it is racy without a sleep.
+ * Tested on mt7622 & mt7986.
+ */
+ usleep_range(50, 100);
+ regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, 0);
+
+ return changed || mode_changed;
+}
+
+static void mtk_pcs_lynxi_restart_an(struct phylink_pcs *pcs)
+{
+ struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
+
+ regmap_set_bits(mpcs->regmap, SGMSYS_PCS_CONTROL_1, BMCR_ANRESTART);
+}
+
+static void mtk_pcs_lynxi_link_up(struct phylink_pcs *pcs, unsigned int mode,
+ phy_interface_t interface, int speed,
+ int duplex)
+{
+ struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
+ unsigned int sgm_mode;
+
+ if (!phylink_autoneg_inband(mode)) {
+ /* Force the speed and duplex setting */
+ if (speed == SPEED_10)
+ sgm_mode = SGMII_SPEED_10;
+ else if (speed == SPEED_100)
+ sgm_mode = SGMII_SPEED_100;
+ else
+ sgm_mode = SGMII_SPEED_1000;
+
+ if (duplex != DUPLEX_FULL)
+ sgm_mode |= SGMII_DUPLEX_HALF;
+
+ regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE,
+ SGMII_DUPLEX_HALF | SGMII_SPEED_MASK,
+ sgm_mode);
+ }
+}
+
+static const struct phylink_pcs_ops mtk_pcs_lynxi_ops = {
+ .pcs_get_state = mtk_pcs_lynxi_get_state,
+ .pcs_config = mtk_pcs_lynxi_config,
+ .pcs_an_restart = mtk_pcs_lynxi_restart_an,
+ .pcs_link_up = mtk_pcs_lynxi_link_up,
+};
+
+struct phylink_pcs *mtk_pcs_lynxi_create(struct device *dev,
+ struct regmap *regmap, u32 ana_rgc3,
+ u32 flags)
+{
+ struct mtk_pcs_lynxi *mpcs;
+ u32 id, ver;
+ int ret;
+
+ ret = regmap_read(regmap, SGMSYS_PCS_DEVICE_ID, &id);
+ if (ret < 0)
+ return NULL;
+
+ if (id != SGMII_LYNXI_DEV_ID) {
+ dev_err(dev, "unknown PCS device id %08x\n", id);
+ return NULL;
+ }
+
+ ret = regmap_read(regmap, SGMSYS_PCS_SCRATCH, &ver);
+ if (ret < 0)
+ return NULL;
+
+ ver = FIELD_GET(SGMII_DEV_VERSION, ver);
+ if (ver != 0x1) {
+ dev_err(dev, "unknown PCS device version %04x\n", ver);
+ return NULL;
+ }
+
+ dev_dbg(dev, "MediaTek LynxI SGMII PCS (id 0x%08x, ver 0x%04x)\n", id,
+ ver);
+
+ mpcs = kzalloc(sizeof(*mpcs), GFP_KERNEL);
+ if (!mpcs)
+ return NULL;
+
+ mpcs->ana_rgc3 = ana_rgc3;
+ mpcs->regmap = regmap;
+ mpcs->flags = flags;
+ mpcs->pcs.ops = &mtk_pcs_lynxi_ops;
+ mpcs->pcs.poll = true;
+ mpcs->interface = PHY_INTERFACE_MODE_NA;
+
+ return &mpcs->pcs;
+}
+EXPORT_SYMBOL(mtk_pcs_lynxi_create);
+
+void mtk_pcs_lynxi_destroy(struct phylink_pcs *pcs)
+{
+ if (!pcs)
+ return;
+
+ kfree(pcs_to_mtk_pcs_lynxi(pcs));
+}
+EXPORT_SYMBOL(mtk_pcs_lynxi_destroy);
+
+MODULE_LICENSE("GPL");
--- /dev/null
+++ b/include/linux/pcs/pcs-mtk-lynxi.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_PCS_MTK_LYNXI_H
+#define __LINUX_PCS_MTK_LYNXI_H
+
+#include <linux/phylink.h>
+#include <linux/regmap.h>
+
+#define MTK_SGMII_FLAG_PN_SWAP BIT(0)
+struct phylink_pcs *mtk_pcs_lynxi_create(struct device *dev,
+ struct regmap *regmap,
+ u32 ana_rgc3, u32 flags);
+void mtk_pcs_lynxi_destroy(struct phylink_pcs *pcs);
+#endif

Some files were not shown because too many files have changed in this diff Show more