reverted: --- linux-aws-5.13-5.13.0/Documentation/accounting/psi.rst +++ linux-aws-5.13-5.13.0.orig/Documentation/accounting/psi.rst @@ -92,8 +92,7 @@ for the same psi metric can be specified. However for each trigger a separate file descriptor is required to be able to poll it separately from others, therefore for each trigger a separate open() syscall should be made even +when opening the same psi interface file. -when opening the same psi interface file. Write operations to a file descriptor -with an already existing psi trigger will fail with EBUSY. Monitors activate only when system enters stall state for the monitored psi metric and deactivates upon exit from the stall state. While system is diff -u linux-aws-5.13-5.13.0/Documentation/admin-guide/hw-vuln/spectre.rst linux-aws-5.13-5.13.0/Documentation/admin-guide/hw-vuln/spectre.rst --- linux-aws-5.13-5.13.0/Documentation/admin-guide/hw-vuln/spectre.rst +++ linux-aws-5.13-5.13.0/Documentation/admin-guide/hw-vuln/spectre.rst @@ -483,7 +483,7 @@ before invoking any firmware code to prevent Spectre variant 2 exploits using the firmware. - Using kernel address space randomization (CONFIG_RANDOMIZE_BASE=y + Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes attacks on the kernel generally more difficult. diff -u linux-aws-5.13-5.13.0/Documentation/admin-guide/kernel-parameters.txt linux-aws-5.13-5.13.0/Documentation/admin-guide/kernel-parameters.txt --- linux-aws-5.13-5.13.0/Documentation/admin-guide/kernel-parameters.txt +++ linux-aws-5.13-5.13.0/Documentation/admin-guide/kernel-parameters.txt @@ -225,23 +225,14 @@ For broken nForce2 BIOS resulting in XT-PIC timer. acpi_sleep= [HW,ACPI] Sleep options - Format: { s3_bios, s3_mode, s3_beep, s4_hwsig, - s4_nohwsig, old_ordering, nonvs, - sci_force_enable, nobl } + Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, + old_ordering, nonvs, sci_force_enable, nobl } See Documentation/power/video.rst for information on s3_bios and s3_mode. s3_beep is for debugging; it makes the PC's speaker beep as soon as the kernel's real-mode entry point is called. - s4_hwsig causes the kernel to check the ACPI hardware - signature during resume from hibernation, and gracefully - refuse to resume if it has changed. This complies with - the ACPI specification but not with reality, since - Windows does not do this and many laptops do change it - on docking. So the default behaviour is to allow resume - and simply warn when the signature changes, unless the - s4_hwsig option is enabled. s4_nohwsig prevents ACPI hardware signature from being - used (or even warned about) during resume. + used during resume from hibernation. old_ordering causes the ACPI 1.0 ordering of the _PTS control method, with respect to putting devices into low power states, to be enforced (the ACPI 2.0 ordering reverted: --- linux-aws-5.13-5.13.0/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +++ linux-aws-5.13-5.13.0.orig/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml @@ -10,9 +10,6 @@ maintainers: - Neil Armstrong -allOf: - - $ref: /schemas/sound/name-prefix.yaml# - description: | The Amlogic Meson Synopsys Designware Integration is composed of - A Synopsys DesignWare HDMI Controller IP @@ -102,8 +99,6 @@ "#sound-dai-cells": const: 0 - sound-name-prefix: true - required: - compatible - reg reverted: --- linux-aws-5.13-5.13.0/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +++ linux-aws-5.13-5.13.0.orig/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml @@ -78,10 +78,6 @@ interrupts: maxItems: 1 - amlogic,canvas: - description: should point to a canvas provider node - $ref: /schemas/types.yaml#/definitions/phandle - power-domains: maxItems: 1 description: phandle to the associated power domain @@ -110,7 +106,6 @@ - port@1 - "#address-cells" - "#size-cells" - - amlogic,canvas additionalProperties: false @@ -123,7 +118,6 @@ interrupts = <3>; #address-cells = <1>; #size-cells = <0>; - amlogic,canvas = <&canvas>; /* CVBS VDAC output port */ port@0 { reverted: --- linux-aws-5.13-5.13.0/Documentation/devicetree/bindings/net/can/tcan4x5x.txt +++ linux-aws-5.13-5.13.0.orig/Documentation/devicetree/bindings/net/can/tcan4x5x.txt @@ -31,7 +31,7 @@ #address-cells = <1>; #size-cells = <1>; spi-max-frequency = <10000000>; + bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; - bosch,mram-cfg = <0x0 0 0 16 0 0 1 1>; interrupt-parent = <&gpio1>; interrupts = <14 IRQ_TYPE_LEVEL_LOW>; device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; reverted: --- linux-aws-5.13-5.13.0/Documentation/devicetree/bindings/thermal/thermal-zones.yaml +++ linux-aws-5.13-5.13.0.orig/Documentation/devicetree/bindings/thermal/thermal-zones.yaml @@ -199,11 +199,12 @@ contribution: $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 100 description: + The percentage contribution of the cooling devices at the + specific trip temperature referenced in this map + to this thermal zone - The cooling contribution to the thermal zone of the referred - cooling device at the referred trip point. The contribution is - a ratio of the sum of all cooling contributions within a - thermal zone. required: - trip reverted: --- linux-aws-5.13-5.13.0/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml +++ linux-aws-5.13-5.13.0.orig/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml @@ -39,8 +39,8 @@ samsung,syscon-phandle: $ref: /schemas/types.yaml#/definitions/phandle description: + Phandle to the PMU system controller node (in case of Exynos5250 + and Exynos5420). - Phandle to the PMU system controller node (in case of Exynos5250, - Exynos5420 and Exynos7). required: - compatible @@ -58,7 +58,6 @@ enum: - samsung,exynos5250-wdt - samsung,exynos5420-wdt - - samsung,exynos7-wdt then: required: - samsung,syscon-phandle reverted: --- linux-aws-5.13-5.13.0/Documentation/driver-api/dmaengine/dmatest.rst +++ linux-aws-5.13-5.13.0.orig/Documentation/driver-api/dmaengine/dmatest.rst @@ -143,14 +143,13 @@ Allocating Channels ------------------- +Channels are required to be configured prior to starting the test run. +Attempting to run the test without configuring the channels will fail. -Channels do not need to be configured prior to starting a test run. Attempting -to run the test without configuring the channels will result in testing any -channels that are available. Example:: % echo 1 > /sys/module/dmatest/parameters/run + dmatest: Could not start test, no channels configured - dmatest: No channels configured, continue with any Channels are registered using the "channel" parameter. Channels can be requested by their name, once requested, the channel is registered and a pending thread is added to the test list. reverted: --- linux-aws-5.13-5.13.0/Documentation/driver-api/firewire.rst +++ linux-aws-5.13-5.13.0.orig/Documentation/driver-api/firewire.rst @@ -19,7 +19,7 @@ Firewire char device data structures ==================================== +.. include:: /ABI/stable/firewire-cdev -.. include:: ../ABI/stable/firewire-cdev :literal: .. kernel-doc:: include/uapi/linux/firewire-cdev.h @@ -28,7 +28,7 @@ Firewire device probing and sysfs interfaces ============================================ +.. include:: /ABI/stable/sysfs-bus-firewire -.. include:: ../ABI/stable/sysfs-bus-firewire :literal: .. kernel-doc:: drivers/firewire/core-device.c reverted: --- linux-aws-5.13-5.13.0/Documentation/firmware-guide/acpi/dsd/data-node-references.rst +++ linux-aws-5.13-5.13.0.orig/Documentation/firmware-guide/acpi/dsd/data-node-references.rst @@ -5,7 +5,7 @@ Referencing hierarchical data nodes =================================== +:Copyright: |copy| 2018 Intel Corporation -:Copyright: |copy| 2018, 2021 Intel Corporation :Author: Sakari Ailus ACPI in general allows referring to device objects in the tree only. @@ -52,14 +52,12 @@ Name (NOD0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () { "reg", 0 }, Package () { "random-property", 3 }, } }) Name (NOD1, Package() { ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { - Package () { "reg", 1 }, Package () { "anothernode", "ANOD" }, } }) @@ -76,11 +74,7 @@ Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { + Package () { "reference", ^DEV0, "node@1", "anothernode" }, - Package () { - "reference", Package () { - ^DEV0, "node@1", "anothernode" - } - }, } }) } reverted: --- linux-aws-5.13-5.13.0/arch/arm/Kconfig.debug +++ linux-aws-5.13-5.13.0.orig/arch/arm/Kconfig.debug @@ -400,12 +400,12 @@ Say Y here if you want kernel low-level debugging support on i.MX25. + config DEBUG_IMX21_IMX27_UART + bool "i.MX21 and i.MX27 Debug UART" + depends on SOC_IMX21 || SOC_IMX27 - config DEBUG_IMX27_UART - bool "i.MX27 Debug UART" - depends on SOC_IMX27 help Say Y here if you want kernel low-level debugging support + on i.MX21 or i.MX27. - on i.MX27. config DEBUG_IMX28_UART bool "i.MX28 Debug UART" @@ -1463,7 +1463,7 @@ int "i.MX Debug UART Port Selection" depends on DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ + DEBUG_IMX21_IMX27_UART || \ - DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ @@ -1522,12 +1522,12 @@ default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/imx.S" if DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ + DEBUG_IMX21_IMX27_UART || \ - DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ DEBUG_IMX51_UART || \ + DEBUG_IMX53_UART ||\ - DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ DEBUG_IMX6SX_UART || \ reverted: --- linux-aws-5.13-5.13.0/arch/arm/boot/compressed/efi-header.S +++ linux-aws-5.13-5.13.0.orig/arch/arm/boot/compressed/efi-header.S @@ -9,22 +9,16 @@ #include .macro __nop +#ifdef CONFIG_EFI_STUB + @ This is almost but not quite a NOP, since it does clobber the + @ condition flags. But it is the best we can do for EFI, since + @ PE/COFF expects the magic string "MZ" at offset 0, while the + @ ARM/Linux boot protocol expects an executable instruction + @ there. + .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 +#else AR_CLASS( mov r0, r0 ) M_CLASS( nop.w ) - .endm - - .macro __initial_nops -#ifdef CONFIG_EFI_STUB - @ This is a two-instruction NOP, which happens to bear the - @ PE/COFF signature "MZ" in the first two bytes, so the kernel - @ is accepted as an EFI binary. Booting via the UEFI stub - @ will not execute those instructions, but the ARM/Linux - @ boot protocol does, so we need some NOPs here. - .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 - eor r5, r5, 0x4d000 @ undo previous insn -#else - __nop - __nop #endif .endm reverted: --- linux-aws-5.13-5.13.0/arch/arm/boot/compressed/head.S +++ linux-aws-5.13-5.13.0.orig/arch/arm/boot/compressed/head.S @@ -203,8 +203,7 @@ * were patching the initial instructions of the kernel, i.e * had started to exploit this "patch area". */ + .rept 7 - __initial_nops - .rept 5 __nop .endr #ifndef CONFIG_THUMB2_KERNEL reverted: --- linux-aws-5.13-5.13.0/arch/arm/boot/dts/armada-38x.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm/boot/dts/armada-38x.dtsi @@ -168,7 +168,7 @@ }; uart0: serial@12000 { + compatible = "marvell,armada-38x-uart"; - compatible = "marvell,armada-38x-uart", "ns16550a"; reg = <0x12000 0x100>; reg-shift = <2>; interrupts = ; @@ -178,7 +178,7 @@ }; uart1: serial@12100 { + compatible = "marvell,armada-38x-uart"; - compatible = "marvell,armada-38x-uart", "ns16550a"; reg = <0x12100 0x100>; reg-shift = <2>; interrupts = ; diff -u linux-aws-5.13-5.13.0/arch/arm/boot/dts/gemini-nas4220b.dts linux-aws-5.13-5.13.0/arch/arm/boot/dts/gemini-nas4220b.dts --- linux-aws-5.13-5.13.0/arch/arm/boot/dts/gemini-nas4220b.dts +++ linux-aws-5.13-5.13.0/arch/arm/boot/dts/gemini-nas4220b.dts @@ -84,7 +84,7 @@ partitions { compatible = "redboot-fis"; /* Eraseblock at 0xfe0000 */ - fis-index-block = <0x7f>; + fis-index-block = <0x1fc>; }; }; reverted: --- linux-aws-5.13-5.13.0/arch/arm/boot/dts/omap3-n900.dts +++ linux-aws-5.13-5.13.0.orig/arch/arm/boot/dts/omap3-n900.dts @@ -8,7 +8,6 @@ #include "omap34xx.dtsi" #include -#include /* * Default secure signed bootloader (Nokia X-Loader) does not enable L3 firewall @@ -631,92 +630,63 @@ }; lp5523: lp5523@32 { - #address-cells = <1>; - #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ + enable-gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ - enable-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ + chan0 { - led@0 { - reg = <0>; chan-name = "lp5523:kb1"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; + chan1 { - led@1 { - reg = <1>; chan-name = "lp5523:kb2"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; + chan2 { - led@2 { - reg = <2>; chan-name = "lp5523:kb3"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; + chan3 { - led@3 { - reg = <3>; chan-name = "lp5523:kb4"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; + chan4 { - led@4 { - reg = <4>; chan-name = "lp5523:b"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_STATUS; }; + chan5 { - led@5 { - reg = <5>; chan-name = "lp5523:g"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_STATUS; }; + chan6 { - led@6 { - reg = <6>; chan-name = "lp5523:r"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_STATUS; }; + chan7 { - led@7 { - reg = <7>; chan-name = "lp5523:kb5"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; + chan8 { - led@8 { - reg = <8>; chan-name = "lp5523:kb6"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; - color = ; - function = LED_FUNCTION_KBD_BACKLIGHT; }; }; reverted: --- linux-aws-5.13-5.13.0/arch/arm/boot/dts/qcom-sdx55.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm/boot/dts/qcom-sdx55.dtsi @@ -334,10 +334,12 @@ clocks = <&rpmhcc RPMH_IPA_CLK>; clock-names = "core"; + interconnects = <&system_noc MASTER_IPA &system_noc SLAVE_SNOC_MEM_NOC_GC>, + <&mem_noc MASTER_SNOC_GC_MEM_NOC &mc_virt SLAVE_EBI_CH0>, - interconnects = <&system_noc MASTER_IPA &mc_virt SLAVE_EBI_CH0>, <&system_noc MASTER_IPA &system_noc SLAVE_OCIMEM>, <&mem_noc MASTER_AMPSS_M0 &system_noc SLAVE_IPA_CFG>; + interconnect-names = "memory-a", + "memory-b", - interconnect-names = "memory", "imem", "config"; diff -u linux-aws-5.13-5.13.0/arch/arm/boot/dts/stm32f429-disco.dts linux-aws-5.13-5.13.0/arch/arm/boot/dts/stm32f429-disco.dts --- linux-aws-5.13-5.13.0/arch/arm/boot/dts/stm32f429-disco.dts +++ linux-aws-5.13-5.13.0/arch/arm/boot/dts/stm32f429-disco.dts @@ -192,7 +192,7 @@ display: display@1{ /* Connect panel-ilitek-9341 to ltdc */ - compatible = "st,sf-tc240t-9370-t", "ilitek,ili9341"; + compatible = "st,sf-tc240t-9370-t"; reg = <1>; spi-3wire; spi-max-frequency = <10000000>; reverted: --- linux-aws-5.13-5.13.0/arch/arm/include/debug/imx-uart.h +++ linux-aws-5.13-5.13.0.orig/arch/arm/include/debug/imx-uart.h @@ -11,6 +11,13 @@ #define IMX1_UART_BASE_ADDR(n) IMX1_UART##n##_BASE_ADDR #define IMX1_UART_BASE(n) IMX1_UART_BASE_ADDR(n) +#define IMX21_UART1_BASE_ADDR 0x1000a000 +#define IMX21_UART2_BASE_ADDR 0x1000b000 +#define IMX21_UART3_BASE_ADDR 0x1000c000 +#define IMX21_UART4_BASE_ADDR 0x1000d000 +#define IMX21_UART_BASE_ADDR(n) IMX21_UART##n##_BASE_ADDR +#define IMX21_UART_BASE(n) IMX21_UART_BASE_ADDR(n) + #define IMX25_UART1_BASE_ADDR 0x43f90000 #define IMX25_UART2_BASE_ADDR 0x43f94000 #define IMX25_UART3_BASE_ADDR 0x5000c000 @@ -19,13 +26,6 @@ #define IMX25_UART_BASE_ADDR(n) IMX25_UART##n##_BASE_ADDR #define IMX25_UART_BASE(n) IMX25_UART_BASE_ADDR(n) -#define IMX27_UART1_BASE_ADDR 0x1000a000 -#define IMX27_UART2_BASE_ADDR 0x1000b000 -#define IMX27_UART3_BASE_ADDR 0x1000c000 -#define IMX27_UART4_BASE_ADDR 0x1000d000 -#define IMX27_UART_BASE_ADDR(n) IMX27_UART##n##_BASE_ADDR -#define IMX27_UART_BASE(n) IMX27_UART_BASE_ADDR(n) - #define IMX31_UART1_BASE_ADDR 0x43f90000 #define IMX31_UART2_BASE_ADDR 0x43f94000 #define IMX31_UART3_BASE_ADDR 0x5000c000 @@ -112,10 +112,10 @@ #ifdef CONFIG_DEBUG_IMX1_UART #define UART_PADDR IMX_DEBUG_UART_BASE(IMX1) +#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART) +#define UART_PADDR IMX_DEBUG_UART_BASE(IMX21) #elif defined(CONFIG_DEBUG_IMX25_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX25) -#elif defined(CONFIG_DEBUG_IMX27_UART) -#define UART_PADDR IMX_DEBUG_UART_BASE(IMX27) #elif defined(CONFIG_DEBUG_IMX31_UART) #define UART_PADDR IMX_DEBUG_UART_BASE(IMX31) #elif defined(CONFIG_DEBUG_IMX35_UART) reverted: --- linux-aws-5.13-5.13.0/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ linux-aws-5.13-5.13.0.orig/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -154,10 +154,8 @@ return -ENODEV; for_each_matching_node_and_match(np, rcar_gen2_quirk_match, &id) { + if (!of_device_is_available(np)) - if (!of_device_is_available(np)) { - of_node_put(np); break; - } ret = of_property_read_u32(np, "reg", &addr); if (ret) /* Skip invalid entry and continue */ @@ -166,7 +164,6 @@ quirk = kzalloc(sizeof(*quirk), GFP_KERNEL); if (!quirk) { ret = -ENOMEM; - of_node_put(np); goto err_mem; } reverted: --- linux-aws-5.13-5.13.0/arch/arm/probes/kprobes/Makefile +++ linux-aws-5.13-5.13.0.orig/arch/arm/probes/kprobes/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -KASAN_SANITIZE_actions-common.o := n -KASAN_SANITIZE_actions-arm.o := n -KASAN_SANITIZE_actions-thumb.o := n obj-$(CONFIG_KPROBES) += core.o actions-common.o checkers-common.o obj-$(CONFIG_ARM_KPROBES_TEST) += test-kprobes.o test-kprobes-objs := test-core.o reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi @@ -58,7 +58,7 @@ secure-monitor = <&sm>; }; + gpu_opp_table: gpu-opp-table { - gpu_opp_table: opp-table-gpu { compatible = "operating-points-v2"; opp-124999998 { diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -607,7 +607,7 @@ pinctrl-0 = <&nor_pins>; pinctrl-names = "default"; - mx25u64: flash@0 { + mx25u64: spi-flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "mxicy,mx25u6435f", "jedec,spi-nor"; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi @@ -6,7 +6,6 @@ */ #include "meson-gxbb.dtsi" -#include / { aliases { @@ -65,7 +64,6 @@ regulator-name = "VDDIO_AO18"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; - regulator-always-on; }; vcc_3v3: regulator-vcc_3v3 { @@ -163,7 +161,6 @@ status = "okay"; pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; pinctrl-names = "default"; - hdmi-supply = <&vddio_ao18>; }; &hdmi_tx_tmds_port { reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts @@ -272,6 +272,11 @@ vcc-supply = <&sb_3v3>; }; + rtc@51 { + compatible = "nxp,pcf2129"; + reg = <0x51>; + }; + eeprom@56 { compatible = "atmel,24c512"; reg = <0x56>; @@ -313,15 +318,6 @@ }; -&i2c1 { - status = "okay"; - - rtc@51 { - compatible = "nxp,pcf2129"; - reg = <0x51>; - }; -}; - &enetc_port1 { phy-handle = <&qds_phy1>; phy-connection-type = "rgmii-id"; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/marvell/cn9130.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/marvell/cn9130.dtsi @@ -11,13 +11,6 @@ model = "Marvell Armada CN9130 SoC"; compatible = "marvell,cn9130", "marvell,armada-ap807-quad", "marvell,armada-ap807"; - - aliases { - gpio1 = &cp0_gpio1; - gpio2 = &cp0_gpio2; - spi1 = &cp0_spi0; - spi2 = &cp0_spi1; - }; }; /* @@ -42,11 +35,3 @@ #undef CP11X_PCIE0_BASE #undef CP11X_PCIE1_BASE #undef CP11X_PCIE2_BASE - -&cp0_gpio1 { - status = "okay"; -}; - -&cp0_gpio2 { - status = "okay"; -}; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -988,7 +988,7 @@ ccplex@e000000 { compatible = "nvidia,tegra186-ccplex-cluster"; + reg = <0x0 0x0e000000 0x0 0x3fffff>; - reg = <0x0 0x0e000000 0x0 0x400000>; nvidia,bpmp = <&bpmp>; }; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/nvidia/tegra194.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/nvidia/tegra194.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -814,8 +814,9 @@ <&bpmp TEGRA194_CLK_HDA2CODEC_2X>; clock-names = "hda", "hda2hdmi", "hda2codec_2x"; resets = <&bpmp TEGRA194_RESET_HDA>, - <&bpmp TEGRA194_RESET_HDA2HDMICODEC>; - reset-names = "hda", "hda2hdmi"; + <&bpmp TEGRA194_RESET_HDA2HDMICODEC>, + <&bpmp TEGRA194_RESET_HDA2CODEC_2X>; + reset-names = "hda", "hda2hdmi", "hda2codec_2x"; power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>; interconnects = <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>, <&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -221,7 +221,7 @@ interrupts = ; gpio-controller; #gpio-cells = <2>; - gpio-ranges = <&tlmm 0 0 80>; + gpio-ranges = <&tlmm 0 80>; interrupt-controller; #interrupt-cells = <2>; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8916.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8916.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -19,8 +19,8 @@ #size-cells = <2>; aliases { - mmc0 = &sdhc_1; /* SDC1 eMMC slot */ - mmc1 = &sdhc_2; /* SDC2 SD card slot */ + sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ + sdhc2 = &sdhc_2; /* SDC2 SD card slot */ }; chosen { }; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8996.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8996.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -645,6 +645,9 @@ nvmem-cells = <&gpu_speed_bin>; nvmem-cell-names = "speed_bin"; + qcom,gpu-quirk-two-pass-use-wfi; + qcom,gpu-quirk-fault-detect-mask; + operating-points-v2 = <&gpu_opp_table>; gpu_opp_table: opp-table { reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -275,7 +275,7 @@ <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, <0>, <0>, <0>, <0>, <0>, <0>; clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk", + "pcie_0_pipe_clk", "pcie_1_pipe-clk", - "pcie_0_pipe_clk", "pcie_1_pipe_clk", "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk", "ufs_phy_tx_symbol_0_clk", "usb3_phy_wrapper_gcc_usb30_pipe_clk"; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts @@ -479,10 +479,6 @@ dai@1 { reg = <1>; }; - - dai@2 { - reg = <2>; - }; }; &sound { @@ -495,7 +491,6 @@ "SpkrLeft IN", "SPK1 OUT", "SpkrRight IN", "SPK2 OUT", "MM_DL1", "MultiMedia1 Playback", - "MM_DL3", "MultiMedia3 Playback", "MultiMedia2 Capture", "MM_UL2"; mm1-dai-link { @@ -512,13 +507,6 @@ }; }; - mm3-dai-link { - link-name = "MultiMedia3"; - cpu { - sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>; - }; - }; - slim-dai-link { link-name = "SLIM Playback"; cpu { @@ -548,21 +536,6 @@ sound-dai = <&wcd9340 1>; }; }; - - slim-wcd-dai-link { - link-name = "SLIM WCD Playback"; - cpu { - sound-dai = <&q6afedai SLIMBUS_1_RX>; - }; - - platform { - sound-dai = <&q6routing>; - }; - - codec { - sound-dai = <&wcd9340 2>; - }; - }; }; &tlmm { diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sm8350.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sm8350.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -2096,7 +2096,7 @@ }; }; - cam-thermal-bottom { + camera-thermal-bottom { polling-delay-passive = <250>; polling-delay = <1000>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/cat875.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/cat875.dtsi @@ -18,7 +18,6 @@ pinctrl-names = "default"; renesas,no-ether-link; phy-handle = <&phy0>; - phy-mode = "rgmii-id"; status = "okay"; phy0: ethernet-phy@0 { diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774a1.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774a1.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774a1.dtsi @@ -2783,7 +2783,7 @@ }; thermal-zones { - sensor1_thermal: sensor1-thermal { + sensor_thermal1: sensor-thermal1 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2798,7 +2798,7 @@ }; }; - sensor2_thermal: sensor2-thermal { + sensor_thermal2: sensor-thermal2 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -2813,7 +2813,7 @@ }; }; - sensor3_thermal: sensor3-thermal { + sensor_thermal3: sensor-thermal3 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774b1.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/r8a774b1.dtsi @@ -2628,7 +2628,7 @@ }; thermal-zones { + sensor_thermal1: sensor-thermal1 { - sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2643,7 +2643,7 @@ }; }; + sensor_thermal2: sensor-thermal2 { - sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -2658,7 +2658,7 @@ }; }; + sensor_thermal3: sensor-thermal3 { - sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a774e1.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/r8a774e1.dtsi @@ -2903,7 +2903,7 @@ }; thermal-zones { + sensor_thermal1: sensor-thermal1 { - sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2918,7 +2918,7 @@ }; }; + sensor_thermal2: sensor-thermal2 { - sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -2933,7 +2933,7 @@ }; }; + sensor_thermal3: sensor-thermal3 { - sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77951.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/r8a77951.dtsi @@ -3369,7 +3369,7 @@ }; thermal-zones { + sensor_thermal1: sensor-thermal1 { - sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -3384,7 +3384,7 @@ }; }; + sensor_thermal2: sensor-thermal2 { - sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -3399,7 +3399,7 @@ }; }; + sensor_thermal3: sensor-thermal3 { - sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77960.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77960.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77960.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77960.dtsi @@ -2971,7 +2971,7 @@ }; thermal-zones { - sensor1_thermal: sensor1-thermal { + sensor_thermal1: sensor-thermal1 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2986,7 +2986,7 @@ }; }; - sensor2_thermal: sensor2-thermal { + sensor_thermal2: sensor-thermal2 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -3001,7 +3001,7 @@ }; }; - sensor3_thermal: sensor3-thermal { + sensor_thermal3: sensor-thermal3 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77961.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77961.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77961.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77961.dtsi @@ -2680,7 +2680,7 @@ }; thermal-zones { - sensor1_thermal: sensor1-thermal { + sensor_thermal1: sensor-thermal1 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2695,7 +2695,7 @@ }; }; - sensor2_thermal: sensor2-thermal { + sensor_thermal2: sensor-thermal2 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -2710,7 +2710,7 @@ }; }; - sensor3_thermal: sensor3-thermal { + sensor_thermal3: sensor-thermal3 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77965.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/r8a77965.dtsi @@ -2781,7 +2781,7 @@ }; thermal-zones { + sensor_thermal1: sensor-thermal1 { - sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -2796,7 +2796,7 @@ }; }; + sensor_thermal2: sensor-thermal2 { - sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -2811,7 +2811,7 @@ }; }; + sensor_thermal3: sensor-thermal3 { - sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a77980.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/renesas/r8a77980.dtsi @@ -1579,7 +1579,7 @@ }; thermal-zones { + thermal-sensor-1 { - sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -1598,7 +1598,7 @@ }; }; + thermal-sensor-2 { - sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a779a0.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a779a0.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a779a0.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/renesas/r8a779a0.dtsi @@ -1143,7 +1143,7 @@ }; thermal-zones { - sensor1_thermal: sensor1-thermal { + sensor_thermal1: sensor-thermal1 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>; @@ -1157,7 +1157,7 @@ }; }; - sensor2_thermal: sensor2-thermal { + sensor_thermal2: sensor-thermal2 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>; @@ -1171,7 +1171,7 @@ }; }; - sensor3_thermal: sensor3-thermal { + sensor_thermal3: sensor-thermal3 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>; @@ -1185,7 +1185,7 @@ }; }; - sensor4_thermal: sensor4-thermal { + sensor_thermal4: sensor-thermal4 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 3>; @@ -1199,7 +1199,7 @@ }; }; - sensor5_thermal: sensor5-thermal { + sensor_thermal5: sensor-thermal5 { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 4>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-am642.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/ti/k3-am642.dtsi @@ -60,6 +60,6 @@ cache-level = <2>; cache-size = <0x40000>; cache-line-size = <64>; + cache-sets = <512>; - cache-sets = <256>; }; }; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -32,7 +32,7 @@ #size-cells = <1>; ranges = <0x00 0x00 0x00100000 0x1c000>; - serdes_ln_ctrl: mux-controller@4080 { + serdes_ln_ctrl: serdes-ln-ctrl@4080 { compatible = "mmio-mux"; #mux-control-cells = <1>; mux-reg-masks = <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select */ reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j7200.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/ti/k3-j7200.dtsi @@ -60,7 +60,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; + d-cache-sets = <128>; - d-cache-sets = <256>; next-level-cache = <&L2_0>; }; @@ -74,7 +74,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; + d-cache-sets = <128>; - d-cache-sets = <256>; next-level-cache = <&L2_0>; }; }; @@ -84,7 +84,7 @@ cache-level = <2>; cache-size = <0x100000>; cache-line-size = <64>; + cache-sets = <2048>; - cache-sets = <1024>; next-level-cache = <&msmc_l3>; }; diff -u linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +++ linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi @@ -42,7 +42,7 @@ #size-cells = <1>; ranges = <0x0 0x0 0x00100000 0x1c000>; - serdes_ln_ctrl: mux-controller@4080 { + serdes_ln_ctrl: mux@4080 { compatible = "mmio-mux"; reg = <0x00004080 0x50>; #mux-control-cells = <1>; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/boot/dts/ti/k3-j721e.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/arm64/boot/dts/ti/k3-j721e.dtsi @@ -61,7 +61,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; + d-cache-sets = <128>; - d-cache-sets = <256>; next-level-cache = <&L2_0>; }; @@ -75,7 +75,7 @@ i-cache-sets = <256>; d-cache-size = <0x8000>; d-cache-line-size = <64>; + d-cache-sets = <128>; - d-cache-sets = <256>; next-level-cache = <&L2_0>; }; }; @@ -85,7 +85,7 @@ cache-level = <2>; cache-size = <0x100000>; cache-line-size = <64>; + cache-sets = <2048>; - cache-sets = <1024>; next-level-cache = <&msmc_l3>; }; reverted: --- linux-aws-5.13-5.13.0/arch/arm64/include/asm/extable.h +++ linux-aws-5.13-5.13.0.orig/arch/arm64/include/asm/extable.h @@ -22,6 +22,15 @@ #define ARCH_HAS_RELATIVE_EXTABLE +static inline bool in_bpf_jit(struct pt_regs *regs) +{ + if (!IS_ENABLED(CONFIG_BPF_JIT)) + return false; + + return regs->pc >= BPF_JIT_REGION_START && + regs->pc < BPF_JIT_REGION_END; +} + #ifdef CONFIG_BPF_JIT int arm64_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs); reverted: --- linux-aws-5.13-5.13.0/arch/arm64/include/asm/memory.h +++ linux-aws-5.13-5.13.0.orig/arch/arm64/include/asm/memory.h @@ -44,8 +44,11 @@ #define _PAGE_OFFSET(va) (-(UL(1) << (va))) #define PAGE_OFFSET (_PAGE_OFFSET(VA_BITS)) #define KIMAGE_VADDR (MODULES_END) +#define BPF_JIT_REGION_START (_PAGE_END(VA_BITS_MIN)) +#define BPF_JIT_REGION_SIZE (SZ_128M) +#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE) #define MODULES_END (MODULES_VADDR + MODULES_VSIZE) +#define MODULES_VADDR (BPF_JIT_REGION_END) -#define MODULES_VADDR (_PAGE_END(VA_BITS_MIN)) #define MODULES_VSIZE (SZ_128M) #define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT))) #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) diff -u linux-aws-5.13-5.13.0/arch/arm64/kernel/process.c linux-aws-5.13-5.13.0/arch/arm64/kernel/process.c --- linux-aws-5.13-5.13.0/arch/arm64/kernel/process.c +++ linux-aws-5.13-5.13.0/arch/arm64/kernel/process.c @@ -497,26 +497,34 @@ /* * ARM erratum 1418040 handling, affecting the 32bit view of CNTVCT. - * Ensure access is disabled when switching to a 32bit task, ensure - * access is enabled when switching to a 64bit task. + * Assuming the virtual counter is enabled at the beginning of times: + * + * - disable access when switching from a 64bit task to a 32bit task + * - enable access when switching from a 32bit task to a 64bit task */ -static void erratum_1418040_thread_switch(struct task_struct *next) +static void erratum_1418040_thread_switch(struct task_struct *prev, + struct task_struct *next) { - if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) || - !this_cpu_has_cap(ARM64_WORKAROUND_1418040)) + bool prev32, next32; + u64 val; + + if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) + return; + + prev32 = is_compat_thread(task_thread_info(prev)); + next32 = is_compat_thread(task_thread_info(next)); + + if (prev32 == next32 || !this_cpu_has_cap(ARM64_WORKAROUND_1418040)) return; - if (is_compat_thread(task_thread_info(next))) - sysreg_clear_set(cntkctl_el1, ARCH_TIMER_USR_VCT_ACCESS_EN, 0); + val = read_sysreg(cntkctl_el1); + + if (!next32) + val |= ARCH_TIMER_USR_VCT_ACCESS_EN; else - sysreg_clear_set(cntkctl_el1, 0, ARCH_TIMER_USR_VCT_ACCESS_EN); -} + val &= ~ARCH_TIMER_USR_VCT_ACCESS_EN; -static void erratum_1418040_new_exec(void) -{ - preempt_disable(); - erratum_1418040_thread_switch(current); - preempt_enable(); + write_sysreg(val, cntkctl_el1); } static void update_sctlr_el1(u64 sctlr) @@ -558,7 +566,7 @@ contextidr_thread_switch(next); entry_task_switch(next); ssbs_thread_switch(next); - erratum_1418040_thread_switch(next); + erratum_1418040_thread_switch(prev, next); ptrauth_thread_switch_user(next); /* @@ -629,7 +637,6 @@ ptrauth_thread_init_user(); mte_thread_init_user(); - erratum_1418040_new_exec(); if (task_spec_ssb_noexec(current)) { arch_prctl_spec_ctrl_set(current, PR_SPEC_STORE_BYPASS, reverted: --- linux-aws-5.13-5.13.0/arch/arm64/kernel/traps.c +++ linux-aws-5.13-5.13.0.orig/arch/arm64/kernel/traps.c @@ -923,7 +923,7 @@ static int reserved_fault_handler(struct pt_regs *regs, unsigned int esr) { pr_err("%s generated an invalid instruction at %pS!\n", + in_bpf_jit(regs) ? "BPF JIT" : "Kernel text patching", - "Kernel text patching", (void *)instruction_pointer(regs)); /* We cannot handle this */ reverted: --- linux-aws-5.13-5.13.0/arch/arm64/kvm/hyp/exception.c +++ linux-aws-5.13-5.13.0.orig/arch/arm64/kvm/hyp/exception.c @@ -38,10 +38,7 @@ static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, u64 val) { + write_sysreg_el1(val, SYS_SPSR); - if (has_vhe()) - write_sysreg_el1(val, SYS_SPSR); - else - __vcpu_sys_reg(vcpu, SPSR_EL1) = val; } static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val) reverted: --- linux-aws-5.13-5.13.0/arch/arm64/lib/clear_page.S +++ linux-aws-5.13-5.13.0.orig/arch/arm64/lib/clear_page.S @@ -16,7 +16,6 @@ */ SYM_FUNC_START_PI(clear_page) mrs x1, dczid_el0 - tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */ and w1, w1, #0xf mov x2, #4 lsl x1, x2, x1 @@ -26,14 +25,5 @@ tst x0, #(PAGE_SIZE - 1) b.ne 1b ret - -2: stnp xzr, xzr, [x0] - stnp xzr, xzr, [x0, #16] - stnp xzr, xzr, [x0, #32] - stnp xzr, xzr, [x0, #48] - add x0, x0, #64 - tst x0, #(PAGE_SIZE - 1) - b.ne 2b - ret SYM_FUNC_END_PI(clear_page) EXPORT_SYMBOL(clear_page) reverted: --- linux-aws-5.13-5.13.0/arch/arm64/mm/extable.c +++ linux-aws-5.13-5.13.0.orig/arch/arm64/mm/extable.c @@ -9,19 +9,14 @@ int fixup_exception(struct pt_regs *regs) { const struct exception_table_entry *fixup; - unsigned long addr; + fixup = search_exception_tables(instruction_pointer(regs)); + if (!fixup) + return 0; - addr = instruction_pointer(regs); + if (in_bpf_jit(regs)) - /* Search the BPF tables first, these are formatted differently */ - fixup = search_bpf_extables(addr); - if (fixup) return arm64_bpf_fixup_exception(fixup, regs); - fixup = search_exception_tables(addr); - if (!fixup) - return 0; - regs->pc = (unsigned long)&fixup->fixup + fixup->fixup; return 1; } reverted: --- linux-aws-5.13-5.13.0/arch/arm64/mm/ptdump.c +++ linux-aws-5.13-5.13.0.orig/arch/arm64/mm/ptdump.c @@ -41,6 +41,8 @@ { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif + { BPF_JIT_REGION_START, "BPF start" }, + { BPF_JIT_REGION_END, "BPF end" }, { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() area" }, diff -u linux-aws-5.13-5.13.0/arch/arm64/net/bpf_jit_comp.c linux-aws-5.13-5.13.0/arch/arm64/net/bpf_jit_comp.c --- linux-aws-5.13-5.13.0/arch/arm64/net/bpf_jit_comp.c +++ linux-aws-5.13-5.13.0/arch/arm64/net/bpf_jit_comp.c @@ -1144,12 +1144,15 @@ u64 bpf_jit_alloc_exec_limit(void) { - return VMALLOC_END - VMALLOC_START; + return BPF_JIT_REGION_SIZE; } void *bpf_jit_alloc_exec(unsigned long size) { - return vmalloc(size); + return __vmalloc_node_range(size, PAGE_SIZE, BPF_JIT_REGION_START, + BPF_JIT_REGION_END, GFP_KERNEL, + PAGE_KERNEL, 0, NUMA_NO_NODE, + __builtin_return_address(0)); } void bpf_jit_free_exec(void *addr) reverted: --- linux-aws-5.13-5.13.0/arch/ia64/pci/fixup.c +++ linux-aws-5.13-5.13.0.orig/arch/ia64/pci/fixup.c @@ -76,5 +76,5 @@ } } } +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); -DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); diff -u linux-aws-5.13-5.13.0/arch/mips/Kconfig linux-aws-5.13-5.13.0/arch/mips/Kconfig --- linux-aws-5.13-5.13.0/arch/mips/Kconfig +++ linux-aws-5.13-5.13.0/arch/mips/Kconfig @@ -2026,10 +2026,6 @@ config SYS_HAS_CPU_MIPS64_R2 bool -config SYS_HAS_CPU_MIPS64_R5 - bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT - config SYS_HAS_CPU_MIPS64_R6 bool select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT @@ -2194,7 +2190,7 @@ bool config CPU_SUPPORTS_HUGEPAGES bool - depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA)) + depends on !(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA)) config MIPS_PGD_C0_CONTEXT bool depends on 64BIT diff -u linux-aws-5.13-5.13.0/arch/mips/bcm63xx/clk.c linux-aws-5.13-5.13.0/arch/mips/bcm63xx/clk.c --- linux-aws-5.13-5.13.0/arch/mips/bcm63xx/clk.c +++ linux-aws-5.13-5.13.0/arch/mips/bcm63xx/clk.c @@ -387,12 +387,6 @@ } EXPORT_SYMBOL(clk_get_parent); -int clk_set_parent(struct clk *clk, struct clk *parent) -{ - return 0; -} -EXPORT_SYMBOL(clk_set_parent); - unsigned long clk_get_rate(struct clk *clk) { if (!clk) reverted: --- linux-aws-5.13-5.13.0/arch/mips/cavium-octeon/octeon-platform.c +++ linux-aws-5.13-5.13.0.orig/arch/mips/cavium-octeon/octeon-platform.c @@ -328,7 +328,6 @@ pd->dev.platform_data = &octeon_ehci_pdata; octeon_ehci_hw_start(&pd->dev); - put_device(&pd->dev); return ret; } @@ -392,7 +391,6 @@ pd->dev.platform_data = &octeon_ohci_pdata; octeon_ohci_hw_start(&pd->dev); - put_device(&pd->dev); return ret; } reverted: --- linux-aws-5.13-5.13.0/arch/mips/cavium-octeon/octeon-usb.c +++ linux-aws-5.13-5.13.0.orig/arch/mips/cavium-octeon/octeon-usb.c @@ -544,7 +544,6 @@ devm_iounmap(&pdev->dev, base); devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); - put_device(&pdev->dev); } } while (node != NULL); reverted: --- linux-aws-5.13-5.13.0/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h +++ linux-aws-5.13-5.13.0.orig/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h @@ -32,7 +32,7 @@ nop /* Loongson-3A R2/R3 */ andi t0, (PRID_IMP_MASK | PRID_REV_MASK) + slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) - slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) bnez t0, 2f nop 1: @@ -63,7 +63,7 @@ nop /* Loongson-3A R2/R3 */ andi t0, (PRID_IMP_MASK | PRID_REV_MASK) + slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) - slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) bnez t0, 2f nop 1: reverted: --- linux-aws-5.13-5.13.0/arch/mips/include/asm/octeon/cvmx-bootinfo.h +++ linux-aws-5.13-5.13.0.orig/arch/mips/include/asm/octeon/cvmx-bootinfo.h @@ -318,7 +318,7 @@ /* Functions to return string based on type */ #define ENUM_BRD_TYPE_CASE(x) \ + case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ - case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum type) { @@ -410,7 +410,7 @@ } #define ENUM_CHIP_TYPE_CASE(x) \ + case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ - case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ static inline const char *cvmx_chip_type_to_string(enum cvmx_chip_types_enum type) { diff -u linux-aws-5.13-5.13.0/arch/mips/lantiq/clk.c linux-aws-5.13-5.13.0/arch/mips/lantiq/clk.c --- linux-aws-5.13-5.13.0/arch/mips/lantiq/clk.c +++ linux-aws-5.13-5.13.0/arch/mips/lantiq/clk.c @@ -164,12 +164,6 @@ } EXPORT_SYMBOL(clk_get_parent); -int clk_set_parent(struct clk *clk, struct clk *parent) -{ - return 0; -} -EXPORT_SYMBOL(clk_set_parent); - static inline u32 get_counter_resolution(void) { u32 res; reverted: --- linux-aws-5.13-5.13.0/arch/mips/loongson64/vbios_quirk.c +++ linux-aws-5.13-5.13.0.orig/arch/mips/loongson64/vbios_quirk.c @@ -3,7 +3,7 @@ #include #include +static void pci_fixup_radeon(struct pci_dev *pdev) -static void pci_fixup_video(struct pci_dev *pdev) { struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; @@ -22,7 +22,8 @@ res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | IORESOURCE_PCI_FIXED; + dev_info(&pdev->dev, "BAR %d: assigned %pR for Radeon ROM\n", + PCI_ROM_RESOURCE, res); - dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", res); } +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, 0x9615, + PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_radeon); -DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, 0x9615, - PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); reverted: --- linux-aws-5.13-5.13.0/arch/openrisc/include/asm/syscalls.h +++ linux-aws-5.13-5.13.0.orig/arch/openrisc/include/asm/syscalls.h @@ -22,11 +22,9 @@ asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, int tls); -asmlinkage long __sys_clone3(struct clone_args __user *uargs, size_t size); asmlinkage long __sys_fork(void); #define sys_clone __sys_clone -#define sys_clone3 __sys_clone3 #define sys_fork __sys_fork #endif /* __ASM_OPENRISC_SYSCALLS_H */ diff -u linux-aws-5.13-5.13.0/arch/openrisc/kernel/entry.S linux-aws-5.13-5.13.0/arch/openrisc/kernel/entry.S --- linux-aws-5.13-5.13.0/arch/openrisc/kernel/entry.S +++ linux-aws-5.13-5.13.0/arch/openrisc/kernel/entry.S @@ -1170,11 +1170,6 @@ l.j _fork_save_extra_regs_and_call l.nop -ENTRY(__sys_clone3) - l.movhi r29,hi(sys_clone3) - l.j _fork_save_extra_regs_and_call - l.ori r29,r29,lo(sys_clone3) - ENTRY(__sys_fork) l.movhi r29,hi(sys_fork) l.ori r29,r29,lo(sys_fork) reverted: --- linux-aws-5.13-5.13.0/arch/parisc/include/asm/special_insns.h +++ linux-aws-5.13-5.13.0.orig/arch/parisc/include/asm/special_insns.h @@ -2,32 +2,28 @@ #ifndef __PARISC_SPECIAL_INSNS_H #define __PARISC_SPECIAL_INSNS_H +#define lpa(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n\t" \ + "lpa %%r0(%1),%0" \ + : "=r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ -#define lpa(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n" \ - "8:\tlpa %%r0(%1),%0\n" \ - "9:\n" \ - ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ - : "=&r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ }) +#define lpa_user(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n\t" \ + "lpa %%r0(%%sr3,%1),%0" \ + : "=r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ -#define lpa_user(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n" \ - "8:\tlpa %%r0(%%sr3,%1),%0\n" \ - "9:\n" \ - ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ - : "=&r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ }) #define mfctl(reg) ({ \ diff -u linux-aws-5.13-5.13.0/arch/parisc/kernel/traps.c linux-aws-5.13-5.13.0/arch/parisc/kernel/traps.c --- linux-aws-5.13-5.13.0/arch/parisc/kernel/traps.c +++ linux-aws-5.13-5.13.0/arch/parisc/kernel/traps.c @@ -784,7 +784,7 @@ * unless pagefault_disable() was called before. */ - if (faulthandler_disabled() || fault_space == 0) + if (fault_space == 0 && !faulthandler_disabled()) { /* Clean up and return if in exception table. */ if (fixup_exception(regs)) reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi @@ -79,7 +79,6 @@ #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfc000 0x1000>; - fsl,erratum-a009885; }; xmdio0: mdio@fd000 { @@ -87,7 +86,6 @@ #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfd000 0x1000>; - fsl,erratum-a009885; }; }; diff -u linux-aws-5.13-5.13.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h linux-aws-5.13-5.13.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h --- linux-aws-5.13-5.13.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h +++ linux-aws-5.13-5.13.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h @@ -129,8 +129,6 @@ UPDATE_TWO_USER_SEGMENTS(14); } -int __init find_free_bat(void); -unsigned int bat_block_size(unsigned long base, unsigned long top); #endif /* !__ASSEMBLY__ */ /* We happily ignore the smaller BATs on 601, we don't actually use reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/include/asm/hw_irq.h +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/include/asm/hw_irq.h @@ -215,42 +215,6 @@ return arch_irqs_disabled_flags(arch_local_save_flags()); } -static inline void set_pmi_irq_pending(void) -{ - /* - * Invoked from PMU callback functions to set PMI bit in the paca. - * This has to be called with irq's disabled (via hard_irq_disable()). - */ - if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) - WARN_ON_ONCE(mfmsr() & MSR_EE); - - get_paca()->irq_happened |= PACA_IRQ_PMI; -} - -static inline void clear_pmi_irq_pending(void) -{ - /* - * Invoked from PMU callback functions to clear the pending PMI bit - * in the paca. - */ - if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) - WARN_ON_ONCE(mfmsr() & MSR_EE); - - get_paca()->irq_happened &= ~PACA_IRQ_PMI; -} - -static inline bool pmi_irq_pending(void) -{ - /* - * Invoked from PMU callback functions to check if there is a pending - * PMI bit in the paca. - */ - if (get_paca()->irq_happened & PACA_IRQ_PMI) - return true; - - return false; -} - #ifdef CONFIG_PPC_BOOK3S /* * To support disabling and enabling of irq with PMI, set of @@ -427,10 +391,6 @@ static inline void may_hard_irq_enable(void) { } -static inline void clear_pmi_irq_pending(void) { } -static inline void set_pmi_irq_pending(void) { } -static inline bool pmi_irq_pending(void) { return false; } - static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsigned long val) { } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/include/asm/ppc-opcode.h +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/include/asm/ppc-opcode.h @@ -468,7 +468,6 @@ #define PPC_RAW_LDX(r, base, b) (0x7c00002a | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) #define PPC_RAW_LHZ(r, base, i) (0xa0000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i)) #define PPC_RAW_LHBRX(r, base, b) (0x7c00062c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) -#define PPC_RAW_LWBRX(r, base, b) (0x7c00042c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) #define PPC_RAW_LDBRX(r, base, b) (0x7c000428 | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) #define PPC_RAW_STWCX(s, a, b) (0x7c00012d | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) #define PPC_RAW_CMPWI(a, i) (0x2c000000 | ___PPC_RA(a) | IMM_L(i)) diff -u linux-aws-5.13-5.13.0/arch/powerpc/kernel/Makefile linux-aws-5.13-5.13.0/arch/powerpc/kernel/Makefile --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/Makefile +++ linux-aws-5.13-5.13.0/arch/powerpc/kernel/Makefile @@ -11,7 +11,6 @@ CFLAGS_btext.o += -fPIC endif -CFLAGS_early_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/btext.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/kernel/btext.c @@ -241,10 +241,8 @@ rc = btext_initialize(np); printk("result: %d\n", rc); } + if (rc == 0) - if (rc == 0) { - of_node_put(np); break; - } } return rc; } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/fadump.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/kernel/fadump.c @@ -1641,14 +1641,6 @@ else if (fw_dump.reserve_dump_area_size) fw_dump.ops->fadump_init_mem_struct(&fw_dump); - /* - * In case of panic, fadump is triggered via ppc_panic_event() - * panic notifier. Setting crash_kexec_post_notifiers to 'true' - * lets panic() function take crash friendly path before panic - * notifiers are invoked. - */ - crash_kexec_post_notifiers = true; - return 1; } subsys_initcall(setup_fadump); reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/head_40x.S +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/kernel/head_40x.S @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -651,7 +650,7 @@ b . /* prevent prefetch past rfi */ /* Set up the initial MMU state so we can do the first level of + * kernel initialization. This maps the first 16 MBytes of memory 1:1 - * kernel initialization. This maps the first 32 MBytes of memory 1:1 * virtual to physical and more importantly sets the cache mode. */ initial_mmu: @@ -688,12 +687,6 @@ tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */ tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */ - li r0,62 /* TLB slot 62 */ - addis r4,r4,SZ_16M@h - addis r3,r3,SZ_16M@h - tlbwe r4,r0,TLB_DATA /* Load the data portion of the entry */ - tlbwe r3,r0,TLB_TAG /* Load the tag portion of the entry */ - isync /* Establish the exception vector base reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/prom_init.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/kernel/prom_init.c @@ -2957,7 +2957,7 @@ /* Check if the phy-handle property exists - bail if it does */ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); + if (!rv) - if (rv <= 0) return; /* diff -u linux-aws-5.13-5.13.0/arch/powerpc/kernel/smp.c linux-aws-5.13-5.13.0/arch/powerpc/kernel/smp.c --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/smp.c +++ linux-aws-5.13-5.13.0/arch/powerpc/kernel/smp.c @@ -61,7 +61,6 @@ #include #include #include -#include #ifdef DEBUG #include @@ -615,45 +614,6 @@ #endif #ifdef CONFIG_NMI_IPI -static void crash_stop_this_cpu(struct pt_regs *regs) -#else -static void crash_stop_this_cpu(void *dummy) -#endif -{ - /* - * Just busy wait here and avoid marking CPU as offline to ensure - * register data is captured appropriately. - */ - while (1) - cpu_relax(); -} - -void crash_smp_send_stop(void) -{ - static bool stopped = false; - - /* - * In case of fadump, register data for all CPUs is captured by f/w - * on ibm,os-term rtas call. Skip IPI callbacks to other CPUs before - * this rtas call to avoid tricky post processing of those CPUs' - * backtraces. - */ - if (should_fadump_crash()) - return; - - if (stopped) - return; - - stopped = true; - -#ifdef CONFIG_NMI_IPI - smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); -#else - smp_call_function(crash_stop_this_cpu, NULL, 0); -#endif /* CONFIG_NMI_IPI */ -} - -#ifdef CONFIG_NMI_IPI static void nmi_stop_this_cpu(struct pt_regs *regs) { /* @@ -1649,12 +1609,10 @@ BUG(); } -#ifdef CONFIG_PROFILING int setup_profiling_timer(unsigned int multiplier) { return 0; } -#endif static void fixup_topology(void) { reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/kernel/watchdog.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/kernel/watchdog.c @@ -134,10 +134,6 @@ { cpumask_or(&wd_smp_cpus_stuck, &wd_smp_cpus_stuck, cpumask); cpumask_andnot(&wd_smp_cpus_pending, &wd_smp_cpus_pending, cpumask); - /* - * See wd_smp_clear_cpu_pending() - */ - smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb = tb; cpumask_andnot(&wd_smp_cpus_pending, @@ -223,44 +219,13 @@ cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); wd_smp_unlock(&flags); - } else { - /* - * The last CPU to clear pending should have reset the - * watchdog so we generally should not find it empty - * here if our CPU was clear. However it could happen - * due to a rare race with another CPU taking the - * last CPU out of the mask concurrently. - * - * We can't add a warning for it. But just in case - * there is a problem with the watchdog that is causing - * the mask to not be reset, try to kick it along here. - */ - if (unlikely(cpumask_empty(&wd_smp_cpus_pending))) - goto none_pending; } return; } - cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); - - /* - * Order the store to clear pending with the load(s) to check all - * words in the pending mask to check they are all empty. This orders - * with the same barrier on another CPU. This prevents two CPUs - * clearing the last 2 pending bits, but neither seeing the other's - * store when checking if the mask is empty, and missing an empty - * mask, which ends with a false positive. - */ - smp_mb(); if (cpumask_empty(&wd_smp_cpus_pending)) { unsigned long flags; -none_pending: - /* - * Double check under lock because more than one CPU could see - * a clear mask with the lockless check after clearing their - * pending bits. - */ wd_smp_lock(&flags); if (cpumask_empty(&wd_smp_cpus_pending)) { wd_smp_last_reset_tb = tb; @@ -351,12 +316,8 @@ { unsigned long ticks = tb_ticks_per_usec * wd_timer_period_ms * 1000; int cpu = smp_processor_id(); + u64 tb = get_tb(); - u64 tb; - if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) - return; - - tb = get_tb(); if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { per_cpu(wd_timer_tb, cpu) = tb; wd_smp_clear_cpu_pending(cpu, tb); diff -u linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv.c linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv.c --- linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv.c +++ linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv.c @@ -4645,12 +4645,8 @@ unsigned long npages = mem->memory_size >> PAGE_SHIFT; if (change == KVM_MR_CREATE) { - unsigned long size = array_size(npages, sizeof(*slot->arch.rmap)); - - if ((size >> PAGE_SHIFT) > totalram_pages()) - return -ENOMEM; - - slot->arch.rmap = vzalloc(size); + slot->arch.rmap = vzalloc(array_size(npages, + sizeof(*slot->arch.rmap))); if (!slot->arch.rmap) return -ENOMEM; } diff -u linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv_nested.c linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv_nested.c --- linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv_nested.c +++ linux-aws-5.13-5.13.0/arch/powerpc/kvm/book3s_hv_nested.c @@ -575,7 +575,7 @@ if (eaddr & (0xFFFUL << 52)) return H_PARAMETER; - buf = kzalloc(n, GFP_KERNEL | __GFP_NOWARN); + buf = kzalloc(n, GFP_KERNEL); if (!buf) return H_NO_MEM; reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/lib/Makefile +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/lib/Makefile @@ -19,9 +19,6 @@ CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING endif -CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) -CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - obj-y += alloc.o code-patching.o feature-fixups.o pmem.o test_code-patching.o ifndef CONFIG_KASAN diff -u linux-aws-5.13-5.13.0/arch/powerpc/mm/book3s32/mmu.c linux-aws-5.13-5.13.0/arch/powerpc/mm/book3s32/mmu.c --- linux-aws-5.13-5.13.0/arch/powerpc/mm/book3s32/mmu.c +++ linux-aws-5.13-5.13.0/arch/powerpc/mm/book3s32/mmu.c @@ -76,7 +76,7 @@ return 0; } -int __init find_free_bat(void) +static int find_free_bat(void) { int b; int n = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; @@ -100,7 +100,7 @@ * - block size has to be a power of two. This is calculated by finding the * highest bit set to 1. */ -unsigned int bat_block_size(unsigned long base, unsigned long top) +static unsigned int block_size(unsigned long base, unsigned long top) { unsigned int max_size = SZ_256M; unsigned int base_shift = (ffs(base) - 1) & 31; @@ -145,7 +145,7 @@ int idx; while ((idx = find_free_bat()) != -1 && base != top) { - unsigned int size = bat_block_size(base, top); + unsigned int size = block_size(base, top); if (size < 128 << 10) break; @@ -196,17 +196,18 @@ int nb = mmu_has_feature(MMU_FTR_USE_HIGH_BATS) ? 8 : 4; int i; unsigned long base = (unsigned long)_stext - PAGE_OFFSET; - unsigned long top = ALIGN((unsigned long)_etext - PAGE_OFFSET, SZ_128K); + unsigned long top = (unsigned long)_etext - PAGE_OFFSET; unsigned long border = (unsigned long)__init_begin - PAGE_OFFSET; unsigned long size; - for (i = 0; i < nb - 1 && base < top;) { - size = bat_block_size(base, top); + for (i = 0; i < nb - 1 && base < top && top - base > (128 << 10);) { + size = block_size(base, top); setibat(i++, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); base += size; } if (base < top) { - size = bat_block_size(base, top); + size = block_size(base, top); + size = max(size, 128UL << 10); if ((top - base) > size) { size <<= 1; if (strict_kernel_rwx_enabled() && base + size > border) reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/mm/book3s64/radix_pgtable.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -1097,7 +1097,7 @@ int pud_clear_huge(pud_t *pud) { + if (pud_huge(*pud)) { - if (pud_is_leaf(*pud)) { pud_clear(pud); return 1; } @@ -1144,7 +1144,7 @@ int pmd_clear_huge(pmd_t *pmd) { + if (pmd_huge(*pmd)) { - if (pmd_is_leaf(*pmd)) { pmd_clear(pmd); return 1; } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/mm/kasan/book3s_32.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/mm/kasan/book3s_32.c @@ -10,51 +10,47 @@ { unsigned long k_start = (unsigned long)kasan_mem_to_shadow(start); unsigned long k_end = (unsigned long)kasan_mem_to_shadow(start + size); + unsigned long k_cur = k_start; + int k_size = k_end - k_start; + int k_size_base = 1 << (ffs(k_size) - 1); - unsigned long k_nobat = k_start; - unsigned long k_cur; - phys_addr_t phys; int ret; + void *block; + block = memblock_alloc(k_size, k_size_base); - while (k_nobat < k_end) { - unsigned int k_size = bat_block_size(k_nobat, k_end); - int idx = find_free_bat(); - - if (idx == -1) - break; - if (k_size < SZ_128K) - break; - phys = memblock_phys_alloc_range(k_size, k_size, 0, - MEMBLOCK_ALLOC_ANYWHERE); - if (!phys) - break; + if (block && k_size_base >= SZ_128K && k_start == ALIGN(k_start, k_size_base)) { + int k_size_more = 1 << (ffs(k_size - k_size_base) - 1); + + setbat(-1, k_start, __pa(block), k_size_base, PAGE_KERNEL); + if (k_size_more >= SZ_128K) + setbat(-1, k_start + k_size_base, __pa(block) + k_size_base, + k_size_more, PAGE_KERNEL); + if (v_block_mapped(k_start)) + k_cur = k_start + k_size_base; + if (v_block_mapped(k_start + k_size_base)) + k_cur = k_start + k_size_base + k_size_more; + + update_bats(); - setbat(idx, k_nobat, phys, k_size, PAGE_KERNEL); - k_nobat += k_size; } - if (k_nobat != k_start) - update_bats(); + if (!block) + block = memblock_alloc(k_size, PAGE_SIZE); + if (!block) + return -ENOMEM; - if (k_nobat < k_end) { - phys = memblock_phys_alloc_range(k_end - k_nobat, PAGE_SIZE, 0, - MEMBLOCK_ALLOC_ANYWHERE); - if (!phys) - return -ENOMEM; - } ret = kasan_init_shadow_page_tables(k_start, k_end); if (ret) return ret; + kasan_update_early_region(k_start, k_cur, __pte(0)); - kasan_update_early_region(k_start, k_nobat, __pte(0)); + for (; k_cur < k_end; k_cur += PAGE_SIZE) { - for (k_cur = k_nobat; k_cur < k_end; k_cur += PAGE_SIZE) { pmd_t *pmd = pmd_off_k(k_cur); + void *va = block + k_cur - k_start; + pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL); - pte_t pte = pfn_pte(PHYS_PFN(phys + k_cur - k_nobat), PAGE_KERNEL); __set_pte_at(&init_mm, k_cur, pte_offset_kernel(pmd, k_cur), pte, 0); } flush_tlb_kernel_range(k_start, k_end); - memset(kasan_mem_to_shadow(start), 0, k_end - k_start); - return 0; } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/mm/pgtable_64.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/mm/pgtable_64.c @@ -102,8 +102,7 @@ struct page *p4d_page(p4d_t p4d) { if (p4d_is_leaf(p4d)) { + VM_WARN_ON(!p4d_huge(p4d)); - if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) - VM_WARN_ON(!p4d_huge(p4d)); return pte_page(p4d_pte(p4d)); } return virt_to_page(p4d_page_vaddr(p4d)); @@ -113,8 +112,7 @@ struct page *pud_page(pud_t pud) { if (pud_is_leaf(pud)) { + VM_WARN_ON(!pud_huge(pud)); - if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) - VM_WARN_ON(!pud_huge(pud)); return pte_page(pud_pte(pud)); } return virt_to_page(pud_page_vaddr(pud)); @@ -127,13 +125,7 @@ struct page *pmd_page(pmd_t pmd) { if (pmd_is_leaf(pmd)) { + VM_WARN_ON(!(pmd_large(pmd) || pmd_huge(pmd))); - /* - * vmalloc_to_page may be called on any vmap address (not only - * vmalloc), and it uses pmd_page() etc., when huge vmap is - * enabled so these checks can't be used. - */ - if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) - VM_WARN_ON(!(pmd_large(pmd) || pmd_huge(pmd))); return pte_page(pmd_pte(pmd)); } return virt_to_page(pmd_page_vaddr(pmd)); diff -u linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp.c linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp.c --- linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp.c +++ linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp.c @@ -23,15 +23,15 @@ memset32(area, BREAKPOINT_INSTRUCTION, size / 4); } -/* Fix updated addresses (for subprog calls, ldimm64, et al) during extra pass */ -static int bpf_jit_fixup_addresses(struct bpf_prog *fp, u32 *image, - struct codegen_context *ctx, u32 *addrs) +/* Fix the branch target addresses for subprog calls */ +static int bpf_jit_fixup_subprog_calls(struct bpf_prog *fp, u32 *image, + struct codegen_context *ctx, u32 *addrs) { const struct bpf_insn *insn = fp->insnsi; bool func_addr_fixed; u64 func_addr; u32 tmp_idx; - int i, j, ret; + int i, ret; for (i = 0; i < fp->len; i++) { /* @@ -66,23 +66,6 @@ * of the JITed sequence remains unchanged. */ ctx->idx = tmp_idx; - } else if (insn[i].code == (BPF_LD | BPF_IMM | BPF_DW)) { - tmp_idx = ctx->idx; - ctx->idx = addrs[i] / 4; -#ifdef CONFIG_PPC32 - PPC_LI32(ctx->b2p[insn[i].dst_reg] - 1, (u32)insn[i + 1].imm); - PPC_LI32(ctx->b2p[insn[i].dst_reg], (u32)insn[i].imm); - for (j = ctx->idx - addrs[i] / 4; j < 4; j++) - EMIT(PPC_RAW_NOP()); -#else - func_addr = ((u64)(u32)insn[i].imm) | (((u64)(u32)insn[i + 1].imm) << 32); - PPC_LI64(b2p[insn[i].dst_reg], func_addr); - /* overwrite rest with nops */ - for (j = ctx->idx - addrs[i] / 4; j < 5; j++) - EMIT(PPC_RAW_NOP()); -#endif - ctx->idx = tmp_idx; - i++; } } @@ -210,13 +193,13 @@ /* * Do not touch the prologue and epilogue as they will remain * unchanged. Only fix the branch target address for subprog - * calls in the body, and ldimm64 instructions. + * calls in the body. * * This does not change the offsets and lengths of the subprog * call instruction sequences and hence, the size of the JITed * image as well. */ - bpf_jit_fixup_addresses(fp, code_base, &cgctx, addrs); + bpf_jit_fixup_subprog_calls(fp, code_base, &cgctx, addrs); /* There is no need to perform the usual passes. */ goto skip_codegen_passes; diff -u linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp32.c linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp32.c --- linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp32.c +++ linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp32.c @@ -191,9 +191,6 @@ if (image && rel < 0x2000000 && rel >= -0x2000000) { PPC_BL_ABS(func); - EMIT(PPC_RAW_NOP()); - EMIT(PPC_RAW_NOP()); - EMIT(PPC_RAW_NOP()); } else { /* Load function address into r0 */ EMIT(PPC_RAW_LIS(__REG_R0, IMM_H(func))); @@ -292,8 +289,6 @@ bool func_addr_fixed; u64 func_addr; u32 true_cond; - u32 tmp_idx; - int j; /* * addrs[] maps a BPF bytecode address into a real offset from @@ -841,12 +836,8 @@ * 16 byte instruction that uses two 'struct bpf_insn' */ case BPF_LD | BPF_IMM | BPF_DW: /* dst = (u64) imm */ - tmp_idx = ctx->idx; PPC_LI32(dst_reg_h, (u32)insn[i + 1].imm); PPC_LI32(dst_reg, (u32)insn[i].imm); - /* padding to allow full 4 instructions for later patching */ - for (j = ctx->idx - tmp_idx; j < 4; j++) - EMIT(PPC_RAW_NOP()); /* Adjust for two bpf instructions */ addrs[++i] = ctx->idx * 4; break; diff -u linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp64.c linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp64.c --- linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp64.c +++ linux-aws-5.13-5.13.0/arch/powerpc/net/bpf_jit_comp64.c @@ -318,7 +318,6 @@ u64 imm64; u32 true_cond; u32 tmp_idx; - int j; /* * addrs[] maps a BPF bytecode address into a real offset from @@ -633,21 +632,17 @@ EMIT(PPC_RAW_MR(dst_reg, b2p[TMP_REG_1])); break; case 64: - /* Store the value to stack and then use byte-reverse loads */ + /* + * Way easier and faster(?) to store the value + * into stack and then use ldbrx + * + * ctx->seen will be reliable in pass2, but + * the instructions generated will remain the + * same across all passes + */ PPC_BPF_STL(dst_reg, 1, bpf_jit_stack_local(ctx)); EMIT(PPC_RAW_ADDI(b2p[TMP_REG_1], 1, bpf_jit_stack_local(ctx))); - if (cpu_has_feature(CPU_FTR_ARCH_206)) { - EMIT(PPC_RAW_LDBRX(dst_reg, 0, b2p[TMP_REG_1])); - } else { - EMIT(PPC_RAW_LWBRX(dst_reg, 0, b2p[TMP_REG_1])); - if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) - EMIT(PPC_RAW_SLDI(dst_reg, dst_reg, 32)); - EMIT(PPC_RAW_LI(b2p[TMP_REG_2], 4)); - EMIT(PPC_RAW_LWBRX(b2p[TMP_REG_2], b2p[TMP_REG_2], b2p[TMP_REG_1])); - if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) - EMIT(PPC_RAW_SLDI(b2p[TMP_REG_2], b2p[TMP_REG_2], 32)); - EMIT(PPC_RAW_OR(dst_reg, dst_reg, b2p[TMP_REG_2])); - } + EMIT(PPC_RAW_LDBRX(dst_reg, 0, b2p[TMP_REG_1])); break; } break; @@ -812,13 +807,9 @@ case BPF_LD | BPF_IMM | BPF_DW: /* dst = (u64) imm */ imm64 = ((u64)(u32) insn[i].imm) | (((u64)(u32) insn[i+1].imm) << 32); - tmp_idx = ctx->idx; - PPC_LI64(dst_reg, imm64); - /* padding to allow full 5 instructions for later patching */ - for (j = ctx->idx - tmp_idx; j < 5; j++) - EMIT(PPC_RAW_NOP()); /* Adjust for two bpf instructions */ addrs[++i] = ctx->idx * 4; + PPC_LI64(dst_reg, imm64); break; /* diff -u linux-aws-5.13-5.13.0/arch/powerpc/perf/core-book3s.c linux-aws-5.13-5.13.0/arch/powerpc/perf/core-book3s.c --- linux-aws-5.13-5.13.0/arch/powerpc/perf/core-book3s.c +++ linux-aws-5.13-5.13.0/arch/powerpc/perf/core-book3s.c @@ -848,19 +848,6 @@ } } -static int any_pmc_overflown(struct cpu_hw_events *cpuhw) -{ - int i, idx; - - for (i = 0; i < cpuhw->n_events; i++) { - idx = cpuhw->event[i]->hw.idx; - if ((idx) && ((int)read_pmc(idx) < 0)) - return idx; - } - - return 0; -} - /* Called from sysrq_handle_showregs() */ void perf_event_print_debug(void) { @@ -1285,13 +1272,11 @@ /* * Set the 'freeze counters' bit, clear EBE/BHRBA/PMCC/PMAO/FC56 - * Also clear PMXE to disable PMI's getting triggered in some - * corner cases during PMU disable. */ val = mmcr0 = mfspr(SPRN_MMCR0); val |= MMCR0_FC; val &= ~(MMCR0_EBE | MMCR0_BHRBA | MMCR0_PMCC | MMCR0_PMAO | - MMCR0_PMXE | MMCR0_FC56); + MMCR0_FC56); /* Set mmcr0 PMCCEXT for p10 */ if (ppmu->flags & PPMU_ARCH_31) val |= MMCR0_PMCCEXT; @@ -1305,34 +1290,6 @@ mb(); isync(); - /* - * Some corner cases could clear the PMU counter overflow - * while a masked PMI is pending. One such case is when - * a PMI happens during interrupt replay and perf counter - * values are cleared by PMU callbacks before replay. - * - * If any PMC corresponding to the active PMU events are - * overflown, disable the interrupt by clearing the paca - * bit for PMI since we are disabling the PMU now. - * Otherwise provide a warning if there is PMI pending, but - * no counter is found overflown. - */ - if (any_pmc_overflown(cpuhw)) { - /* - * Since power_pmu_disable runs under local_irq_save, it - * could happen that code hits a PMC overflow without PMI - * pending in paca. Hence only clear PMI pending if it was - * set. - * - * If a PMI is pending, then MSR[EE] must be disabled (because - * the masked PMI handler disabling EE). So it is safe to - * call clear_pmi_irq_pending(). - */ - if (pmi_irq_pending()) - clear_pmi_irq_pending(); - } else - WARN_ON(pmi_irq_pending()); - val = mmcra = cpuhw->mmcr.mmcra; /* @@ -1424,15 +1381,6 @@ * (possibly updated for removal of events). */ if (!cpuhw->n_added) { - /* - * If there is any active event with an overflown PMC - * value, set back PACA_IRQ_PMI which would have been - * cleared in power_pmu_disable(). - */ - hard_irq_disable(); - if (any_pmc_overflown(cpuhw)) - set_pmi_irq_pending(); - mtspr(SPRN_MMCRA, cpuhw->mmcr.mmcra & ~MMCRA_SAMPLE_ENABLE); mtspr(SPRN_MMCR1, cpuhw->mmcr.mmcr1); if (ppmu->flags & PPMU_ARCH_31) @@ -2380,14 +2328,6 @@ break; } } - - /* - * Clear PACA_IRQ_PMI in case it was set by - * set_pmi_irq_pending() when PMU was enabled - * after accounting for interrupts. - */ - clear_pmi_irq_pending(); - if (!active) /* reset non active counters that have overflowed */ write_pmc(i + 1, 0); @@ -2407,13 +2347,6 @@ } } } - - /* - * During system wide profling or while specific CPU is monitored for an - * event, some corner cases could cause PMC to overflow in idle path. This - * will trigger a PMI after waking up from idle. Since counter values are _not_ - * saved/restored in idle path, can lead to below "Can't find PMC" message. - */ if (unlikely(!found) && !arch_irq_disabled_regs(regs)) printk_ratelimited(KERN_WARNING "Can't find PMC that caused IRQ\n"); reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/platforms/cell/iommu.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/platforms/cell/iommu.c @@ -977,7 +977,6 @@ if (hbase < dbase || (hend > (dbase + dsize))) { pr_debug("iommu: hash window doesn't fit in" "real DMA window\n"); - of_node_put(np); return -1; } } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/platforms/cell/pervasive.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/platforms/cell/pervasive.c @@ -78,7 +78,6 @@ switch (regs->msr & SRR1_WAKEMASK) { case SRR1_WAKEDEC: set_dec(1); - break; case SRR1_WAKEEE: /* * Handle these when interrupts get re-enabled and we take reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/platforms/embedded6xx/hlwd-pic.c @@ -215,7 +215,6 @@ irq_set_chained_handler(cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host = host; - of_node_put(np); break; } } reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/platforms/powermac/low_i2c.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/platforms/powermac/low_i2c.c @@ -582,7 +582,6 @@ bus->close = kw_i2c_close; bus->xfer = kw_i2c_xfer; mutex_init(&bus->mutex); - lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); if (controller == busnode) bus->flags = pmac_i2c_multibus; @@ -811,7 +810,6 @@ bus->hostdata = bus + 1; bus->xfer = pmu_i2c_xfer; mutex_init(&bus->mutex); - lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags = pmac_i2c_multibus; list_add(&bus->link, &pmac_i2c_busses); @@ -935,7 +933,6 @@ bus->hostdata = bus + 1; bus->xfer = smu_i2c_xfer; mutex_init(&bus->mutex); - lockdep_register_key(&bus->lock_key); lockdep_set_class(&bus->mutex, &bus->lock_key); bus->flags = 0; list_add(&bus->link, &pmac_i2c_busses); reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/platforms/powernv/opal-lpc.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/platforms/powernv/opal-lpc.c @@ -396,7 +396,6 @@ if (!of_get_property(np, "primary", NULL)) continue; opal_lpc_chip_id = of_get_ibm_chip_id(np); - of_node_put(np); break; } if (opal_lpc_chip_id < 0) reverted: --- linux-aws-5.13-5.13.0/arch/powerpc/sysdev/xive/spapr.c +++ linux-aws-5.13-5.13.0.orig/arch/powerpc/sysdev/xive/spapr.c @@ -653,9 +653,6 @@ struct xive_irq_bitmap *xibm; char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); - if (!buf) - return -ENOMEM; - list_for_each_entry(xibm, &xive_irq_bitmaps, list) { memset(buf, 0, PAGE_SIZE); bitmap_print_to_pagebuf(true, buf, xibm->bitmap, xibm->count); diff -u linux-aws-5.13-5.13.0/arch/riscv/Kconfig linux-aws-5.13-5.13.0/arch/riscv/Kconfig --- linux-aws-5.13-5.13.0/arch/riscv/Kconfig +++ linux-aws-5.13-5.13.0/arch/riscv/Kconfig @@ -149,9 +149,10 @@ config PAGE_OFFSET hex - default 0xC0000000 if 32BIT + default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB default 0x80000000 if 64BIT && !MMU - default 0xffffffe000000000 if 64BIT + default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB + default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB config KASAN_SHADOW_OFFSET hex @@ -263,6 +264,24 @@ bool select HAVE_MOD_ARCH_SPECIFIC +choice + prompt "Maximum Physical Memory" + default MAXPHYSMEM_1GB if 32BIT + default MAXPHYSMEM_2GB if 64BIT && CMODEL_MEDLOW + default MAXPHYSMEM_128GB if 64BIT && CMODEL_MEDANY + + config MAXPHYSMEM_1GB + depends on 32BIT + bool "1GiB" + config MAXPHYSMEM_2GB + depends on 64BIT && CMODEL_MEDLOW + bool "2GiB" + config MAXPHYSMEM_128GB + depends on 64BIT && CMODEL_MEDANY + bool "128GiB" +endchoice + + config SMP bool "Symmetric Multi-Processing" help diff -u linux-aws-5.13-5.13.0/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi linux-aws-5.13-5.13.0/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi --- linux-aws-5.13-5.13.0/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +++ linux-aws-5.13-5.13.0/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi @@ -10,4 +10,7 @@ compatible = "microchip,mpfs"; + chosen { + }; + cpus { #address-cells = <1>; reverted: --- linux-aws-5.13-5.13.0/arch/riscv/configs/nommu_k210_defconfig +++ linux-aws-5.13-5.13.0.orig/arch/riscv/configs/nommu_k210_defconfig @@ -29,6 +29,8 @@ CONFIG_SLOB=y # CONFIG_MMU is not set CONFIG_SOC_CANAAN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="k210_generic" +CONFIG_MAXPHYSMEM_2GB=y CONFIG_SMP=y CONFIG_NR_CPUS=2 CONFIG_CMDLINE="earlycon console=ttySIF0" reverted: --- linux-aws-5.13-5.13.0/arch/riscv/configs/nommu_k210_sdcard_defconfig +++ linux-aws-5.13-5.13.0.orig/arch/riscv/configs/nommu_k210_sdcard_defconfig @@ -21,6 +21,8 @@ CONFIG_SLOB=y # CONFIG_MMU is not set CONFIG_SOC_CANAAN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="k210_generic" +CONFIG_MAXPHYSMEM_2GB=y CONFIG_SMP=y CONFIG_NR_CPUS=2 CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro" reverted: --- linux-aws-5.13-5.13.0/arch/riscv/configs/nommu_virt_defconfig +++ linux-aws-5.13-5.13.0.orig/arch/riscv/configs/nommu_virt_defconfig @@ -27,6 +27,7 @@ # CONFIG_SLAB_MERGE_DEFAULT is not set # CONFIG_MMU is not set CONFIG_SOC_VIRT=y +CONFIG_MAXPHYSMEM_2GB=y CONFIG_SMP=y CONFIG_CMDLINE="root=/dev/vda rw earlycon=uart8250,mmio,0x10000000,115200n8 console=ttyS0" CONFIG_CMDLINE_FORCE=y reverted: --- linux-aws-5.13-5.13.0/arch/riscv/include/asm/smp.h +++ linux-aws-5.13-5.13.0.orig/arch/riscv/include/asm/smp.h @@ -43,6 +43,7 @@ void arch_send_call_function_single_ipi(int cpu); int riscv_hartid_to_cpuid(int hartid); +void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out); /* Set custom IPI operations */ void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops); @@ -84,6 +85,13 @@ return boot_cpu_hartid; } +static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in, + struct cpumask *out) +{ + cpumask_clear(out); + cpumask_set_cpu(boot_cpu_hartid, out); +} + static inline void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops) { } @@ -94,8 +102,6 @@ #endif /* CONFIG_SMP */ -void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out); - #if defined(CONFIG_HOTPLUG_CPU) && (CONFIG_SMP) bool cpu_has_hotplug(unsigned int cpu); #else reverted: --- linux-aws-5.13-5.13.0/arch/riscv/kernel/kexec_relocate.S +++ linux-aws-5.13-5.13.0.orig/arch/riscv/kernel/kexec_relocate.S @@ -159,15 +159,25 @@ * s0: (const) Phys address to jump to * s1: (const) Phys address of the FDT image * s2: (const) The hartid of the current hart + * s3: (const) va_pa_offset, used when switching MMU off */ mv s0, a1 mv s1, a2 mv s2, a3 + mv s3, a4 /* Disable / cleanup interrupts */ csrw CSR_SIE, zero csrw CSR_SIP, zero + /* Switch to physical addressing */ + la s4, 1f + sub s4, s4, s3 + csrw CSR_STVEC, s4 + csrw CSR_SATP, zero + +.align 2 +1: /* Pass the arguments to the next kernel / Cleanup*/ mv a0, s2 mv a1, s1 @@ -204,15 +214,7 @@ csrw CSR_SCAUSE, zero csrw CSR_SSCRATCH, zero + jalr zero, a2, 0 - /* - * Switch to physical addressing - * This will also trigger a jump to CSR_STVEC - * which in this case is the address of the new - * kernel. - */ - csrw CSR_STVEC, a2 - csrw CSR_SATP, zero - SYM_CODE_END(riscv_kexec_norelocate) .section ".rodata" reverted: --- linux-aws-5.13-5.13.0/arch/riscv/kernel/machine_kexec.c +++ linux-aws-5.13-5.13.0.orig/arch/riscv/kernel/machine_kexec.c @@ -169,8 +169,7 @@ struct kimage_arch *internal = &image->arch; unsigned long jump_addr = (unsigned long) image->start; unsigned long first_ind_entry = (unsigned long) &image->head; + unsigned long this_hart_id = raw_smp_processor_id(); - unsigned long this_cpu_id = smp_processor_id(); - unsigned long this_hart_id = cpuid_to_hartid_map(this_cpu_id); unsigned long fdt_addr = internal->fdt_addr; void *control_code_buffer = page_address(image->control_code_page); riscv_kexec_method kexec_method = NULL; diff -u linux-aws-5.13-5.13.0/arch/riscv/kernel/setup.c linux-aws-5.13-5.13.0/arch/riscv/kernel/setup.c --- linux-aws-5.13-5.13.0/arch/riscv/kernel/setup.c +++ linux-aws-5.13-5.13.0/arch/riscv/kernel/setup.c @@ -60,16 +60,6 @@ unsigned long boot_cpu_hartid; static DEFINE_PER_CPU(struct cpu, cpu_devices); -void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out) -{ - int cpu; - - cpumask_clear(out); - for_each_cpu(cpu, in) - cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); -} -EXPORT_SYMBOL_GPL(riscv_cpuid_to_hartid_mask); - /* * Place kernel memory regions on the resource tree so that * kexec-tools can retrieve them from /proc/iomem. While there reverted: --- linux-aws-5.13-5.13.0/arch/riscv/kernel/smp.c +++ linux-aws-5.13-5.13.0.orig/arch/riscv/kernel/smp.c @@ -59,6 +59,16 @@ return -ENOENT; } +void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out) +{ + int cpu; + + cpumask_clear(out); + for_each_cpu(cpu, in) + cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); +} +EXPORT_SYMBOL_GPL(riscv_cpuid_to_hartid_mask); + bool arch_match_cpu_phys_id(int cpu, u64 phys_id) { return phys_id == cpuid_to_hartid_map(cpu); diff -u linux-aws-5.13-5.13.0/arch/riscv/mm/init.c linux-aws-5.13-5.13.0/arch/riscv/mm/init.c --- linux-aws-5.13-5.13.0/arch/riscv/mm/init.c +++ linux-aws-5.13-5.13.0/arch/riscv/mm/init.c @@ -813,23 +813,14 @@ /* * Current riscv boot protocol requires 2MB alignment for * RV64 and 4MB alignment for RV32 (hugepage size) - * - * Try to alloc from 32bit addressible physical memory so that - * swiotlb can work on the crash kernel. */ - crash_base = memblock_find_in_range(search_start, - min(search_end, (unsigned long) SZ_4G), + crash_base = memblock_find_in_range(search_start, search_end, crash_size, PMD_SIZE); if (crash_base == 0) { - /* Try again without restricting region to 32bit addressible memory */ - crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE, - search_start, search_end); - if (crash_base == 0) { - pr_warn("crashkernel: couldn't allocate %lldKB\n", - crash_size >> 10); - return; - } + pr_warn("crashkernel: couldn't allocate %lldKB\n", + crash_size >> 10); + return; } } else { /* User specifies base address explicitly. */ reverted: --- linux-aws-5.13-5.13.0/arch/s390/hypfs/hypfs_vm.c +++ linux-aws-5.13-5.13.0.orig/arch/s390/hypfs/hypfs_vm.c @@ -20,7 +20,6 @@ static char local_guest[] = " "; static char all_guests[] = "* "; -static char *all_groups = all_guests; static char *guest_query; struct diag2fc_data { @@ -63,11 +62,10 @@ memcpy(parm_list.userid, query, NAME_LEN); ASCEBC(parm_list.userid, NAME_LEN); + parm_list.addr = (unsigned long) addr ; - memcpy(parm_list.aci_grp, all_groups, NAME_LEN); - ASCEBC(parm_list.aci_grp, NAME_LEN); - parm_list.addr = (unsigned long)addr; parm_list.size = size; parm_list.fmt = 0x02; + memset(parm_list.aci_grp, 0x40, NAME_LEN); rc = -1; diag_stat_inc(DIAG_STAT_X2FC); reverted: --- linux-aws-5.13-5.13.0/arch/s390/kernel/nmi.c +++ linux-aws-5.13-5.13.0.orig/arch/s390/kernel/nmi.c @@ -266,21 +266,11 @@ if (cr2.gse) { if (!mci.gs) { /* + * Guarded storage register can't be restored and + * the current processes uses guarded storage. + * It has to be terminated. - * 2 cases: - * - machine check in kernel or userspace - * - machine check while running SIE (KVM guest) - * For kernel or userspace the userspace values of - * guarded storage control can not be recreated, the - * process must be terminated. - * For SIE the guest values of guarded storage can not - * be recreated. This is either due to a bug or due to - * GS being disabled in the guest. The guest will be - * notified by KVM code and the guests machine check - * handling must take care of this. The host values - * are saved by KVM and are not affected. */ + kill_task = 1; - if (!test_cpu_flag(CIF_MCCK_GUEST)) - kill_task = 1; } } /* Check if old PSW is valid */ diff -u linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.c linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.c --- linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.c +++ linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.c @@ -2471,8 +2471,8 @@ case KVM_S390_PV_COMMAND: { struct kvm_pv_cmd args; - /* protvirt means user cpu state */ - kvm_s390_set_user_cpu_state_ctrl(kvm); + /* protvirt means user sigp */ + kvm->arch.user_cpu_state_ctrl = 1; r = 0; if (!is_prot_virt_host()) { r = -EINVAL; @@ -3762,7 +3762,7 @@ vcpu_load(vcpu); /* user space knows about this interface - let it control the state */ - kvm_s390_set_user_cpu_state_ctrl(vcpu->kvm); + vcpu->kvm->arch.user_cpu_state_ctrl = 1; switch (mp_state->mp_state) { case KVM_MP_STATE_STOPPED: diff -u linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.h linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.h --- linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.h +++ linux-aws-5.13-5.13.0/arch/s390/kvm/kvm-s390.h @@ -208,15 +208,6 @@ return kvm->arch.user_cpu_state_ctrl != 0; } -static inline void kvm_s390_set_user_cpu_state_ctrl(struct kvm *kvm) -{ - if (kvm->arch.user_cpu_state_ctrl) - return; - - VM_EVENT(kvm, 3, "%s", "ENABLE: Userspace CPU state control"); - kvm->arch.user_cpu_state_ctrl = 1; -} - /* implemented in pv.c */ int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc); int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc); diff -u linux-aws-5.13-5.13.0/arch/s390/kvm/sigp.c linux-aws-5.13-5.13.0/arch/s390/kvm/sigp.c --- linux-aws-5.13-5.13.0/arch/s390/kvm/sigp.c +++ linux-aws-5.13-5.13.0/arch/s390/kvm/sigp.c @@ -151,10 +151,22 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter, u64 *status_reg) { + unsigned int i; + struct kvm_vcpu *v; + bool all_stopped = true; + + kvm_for_each_vcpu(i, v, vcpu->kvm) { + if (v == vcpu) + continue; + if (!is_vcpu_stopped(v)) + all_stopped = false; + } + *status_reg &= 0xffffffff00000000UL; /* Reject set arch order, with czam we're always in z/Arch mode. */ - *status_reg |= SIGP_STATUS_INVALID_PARAMETER; + *status_reg |= (all_stopped ? SIGP_STATUS_INVALID_PARAMETER : + SIGP_STATUS_INCORRECT_STATE); return SIGP_CC_STATUS_STORED; } reverted: --- linux-aws-5.13-5.13.0/arch/s390/mm/pgalloc.c +++ linux-aws-5.13-5.13.0.orig/arch/s390/mm/pgalloc.c @@ -244,15 +244,13 @@ /* Free 2K page table fragment of a 4K page */ bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); spin_lock_bh(&mm->context.lock); + mask = atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); - mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); mask >>= 24; if (mask & 3) list_add(&page->lru, &mm->context.pgtable_list); else list_del(&page->lru); spin_unlock_bh(&mm->context.lock); - mask = atomic_xor_bits(&page->_refcount, 0x10U << (bit + 24)); - mask >>= 24; if (mask != 0) return; } else { diff -u linux-aws-5.13-5.13.0/arch/um/drivers/virtio_uml.c linux-aws-5.13-5.13.0/arch/um/drivers/virtio_uml.c --- linux-aws-5.13-5.13.0/arch/um/drivers/virtio_uml.c +++ linux-aws-5.13-5.13.0/arch/um/drivers/virtio_uml.c @@ -1088,8 +1088,6 @@ container_of(d, struct virtio_device, dev); struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); - time_travel_propagate_time(); - /* might not have been opened due to not negotiating the feature */ if (vu_dev->req_fd >= 0) { um_free_irq(vu_dev->irq, vu_dev); @@ -1123,8 +1121,6 @@ vu_dev->pdev = pdev; vu_dev->req_fd = -1; - time_travel_propagate_time(); - do { rc = os_connect_socket(pdata->socket_path); } while (rc == -EINTR); reverted: --- linux-aws-5.13-5.13.0/arch/um/include/asm/delay.h +++ linux-aws-5.13-5.13.0.orig/arch/um/include/asm/delay.h @@ -14,7 +14,7 @@ ndelay(nsecs); } #undef ndelay +#define ndelay um_ndelay -#define ndelay(n) um_ndelay(n) static inline void um_udelay(unsigned long usecs) { @@ -26,5 +26,5 @@ udelay(usecs); } #undef udelay +#define udelay um_udelay -#define udelay(n) um_udelay(n) #endif /* __UM_DELAY_H */ reverted: --- linux-aws-5.13-5.13.0/arch/um/include/shared/registers.h +++ linux-aws-5.13-5.13.0.orig/arch/um/include/shared/registers.h @@ -16,8 +16,8 @@ extern int save_fpx_registers(int pid, unsigned long *fp_regs); extern int restore_fpx_registers(int pid, unsigned long *fp_regs); extern int save_registers(int pid, struct uml_pt_regs *regs); +extern int restore_registers(int pid, struct uml_pt_regs *regs); +extern int init_registers(int pid); -extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); -extern int init_pid_registers(int pid); extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); extern unsigned long get_thread_reg(int reg, jmp_buf *buf); extern int get_fp_registers(int pid, unsigned long *regs); reverted: --- linux-aws-5.13-5.13.0/arch/um/os-Linux/registers.c +++ linux-aws-5.13-5.13.0.orig/arch/um/os-Linux/registers.c @@ -21,7 +21,7 @@ return 0; } +int restore_registers(int pid, struct uml_pt_regs *regs) -int restore_pid_registers(int pid, struct uml_pt_regs *regs) { int err; @@ -36,7 +36,7 @@ static unsigned long exec_regs[MAX_REG_NR]; static unsigned long exec_fp_regs[FP_SIZE]; +int init_registers(int pid) -int init_pid_registers(int pid) { int err; reverted: --- linux-aws-5.13-5.13.0/arch/um/os-Linux/start_up.c +++ linux-aws-5.13-5.13.0.orig/arch/um/os-Linux/start_up.c @@ -336,7 +336,7 @@ check_tmpexec(); pid = start_ptraced_child(); + if (init_registers(pid)) - if (init_pid_registers(pid)) fatal("Failed to initialize default registers"); stop_ptraced_child(pid, 1, 1); } reverted: --- linux-aws-5.13-5.13.0/arch/x86/boot/compressed/Makefile +++ linux-aws-5.13-5.13.0.orig/arch/x86/boot/compressed/Makefile @@ -28,11 +28,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst +KBUILD_CFLAGS := -m$(BITS) -O2 -# CLANG_FLAGS must come before any cc-disable-warning or cc-option calls in -# case of cross compiling, as it has the '--target=' flag, which is needed to -# avoid errors with '-march=i386', and future flags may depend on the target to -# be valid. -KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) KBUILD_CFLAGS += -fno-strict-aliasing -fPIE KBUILD_CFLAGS += -Wundef KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING @@ -51,6 +47,7 @@ # Disable relocation relaxation in case the link is not PIE. KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h +KBUILD_CFLAGS += $(CLANG_FLAGS) # sev.c indirectly inludes inat-table.h which is generated during # compilation and stored in $(objtree). Add the directory to the includes so reverted: --- linux-aws-5.13-5.13.0/arch/x86/configs/i386_defconfig +++ linux-aws-5.13-5.13.0.orig/arch/x86/configs/i386_defconfig @@ -263,4 +263,3 @@ CONFIG_PROVIDE_OHCI1394_DMA_INIT=y CONFIG_EARLY_PRINTK_DBGP=y CONFIG_DEBUG_BOOT_PARAMS=y -CONFIG_KALLSYMS_ALL=y reverted: --- linux-aws-5.13-5.13.0/arch/x86/configs/x86_64_defconfig +++ linux-aws-5.13-5.13.0.orig/arch/x86/configs/x86_64_defconfig @@ -259,4 +259,3 @@ CONFIG_PROVIDE_OHCI1394_DMA_INIT=y CONFIG_EARLY_PRINTK_DBGP=y CONFIG_DEBUG_BOOT_PARAMS=y -CONFIG_KALLSYMS_ALL=y diff -u linux-aws-5.13-5.13.0/arch/x86/crypto/aesni-intel_glue.c linux-aws-5.13-5.13.0/arch/x86/crypto/aesni-intel_glue.c --- linux-aws-5.13-5.13.0/arch/x86/crypto/aesni-intel_glue.c +++ linux-aws-5.13-5.13.0/arch/x86/crypto/aesni-intel_glue.c @@ -1107,7 +1107,7 @@ .cra_flags = CRYPTO_ALG_INTERNAL, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct aesni_rfc4106_gcm_ctx), - .cra_alignmask = 0, + .cra_alignmask = AESNI_ALIGN - 1, .cra_module = THIS_MODULE, }, }, { @@ -1124,7 +1124,7 @@ .cra_flags = CRYPTO_ALG_INTERNAL, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct generic_gcmaes_ctx), - .cra_alignmask = 0, + .cra_alignmask = AESNI_ALIGN - 1, .cra_module = THIS_MODULE, }, } }; diff -u linux-aws-5.13-5.13.0/arch/x86/events/intel/core.c linux-aws-5.13-5.13.0/arch/x86/events/intel/core.c --- linux-aws-5.13-5.13.0/arch/x86/events/intel/core.c +++ linux-aws-5.13-5.13.0/arch/x86/events/intel/core.c @@ -6181,19 +6181,6 @@ pmu->num_counters = x86_pmu.num_counters; pmu->num_counters_fixed = x86_pmu.num_counters_fixed; } - - /* - * Quirk: For some Alder Lake machine, when all E-cores are disabled in - * a BIOS, the leaf 0xA will enumerate all counters of P-cores. However, - * the X86_FEATURE_HYBRID_CPU is still set. The above codes will - * mistakenly add extra counters for P-cores. Correct the number of - * counters here. - */ - if ((pmu->num_counters > 8) || (pmu->num_counters_fixed > 4)) { - pmu->num_counters = x86_pmu.num_counters; - pmu->num_counters_fixed = x86_pmu.num_counters_fixed; - } - pmu->max_pebs_events = min_t(unsigned, MAX_PEBS_EVENTS, pmu->num_counters); pmu->unconstrained = (struct event_constraint) __EVENT_CONSTRAINT(0, (1ULL << pmu->num_counters) - 1, diff -u linux-aws-5.13-5.13.0/arch/x86/events/intel/uncore_snbep.c linux-aws-5.13-5.13.0/arch/x86/events/intel/uncore_snbep.c --- linux-aws-5.13-5.13.0/arch/x86/events/intel/uncore_snbep.c +++ linux-aws-5.13-5.13.0/arch/x86/events/intel/uncore_snbep.c @@ -5279,7 +5279,7 @@ .fixed_ctr_bits = 48, .fixed_ctr = SNR_IMC_MMIO_PMON_FIXED_CTR, .fixed_ctl = SNR_IMC_MMIO_PMON_FIXED_CTL, - .event_descs = snr_uncore_imc_events, + .event_descs = hswep_uncore_imc_events, .perf_ctr = SNR_IMC_MMIO_PMON_CTR0, .event_ctl = SNR_IMC_MMIO_PMON_CTL0, .event_mask = SNBEP_PMON_RAW_EVENT_MASK, reverted: --- linux-aws-5.13-5.13.0/arch/x86/include/asm/realmode.h +++ linux-aws-5.13-5.13.0.orig/arch/x86/include/asm/realmode.h @@ -89,7 +89,6 @@ } void reserve_real_mode(void); -void load_trampoline_pgtable(void); #endif /* __ASSEMBLY__ */ reverted: --- linux-aws-5.13-5.13.0/arch/x86/include/asm/topology.h +++ linux-aws-5.13-5.13.0.orig/arch/x86/include/asm/topology.h @@ -218,7 +218,7 @@ } #endif +#ifdef CONFIG_ACPI_CPPC_LIB -#if defined(CONFIG_ACPI_CPPC_LIB) && defined(CONFIG_SMP) void init_freq_invariance_cppc(void); #define init_freq_invariance_cppc init_freq_invariance_cppc #endif diff -u linux-aws-5.13-5.13.0/arch/x86/include/asm/uaccess.h linux-aws-5.13-5.13.0/arch/x86/include/asm/uaccess.h --- linux-aws-5.13-5.13.0/arch/x86/include/asm/uaccess.h +++ linux-aws-5.13-5.13.0/arch/x86/include/asm/uaccess.h @@ -314,12 +314,11 @@ do { \ __chk_user_ptr(ptr); \ switch (size) { \ - case 1: { \ - unsigned char x_u8__; \ + unsigned char x_u8__; \ + case 1: \ __get_user_asm(x_u8__, ptr, "b", "=q", label); \ (x) = x_u8__; \ break; \ - } \ case 2: \ __get_user_asm(x, ptr, "w", "=r", label); \ break; \ reverted: --- linux-aws-5.13-5.13.0/arch/x86/kernel/acpi/sleep.c +++ linux-aws-5.13-5.13.0.orig/arch/x86/kernel/acpi/sleep.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include "../../realmode/rm/wakeup.h" @@ -140,10 +139,8 @@ if (strncmp(str, "s3_beep", 7) == 0) acpi_realmode_flags |= 4; #ifdef CONFIG_HIBERNATION - if (strncmp(str, "s4_hwsig", 8) == 0) - acpi_check_s4_hw_signature = 1; if (strncmp(str, "s4_nohwsig", 10) == 0) + acpi_no_s4_hw_signature(); - acpi_check_s4_hw_signature = 0; #endif if (strncmp(str, "nonvs", 5) == 0) acpi_nvs_nosave(); @@ -161,21 +158,3 @@ } __setup("acpi_sleep=", acpi_sleep_setup); - -#if defined(CONFIG_HIBERNATION) && defined(CONFIG_HYPERVISOR_GUEST) -static int __init init_s4_sigcheck(void) -{ - /* - * If running on a hypervisor, honour the ACPI specification - * by default and trigger a clean reboot when the hardware - * signature in FACS is changed after hibernation. - */ - if (acpi_check_s4_hw_signature == -1 && - !hypervisor_is_type(X86_HYPER_NATIVE)) - acpi_check_s4_hw_signature = 1; - - return 0; -} -/* This must happen before acpi_init() which is a subsys initcall */ -arch_initcall(init_s4_sigcheck); -#endif reverted: --- linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/amd.c +++ linux-aws-5.13-5.13.0.orig/arch/x86/kernel/cpu/mce/amd.c @@ -387,7 +387,7 @@ u32 hi, lo; /* sysfs write might race against an offline operation */ + if (this_cpu_read(threshold_banks)) - if (!this_cpu_read(threshold_banks) && !tr->set_lvt_off) return; rdmsr(tr->b->address, lo, hi); diff -u linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/core.c linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/core.c --- linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/core.c +++ linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/core.c @@ -295,17 +295,11 @@ panic("Panicing machine check CPU died"); } -static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) +static void mce_panic(const char *msg, struct mce *final, char *exp) { + int apei_err = 0; struct llist_node *pending; struct mce_evt_llist *l; - int apei_err = 0; - - /* - * Allow instrumentation around external facilities usage. Not that it - * matters a whole lot since the machine is going to panic anyway. - */ - instrumentation_begin(); if (!fake_panic) { /* @@ -320,7 +314,7 @@ } else { /* Don't log too much for fake panic */ if (atomic_inc_return(&mce_fake_panicked) > 1) - goto out; + return; } pending = mce_gen_pool_prepare_records(); /* First print corrected ones that are still unlogged */ @@ -358,9 +352,6 @@ panic(msg); } else pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); - -out: - instrumentation_end(); } /* Support code for software error injection */ @@ -691,7 +682,7 @@ /* * Read ADDR and MISC registers. */ -static noinstr void mce_read_aux(struct mce *m, int i) +static void mce_read_aux(struct mce *m, int i) { if (m->status & MCI_STATUS_MISCV) m->misc = mce_rdmsrl(msr_ops.misc(i)); @@ -1081,13 +1072,10 @@ * Synchronize between CPUs after main scanning loop. * This invokes the bulk of the Monarch processing. */ -static noinstr int mce_end(int order) +static int mce_end(int order) { - u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; int ret = -1; - - /* Allow instrumentation around external facilities. */ - instrumentation_begin(); + u64 timeout = (u64)mca_cfg.monarch_timeout * NSEC_PER_USEC; if (!timeout) goto reset; @@ -1131,8 +1119,7 @@ /* * Don't reset anything. That's done by the Monarch. */ - ret = 0; - goto out; + return 0; } /* @@ -1148,10 +1135,6 @@ * Let others run again. */ atomic_set(&mce_executing, 0); - -out: - instrumentation_end(); - return ret; } @@ -1462,14 +1445,6 @@ if (worst != MCE_AR_SEVERITY && !kill_current_task) goto out; - /* - * Enable instrumentation around the external facilities like - * task_work_add() (via queue_task_work()), fixup_exception() etc. - * For now, that is. Fixing this properly would need a lot more involved - * reorganization. - */ - instrumentation_begin(); - /* Fault was in user mode and we need to take some action */ if ((m.cs & 3) == 3) { /* If this triggers there is no way to recover. Die hard. */ @@ -1495,9 +1470,6 @@ if (m.kflags & MCE_IN_KERNEL_COPYIN) queue_task_work(&m, msg, kill_current_task); } - - instrumentation_end(); - out: mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } reverted: --- linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/inject.c +++ linux-aws-5.13-5.13.0.orig/arch/x86/kernel/cpu/mce/inject.c @@ -350,7 +350,7 @@ char buf[MAX_FLAG_OPT_SIZE], *__buf; int err; + if (cnt > MAX_FLAG_OPT_SIZE) - if (!cnt || cnt > MAX_FLAG_OPT_SIZE) return -EINVAL; if (copy_from_user(&buf, ubuf, cnt)) diff -u linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/intel.c linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/intel.c --- linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/intel.c +++ linux-aws-5.13-5.13.0/arch/x86/kernel/cpu/mce/intel.c @@ -486,7 +486,6 @@ case INTEL_FAM6_BROADWELL_X: case INTEL_FAM6_SKYLAKE_X: case INTEL_FAM6_ICELAKE_X: - case INTEL_FAM6_ICELAKE_D: case INTEL_FAM6_SAPPHIRERAPIDS_X: case INTEL_FAM6_XEON_PHI_KNL: case INTEL_FAM6_XEON_PHI_KNM: diff -u linux-aws-5.13-5.13.0/arch/x86/kernel/early-quirks.c linux-aws-5.13-5.13.0/arch/x86/kernel/early-quirks.c --- linux-aws-5.13-5.13.0/arch/x86/kernel/early-quirks.c +++ linux-aws-5.13-5.13.0/arch/x86/kernel/early-quirks.c @@ -546,7 +546,6 @@ .stolen_size = gen9_stolen_size, }; -/* Intel integrated GPUs for which we need to reserve "stolen memory" */ static const struct pci_device_id intel_early_ids[] __initconst = { INTEL_I830_IDS(&i830_early_ops), INTEL_I845G_IDS(&i845_early_ops), @@ -622,13 +621,6 @@ u16 device; int i; - /* - * Reserve "stolen memory" for an integrated GPU. If we've already - * found one, there's nothing to do for other (discrete) GPUs. - */ - if (resource_size(&intel_graphics_stolen_res)) - return; - device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) { @@ -741,7 +733,7 @@ { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, - 0, intel_graphics_quirks }, + QFLAG_APPLY_ONCE, intel_graphics_quirks }, /* * HPET on the current version of the Baytrail platform has accuracy * problems: it will halt in deep idle state - so we disable it. diff -u linux-aws-5.13-5.13.0/arch/x86/kernel/reboot.c linux-aws-5.13-5.13.0/arch/x86/kernel/reboot.c --- linux-aws-5.13-5.13.0/arch/x86/kernel/reboot.c +++ linux-aws-5.13-5.13.0/arch/x86/kernel/reboot.c @@ -114,9 +114,17 @@ spin_unlock(&rtc_lock); /* - * Switch to the trampoline page table. + * Switch back to the initial page table. */ - load_trampoline_pgtable(); +#ifdef CONFIG_X86_32 + load_cr3(initial_page_table); +#else + write_cr3(real_mode_header->trampoline_pgd); + + /* Exiting long mode will fail if CR4.PCIDE is set. */ + if (boot_cpu_has(X86_FEATURE_PCID)) + cr4_clear_bits(X86_CR4_PCIDE); +#endif /* Jump to the identity-mapped low memory code */ #ifdef CONFIG_X86_32 diff -u linux-aws-5.13-5.13.0/arch/x86/kernel/tsc.c linux-aws-5.13-5.13.0/arch/x86/kernel/tsc.c --- linux-aws-5.13-5.13.0/arch/x86/kernel/tsc.c +++ linux-aws-5.13-5.13.0/arch/x86/kernel/tsc.c @@ -1130,7 +1130,6 @@ static struct clocksource clocksource_tsc_early = { .name = "tsc-early", .rating = 299, - .uncertainty_margin = 32 * NSEC_PER_MSEC, .read = read_tsc, .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS | diff -u linux-aws-5.13-5.13.0/arch/x86/kvm/mmu/tdp_mmu.c linux-aws-5.13-5.13.0/arch/x86/kvm/mmu/tdp_mmu.c --- linux-aws-5.13-5.13.0/arch/x86/kvm/mmu/tdp_mmu.c +++ linux-aws-5.13-5.13.0/arch/x86/kvm/mmu/tdp_mmu.c @@ -1488,12 +1488,12 @@ rcu_read_lock(); tdp_root_for_each_leaf_pte(iter, root, gfn, gfn + 1) { + if (!is_writable_pte(iter.old_spte)) + break; + new_spte = iter.old_spte & ~(PT_WRITABLE_MASK | shadow_mmu_writable_mask); - if (new_spte == iter.old_spte) - break; - tdp_mmu_set_spte(kvm, &iter, new_spte); spte_set = true; } diff -u linux-aws-5.13-5.13.0/arch/x86/kvm/svm/svm.c linux-aws-5.13-5.13.0/arch/x86/kvm/svm/svm.c --- linux-aws-5.13-5.13.0/arch/x86/kvm/svm/svm.c +++ linux-aws-5.13-5.13.0/arch/x86/kvm/svm/svm.c @@ -4343,13 +4343,8 @@ bool smep, smap, is_user; unsigned long cr4; - /* Emulation is always possible when KVM has access to all guest state. */ - if (!sev_guest(vcpu->kvm)) - return true; - /* - * Emulation is impossible for SEV-ES guests as KVM doesn't have access - * to guest register state. + * When the guest is an SEV-ES guest, emulation is not possible. */ if (sev_es_guest(vcpu->kvm)) return false; @@ -4397,11 +4392,21 @@ if (likely(!insn || insn_len)) return true; + /* + * If RIP is invalid, go ahead with emulation which will cause an + * internal error exit. + */ + if (!kvm_vcpu_gfn_to_memslot(vcpu, kvm_rip_read(vcpu) >> PAGE_SHIFT)) + return true; + cr4 = kvm_read_cr4(vcpu); smep = cr4 & X86_CR4_SMEP; smap = cr4 & X86_CR4_SMAP; is_user = svm_get_cpl(vcpu) == 3; if (smap && (!smep || is_user)) { + if (!sev_guest(vcpu->kvm)) + return true; + pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); } diff -u linux-aws-5.13-5.13.0/arch/x86/kvm/vmx/posted_intr.c linux-aws-5.13-5.13.0/arch/x86/kvm/vmx/posted_intr.c --- linux-aws-5.13-5.13.0/arch/x86/kvm/vmx/posted_intr.c +++ linux-aws-5.13-5.13.0/arch/x86/kvm/vmx/posted_intr.c @@ -15,7 +15,7 @@ * can find which vCPU should be waken up. */ static DEFINE_PER_CPU(struct list_head, blocked_vcpu_on_cpu); -static DEFINE_PER_CPU(raw_spinlock_t, blocked_vcpu_on_cpu_lock); +static DEFINE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock); static inline struct pi_desc *vcpu_to_pi_desc(struct kvm_vcpu *vcpu) { @@ -121,9 +121,9 @@ new.control) != old.control); if (!WARN_ON_ONCE(vcpu->pre_pcpu == -1)) { - raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); list_del(&vcpu->blocked_vcpu_list); - raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); vcpu->pre_pcpu = -1; } } @@ -154,11 +154,11 @@ local_irq_disable(); if (!WARN_ON_ONCE(vcpu->pre_pcpu != -1)) { vcpu->pre_pcpu = vcpu->cpu; - raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); list_add_tail(&vcpu->blocked_vcpu_list, &per_cpu(blocked_vcpu_on_cpu, vcpu->pre_pcpu)); - raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); + spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->pre_pcpu)); } do { @@ -215,7 +215,7 @@ struct kvm_vcpu *vcpu; int cpu = smp_processor_id(); - raw_spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); list_for_each_entry(vcpu, &per_cpu(blocked_vcpu_on_cpu, cpu), blocked_vcpu_list) { struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); @@ -223,13 +223,13 @@ if (pi_test_on(pi_desc) == 1) kvm_vcpu_kick(vcpu); } - raw_spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); } void __init pi_init_cpu(int cpu) { INIT_LIST_HEAD(&per_cpu(blocked_vcpu_on_cpu, cpu)); - raw_spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); + spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); } bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) diff -u linux-aws-5.13-5.13.0/arch/x86/kvm/x86.c linux-aws-5.13-5.13.0/arch/x86/kvm/x86.c --- linux-aws-5.13-5.13.0/arch/x86/kvm/x86.c +++ linux-aws-5.13-5.13.0/arch/x86/kvm/x86.c @@ -3343,7 +3343,6 @@ if (data & ~supported_xss) return 1; vcpu->arch.ia32_xss = data; - kvm_update_cpuid_runtime(vcpu); break; case MSR_SMI_COUNT: if (!msr_info->host_initiated) @@ -10635,14 +10634,15 @@ vcpu->arch.msr_misc_features_enables = 0; - __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP); - __kvm_set_msr(vcpu, MSR_IA32_XSS, 0, true); + vcpu->arch.xcr0 = XFEATURE_MASK_FP; } memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); vcpu->arch.regs_avail = ~0; vcpu->arch.regs_dirty = ~0; + vcpu->arch.ia32_xss = 0; + static_call(kvm_x86_vcpu_reset)(vcpu, init_event); vcpu->arch.cr3 = 0; reverted: --- linux-aws-5.13-5.13.0/arch/x86/pci/fixup.c +++ linux-aws-5.13-5.13.0.orig/arch/x86/pci/fixup.c @@ -353,8 +353,8 @@ } } } +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); -DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); static const struct dmi_system_id msi_k8t_dmi_table[] = { diff -u linux-aws-5.13-5.13.0/arch/x86/realmode/init.c linux-aws-5.13-5.13.0/arch/x86/realmode/init.c --- linux-aws-5.13-5.13.0/arch/x86/realmode/init.c +++ linux-aws-5.13-5.13.0/arch/x86/realmode/init.c @@ -17,32 +17,6 @@ /* Hold the pgd entry used on booting additional CPUs */ pgd_t trampoline_pgd_entry; -void load_trampoline_pgtable(void) -{ -#ifdef CONFIG_X86_32 - load_cr3(initial_page_table); -#else - /* - * This function is called before exiting to real-mode and that will - * fail with CR4.PCIDE still set. - */ - if (boot_cpu_has(X86_FEATURE_PCID)) - cr4_clear_bits(X86_CR4_PCIDE); - - write_cr3(real_mode_header->trampoline_pgd); -#endif - - /* - * The CR3 write above will not flush global TLB entries. - * Stale, global entries from previous page tables may still be - * present. Flush those stale entries. - * - * This ensures that memory accessed while running with - * trampoline_pgd is *actually* mapped into trampoline_pgd. - */ - __flush_tlb_all(); -} - void __init reserve_real_mode(void) { phys_addr_t mem; reverted: --- linux-aws-5.13-5.13.0/arch/x86/um/syscalls_64.c +++ linux-aws-5.13-5.13.0.orig/arch/x86/um/syscalls_64.c @@ -11,7 +11,6 @@ #include #include /* XXX This should get the constants from libc */ #include -#include long arch_prctl(struct task_struct *task, int option, unsigned long __user *arg2) @@ -36,7 +35,7 @@ switch (option) { case ARCH_SET_FS: case ARCH_SET_GS: + ret = restore_registers(pid, ¤t->thread.regs.regs); - ret = restore_pid_registers(pid, ¤t->thread.regs.regs); if (ret) return ret; break; diff -u linux-aws-5.13-5.13.0/block/bfq-iosched.c linux-aws-5.13-5.13.0/block/bfq-iosched.c --- linux-aws-5.13-5.13.0/block/bfq-iosched.c +++ linux-aws-5.13-5.13.0/block/bfq-iosched.c @@ -5951,7 +5951,48 @@ spin_lock_irq(&bfqd->lock); bfqq = bfq_init_rq(rq); - if (!bfqq || at_head) { + + /* + * Reqs with at_head or passthrough flags set are to be put + * directly into dispatch list. Additional case for putting rq + * directly into the dispatch queue: the only active + * bfq_queues are bfqq and either its waker bfq_queue or one + * of its woken bfq_queues. The rationale behind this + * additional condition is as follows: + * - consider a bfq_queue, say Q1, detected as a waker of + * another bfq_queue, say Q2 + * - by definition of a waker, Q1 blocks the I/O of Q2, i.e., + * some I/O of Q1 needs to be completed for new I/O of Q2 + * to arrive. A notable example of waker is journald + * - so, Q1 and Q2 are in any respect the queues of two + * cooperating processes (or of two cooperating sets of + * processes): the goal of Q1's I/O is doing what needs to + * be done so that new Q2's I/O can finally be + * issued. Therefore, if the service of Q1's I/O is delayed, + * then Q2's I/O is delayed too. Conversely, if Q2's I/O is + * delayed, the goal of Q1's I/O is hindered. + * - as a consequence, if some I/O of Q1/Q2 arrives while + * Q2/Q1 is the only queue in service, there is absolutely + * no point in delaying the service of such an I/O. The + * only possible result is a throughput loss + * - so, when the above condition holds, the best option is to + * have the new I/O dispatched as soon as possible + * - the most effective and efficient way to attain the above + * goal is to put the new I/O directly in the dispatch + * list + * - as an additional restriction, Q1 and Q2 must be the only + * busy queues for this commit to put the I/O of Q2/Q1 in + * the dispatch list. This is necessary, because, if also + * other queues are waiting for service, then putting new + * I/O directly in the dispatch list may evidently cause a + * violation of service guarantees for the other queues + */ + if (!bfqq || + (bfqq != bfqd->in_service_queue && + bfqd->in_service_queue != NULL && + bfq_tot_busy_queues(bfqd) == 1 + bfq_bfqq_busy(bfqq) && + (bfqq->waker_bfqq == bfqd->in_service_queue || + bfqd->in_service_queue->waker_bfqq == bfqq)) || at_head) { if (at_head) list_add(&rq->queuelist, &bfqd->dispatch); else @@ -5978,6 +6019,7 @@ * merge). */ cmd_flags = rq->cmd_flags; + spin_unlock_irq(&bfqd->lock); bfq_update_insert_stats(q, bfqq, idle_timer_disabled, diff -u linux-aws-5.13-5.13.0/block/bio.c linux-aws-5.13-5.13.0/block/bio.c --- linux-aws-5.13-5.13.0/block/bio.c +++ linux-aws-5.13-5.13.0/block/bio.c @@ -539,8 +539,7 @@ offset = new_size - done; else offset = 0; - zero_user(bv.bv_page, bv.bv_offset + offset, - bv.bv_len - offset); + zero_user(bv.bv_page, offset, bv.bv_len - offset); truncated = true; } done += bv.bv_len; diff -u linux-aws-5.13-5.13.0/block/blk-flush.c linux-aws-5.13-5.13.0/block/blk-flush.c --- linux-aws-5.13-5.13.0/block/blk-flush.c +++ linux-aws-5.13-5.13.0/block/blk-flush.c @@ -235,10 +235,8 @@ * avoiding use-after-free. */ WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE); - if (fq->rq_status != BLK_STS_OK) { + if (fq->rq_status != BLK_STS_OK) error = fq->rq_status; - fq->rq_status = BLK_STS_OK; - } if (!q->elevator) { flush_rq->tag = BLK_MQ_NO_TAG; reverted: --- linux-aws-5.13-5.13.0/block/blk-pm.c +++ linux-aws-5.13-5.13.0.orig/block/blk-pm.c @@ -163,19 +163,27 @@ /** * blk_post_runtime_resume - Post runtime resume processing * @q: the queue of the device + * @err: return value of the device's runtime_resume function * * Description: + * Update the queue's runtime status according to the return value of the + * device's runtime_resume function. If the resume was successful, call + * blk_set_runtime_active() to do the real work of restarting the queue. - * For historical reasons, this routine merely calls blk_set_runtime_active() - * to do the real work of restarting the queue. It does this regardless of - * whether the device's runtime-resume succeeded; even if it failed the - * driver or error handler will need to communicate with the device. * * This function should be called near the end of the device's * runtime_resume callback. */ +void blk_post_runtime_resume(struct request_queue *q, int err) -void blk_post_runtime_resume(struct request_queue *q) { + if (!q->dev) + return; + if (!err) { + blk_set_runtime_active(q); + } else { + spin_lock_irq(&q->queue_lock); + q->rpm_status = RPM_SUSPENDED; + spin_unlock_irq(&q->queue_lock); + } - blk_set_runtime_active(q); } EXPORT_SYMBOL(blk_post_runtime_resume); @@ -193,7 +201,7 @@ * runtime PM status and re-enable peeking requests from the queue. It * should be called before first request is added to the queue. * + * This function is also called by blk_post_runtime_resume() for successful - * This function is also called by blk_post_runtime_resume() for * runtime resumes. It does everything necessary to restart the queue. */ void blk_set_runtime_active(struct request_queue *q) reverted: --- linux-aws-5.13-5.13.0/crypto/jitterentropy.c +++ linux-aws-5.13-5.13.0.orig/crypto/jitterentropy.c @@ -265,6 +265,7 @@ { __u64 delta2 = jent_delta(ec->last_delta, current_delta); __u64 delta3 = jent_delta(ec->last_delta2, delta2); + unsigned int delta_masked = current_delta & JENT_APT_WORD_MASK; ec->last_delta = current_delta; ec->last_delta2 = delta2; @@ -273,7 +274,7 @@ * Insert the result of the comparison of two back-to-back time * deltas. */ + jent_apt_insert(ec, delta_masked); - jent_apt_insert(ec, current_delta); if (!current_delta || !delta2 || !delta3) { /* RCT with a stuck bit */ diff -u linux-aws-5.13-5.13.0/debian.aws-5.13/abi/version linux-aws-5.13-5.13.0/debian.aws-5.13/abi/version --- linux-aws-5.13-5.13.0/debian.aws-5.13/abi/version +++ linux-aws-5.13-5.13.0/debian.aws-5.13/abi/version @@ -1 +1 @@ -5.13.0-1019.21~20.04.1 +5.13.0-1020.22~20.04.1 diff -u linux-aws-5.13-5.13.0/debian.aws-5.13/changelog linux-aws-5.13-5.13.0/debian.aws-5.13/changelog --- linux-aws-5.13-5.13.0/debian.aws-5.13/changelog +++ linux-aws-5.13-5.13.0/debian.aws-5.13/changelog @@ -1,3 +1,20 @@ +linux-aws-5.13 (5.13.0-1021.23~20.04.1) focal; urgency=medium + + * focal/linux-aws-5.13: 5.13.0-1021.23~20.04.1 -proposed tracker + (LP: #1966223) + + [ Ubuntu: 5.13.0-1021.23 ] + + * impish/linux-aws: 5.13.0-1021.23 -proposed tracker (LP: #1966224) + * impish/linux: 5.13.0-39.44 -proposed tracker (LP: #1966236) + * CVE-2022-27666 + - sock: remove one redundant SKB_FRAG_PAGE_ORDER macro + - esp: Fix possible buffer overflow in ESP transformation + * CVE-2022-1055 + - net: sched: fix use-after-free in tc_new_tfilter() + + -- Tim Gardner Thu, 24 Mar 2022 14:59:01 -0600 + linux-aws-5.13 (5.13.0-1020.22~20.04.1) focal; urgency=medium * focal/linux-aws-5.13: 5.13.0-1020.22~20.04.1 -proposed tracker diff -u linux-aws-5.13-5.13.0/debian.aws-5.13/tracking-bug linux-aws-5.13-5.13.0/debian.aws-5.13/tracking-bug --- linux-aws-5.13-5.13.0/debian.aws-5.13/tracking-bug +++ linux-aws-5.13-5.13.0/debian.aws-5.13/tracking-bug @@ -1 +1 @@ -1965332 2022.03.21-1 +1966223 2022.02.21-8 diff -u linux-aws-5.13-5.13.0/debian.aws/changelog linux-aws-5.13-5.13.0/debian.aws/changelog --- linux-aws-5.13-5.13.0/debian.aws/changelog +++ linux-aws-5.13-5.13.0/debian.aws/changelog @@ -1,900 +1,17 @@ -linux-aws (5.13.0-1020.22) impish; urgency=medium +linux-aws (5.13.0-1021.23) impish; urgency=medium - * impish/linux-aws: 5.13.0-1020.22 -proposed tracker (LP: #1965333) + * impish/linux-aws: 5.13.0-1021.23 -proposed tracker (LP: #1966224) - * AWS: Hibernate resume crashes when platform changes (LP: #1965002) - - PM: hibernate: Allow ACPI hardware signature to be honoured - - PM: hibernate: Honour ACPI hardware signature by default for virtual guests + [ Ubuntu: 5.13.0-39.44 ] - [ Ubuntu: 5.13.0-38.43 ] + * impish/linux: 5.13.0-39.44 -proposed tracker (LP: #1966236) + * CVE-2022-27666 + - sock: remove one redundant SKB_FRAG_PAGE_ORDER macro + - esp: Fix possible buffer overflow in ESP transformation + * CVE-2022-1055 + - net: sched: fix use-after-free in tc_new_tfilter() - * impish/linux: 5.13.0-38.43 -proposed tracker (LP: #1965347) - * PS/2 Keyboard wakeup from s2idle not functioning on AMD Yellow Carp platform - (LP: #1961739) - - PM: s2idle: ACPI: Fix wakeup interrupts handling - * Low RX performance for 40G Solarflare NICs (LP: #1964512) - - SAUCE: sfc: The size of the RX recycle ring should be more flexible - * [UBUNTU 20.04] Fix SIGP processing on KVM/s390 (LP: #1962578) - - KVM: s390: Simplify SIGP Set Arch handling - - KVM: s390: Add a routine for setting userspace CPU state - * Move virtual graphics drivers from linux-modules-extra to linux-modules - (LP: #1960633) - - [Packaging] Move VM DRM drivers into modules - * Impish update: upstream stable patchset 2022-03-09 (LP: #1964422) - - bnx2x: Utilize firmware 7.13.21.0 - - bnx2x: Invalidate fastpath HSI version for VFs - - rcu: Tighten rcu_advance_cbs_nowake() checks - - select: Fix indefinitely sleeping task in poll_schedule_timeout() - - drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 - - arm64/bpf: Remove 128MB limit for BPF JIT programs - - Bluetooth: refactor malicious adv data check - - net: sfp: ignore disabled SFP node - - net: stmmac: skip only stmmac_ptp_register when resume from suspend - - s390/hypfs: include z/VM guests with access control group set - - bpf: Guard against accessing NULL pt_regs in bpf_get_task_stack() - - scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP - devices - - udf: Restore i_lenAlloc when inode expansion fails - - udf: Fix NULL ptr deref when converting from inline format - - efi: runtime: avoid EFIv2 runtime services on Apple x86 machines - - PM: wakeup: simplify the output logic of pm_show_wakelocks() - - tracing/histogram: Fix a potential memory leak for kstrdup() - - tracing: Don't inc err_log entry count if entry allocation fails - - ceph: properly put ceph_string reference after async create attempt - - ceph: set pool_ns in new inode layout for async creates - - fsnotify: fix fsnotify hooks in pseudo filesystems - - Revert "KVM: SVM: avoid infinite loop on NPF from bad address" - - perf/x86/intel/uncore: Fix CAS_COUNT_WRITE issue for ICX - - drm/etnaviv: relax submit size limits - - KVM: x86: Update vCPU's runtime CPUID on write to MSR_IA32_XSS - - netfilter: nft_payload: do not update layer 4 checksum when mangling - fragments - - serial: 8250: of: Fix mapped region size when using reg-offset property - - serial: stm32: fix software flow control transfer - - tty: n_gsm: fix SW flow control encoding/handling - - tty: Add support for Brainboxes UC cards. - - usb-storage: Add unusual-devs entry for VL817 USB-SATA bridge - - usb: xhci-plat: fix crash when suspend if remote wake enable - - usb: common: ulpi: Fix crash in ulpi_match() - - usb: gadget: f_sourcesink: Fix isoc transfer for USB_SPEED_SUPER_PLUS - - USB: core: Fix hang in usb_kill_urb by adding memory barriers - - usb: typec: tcpm: Do not disconnect while receiving VBUS off - - ucsi_ccg: Check DEV_INT bit only when starting CCG4 - - jbd2: export jbd2_journal_[grab|put]_journal_head - - ocfs2: fix a deadlock when commit trans - - sched/membarrier: Fix membarrier-rseq fence command missing from query - bitmask - - x86/MCE/AMD: Allow thresholding interface updates after init - - powerpc/32s: Allocate one 256k IBAT instead of two consecutives 128k IBATs - - powerpc/32s: Fix kasan_init_region() for KASAN - - powerpc/32: Fix boot failure with GCC latent entropy plugin - - i40e: Increase delay to 1 s after global EMP reset - - i40e: Fix issue when maximum queues is exceeded - - i40e: Fix queues reservation for XDP - - i40e: Fix for failed to init adminq while VF reset - - i40e: fix unsigned stat widths - - usb: roles: fix include/linux/usb/role.h compile issue - - rpmsg: char: Fix race between the release of rpmsg_ctrldev and cdev - - rpmsg: char: Fix race between the release of rpmsg_eptdev and cdev - - scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put() - - ipv6_tunnel: Rate limit warning messages - - net: fix information leakage in /proc/net/ptype - - hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649 - - hwmon: (lm90) Mark alert as broken for MAX6680 - - ping: fix the sk_bound_dev_if match in ping_lookup - - ipv4: avoid using shared IP generator for connected sockets - - hwmon: (lm90) Reduce maximum conversion rate for G781 - - NFSv4: Handle case where the lookup of a directory fails - - NFSv4: nfs_atomic_open() can race when looking up a non-regular file - - net-procfs: show net devices bound packet types - - drm/msm: Fix wrong size calculation - - drm/msm/dsi: Fix missing put_device() call in dsi_get_phy - - drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable - - ipv6: annotate accesses to fn->fn_sernum - - NFS: Ensure the server has an up to date ctime before hardlinking - - NFS: Ensure the server has an up to date ctime before renaming - - powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 - - netfilter: conntrack: don't increment invalid counter on NF_REPEAT - - perf: Fix perf_event_read_local() time - - sched/pelt: Relax the sync of util_sum with util_avg - - net: phy: broadcom: hook up soft_reset for BCM54616S - - phylib: fix potential use-after-free - - octeontx2-pf: Forward error codes to VF - - rxrpc: Adjust retransmission backoff - - efi/libstub: arm64: Fix image check alignment at entry - - hwmon: (lm90) Mark alert as broken for MAX6654 - - powerpc/perf: Fix power_pmu_disable to call clear_pmi_irq_pending only if - PMI is pending - - net: ipv4: Move ip_options_fragment() out of loop - - net: ipv4: Fix the warning for dereference - - ipv4: fix ip option filtering for locally generated fragments - - ibmvnic: init ->running_cap_crqs early - - ibmvnic: don't spin in tasklet - - video: hyperv_fb: Fix validation of screen resolution - - drm/msm/hdmi: Fix missing put_device() call in msm_hdmi_get_phy - - drm/msm/dpu: invalid parameter check in dpu_setup_dspp_pcc - - yam: fix a memory leak in yam_siocdevprivate() - - net: cpsw: Properly initialise struct page_pool_params - - net: hns3: handle empty unknown interrupt for VF - - Revert "ipv6: Honor all IPv6 PIO Valid Lifetime values" - - net: bridge: vlan: fix single net device option dumping - - ipv4: raw: lock the socket in raw_bind() - - ipv4: tcp: send zero IPID in SYNACK messages - - ipv4: remove sparse error in ip_neigh_gw4() - - net: bridge: vlan: fix memory leak in __allowed_ingress - - dt-bindings: can: tcan4x5x: fix mram-cfg RX FIFO config - - usr/include/Makefile: add linux/nfc.h to the compile-test coverage - - fsnotify: invalidate dcache before IN_DELETE event - - block: Fix wrong offset in bio_truncate() - - mtd: rawnand: mpc5121: Remove unused variable in ads5121_select_chip() - - net: stmmac: configure PTP clock source prior to PTP initialization - - KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE - - s390/nmi: handle guarded storage validity failures for KVM guests - - powerpc32/bpf: Fix codegen for bpf-to-bpf calls - - powerpc/bpf: Update ldimm64 instructions during extra pass - - psi: Fix uaf issue when psi trigger is destroyed while being polled - - perf/x86/intel: Add a quirk for the calculation of the number of counters on - Alder Lake - - drm/atomic: Add the crtc to affected crtc only if uapi.enable = true - - KVM: SVM: Never reject emulation due to SMAP errata for !SEV guests - - KVM: x86: Keep MSR_IA32_XSS unchanged for INIT - - KVM: x86: Sync the states size with the XCR0/IA32_XSS at, any time - - tty: Partially revert the removal of the Cyclades public API - - usb: cdnsp: Fix segmentation fault in cdns_lost_power function - - usb: dwc3: xilinx: Skip resets and USB3 register settings for USB2.0 mode - - usb: dwc3: xilinx: Fix error handling when getting USB3 PHY - - usb: typec: tcpci: don't touch CC line if it's Vconn source - - usb: typec: tcpm: Do not disconnect when receiving VSAFE0V - - mm, kasan: use compare-exchange operation to set KASAN page tag - - PCI/sysfs: Find shadow ROM before static attribute initialization - - x86/cpu: Add Xeon Icelake-D to list of CPUs that support PPIN - - ARM: 9170/1: fix panic when kasan and kprobe are enabled - - net: stmmac: dwmac-visconti: Fix bit definitions for ETHER_CLK_SEL - - net: stmmac: dwmac-visconti: Fix clock configuration for RMII mode - - octeontx2-af: cn10k: Do not enable RPM loopback for LPC interfaces - - io_uring: fix bug in slow unregistering of nodes - - ibmvnic: Allow extra failures before disabling - - net/smc: Transitional solution for clcsock race issue - - can: tcan4x5x: regmap: fix max register value - - drm/msm/a6xx: Add missing suspend_count increment - - sch_htb: Fail on unsupported parameters when offload is requested - - Revert "drm/ast: Support 1600x900 with 108MHz PCLK" - - irqchip/realtek-rtl: Map control data to virq - - irqchip/realtek-rtl: Fix off-by-one in routing - - perf/core: Fix cgroup event list management - - psi: fix "no previous prototype" warnings when CONFIG_CGROUPS=n - - psi: fix "defined but not used" warnings when CONFIG_PROC_FS=n - * Impish update: upstream stable patchset 2022-02-24 (LP: #1962230) - - KVM: VMX: switch blocked_vcpu_on_cpu_lock to raw spinlock - - HID: uhid: Fix worker destroying device without any protection - - HID: wacom: Avoid using stale array indicies to read contact count - - f2fs: fix to do sanity check in is_alive() - - nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed - bind() - - mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings - - mtd: rawnand: gpmi: Remove explicit default gpmi clock setting for i.MX6 - - mtd: Fixed breaking list in __mtd_del_partition. - - mtd: rawnand: davinci: Don't calculate ECC when reading page - - mtd: rawnand: davinci: Avoid duplicated page read - - mtd: rawnand: davinci: Rewrite function description - - x86/gpu: Reserve stolen memory for first integrated Intel GPU - - tools/nolibc: x86-64: Fix startup code bug - - tools/nolibc: i386: fix initial stack alignment - - tools/nolibc: fix incorrect truncation of exit code - - rtc: cmos: take rtc_lock while reading from CMOS - - media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE - - media: flexcop-usb: fix control-message timeouts - - media: mceusb: fix control-message timeouts - - media: em28xx: fix control-message timeouts - - media: cpia2: fix control-message timeouts - - media: s2255: fix control-message timeouts - - media: dib0700: fix undefined behavior in tuner shutdown - - media: redrat3: fix control-message timeouts - - media: pvrusb2: fix control-message timeouts - - media: stk1160: fix control-message timeouts - - media: cec-pin: fix interrupt en/disable handling - - can: softing_cs: softingcs_probe(): fix memleak on registration failure - - iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs - - lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() - - iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure - - gpu: host1x: Add back arm_iommu_detach_device() - - dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() - - PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller - - mm_zone: add function to check if managed dma zone exists - - dma/pool: create dma atomic pool only if dma zone has managed pages - - mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed - pages - - shmem: fix a race between shmem_unused_huge_shrink and shmem_evict_inode - - drm/ttm: Put BO in its memory manager's lru list - - Bluetooth: L2CAP: Fix not initializing sk_peer_pid - - drm/bridge: display-connector: fix an uninitialized pointer in probe() - - drm: fix null-ptr-deref in drm_dev_init_release() - - drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure - - drm/panel: innolux-p079zca: Delete panel on attach() failure - - drm/rockchip: dsi: Fix unbalanced clock on probe error - - drm/rockchip: dsi: Hold pm-runtime across bind/unbind - - drm/rockchip: dsi: Disable PLL clock on bind error - - drm/rockchip: dsi: Reconfigure hardware on resume() - - Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails - - clk: bcm-2835: Pick the closest clock rate - - clk: bcm-2835: Remove rounding up the dividers - - drm/vc4: hdmi: Set a default HSM rate - - wcn36xx: ensure pairing of init_scan/finish_scan and start_scan/end_scan - - wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND - - wcn36xx: Fix DMA channel enable/disable cycle - - wcn36xx: Release DMA channel descriptor allocations - - wcn36xx: Put DXE block into reset before freeing memory - - wcn36xx: populate band before determining rate on RX - - wcn36xx: fix RX BD rate mapping for 5GHz legacy rates - - ath11k: Send PPDU_STATS_CFG with proper pdev mask to firmware - - mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init() - - media: videobuf2: Fix the size printk format - - media: atomisp: add missing media_device_cleanup() in - atomisp_unregister_entities() - - media: atomisp: fix punit_ddr_dvfs_enable() argument for mrfld_power up case - - media: atomisp: fix inverted logic in buffers_needed() - - media: atomisp: do not use err var when checking port validity for ISP2400 - - media: atomisp: fix inverted error check for - ia_css_mipi_is_source_port_valid() - - media: atomisp: fix ifdefs in sh_css.c - - media: staging: media: atomisp: pci: Balance braces around conditional - statements in file atomisp_cmd.c - - media: atomisp: add NULL check for asd obtained from atomisp_video_pipe - - media: atomisp: fix enum formats logic - - media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() - - media: aspeed: fix mode-detect always time out at 2nd run - - media: em28xx: fix memory leak in em28xx_init_dev - - media: aspeed: Update signal status immediately to ensure sane hw state - - arm64: dts: amlogic: meson-g12: Fix GPU operating point table node name - - arm64: dts: amlogic: Fix SPI NOR flash node name for ODROID N2/N2+ - - arm64: dts: meson-gxbb-wetek: fix HDMI in early boot - - arm64: dts: meson-gxbb-wetek: fix missing GPIO binding - - fs: dlm: use sk->sk_socket instead of con->sock - - fs: dlm: don't call kernel_getpeername() in error_report() - - memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails - - Bluetooth: stop proccessing malicious adv data - - ath11k: Fix ETSI regd with weather radar overlap - - ath11k: clear the keys properly via DISABLE_KEY - - ath11k: reset RSN/WPA present state for open BSS - - tee: fix put order in teedev_close_context() - - fs: dlm: fix build with CONFIG_IPV6 disabled - - drm/vboxvideo: fix a NULL vs IS_ERR() check - - arm64: dts: renesas: cat875: Add rx/tx delays - - media: dmxdev: fix UAF when dvb_register_device() fails - - crypto: qce - fix uaf on qce_ahash_register_one - - crypto: qce - fix uaf on qce_skcipher_register_one - - mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove - - ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding on stm32f429 - disco - - crypto: qat - remove unnecessary collision prevention step in PFVF - - crypto: qat - make pfvf send message direction agnostic - - crypto: qat - fix undetected PFVF timeout in ACK loop - - ath11k: Use host CE parameters for CE interrupts configuration - - arm64: dts: ti: k3-j721e: correct cache-sets info - - tty: serial: atmel: Check return code of dmaengine_submit() - - tty: serial: atmel: Call dma_async_issue_pending() - - mfd: atmel-flexcom: Remove #ifdef CONFIG_PM_SLEEP - - mfd: atmel-flexcom: Use .resume_noirq - - media: rcar-csi2: Correct the selection of hsfreqrange - - media: imx-pxp: Initialize the spinlock prior to using it - - media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() - - media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released - - media: coda: fix CODA960 JPEG encoder buffer overflow - - media: venus: core: Fix a potential NULL pointer dereference in an error - handling path - - media: venus: core: Fix a resource leak in the error handling path of - 'venus_probe()' - - thermal/drivers/imx: Implement runtime PM support - - netfilter: bridge: add support for pppoe filtering - - arm64: dts: qcom: msm8916: fix MMC controller aliases - - cgroup: Trace event cgroup id fields should be u64 - - ACPI: EC: Rework flushing of EC work while suspended to idle - - thermal/drivers/imx8mm: Enable ADC when enabling monitor - - drm/amdgpu: Fix a NULL pointer dereference in - amdgpu_connector_lcd_native_mode() - - drm/radeon/radeon_kms: Fix a NULL pointer dereference in - radeon_driver_open_kms() - - arm64: dts: ti: k3-j7200: Fix the L2 cache sets - - arm64: dts: ti: k3-j721e: Fix the L2 cache sets - - arm64: dts: ti: k3-j7200: Correct the d-cache-sets info - - tty: serial: uartlite: allow 64 bit address - - serial: amba-pl011: do not request memory region twice - - floppy: Fix hang in watchdog when disk is ejected - - staging: rtl8192e: return error code from rtllib_softmac_init() - - staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() - - Bluetooth: btmtksdio: fix resume failure - - sched/fair: Fix detection of per-CPU kthreads waking a task - - sched/fair: Fix per-CPU kthread and wakee stacking for asym CPU capacity - - bpf: Adjust BTF log size limit. - - bpf: Disallow BPF_LOG_KERNEL log level for bpf(BPF_BTF_LOAD) - - bpf: Remove config check to enable bpf support for branch records - - arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 - - media: dib8000: Fix a memleak in dib8000_init() - - media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach() - - media: si2157: Fix "warm" tuner state detection - - wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma - - sched/rt: Try to restart rt period timer when rt runtime exceeded - - drm/msm/dp: displayPort driver need algorithm rational - - rcu/exp: Mark current CPU as exp-QS in IPI loop second pass - - mwifiex: Fix possible ABBA deadlock - - xfrm: fix a small bug in xfrm_sa_len() - - x86/uaccess: Move variable into switch case statement - - selftests: clone3: clone3: add case CLONE3_ARGS_NO_TEST - - selftests: harness: avoid false negatives if test has no ASSERTs - - crypto: stm32/cryp - fix CTR counter carry - - crypto: stm32/cryp - fix xts and race condition in crypto_engine requests - - crypto: stm32/cryp - check early input data - - crypto: stm32/cryp - fix double pm exit - - crypto: stm32/cryp - fix lrw chaining mode - - crypto: stm32/cryp - fix bugs and crash in tests - - crypto: stm32 - Revert broken pm_runtime_resume_and_get changes - - ath11k: Fix deleting uninitialized kernel timer during fragment cache flush - - ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB sectors - - media: dw2102: Fix use after free - - media: msi001: fix possible null-ptr-deref in msi001_probe() - - media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes - - ath11k: Fix a NULL pointer dereference in ath11k_mac_op_hw_scan() - - arm64: dts: qcom: c630: Fix soundcard setup - - arm64: dts: qcom: ipq6018: Fix gpio-ranges property - - drm/msm/dpu: fix safe status debugfs file - - drm/bridge: ti-sn65dsi86: Set max register for regmap - - drm/tegra: vic: Fix DMA API misuse - - media: hantro: Fix probe func error path - - xfrm: interface with if_id 0 should return error - - xfrm: state and policy should fail if XFRMA_IF_ID 0 - - ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding - - usb: ftdi-elan: fix memory leak on device disconnect - - arm64: dts: marvell: cn9130: add GPIO and SPI aliases - - arm64: dts: marvell: cn9130: enable CP0 GPIO controllers - - ARM: dts: armada-38x: Add generic compatible to UART nodes - - iwlwifi: mvm: fix 32-bit build in FTM - - iwlwifi: mvm: test roc running status bits before removing the sta - - mmc: meson-mx-sdhc: add IRQ check - - mmc: meson-mx-sdio: add IRQ check - - selinux: fix potential memleak in selinux_add_opt() - - um: fix ndelay/udelay defines - - um: virtio_uml: Fix time-travel external time propagation - - Bluetooth: L2CAP: Fix using wrong mode - - bpftool: Enable line buffering for stdout - - backlight: qcom-wled: Validate enabled string indices in DT - - backlight: qcom-wled: Pass number of elements to read to read_u32_array - - backlight: qcom-wled: Fix off-by-one maximum with default num_strings - - backlight: qcom-wled: Override default length with qcom,enabled-strings - - backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion - - backlight: qcom-wled: Respect enabled-strings in set_brightness - - software node: fix wrong node passed to find nargs_prop - - Bluetooth: hci_qca: Stop IBS timer during BT OFF - - x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS - - hwmon: (mr75203) fix wrong power-up delay value - - x86/mce/inject: Avoid out-of-bounds write when setting flags - - ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes - - pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in - __nonstatic_find_io_region() - - pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in - nonstatic_find_mem_region() - - power: reset: mt6397: Check for null res pointer - - netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() - - bpf: Fix SO_RCVBUF/SO_SNDBUF handling in _bpf_setsockopt(). - - netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone - - ppp: ensure minimum packet size in ppp_write() - - rocker: fix a sleeping in atomic bug - - staging: greybus: audio: Check null pointer - - fsl/fman: Check for null pointer after calling devm_ioremap - - Bluetooth: hci_bcm: Check for error irq - - Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe - - usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe - - HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_get_str_desc - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_huion_init - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_frame_init_v1_buttonpad - - debugfs: lockdown: Allow reading debugfs files that are not world readable - - net/mlx5e: Fix page DMA map/unmap attributes - - net/mlx5e: Don't block routes with nexthop objects in SW - - Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels" - - net/mlx5: Set command entry semaphore up once got index free - - lib/mpi: Add the return value check of kcalloc() - - Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() - - spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe - - ax25: uninitialized variable in ax25_setsockopt() - - netrom: fix api breakage in nr_setsockopt() - - regmap: Call regmap_debugfs_exit() prior to _init() - - can: mcp251xfd: add missing newline to printed strings - - tpm: add request_locality before write TPM_INT_ENABLE - - tpm_tis: Fix an error handling path in 'tpm_tis_core_init()' - - can: softing: softing_startstop(): fix set but not used variable warning - - can: xilinx_can: xcan_probe(): check for error irq - - pcmcia: fix setting of kthread task states - - iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() - - net: mcs7830: handle usb read errors properly - - ext4: avoid trim error on fs with small groups - - ALSA: jack: Add missing rwsem around snd_ctl_remove() calls - - ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls - - ALSA: hda: Add missing rwsem around snd_ctl_remove() calls - - RDMA/bnxt_re: Scan the whole bitmap when checking if "disabling RCFW with - pending cmd-bit" - - RDMA/hns: Validate the pkey index - - scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() - - clk: imx8mn: Fix imx8mn_clko1_sels - - powerpc/prom_init: Fix improper check of prom_getprop() - - ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA - - dt-bindings: thermal: Fix definition of cooling-maps contribution property - - powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an - overflown PMC - - powerpc/32s: Fix shift-out-of-bounds in KASAN init - - clocksource: Reduce clocksource-skew threshold - - clocksource: Avoid accidental unstable marking of clocksources - - ALSA: oss: fix compile error when OSS_DEBUG is enabled - - ALSA: usb-audio: Drop superfluous '0' in Presonus Studio 1810c's ID - - char/mwave: Adjust io port register size - - binder: fix handling of error during copy - - openrisc: Add clone3 ABI wrapper - - iommu/io-pgtable-arm: Fix table descriptor paddr formatting - - scsi: ufs: Fix race conditions related to driver data - - RDMA/qedr: Fix reporting max_{send/recv}_wr attrs - - PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() - - powerpc/powermac: Add additional missing lockdep_register_key() - - RDMA/core: Let ib_find_gid() continue search even after empty entry - - RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry - - ASoC: rt5663: Handle device_property_read_u32_array error codes - - of: unittest: fix warning on PowerPC frame size warning - - of: unittest: 64 bit dma address test requires arch support - - clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system - enter shell - - mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support - - mips: fix Kconfig reference to PHYS_ADDR_T_64BIT - - dmaengine: pxa/mmp: stop referencing config->slave_id - - iommu/amd: Remove iommu_init_ga() - - iommu/amd: Restore GA log/tail pointer on host resume - - ASoC: Intel: catpt: Test dmaengine_submit() result before moving on - - iommu/iova: Fix race between FQ timeout and teardown - - scsi: block: pm: Always set request queue runtime active in - blk_post_runtime_resume() - - phy: uniphier-usb3ss: fix unintended writing zeros to PHY register - - ASoC: samsung: idma: Check of ioremap return value - - misc: lattice-ecp3-config: Fix task hung when firmware load failed - - arm64: tegra: Remove non existent Tegra194 reset - - mips: lantiq: add support for clk_set_parent() - - mips: bcm63xx: add support for clk_set_parent() - - powerpc/xive: Add missing null check after calling kmalloc - - ASoC: fsl_mqs: fix MODULE_ALIAS - - RDMA/cxgb4: Set queue pair state when being queried - - ASoC: fsl_asrc: refine the check of available clock divider - - clk: bm1880: remove kfrees on static allocations - - of: base: Fix phandle argument length mismatch error message - - ARM: dts: omap3-n900: Fix lp5523 for multi color - - Bluetooth: Fix debugfs entry leak in hci_register_dev() - - fs: dlm: filter user dlm messages for kernel locks - - drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y - - selftests/bpf: Fix bpf_object leak in skb_ctx selftest - - ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply - - drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR - - drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR - - media: atomisp: fix try_fmt logic - - media: atomisp: set per-device's default mode - - media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure - - ARM: shmobile: rcar-gen2: Add missing of_node_put() - - batman-adv: allow netlink usage in unprivileged containers - - media: atomisp: handle errors at sh_css_create_isp_params() - - ath11k: Fix crash caused by uninitialized TX ring - - usb: gadget: f_fs: Use stream_open() for endpoint files - - drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L - - HID: apple: Do not reset quirks when the Fn key is not found - - media: b2c2: Add missing check in flexcop_pci_isr: - - EDAC/synopsys: Use the quirk for version instead of ddr version - - ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART - - drm/amd/display: check top_pipe_to_program pointer - - drm/amdgpu/display: set vblank_disable_immediate for DC - - soc: ti: pruss: fix referenced node in error message - - mlxsw: pci: Add shutdown method in PCI driver - - drm/bridge: megachips: Ensure both bridges are probed before registration - - tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown() - - gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use - - HSI: core: Fix return freed object in hsi_new_client - - crypto: jitter - consider 32 LSB for APT - - mwifiex: Fix skb_over_panic in mwifiex_usb_recv() - - rsi: Fix use-after-free in rsi_rx_done_handler() - - rsi: Fix out-of-bounds read in rsi_read_pkt() - - ath11k: Avoid NULL ptr access during mgmt tx cleanup - - media: venus: avoid calling core_clk_setrate() concurrently during - concurrent video sessions - - ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table - - ACPI: Change acpi_device_always_present() into acpi_device_override_status() - - ACPI / x86: Allow specifying acpi_device_override_status() quirks by path - - ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD - win - - arm64: dts: ti: j7200-main: Fix 'dtbs_check' serdes_ln_ctrl node - - usb: uhci: add aspeed ast2600 uhci support - - floppy: Add max size check for user space request - - x86/mm: Flush global TLB when switching to trampoline page-table - - drm: rcar-du: Fix CRTC timings when CMM is used - - media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds. - - media: rcar-vin: Update format alignment constraints - - media: saa7146: hexium_orion: Fix a NULL pointer dereference in - hexium_attach() - - media: m920x: don't use stack on USB reads - - thunderbolt: Runtime PM activate both ends of the device link - - iwlwifi: mvm: synchronize with FW after multicast commands - - iwlwifi: mvm: avoid clearing a just saved session protection id - - ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work - - ath10k: Fix tx hanging - - net-sysfs: update the queue counts in the unregistration path - - net: phy: prefer 1000baseT over 1000baseKX - - gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock - - selftests/ftrace: make kprobe profile testcase description unique - - ath11k: Avoid false DEADLOCK warning reported by lockdep - - x86/mce: Allow instrumentation during task work queueing - - x86/mce: Mark mce_panic() noinstr - - x86/mce: Mark mce_end() noinstr - - x86/mce: Mark mce_read_aux() noinstr - - net: bonding: debug: avoid printing debug logs when bond is not notifying - peers - - bpf: Do not WARN in bpf_warn_invalid_xdp_action() - - HID: quirks: Allow inverting the absolute X/Y values - - media: igorplugusb: receiver overflow should be reported - - media: saa7146: hexium_gemini: Fix a NULL pointer dereference in - hexium_attach() - - mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO - - audit: ensure userspace is penalized the same as the kernel when under - pressure - - arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus - - arm64: tegra: Adjust length of CCPLEX cluster MMIO region - - PM: runtime: Add safety net to supplier device release - - cpufreq: Fix initialization of min and max frequency QoS requests - - usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 - - ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream - - rtw88: 8822c: update rx settings to prevent potential hw deadlock - - PM: AVS: qcom-cpr: Use div64_ul instead of do_div - - iwlwifi: fix leaks/bad data after failed firmware load - - iwlwifi: remove module loading failure message - - iwlwifi: mvm: Fix calculation of frame length - - iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ - - um: registers: Rename function names to avoid conflicts and build problems - - ath11k: Fix napi related hang - - Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES - - xfrm: rate limit SA mapping change message to user space - - drm/etnaviv: consider completed fence seqno in hang check - - jffs2: GC deadlock reading a page that is used in jffs2_write_begin() - - ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions - - ACPICA: Utilities: Avoid deleting the same object twice in a row - - ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() - - ACPICA: Fix wrong interpretation of PCC address - - ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 - - drm/amdgpu: fixup bad vram size on gmc v8 - - amdgpu/pm: Make sysfs pm attributes as read-only for VFs - - ACPI: battery: Add the ThinkPad "Not Charging" quirk - - btrfs: remove BUG_ON() in find_parent_nodes() - - btrfs: remove BUG_ON(!eie) in find_parent_nodes - - net: mdio: Demote probed message to debug print - - mac80211: allow non-standard VHT MCS-10/11 - - dm btree: add a defensive bounds check to insert_at() - - dm space map common: add bounds check to sm_ll_lookup_bitmap() - - mlxsw: pci: Avoid flow control for EMAD packets - - net: phy: marvell: configure RGMII delays for 88E1118 - - net: gemini: allow any RGMII interface mode - - regulator: qcom_smd: Align probe function with rpmh-regulator - - serial: pl010: Drop CR register reset on set_termios - - serial: core: Keep mctrl register state and cached copy in sync - - random: do not throw away excess input to crng_fast_load - - parisc: Avoid calling faulthandler_disabled() twice - - x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs - - powerpc/6xx: add missing of_node_put - - powerpc/powernv: add missing of_node_put - - powerpc/cell: add missing of_node_put - - powerpc/btext: add missing of_node_put - - powerpc/watchdog: Fix missed watchdog reset due to memory ordering race - - i2c: i801: Don't silently correct invalid transfer size - - powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING - - i2c: mpc: Correct I2C reset procedure - - clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB - - powerpc/powermac: Add missing lockdep_register_key() - - KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots - - KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST - - w1: Misuse of get_user()/put_user() reported by sparse - - nvmem: core: set size for sysfs bin file - - dm: fix alloc_dax error handling in alloc_dev - - scsi: lpfc: Trigger SLI4 firmware dump before doing driver cleanup - - ALSA: seq: Set upper limit of processed events - - MIPS: Loongson64: Use three arguments for slti - - powerpc/40x: Map 32Mbytes of memory at startup - - selftests/powerpc/spectre_v2: Return skip code when miss_percent is high - - powerpc: handle kdump appropriately with crash_kexec_post_notifiers option - - powerpc/fadump: Fix inaccurate CPU state info in vmcore generated with panic - - udf: Fix error handling in udf_new_inode() - - MIPS: OCTEON: add put_device() after of_find_device_by_node() - - irqchip/gic-v4: Disable redistributors' view of the VPE table at boot time - - i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters - - MIPS: Octeon: Fix build errors using clang - - scsi: sr: Don't use GFP_DMA - - ASoC: mediatek: mt8173: fix device_node leak - - ASoC: mediatek: mt8183: fix device_node leak - - phy: mediatek: Fix missing check in mtk_mipi_tx_probe - - rpmsg: core: Clean up resources on announce_create failure. - - crypto: omap-aes - Fix broken pm_runtime_and_get() usage - - crypto: stm32/crc32 - Fix kernel BUG triggered in probe() - - crypto: caam - replace this_cpu_ptr with raw_cpu_ptr - - ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers - - tpm: fix NPE on probe for missing device - - spi: uniphier: Fix a bug that doesn't point to private data correctly - - xen/gntdev: fix unmap notification order - - fuse: Pass correct lend value to filemap_write_and_wait_range() - - serial: Fix incorrect rs485 polarity on uart open - - cputime, cpuacct: Include guest time in user time in cpuacct.stat - - tracing/kprobes: 'nmissed' not showed correctly for kretprobe - - iwlwifi: mvm: Increase the scan timeout guard to 30 seconds - - s390/mm: fix 2KB pgtable release race - - device property: Fix fwnode_graph_devcon_match() fwnode leak - - drm/etnaviv: limit submit sizes - - drm/nouveau/kms/nv04: use vzalloc for nv04_display - - drm/bridge: analogix_dp: Make PSR-exit block less - - parisc: Fix lpa and lpa_user defines - - powerpc/64s/radix: Fix huge vmap false positive - - PCI: xgene: Fix IB window setup - - PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors - - PCI: pci-bridge-emul: Make expansion ROM Base Address register read-only - - PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space - - PCI: pci-bridge-emul: Fix definitions of reserved bits - - PCI: pci-bridge-emul: Correctly set PCIe capabilities - - PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device - - xfrm: fix policy lookup for ipv6 gre packets - - btrfs: fix deadlock between quota enable and other quota operations - - btrfs: check the root node for uptodate before returning it - - btrfs: respect the max size in the header when activating swap file - - ext4: make sure to reset inode lockdep class when quota enabling fails - - ext4: make sure quota gets properly shutdown on error - - ext4: fix a possible ABBA deadlock due to busy PA - - ext4: initialize err_blk before calling __ext4_get_inode_loc - - ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE - - ext4: set csum seed in tmp inode while migrating to extents - - ext4: Fix BUG_ON in ext4_bread when write quota data - - ext4: use ext4_ext_remove_space() for fast commit replay delete range - - ext4: fast commit may miss tracking unwritten range during ftruncate - - ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal - - ext4: fix null-ptr-deref in '__ext4_journal_ensure_credits' - - ext4: don't use the orphan list when migrating an inode - - drm/radeon: fix error handling in radeon_driver_open_kms - - of: base: Improve argument length mismatch error - - firmware: Update Kconfig help text for Google firmware - - can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message - - media: rcar-csi2: Optimize the selection PHTW register - - media: correct MEDIA_TEST_SUPPORT help text - - Documentation: dmaengine: Correctly describe dmatest with channel unset - - Documentation: ACPI: Fix data node reference documentation - - Documentation: refer to config RANDOMIZE_BASE for kernel address-space - randomization - - Documentation: fix firewire.rst ABI file path error - - Bluetooth: hci_sync: Fix not setting adv set duration - - scsi: core: Show SCMD_LAST in text form - - dmaengine: uniphier-xdmac: Fix type of address variables - - RDMA/hns: Modify the mapping attribute of doorbell to device - - RDMA/rxe: Fix a typo in opcode name - - dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK - - Revert "net/mlx5: Add retry mechanism to the command entry index allocation" - - powerpc/cell: Fix clang -Wimplicit-fallthrough warning - - powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses - - block: Fix fsync always failed if once failed - - bpftool: Remove inclusion of utilities.mak from Makefiles - - xdp: check prog type before updating BPF link - - perf evsel: Override attr->sample_period for non-libpfm4 events - - ipv4: update fib_info_cnt under spinlock protection - - ipv4: avoid quadratic behavior in netns dismantle - - net/fsl: xgmac_mdio: Add workaround for erratum A-009885 - - net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module - - parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries - - f2fs: compress: fix potential deadlock of compress file - - f2fs: fix to reserve space for IO align feature - - af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress - - clk: Emit a stern warning with writable debugfs enabled - - clk: si5341: Fix clock HW provider cleanup - - net/smc: Fix hung_task when removing SMC-R devices - - net: axienet: increase reset timeout - - net: axienet: Wait for PhyRstCmplt after core reset - - net: axienet: reset core on initialization prior to MDIO access - - net: axienet: add missing memory barriers - - net: axienet: limit minimum TX ring size - - net: axienet: Fix TX ring slot available check - - net: axienet: fix number of TX ring slots for available check - - net: axienet: fix for TX busy handling - - net: axienet: increase default TX ring size to 128 - - HID: vivaldi: fix handling devices not using numbered reports - - rtc: pxa: fix null pointer dereference - - vdpa/mlx5: Fix wrong configuration of virtio_version_1_0 - - virtio_ring: mark ring unused on error - - taskstats: Cleanup the use of task->exit_code - - inet: frags: annotate races around fqdir->dead and fqdir->high_thresh - - netns: add schedule point in ops_exit_list() - - xfrm: Don't accidentally set RTO_ONLINK in decode_session4() - - gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst() - - libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route() - - perf script: Fix hex dump character output - - dmaengine: at_xdmac: Don't start transactions at tx_submit level - - dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending - - dmaengine: at_xdmac: Print debug message after realeasing the lock - - dmaengine: at_xdmac: Fix concurrency over xfers_list - - dmaengine: at_xdmac: Fix lld view setting - - dmaengine: at_xdmac: Fix at_xdmac_lld struct definition - - perf probe: Fix ppc64 'perf probe add events failed' case - - devlink: Remove misleading internal_flags from health reporter dump - - arm64: dts: qcom: msm8996: drop not documented adreno properties - - net: bonding: fix bond_xmit_broadcast return value error bug - - net_sched: restore "mpu xxx" handling - - bcmgenet: add WOL IRQ check - - net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() - - net: sfp: fix high power modules without diagnostic monitoring - - net: mscc: ocelot: fix using match before it is set - - dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property - - dt-bindings: display: meson-vpu: Add missing amlogic,canvas property - - dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 - - scripts/dtc: dtx_diff: remove broken example from help text - - lib82596: Fix IRQ check in sni_82596_probe - - mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault - - lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test - - mtd: nand: bbt: Fix corner case in bad block table handling - - ath10k: Fix the MTU size on QCA9377 SDIO - - scripts: sphinx-pre-install: add required ctex dependency - - scripts: sphinx-pre-install: Fix ctex support on Debian - - KVM: x86/mmu: Fix write-protection of PTs mapped by the TDP MMU - - HID: Ignore battery for Elan touchscreen on HP Envy X360 15t-dr100 - - f2fs: fix to do sanity check on inode type during garbage collection - - mtd: rawnand: Export nand_read_page_hwecc_oob_first() - - mtd: rawnand: ingenic: JZ4740 needs 'oob_first' read page function - - riscv: Get rid of MAXPHYSMEM configs - - RISC-V: Use common riscv_cpuid_to_hartid_mask() for both SMP=y and SMP=n - - riscv: try to allocate crashkern region from 32bit addressible memory - - riscv: Don't use va_pa_offset on kdump - - riscv: use hart id instead of cpu id on machine_kexec - - crypto: x86/aesni - don't require alignment of data - - net: phy: marvell: add Marvell specific PHY loopback - - media: cec: fix a deadlock situation - - media: ov8865: Disable only enabled regulators on error path - - mei: hbm: fix client dma reply status - - iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046 - - bus: mhi: pci_generic: Graceful shutdown on freeze - - bus: mhi: core: Fix reading wake_capable channel configuration - - arm64: errata: Fix exec handling in erratum 1418040 workaround - - drm/tegra: Add back arm_iommu_detach_device() - - virtio/virtio_mem: handle a possible NULL as a memcpy parameter - - Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() - - drm/vc4: crtc: Make sure the HDMI controller is powered when disabling - - libbpf: Free up resources used by inner map definition - - bpftool: Fix memory leak in prog_dump() - - arm64: dts: qcom: sc7280: Fix incorrect clock name - - libbpf: Fix glob_syms memory leak in bpf_linker - - libbpf: Fix using invalidated memory in bpf_linker - - bfq: Do not let waker requests skip proper accounting - - media: i2c: imx274: fix s_frame_interval runtime resume not requested - - media: i2c: Re-order runtime pm initialisation - - media: i2c: ov8865: Fix lockdep error - - net: stmmac: Add platform level debug register dump feature - - drm/vmwgfx: Remove the deprecated lower mem limit - - crypto: caam - save caam memory to support crypto engine retry mechanism. - - arm64: dts: ti: k3-am642: Fix the L2 cache sets - - bpf: Fix the test_task_vma selftest to support output shorter than 1 kB - - Bluetooth: refactor set_exp_feature with a feature table - - Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag - - drm/amd/display: Fix bug in debugfs crc_win_update entry - - wcn36xx: Fix max channels retrieval - - perf/arm-cmn: Fix CPU hotplug unregistration - - net: dsa: hellcreek: Fix insertion of static FDB entries - - net: dsa: hellcreek: Add STP forwarding rule - - net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports - - net: dsa: hellcreek: Add missing PTP via UDP rules - - mt76: mt7921: drop offload_flags overwritten - - iwlwifi: mvm: perform 6GHz passive scan after suspend - - iwlwifi: mvm: set protected flag only for NDP ranging - - crypto: octeontx2 - prevent underflow in get_cores_bmap() - - regulator: qcom-labibb: OCP interrupts are not a failure while disabled - - io_uring: remove double poll on poll update - - serial: 8250_bcm7271: Propagate error codes from brcmuart_probe() - - net: ethernet: mtk_eth_soc: fix return values and refactor MDIO ops - - net: dsa: fix incorrect function pointer check for MRP ring roles - - net/smc: Reset conn->lgr when link group registration fails - - usb: dwc2: do not gate off the hardware if it does not support clock gating - - serial: liteuart: fix MODULE_ALIAS - - serial: stm32: move tx dma terminate DMA to shutdown - - x86, sched: Fix undefined reference to init_freq_invariance_cppc() build - error - - net/mlx5e: Fix wrong usage of fib_info_nh when routes with nexthop objects - are used - - Revert "net/mlx5e: Block offload of outer header csum for GRE tunnel" - - net/mlx5e: Fix matching on modified inner ip_ecn bits - - net/mlx5: Fix access to sf_dev_table on allocation failure - - net/mlx5e: Sync VXLAN udp ports during uplink representor profile change - - net: mscc: ocelot: fix incorrect balancing with down LAG ports - - net/sched: flow_dissector: Fix matching on zone id for invalid conns - - net: openvswitch: Fix matching zone id for invalid conns arriving from tc - - net: openvswitch: Fix ct_state nat flags for conns arriving from tc - - bnxt_en: Refactor coredump functions - - RDMA/rtrs-clt: Fix the initial value of min_latency - - ALSA: hda: Make proper use of timecounter - - binder: avoid potential data leakage when copying txn - - scsi: core: Fix scsi_device_max_queue_depth() - - iommu/amd: X2apic mode: re-enable after resume - - iommu/amd: X2apic mode: setup the INTX registers on mask/unmask - - iommu/amd: X2apic mode: mask/unmask interrupts on suspend/resume - - iommu/amd: Remove useless irq affinity notifier - - phy: cadence: Sierra: Fix to get correct parent for mux clocks - - ALSA: hda/cs8409: Increase delay during jack detection - - ALSA: hda/cs8409: Fix Jack detection after resume - - clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled - - of/fdt: Don't worry about non-memory region overlap for no-map - - drm/panel: Delete panel on mipi_dsi_attach() failure - - selftests/bpf: Fix memory leaks in btf_type_c_dump() helper - - media: atomisp: check before deference asd variable - - usb: dwc3: meson-g12a: fix shared reset control use - - psi: Fix PSI_MEM_FULL state when tasks are in memstall and doing reclaim - - HID: magicmouse: Report battery level over USB - - libbpf: Accommodate DWARF/compiler bug with duplicated structs - - ethernet: renesas: Use div64_ul instead of do_div - - arm64: dts: qcom: sm8350: Shorten camera-thermal-bottom name - - drm/amd/display: add else to avoid double destroy clk_mgr - - regulator: da9121: Prevent current limit change when enabled - - drm/vmwgfx: Release ttm memory if probe fails - - arm64: dts: ti: j721e-main: Fix 'dtbs_check' in serdes_ln_ctrl node - - media: atomisp: fix "variable dereferenced before check 'asd'" - - arm64: dts: renesas: Fix thermal bindings - - ARM: dts: qcom: sdx55: fix IPA interconnect definitions - - media: rockchip: rkisp1: use device name for debugfs subdir name - - mmc: tmio: reinit card irqs in reset routine - - drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV - - drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV - - crypto: ccp - Move SEV_INIT retry for corrupted data - - mt76: mt7615: fix possible deadlock while mt7615_register_ext_phy() - - mt76: mt7615: improve wmm index allocation - - ath9k_htc: fix NULL pointer dereference at ath9k_htc_rxep() - - ath9k_htc: fix NULL pointer dereference at ath9k_htc_tx_get_packet() - - iwlwifi: mvm: fix AUX ROC removal - - mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms - - mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling - - ACPI: CPPC: Check present CPUs for determining _CPC is valid - - bpf/selftests: Fix namespace mount setup in tc_redirect - - serial: pl011: Drop CR register reset on set_termios - - net/mlx5: Update log_max_qp value to FW max capability - - ASoC: imx-hdmi: add put_device() after of_find_device_by_node() - - interconnect: qcom: rpm: Prevent integer overflow in rate - - scsi: ufs: Fix a kernel crash during shutdown - - scsi: lpfc: Fix leaked lpfc_dmabuf mbox allocations with NPIV - - selftests/powerpc: Add a test of sigreturning to the kernel - - scsi: mpi3mr: Fixes around reply request queues - - ASoC: mediatek: mt8192-mt6359: fix device_node leak - - seg6: export get_srh() for ICMP handling - - icmp: ICMPV6: Examine invoking packet for Segment Route Headers. - - udp6: Use Segment Routing Header for dest address if present - - ifcvf/vDPA: fix misuse virtio-net device config size for blk dev - - tpm: fix potential NULL pointer access in tpm_del_char_device - - mfd: tps65910: Set PWR_OFF bit during driver probe - - sched/cpuacct: Fix user/system in shown cpuacct.usage* - - tracing: Have syscall trace events use trace_event_buffer_lock_reserve() - - remoteproc: imx_rproc: Fix a resource leak in the remove function - - drm/amd/display: Fix the uninitialized variable in enable_stream_features() - - scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance - - drm/amdgpu: don't do resets on APUs which don't support it - - ath11k: qmi: avoid error messages when dma allocation fails - - scsi: ufs: ufs-mediatek: Fix error checking in ufs_mtk_init_va09_pwr_ctrl() - - RDMA/cma: Remove open coding of overflow checking for private_data_len - - dmaengine: idxd: fix wq settings post wq disable - - drm/vc4: crtc: Drop feed_txp from state - - drm/vc4: Fix non-blocking commit getting stuck forever - - drm/vc4: crtc: Copy assigned channel to the CRTC - - bpf: Mark PTR_TO_FUNC register initially with zero offset - - mlx5: Don't accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() - - riscv: dts: microchip: mpfs: Drop empty chosen node - - drm/vmwgfx: Remove unused compile options - - f2fs: fix remove page failed in invalidate compress pages - - f2fs: fix to avoid panic in is_alive() if metadata is inconsistent - - crypto: octeontx2 - uninitialized variable in kvf_limits_store() - - gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe - - bitops: protect find_first_{,zero}_bit properly - - net: ipa: fix atomic update in ipa_endpoint_replenish() - - net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account - - net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices - - sch_api: Don't skip qdisc attach on ingress - * Packaging resync (LP: #1786013) - - [Packaging] resync dkms-build{,--nvidia-N} from LRMv5 - - -- Ian May Tue, 22 Mar 2022 17:02:49 -0500 + -- Ian May Thu, 24 Mar 2022 13:53:42 -0500 linux-aws (5.13.0-1019.21) impish; urgency=medium diff -u linux-aws-5.13-5.13.0/debian.aws/tracking-bug linux-aws-5.13-5.13.0/debian.aws/tracking-bug --- linux-aws-5.13-5.13.0/debian.aws/tracking-bug +++ linux-aws-5.13-5.13.0/debian.aws/tracking-bug @@ -1 +1 @@ -1965333 2022.03.21-1 +1966224 2022.02.21-8 diff -u linux-aws-5.13-5.13.0/debian.master/changelog linux-aws-5.13-5.13.0/debian.master/changelog --- linux-aws-5.13-5.13.0/debian.master/changelog +++ linux-aws-5.13-5.13.0/debian.master/changelog @@ -1,899 +1,15 @@ -linux (5.13.0-38.43) impish; urgency=medium +linux (5.13.0-39.44) impish; urgency=medium - * impish/linux: 5.13.0-38.43 -proposed tracker (LP: #1965347) + * impish/linux: 5.13.0-39.44 -proposed tracker (LP: #1966236) - * PS/2 Keyboard wakeup from s2idle not functioning on AMD Yellow Carp platform - (LP: #1961739) - - PM: s2idle: ACPI: Fix wakeup interrupts handling + * CVE-2022-27666 + - sock: remove one redundant SKB_FRAG_PAGE_ORDER macro + - esp: Fix possible buffer overflow in ESP transformation - * Low RX performance for 40G Solarflare NICs (LP: #1964512) - - SAUCE: sfc: The size of the RX recycle ring should be more flexible + * CVE-2022-1055 + - net: sched: fix use-after-free in tc_new_tfilter() - * [UBUNTU 20.04] Fix SIGP processing on KVM/s390 (LP: #1962578) - - KVM: s390: Simplify SIGP Set Arch handling - - KVM: s390: Add a routine for setting userspace CPU state - - * Move virtual graphics drivers from linux-modules-extra to linux-modules - (LP: #1960633) - - [Packaging] Move VM DRM drivers into modules - - * Impish update: upstream stable patchset 2022-03-09 (LP: #1964422) - - bnx2x: Utilize firmware 7.13.21.0 - - bnx2x: Invalidate fastpath HSI version for VFs - - rcu: Tighten rcu_advance_cbs_nowake() checks - - select: Fix indefinitely sleeping task in poll_schedule_timeout() - - drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 - - arm64/bpf: Remove 128MB limit for BPF JIT programs - - Bluetooth: refactor malicious adv data check - - net: sfp: ignore disabled SFP node - - net: stmmac: skip only stmmac_ptp_register when resume from suspend - - s390/hypfs: include z/VM guests with access control group set - - bpf: Guard against accessing NULL pt_regs in bpf_get_task_stack() - - scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP - devices - - udf: Restore i_lenAlloc when inode expansion fails - - udf: Fix NULL ptr deref when converting from inline format - - efi: runtime: avoid EFIv2 runtime services on Apple x86 machines - - PM: wakeup: simplify the output logic of pm_show_wakelocks() - - tracing/histogram: Fix a potential memory leak for kstrdup() - - tracing: Don't inc err_log entry count if entry allocation fails - - ceph: properly put ceph_string reference after async create attempt - - ceph: set pool_ns in new inode layout for async creates - - fsnotify: fix fsnotify hooks in pseudo filesystems - - Revert "KVM: SVM: avoid infinite loop on NPF from bad address" - - perf/x86/intel/uncore: Fix CAS_COUNT_WRITE issue for ICX - - drm/etnaviv: relax submit size limits - - KVM: x86: Update vCPU's runtime CPUID on write to MSR_IA32_XSS - - netfilter: nft_payload: do not update layer 4 checksum when mangling - fragments - - serial: 8250: of: Fix mapped region size when using reg-offset property - - serial: stm32: fix software flow control transfer - - tty: n_gsm: fix SW flow control encoding/handling - - tty: Add support for Brainboxes UC cards. - - usb-storage: Add unusual-devs entry for VL817 USB-SATA bridge - - usb: xhci-plat: fix crash when suspend if remote wake enable - - usb: common: ulpi: Fix crash in ulpi_match() - - usb: gadget: f_sourcesink: Fix isoc transfer for USB_SPEED_SUPER_PLUS - - USB: core: Fix hang in usb_kill_urb by adding memory barriers - - usb: typec: tcpm: Do not disconnect while receiving VBUS off - - ucsi_ccg: Check DEV_INT bit only when starting CCG4 - - jbd2: export jbd2_journal_[grab|put]_journal_head - - ocfs2: fix a deadlock when commit trans - - sched/membarrier: Fix membarrier-rseq fence command missing from query - bitmask - - x86/MCE/AMD: Allow thresholding interface updates after init - - powerpc/32s: Allocate one 256k IBAT instead of two consecutives 128k IBATs - - powerpc/32s: Fix kasan_init_region() for KASAN - - powerpc/32: Fix boot failure with GCC latent entropy plugin - - i40e: Increase delay to 1 s after global EMP reset - - i40e: Fix issue when maximum queues is exceeded - - i40e: Fix queues reservation for XDP - - i40e: Fix for failed to init adminq while VF reset - - i40e: fix unsigned stat widths - - usb: roles: fix include/linux/usb/role.h compile issue - - rpmsg: char: Fix race between the release of rpmsg_ctrldev and cdev - - rpmsg: char: Fix race between the release of rpmsg_eptdev and cdev - - scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put() - - ipv6_tunnel: Rate limit warning messages - - net: fix information leakage in /proc/net/ptype - - hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649 - - hwmon: (lm90) Mark alert as broken for MAX6680 - - ping: fix the sk_bound_dev_if match in ping_lookup - - ipv4: avoid using shared IP generator for connected sockets - - hwmon: (lm90) Reduce maximum conversion rate for G781 - - NFSv4: Handle case where the lookup of a directory fails - - NFSv4: nfs_atomic_open() can race when looking up a non-regular file - - net-procfs: show net devices bound packet types - - drm/msm: Fix wrong size calculation - - drm/msm/dsi: Fix missing put_device() call in dsi_get_phy - - drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable - - ipv6: annotate accesses to fn->fn_sernum - - NFS: Ensure the server has an up to date ctime before hardlinking - - NFS: Ensure the server has an up to date ctime before renaming - - powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 - - netfilter: conntrack: don't increment invalid counter on NF_REPEAT - - perf: Fix perf_event_read_local() time - - sched/pelt: Relax the sync of util_sum with util_avg - - net: phy: broadcom: hook up soft_reset for BCM54616S - - phylib: fix potential use-after-free - - octeontx2-pf: Forward error codes to VF - - rxrpc: Adjust retransmission backoff - - efi/libstub: arm64: Fix image check alignment at entry - - hwmon: (lm90) Mark alert as broken for MAX6654 - - powerpc/perf: Fix power_pmu_disable to call clear_pmi_irq_pending only if - PMI is pending - - net: ipv4: Move ip_options_fragment() out of loop - - net: ipv4: Fix the warning for dereference - - ipv4: fix ip option filtering for locally generated fragments - - ibmvnic: init ->running_cap_crqs early - - ibmvnic: don't spin in tasklet - - video: hyperv_fb: Fix validation of screen resolution - - drm/msm/hdmi: Fix missing put_device() call in msm_hdmi_get_phy - - drm/msm/dpu: invalid parameter check in dpu_setup_dspp_pcc - - yam: fix a memory leak in yam_siocdevprivate() - - net: cpsw: Properly initialise struct page_pool_params - - net: hns3: handle empty unknown interrupt for VF - - Revert "ipv6: Honor all IPv6 PIO Valid Lifetime values" - - net: bridge: vlan: fix single net device option dumping - - ipv4: raw: lock the socket in raw_bind() - - ipv4: tcp: send zero IPID in SYNACK messages - - ipv4: remove sparse error in ip_neigh_gw4() - - net: bridge: vlan: fix memory leak in __allowed_ingress - - dt-bindings: can: tcan4x5x: fix mram-cfg RX FIFO config - - usr/include/Makefile: add linux/nfc.h to the compile-test coverage - - fsnotify: invalidate dcache before IN_DELETE event - - block: Fix wrong offset in bio_truncate() - - mtd: rawnand: mpc5121: Remove unused variable in ads5121_select_chip() - - net: stmmac: configure PTP clock source prior to PTP initialization - - KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE - - s390/nmi: handle guarded storage validity failures for KVM guests - - powerpc32/bpf: Fix codegen for bpf-to-bpf calls - - powerpc/bpf: Update ldimm64 instructions during extra pass - - psi: Fix uaf issue when psi trigger is destroyed while being polled - - perf/x86/intel: Add a quirk for the calculation of the number of counters on - Alder Lake - - drm/atomic: Add the crtc to affected crtc only if uapi.enable = true - - KVM: SVM: Never reject emulation due to SMAP errata for !SEV guests - - KVM: x86: Keep MSR_IA32_XSS unchanged for INIT - - KVM: x86: Sync the states size with the XCR0/IA32_XSS at, any time - - tty: Partially revert the removal of the Cyclades public API - - usb: cdnsp: Fix segmentation fault in cdns_lost_power function - - usb: dwc3: xilinx: Skip resets and USB3 register settings for USB2.0 mode - - usb: dwc3: xilinx: Fix error handling when getting USB3 PHY - - usb: typec: tcpci: don't touch CC line if it's Vconn source - - usb: typec: tcpm: Do not disconnect when receiving VSAFE0V - - mm, kasan: use compare-exchange operation to set KASAN page tag - - PCI/sysfs: Find shadow ROM before static attribute initialization - - x86/cpu: Add Xeon Icelake-D to list of CPUs that support PPIN - - ARM: 9170/1: fix panic when kasan and kprobe are enabled - - net: stmmac: dwmac-visconti: Fix bit definitions for ETHER_CLK_SEL - - net: stmmac: dwmac-visconti: Fix clock configuration for RMII mode - - octeontx2-af: cn10k: Do not enable RPM loopback for LPC interfaces - - io_uring: fix bug in slow unregistering of nodes - - ibmvnic: Allow extra failures before disabling - - net/smc: Transitional solution for clcsock race issue - - can: tcan4x5x: regmap: fix max register value - - drm/msm/a6xx: Add missing suspend_count increment - - sch_htb: Fail on unsupported parameters when offload is requested - - Revert "drm/ast: Support 1600x900 with 108MHz PCLK" - - irqchip/realtek-rtl: Map control data to virq - - irqchip/realtek-rtl: Fix off-by-one in routing - - perf/core: Fix cgroup event list management - - psi: fix "no previous prototype" warnings when CONFIG_CGROUPS=n - - psi: fix "defined but not used" warnings when CONFIG_PROC_FS=n - - * Impish update: upstream stable patchset 2022-02-24 (LP: #1962230) - - KVM: VMX: switch blocked_vcpu_on_cpu_lock to raw spinlock - - HID: uhid: Fix worker destroying device without any protection - - HID: wacom: Avoid using stale array indicies to read contact count - - f2fs: fix to do sanity check in is_alive() - - nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed - bind() - - mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings - - mtd: rawnand: gpmi: Remove explicit default gpmi clock setting for i.MX6 - - mtd: Fixed breaking list in __mtd_del_partition. - - mtd: rawnand: davinci: Don't calculate ECC when reading page - - mtd: rawnand: davinci: Avoid duplicated page read - - mtd: rawnand: davinci: Rewrite function description - - x86/gpu: Reserve stolen memory for first integrated Intel GPU - - tools/nolibc: x86-64: Fix startup code bug - - tools/nolibc: i386: fix initial stack alignment - - tools/nolibc: fix incorrect truncation of exit code - - rtc: cmos: take rtc_lock while reading from CMOS - - media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE - - media: flexcop-usb: fix control-message timeouts - - media: mceusb: fix control-message timeouts - - media: em28xx: fix control-message timeouts - - media: cpia2: fix control-message timeouts - - media: s2255: fix control-message timeouts - - media: dib0700: fix undefined behavior in tuner shutdown - - media: redrat3: fix control-message timeouts - - media: pvrusb2: fix control-message timeouts - - media: stk1160: fix control-message timeouts - - media: cec-pin: fix interrupt en/disable handling - - can: softing_cs: softingcs_probe(): fix memleak on registration failure - - iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs - - lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() - - iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure - - gpu: host1x: Add back arm_iommu_detach_device() - - dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() - - PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller - - mm_zone: add function to check if managed dma zone exists - - dma/pool: create dma atomic pool only if dma zone has managed pages - - mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed - pages - - shmem: fix a race between shmem_unused_huge_shrink and shmem_evict_inode - - drm/ttm: Put BO in its memory manager's lru list - - Bluetooth: L2CAP: Fix not initializing sk_peer_pid - - drm/bridge: display-connector: fix an uninitialized pointer in probe() - - drm: fix null-ptr-deref in drm_dev_init_release() - - drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure - - drm/panel: innolux-p079zca: Delete panel on attach() failure - - drm/rockchip: dsi: Fix unbalanced clock on probe error - - drm/rockchip: dsi: Hold pm-runtime across bind/unbind - - drm/rockchip: dsi: Disable PLL clock on bind error - - drm/rockchip: dsi: Reconfigure hardware on resume() - - Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails - - clk: bcm-2835: Pick the closest clock rate - - clk: bcm-2835: Remove rounding up the dividers - - drm/vc4: hdmi: Set a default HSM rate - - wcn36xx: ensure pairing of init_scan/finish_scan and start_scan/end_scan - - wcn36xx: Indicate beacon not connection loss on MISSED_BEACON_IND - - wcn36xx: Fix DMA channel enable/disable cycle - - wcn36xx: Release DMA channel descriptor allocations - - wcn36xx: Put DXE block into reset before freeing memory - - wcn36xx: populate band before determining rate on RX - - wcn36xx: fix RX BD rate mapping for 5GHz legacy rates - - ath11k: Send PPDU_STATS_CFG with proper pdev mask to firmware - - mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init() - - media: videobuf2: Fix the size printk format - - media: atomisp: add missing media_device_cleanup() in - atomisp_unregister_entities() - - media: atomisp: fix punit_ddr_dvfs_enable() argument for mrfld_power up case - - media: atomisp: fix inverted logic in buffers_needed() - - media: atomisp: do not use err var when checking port validity for ISP2400 - - media: atomisp: fix inverted error check for - ia_css_mipi_is_source_port_valid() - - media: atomisp: fix ifdefs in sh_css.c - - media: staging: media: atomisp: pci: Balance braces around conditional - statements in file atomisp_cmd.c - - media: atomisp: add NULL check for asd obtained from atomisp_video_pipe - - media: atomisp: fix enum formats logic - - media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() - - media: aspeed: fix mode-detect always time out at 2nd run - - media: em28xx: fix memory leak in em28xx_init_dev - - media: aspeed: Update signal status immediately to ensure sane hw state - - arm64: dts: amlogic: meson-g12: Fix GPU operating point table node name - - arm64: dts: amlogic: Fix SPI NOR flash node name for ODROID N2/N2+ - - arm64: dts: meson-gxbb-wetek: fix HDMI in early boot - - arm64: dts: meson-gxbb-wetek: fix missing GPIO binding - - fs: dlm: use sk->sk_socket instead of con->sock - - fs: dlm: don't call kernel_getpeername() in error_report() - - memory: renesas-rpc-if: Return error in case devm_ioremap_resource() fails - - Bluetooth: stop proccessing malicious adv data - - ath11k: Fix ETSI regd with weather radar overlap - - ath11k: clear the keys properly via DISABLE_KEY - - ath11k: reset RSN/WPA present state for open BSS - - tee: fix put order in teedev_close_context() - - fs: dlm: fix build with CONFIG_IPV6 disabled - - drm/vboxvideo: fix a NULL vs IS_ERR() check - - arm64: dts: renesas: cat875: Add rx/tx delays - - media: dmxdev: fix UAF when dvb_register_device() fails - - crypto: qce - fix uaf on qce_ahash_register_one - - crypto: qce - fix uaf on qce_skcipher_register_one - - mtd: hyperbus: rpc-if: fix bug in rpcif_hb_remove - - ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding on stm32f429 - disco - - crypto: qat - remove unnecessary collision prevention step in PFVF - - crypto: qat - make pfvf send message direction agnostic - - crypto: qat - fix undetected PFVF timeout in ACK loop - - ath11k: Use host CE parameters for CE interrupts configuration - - arm64: dts: ti: k3-j721e: correct cache-sets info - - tty: serial: atmel: Check return code of dmaengine_submit() - - tty: serial: atmel: Call dma_async_issue_pending() - - mfd: atmel-flexcom: Remove #ifdef CONFIG_PM_SLEEP - - mfd: atmel-flexcom: Use .resume_noirq - - media: rcar-csi2: Correct the selection of hsfreqrange - - media: imx-pxp: Initialize the spinlock prior to using it - - media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() - - media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released - - media: coda: fix CODA960 JPEG encoder buffer overflow - - media: venus: core: Fix a potential NULL pointer dereference in an error - handling path - - media: venus: core: Fix a resource leak in the error handling path of - 'venus_probe()' - - thermal/drivers/imx: Implement runtime PM support - - netfilter: bridge: add support for pppoe filtering - - arm64: dts: qcom: msm8916: fix MMC controller aliases - - cgroup: Trace event cgroup id fields should be u64 - - ACPI: EC: Rework flushing of EC work while suspended to idle - - thermal/drivers/imx8mm: Enable ADC when enabling monitor - - drm/amdgpu: Fix a NULL pointer dereference in - amdgpu_connector_lcd_native_mode() - - drm/radeon/radeon_kms: Fix a NULL pointer dereference in - radeon_driver_open_kms() - - arm64: dts: ti: k3-j7200: Fix the L2 cache sets - - arm64: dts: ti: k3-j721e: Fix the L2 cache sets - - arm64: dts: ti: k3-j7200: Correct the d-cache-sets info - - tty: serial: uartlite: allow 64 bit address - - serial: amba-pl011: do not request memory region twice - - floppy: Fix hang in watchdog when disk is ejected - - staging: rtl8192e: return error code from rtllib_softmac_init() - - staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() - - Bluetooth: btmtksdio: fix resume failure - - sched/fair: Fix detection of per-CPU kthreads waking a task - - sched/fair: Fix per-CPU kthread and wakee stacking for asym CPU capacity - - bpf: Adjust BTF log size limit. - - bpf: Disallow BPF_LOG_KERNEL log level for bpf(BPF_BTF_LOAD) - - bpf: Remove config check to enable bpf support for branch records - - arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 - - media: dib8000: Fix a memleak in dib8000_init() - - media: saa7146: mxb: Fix a NULL pointer dereference in mxb_attach() - - media: si2157: Fix "warm" tuner state detection - - wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma - - sched/rt: Try to restart rt period timer when rt runtime exceeded - - drm/msm/dp: displayPort driver need algorithm rational - - rcu/exp: Mark current CPU as exp-QS in IPI loop second pass - - mwifiex: Fix possible ABBA deadlock - - xfrm: fix a small bug in xfrm_sa_len() - - x86/uaccess: Move variable into switch case statement - - selftests: clone3: clone3: add case CLONE3_ARGS_NO_TEST - - selftests: harness: avoid false negatives if test has no ASSERTs - - crypto: stm32/cryp - fix CTR counter carry - - crypto: stm32/cryp - fix xts and race condition in crypto_engine requests - - crypto: stm32/cryp - check early input data - - crypto: stm32/cryp - fix double pm exit - - crypto: stm32/cryp - fix lrw chaining mode - - crypto: stm32/cryp - fix bugs and crash in tests - - crypto: stm32 - Revert broken pm_runtime_resume_and_get changes - - ath11k: Fix deleting uninitialized kernel timer during fragment cache flush - - ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB sectors - - media: dw2102: Fix use after free - - media: msi001: fix possible null-ptr-deref in msi001_probe() - - media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes - - ath11k: Fix a NULL pointer dereference in ath11k_mac_op_hw_scan() - - arm64: dts: qcom: c630: Fix soundcard setup - - arm64: dts: qcom: ipq6018: Fix gpio-ranges property - - drm/msm/dpu: fix safe status debugfs file - - drm/bridge: ti-sn65dsi86: Set max register for regmap - - drm/tegra: vic: Fix DMA API misuse - - media: hantro: Fix probe func error path - - xfrm: interface with if_id 0 should return error - - xfrm: state and policy should fail if XFRMA_IF_ID 0 - - ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding - - usb: ftdi-elan: fix memory leak on device disconnect - - arm64: dts: marvell: cn9130: add GPIO and SPI aliases - - arm64: dts: marvell: cn9130: enable CP0 GPIO controllers - - ARM: dts: armada-38x: Add generic compatible to UART nodes - - iwlwifi: mvm: fix 32-bit build in FTM - - iwlwifi: mvm: test roc running status bits before removing the sta - - mmc: meson-mx-sdhc: add IRQ check - - mmc: meson-mx-sdio: add IRQ check - - selinux: fix potential memleak in selinux_add_opt() - - um: fix ndelay/udelay defines - - um: virtio_uml: Fix time-travel external time propagation - - Bluetooth: L2CAP: Fix using wrong mode - - bpftool: Enable line buffering for stdout - - backlight: qcom-wled: Validate enabled string indices in DT - - backlight: qcom-wled: Pass number of elements to read to read_u32_array - - backlight: qcom-wled: Fix off-by-one maximum with default num_strings - - backlight: qcom-wled: Override default length with qcom,enabled-strings - - backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion - - backlight: qcom-wled: Respect enabled-strings in set_brightness - - software node: fix wrong node passed to find nargs_prop - - Bluetooth: hci_qca: Stop IBS timer during BT OFF - - x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS - - hwmon: (mr75203) fix wrong power-up delay value - - x86/mce/inject: Avoid out-of-bounds write when setting flags - - ACPI: scan: Create platform device for BCM4752 and LNV4752 ACPI nodes - - pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in - __nonstatic_find_io_region() - - pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in - nonstatic_find_mem_region() - - power: reset: mt6397: Check for null res pointer - - netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() - - bpf: Fix SO_RCVBUF/SO_SNDBUF handling in _bpf_setsockopt(). - - netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone - - ppp: ensure minimum packet size in ppp_write() - - rocker: fix a sleeping in atomic bug - - staging: greybus: audio: Check null pointer - - fsl/fman: Check for null pointer after calling devm_ioremap - - Bluetooth: hci_bcm: Check for error irq - - Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe - - usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe - - HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_get_str_desc - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_huion_init - - HID: hid-uclogic-params: Invalid parameter check in - uclogic_params_frame_init_v1_buttonpad - - debugfs: lockdown: Allow reading debugfs files that are not world readable - - net/mlx5e: Fix page DMA map/unmap attributes - - net/mlx5e: Don't block routes with nexthop objects in SW - - Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels" - - net/mlx5: Set command entry semaphore up once got index free - - lib/mpi: Add the return value check of kcalloc() - - Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() - - spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe - - ax25: uninitialized variable in ax25_setsockopt() - - netrom: fix api breakage in nr_setsockopt() - - regmap: Call regmap_debugfs_exit() prior to _init() - - can: mcp251xfd: add missing newline to printed strings - - tpm: add request_locality before write TPM_INT_ENABLE - - tpm_tis: Fix an error handling path in 'tpm_tis_core_init()' - - can: softing: softing_startstop(): fix set but not used variable warning - - can: xilinx_can: xcan_probe(): check for error irq - - pcmcia: fix setting of kthread task states - - iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing() - - net: mcs7830: handle usb read errors properly - - ext4: avoid trim error on fs with small groups - - ALSA: jack: Add missing rwsem around snd_ctl_remove() calls - - ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls - - ALSA: hda: Add missing rwsem around snd_ctl_remove() calls - - RDMA/bnxt_re: Scan the whole bitmap when checking if "disabling RCFW with - pending cmd-bit" - - RDMA/hns: Validate the pkey index - - scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() - - clk: imx8mn: Fix imx8mn_clko1_sels - - powerpc/prom_init: Fix improper check of prom_getprop() - - ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA - - dt-bindings: thermal: Fix definition of cooling-maps contribution property - - powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an - overflown PMC - - powerpc/32s: Fix shift-out-of-bounds in KASAN init - - clocksource: Reduce clocksource-skew threshold - - clocksource: Avoid accidental unstable marking of clocksources - - ALSA: oss: fix compile error when OSS_DEBUG is enabled - - ALSA: usb-audio: Drop superfluous '0' in Presonus Studio 1810c's ID - - char/mwave: Adjust io port register size - - binder: fix handling of error during copy - - openrisc: Add clone3 ABI wrapper - - iommu/io-pgtable-arm: Fix table descriptor paddr formatting - - scsi: ufs: Fix race conditions related to driver data - - RDMA/qedr: Fix reporting max_{send/recv}_wr attrs - - PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() - - powerpc/powermac: Add additional missing lockdep_register_key() - - RDMA/core: Let ib_find_gid() continue search even after empty entry - - RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry - - ASoC: rt5663: Handle device_property_read_u32_array error codes - - of: unittest: fix warning on PowerPC frame size warning - - of: unittest: 64 bit dma address test requires arch support - - clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system - enter shell - - mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support - - mips: fix Kconfig reference to PHYS_ADDR_T_64BIT - - dmaengine: pxa/mmp: stop referencing config->slave_id - - iommu/amd: Remove iommu_init_ga() - - iommu/amd: Restore GA log/tail pointer on host resume - - ASoC: Intel: catpt: Test dmaengine_submit() result before moving on - - iommu/iova: Fix race between FQ timeout and teardown - - scsi: block: pm: Always set request queue runtime active in - blk_post_runtime_resume() - - phy: uniphier-usb3ss: fix unintended writing zeros to PHY register - - ASoC: samsung: idma: Check of ioremap return value - - misc: lattice-ecp3-config: Fix task hung when firmware load failed - - arm64: tegra: Remove non existent Tegra194 reset - - mips: lantiq: add support for clk_set_parent() - - mips: bcm63xx: add support for clk_set_parent() - - powerpc/xive: Add missing null check after calling kmalloc - - ASoC: fsl_mqs: fix MODULE_ALIAS - - RDMA/cxgb4: Set queue pair state when being queried - - ASoC: fsl_asrc: refine the check of available clock divider - - clk: bm1880: remove kfrees on static allocations - - of: base: Fix phandle argument length mismatch error message - - ARM: dts: omap3-n900: Fix lp5523 for multi color - - Bluetooth: Fix debugfs entry leak in hci_register_dev() - - fs: dlm: filter user dlm messages for kernel locks - - drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y - - selftests/bpf: Fix bpf_object leak in skb_ctx selftest - - ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply - - drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR - - drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR - - media: atomisp: fix try_fmt logic - - media: atomisp: set per-device's default mode - - media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure - - ARM: shmobile: rcar-gen2: Add missing of_node_put() - - batman-adv: allow netlink usage in unprivileged containers - - media: atomisp: handle errors at sh_css_create_isp_params() - - ath11k: Fix crash caused by uninitialized TX ring - - usb: gadget: f_fs: Use stream_open() for endpoint files - - drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L - - HID: apple: Do not reset quirks when the Fn key is not found - - media: b2c2: Add missing check in flexcop_pci_isr: - - EDAC/synopsys: Use the quirk for version instead of ddr version - - ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART - - drm/amd/display: check top_pipe_to_program pointer - - drm/amdgpu/display: set vblank_disable_immediate for DC - - soc: ti: pruss: fix referenced node in error message - - mlxsw: pci: Add shutdown method in PCI driver - - drm/bridge: megachips: Ensure both bridges are probed before registration - - tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown() - - gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use - - HSI: core: Fix return freed object in hsi_new_client - - crypto: jitter - consider 32 LSB for APT - - mwifiex: Fix skb_over_panic in mwifiex_usb_recv() - - rsi: Fix use-after-free in rsi_rx_done_handler() - - rsi: Fix out-of-bounds read in rsi_read_pkt() - - ath11k: Avoid NULL ptr access during mgmt tx cleanup - - media: venus: avoid calling core_clk_setrate() concurrently during - concurrent video sessions - - ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table - - ACPI: Change acpi_device_always_present() into acpi_device_override_status() - - ACPI / x86: Allow specifying acpi_device_override_status() quirks by path - - ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD - win - - arm64: dts: ti: j7200-main: Fix 'dtbs_check' serdes_ln_ctrl node - - usb: uhci: add aspeed ast2600 uhci support - - floppy: Add max size check for user space request - - x86/mm: Flush global TLB when switching to trampoline page-table - - drm: rcar-du: Fix CRTC timings when CMM is used - - media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds. - - media: rcar-vin: Update format alignment constraints - - media: saa7146: hexium_orion: Fix a NULL pointer dereference in - hexium_attach() - - media: m920x: don't use stack on USB reads - - thunderbolt: Runtime PM activate both ends of the device link - - iwlwifi: mvm: synchronize with FW after multicast commands - - iwlwifi: mvm: avoid clearing a just saved session protection id - - ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work - - ath10k: Fix tx hanging - - net-sysfs: update the queue counts in the unregistration path - - net: phy: prefer 1000baseT over 1000baseKX - - gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock - - selftests/ftrace: make kprobe profile testcase description unique - - ath11k: Avoid false DEADLOCK warning reported by lockdep - - x86/mce: Allow instrumentation during task work queueing - - x86/mce: Mark mce_panic() noinstr - - x86/mce: Mark mce_end() noinstr - - x86/mce: Mark mce_read_aux() noinstr - - net: bonding: debug: avoid printing debug logs when bond is not notifying - peers - - bpf: Do not WARN in bpf_warn_invalid_xdp_action() - - HID: quirks: Allow inverting the absolute X/Y values - - media: igorplugusb: receiver overflow should be reported - - media: saa7146: hexium_gemini: Fix a NULL pointer dereference in - hexium_attach() - - mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO - - audit: ensure userspace is penalized the same as the kernel when under - pressure - - arm64: dts: ls1028a-qds: move rtc node to the correct i2c bus - - arm64: tegra: Adjust length of CCPLEX cluster MMIO region - - PM: runtime: Add safety net to supplier device release - - cpufreq: Fix initialization of min and max frequency QoS requests - - usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 - - ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream - - rtw88: 8822c: update rx settings to prevent potential hw deadlock - - PM: AVS: qcom-cpr: Use div64_ul instead of do_div - - iwlwifi: fix leaks/bad data after failed firmware load - - iwlwifi: remove module loading failure message - - iwlwifi: mvm: Fix calculation of frame length - - iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ - - um: registers: Rename function names to avoid conflicts and build problems - - ath11k: Fix napi related hang - - Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES - - xfrm: rate limit SA mapping change message to user space - - drm/etnaviv: consider completed fence seqno in hang check - - jffs2: GC deadlock reading a page that is used in jffs2_write_begin() - - ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions - - ACPICA: Utilities: Avoid deleting the same object twice in a row - - ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() - - ACPICA: Fix wrong interpretation of PCC address - - ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 - - drm/amdgpu: fixup bad vram size on gmc v8 - - amdgpu/pm: Make sysfs pm attributes as read-only for VFs - - ACPI: battery: Add the ThinkPad "Not Charging" quirk - - btrfs: remove BUG_ON() in find_parent_nodes() - - btrfs: remove BUG_ON(!eie) in find_parent_nodes - - net: mdio: Demote probed message to debug print - - mac80211: allow non-standard VHT MCS-10/11 - - dm btree: add a defensive bounds check to insert_at() - - dm space map common: add bounds check to sm_ll_lookup_bitmap() - - mlxsw: pci: Avoid flow control for EMAD packets - - net: phy: marvell: configure RGMII delays for 88E1118 - - net: gemini: allow any RGMII interface mode - - regulator: qcom_smd: Align probe function with rpmh-regulator - - serial: pl010: Drop CR register reset on set_termios - - serial: core: Keep mctrl register state and cached copy in sync - - random: do not throw away excess input to crng_fast_load - - parisc: Avoid calling faulthandler_disabled() twice - - x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs - - powerpc/6xx: add missing of_node_put - - powerpc/powernv: add missing of_node_put - - powerpc/cell: add missing of_node_put - - powerpc/btext: add missing of_node_put - - powerpc/watchdog: Fix missed watchdog reset due to memory ordering race - - i2c: i801: Don't silently correct invalid transfer size - - powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING - - i2c: mpc: Correct I2C reset procedure - - clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB - - powerpc/powermac: Add missing lockdep_register_key() - - KVM: PPC: Book3S: Suppress warnings when allocating too big memory slots - - KVM: PPC: Book3S: Suppress failed alloc warning in H_COPY_TOFROM_GUEST - - w1: Misuse of get_user()/put_user() reported by sparse - - nvmem: core: set size for sysfs bin file - - dm: fix alloc_dax error handling in alloc_dev - - scsi: lpfc: Trigger SLI4 firmware dump before doing driver cleanup - - ALSA: seq: Set upper limit of processed events - - MIPS: Loongson64: Use three arguments for slti - - powerpc/40x: Map 32Mbytes of memory at startup - - selftests/powerpc/spectre_v2: Return skip code when miss_percent is high - - powerpc: handle kdump appropriately with crash_kexec_post_notifiers option - - powerpc/fadump: Fix inaccurate CPU state info in vmcore generated with panic - - udf: Fix error handling in udf_new_inode() - - MIPS: OCTEON: add put_device() after of_find_device_by_node() - - irqchip/gic-v4: Disable redistributors' view of the VPE table at boot time - - i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters - - MIPS: Octeon: Fix build errors using clang - - scsi: sr: Don't use GFP_DMA - - ASoC: mediatek: mt8173: fix device_node leak - - ASoC: mediatek: mt8183: fix device_node leak - - phy: mediatek: Fix missing check in mtk_mipi_tx_probe - - rpmsg: core: Clean up resources on announce_create failure. - - crypto: omap-aes - Fix broken pm_runtime_and_get() usage - - crypto: stm32/crc32 - Fix kernel BUG triggered in probe() - - crypto: caam - replace this_cpu_ptr with raw_cpu_ptr - - ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers - - tpm: fix NPE on probe for missing device - - spi: uniphier: Fix a bug that doesn't point to private data correctly - - xen/gntdev: fix unmap notification order - - fuse: Pass correct lend value to filemap_write_and_wait_range() - - serial: Fix incorrect rs485 polarity on uart open - - cputime, cpuacct: Include guest time in user time in cpuacct.stat - - tracing/kprobes: 'nmissed' not showed correctly for kretprobe - - iwlwifi: mvm: Increase the scan timeout guard to 30 seconds - - s390/mm: fix 2KB pgtable release race - - device property: Fix fwnode_graph_devcon_match() fwnode leak - - drm/etnaviv: limit submit sizes - - drm/nouveau/kms/nv04: use vzalloc for nv04_display - - drm/bridge: analogix_dp: Make PSR-exit block less - - parisc: Fix lpa and lpa_user defines - - powerpc/64s/radix: Fix huge vmap false positive - - PCI: xgene: Fix IB window setup - - PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors - - PCI: pci-bridge-emul: Make expansion ROM Base Address register read-only - - PCI: pci-bridge-emul: Properly mark reserved PCIe bits in PCI config space - - PCI: pci-bridge-emul: Fix definitions of reserved bits - - PCI: pci-bridge-emul: Correctly set PCIe capabilities - - PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device - - xfrm: fix policy lookup for ipv6 gre packets - - btrfs: fix deadlock between quota enable and other quota operations - - btrfs: check the root node for uptodate before returning it - - btrfs: respect the max size in the header when activating swap file - - ext4: make sure to reset inode lockdep class when quota enabling fails - - ext4: make sure quota gets properly shutdown on error - - ext4: fix a possible ABBA deadlock due to busy PA - - ext4: initialize err_blk before calling __ext4_get_inode_loc - - ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE - - ext4: set csum seed in tmp inode while migrating to extents - - ext4: Fix BUG_ON in ext4_bread when write quota data - - ext4: use ext4_ext_remove_space() for fast commit replay delete range - - ext4: fast commit may miss tracking unwritten range during ftruncate - - ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal - - ext4: fix null-ptr-deref in '__ext4_journal_ensure_credits' - - ext4: don't use the orphan list when migrating an inode - - drm/radeon: fix error handling in radeon_driver_open_kms - - of: base: Improve argument length mismatch error - - firmware: Update Kconfig help text for Google firmware - - can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message - - media: rcar-csi2: Optimize the selection PHTW register - - media: correct MEDIA_TEST_SUPPORT help text - - Documentation: dmaengine: Correctly describe dmatest with channel unset - - Documentation: ACPI: Fix data node reference documentation - - Documentation: refer to config RANDOMIZE_BASE for kernel address-space - randomization - - Documentation: fix firewire.rst ABI file path error - - Bluetooth: hci_sync: Fix not setting adv set duration - - scsi: core: Show SCMD_LAST in text form - - dmaengine: uniphier-xdmac: Fix type of address variables - - RDMA/hns: Modify the mapping attribute of doorbell to device - - RDMA/rxe: Fix a typo in opcode name - - dmaengine: stm32-mdma: fix STM32_MDMA_CTBR_TSEL_MASK - - Revert "net/mlx5: Add retry mechanism to the command entry index allocation" - - powerpc/cell: Fix clang -Wimplicit-fallthrough warning - - powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses - - block: Fix fsync always failed if once failed - - bpftool: Remove inclusion of utilities.mak from Makefiles - - xdp: check prog type before updating BPF link - - perf evsel: Override attr->sample_period for non-libpfm4 events - - ipv4: update fib_info_cnt under spinlock protection - - ipv4: avoid quadratic behavior in netns dismantle - - net/fsl: xgmac_mdio: Add workaround for erratum A-009885 - - net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module - - parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries - - f2fs: compress: fix potential deadlock of compress file - - f2fs: fix to reserve space for IO align feature - - af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress - - clk: Emit a stern warning with writable debugfs enabled - - clk: si5341: Fix clock HW provider cleanup - - net/smc: Fix hung_task when removing SMC-R devices - - net: axienet: increase reset timeout - - net: axienet: Wait for PhyRstCmplt after core reset - - net: axienet: reset core on initialization prior to MDIO access - - net: axienet: add missing memory barriers - - net: axienet: limit minimum TX ring size - - net: axienet: Fix TX ring slot available check - - net: axienet: fix number of TX ring slots for available check - - net: axienet: fix for TX busy handling - - net: axienet: increase default TX ring size to 128 - - HID: vivaldi: fix handling devices not using numbered reports - - rtc: pxa: fix null pointer dereference - - vdpa/mlx5: Fix wrong configuration of virtio_version_1_0 - - virtio_ring: mark ring unused on error - - taskstats: Cleanup the use of task->exit_code - - inet: frags: annotate races around fqdir->dead and fqdir->high_thresh - - netns: add schedule point in ops_exit_list() - - xfrm: Don't accidentally set RTO_ONLINK in decode_session4() - - gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst() - - libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route() - - perf script: Fix hex dump character output - - dmaengine: at_xdmac: Don't start transactions at tx_submit level - - dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending - - dmaengine: at_xdmac: Print debug message after realeasing the lock - - dmaengine: at_xdmac: Fix concurrency over xfers_list - - dmaengine: at_xdmac: Fix lld view setting - - dmaengine: at_xdmac: Fix at_xdmac_lld struct definition - - perf probe: Fix ppc64 'perf probe add events failed' case - - devlink: Remove misleading internal_flags from health reporter dump - - arm64: dts: qcom: msm8996: drop not documented adreno properties - - net: bonding: fix bond_xmit_broadcast return value error bug - - net_sched: restore "mpu xxx" handling - - bcmgenet: add WOL IRQ check - - net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() - - net: sfp: fix high power modules without diagnostic monitoring - - net: mscc: ocelot: fix using match before it is set - - dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property - - dt-bindings: display: meson-vpu: Add missing amlogic,canvas property - - dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 - - scripts/dtc: dtx_diff: remove broken example from help text - - lib82596: Fix IRQ check in sni_82596_probe - - mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault - - lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test - - mtd: nand: bbt: Fix corner case in bad block table handling - - ath10k: Fix the MTU size on QCA9377 SDIO - - scripts: sphinx-pre-install: add required ctex dependency - - scripts: sphinx-pre-install: Fix ctex support on Debian - - KVM: x86/mmu: Fix write-protection of PTs mapped by the TDP MMU - - HID: Ignore battery for Elan touchscreen on HP Envy X360 15t-dr100 - - f2fs: fix to do sanity check on inode type during garbage collection - - mtd: rawnand: Export nand_read_page_hwecc_oob_first() - - mtd: rawnand: ingenic: JZ4740 needs 'oob_first' read page function - - riscv: Get rid of MAXPHYSMEM configs - - RISC-V: Use common riscv_cpuid_to_hartid_mask() for both SMP=y and SMP=n - - riscv: try to allocate crashkern region from 32bit addressible memory - - riscv: Don't use va_pa_offset on kdump - - riscv: use hart id instead of cpu id on machine_kexec - - crypto: x86/aesni - don't require alignment of data - - net: phy: marvell: add Marvell specific PHY loopback - - media: cec: fix a deadlock situation - - media: ov8865: Disable only enabled regulators on error path - - mei: hbm: fix client dma reply status - - iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046 - - bus: mhi: pci_generic: Graceful shutdown on freeze - - bus: mhi: core: Fix reading wake_capable channel configuration - - arm64: errata: Fix exec handling in erratum 1418040 workaround - - drm/tegra: Add back arm_iommu_detach_device() - - virtio/virtio_mem: handle a possible NULL as a memcpy parameter - - Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() - - drm/vc4: crtc: Make sure the HDMI controller is powered when disabling - - libbpf: Free up resources used by inner map definition - - bpftool: Fix memory leak in prog_dump() - - arm64: dts: qcom: sc7280: Fix incorrect clock name - - libbpf: Fix glob_syms memory leak in bpf_linker - - libbpf: Fix using invalidated memory in bpf_linker - - bfq: Do not let waker requests skip proper accounting - - media: i2c: imx274: fix s_frame_interval runtime resume not requested - - media: i2c: Re-order runtime pm initialisation - - media: i2c: ov8865: Fix lockdep error - - net: stmmac: Add platform level debug register dump feature - - drm/vmwgfx: Remove the deprecated lower mem limit - - crypto: caam - save caam memory to support crypto engine retry mechanism. - - arm64: dts: ti: k3-am642: Fix the L2 cache sets - - bpf: Fix the test_task_vma selftest to support output shorter than 1 kB - - Bluetooth: refactor set_exp_feature with a feature table - - Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag - - drm/amd/display: Fix bug in debugfs crc_win_update entry - - wcn36xx: Fix max channels retrieval - - perf/arm-cmn: Fix CPU hotplug unregistration - - net: dsa: hellcreek: Fix insertion of static FDB entries - - net: dsa: hellcreek: Add STP forwarding rule - - net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports - - net: dsa: hellcreek: Add missing PTP via UDP rules - - mt76: mt7921: drop offload_flags overwritten - - iwlwifi: mvm: perform 6GHz passive scan after suspend - - iwlwifi: mvm: set protected flag only for NDP ranging - - crypto: octeontx2 - prevent underflow in get_cores_bmap() - - regulator: qcom-labibb: OCP interrupts are not a failure while disabled - - io_uring: remove double poll on poll update - - serial: 8250_bcm7271: Propagate error codes from brcmuart_probe() - - net: ethernet: mtk_eth_soc: fix return values and refactor MDIO ops - - net: dsa: fix incorrect function pointer check for MRP ring roles - - net/smc: Reset conn->lgr when link group registration fails - - usb: dwc2: do not gate off the hardware if it does not support clock gating - - serial: liteuart: fix MODULE_ALIAS - - serial: stm32: move tx dma terminate DMA to shutdown - - x86, sched: Fix undefined reference to init_freq_invariance_cppc() build - error - - net/mlx5e: Fix wrong usage of fib_info_nh when routes with nexthop objects - are used - - Revert "net/mlx5e: Block offload of outer header csum for GRE tunnel" - - net/mlx5e: Fix matching on modified inner ip_ecn bits - - net/mlx5: Fix access to sf_dev_table on allocation failure - - net/mlx5e: Sync VXLAN udp ports during uplink representor profile change - - net: mscc: ocelot: fix incorrect balancing with down LAG ports - - net/sched: flow_dissector: Fix matching on zone id for invalid conns - - net: openvswitch: Fix matching zone id for invalid conns arriving from tc - - net: openvswitch: Fix ct_state nat flags for conns arriving from tc - - bnxt_en: Refactor coredump functions - - RDMA/rtrs-clt: Fix the initial value of min_latency - - ALSA: hda: Make proper use of timecounter - - binder: avoid potential data leakage when copying txn - - scsi: core: Fix scsi_device_max_queue_depth() - - iommu/amd: X2apic mode: re-enable after resume - - iommu/amd: X2apic mode: setup the INTX registers on mask/unmask - - iommu/amd: X2apic mode: mask/unmask interrupts on suspend/resume - - iommu/amd: Remove useless irq affinity notifier - - phy: cadence: Sierra: Fix to get correct parent for mux clocks - - ALSA: hda/cs8409: Increase delay during jack detection - - ALSA: hda/cs8409: Fix Jack detection after resume - - clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled - - of/fdt: Don't worry about non-memory region overlap for no-map - - drm/panel: Delete panel on mipi_dsi_attach() failure - - selftests/bpf: Fix memory leaks in btf_type_c_dump() helper - - media: atomisp: check before deference asd variable - - usb: dwc3: meson-g12a: fix shared reset control use - - psi: Fix PSI_MEM_FULL state when tasks are in memstall and doing reclaim - - HID: magicmouse: Report battery level over USB - - libbpf: Accommodate DWARF/compiler bug with duplicated structs - - ethernet: renesas: Use div64_ul instead of do_div - - arm64: dts: qcom: sm8350: Shorten camera-thermal-bottom name - - drm/amd/display: add else to avoid double destroy clk_mgr - - regulator: da9121: Prevent current limit change when enabled - - drm/vmwgfx: Release ttm memory if probe fails - - arm64: dts: ti: j721e-main: Fix 'dtbs_check' in serdes_ln_ctrl node - - media: atomisp: fix "variable dereferenced before check 'asd'" - - arm64: dts: renesas: Fix thermal bindings - - ARM: dts: qcom: sdx55: fix IPA interconnect definitions - - media: rockchip: rkisp1: use device name for debugfs subdir name - - mmc: tmio: reinit card irqs in reset routine - - drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV - - drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV - - crypto: ccp - Move SEV_INIT retry for corrupted data - - mt76: mt7615: fix possible deadlock while mt7615_register_ext_phy() - - mt76: mt7615: improve wmm index allocation - - ath9k_htc: fix NULL pointer dereference at ath9k_htc_rxep() - - ath9k_htc: fix NULL pointer dereference at ath9k_htc_tx_get_packet() - - iwlwifi: mvm: fix AUX ROC removal - - mmc: sdhci-pci-gli: GL9755: Support for CD/WP inversion on OF platforms - - mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling - - ACPI: CPPC: Check present CPUs for determining _CPC is valid - - bpf/selftests: Fix namespace mount setup in tc_redirect - - serial: pl011: Drop CR register reset on set_termios - - net/mlx5: Update log_max_qp value to FW max capability - - ASoC: imx-hdmi: add put_device() after of_find_device_by_node() - - interconnect: qcom: rpm: Prevent integer overflow in rate - - scsi: ufs: Fix a kernel crash during shutdown - - scsi: lpfc: Fix leaked lpfc_dmabuf mbox allocations with NPIV - - selftests/powerpc: Add a test of sigreturning to the kernel - - scsi: mpi3mr: Fixes around reply request queues - - ASoC: mediatek: mt8192-mt6359: fix device_node leak - - seg6: export get_srh() for ICMP handling - - icmp: ICMPV6: Examine invoking packet for Segment Route Headers. - - udp6: Use Segment Routing Header for dest address if present - - ifcvf/vDPA: fix misuse virtio-net device config size for blk dev - - tpm: fix potential NULL pointer access in tpm_del_char_device - - mfd: tps65910: Set PWR_OFF bit during driver probe - - sched/cpuacct: Fix user/system in shown cpuacct.usage* - - tracing: Have syscall trace events use trace_event_buffer_lock_reserve() - - remoteproc: imx_rproc: Fix a resource leak in the remove function - - drm/amd/display: Fix the uninitialized variable in enable_stream_features() - - scsi: lpfc: Fix lpfc_force_rscn ndlp kref imbalance - - drm/amdgpu: don't do resets on APUs which don't support it - - ath11k: qmi: avoid error messages when dma allocation fails - - scsi: ufs: ufs-mediatek: Fix error checking in ufs_mtk_init_va09_pwr_ctrl() - - RDMA/cma: Remove open coding of overflow checking for private_data_len - - dmaengine: idxd: fix wq settings post wq disable - - drm/vc4: crtc: Drop feed_txp from state - - drm/vc4: Fix non-blocking commit getting stuck forever - - drm/vc4: crtc: Copy assigned channel to the CRTC - - bpf: Mark PTR_TO_FUNC register initially with zero offset - - mlx5: Don't accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() - - riscv: dts: microchip: mpfs: Drop empty chosen node - - drm/vmwgfx: Remove unused compile options - - f2fs: fix remove page failed in invalidate compress pages - - f2fs: fix to avoid panic in is_alive() if metadata is inconsistent - - crypto: octeontx2 - uninitialized variable in kvf_limits_store() - - gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe - - bitops: protect find_first_{,zero}_bit properly - - net: ipa: fix atomic update in ipa_endpoint_replenish() - - net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account - - net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices - - sch_api: Don't skip qdisc attach on ingress - - * Packaging resync (LP: #1786013) - - [Packaging] resync dkms-build{,--nvidia-N} from LRMv5 - - -- Stefan Bader Fri, 18 Mar 2022 11:05:03 +0100 + -- Stefan Bader Thu, 24 Mar 2022 16:24:10 +0100 linux (5.13.0-37.42) impish; urgency=medium diff -u linux-aws-5.13-5.13.0/debian.master/control.d/generic.inclusion-list linux-aws-5.13-5.13.0/debian.master/control.d/generic.inclusion-list --- linux-aws-5.13-5.13.0/debian.master/control.d/generic.inclusion-list +++ linux-aws-5.13-5.13.0/debian.master/control.d/generic.inclusion-list @@ -45,16 +45,11 @@ drivers/firmware/iscsi_ibft.ko drivers/gpio/gpio-max77620.ko drivers/gpu/drm/ast/ast.ko -drivers/gpu/drm/bochs/bochs-drm.ko -drivers/gpu/drm/cirrus/cirrus.ko drivers/gpu/drm/drm.ko drivers/gpu/drm/drm_kms_helper.ko drivers/gpu/drm/tegra/tegra-drm.ko drivers/gpu/drm/ttm/ttm.ko drivers/gpu/drm/vboxvideo/vboxvideo.ko -drivers/gpu/drm/virtio/virtio-gpu.ko -drivers/gpu/drm/vmwgfx/vmwgfx.ko -drivers/gpu/drm/xen/drm_xen_front.ko drivers/gpu/host1x/host1x.ko drivers/hid/hid-generic.ko drivers/hid/hid-hyperv.ko diff -u linux-aws-5.13-5.13.0/debian.master/tracking-bug linux-aws-5.13-5.13.0/debian.master/tracking-bug --- linux-aws-5.13-5.13.0/debian.master/tracking-bug +++ linux-aws-5.13-5.13.0/debian.master/tracking-bug @@ -1 +1 @@ -1965347 2022.03.21-1 +1966236 2022.02.21-8 diff -u linux-aws-5.13-5.13.0/debian.master/upstream-stable linux-aws-5.13-5.13.0/debian.master/upstream-stable --- linux-aws-5.13-5.13.0/debian.master/upstream-stable +++ linux-aws-5.13-5.13.0/debian.master/upstream-stable @@ -3,4 +3,4 @@ - linux-5.10.y = v5.10.96 + linux-5.10.y = v5.10.93 linux-5.13.y = v5.13.19 linux-5.14.y = v5.14.21 - linux-5.15.y = v5.15.19 + linux-5.15.y = v5.15.16 diff -u linux-aws-5.13-5.13.0/debian/changelog linux-aws-5.13-5.13.0/debian/changelog --- linux-aws-5.13-5.13.0/debian/changelog +++ linux-aws-5.13-5.13.0/debian/changelog @@ -1,3 +1,20 @@ +linux-aws-5.13 (5.13.0-1021.23~20.04.1) focal; urgency=medium + + * focal/linux-aws-5.13: 5.13.0-1021.23~20.04.1 -proposed tracker + (LP: #1966223) + + [ Ubuntu: 5.13.0-1021.23 ] + + * impish/linux-aws: 5.13.0-1021.23 -proposed tracker (LP: #1966224) + * impish/linux: 5.13.0-39.44 -proposed tracker (LP: #1966236) + * CVE-2022-27666 + - sock: remove one redundant SKB_FRAG_PAGE_ORDER macro + - esp: Fix possible buffer overflow in ESP transformation + * CVE-2022-1055 + - net: sched: fix use-after-free in tc_new_tfilter() + + -- Tim Gardner Thu, 24 Mar 2022 14:59:01 -0600 + linux-aws-5.13 (5.13.0-1020.22~20.04.1) focal; urgency=medium * focal/linux-aws-5.13: 5.13.0-1020.22~20.04.1 -proposed tracker diff -u linux-aws-5.13-5.13.0/debian/control linux-aws-5.13-5.13.0/debian/control --- linux-aws-5.13-5.13.0/debian/control +++ linux-aws-5.13-5.13.0/debian/control @@ -61,7 +61,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-aws-5.13-headers-5.13.0-1020 +Package: linux-aws-5.13-headers-5.13.0-1021 Build-Profiles: Architecture: all Multi-Arch: foreign @@ -72,46 +72,46 @@ Description: Header files related to Linux kernel version 5.13.0 This package provides kernel header files for version 5.13.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-aws-5.13-headers-5.13.0-1020/debian.README.gz for details + /usr/share/doc/linux-aws-5.13-headers-5.13.0-1021/debian.README.gz for details -Package: linux-aws-5.13-tools-5.13.0-1020 +Package: linux-aws-5.13-tools-5.13.0-1021 Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-tools-common -Description: Linux kernel version specific tools for version 5.13.0-1020 +Description: Linux kernel version specific tools for version 5.13.0-1021 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.13.0-1020 on + version 5.13.0-1021 on 64 bit x86. - You probably want to install linux-tools-5.13.0-1020-. + You probably want to install linux-tools-5.13.0-1021-. -Package: linux-aws-5.13-cloud-tools-5.13.0-1020 +Package: linux-aws-5.13-cloud-tools-5.13.0-1021 Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-cloud-tools-common -Description: Linux kernel version specific cloud tools for version 5.13.0-1020 +Description: Linux kernel version specific cloud tools for version 5.13.0-1021 This package provides the architecture dependant parts for kernel - version locked tools for cloud tools for version 5.13.0-1020 on + version locked tools for cloud tools for version 5.13.0-1021 on 64 bit x86. - You probably want to install linux-cloud-tools-5.13.0-1020-. + You probably want to install linux-cloud-tools-5.13.0-1021-. -Package: linux-image-unsigned-5.13.0-1020-aws +Package: linux-image-unsigned-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional Provides: linux-image, fuse-module, ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.13.0-1020-aws +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.13.0-1021-aws Recommends: grub-pc [amd64] | grub-efi-amd64 [amd64] | grub-efi-ia32 [amd64] | grub [amd64] | lilo [amd64] | grub-efi-arm64 [arm64], initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.13.0-1020-aws -Suggests: fdutils, linux-aws-5.13-doc-5.13.0 | linux-aws-5.13-source-5.13.0, linux-aws-5.13-tools, linux-headers-5.13.0-1020-aws +Conflicts: linux-image-5.13.0-1021-aws +Suggests: fdutils, linux-aws-5.13-doc-5.13.0 | linux-aws-5.13-source-5.13.0, linux-aws-5.13-tools, linux-headers-5.13.0-1021-aws Description: Linux kernel image for version 5.13.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.13.0 on 64 bit x86 SMP. @@ -124,12 +124,12 @@ the linux-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.13.0-1020-aws +Package: linux-modules-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.13.0-1020-aws | linux-image-unsigned-5.13.0-1020-aws +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.13.0-1021-aws | linux-image-unsigned-5.13.0-1021-aws Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.13.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -144,12 +144,12 @@ the linux-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.13.0-1020-aws +Package: linux-modules-extra-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.13.0-1020-aws | linux-image-unsigned-5.13.0-1020-aws, crda | wireless-crda +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.13.0-1021-aws | linux-image-unsigned-5.13.0-1021-aws, crda | wireless-crda Description: Linux kernel extra modules for version 5.13.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.13.0 on 64 bit x86 SMP. @@ -162,21 +162,21 @@ the linux-modules-extra-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.13.0-1020-aws +Package: linux-headers-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-5.13-headers-5.13.0-1020, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-aws-5.13-headers-5.13.0-1021, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.13.0 on 64 bit x86 SMP This package provides kernel header files for version 5.13.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.13.0-1020/debian.README.gz for details. + /usr/share/doc/linux-headers-5.13.0-1021/debian.README.gz for details. -Package: linux-image-unsigned-5.13.0-1020-aws-dbgsym +Package: linux-image-unsigned-5.13.0-1021-aws-dbgsym Build-Profiles: Architecture: amd64 arm64 Section: devel @@ -193,27 +193,27 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.13.0-1020-aws +Package: linux-tools-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-5.13-tools-5.13.0-1020 -Description: Linux kernel version specific tools for version 5.13.0-1020 +Depends: ${misc:Depends}, linux-aws-5.13-tools-5.13.0-1021 +Description: Linux kernel version specific tools for version 5.13.0-1021 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.13.0-1020 on + version 5.13.0-1021 on 64 bit x86. -Package: linux-cloud-tools-5.13.0-1020-aws +Package: linux-cloud-tools-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-5.13-cloud-tools-5.13.0-1020 -Description: Linux kernel version specific cloud tools for version 5.13.0-1020 +Depends: ${misc:Depends}, linux-aws-5.13-cloud-tools-5.13.0-1021 +Description: Linux kernel version specific cloud tools for version 5.13.0-1021 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.13.0-1020 on + version locked tools for cloud for version 5.13.0-1021 on 64 bit x86. Package: linux-udebs-aws @@ -227,7 +227,7 @@ for easier version and migration tracking. -Package: linux-buildinfo-5.13.0-1020-aws +Package: linux-buildinfo-5.13.0-1021-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel diff -u linux-aws-5.13-5.13.0/debian/scripts/dkms-build--nvidia-N linux-aws-5.13-5.13.0/debian/scripts/dkms-build--nvidia-N --- linux-aws-5.13-5.13.0/debian/scripts/dkms-build--nvidia-N +++ linux-aws-5.13-5.13.0/debian/scripts/dkms-build--nvidia-N @@ -50,8 +50,7 @@ # Build helper scripts. cat - <<'EOL' >"$pkgdir/bits/BUILD" -[ "$1" = "unsigned" ] && { signed_only=:; shift; } -[ "$1" = "nocheck" ] && { check_only=:; shift; } +[ "$1" = "unsigned" ] && signed_only=: EOL grep /usr/bin/ld.bfd "$log" | grep -v scripts/genksyms/genksyms | sed -e "s@$build/@@g" >>"$pkgdir/bits/BUILD" sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/CLEAN" @@ -62,9 +61,6 @@ ( cd "$pkgdir/bits" || exit 1 - # Add checksum check. - echo "\$check_only sha256sum -c SHA256SUMS || exit 1" >>"$pkgdir/bits/BUILD" - # Add .ko handling to the CLEAN/BUILD dance. for ko in "$pkgdir"/*.ko do @@ -76,7 +72,7 @@ # Clear out anything we are not going to distribute and build unsigned .kos. sh ./CLEAN - sh ./BUILD unsigned nocheck + sh ./BUILD unsigned if [ "$sign" = "--custom" ]; then # We are building for and archive custom signing upload. Keep everything. reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/exfield.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/acpica/exfield.c @@ -326,7 +326,12 @@ obj_desc->field.base_byte_offset, source_desc->buffer.pointer, data_length); + if ((obj_desc->field.region_obj->region.address == + PCC_MASTER_SUBSPACE + && MASTER_SUBSPACE_COMMAND(obj_desc->field. + base_byte_offset)) + || GENERIC_SUBSPACE_COMMAND(obj_desc->field. + base_byte_offset)) { - if (MASTER_SUBSPACE_COMMAND(obj_desc->field.base_byte_offset)) { /* Perform the write */ reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/exoparg1.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/acpica/exoparg1.c @@ -1007,8 +1007,7 @@ (walk_state, return_desc, &temp_desc); if (ACPI_FAILURE(status)) { + goto cleanup; - return_ACPI_STATUS - (status); } return_desc = temp_desc; diff -u linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwesleep.c linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwesleep.c --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwesleep.c +++ linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwesleep.c @@ -104,9 +104,7 @@ /* Flush caches, as per ACPI specification */ - if (sleep_state < ACPI_STATE_S4) { - ACPI_FLUSH_CPU_CACHE(); - } + ACPI_FLUSH_CPU_CACHE(); status = acpi_os_enter_sleep(sleep_state, sleep_control, 0); if (status == AE_CTRL_TERMINATE) { diff -u linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwsleep.c linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwsleep.c --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwsleep.c +++ linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwsleep.c @@ -110,9 +110,7 @@ /* Flush caches, as per ACPI specification */ - if (sleep_state < ACPI_STATE_S4) { - ACPI_FLUSH_CPU_CACHE(); - } + ACPI_FLUSH_CPU_CACHE(); status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control); if (status == AE_CTRL_TERMINATE) { diff -u linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwxfsleep.c linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwxfsleep.c --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwxfsleep.c +++ linux-aws-5.13-5.13.0/drivers/acpi/acpica/hwxfsleep.c @@ -162,6 +162,8 @@ return_ACPI_STATUS(status); } + ACPI_FLUSH_CPU_CACHE(); + status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, (u32)acpi_gbl_FADT.s4_bios_request, 8); if (ACPI_FAILURE(status)) { reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/acpica/utdelete.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/acpica/utdelete.c @@ -422,7 +422,6 @@ ACPI_WARNING((AE_INFO, "Obj %p, Reference Count is already zero, cannot decrement\n", object)); - return; } ACPI_DEBUG_PRINT_RAW((ACPI_DB_ALLOCATIONS, diff -u linux-aws-5.13-5.13.0/drivers/acpi/battery.c linux-aws-5.13-5.13.0/drivers/acpi/battery.c --- linux-aws-5.13-5.13.0/drivers/acpi/battery.c +++ linux-aws-5.13-5.13.0/drivers/acpi/battery.c @@ -53,7 +53,6 @@ static int battery_notification_delay_ms; static int battery_ac_is_broken; static int battery_check_pmic = 1; -static int battery_quirk_notcharging; static unsigned int cache_time = 1000; module_param(cache_time, uint, 0644); MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); @@ -218,8 +217,6 @@ val->intval = POWER_SUPPLY_STATUS_CHARGING; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; - else if (battery_quirk_notcharging) - val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break; @@ -1114,12 +1111,6 @@ return 0; } -static int __init battery_quirk_not_charging(const struct dmi_system_id *d) -{ - battery_quirk_notcharging = 1; - return 0; -} - static const struct dmi_system_id bat_dmi_table[] __initconst = { { /* NEC LZ750/LS */ @@ -1164,19 +1155,6 @@ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), }, }, - { - /* - * On Lenovo ThinkPads the BIOS specification defines - * a state when the bits for charging and discharging - * are both set to 0. That state is "Not Charging". - */ - .callback = battery_quirk_not_charging, - .ident = "Lenovo ThinkPad", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), - }, - }, {}, }; diff -u linux-aws-5.13-5.13.0/drivers/acpi/bus.c linux-aws-5.13-5.13.0/drivers/acpi/bus.c --- linux-aws-5.13-5.13.0/drivers/acpi/bus.c +++ linux-aws-5.13-5.13.0/drivers/acpi/bus.c @@ -96,8 +96,8 @@ acpi_status status; unsigned long long sta; - if (acpi_device_override_status(device, &sta)) { - acpi_set_device_status(device, sta); + if (acpi_device_always_present(device)) { + acpi_set_device_status(device, ACPI_STA_DEFAULT); return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/cppc_acpi.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/cppc_acpi.c @@ -411,7 +411,7 @@ struct cpc_desc *cpc_ptr; int cpu; + for_each_possible_cpu(cpu) { - for_each_present_cpu(cpu) { cpc_ptr = per_cpu(cpc_desc_ptr, cpu); if (!cpc_ptr) return false; diff -u linux-aws-5.13-5.13.0/drivers/acpi/ec.c linux-aws-5.13-5.13.0/drivers/acpi/ec.c --- linux-aws-5.13-5.13.0/drivers/acpi/ec.c +++ linux-aws-5.13-5.13.0/drivers/acpi/ec.c @@ -166,7 +166,6 @@ struct transaction transaction; struct work_struct work; struct acpi_ec_query_handler *handler; - struct acpi_ec *ec; }; static int acpi_ec_query(struct acpi_ec *ec, u8 *data); @@ -453,7 +452,6 @@ ec_dbg_evt("Command(%s) submitted/blocked", acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); ec->nr_pending_queries++; - ec->events_in_progress++; queue_work(ec_wq, &ec->work); } } @@ -520,7 +518,7 @@ #ifdef CONFIG_PM_SLEEP static void __acpi_ec_flush_work(void) { - flush_workqueue(ec_wq); /* flush ec->work */ + drain_workqueue(ec_wq); /* flush ec->work */ flush_workqueue(ec_query_wq); /* flush queries */ } @@ -1105,7 +1103,7 @@ } EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); -static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval) +static struct acpi_ec_query *acpi_ec_create_query(u8 *pval) { struct acpi_ec_query *q; struct transaction *t; @@ -1113,13 +1111,11 @@ q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL); if (!q) return NULL; - INIT_WORK(&q->work, acpi_ec_event_processor); t = &q->transaction; t->command = ACPI_EC_COMMAND_QUERY; t->rdata = pval; t->rlen = 1; - q->ec = ec; return q; } @@ -1136,21 +1132,13 @@ { struct acpi_ec_query *q = container_of(work, struct acpi_ec_query, work); struct acpi_ec_query_handler *handler = q->handler; - struct acpi_ec *ec = q->ec; ec_dbg_evt("Query(0x%02x) started", handler->query_bit); - if (handler->func) handler->func(handler->data); else if (handler->handle) acpi_evaluate_object(handler->handle, NULL, NULL, NULL); - ec_dbg_evt("Query(0x%02x) stopped", handler->query_bit); - - spin_lock_irq(&ec->lock); - ec->queries_in_progress--; - spin_unlock_irq(&ec->lock); - acpi_ec_delete_query(q); } @@ -1160,7 +1148,7 @@ int result; struct acpi_ec_query *q; - q = acpi_ec_create_query(ec, &value); + q = acpi_ec_create_query(&value); if (!q) return -ENOMEM; @@ -1182,20 +1170,19 @@ } /* - * It is reported that _Qxx are evaluated in a parallel way on Windows: + * It is reported that _Qxx are evaluated in a parallel way on + * Windows: * https://bugzilla.kernel.org/show_bug.cgi?id=94411 * - * Put this log entry before queue_work() to make it appear in the log - * before any other messages emitted during workqueue handling. + * Put this log entry before schedule_work() in order to make + * it appearing before any other log entries occurred during the + * work queue execution. */ ec_dbg_evt("Query(0x%02x) scheduled", value); - - spin_lock_irq(&ec->lock); - - ec->queries_in_progress++; - queue_work(ec_query_wq, &q->work); - - spin_unlock_irq(&ec->lock); + if (!queue_work(ec_query_wq, &q->work)) { + ec_dbg_evt("Query(0x%02x) overlapped", value); + result = -EBUSY; + } err_exit: if (result) @@ -1253,10 +1240,6 @@ ec_dbg_evt("Event stopped"); acpi_ec_check_event(ec); - - spin_lock_irqsave(&ec->lock, flags); - ec->events_in_progress--; - spin_unlock_irqrestore(&ec->lock, flags); } static void acpi_ec_handle_interrupt(struct acpi_ec *ec) @@ -2038,7 +2021,6 @@ bool acpi_ec_dispatch_gpe(void) { - bool work_in_progress; u32 ret; if (!first_ec) @@ -2059,19 +2041,8 @@ if (ret == ACPI_INTERRUPT_HANDLED) pm_pr_dbg("ACPI EC GPE dispatched\n"); - /* Drain EC work. */ - do { - acpi_ec_flush_work(); - - pm_pr_dbg("ACPI EC work flushed\n"); - - spin_lock_irq(&first_ec->lock); - - work_in_progress = first_ec->events_in_progress + - first_ec->queries_in_progress > 0; - - spin_unlock_irq(&first_ec->lock); - } while (work_in_progress && !pm_wakeup_pending()); + /* Flush the event and query workqueues. */ + acpi_ec_flush_work(); return false; } reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/internal.h +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/internal.h @@ -185,8 +185,6 @@ struct work_struct work; unsigned long timestamp; unsigned long nr_pending_queries; - unsigned int events_in_progress; - unsigned int queries_in_progress; bool busy_polling; unsigned int polling_guard; }; diff -u linux-aws-5.13-5.13.0/drivers/acpi/scan.c linux-aws-5.13-5.13.0/drivers/acpi/scan.c --- linux-aws-5.13-5.13.0/drivers/acpi/scan.c +++ linux-aws-5.13-5.13.0/drivers/acpi/scan.c @@ -1611,7 +1611,6 @@ { struct list_head resource_list; bool is_serial_bus_slave = false; - static const struct acpi_device_id ignore_serial_bus_ids[] = { /* * These devices have multiple I2cSerialBus resources and an i2c-client * must be instantiated for each, each with its own i2c_device_id. @@ -1620,18 +1619,11 @@ * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows * which i2c_device_id to use for each resource. */ + static const struct acpi_device_id i2c_multi_instantiate_ids[] = { {"BSG1160", }, {"BSG2150", }, {"INT33FE", }, {"INT3515", }, - /* - * HIDs of device with an UartSerialBusV2 resource for which userspace - * expects a regular tty cdev to be created (instead of the in kernel - * serdev) and which have a kernel driver which expects a platform_dev - * such as the rfkill-gpio driver. - */ - {"BCM4752", }, - {"LNV4752", }, {} }; @@ -1645,7 +1637,8 @@ fwnode_property_present(&device->fwnode, "baud"))) return true; - if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) + /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */ + if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) return false; INIT_LIST_HEAD(&resource_list); reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/sleep.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/sleep.c @@ -767,7 +767,6 @@ return true; } - pm_wakeup_clear(acpi_sci_irq); rearm_wake_irq(acpi_sci_irq); } @@ -874,7 +873,12 @@ #ifdef CONFIG_HIBERNATION static unsigned long s4_hardware_signature; static struct acpi_table_facs *facs; +static bool nosigcheck; + +void __init acpi_no_s4_hw_signature(void) +{ + nosigcheck = true; +} -int acpi_check_s4_hw_signature = -1; /* Default behaviour is just to warn */ static int acpi_hibernation_begin(pm_message_t stage) { @@ -1001,28 +1005,12 @@ hibernation_set_ops(old_suspend_ordering ? &acpi_hibernation_ops_old : &acpi_hibernation_ops); sleep_states[ACPI_STATE_S4] = 1; + if (nosigcheck) - if (!acpi_check_s4_hw_signature) return; acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs); + if (facs) - if (facs) { - /* - * s4_hardware_signature is the local variable which is just - * used to warn about mismatch after we're attempting to - * resume (in violation of the ACPI specification.) - */ s4_hardware_signature = facs->hardware_signature; - - if (acpi_check_s4_hw_signature > 0) { - /* - * If we're actually obeying the ACPI specification - * then the signature is written out as part of the - * swsusp header, in order to allow the boot kernel - * to gracefully decline to resume. - */ - swsusp_hardware_signature = facs->hardware_signature; - } - } } #else /* !CONFIG_HIBERNATION */ static inline void acpi_sleep_hibernate_setup(void) {} reverted: --- linux-aws-5.13-5.13.0/drivers/acpi/x86/utils.c +++ linux-aws-5.13-5.13.0.orig/drivers/acpi/x86/utils.c @@ -22,71 +22,58 @@ * Some BIOS-es (temporarily) hide specific APCI devices to work around Windows * driver bugs. We use DMI matching to match known cases of this. * + * We work around this by always reporting ACPI_STA_DEFAULT for these + * devices. Note this MUST only be done for devices where this is safe. - * Likewise sometimes some not-actually present devices are sometimes - * reported as present, which may cause issues. * + * This forcing of devices to be present is limited to specific CPU (SoC) + * models both to avoid potentially causing trouble on other models and + * because some HIDs are re-used on different SoCs for completely + * different devices. - * We work around this by using the below quirk list to override the status - * reported by the _STA method with a fixed value (ACPI_STA_DEFAULT or 0). - * Note this MUST only be done for devices where this is safe. - * - * This status overriding is limited to specific CPU (SoC) models both to - * avoid potentially causing trouble on other models and because some HIDs - * are re-used on different SoCs for completely different devices. */ +struct always_present_id { -struct override_status_id { struct acpi_device_id hid[2]; struct x86_cpu_id cpu_ids[2]; struct dmi_system_id dmi_ids[2]; /* Optional */ const char *uid; - const char *path; - unsigned long long status; }; +#define X86_MATCH(model) X86_MATCH_INTEL_FAM6_MODEL(model, NULL) + +#define ENTRY(hid, uid, cpu_models, dmi...) { \ -#define ENTRY(status, hid, uid, path, cpu_model, dmi...) { \ { { hid, }, {} }, \ + { cpu_models, {} }, \ - { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ { { .matches = dmi }, {} }, \ uid, \ - path, \ - status, \ } +static const struct always_present_id always_present_ids[] = { -#define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_model, dmi) - -#define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(0, hid, uid, NULL, cpu_model, dmi) - -#define PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ - ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_model, dmi) - -#define NOT_PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ - ENTRY(0, "", NULL, path, cpu_model, dmi) - -static const struct override_status_id override_status_ids[] = { /* * Bay / Cherry Trail PWM directly poked by GPU driver in win10, * but Linux uses a separate PWM driver, harmless if not used. */ + ENTRY("80860F09", "1", X86_MATCH(ATOM_SILVERMONT), {}), + ENTRY("80862288", "1", X86_MATCH(ATOM_AIRMONT), {}), - PRESENT_ENTRY_HID("80860F09", "1", ATOM_SILVERMONT, {}), - PRESENT_ENTRY_HID("80862288", "1", ATOM_AIRMONT, {}), + /* Lenovo Yoga Book uses PWM2 for keyboard backlight control */ + ENTRY("80862289", "2", X86_MATCH(ATOM_AIRMONT), { + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), + }), /* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs. */ + ENTRY("INT0002", "1", X86_MATCH(ATOM_AIRMONT), {}), - PRESENT_ENTRY_HID("INT0002", "1", ATOM_AIRMONT, {}), /* * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides * the touchscreen ACPI device until a certain time * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed * *and* _STA has been called at least 3 times since. */ + ENTRY("SYNA7500", "1", X86_MATCH(HASWELL_L), { - PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"), }), + ENTRY("SYNA7500", "1", X86_MATCH(HASWELL_L), { - PRESENT_ENTRY_HID("SYNA7500", "1", HASWELL_L, { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7139"), }), @@ -94,83 +81,54 @@ /* * The GPD win BIOS dated 20170221 has disabled the accelerometer, the * drivers sometimes cause crashes under Windows and this is how the + * manufacturer has solved this :| Note that the the DMI data is less + * generic then it seems, a board_vendor of "AMI Corporation" is quite + * rare and a board_name of "Default String" also is rare. - * manufacturer has solved this :| The DMI match may not seem unique, - * but it is. In the 67000+ DMI decode dumps from linux-hardware.org - * only 116 have board_vendor set to "AMI Corporation" and of those 116 - * only the GPD win and pocket entries' board_name is "Default string". * * Unfortunately the GPD pocket also uses these strings and its BIOS * was copy-pasted from the GPD win, so it has a disabled KIOX000A * node which we should not enable, thus we also check the BIOS date. */ + ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { - PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "02/21/2017") }), + ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { - PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "03/20/2017") }), + ENTRY("KIOX000A", "1", X86_MATCH(ATOM_AIRMONT), { - PRESENT_ENTRY_HID("KIOX000A", "1", ATOM_AIRMONT, { DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_MATCH(DMI_BOARD_NAME, "Default string"), DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "05/25/2017") }), - - /* - * The GPD win/pocket have a PCI wifi card, but its DSDT has the SDIO - * mmc controller enabled and that has a child-device which _PS3 - * method sets a GPIO causing the PCI wifi card to turn off. - * See above remark about uniqueness of the DMI match. - */ - NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", ATOM_AIRMONT, { - DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), - DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), - DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), - }), }; +bool acpi_device_always_present(struct acpi_device *adev) -bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status) { bool ret = false; unsigned int i; + for (i = 0; i < ARRAY_SIZE(always_present_ids); i++) { + if (acpi_match_device_ids(adev, always_present_ids[i].hid)) - for (i = 0; i < ARRAY_SIZE(override_status_ids); i++) { - if (!x86_match_cpu(override_status_ids[i].cpu_ids)) continue; + if (!adev->pnp.unique_id || + strcmp(adev->pnp.unique_id, always_present_ids[i].uid)) - if (override_status_ids[i].dmi_ids[0].matches[0].slot && - !dmi_check_system(override_status_ids[i].dmi_ids)) continue; + if (!x86_match_cpu(always_present_ids[i].cpu_ids)) + continue; + + if (always_present_ids[i].dmi_ids[0].matches[0].slot && + !dmi_check_system(always_present_ids[i].dmi_ids)) + continue; - if (override_status_ids[i].path) { - struct acpi_buffer path = { ACPI_ALLOCATE_BUFFER, NULL }; - bool match; - - if (acpi_get_name(adev->handle, ACPI_FULL_PATHNAME, &path)) - continue; - - match = strcmp((char *)path.pointer, override_status_ids[i].path) == 0; - kfree(path.pointer); - - if (!match) - continue; - } else { - if (acpi_match_device_ids(adev, override_status_ids[i].hid)) - continue; - - if (!adev->pnp.unique_id || - strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) - continue; - } - *status = override_status_ids[i].status; ret = true; break; } diff -u linux-aws-5.13-5.13.0/drivers/android/binder.c linux-aws-5.13-5.13.0/drivers/android/binder.c --- linux-aws-5.13-5.13.0/drivers/android/binder.c +++ linux-aws-5.13-5.13.0/drivers/android/binder.c @@ -1608,21 +1608,15 @@ /** * binder_get_object() - gets object and checks for valid metadata * @proc: binder_proc owning the buffer - * @u: sender's user pointer to base of buffer * @buffer: binder_buffer that we're parsing. * @offset: offset in the @buffer at which to validate an object. * @object: struct binder_object to read into * - * Copy the binder object at the given offset into @object. If @u is - * provided then the copy is from the sender's buffer. If not, then - * it is copied from the target's @buffer. - * - * Return: If there's a valid metadata object at @offset, the + * Return: If there's a valid metadata object at @offset in @buffer, the * size of that object. Otherwise, it returns zero. The object * is read into the struct binder_object pointed to by @object. */ static size_t binder_get_object(struct binder_proc *proc, - const void __user *u, struct binder_buffer *buffer, unsigned long offset, struct binder_object *object) @@ -1632,16 +1626,10 @@ size_t object_size = 0; read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset); - if (offset > buffer->data_size || read_size < sizeof(*hdr)) + if (offset > buffer->data_size || read_size < sizeof(*hdr) || + binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, + offset, read_size)) return 0; - if (u) { - if (copy_from_user(object, u + offset, read_size)) - return 0; - } else { - if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, - offset, read_size)) - return 0; - } /* Ok, now see if we read a complete object. */ hdr = &object->hdr; @@ -1714,7 +1702,7 @@ b, buffer_offset, sizeof(object_offset))) return NULL; - object_size = binder_get_object(proc, NULL, b, object_offset, object); + object_size = binder_get_object(proc, b, object_offset, object); if (!object_size || object->hdr.type != BINDER_TYPE_PTR) return NULL; if (object_offsetp) @@ -1779,8 +1767,7 @@ unsigned long buffer_offset; struct binder_object last_object; struct binder_buffer_object *last_bbo; - size_t object_size = binder_get_object(proc, NULL, b, - last_obj_offset, + size_t object_size = binder_get_object(proc, b, last_obj_offset, &last_object); if (object_size != sizeof(*last_bbo)) return false; @@ -1895,7 +1882,7 @@ if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, buffer, buffer_offset, sizeof(object_offset))) - object_size = binder_get_object(proc, NULL, buffer, + object_size = binder_get_object(proc, buffer, object_offset, &object); if (object_size == 0) { pr_err("transaction release %d bad object at offset %lld, size %zd\n", @@ -2282,8 +2269,8 @@ if (!ret) ret = binder_translate_fd(fd, offset, t, thread, in_reply_to); - if (ret) - return ret > 0 ? -EINVAL : ret; + if (ret < 0) + return ret; } return 0; } @@ -2468,7 +2455,6 @@ binder_size_t off_start_offset, off_end_offset; binder_size_t off_min; binder_size_t sg_buf_offset, sg_buf_end_offset; - binder_size_t user_offset = 0; struct binder_proc *target_proc = NULL; struct binder_thread *target_thread = NULL; struct binder_node *target_node = NULL; @@ -2482,8 +2468,6 @@ struct binder_context *context = proc->context; int t_debug_id = atomic_inc_return(&binder_last_id); struct lsmcontext lsmctx = { }; - const void __user *user_buffer = (const void __user *) - (uintptr_t)tr->data.ptr.buffer; e = binder_transaction_log_add(&binder_transaction_log); e->debug_id = t_debug_id; @@ -2805,6 +2789,19 @@ if (binder_alloc_copy_user_to_buffer( &target_proc->alloc, + t->buffer, 0, + (const void __user *) + (uintptr_t)tr->data.ptr.buffer, + tr->data_size)) { + binder_user_error("%d:%d got transaction with invalid data ptr\n", + proc->pid, thread->pid); + return_error = BR_FAILED_REPLY; + return_error_param = -EFAULT; + return_error_line = __LINE__; + goto err_copy_data_failed; + } + if (binder_alloc_copy_user_to_buffer( + &target_proc->alloc, t->buffer, ALIGN(tr->data_size, sizeof(void *)), (const void __user *) @@ -2847,7 +2844,6 @@ size_t object_size; struct binder_object object; binder_size_t object_offset; - binder_size_t copy_size; if (binder_alloc_copy_from_buffer(&target_proc->alloc, &object_offset, @@ -2859,27 +2855,8 @@ return_error_line = __LINE__; goto err_bad_offset; } - - /* - * Copy the source user buffer up to the next object - * that will be processed. - */ - copy_size = object_offset - user_offset; - if (copy_size && (user_offset > object_offset || - binder_alloc_copy_user_to_buffer( - &target_proc->alloc, - t->buffer, user_offset, - user_buffer + user_offset, - copy_size))) { - binder_user_error("%d:%d got transaction with invalid data ptr\n", - proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - return_error_param = -EFAULT; - return_error_line = __LINE__; - goto err_copy_data_failed; - } - object_size = binder_get_object(target_proc, user_buffer, - t->buffer, object_offset, &object); + object_size = binder_get_object(target_proc, t->buffer, + object_offset, &object); if (object_size == 0 || object_offset < off_min) { binder_user_error("%d:%d got transaction with invalid offset (%lld, min %lld max %lld) or object.\n", proc->pid, thread->pid, @@ -2891,11 +2868,6 @@ return_error_line = __LINE__; goto err_bad_offset; } - /* - * Set offset to the next buffer fragment to be - * copied - */ - user_offset = object_offset + object_size; hdr = &object.hdr; off_min = object_offset + object_size; @@ -2991,14 +2963,9 @@ } ret = binder_translate_fd_array(fda, parent, t, thread, in_reply_to); - if (!ret) - ret = binder_alloc_copy_to_buffer(&target_proc->alloc, - t->buffer, - object_offset, - fda, sizeof(*fda)); - if (ret) { + if (ret < 0) { return_error = BR_FAILED_REPLY; - return_error_param = ret > 0 ? -EINVAL : ret; + return_error_param = ret; return_error_line = __LINE__; goto err_translate_failed; } @@ -3068,19 +3035,6 @@ goto err_bad_object_type; } } - /* Done processing objects, copy the rest of the buffer */ - if (binder_alloc_copy_user_to_buffer( - &target_proc->alloc, - t->buffer, user_offset, - user_buffer + user_offset, - tr->data_size - user_offset)) { - binder_user_error("%d:%d got transaction with invalid data ptr\n", - proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - return_error_param = -EFAULT; - return_error_line = __LINE__; - goto err_copy_data_failed; - } if (t->buffer->oneway_spam_suspect) tcomplete->type = BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT; else diff -u linux-aws-5.13-5.13.0/drivers/base/core.c linux-aws-5.13-5.13.0/drivers/base/core.c --- linux-aws-5.13-5.13.0/drivers/base/core.c +++ linux-aws-5.13-5.13.0/drivers/base/core.c @@ -473,7 +473,8 @@ /* Ensure that all references to the link object have been dropped. */ device_link_synchronize_removal(); - pm_runtime_release_supplier(link, true); + while (refcount_dec_not_one(&link->rpm_active)) + pm_runtime_put(link->supplier); put_device(link->consumer); put_device(link->supplier); reverted: --- linux-aws-5.13-5.13.0/drivers/base/power/runtime.c +++ linux-aws-5.13-5.13.0.orig/drivers/base/power/runtime.c @@ -305,40 +305,19 @@ return 0; } -/** - * pm_runtime_release_supplier - Drop references to device link's supplier. - * @link: Target device link. - * @check_idle: Whether or not to check if the supplier device is idle. - * - * Drop all runtime PM references associated with @link to its supplier device - * and if @check_idle is set, check if that device is idle (and so it can be - * suspended). - */ -void pm_runtime_release_supplier(struct device_link *link, bool check_idle) -{ - struct device *supplier = link->supplier; - - /* - * The additional power.usage_count check is a safety net in case - * the rpm_active refcount becomes saturated, in which case - * refcount_dec_not_one() would return true forever, but it is not - * strictly necessary. - */ - while (refcount_dec_not_one(&link->rpm_active) && - atomic_read(&supplier->power.usage_count) > 0) - pm_runtime_put_noidle(supplier); - - if (check_idle) - pm_request_idle(supplier); -} - static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend) { struct device_link *link; list_for_each_entry_rcu(link, &dev->links.suppliers, c_node, + device_links_read_lock_held()) { + + while (refcount_dec_not_one(&link->rpm_active)) + pm_runtime_put_noidle(link->supplier); + + if (try_to_suspend) + pm_request_idle(link->supplier); + } - device_links_read_lock_held()) - pm_runtime_release_supplier(link, try_to_suspend); } static void rpm_put_suppliers(struct device *dev) @@ -1776,7 +1755,9 @@ return; pm_runtime_drop_link_count(link->consumer); + + while (refcount_dec_not_one(&link->rpm_active)) + pm_runtime_put(link->supplier); - pm_runtime_release_supplier(link, true); } static bool pm_runtime_need_not_resume(struct device *dev) reverted: --- linux-aws-5.13-5.13.0/drivers/base/power/wakeup.c +++ linux-aws-5.13-5.13.0.orig/drivers/base/power/wakeup.c @@ -34,8 +34,7 @@ bool events_check_enabled __read_mostly; /* First wakeup IRQ seen by the kernel in the last cycle. */ +unsigned int pm_wakeup_irq __read_mostly; -static unsigned int wakeup_irq[2] __read_mostly; -static DEFINE_RAW_SPINLOCK(wakeup_irq_lock); /* If greater than 0 and the system is suspending, terminate the suspend. */ static atomic_t pm_abort_suspend __read_mostly; @@ -943,45 +942,19 @@ atomic_dec_if_positive(&pm_abort_suspend); } +void pm_wakeup_clear(bool reset) -void pm_wakeup_clear(unsigned int irq_number) { + pm_wakeup_irq = 0; + if (reset) - raw_spin_lock_irq(&wakeup_irq_lock); - - if (irq_number && wakeup_irq[0] == irq_number) - wakeup_irq[0] = wakeup_irq[1]; - else - wakeup_irq[0] = 0; - - wakeup_irq[1] = 0; - - raw_spin_unlock_irq(&wakeup_irq_lock); - - if (!irq_number) atomic_set(&pm_abort_suspend, 0); } void pm_system_irq_wakeup(unsigned int irq_number) { + if (pm_wakeup_irq == 0) { + pm_wakeup_irq = irq_number; - unsigned long flags; - - raw_spin_lock_irqsave(&wakeup_irq_lock, flags); - - if (wakeup_irq[0] == 0) - wakeup_irq[0] = irq_number; - else if (wakeup_irq[1] == 0) - wakeup_irq[1] = irq_number; - else - irq_number = 0; - - raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags); - - if (irq_number) pm_system_wakeup(); + } -} - -unsigned int pm_wakeup_irq(void) -{ - return wakeup_irq[0]; } /** reverted: --- linux-aws-5.13-5.13.0/drivers/base/property.c +++ linux-aws-5.13-5.13.0.orig/drivers/base/property.c @@ -1260,10 +1260,8 @@ fwnode_graph_for_each_endpoint(fwnode, ep) { node = fwnode_graph_get_remote_port_parent(ep); + if (!fwnode_device_is_available(node)) - if (!fwnode_device_is_available(node)) { - fwnode_handle_put(node); continue; - } ret = match(node, con_id, data); fwnode_handle_put(node); diff -u linux-aws-5.13-5.13.0/drivers/base/regmap/regmap.c linux-aws-5.13-5.13.0/drivers/base/regmap/regmap.c --- linux-aws-5.13-5.13.0/drivers/base/regmap/regmap.c +++ linux-aws-5.13-5.13.0/drivers/base/regmap/regmap.c @@ -620,7 +620,6 @@ if (ret) return ret; - regmap_debugfs_exit(map); regmap_debugfs_init(map); /* Add a devres resource for dev_get_regmap() */ diff -u linux-aws-5.13-5.13.0/drivers/base/swnode.c linux-aws-5.13-5.13.0/drivers/base/swnode.c --- linux-aws-5.13-5.13.0/drivers/base/swnode.c +++ linux-aws-5.13-5.13.0/drivers/base/swnode.c @@ -533,7 +533,7 @@ return -ENOENT; if (nargs_prop) { - error = property_entry_read_int_array(ref->node->properties, + error = property_entry_read_int_array(swnode->node->properties, nargs_prop, sizeof(u32), &nargs_prop_val, 1); if (error) diff -u linux-aws-5.13-5.13.0/drivers/block/floppy.c linux-aws-5.13-5.13.0/drivers/block/floppy.c --- linux-aws-5.13-5.13.0/drivers/block/floppy.c +++ linux-aws-5.13-5.13.0/drivers/block/floppy.c @@ -1014,7 +1014,7 @@ static void cancel_activity(void) { do_floppy = NULL; - cancel_delayed_work(&fd_timer); + cancel_delayed_work_sync(&fd_timer); cancel_work_sync(&floppy_work); } @@ -3080,8 +3080,6 @@ } } -#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) - static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { @@ -3109,7 +3107,7 @@ ptr->resultcode = 0; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { - if (ptr->length <= 0 || ptr->length >= MAX_LEN) + if (ptr->length <= 0) return -EINVAL; ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); reverted: --- linux-aws-5.13-5.13.0/drivers/bluetooth/btmtksdio.c +++ linux-aws-5.13-5.13.0.orig/drivers/bluetooth/btmtksdio.c @@ -1042,8 +1042,6 @@ if (!bdev) return 0; - sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - sdio_claim_host(bdev->func); sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); reverted: --- linux-aws-5.13-5.13.0/drivers/bluetooth/hci_bcm.c +++ linux-aws-5.13-5.13.0.orig/drivers/bluetooth/hci_bcm.c @@ -1182,12 +1182,7 @@ return -ENOMEM; dev->dev = &pdev->dev; + dev->irq = platform_get_irq(pdev, 0); - - ret = platform_get_irq(pdev, 0); - if (ret < 0) - return ret; - - dev->irq = ret; /* Initialize routing field to an unused value */ dev->pcm_int_params[0] = 0xff; diff -u linux-aws-5.13-5.13.0/drivers/bluetooth/hci_qca.c linux-aws-5.13-5.13.0/drivers/bluetooth/hci_qca.c --- linux-aws-5.13-5.13.0/drivers/bluetooth/hci_qca.c +++ linux-aws-5.13-5.13.0/drivers/bluetooth/hci_qca.c @@ -1872,9 +1872,6 @@ hu->hdev->hw_error = NULL; hu->hdev->cmd_timeout = NULL; - del_timer_sync(&qca->wake_retrans_timer); - del_timer_sync(&qca->tx_idle_timer); - /* Stop sending shutdown command if soc crashes. */ if (soc_type != QCA_ROME && qca->memdump_state == QCA_MEMDUMP_IDLE) { @@ -2018,7 +2015,7 @@ qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR_OR_NULL(qcadev->bt_en)) { + if (!qcadev->bt_en) { dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); power_ctrl_enabled = false; } reverted: --- linux-aws-5.13-5.13.0/drivers/bluetooth/hci_vhci.c +++ linux-aws-5.13-5.13.0.orig/drivers/bluetooth/hci_vhci.c @@ -121,8 +121,6 @@ if (opcode & 0x80) set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); - set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); - if (hci_register_dev(hdev) < 0) { BT_ERR("Can't register HCI device"); hci_free_dev(hdev); diff -u linux-aws-5.13-5.13.0/drivers/bluetooth/virtio_bt.c linux-aws-5.13-5.13.0/drivers/bluetooth/virtio_bt.c --- linux-aws-5.13-5.13.0/drivers/bluetooth/virtio_bt.c +++ linux-aws-5.13-5.13.0/drivers/bluetooth/virtio_bt.c @@ -202,9 +202,6 @@ hci_skb_pkt_type(skb) = pkt_type; hci_recv_frame(vbt->hdev, skb); break; - default: - kfree_skb(skb); - break; } } reverted: --- linux-aws-5.13-5.13.0/drivers/bus/mhi/core/init.c +++ linux-aws-5.13-5.13.0.orig/drivers/bus/mhi/core/init.c @@ -788,7 +788,6 @@ mhi_chan->offload_ch = ch_cfg->offload_channel; mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch; mhi_chan->pre_alloc = ch_cfg->auto_queue; - mhi_chan->wake_capable = ch_cfg->wake_capable; /* * If MHI host allocates buffers, then the channel direction diff -u linux-aws-5.13-5.13.0/drivers/bus/mhi/pci_generic.c linux-aws-5.13-5.13.0/drivers/bus/mhi/pci_generic.c --- linux-aws-5.13-5.13.0/drivers/bus/mhi/pci_generic.c +++ linux-aws-5.13-5.13.0/drivers/bus/mhi/pci_generic.c @@ -976,7 +976,7 @@ * context. */ if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { - mhi_power_down(mhi_cntrl, true); + mhi_power_down(mhi_cntrl, false); mhi_unprepare_after_power_down(mhi_cntrl); } reverted: --- linux-aws-5.13-5.13.0/drivers/char/mwave/3780i.h +++ linux-aws-5.13-5.13.0.orig/drivers/char/mwave/3780i.h @@ -68,7 +68,7 @@ unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ + unsigned char Reserved:5; /* 0: Reserved */ - unsigned short Reserved:13; /* 0: Reserved */ } DSP_ISA_SLAVE_CONTROL; diff -u linux-aws-5.13-5.13.0/drivers/char/random.c linux-aws-5.13-5.13.0/drivers/char/random.c --- linux-aws-5.13-5.13.0/drivers/char/random.c +++ linux-aws-5.13-5.13.0/drivers/char/random.c @@ -912,14 +912,12 @@ /* * crng_fast_load() can be called by code in the interrupt service - * path. So we can't afford to dilly-dally. Returns the number of - * bytes processed from cp. + * path. So we can't afford to dilly-dally. */ -static size_t crng_fast_load(const char *cp, size_t len) +static int crng_fast_load(const char *cp, size_t len) { unsigned long flags; char *p; - size_t ret = 0; if (!spin_trylock_irqsave(&primary_crng.lock, flags)) return 0; @@ -930,7 +928,7 @@ p = (unsigned char *) &primary_crng.state[4]; while (len > 0 && crng_init_cnt < CRNG_INIT_CNT_THRESH) { p[crng_init_cnt % CHACHA_KEY_SIZE] ^= *cp; - cp++; crng_init_cnt++; len--; ret++; + cp++; crng_init_cnt++; len--; } spin_unlock_irqrestore(&primary_crng.lock, flags); if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { @@ -938,7 +936,7 @@ crng_init = 1; pr_notice("fast init done\n"); } - return ret; + return 1; } /* @@ -1289,7 +1287,7 @@ if (unlikely(crng_init == 0)) { if ((fast_pool->count >= 64) && crng_fast_load((char *) fast_pool->pool, - sizeof(fast_pool->pool)) > 0) { + sizeof(fast_pool->pool))) { fast_pool->count = 0; fast_pool->last = now; } @@ -2297,11 +2295,8 @@ struct entropy_store *poolp = &input_pool; if (unlikely(crng_init == 0)) { - size_t ret = crng_fast_load(buffer, count); - count -= ret; - buffer += ret; - if (!count || crng_init == 0) - return; + crng_fast_load(buffer, count); + return; } /* Suspend writing if we're above the trickle threshold. reverted: --- linux-aws-5.13-5.13.0/drivers/char/tpm/tpm-chip.c +++ linux-aws-5.13-5.13.0.orig/drivers/char/tpm/tpm-chip.c @@ -474,21 +474,13 @@ /* Make the driver uncallable. */ down_write(&chip->ops_sem); + if (chip->flags & TPM_CHIP_FLAG_TPM2) { + if (!tpm_chip_start(chip)) { + tpm2_shutdown(chip, TPM2_SU_CLEAR); + tpm_chip_stop(chip); - - /* - * Check if chip->ops is still valid: In case that the controller - * drivers shutdown handler unregisters the controller in its - * shutdown handler we are called twice and chip->ops to NULL. - */ - if (chip->ops) { - if (chip->flags & TPM_CHIP_FLAG_TPM2) { - if (!tpm_chip_start(chip)) { - tpm2_shutdown(chip, TPM2_SU_CLEAR); - tpm_chip_stop(chip); - } } - chip->ops = NULL; } + chip->ops = NULL; up_write(&chip->ops_sem); } diff -u linux-aws-5.13-5.13.0/drivers/char/tpm/tpm_tis_core.c linux-aws-5.13-5.13.0/drivers/char/tpm/tpm_tis_core.c --- linux-aws-5.13-5.13.0/drivers/char/tpm/tpm_tis_core.c +++ linux-aws-5.13-5.13.0/drivers/char/tpm/tpm_tis_core.c @@ -950,11 +950,9 @@ priv->timeout_max = TPM_TIMEOUT_USECS_MAX; priv->phy_ops = phy_ops; - dev_set_drvdata(&chip->dev, priv); - rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); if (rc < 0) - return rc; + goto out_err; priv->manufacturer_id = vendor; @@ -964,6 +962,8 @@ priv->timeout_max = TIS_TIMEOUT_MAX_ATML; } + dev_set_drvdata(&chip->dev, priv); + if (is_bsw()) { priv->ilb_base_addr = ioremap(INTEL_LEGACY_BLK_BASE_ADDR, ILB_REMAP_SIZE); @@ -994,15 +994,7 @@ intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; intmask &= ~TPM_GLOBAL_INT_ENABLE; - - rc = request_locality(chip, 0); - if (rc < 0) { - rc = -ENODEV; - goto out_err; - } - tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); - release_locality(chip, 0); rc = tpm_chip_start(chip); if (rc) reverted: --- linux-aws-5.13-5.13.0/drivers/clk/bcm/clk-bcm2835.c +++ linux-aws-5.13-5.13.0.orig/drivers/clk/bcm/clk-bcm2835.c @@ -933,7 +933,8 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate, + bool round_up) - unsigned long parent_rate) { struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); const struct bcm2835_clock_data *data = clock->data; @@ -945,6 +946,10 @@ rem = do_div(temp, rate); div = temp; + + /* Round up and mask off the unused bits */ + if (round_up && ((div & unused_frac_mask) != 0 || rem != 0)) + div += unused_frac_mask + 1; div &= ~unused_frac_mask; /* different clamping limits apply for a mash clock */ @@ -1075,7 +1080,7 @@ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman = clock->cprman; const struct bcm2835_clock_data *data = clock->data; + u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false); - u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate); u32 ctl; spin_lock(&cprman->regs_lock); @@ -1126,7 +1131,7 @@ if (!(BIT(parent_idx) & data->set_rate_parent)) { *prate = clk_hw_get_rate(parent); + *div = bcm2835_clock_choose_div(hw, rate, *prate, true); - *div = bcm2835_clock_choose_div(hw, rate, *prate); *avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div); @@ -1212,7 +1217,7 @@ rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate, &div, &prate, &avgrate); + if (rate > best_rate && rate <= req->rate) { - if (abs(req->rate - rate) < abs(req->rate - best_rate)) { best_parent = parent; best_prate = prate; best_rate = rate; reverted: --- linux-aws-5.13-5.13.0/drivers/clk/clk-bm1880.c +++ linux-aws-5.13-5.13.0.orig/drivers/clk/clk-bm1880.c @@ -522,6 +522,14 @@ return hw; } +static void bm1880_clk_unregister_pll(struct clk_hw *hw) +{ + struct bm1880_pll_hw_clock *pll_hw = to_bm1880_pll_clk(hw); + + clk_hw_unregister(hw); + kfree(pll_hw); +} + static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -547,7 +555,7 @@ err_clk: while (i--) + bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]); - clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]); return PTR_ERR(hw); } @@ -687,6 +695,14 @@ return hw; } +static void bm1880_clk_unregister_div(struct clk_hw *hw) +{ + struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw); + + clk_hw_unregister(hw); + kfree(div_hw); +} + static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -713,7 +729,7 @@ err_clk: while (i--) + bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]); - clk_hw_unregister(data->hw_data.hws[clks[i].div.id]); return PTR_ERR(hw); } diff -u linux-aws-5.13-5.13.0/drivers/clk/clk-si5341.c linux-aws-5.13-5.13.0/drivers/clk/clk-si5341.c --- linux-aws-5.13-5.13.0/drivers/clk/clk-si5341.c +++ linux-aws-5.13-5.13.0/drivers/clk/clk-si5341.c @@ -1576,7 +1576,7 @@ clk_prepare(data->clk[i].hw.clk); } - err = devm_of_clk_add_hw_provider(&client->dev, of_clk_si5341_get, + err = of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, data); if (err) { dev_err(&client->dev, "unable to add clk provider\n"); diff -u linux-aws-5.13-5.13.0/drivers/clk/clk-stm32f4.c linux-aws-5.13-5.13.0/drivers/clk/clk-stm32f4.c --- linux-aws-5.13-5.13.0/drivers/clk/clk-stm32f4.c +++ linux-aws-5.13-5.13.0/drivers/clk/clk-stm32f4.c @@ -129,6 +129,7 @@ { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, + { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { @@ -210,6 +211,7 @@ { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, + { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { @@ -284,6 +286,7 @@ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, + { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { @@ -361,6 +364,7 @@ { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, + { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, }; diff -u linux-aws-5.13-5.13.0/drivers/clk/clk.c linux-aws-5.13-5.13.0/drivers/clk/clk.c --- linux-aws-5.13-5.13.0/drivers/clk/clk.c +++ linux-aws-5.13-5.13.0/drivers/clk/clk.c @@ -3340,24 +3340,6 @@ { struct clk_core *core; -#ifdef CLOCK_ALLOW_WRITE_DEBUGFS - pr_warn("\n"); - pr_warn("********************************************************************\n"); - pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); - pr_warn("** **\n"); - pr_warn("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n"); - pr_warn("** **\n"); - pr_warn("** This means that this kernel is built to expose clk operations **\n"); - pr_warn("** such as parent or rate setting, enabling, disabling, etc. **\n"); - pr_warn("** to userspace, which may compromise security on your system. **\n"); - pr_warn("** **\n"); - pr_warn("** If you see this message and you are not debugging the **\n"); - pr_warn("** kernel, report this immediately to your vendor! **\n"); - pr_warn("** **\n"); - pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); - pr_warn("********************************************************************\n"); -#endif - rootdir = debugfs_create_dir("clk", NULL); debugfs_create_file("clk_summary", 0444, rootdir, &all_lists, diff -u linux-aws-5.13-5.13.0/drivers/clk/imx/clk-imx8mn.c linux-aws-5.13-5.13.0/drivers/clk/imx/clk-imx8mn.c --- linux-aws-5.13-5.13.0/drivers/clk/imx/clk-imx8mn.c +++ linux-aws-5.13-5.13.0/drivers/clk/imx/clk-imx8mn.c @@ -274,9 +274,9 @@ static const char * const imx8mn_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; -static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "dummy", - "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m", - "dummy", "sys_pll1_80m", }; +static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", + "sys_pll1_200m", "audio_pll2_out", "vpu_pll", + "sys_pll1_80m", }; static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m", "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", "video_pll1_out", "osc_32k", }; reverted: --- linux-aws-5.13-5.13.0/drivers/clk/meson/gxbb.c +++ linux-aws-5.13-5.13.0.orig/drivers/clk/meson/gxbb.c @@ -720,35 +720,6 @@ .width = 14, }, .sdm_en = { - .reg_off = HHI_MPLL_CNTL, - .shift = 25, - .width = 1, - }, - .n2 = { - .reg_off = HHI_MPLL_CNTL7, - .shift = 16, - .width = 9, - }, - .lock = &meson_clk_lock, - }, - .hw.init = &(struct clk_init_data){ - .name = "mpll0_div", - .ops = &meson_clk_mpll_ops, - .parent_hws = (const struct clk_hw *[]) { - &gxbb_mpll_prediv.hw - }, - .num_parents = 1, - }, -}; - -static struct clk_regmap gxl_mpll0_div = { - .data = &(struct meson_clk_mpll_data){ - .sdm = { - .reg_off = HHI_MPLL_CNTL7, - .shift = 0, - .width = 14, - }, - .sdm_en = { .reg_off = HHI_MPLL_CNTL7, .shift = 15, .width = 1, @@ -778,16 +749,7 @@ .hw.init = &(struct clk_init_data){ .name = "mpll0", .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { &gxbb_mpll0_div.hw }, - .parent_data = &(const struct clk_parent_data) { - /* - * Note: - * GXL and GXBB have different SDM_EN registers. We - * fallback to the global naming string mechanism so - * mpll0_div picks up the appropriate one. - */ - .name = "mpll0_div", - .index = -1, - }, .num_parents = 1, .flags = CLK_SET_RATE_PARENT, }, @@ -3082,7 +3044,7 @@ [CLKID_VAPB_1] = &gxbb_vapb_1.hw, [CLKID_VAPB_SEL] = &gxbb_vapb_sel.hw, [CLKID_VAPB] = &gxbb_vapb.hw, + [CLKID_MPLL0_DIV] = &gxbb_mpll0_div.hw, - [CLKID_MPLL0_DIV] = &gxl_mpll0_div.hw, [CLKID_MPLL1_DIV] = &gxbb_mpll1_div.hw, [CLKID_MPLL2_DIV] = &gxbb_mpll2_div.hw, [CLKID_MPLL_PREDIV] = &gxbb_mpll_prediv.hw, @@ -3477,7 +3439,7 @@ &gxbb_mpll0, &gxbb_mpll1, &gxbb_mpll2, + &gxbb_mpll0_div, - &gxl_mpll0_div, &gxbb_mpll1_div, &gxbb_mpll2_div, &gxbb_cts_amclk_div, diff -u linux-aws-5.13-5.13.0/drivers/clk/qcom/gcc-sc7280.c linux-aws-5.13-5.13.0/drivers/clk/qcom/gcc-sc7280.c --- linux-aws-5.13-5.13.0/drivers/clk/qcom/gcc-sc7280.c +++ linux-aws-5.13-5.13.0/drivers/clk/qcom/gcc-sc7280.c @@ -2998,7 +2998,7 @@ .enable_mask = BIT(0), .hw.init = &(struct clk_init_data){ .name = "gcc_cfg_noc_lpass_clk", - .ops = &clk_branch2_aon_ops, + .ops = &clk_branch2_ops, }, }, }; diff -u linux-aws-5.13-5.13.0/drivers/cpufreq/cpufreq.c linux-aws-5.13-5.13.0/drivers/cpufreq/cpufreq.c --- linux-aws-5.13-5.13.0/drivers/cpufreq/cpufreq.c +++ linux-aws-5.13-5.13.0/drivers/cpufreq/cpufreq.c @@ -1401,7 +1401,7 @@ ret = freq_qos_add_request(&policy->constraints, policy->min_freq_req, FREQ_QOS_MIN, - FREQ_QOS_MIN_DEFAULT_VALUE); + policy->min); if (ret < 0) { /* * So we don't call freq_qos_remove_request() for an @@ -1421,7 +1421,7 @@ ret = freq_qos_add_request(&policy->constraints, policy->max_freq_req, FREQ_QOS_MAX, - FREQ_QOS_MAX_DEFAULT_VALUE); + policy->max); if (ret < 0) { policy->max_freq_req = NULL; goto out_destroy_policy; reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/caam/caamalg.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/caam/caamalg.c @@ -1533,9 +1533,6 @@ ret = caam_jr_enqueue(ctx->jrdev, desc, aead_crypt_done, req); - if (ret == -ENOSPC && engine->retry_support) - return ret; - if (ret != -EINPROGRESS) { aead_unmap(ctx->jrdev, rctx->edesc, req); kfree(rctx->edesc); @@ -1765,9 +1762,6 @@ ret = caam_jr_enqueue(ctx->jrdev, desc, skcipher_crypt_done, req); - if (ret == -ENOSPC && engine->retry_support) - return ret; - if (ret != -EINPROGRESS) { skcipher_unmap(ctx->jrdev, rctx->edesc, req); kfree(rctx->edesc); reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/caam/caamalg_qi2.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/caam/caamalg_qi2.c @@ -5470,7 +5470,7 @@ dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1])); dpaa2_fd_set_flc(&fd, req->flc_dma); + ppriv = this_cpu_ptr(priv->ppriv); - ppriv = raw_cpu_ptr(priv->ppriv); for (i = 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) { err = dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid, &fd); reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/caam/caamhash.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/caam/caamhash.c @@ -765,9 +765,6 @@ ret = caam_jr_enqueue(jrdev, desc, state->ahash_op_done, req); - if (ret == -ENOSPC && engine->retry_support) - return ret; - if (ret != -EINPROGRESS) { ahash_unmap(jrdev, state->edesc, req, 0); kfree(state->edesc); diff -u linux-aws-5.13-5.13.0/drivers/crypto/caam/caampkc.c linux-aws-5.13-5.13.0/drivers/crypto/caam/caampkc.c --- linux-aws-5.13-5.13.0/drivers/crypto/caam/caampkc.c +++ linux-aws-5.13-5.13.0/drivers/crypto/caam/caampkc.c @@ -380,9 +380,6 @@ ret = caam_jr_enqueue(jrdev, desc, req_ctx->akcipher_op_done, req); - if (ret == -ENOSPC && engine->retry_support) - return ret; - if (ret != -EINPROGRESS) { rsa_pub_unmap(jrdev, req_ctx->edesc, req); rsa_io_unmap(jrdev, req_ctx->edesc, req); diff -u linux-aws-5.13-5.13.0/drivers/crypto/ccp/sev-dev.c linux-aws-5.13-5.13.0/drivers/crypto/ccp/sev-dev.c --- linux-aws-5.13-5.13.0/drivers/crypto/ccp/sev-dev.c +++ linux-aws-5.13-5.13.0/drivers/crypto/ccp/sev-dev.c @@ -241,7 +241,7 @@ struct psp_device *psp = psp_master; struct sev_data_init data; struct sev_device *sev; - int psp_ret, rc = 0; + int rc = 0; if (!psp || !psp->sev_data) return -ENODEV; @@ -266,21 +266,7 @@ data.tmr_len = SEV_ES_TMR_SIZE; } - rc = __sev_do_cmd_locked(SEV_CMD_INIT, &data, &psp_ret); - if (rc && psp_ret == SEV_RET_SECURE_DATA_INVALID) { - /* - * Initialization command returned an integrity check failure - * status code, meaning that firmware load and validation of SEV - * related persistent data has failed. Retrying the - * initialization function should succeed by replacing the state - * with a reset state. - */ - dev_dbg(sev->dev, "SEV: retrying INIT command"); - rc = __sev_do_cmd_locked(SEV_CMD_INIT, &data, &psp_ret); - } - if (error) - *error = psp_ret; - + rc = __sev_do_cmd_locked(SEV_CMD_INIT, &data, error); if (rc) return rc; @@ -1105,6 +1091,18 @@ /* Initialize the platform */ rc = sev_platform_init(&error); + if (rc && (error == SEV_RET_SECURE_DATA_INVALID)) { + /* + * INIT command returned an integrity check failure + * status code, meaning that firmware load and + * validation of SEV related persistent data has + * failed and persistent state has been erased. + * Retrying INIT command here should succeed. + */ + dev_dbg(sev->dev, "SEV: retrying INIT command"); + rc = sev_platform_init(&error); + } + if (rc) { dev_err(sev->dev, "SEV: failed to INIT error %#x\n", error); return; reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c @@ -406,11 +406,12 @@ { struct otx2_cptpf_dev *cptpf = dev_get_drvdata(dev); int lfs_num; - int ret; + if (kstrtoint(buf, 0, &lfs_num)) { + dev_err(dev, "lfs count %d must be in range [1 - %d]\n", + lfs_num, num_online_cpus()); + return -EINVAL; + } - ret = kstrtoint(buf, 0, &lfs_num); - if (ret) - return ret; if (lfs_num < 1 || lfs_num > num_online_cpus()) { dev_err(dev, "lfs count %d must be in range [1 - %d]\n", lfs_num, num_online_cpus()); reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c @@ -27,8 +27,7 @@ bool found = false; int i; + if (eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) { - if (eng_grp->g->engs_num < 0 || - eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) { dev_err(dev, "unsupported number of engines %d on octeontx2\n", eng_grp->g->engs_num); return bmap; diff -u linux-aws-5.13-5.13.0/drivers/crypto/omap-aes.c linux-aws-5.13-5.13.0/drivers/crypto/omap-aes.c --- linux-aws-5.13-5.13.0/drivers/crypto/omap-aes.c +++ linux-aws-5.13-5.13.0/drivers/crypto/omap-aes.c @@ -1302,7 +1302,7 @@ static int omap_aes_resume(struct device *dev) { - pm_runtime_get_sync(dev); + pm_runtime_resume_and_get(dev); return 0; } #endif diff -u linux-aws-5.13-5.13.0/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c linux-aws-5.13-5.13.0/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c --- linux-aws-5.13-5.13.0/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ linux-aws-5.13-5.13.0/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -111,19 +111,37 @@ mutex_lock(lock); - /* Check if the PFVF CSR is in use by remote function */ + /* Check if PF2VF CSR is in use by remote function */ val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); if ((val & remote_in_use_mask) == remote_in_use_pattern) { dev_dbg(&GET_DEV(accel_dev), - "PFVF CSR in use by remote function\n"); + "PF2VF CSR in use by remote function\n"); ret = -EBUSY; goto out; } + /* Attempt to get ownership of PF2VF CSR */ msg &= ~local_in_use_mask; msg |= local_in_use_pattern; + ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, msg); - /* Attempt to get ownership of the PFVF CSR */ + /* Wait in case remote func also attempting to get ownership */ + msleep(ADF_IOV_MSG_COLLISION_DETECT_DELAY); + + val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); + if ((val & local_in_use_mask) != local_in_use_pattern) { + dev_dbg(&GET_DEV(accel_dev), + "PF2VF CSR in use by remote - collision detected\n"); + ret = -EBUSY; + goto out; + } + + /* + * This function now owns the PV2VF CSR. The IN_USE_BY pattern must + * remain in the PF2VF CSR for all writes including ACK from remote + * until this local function relinquishes the CSR. Send the message + * by interrupting the remote. + */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, msg | int_bit); /* Wait for confirmation from remote func it received the message */ @@ -132,12 +150,6 @@ val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); } while ((val & int_bit) && (count++ < ADF_IOV_MSG_ACK_MAX_RETRY)); - if (val & int_bit) { - dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); - val &= ~int_bit; - ret = -EIO; - } - if (val != msg) { dev_dbg(&GET_DEV(accel_dev), "Collision - PFVF CSR overwritten by remote function\n"); @@ -145,7 +157,13 @@ goto out; } - /* Finished with the PFVF CSR; relinquish it and leave msg in CSR */ + if (val & int_bit) { + dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); + val &= ~int_bit; + ret = -EIO; + } + + /* Finished with PF2VF CSR; relinquish it and leave msg in CSR */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, val & ~local_in_use_mask); out: mutex_unlock(lock); @@ -153,13 +171,12 @@ } /** - * adf_iov_putmsg() - send PFVF message + * adf_iov_putmsg() - send PF2VF message * @accel_dev: Pointer to acceleration device. * @msg: Message to send - * @vf_nr: VF number to which the message will be sent if on PF, ignored - * otherwise + * @vf_nr: VF number to which the message will be sent * - * Function sends a message through the PFVF channel + * Function sends a message from the PF to a VF * * Return: 0 on success, error code otherwise. */ reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/qce/sha.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/qce/sha.c @@ -498,8 +498,8 @@ ret = crypto_register_ahash(alg); if (ret) { + kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", base->cra_name); - kfree(tmpl); return ret; } diff -u linux-aws-5.13-5.13.0/drivers/crypto/qce/skcipher.c linux-aws-5.13-5.13.0/drivers/crypto/qce/skcipher.c --- linux-aws-5.13-5.13.0/drivers/crypto/qce/skcipher.c +++ linux-aws-5.13-5.13.0/drivers/crypto/qce/skcipher.c @@ -484,8 +484,8 @@ ret = crypto_register_skcipher(alg); if (ret) { - dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); kfree(tmpl); + dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/stm32/stm32-crc32.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/stm32/stm32-crc32.c @@ -279,7 +279,7 @@ .digestsize = CHKSUM_DIGEST_SIZE, .base = { .cra_name = "crc32", + .cra_driver_name = DRIVER_NAME, - .cra_driver_name = "stm32-crc32-crc32", .cra_priority = 200, .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize = CHKSUM_BLOCK_SIZE, @@ -301,7 +301,7 @@ .digestsize = CHKSUM_DIGEST_SIZE, .base = { .cra_name = "crc32c", + .cra_driver_name = DRIVER_NAME, - .cra_driver_name = "stm32-crc32-crc32c", .cra_priority = 200, .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize = CHKSUM_BLOCK_SIZE, reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/stm32/stm32-cryp.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/stm32/stm32-cryp.c @@ -37,6 +37,7 @@ /* Mode mask = bits [15..0] */ #define FLG_MODE_MASK GENMASK(15, 0) /* Bit [31..16] status */ +#define FLG_CCM_PADDED_WA BIT(16) /* Registers */ #define CRYP_CR 0x00000000 @@ -104,6 +105,8 @@ /* Misc */ #define AES_BLOCK_32 (AES_BLOCK_SIZE / sizeof(u32)) #define GCM_CTR_INIT 2 +#define _walked_in (cryp->in_walk.offset - cryp->in_sg->offset) +#define _walked_out (cryp->out_walk.offset - cryp->out_sg->offset) #define CRYP_AUTOSUSPEND_DELAY 50 struct stm32_cryp_caps { @@ -141,16 +144,26 @@ size_t authsize; size_t hw_blocksize; + size_t total_in; + size_t total_in_save; + size_t total_out; + size_t total_out_save; - size_t payload_in; - size_t header_in; - size_t payload_out; + struct scatterlist *in_sg; struct scatterlist *out_sg; + struct scatterlist *out_sg_save; + + struct scatterlist in_sgl; + struct scatterlist out_sgl; + bool sgs_copied; + + int in_sg_len; + int out_sg_len; struct scatter_walk in_walk; struct scatter_walk out_walk; + u32 last_ctr[4]; - __be32 last_ctr[4]; u32 gcm_ctr; }; @@ -249,7 +262,6 @@ } static int stm32_cryp_read_auth_tag(struct stm32_cryp *cryp); -static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err); static struct stm32_cryp *stm32_cryp_find_dev(struct stm32_cryp_ctx *ctx) { @@ -271,6 +283,103 @@ return cryp; } +static int stm32_cryp_check_aligned(struct scatterlist *sg, size_t total, + size_t align) +{ + int len = 0; + + if (!total) + return 0; + + if (!IS_ALIGNED(total, align)) + return -EINVAL; + + while (sg) { + if (!IS_ALIGNED(sg->offset, sizeof(u32))) + return -EINVAL; + + if (!IS_ALIGNED(sg->length, align)) + return -EINVAL; + + len += sg->length; + sg = sg_next(sg); + } + + if (len != total) + return -EINVAL; + + return 0; +} + +static int stm32_cryp_check_io_aligned(struct stm32_cryp *cryp) +{ + int ret; + + ret = stm32_cryp_check_aligned(cryp->in_sg, cryp->total_in, + cryp->hw_blocksize); + if (ret) + return ret; + + ret = stm32_cryp_check_aligned(cryp->out_sg, cryp->total_out, + cryp->hw_blocksize); + + return ret; +} + +static void sg_copy_buf(void *buf, struct scatterlist *sg, + unsigned int start, unsigned int nbytes, int out) +{ + struct scatter_walk walk; + + if (!nbytes) + return; + + scatterwalk_start(&walk, sg); + scatterwalk_advance(&walk, start); + scatterwalk_copychunks(buf, &walk, nbytes, out); + scatterwalk_done(&walk, out, 0); +} + +static int stm32_cryp_copy_sgs(struct stm32_cryp *cryp) +{ + void *buf_in, *buf_out; + int pages, total_in, total_out; + + if (!stm32_cryp_check_io_aligned(cryp)) { + cryp->sgs_copied = 0; + return 0; + } + + total_in = ALIGN(cryp->total_in, cryp->hw_blocksize); + pages = total_in ? get_order(total_in) : 1; + buf_in = (void *)__get_free_pages(GFP_ATOMIC, pages); + + total_out = ALIGN(cryp->total_out, cryp->hw_blocksize); + pages = total_out ? get_order(total_out) : 1; + buf_out = (void *)__get_free_pages(GFP_ATOMIC, pages); + + if (!buf_in || !buf_out) { + dev_err(cryp->dev, "Can't allocate pages when unaligned\n"); + cryp->sgs_copied = 0; + return -EFAULT; + } + + sg_copy_buf(buf_in, cryp->in_sg, 0, cryp->total_in, 0); + + sg_init_one(&cryp->in_sgl, buf_in, total_in); + cryp->in_sg = &cryp->in_sgl; + cryp->in_sg_len = 1; + + sg_init_one(&cryp->out_sgl, buf_out, total_out); + cryp->out_sg_save = cryp->out_sg; + cryp->out_sg = &cryp->out_sgl; + cryp->out_sg_len = 1; + + cryp->sgs_copied = 1; + + return 0; +} + static void stm32_cryp_hw_write_iv(struct stm32_cryp *cryp, __be32 *iv) { if (!iv) @@ -372,99 +481,16 @@ /* Wait for end of processing */ ret = stm32_cryp_wait_enable(cryp); + if (ret) - if (ret) { dev_err(cryp->dev, "Timeout (gcm init)\n"); - return ret; - } + return ret; - /* Prepare next phase */ - if (cryp->areq->assoclen) { - cfg |= CR_PH_HEADER; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } else if (stm32_cryp_get_input_text_len(cryp)) { - cfg |= CR_PH_PAYLOAD; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } - - return 0; -} - -static void stm32_crypt_gcmccm_end_header(struct stm32_cryp *cryp) -{ - u32 cfg; - int err; - - /* Check if whole header written */ - if (!cryp->header_in) { - /* Wait for completion */ - err = stm32_cryp_wait_busy(cryp); - if (err) { - dev_err(cryp->dev, "Timeout (gcm/ccm header)\n"); - stm32_cryp_write(cryp, CRYP_IMSCR, 0); - stm32_cryp_finish_req(cryp, err); - return; - } - - if (stm32_cryp_get_input_text_len(cryp)) { - /* Phase 3 : payload */ - cfg = stm32_cryp_read(cryp, CRYP_CR); - cfg &= ~CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - - cfg &= ~CR_PH_MASK; - cfg |= CR_PH_PAYLOAD | CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } else { - /* - * Phase 4 : tag. - * Nothing to read, nothing to write, caller have to - * end request - */ - } - } -} - -static void stm32_cryp_write_ccm_first_header(struct stm32_cryp *cryp) -{ - unsigned int i; - size_t written; - size_t len; - u32 alen = cryp->areq->assoclen; - u32 block[AES_BLOCK_32] = {0}; - u8 *b8 = (u8 *)block; - - if (alen <= 65280) { - /* Write first u32 of B1 */ - b8[0] = (alen >> 8) & 0xFF; - b8[1] = alen & 0xFF; - len = 2; - } else { - /* Build the two first u32 of B1 */ - b8[0] = 0xFF; - b8[1] = 0xFE; - b8[2] = (alen & 0xFF000000) >> 24; - b8[3] = (alen & 0x00FF0000) >> 16; - b8[4] = (alen & 0x0000FF00) >> 8; - b8[5] = alen & 0x000000FF; - len = 6; - } - - written = min_t(size_t, AES_BLOCK_SIZE - len, alen); - - scatterwalk_copychunks((char *)block + len, &cryp->in_walk, written, 0); - for (i = 0; i < AES_BLOCK_32; i++) - stm32_cryp_write(cryp, CRYP_DIN, block[i]); - - cryp->header_in -= written; - - stm32_crypt_gcmccm_end_header(cryp); } static int stm32_cryp_ccm_init(struct stm32_cryp *cryp, u32 cfg) { int ret; + u8 iv[AES_BLOCK_SIZE], b0[AES_BLOCK_SIZE]; - u32 iv_32[AES_BLOCK_32], b0_32[AES_BLOCK_32]; - u8 *iv = (u8 *)iv_32, *b0 = (u8 *)b0_32; __be32 *bd; u32 *d; unsigned int i, textlen; @@ -505,24 +531,10 @@ /* Wait for end of processing */ ret = stm32_cryp_wait_enable(cryp); + if (ret) - if (ret) { dev_err(cryp->dev, "Timeout (ccm init)\n"); - return ret; - } + return ret; - /* Prepare next phase */ - if (cryp->areq->assoclen) { - cfg |= CR_PH_HEADER | CR_CRYPEN; - stm32_cryp_write(cryp, CRYP_CR, cfg); - - /* Write first (special) block (may move to next phase [payload]) */ - stm32_cryp_write_ccm_first_header(cryp); - } else if (stm32_cryp_get_input_text_len(cryp)) { - cfg |= CR_PH_PAYLOAD; - stm32_cryp_write(cryp, CRYP_CR, cfg); - } - - return 0; } static int stm32_cryp_hw_init(struct stm32_cryp *cryp) @@ -530,7 +542,7 @@ int ret; u32 cfg, hw_mode; + pm_runtime_resume_and_get(cryp->dev); - pm_runtime_get_sync(cryp->dev); /* Disable interrupt */ stm32_cryp_write(cryp, CRYP_IMSCR, 0); @@ -593,6 +605,16 @@ if (ret) return ret; + /* Phase 2 : header (authenticated data) */ + if (cryp->areq->assoclen) { + cfg |= CR_PH_HEADER; + } else if (stm32_cryp_get_input_text_len(cryp)) { + cfg |= CR_PH_PAYLOAD; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } else { + cfg |= CR_PH_INIT; + } + break; case CR_DES_CBC: @@ -611,6 +633,8 @@ stm32_cryp_write(cryp, CRYP_CR, cfg); + cryp->flags &= ~FLG_CCM_PADDED_WA; + return 0; } @@ -620,9 +644,28 @@ /* Phase 4 : output tag */ err = stm32_cryp_read_auth_tag(cryp); + if (!err && (!(is_gcm(cryp) || is_ccm(cryp)))) - if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp)))) stm32_cryp_get_iv(cryp); + if (cryp->sgs_copied) { + void *buf_in, *buf_out; + int pages, len; + + buf_in = sg_virt(&cryp->in_sgl); + buf_out = sg_virt(&cryp->out_sgl); + + sg_copy_buf(buf_out, cryp->out_sg_save, 0, + cryp->total_out_save, 1); + + len = ALIGN(cryp->total_in_save, cryp->hw_blocksize); + pages = len ? get_order(len) : 1; + free_pages((unsigned long)buf_in, pages); + + len = ALIGN(cryp->total_out_save, cryp->hw_blocksize); + pages = len ? get_order(len) : 1; + free_pages((unsigned long)buf_out, pages); + } + pm_runtime_mark_last_busy(cryp->dev); pm_runtime_put_autosuspend(cryp->dev); @@ -631,6 +674,8 @@ else crypto_finalize_skcipher_request(cryp->engine, cryp->req, err); + + memset(cryp->ctx->key, 0, cryp->ctx->keylen); } static int stm32_cryp_cpu_start(struct stm32_cryp *cryp) @@ -756,20 +801,7 @@ static int stm32_cryp_aes_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize) { + return authsize == AES_BLOCK_SIZE ? 0 : -EINVAL; - switch (authsize) { - case 4: - case 8: - case 12: - case 13: - case 14: - case 15: - case 16: - break; - default: - return -EINVAL; - } - - return 0; } static int stm32_cryp_aes_ccm_setauthsize(struct crypto_aead *tfm, @@ -793,61 +825,31 @@ static int stm32_cryp_aes_ecb_encrypt(struct skcipher_request *req) { - if (req->cryptlen % AES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_ECB | FLG_ENCRYPT); } static int stm32_cryp_aes_ecb_decrypt(struct skcipher_request *req) { - if (req->cryptlen % AES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_ECB); } static int stm32_cryp_aes_cbc_encrypt(struct skcipher_request *req) { - if (req->cryptlen % AES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_CBC | FLG_ENCRYPT); } static int stm32_cryp_aes_cbc_decrypt(struct skcipher_request *req) { - if (req->cryptlen % AES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_CBC); } static int stm32_cryp_aes_ctr_encrypt(struct skcipher_request *req) { - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_CTR | FLG_ENCRYPT); } static int stm32_cryp_aes_ctr_decrypt(struct skcipher_request *req) { - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_AES | FLG_CTR); } @@ -861,122 +863,53 @@ return stm32_cryp_aead_crypt(req, FLG_AES | FLG_GCM); } -static inline int crypto_ccm_check_iv(const u8 *iv) -{ - /* 2 <= L <= 8, so 1 <= L' <= 7. */ - if (iv[0] < 1 || iv[0] > 7) - return -EINVAL; - - return 0; -} - static int stm32_cryp_aes_ccm_encrypt(struct aead_request *req) { - int err; - - err = crypto_ccm_check_iv(req->iv); - if (err) - return err; - return stm32_cryp_aead_crypt(req, FLG_AES | FLG_CCM | FLG_ENCRYPT); } static int stm32_cryp_aes_ccm_decrypt(struct aead_request *req) { - int err; - - err = crypto_ccm_check_iv(req->iv); - if (err) - return err; - return stm32_cryp_aead_crypt(req, FLG_AES | FLG_CCM); } static int stm32_cryp_des_ecb_encrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_DES | FLG_ECB | FLG_ENCRYPT); } static int stm32_cryp_des_ecb_decrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_DES | FLG_ECB); } static int stm32_cryp_des_cbc_encrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_DES | FLG_CBC | FLG_ENCRYPT); } static int stm32_cryp_des_cbc_decrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_DES | FLG_CBC); } static int stm32_cryp_tdes_ecb_encrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_TDES | FLG_ECB | FLG_ENCRYPT); } static int stm32_cryp_tdes_ecb_decrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_TDES | FLG_ECB); } static int stm32_cryp_tdes_cbc_encrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_TDES | FLG_CBC | FLG_ENCRYPT); } static int stm32_cryp_tdes_cbc_decrypt(struct skcipher_request *req) { - if (req->cryptlen % DES_BLOCK_SIZE) - return -EINVAL; - - if (req->cryptlen == 0) - return 0; - return stm32_cryp_crypt(req, FLG_TDES | FLG_CBC); } @@ -986,7 +919,6 @@ struct stm32_cryp_ctx *ctx; struct stm32_cryp *cryp; struct stm32_cryp_reqctx *rctx; - struct scatterlist *in_sg; int ret; if (!req && !areq) @@ -1012,55 +944,76 @@ if (req) { cryp->req = req; cryp->areq = NULL; + cryp->total_in = req->cryptlen; + cryp->total_out = cryp->total_in; - cryp->header_in = 0; - cryp->payload_in = req->cryptlen; - cryp->payload_out = req->cryptlen; - cryp->authsize = 0; } else { /* * Length of input and output data: * Encryption case: + * INPUT = AssocData || PlainText - * INPUT = AssocData || PlainText * <- assoclen -> <- cryptlen -> + * <------- total_in -----------> * + * OUTPUT = AssocData || CipherText || AuthTag + * <- assoclen -> <- cryptlen -> <- authsize -> + * <---------------- total_out -----------------> - * OUTPUT = AssocData || CipherText || AuthTag - * <- assoclen -> <-- cryptlen --> <- authsize -> * * Decryption case: + * INPUT = AssocData || CipherText || AuthTag + * <- assoclen -> <--------- cryptlen ---------> + * <- authsize -> + * <---------------- total_in ------------------> - * INPUT = AssocData || CipherTex || AuthTag - * <- assoclen ---> <---------- cryptlen ----------> * + * OUTPUT = AssocData || PlainText + * <- assoclen -> <- crypten - authsize -> + * <---------- total_out -----------------> - * OUTPUT = AssocData || PlainText - * <- assoclen -> <- cryptlen - authsize -> */ cryp->areq = areq; cryp->req = NULL; cryp->authsize = crypto_aead_authsize(crypto_aead_reqtfm(areq)); + cryp->total_in = areq->assoclen + areq->cryptlen; + if (is_encrypt(cryp)) + /* Append auth tag to output */ + cryp->total_out = cryp->total_in + cryp->authsize; + else + /* No auth tag in output */ + cryp->total_out = cryp->total_in - cryp->authsize; - if (is_encrypt(cryp)) { - cryp->payload_in = areq->cryptlen; - cryp->header_in = areq->assoclen; - cryp->payload_out = areq->cryptlen; - } else { - cryp->payload_in = areq->cryptlen - cryp->authsize; - cryp->header_in = areq->assoclen; - cryp->payload_out = cryp->payload_in; - } } + cryp->total_in_save = cryp->total_in; + cryp->total_out_save = cryp->total_out; - in_sg = req ? req->src : areq->src; - scatterwalk_start(&cryp->in_walk, in_sg); + cryp->in_sg = req ? req->src : areq->src; cryp->out_sg = req ? req->dst : areq->dst; + cryp->out_sg_save = cryp->out_sg; + + cryp->in_sg_len = sg_nents_for_len(cryp->in_sg, cryp->total_in); + if (cryp->in_sg_len < 0) { + dev_err(cryp->dev, "Cannot get in_sg_len\n"); + ret = cryp->in_sg_len; + return ret; + } + + cryp->out_sg_len = sg_nents_for_len(cryp->out_sg, cryp->total_out); + if (cryp->out_sg_len < 0) { + dev_err(cryp->dev, "Cannot get out_sg_len\n"); + ret = cryp->out_sg_len; + return ret; + } + + ret = stm32_cryp_copy_sgs(cryp); + if (ret) + return ret; + + scatterwalk_start(&cryp->in_walk, cryp->in_sg); scatterwalk_start(&cryp->out_walk, cryp->out_sg); if (is_gcm(cryp) || is_ccm(cryp)) { /* In output, jump after assoc data */ + scatterwalk_advance(&cryp->out_walk, cryp->areq->assoclen); + cryp->total_out -= cryp->areq->assoclen; - scatterwalk_copychunks(NULL, &cryp->out_walk, cryp->areq->assoclen, 2); } - if (is_ctr(cryp)) - memset(cryp->last_ctr, 0, sizeof(cryp->last_ctr)); - ret = stm32_cryp_hw_init(cryp); return ret; } @@ -1108,7 +1061,8 @@ if (!cryp) return -ENODEV; + if (unlikely(!cryp->areq->assoclen && + !stm32_cryp_get_input_text_len(cryp))) { - if (unlikely(!cryp->payload_in && !cryp->header_in)) { /* No input data to process: get tag and finish */ stm32_cryp_finish_req(cryp, 0); return 0; @@ -1117,10 +1071,43 @@ return stm32_cryp_cpu_start(cryp); } +static u32 *stm32_cryp_next_out(struct stm32_cryp *cryp, u32 *dst, + unsigned int n) +{ + scatterwalk_advance(&cryp->out_walk, n); + + if (unlikely(cryp->out_sg->length == _walked_out)) { + cryp->out_sg = sg_next(cryp->out_sg); + if (cryp->out_sg) { + scatterwalk_start(&cryp->out_walk, cryp->out_sg); + return (sg_virt(cryp->out_sg) + _walked_out); + } + } + + return (u32 *)((u8 *)dst + n); +} + +static u32 *stm32_cryp_next_in(struct stm32_cryp *cryp, u32 *src, + unsigned int n) +{ + scatterwalk_advance(&cryp->in_walk, n); + + if (unlikely(cryp->in_sg->length == _walked_in)) { + cryp->in_sg = sg_next(cryp->in_sg); + if (cryp->in_sg) { + scatterwalk_start(&cryp->in_walk, cryp->in_sg); + return (sg_virt(cryp->in_sg) + _walked_in); + } + } + + return (u32 *)((u8 *)src + n); +} + static int stm32_cryp_read_auth_tag(struct stm32_cryp *cryp) { + u32 cfg, size_bit, *dst, d32; + u8 *d8; + unsigned int i, j; - u32 cfg, size_bit; - unsigned int i; int ret = 0; /* Update Config */ @@ -1143,7 +1130,7 @@ stm32_cryp_write(cryp, CRYP_DIN, size_bit); size_bit = is_encrypt(cryp) ? cryp->areq->cryptlen : + cryp->areq->cryptlen - AES_BLOCK_SIZE; - cryp->areq->cryptlen - cryp->authsize; size_bit *= 8; if (cryp->caps->swap_final) size_bit = (__force u32)cpu_to_be32(size_bit); @@ -1152,9 +1139,11 @@ stm32_cryp_write(cryp, CRYP_DIN, size_bit); } else { /* CCM: write CTR0 */ + u8 iv[AES_BLOCK_SIZE]; + u32 *iv32 = (u32 *)iv; + __be32 *biv; + + biv = (void *)iv; - u32 iv32[AES_BLOCK_32]; - u8 *iv = (u8 *)iv32; - __be32 *biv = (__be32 *)iv32; memcpy(iv, cryp->areq->iv, AES_BLOCK_SIZE); memset(iv + AES_BLOCK_SIZE - 1 - iv[0], 0, iv[0] + 1); @@ -1176,18 +1165,39 @@ } if (is_encrypt(cryp)) { - u32 out_tag[AES_BLOCK_32]; - /* Get and write tag */ + dst = sg_virt(cryp->out_sg) + _walked_out; - for (i = 0; i < AES_BLOCK_32; i++) - out_tag[i] = stm32_cryp_read(cryp, CRYP_DOUT); + for (i = 0; i < AES_BLOCK_32; i++) { + if (cryp->total_out >= sizeof(u32)) { + /* Read a full u32 */ + *dst = stm32_cryp_read(cryp, CRYP_DOUT); + + dst = stm32_cryp_next_out(cryp, dst, + sizeof(u32)); + cryp->total_out -= sizeof(u32); + } else if (!cryp->total_out) { + /* Empty fifo out (data from input padding) */ + stm32_cryp_read(cryp, CRYP_DOUT); + } else { + /* Read less than an u32 */ + d32 = stm32_cryp_read(cryp, CRYP_DOUT); + d8 = (u8 *)&d32; + + for (j = 0; j < cryp->total_out; j++) { + *((u8 *)dst) = *(d8++); + dst = stm32_cryp_next_out(cryp, dst, 1); + } + cryp->total_out = 0; + } + } - scatterwalk_copychunks(out_tag, &cryp->out_walk, cryp->authsize, 1); } else { /* Get and check tag */ u32 in_tag[AES_BLOCK_32], out_tag[AES_BLOCK_32]; + scatterwalk_map_and_copy(in_tag, cryp->in_sg, + cryp->total_in_save - cryp->authsize, + cryp->authsize, 0); - scatterwalk_copychunks(in_tag, &cryp->in_walk, cryp->authsize, 0); for (i = 0; i < AES_BLOCK_32; i++) out_tag[i] = stm32_cryp_read(cryp, CRYP_DOUT); @@ -1207,59 +1217,115 @@ { u32 cr; + if (unlikely(cryp->last_ctr[3] == 0xFFFFFFFF)) { + cryp->last_ctr[3] = 0; + cryp->last_ctr[2]++; + if (!cryp->last_ctr[2]) { + cryp->last_ctr[1]++; + if (!cryp->last_ctr[1]) + cryp->last_ctr[0]++; + } - if (unlikely(cryp->last_ctr[3] == cpu_to_be32(0xFFFFFFFF))) { - /* - * In this case, we need to increment manually the ctr counter, - * as HW doesn't handle the U32 carry. - */ - crypto_inc((u8 *)cryp->last_ctr, sizeof(cryp->last_ctr)); cr = stm32_cryp_read(cryp, CRYP_CR); stm32_cryp_write(cryp, CRYP_CR, cr & ~CR_CRYPEN); + stm32_cryp_hw_write_iv(cryp, (__be32 *)cryp->last_ctr); - stm32_cryp_hw_write_iv(cryp, cryp->last_ctr); stm32_cryp_write(cryp, CRYP_CR, cr); } + cryp->last_ctr[0] = stm32_cryp_read(cryp, CRYP_IV0LR); + cryp->last_ctr[1] = stm32_cryp_read(cryp, CRYP_IV0RR); + cryp->last_ctr[2] = stm32_cryp_read(cryp, CRYP_IV1LR); + cryp->last_ctr[3] = stm32_cryp_read(cryp, CRYP_IV1RR); +} + +static bool stm32_cryp_irq_read_data(struct stm32_cryp *cryp) +{ + unsigned int i, j; + u32 d32, *dst; + u8 *d8; + size_t tag_size; + + /* Do no read tag now (if any) */ + if (is_encrypt(cryp) && (is_gcm(cryp) || is_ccm(cryp))) + tag_size = cryp->authsize; + else + tag_size = 0; - /* The IV registers are BE */ - cryp->last_ctr[0] = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0LR)); - cryp->last_ctr[1] = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0RR)); - cryp->last_ctr[2] = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1LR)); - cryp->last_ctr[3] = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1RR)); -} + dst = sg_virt(cryp->out_sg) + _walked_out; -static void stm32_cryp_irq_read_data(struct stm32_cryp *cryp) -{ - unsigned int i; - u32 block[AES_BLOCK_32]; + for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) { + if (likely(cryp->total_out - tag_size >= sizeof(u32))) { + /* Read a full u32 */ + *dst = stm32_cryp_read(cryp, CRYP_DOUT); + + dst = stm32_cryp_next_out(cryp, dst, sizeof(u32)); + cryp->total_out -= sizeof(u32); + } else if (cryp->total_out == tag_size) { + /* Empty fifo out (data from input padding) */ + d32 = stm32_cryp_read(cryp, CRYP_DOUT); + } else { + /* Read less than an u32 */ + d32 = stm32_cryp_read(cryp, CRYP_DOUT); + d8 = (u8 *)&d32; + + for (j = 0; j < cryp->total_out - tag_size; j++) { + *((u8 *)dst) = *(d8++); + dst = stm32_cryp_next_out(cryp, dst, 1); + } + cryp->total_out = tag_size; + } + } - for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) - block[i] = stm32_cryp_read(cryp, CRYP_DOUT); + return !(cryp->total_out - tag_size) || !cryp->total_in; - scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blocksize, - cryp->payload_out), 1); - cryp->payload_out -= min_t(size_t, cryp->hw_blocksize, - cryp->payload_out); } static void stm32_cryp_irq_write_block(struct stm32_cryp *cryp) { + unsigned int i, j; + u32 *src; + u8 d8[4]; + size_t tag_size; + + /* Do no write tag (if any) */ + if (is_decrypt(cryp) && (is_gcm(cryp) || is_ccm(cryp))) + tag_size = cryp->authsize; + else + tag_size = 0; + + src = sg_virt(cryp->in_sg) + _walked_in; - unsigned int i; - u32 block[AES_BLOCK_32] = {0}; + for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) { + if (likely(cryp->total_in - tag_size >= sizeof(u32))) { + /* Write a full u32 */ + stm32_cryp_write(cryp, CRYP_DIN, *src); + + src = stm32_cryp_next_in(cryp, src, sizeof(u32)); + cryp->total_in -= sizeof(u32); + } else if (cryp->total_in == tag_size) { + /* Write padding data */ + stm32_cryp_write(cryp, CRYP_DIN, 0); + } else { + /* Write less than an u32 */ + memset(d8, 0, sizeof(u32)); + for (j = 0; j < cryp->total_in - tag_size; j++) { + d8[j] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + } - scatterwalk_copychunks(block, &cryp->in_walk, min_t(size_t, cryp->hw_blocksize, - cryp->payload_in), 0); - for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) - stm32_cryp_write(cryp, CRYP_DIN, block[i]); + stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); + cryp->total_in = tag_size; + } + } - cryp->payload_in -= min_t(size_t, cryp->hw_blocksize, cryp->payload_in); } static void stm32_cryp_irq_write_gcm_padded_data(struct stm32_cryp *cryp) { int err; + u32 cfg, tmp[AES_BLOCK_32]; + size_t total_in_ori = cryp->total_in; + struct scatterlist *out_sg_ori = cryp->out_sg; - u32 cfg, block[AES_BLOCK_32] = {0}; unsigned int i; /* 'Special workaround' procedure described in the datasheet */ @@ -1284,25 +1350,18 @@ /* b) pad and write the last block */ stm32_cryp_irq_write_block(cryp); + cryp->total_in = total_in_ori; - /* wait end of process */ err = stm32_cryp_wait_output(cryp); if (err) { + dev_err(cryp->dev, "Timeout (write gcm header)\n"); - dev_err(cryp->dev, "Timeout (write gcm last data)\n"); return stm32_cryp_finish_req(cryp, err); } /* c) get and store encrypted data */ + stm32_cryp_irq_read_data(cryp); + scatterwalk_map_and_copy(tmp, out_sg_ori, + cryp->total_in_save - total_in_ori, + total_in_ori, 0); - /* - * Same code as stm32_cryp_irq_read_data(), but we want to store - * block value - */ - for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) - block[i] = stm32_cryp_read(cryp, CRYP_DOUT); - - scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blocksize, - cryp->payload_out), 1); - cryp->payload_out -= min_t(size_t, cryp->hw_blocksize, - cryp->payload_out); /* d) change mode back to AES GCM */ cfg &= ~CR_ALGO_MASK; @@ -1315,13 +1374,19 @@ stm32_cryp_write(cryp, CRYP_CR, cfg); /* f) write padded data */ + for (i = 0; i < AES_BLOCK_32; i++) { + if (cryp->total_in) + stm32_cryp_write(cryp, CRYP_DIN, tmp[i]); + else + stm32_cryp_write(cryp, CRYP_DIN, 0); + + cryp->total_in -= min_t(size_t, sizeof(u32), cryp->total_in); + } - for (i = 0; i < AES_BLOCK_32; i++) - stm32_cryp_write(cryp, CRYP_DIN, block[i]); /* g) Empty fifo out */ err = stm32_cryp_wait_output(cryp); if (err) { + dev_err(cryp->dev, "Timeout (write gcm header)\n"); - dev_err(cryp->dev, "Timeout (write gcm padded data)\n"); return stm32_cryp_finish_req(cryp, err); } @@ -1334,14 +1399,16 @@ static void stm32_cryp_irq_set_npblb(struct stm32_cryp *cryp) { + u32 cfg, payload_bytes; - u32 cfg; /* disable ip, set NPBLB and reneable ip */ cfg = stm32_cryp_read(cryp, CRYP_CR); cfg &= ~CR_CRYPEN; stm32_cryp_write(cryp, CRYP_CR, cfg); + payload_bytes = is_decrypt(cryp) ? cryp->total_in - cryp->authsize : + cryp->total_in; + cfg |= (cryp->hw_blocksize - payload_bytes) << CR_NBPBL_SHIFT; - cfg |= (cryp->hw_blocksize - cryp->payload_in) << CR_NBPBL_SHIFT; cfg |= CR_CRYPEN; stm32_cryp_write(cryp, CRYP_CR, cfg); } @@ -1350,11 +1417,13 @@ { int err = 0; u32 cfg, iv1tmp; + u32 cstmp1[AES_BLOCK_32], cstmp2[AES_BLOCK_32], tmp[AES_BLOCK_32]; + size_t last_total_out, total_in_ori = cryp->total_in; + struct scatterlist *out_sg_ori = cryp->out_sg; - u32 cstmp1[AES_BLOCK_32], cstmp2[AES_BLOCK_32]; - u32 block[AES_BLOCK_32] = {0}; unsigned int i; /* 'Special workaround' procedure described in the datasheet */ + cryp->flags |= FLG_CCM_PADDED_WA; /* a) disable ip */ stm32_cryp_write(cryp, CRYP_IMSCR, 0); @@ -1384,7 +1453,7 @@ /* b) pad and write the last block */ stm32_cryp_irq_write_block(cryp); + cryp->total_in = total_in_ori; - /* wait end of process */ err = stm32_cryp_wait_output(cryp); if (err) { dev_err(cryp->dev, "Timeout (wite ccm padded data)\n"); @@ -1392,16 +1461,13 @@ } /* c) get and store decrypted data */ + last_total_out = cryp->total_out; + stm32_cryp_irq_read_data(cryp); + + memset(tmp, 0, sizeof(tmp)); + scatterwalk_map_and_copy(tmp, out_sg_ori, + cryp->total_out_save - last_total_out, + last_total_out, 0); - /* - * Same code as stm32_cryp_irq_read_data(), but we want to store - * block value - */ - for (i = 0; i < cryp->hw_blocksize / sizeof(u32); i++) - block[i] = stm32_cryp_read(cryp, CRYP_DOUT); - - scatterwalk_copychunks(block, &cryp->out_walk, min_t(size_t, cryp->hw_blocksize, - cryp->payload_out), 1); - cryp->payload_out -= min_t(size_t, cryp->hw_blocksize, cryp->payload_out); /* d) Load again CRYP_CSGCMCCMxR */ for (i = 0; i < ARRAY_SIZE(cstmp2); i++) @@ -1418,10 +1484,10 @@ stm32_cryp_write(cryp, CRYP_CR, cfg); /* g) XOR and write padded data */ + for (i = 0; i < ARRAY_SIZE(tmp); i++) { + tmp[i] ^= cstmp1[i]; + tmp[i] ^= cstmp2[i]; + stm32_cryp_write(cryp, CRYP_DIN, tmp[i]); - for (i = 0; i < ARRAY_SIZE(block); i++) { - block[i] ^= cstmp1[i]; - block[i] ^= cstmp2[i]; - stm32_cryp_write(cryp, CRYP_DIN, block[i]); } /* h) wait for completion */ @@ -1435,34 +1501,30 @@ static void stm32_cryp_irq_write_data(struct stm32_cryp *cryp) { + if (unlikely(!cryp->total_in)) { - if (unlikely(!cryp->payload_in)) { dev_warn(cryp->dev, "No more data to process\n"); return; } + if (unlikely(cryp->total_in < AES_BLOCK_SIZE && - if (unlikely(cryp->payload_in < AES_BLOCK_SIZE && (stm32_cryp_get_hw_mode(cryp) == CR_AES_GCM) && is_encrypt(cryp))) { /* Padding for AES GCM encryption */ + if (cryp->caps->padding_wa) - if (cryp->caps->padding_wa) { /* Special case 1 */ + return stm32_cryp_irq_write_gcm_padded_data(cryp); - stm32_cryp_irq_write_gcm_padded_data(cryp); - return; - } /* Setting padding bytes (NBBLB) */ stm32_cryp_irq_set_npblb(cryp); } + if (unlikely((cryp->total_in - cryp->authsize < AES_BLOCK_SIZE) && - if (unlikely((cryp->payload_in < AES_BLOCK_SIZE) && (stm32_cryp_get_hw_mode(cryp) == CR_AES_CCM) && is_decrypt(cryp))) { /* Padding for AES CCM decryption */ + if (cryp->caps->padding_wa) - if (cryp->caps->padding_wa) { /* Special case 2 */ + return stm32_cryp_irq_write_ccm_padded_data(cryp); - stm32_cryp_irq_write_ccm_padded_data(cryp); - return; - } /* Setting padding bytes (NBBLB) */ stm32_cryp_irq_set_npblb(cryp); @@ -1474,60 +1536,192 @@ stm32_cryp_irq_write_block(cryp); } +static void stm32_cryp_irq_write_gcm_header(struct stm32_cryp *cryp) -static void stm32_cryp_irq_write_gcmccm_header(struct stm32_cryp *cryp) { + int err; + unsigned int i, j; + u32 cfg, *src; + + src = sg_virt(cryp->in_sg) + _walked_in; + + for (i = 0; i < AES_BLOCK_32; i++) { + stm32_cryp_write(cryp, CRYP_DIN, *src); + + src = stm32_cryp_next_in(cryp, src, sizeof(u32)); + cryp->total_in -= min_t(size_t, sizeof(u32), cryp->total_in); + + /* Check if whole header written */ + if ((cryp->total_in_save - cryp->total_in) == + cryp->areq->assoclen) { + /* Write padding if needed */ + for (j = i + 1; j < AES_BLOCK_32; j++) + stm32_cryp_write(cryp, CRYP_DIN, 0); + + /* Wait for completion */ + err = stm32_cryp_wait_busy(cryp); + if (err) { + dev_err(cryp->dev, "Timeout (gcm header)\n"); + return stm32_cryp_finish_req(cryp, err); + } + + if (stm32_cryp_get_input_text_len(cryp)) { + /* Phase 3 : payload */ + cfg = stm32_cryp_read(cryp, CRYP_CR); + cfg &= ~CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + + cfg &= ~CR_PH_MASK; + cfg |= CR_PH_PAYLOAD; + cfg |= CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } else { + /* Phase 4 : tag */ + stm32_cryp_write(cryp, CRYP_IMSCR, 0); + stm32_cryp_finish_req(cryp, 0); + } + + break; + } + + if (!cryp->total_in) + break; + } +} + +static void stm32_cryp_irq_write_ccm_header(struct stm32_cryp *cryp) +{ + int err; + unsigned int i = 0, j, k; + u32 alen, cfg, *src; + u8 d8[4]; + + src = sg_virt(cryp->in_sg) + _walked_in; + alen = cryp->areq->assoclen; + + if (!_walked_in) { + if (cryp->areq->assoclen <= 65280) { + /* Write first u32 of B1 */ + d8[0] = (alen >> 8) & 0xFF; + d8[1] = alen & 0xFF; + d8[2] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + d8[3] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + + stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); + i++; + + cryp->total_in -= min_t(size_t, 2, cryp->total_in); + } else { + /* Build the two first u32 of B1 */ + d8[0] = 0xFF; + d8[1] = 0xFE; + d8[2] = alen & 0xFF000000; + d8[3] = alen & 0x00FF0000; + + stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); + i++; + + d8[0] = alen & 0x0000FF00; + d8[1] = alen & 0x000000FF; + d8[2] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + d8[3] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + + stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); + i++; + + cryp->total_in -= min_t(size_t, 2, cryp->total_in); + } + } - unsigned int i; - u32 block[AES_BLOCK_32] = {0}; - size_t written; + /* Write next u32 */ + for (; i < AES_BLOCK_32; i++) { + /* Build an u32 */ + memset(d8, 0, sizeof(u32)); + for (k = 0; k < sizeof(u32); k++) { + d8[k] = *((u8 *)src); + src = stm32_cryp_next_in(cryp, src, 1); + + cryp->total_in -= min_t(size_t, 1, cryp->total_in); + if ((cryp->total_in_save - cryp->total_in) == alen) + break; + } - written = min_t(size_t, AES_BLOCK_SIZE, cryp->header_in); + stm32_cryp_write(cryp, CRYP_DIN, *(u32 *)d8); - scatterwalk_copychunks(block, &cryp->in_walk, written, 0); - for (i = 0; i < AES_BLOCK_32; i++) - stm32_cryp_write(cryp, CRYP_DIN, block[i]); + if ((cryp->total_in_save - cryp->total_in) == alen) { + /* Write padding if needed */ + for (j = i + 1; j < AES_BLOCK_32; j++) + stm32_cryp_write(cryp, CRYP_DIN, 0); + + /* Wait for completion */ + err = stm32_cryp_wait_busy(cryp); + if (err) { + dev_err(cryp->dev, "Timeout (ccm header)\n"); + return stm32_cryp_finish_req(cryp, err); + } + + if (stm32_cryp_get_input_text_len(cryp)) { + /* Phase 3 : payload */ + cfg = stm32_cryp_read(cryp, CRYP_CR); + cfg &= ~CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + + cfg &= ~CR_PH_MASK; + cfg |= CR_PH_PAYLOAD; + cfg |= CR_CRYPEN; + stm32_cryp_write(cryp, CRYP_CR, cfg); + } else { + /* Phase 4 : tag */ + stm32_cryp_write(cryp, CRYP_IMSCR, 0); + stm32_cryp_finish_req(cryp, 0); + } - cryp->header_in -= written; + break; + } + } - stm32_crypt_gcmccm_end_header(cryp); } static irqreturn_t stm32_cryp_irq_thread(int irq, void *arg) { struct stm32_cryp *cryp = arg; u32 ph; - u32 it_mask = stm32_cryp_read(cryp, CRYP_IMSCR); if (cryp->irq_status & MISR_OUT) /* Output FIFO IRQ: read data */ + if (unlikely(stm32_cryp_irq_read_data(cryp))) { + /* All bytes processed, finish */ + stm32_cryp_write(cryp, CRYP_IMSCR, 0); + stm32_cryp_finish_req(cryp, 0); + return IRQ_HANDLED; + } - stm32_cryp_irq_read_data(cryp); if (cryp->irq_status & MISR_IN) { + if (is_gcm(cryp)) { - if (is_gcm(cryp) || is_ccm(cryp)) { ph = stm32_cryp_read(cryp, CRYP_CR) & CR_PH_MASK; if (unlikely(ph == CR_PH_HEADER)) /* Write Header */ + stm32_cryp_irq_write_gcm_header(cryp); + else + /* Input FIFO IRQ: write data */ + stm32_cryp_irq_write_data(cryp); + cryp->gcm_ctr++; + } else if (is_ccm(cryp)) { + ph = stm32_cryp_read(cryp, CRYP_CR) & CR_PH_MASK; + if (unlikely(ph == CR_PH_HEADER)) + /* Write Header */ + stm32_cryp_irq_write_ccm_header(cryp); - stm32_cryp_irq_write_gcmccm_header(cryp); else /* Input FIFO IRQ: write data */ stm32_cryp_irq_write_data(cryp); - if (is_gcm(cryp)) - cryp->gcm_ctr++; } else { /* Input FIFO IRQ: write data */ stm32_cryp_irq_write_data(cryp); } } - /* Mask useless interrupts */ - if (!cryp->payload_in && !cryp->header_in) - it_mask &= ~IMSCR_IN; - if (!cryp->payload_out) - it_mask &= ~IMSCR_OUT; - stm32_cryp_write(cryp, CRYP_IMSCR, it_mask); - - if (!cryp->payload_in && !cryp->header_in && !cryp->payload_out) - stm32_cryp_finish_req(cryp, 0); - return IRQ_HANDLED; } @@ -1548,7 +1742,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1565,7 +1759,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1583,7 +1777,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = 1, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1601,7 +1795,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1618,7 +1812,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1636,7 +1830,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1653,7 +1847,7 @@ .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .base.cra_alignmask = 0xf, - .base.cra_alignmask = 0, .base.cra_module = THIS_MODULE, .init = stm32_cryp_init_tfm, @@ -1683,7 +1877,7 @@ .cra_flags = CRYPTO_ALG_ASYNC, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .cra_alignmask = 0xf, - .cra_alignmask = 0, .cra_module = THIS_MODULE, }, }, @@ -1703,7 +1897,7 @@ .cra_flags = CRYPTO_ALG_ASYNC, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct stm32_cryp_ctx), + .cra_alignmask = 0xf, - .cra_alignmask = 0, .cra_module = THIS_MODULE, }, }, @@ -1833,6 +2027,8 @@ pm_runtime_disable(dev); pm_runtime_put_noidle(dev); + pm_runtime_disable(dev); + pm_runtime_put_noidle(dev); clk_disable_unprepare(cryp->clk); reverted: --- linux-aws-5.13-5.13.0/drivers/crypto/stm32/stm32-hash.c +++ linux-aws-5.13-5.13.0.orig/drivers/crypto/stm32/stm32-hash.c @@ -813,7 +813,7 @@ static int stm32_hash_hw_init(struct stm32_hash_dev *hdev, struct stm32_hash_request_ctx *rctx) { + pm_runtime_resume_and_get(hdev->dev); - pm_runtime_get_sync(hdev->dev); if (!(HASH_FLAGS_INIT & hdev->flags)) { stm32_hash_write(hdev, HASH_CR, HASH_CR_INIT); @@ -962,7 +962,7 @@ u32 *preg; unsigned int i; + pm_runtime_resume_and_get(hdev->dev); - pm_runtime_get_sync(hdev->dev); while ((stm32_hash_read(hdev, HASH_SR) & HASH_SR_BUSY)) cpu_relax(); @@ -1000,7 +1000,7 @@ preg = rctx->hw_context; + pm_runtime_resume_and_get(hdev->dev); - pm_runtime_get_sync(hdev->dev); stm32_hash_write(hdev, HASH_IMR, *preg++); stm32_hash_write(hdev, HASH_STR, *preg++); reverted: --- linux-aws-5.13-5.13.0/drivers/dma-buf/dma-fence-array.c +++ linux-aws-5.13-5.13.0.orig/drivers/dma-buf/dma-fence-array.c @@ -104,11 +104,7 @@ { struct dma_fence_array *array = to_dma_fence_array(fence); + return atomic_read(&array->num_pending) <= 0; - if (atomic_read(&array->num_pending) > 0) - return false; - - dma_fence_array_clear_pending_error(array); - return true; } static void dma_fence_array_release(struct dma_fence *fence) diff -u linux-aws-5.13-5.13.0/drivers/dma/at_xdmac.c linux-aws-5.13-5.13.0/drivers/dma/at_xdmac.c --- linux-aws-5.13-5.13.0/drivers/dma/at_xdmac.c +++ linux-aws-5.13-5.13.0/drivers/dma/at_xdmac.c @@ -99,7 +99,6 @@ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ -#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ @@ -253,15 +252,15 @@ /* Linked List Descriptor */ struct at_xdmac_lld { - u32 mbr_nda; /* Next Descriptor Member */ - u32 mbr_ubc; /* Microblock Control Member */ - u32 mbr_sa; /* Source Address Member */ - u32 mbr_da; /* Destination Address Member */ - u32 mbr_cfg; /* Configuration Register */ - u32 mbr_bc; /* Block Control Register */ - u32 mbr_ds; /* Data Stride Register */ - u32 mbr_sus; /* Source Microblock Stride Register */ - u32 mbr_dus; /* Destination Microblock Stride Register */ + dma_addr_t mbr_nda; /* Next Descriptor Member */ + u32 mbr_ubc; /* Microblock Control Member */ + dma_addr_t mbr_sa; /* Source Address Member */ + dma_addr_t mbr_da; /* Destination Address Member */ + u32 mbr_cfg; /* Configuration Register */ + u32 mbr_bc; /* Block Control Register */ + u32 mbr_ds; /* Data Stride Register */ + u32 mbr_sus; /* Source Microblock Stride Register */ + u32 mbr_dus; /* Destination Microblock Stride Register */ }; /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ @@ -386,6 +385,9 @@ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); + if (at_xdmac_chan_is_enabled(atchan)) + return; + /* Set transfer as active to not try to start it again. */ first->active_xfer = true; @@ -403,8 +405,7 @@ */ if (at_xdmac_chan_is_cyclic(atchan)) reg = AT_XDMAC_CNDC_NDVIEW_NDV1; - else if ((first->lld.mbr_ubc & - AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) + else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) reg = AT_XDMAC_CNDC_NDVIEW_NDV3; else reg = AT_XDMAC_CNDC_NDVIEW_NDV2; @@ -475,12 +476,13 @@ spin_lock_irqsave(&atchan->lock, irqflags); cookie = dma_cookie_assign(tx); - list_add_tail(&desc->xfer_node, &atchan->xfers_list); - spin_unlock_irqrestore(&atchan->lock, irqflags); - dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", __func__, atchan, desc); + list_add_tail(&desc->xfer_node, &atchan->xfers_list); + if (list_is_singular(&atchan->xfers_list)) + at_xdmac_start_xfer(atchan, desc); + spin_unlock_irqrestore(&atchan->lock, irqflags); return cookie; } @@ -1621,17 +1623,14 @@ struct at_xdmac_desc *desc; struct dma_async_tx_descriptor *txd; - spin_lock_irq(&atchan->lock); - if (list_empty(&atchan->xfers_list)) { - spin_unlock_irq(&atchan->lock); - return; + if (!list_empty(&atchan->xfers_list)) { + desc = list_first_entry(&atchan->xfers_list, + struct at_xdmac_desc, xfer_node); + txd = &desc->tx_dma_desc; + + if (txd->flags & DMA_PREP_INTERRUPT) + dmaengine_desc_get_callback_invoke(txd, NULL); } - desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, - xfer_node); - spin_unlock_irq(&atchan->lock); - txd = &desc->tx_dma_desc; - if (txd->flags & DMA_PREP_INTERRUPT) - dmaengine_desc_get_callback_invoke(txd, NULL); } static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) @@ -1785,9 +1784,11 @@ dev_dbg(chan2dev(&atchan->chan), "%s\n", __func__); - spin_lock_irqsave(&atchan->lock, flags); - at_xdmac_advance_work(atchan); - spin_unlock_irqrestore(&atchan->lock, flags); + if (!at_xdmac_chan_is_cyclic(atchan)) { + spin_lock_irqsave(&atchan->lock, flags); + at_xdmac_advance_work(atchan); + spin_unlock_irqrestore(&atchan->lock, flags); + } return; } diff -u linux-aws-5.13-5.13.0/drivers/dma/idxd/device.c linux-aws-5.13-5.13.0/drivers/dma/idxd/device.c --- linux-aws-5.13-5.13.0/drivers/dma/idxd/device.c +++ linux-aws-5.13-5.13.0/drivers/dma/idxd/device.c @@ -395,6 +395,8 @@ lockdep_assert_held(&wq->wq_lock); memset(wq->wqcfg, 0, idxd->wqcfg_size); wq->type = IDXD_WQT_NONE; + wq->size = 0; + wq->group = NULL; wq->threshold = 0; wq->priority = 0; wq->ats_dis = 0; @@ -403,15 +405,6 @@ memset(wq->name, 0, WQ_NAME_SIZE); } -static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq) -{ - lockdep_assert_held(&wq->wq_lock); - - idxd_wq_disable_cleanup(wq); - wq->size = 0; - wq->group = NULL; -} - static void idxd_wq_ref_release(struct percpu_ref *ref) { struct idxd_wq *wq = container_of(ref, struct idxd_wq, wq_active); @@ -724,7 +717,6 @@ if (wq->state == IDXD_WQ_ENABLED) { idxd_wq_disable_cleanup(wq); - idxd_wq_device_reset_cleanup(wq); wq->state = IDXD_WQ_DISABLED; } } reverted: --- linux-aws-5.13-5.13.0/drivers/dma/mmp_pdma.c +++ linux-aws-5.13-5.13.0.orig/drivers/dma/mmp_pdma.c @@ -727,6 +727,12 @@ chan->dir = direction; chan->dev_addr = addr; + /* FIXME: drivers should be ported over to use the filter + * function. Once that's done, the following two lines can + * be removed. + */ + if (cfg->slave_id) + chan->drcmr = cfg->slave_id; return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/dma/pxa_dma.c +++ linux-aws-5.13-5.13.0.orig/drivers/dma/pxa_dma.c @@ -910,6 +910,13 @@ *dcmd |= PXA_DCMD_BURST16; else if (maxburst == 32) *dcmd |= PXA_DCMD_BURST32; + + /* FIXME: drivers should be ported over to use the filter + * function. Once that's done, the following two lines can + * be removed. + */ + if (chan->cfg.slave_id) + chan->drcmr = chan->cfg.slave_id; } static struct dma_async_tx_descriptor * reverted: --- linux-aws-5.13-5.13.0/drivers/dma/stm32-mdma.c +++ linux-aws-5.13-5.13.0.orig/drivers/dma/stm32-mdma.c @@ -184,7 +184,7 @@ #define STM32_MDMA_CTBR(x) (0x68 + 0x40 * (x)) #define STM32_MDMA_CTBR_DBUS BIT(17) #define STM32_MDMA_CTBR_SBUS BIT(16) +#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(7, 0) -#define STM32_MDMA_CTBR_TSEL_MASK GENMASK(5, 0) #define STM32_MDMA_CTBR_TSEL(n) STM32_MDMA_SET(n, \ STM32_MDMA_CTBR_TSEL_MASK) diff -u linux-aws-5.13-5.13.0/drivers/dma/uniphier-xdmac.c linux-aws-5.13-5.13.0/drivers/dma/uniphier-xdmac.c --- linux-aws-5.13-5.13.0/drivers/dma/uniphier-xdmac.c +++ linux-aws-5.13-5.13.0/drivers/dma/uniphier-xdmac.c @@ -131,9 +131,8 @@ static void uniphier_xdmac_chan_start(struct uniphier_xdmac_chan *xc, struct uniphier_xdmac_desc *xd) { - u32 src_mode, src_width; - u32 dst_mode, dst_width; - dma_addr_t src_addr, dst_addr; + u32 src_mode, src_addr, src_width; + u32 dst_mode, dst_addr, dst_width; u32 val, its, tnum; enum dma_slave_buswidth buswidth; diff -u linux-aws-5.13-5.13.0/drivers/edac/synopsys_edac.c linux-aws-5.13-5.13.0/drivers/edac/synopsys_edac.c --- linux-aws-5.13-5.13.0/drivers/edac/synopsys_edac.c +++ linux-aws-5.13-5.13.0/drivers/edac/synopsys_edac.c @@ -1352,7 +1352,8 @@ } } - if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) + if (of_device_is_compatible(pdev->dev.of_node, + "xlnx,zynqmp-ddrc-2.40a")) setup_address_map(priv); #endif diff -u linux-aws-5.13-5.13.0/drivers/firmware/efi/efi.c linux-aws-5.13-5.13.0/drivers/firmware/efi/efi.c --- linux-aws-5.13-5.13.0/drivers/firmware/efi/efi.c +++ linux-aws-5.13-5.13.0/drivers/firmware/efi/efi.c @@ -720,13 +720,6 @@ systab_hdr->revision >> 16, systab_hdr->revision & 0xffff, vendor); - - if (IS_ENABLED(CONFIG_X86_64) && - systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION && - !strcmp(vendor, "Apple")) { - pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n"); - efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION; - } } static __initdata char memory_type_name[][13] = { diff -u linux-aws-5.13-5.13.0/drivers/firmware/efi/libstub/arm64-stub.c linux-aws-5.13-5.13.0/drivers/firmware/efi/libstub/arm64-stub.c --- linux-aws-5.13-5.13.0/drivers/firmware/efi/libstub/arm64-stub.c +++ linux-aws-5.13-5.13.0/drivers/firmware/efi/libstub/arm64-stub.c @@ -119,9 +119,9 @@ if (image->image_base != _text) efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); - if (!IS_ALIGNED((u64)_text, SEGMENT_ALIGN)) - efi_err("FIRMWARE BUG: kernel image not aligned on %dk boundary\n", - SEGMENT_ALIGN >> 10); + if (!IS_ALIGNED((u64)_text, EFI_KIMG_ALIGN)) + efi_err("FIRMWARE BUG: kernel image not aligned on %ldk boundary\n", + EFI_KIMG_ALIGN >> 10); kernel_size = _edata - _text; kernel_memsize = kernel_size + (_end - _edata); reverted: --- linux-aws-5.13-5.13.0/drivers/firmware/google/Kconfig +++ linux-aws-5.13-5.13.0.orig/drivers/firmware/google/Kconfig @@ -3,9 +3,9 @@ bool "Google Firmware Drivers" default n help + These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N". - These firmware drivers are used by Google servers, - Chromebooks and other devices using coreboot firmware. - If in doubt, say "N". if GOOGLE_FIRMWARE reverted: --- linux-aws-5.13-5.13.0/drivers/gpio/gpio-aspeed.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpio/gpio-aspeed.c @@ -53,7 +53,7 @@ struct aspeed_gpio { struct gpio_chip chip; struct irq_chip irqc; + spinlock_t lock; - raw_spinlock_t lock; void __iomem *base; int irq; const struct aspeed_gpio_config *config; @@ -413,14 +413,14 @@ unsigned long flags; bool copro; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); __aspeed_gpio_set(gc, offset, val); if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); } static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) @@ -435,7 +435,7 @@ if (!have_input(gpio, offset)) return -ENOTSUPP; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); reg = ioread32(addr); reg &= ~GPIO_BIT(offset); @@ -445,7 +445,7 @@ if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return 0; } @@ -463,7 +463,7 @@ if (!have_output(gpio, offset)) return -ENOTSUPP; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); reg = ioread32(addr); reg |= GPIO_BIT(offset); @@ -474,7 +474,7 @@ if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return 0; } @@ -492,11 +492,11 @@ if (!have_output(gpio, offset)) return GPIO_LINE_DIRECTION_IN; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); val = ioread32(bank_reg(gpio, bank, reg_dir)) & GPIO_BIT(offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return val ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; } @@ -539,14 +539,14 @@ status_addr = bank_reg(gpio, bank, reg_irq_status); + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); iowrite32(bit, status_addr); if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); } static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) @@ -565,7 +565,7 @@ addr = bank_reg(gpio, bank, reg_irq_enable); + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); reg = ioread32(addr); @@ -577,7 +577,7 @@ if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); } static void aspeed_gpio_irq_mask(struct irq_data *d) @@ -629,7 +629,7 @@ return -EINVAL; } + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); addr = bank_reg(gpio, bank, reg_irq_type0); @@ -649,7 +649,7 @@ if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); irq_set_handler_locked(d, handler); @@ -719,7 +719,7 @@ treg = bank_reg(gpio, to_bank(offset), reg_tolerance); + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); val = readl(treg); @@ -733,7 +733,7 @@ if (copro) aspeed_gpio_copro_release(gpio, offset); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return 0; } @@ -859,7 +859,7 @@ return rc; } + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); if (timer_allocation_registered(gpio, offset)) { rc = unregister_allocated_timer(gpio, offset); @@ -919,7 +919,7 @@ configure_timer(gpio, offset, i); out: + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } @@ -930,13 +930,13 @@ unsigned long flags; int rc; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); rc = unregister_allocated_timer(gpio, offset); if (!rc) configure_timer(gpio, offset, 0); + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } @@ -1018,7 +1018,7 @@ return -EINVAL; bindex = offset >> 3; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] == 0xff) { @@ -1039,7 +1039,7 @@ if (bit) *bit = GPIO_OFFSET(offset); bail: + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_grab_gpio); @@ -1063,7 +1063,7 @@ return -EINVAL; bindex = offset >> 3; + spin_lock_irqsave(&gpio->lock, flags); - raw_spin_lock_irqsave(&gpio->lock, flags); /* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] == 0) { @@ -1077,7 +1077,7 @@ aspeed_gpio_change_cmd_source(gpio, bank, bindex, GPIO_CMDSRC_ARM); bail: + spin_unlock_irqrestore(&gpio->lock, flags); - raw_spin_unlock_irqrestore(&gpio->lock, flags); return rc; } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); @@ -1151,7 +1151,7 @@ if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); + spin_lock_init(&gpio->lock); - raw_spin_lock_init(&gpio->lock); gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); if (!gpio_id) diff -u linux-aws-5.13-5.13.0/drivers/gpio/gpio-mpc8xxx.c linux-aws-5.13-5.13.0/drivers/gpio/gpio-mpc8xxx.c --- linux-aws-5.13-5.13.0/drivers/gpio/gpio-mpc8xxx.c +++ linux-aws-5.13-5.13.0/drivers/gpio/gpio-mpc8xxx.c @@ -388,8 +388,8 @@ } mpc8xxx_gc->irqn = platform_get_irq(pdev, 0); - if (mpc8xxx_gc->irqn < 0) - return mpc8xxx_gc->irqn; + if (!mpc8xxx_gc->irqn) + return 0; mpc8xxx_gc->irq = irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS, diff -u linux-aws-5.13-5.13.0/drivers/gpio/gpiolib-acpi.c linux-aws-5.13-5.13.0/drivers/gpio/gpiolib-acpi.c --- linux-aws-5.13-5.13.0/drivers/gpio/gpiolib-acpi.c +++ linux-aws-5.13-5.13.0/drivers/gpio/gpiolib-acpi.c @@ -1008,17 +1008,10 @@ irq_flags = acpi_dev_get_irq_type(info.triggering, info.polarity); - /* - * If the IRQ is not already in use then set type - * if specified and different than the current one. - */ - if (can_request_irq(irq, irq_flags)) { - if (irq_flags != IRQ_TYPE_NONE && - irq_flags != irq_get_trigger_type(irq)) - irq_set_irq_type(irq, irq_flags); - } else { - dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); - } + /* Set type if specified and different than the current one */ + if (irq_flags != IRQ_TYPE_NONE && + irq_flags != irq_get_trigger_type(irq)) + irq_set_irq_type(irq, irq_flags); return irq; } diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -387,9 +387,6 @@ native_mode->vdisplay != 0 && native_mode->clock != 0) { mode = drm_mode_duplicate(dev, native_mode); - if (!mode) - return NULL; - mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; drm_mode_set_name(mode); @@ -404,9 +401,6 @@ * simpler. */ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); - if (!mode) - return NULL; - mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -317,6 +317,7 @@ if (!amdgpu_device_has_dc_support(adev)) { if (!adev->enable_virtual_display) /* Disable vblank IRQs aggressively for power-saving */ + /* XXX: can this be enabled for DC? */ adev_to_drm(adev)->vblank_disable_immediate = true; r = drm_vblank_init(adev_to_drm(adev), adev->mode_info.num_crtc); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -1931,16 +1931,12 @@ DRM_WARN("PSP set boot config@\n"); } - if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) - goto skip_pin_bo; - ret = psp_tmr_init(psp); if (ret) { DRM_ERROR("PSP tmr init failed!\n"); return ret; } -skip_pin_bo: /* * For ASICs with DF Cstate management centralized * to PMFW, TMR setup should be performed after PMFW reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/cik.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/amdgpu/cik.c @@ -1428,10 +1428,6 @@ { int r; - /* APUs don't have full asic reset */ - if (adev->flags & AMD_IS_APU) - return 0; - if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { dev_info(adev->dev, "BACO reset\n"); r = amdgpu_dpm_baco_reset(adev); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c @@ -999,14 +999,10 @@ return -EINVAL; } - if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) - goto skip_pin_bo; - r = amdgpu_gart_table_vram_pin(adev); if (r) return r; -skip_pin_bo: r = adev->gfxhub.funcs->gart_enable(adev); if (r) return r; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -515,10 +515,10 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) { int r; - u32 tmp; adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); if (!adev->gmc.vram_width) { + u32 tmp; int chansize, numchan; /* Get VRAM informations */ @@ -562,15 +562,8 @@ adev->gmc.vram_width = numchan * chansize; } /* size in MB on si */ + adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; + adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; - tmp = RREG32(mmCONFIG_MEMSIZE); - /* some boards may have garbage in the upper 16 bits */ - if (tmp & 0xffff0000) { - DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); - if (tmp & 0xffff) - tmp &= 0xffff; - } - adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; - adev->gmc.real_vram_size = adev->gmc.mc_vram_size; if (!(adev->flags & AMD_IS_APU)) { r = amdgpu_device_resize_fb_bar(adev); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -69,9 +69,6 @@ #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 0x049d #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX 2 -#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2 0x05ea -#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2_BASE_IDX 2 - static const char *gfxhub_client_ids[] = { "CB", @@ -1102,8 +1099,6 @@ u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL); unsigned size; - /* TODO move to DC so GMC doesn't need to hard-code DCN registers */ - if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) { size = AMDGPU_VBIOS_VGA_ALLOCATION; } else { @@ -1111,6 +1106,7 @@ switch (adev->asic_type) { case CHIP_RAVEN: + case CHIP_RENOIR: viewport = RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); size = (REG_GET_FIELD(viewport, HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * @@ -1118,14 +1114,6 @@ HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * 4); break; - case CHIP_RENOIR: - viewport = RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2); - size = (REG_GET_FIELD(viewport, - HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * - REG_GET_FIELD(viewport, - HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * - 4); - break; case CHIP_VEGA10: case CHIP_VEGA12: case CHIP_VEGA20: @@ -1681,14 +1669,10 @@ return -EINVAL; } - if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) - goto skip_pin_bo; - r = amdgpu_gart_table_vram_pin(adev); if (r) return r; -skip_pin_bo: r = adev->gfxhub.funcs->gart_enable(adev); if (r) return r; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/amdgpu/vi.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/amdgpu/vi.c @@ -956,10 +956,6 @@ { int r; - /* APUs don't have full asic reset */ - if (adev->flags & AMD_IS_APU) - return 0; - if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { dev_info(adev->dev, "BACO reset\n"); r = amdgpu_dpm_baco_reset(adev); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1245,9 +1245,6 @@ adev_to_drm(adev)->mode_config.cursor_width = adev->dm.dc->caps.max_cursor_size; adev_to_drm(adev)->mode_config.cursor_height = adev->dm.dc->caps.max_cursor_size; - /* Disable vblank IRQs aggressively for power-saving */ - adev_to_drm(adev)->vblank_disable_immediate = true; - if (drm_vblank_init(adev_to_drm(adev), adev->dm.display_indexes_num)) { DRM_ERROR( "amdgpu: failed to initialize sw for display support.\n"); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -2796,13 +2796,10 @@ struct amdgpu_device *adev = drm_to_adev(new_crtc->dev); struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk; - if (!crc_rd_wrk) - return 0; - if (val) { spin_lock_irq(&adev_to_drm(adev)->event_lock); spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); - if (crc_rd_wrk->crtc) { + if (crc_rd_wrk && crc_rd_wrk->crtc) { old_crtc = crc_rd_wrk->crtc; old_acrtc = to_amdgpu_crtc(old_crtc); } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c @@ -274,7 +274,8 @@ case FAMILY_NV: if (ASICREV_IS_SIENNA_CICHLID_P(clk_mgr_base->ctx->asic_id.hw_internal_rev)) { dcn3_clk_mgr_destroy(clk_mgr); + } + if (ASICREV_IS_DIMGREY_CAVEFISH_P(clk_mgr_base->ctx->asic_id.hw_internal_rev)) { - } else if (ASICREV_IS_DIMGREY_CAVEFISH_P(clk_mgr_base->ctx->asic_id.hw_internal_rev)) { dcn3_clk_mgr_destroy(clk_mgr); } break; diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2620,8 +2620,7 @@ #endif if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program && - top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { if (should_use_dmub_lock(stream->link)) { union dmub_hw_lock_flags hw_locks = { 0 }; struct dmub_hw_lock_inst_flags inst_flags = { 0 }; diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc_link.c linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc_link.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -1703,8 +1703,6 @@ union down_spread_ctrl old_downspread; union down_spread_ctrl new_downspread; - memset(&old_downspread, 0, sizeof(old_downspread)); - core_link_read_dpcd(link, DP_DOWNSPREAD_CTRL, &old_downspread.raw, sizeof(old_downspread)); reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -1901,12 +1901,6 @@ } } - /* setting should not be allowed from VF */ - if (amdgpu_sriov_vf(adev)) { - dev_attr->attr.mode &= ~S_IWUGO; - dev_attr->store = NULL; - } - #undef DEVICE_ATTR_IS return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/ast/ast_tables.h +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/ast/ast_tables.h @@ -282,6 +282,8 @@ }; static const struct ast_vbios_enhtable res_1600x900[] = { + {1800, 1600, 24, 80, 1000, 900, 1, 3, VCLK108, /* 60Hz */ + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 3, 0x3A }, {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo | AST2500PreCatchCRT), 60, 1, 0x3A }, reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -998,21 +998,11 @@ if (!blocking) return 0; - /* - * db[1]!=0: entering PSR, wait for fully active remote frame buffer. - * db[1]==0: exiting PSR, wait for either - * (a) ACTIVE_RESYNC - the sink "must display the - * incoming active frames from the Source device with no visible - * glitches and/or artifacts", even though timings may still be - * re-synchronizing; or - * (b) INACTIVE - the transition is fully complete. - */ ret = readx_poll_timeout(analogix_dp_get_psr_status, dp, psr_status, psr_status >= 0 && ((vsc->db[1] && psr_status == DP_PSR_SINK_ACTIVE_RFB) || + (!vsc->db[1] && psr_status == DP_PSR_SINK_INACTIVE)), 1500, + DP_TIMEOUT_PSR_LOOP_MS * 1000); - (!vsc->db[1] && (psr_status == DP_PSR_SINK_ACTIVE_RESYNC || - psr_status == DP_PSR_SINK_INACTIVE))), - 1500, DP_TIMEOUT_PSR_LOOP_MS * 1000); if (ret) { dev_warn(dp->dev, "Failed to apply PSR %d\n", ret); return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/display-connector.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/display-connector.c @@ -107,7 +107,7 @@ { struct display_connector *conn; unsigned int type; + const char *label; - const char *label = NULL; int ret; conn = devm_kzalloc(&pdev->dev, sizeof(*conn), GFP_KERNEL); reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -306,10 +306,19 @@ mutex_unlock(&ge_b850v3_lvds_dev_mutex); } +static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, + const struct i2c_device_id *id) -static int ge_b850v3_register(void) { - struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c; struct device *dev = &stdp4028_i2c->dev; + int ret; + + ret = ge_b850v3_lvds_init(dev); + + if (ret) + return ret; + + ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; + i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); /* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; @@ -334,27 +343,6 @@ "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); } -static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, - const struct i2c_device_id *id) -{ - struct device *dev = &stdp4028_i2c->dev; - int ret; - - ret = ge_b850v3_lvds_init(dev); - - if (ret) - return ret; - - ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; - i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); - - /* Only register after both bridges are probed */ - if (!ge_b850v3_lvds_ptr->stdp2690_i2c) - return 0; - - return ge_b850v3_register(); -} - static int stdp4028_ge_b850v3_fw_remove(struct i2c_client *stdp4028_i2c) { ge_b850v3_lvds_remove(); @@ -398,11 +386,7 @@ ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); + return 0; - /* Only register after both bridges are probed */ - if (!ge_b850v3_lvds_ptr->stdp4028_i2c) - return 0; - - return ge_b850v3_register(); } static int stdp2690_ge_b850v3_fw_remove(struct i2c_client *stdp2690_i2c) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c @@ -320,17 +320,13 @@ struct snd_pcm_runtime *runtime = substream->runtime; struct snd_dw_hdmi *dw = substream->private_data; void __iomem *base = dw->data.base; - u8 *eld; int ret; runtime->hw = dw_hdmi_hw; + ret = snd_pcm_hw_constraint_eld(runtime, dw->data.eld); + if (ret < 0) + return ret; - eld = dw->data.get_eld(dw->data.hdmi); - if (eld) { - ret = snd_pcm_hw_constraint_eld(runtime, eld); - if (ret < 0) - return ret; - } ret = snd_pcm_limit_hw_rates(runtime); if (ret < 0) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h @@ -9,15 +9,15 @@ void __iomem *base; int irq; struct dw_hdmi *hdmi; + u8 *eld; - u8 *(*get_eld)(struct dw_hdmi *hdmi); }; struct dw_hdmi_i2s_audio_data { struct dw_hdmi *hdmi; + u8 *eld; void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); u8 (*read)(struct dw_hdmi *hdmi, int offset); - u8 *(*get_eld)(struct dw_hdmi *hdmi); }; #endif reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -135,15 +135,8 @@ size_t len) { struct dw_hdmi_i2s_audio_data *audio = data; - u8 *eld; - - eld = audio->get_eld(audio->hdmi); - if (eld) - memcpy(buf, eld, min_t(size_t, MAX_ELD_BYTES, len)); - else - /* Pass en empty ELD if connector not available */ - memset(buf, 0, len); + memcpy(buf, audio->eld, min_t(size_t, MAX_ELD_BYTES, len)); return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -756,14 +756,6 @@ hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); } -static u8 *hdmi_audio_get_eld(struct dw_hdmi *hdmi) -{ - if (!hdmi->curr_conn) - return NULL; - - return hdmi->curr_conn->eld; -} - static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) { hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); @@ -3403,7 +3395,7 @@ audio.base = hdmi->regs; audio.irq = irq; audio.hdmi = hdmi; + audio.eld = hdmi->connector.eld; - audio.get_eld = hdmi_audio_get_eld; hdmi->enable_audio = dw_hdmi_ahb_audio_enable; hdmi->disable_audio = dw_hdmi_ahb_audio_disable; @@ -3416,7 +3408,7 @@ struct dw_hdmi_i2s_audio_data audio; audio.hdmi = hdmi; + audio.eld = hdmi->connector.eld; - audio.get_eld = hdmi_audio_get_eld; audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -178,7 +178,6 @@ .val_bits = 8, .volatile_table = &ti_sn_bridge_volatile_table, .cache_type = REGCACHE_NONE, - .max_register = 0xFF, }; static void ti_sn_bridge_write_u16(struct ti_sn_bridge *pdata, reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_atomic.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/drm_atomic.c @@ -1308,10 +1308,8 @@ DRM_DEBUG_ATOMIC("checking %p\n", state); + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) + requested_crtc |= drm_crtc_mask(crtc); - for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { - if (new_crtc_state->enable) - requested_crtc |= drm_crtc_mask(crtc); - } for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { ret = drm_atomic_plane_check(old_plane_state, new_plane_state); @@ -1360,10 +1358,8 @@ } } + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) + affected_crtc |= drm_crtc_mask(crtc); - for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { - if (new_crtc_state->enable) - affected_crtc |= drm_crtc_mask(crtc); - } /* * For commits that allow modesets drivers can add other CRTCs to the reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_drv.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/drm_drv.c @@ -580,7 +580,6 @@ const struct drm_driver *driver, struct device *parent) { - struct inode *inode; int ret; if (!drm_core_init_complete) { @@ -617,15 +616,13 @@ if (ret) return ret; + dev->anon_inode = drm_fs_inode_new(); + if (IS_ERR(dev->anon_inode)) { + ret = PTR_ERR(dev->anon_inode); - inode = drm_fs_inode_new(); - if (IS_ERR(inode)) { - ret = PTR_ERR(inode); DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret); goto err; } - dev->anon_inode = inode; - if (drm_core_check_feature(dev, DRIVER_RENDER)) { ret = drm_minor_alloc(dev, DRM_MINOR_RENDER); if (ret) diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_panel_orientation_quirks.c linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_panel_orientation_quirks.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -248,12 +248,6 @@ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, - }, { /* Lenovo Yoga Book X90F / X91F / X91L */ - .matches = { - /* Non exact match to match all versions */ - DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), - }, - .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -469,12 +469,6 @@ return -EINVAL; } - if (args->stream_size > SZ_128K || args->nr_relocs > SZ_128K || - args->nr_bos > SZ_128K || args->nr_pmrs > 128) { - DRM_ERROR("submit arguments out of size limits\n"); - return -EINVAL; - } - /* * Copy the command submission and bo array to kernel space in * one go, and do this outside of any locks. diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gpu.h linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gpu.h --- linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -130,7 +130,6 @@ /* hang detection */ u32 hangcheck_dma_addr; - u32 hangcheck_fence; void __iomem *mmio; int irq; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -107,10 +107,8 @@ */ dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS); change = dma_addr - gpu->hangcheck_dma_addr; + if (change < 0 || change > 16) { - if (gpu->completed_fence != gpu->hangcheck_fence || - change < 0 || change > 16) { gpu->hangcheck_dma_addr = dma_addr; - gpu->hangcheck_fence = gpu->completed_fence; goto out_no_timeout; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/lima/lima_device.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/lima/lima_device.c @@ -357,7 +357,6 @@ int err, i; dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); - dma_set_max_seg_size(ldev->dev, UINT_MAX); err = lima_clk_init(ldev); if (err) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/Kconfig +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/msm/Kconfig @@ -61,7 +61,6 @@ config DRM_MSM_DP bool "Enable DisplayPort support in MSM DRM driver" depends on DRM_MSM - select RATIONAL default y help Compile in support for DP driver in MSM DRM driver. DP external diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1305,8 +1305,6 @@ for (i = 0; i < gpu->nr_rings; i++) a6xx_gpu->shadow[i] = 0; - gpu->suspend_count++; - return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c @@ -26,16 +26,9 @@ struct dpu_hw_pcc_cfg *cfg) { + u32 base = ctx->cap->sblk->pcc.base; - u32 base; + if (!ctx || !base) { - if (!ctx) { - DRM_ERROR("invalid ctx %pK\n", ctx); - return; - } - - base = ctx->cap->sblk->pcc.base; - - if (!base) { DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base); return; } diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -72,8 +72,8 @@ &status); } else { seq_puts(s, "\nSafe signal status:\n"); - if (kms->hw_mdp->ops.get_safe_status) - kms->hw_mdp->ops.get_safe_status(kms->hw_mdp, + if (kms->hw_mdp->ops.get_danger_status) + kms->hw_mdp->ops.get_danger_status(kms->hw_mdp, &status); } pm_runtime_put_sync(&kms->pdev->dev); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/dsi/dsi.c linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/dsi/dsi.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/dsi/dsi.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/dsi/dsi.c @@ -33,12 +33,7 @@ of_node_put(phy_node); - if (!phy_pdev) { - DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); - return -EPROBE_DEFER; - } - if (!msm_dsi->phy) { - put_device(&phy_pdev->dev); + if (!phy_pdev || !msm_dsi->phy) { DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__); return -EPROBE_DEFER; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -756,14 +756,12 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, struct msm_dsi_phy_clk_request *clk_req) { + struct device *dev = &phy->pdev->dev; - struct device *dev; int ret; if (!phy || !phy->cfg->ops.enable) return -EINVAL; - dev = &phy->pdev->dev; - ret = dsi_phy_enable_resource(phy); if (ret) { DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n", reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/hdmi/hdmi.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -97,15 +97,10 @@ of_node_put(phy_node); + if (!phy_pdev || !hdmi->phy) { - if (!phy_pdev) { DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); return -EPROBE_DEFER; } - if (!hdmi->phy) { - DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n"); - put_device(&phy_pdev->dev); - return -EPROBE_DEFER; - } hdmi->phy_dev = get_device(&phy_pdev->dev); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/msm_drv.c linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/msm_drv.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/msm_drv.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/msm/msm_drv.c @@ -360,7 +360,7 @@ of_node_put(node); if (ret) return ret; - size = r.end - r.start + 1; + size = r.end - r.start; DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); /* if we have no IOMMU, then we need to use carveout allocator. reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -205,7 +205,7 @@ nvif_notify_dtor(&disp->flip); nouveau_display(dev)->priv = NULL; + kfree(disp); - vfree(disp); nvif_object_unmap(&drm->client.device.object); } @@ -223,7 +223,7 @@ struct nv04_display *disp; int i, ret; + disp = kzalloc(sizeof(*disp), GFP_KERNEL); - disp = vzalloc(sizeof(*disp)); if (!disp) return -ENOMEM; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c @@ -94,13 +94,20 @@ return 0; } +static int -static void nvkm_pmu_reset(struct nvkm_pmu *pmu) { struct nvkm_device *device = pmu->subdev.device; if (!pmu->func->enabled(pmu)) + return 0; + + /* Inhibit interrupts, and wait for idle. */ + nvkm_wr32(device, 0x10a014, 0x0000ffff); + nvkm_msec(device, 2000, + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); - return; /* Reset. */ if (pmu->func->reset) @@ -111,37 +118,25 @@ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) break; ); + + return 0; } static int nvkm_pmu_preinit(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu = nvkm_pmu(subdev); + return nvkm_pmu_reset(pmu); - nvkm_pmu_reset(pmu); - return 0; } static int nvkm_pmu_init(struct nvkm_subdev *subdev) { struct nvkm_pmu *pmu = nvkm_pmu(subdev); + int ret = nvkm_pmu_reset(pmu); + if (ret == 0 && pmu->func->init) + ret = pmu->func->init(pmu); + return ret; - struct nvkm_device *device = pmu->subdev.device; - - if (!pmu->func->init) - return 0; - - if (pmu->func->enabled(pmu)) { - /* Inhibit interrupts, and wait for idle. */ - nvkm_wr32(device, 0x10a014, 0x0000ffff); - nvkm_msec(device, 2000, - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); - - nvkm_pmu_reset(pmu); - } - - return pmu->func->init(pmu); } static void * reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c @@ -227,13 +227,7 @@ dsi->format = MIPI_DSI_FMT_RGB888; dsi->lanes = 4; + return mipi_dsi_attach(dsi); - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); - return ret; - } - - return 0; } static int feiyang_dsi_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -484,7 +484,6 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi) { const struct panel_desc *desc; - struct innolux_panel *innolux; int err; desc = of_device_get_match_data(&dsi->dev); @@ -496,14 +495,7 @@ if (err < 0) return err; + return mipi_dsi_attach(dsi); - err = mipi_dsi_attach(dsi); - if (err < 0) { - innolux = mipi_dsi_get_drvdata(dsi); - innolux_panel_del(innolux); - return err; - } - - return 0; } static int innolux_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -473,13 +473,7 @@ if (ret < 0) return ret; + return mipi_dsi_attach(dsi); - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - jdi_panel_del(jdi); - return ret; - } - - return 0; } static int jdi_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -406,13 +406,7 @@ if (err < 0) return err; + return mipi_dsi_attach(dsi); - err = mipi_dsi_attach(dsi); - if (err < 0) { - kingdisplay_panel_del(kingdisplay); - return err; - } - - return 0; } static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -656,13 +656,7 @@ if (err < 0) return err; + return mipi_dsi_attach(dsi); - err = mipi_dsi_attach(dsi); - if (err < 0) { - drm_panel_remove(&pinfo->base); - return err; - } - - return 0; } static int nt36672a_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c @@ -241,13 +241,7 @@ if (ret < 0) return ret; + return mipi_dsi_attach(dsi); - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - wuxga_nt_panel_del(wuxga_nt); - return ret; - } - - return 0; } static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c @@ -199,13 +199,7 @@ dsi->format = MIPI_DSI_FMT_RGB888; dsi->lanes = 4; + return mipi_dsi_attach(dsi); - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); - return ret; - } - - return 0; } static int rb070d30_panel_dsi_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c @@ -247,7 +247,6 @@ ret = mipi_dsi_attach(dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); - drm_panel_remove(&ctx->panel); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-samsung-sofef00.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-samsung-sofef00.c @@ -302,7 +302,6 @@ ret = mipi_dsi_attach(dsi); if (ret < 0) { dev_err(dev, "Failed to attach to DSI host: %d\n", ret); - drm_panel_remove(&ctx->panel); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -296,13 +296,7 @@ if (ret < 0) return ret; + return mipi_dsi_attach(dsi); - ret = mipi_dsi_attach(dsi); - if (ret < 0) { - sharp_nt_panel_del(sharp_nt); - return ret; - } - - return 0; } static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/radeon/radeon_kms.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/radeon/radeon_kms.c @@ -640,8 +640,6 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) { struct radeon_device *rdev = dev->dev_private; - struct radeon_fpriv *fpriv; - struct radeon_vm *vm; int r; file_priv->driver_priv = NULL; @@ -654,52 +652,48 @@ /* new gpu have virtual address space support */ if (rdev->family >= CHIP_CAYMAN) { + struct radeon_fpriv *fpriv; + struct radeon_vm *vm; fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { r = -ENOMEM; + goto out_suspend; - goto err_suspend; } if (rdev->accel_working) { vm = &fpriv->vm; r = radeon_vm_init(rdev, vm); + if (r) { + kfree(fpriv); + goto out_suspend; + } - if (r) - goto err_fpriv; r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); + if (r) { + radeon_vm_fini(rdev, vm); + kfree(fpriv); + goto out_suspend; + } - if (r) - goto err_vm_fini; /* map the ib pool buffer read only into * virtual address space */ vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, rdev->ring_tmp_bo.bo); - if (!vm->ib_bo_va) { - r = -ENOMEM; - goto err_vm_fini; - } - r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, RADEON_VA_IB_OFFSET, RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); + if (r) { + radeon_vm_fini(rdev, vm); + kfree(fpriv); + goto out_suspend; + } - if (r) - goto err_vm_fini; } file_priv->driver_priv = fpriv; } +out_suspend: - pm_runtime_mark_last_busy(dev->dev); - pm_runtime_put_autosuspend(dev->dev); - return 0; - -err_vm_fini: - radeon_vm_fini(rdev, vm); -err_fpriv: - kfree(fpriv); - -err_suspend: pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); return r; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -215,7 +215,6 @@ const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode; struct rcar_du_device *rcdu = rcrtc->dev; unsigned long mode_clock = mode->clock * 1000; - unsigned int hdse_offset; u32 dsmr; u32 escr; @@ -299,15 +298,10 @@ | DSMR_DIPM_DISP | DSMR_CSPM; rcar_du_crtc_write(rcrtc, DSMR, dsmr); - hdse_offset = 19; - if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2)) - hdse_offset += 25; - /* Display timings */ + rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start - 19); - rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start - - hdse_offset); rcar_du_crtc_write(rcrtc, HDER, mode->htotal - mode->hsync_start + + mode->hdisplay - 19); - mode->hdisplay - hdse_offset); rcar_du_crtc_write(rcrtc, HSWR, mode->hsync_end - mode->hsync_start - 1); rcar_du_crtc_write(rcrtc, HCR, mode->htotal - 1); @@ -842,7 +836,6 @@ struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); struct rcar_du_device *rcdu = rcrtc->dev; bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; - unsigned int min_sync_porch; unsigned int vbp; if (interlaced && !rcar_du_has(rcdu, RCAR_DU_FEATURE_INTERLACED)) @@ -850,14 +843,9 @@ /* * The hardware requires a minimum combined horizontal sync and back + * porch of 20 pixels and a minimum vertical back porch of 3 lines. - * porch of 20 pixels (when CMM isn't used) or 45 pixels (when CMM is - * used), and a minimum vertical back porch of 3 lines. */ + if (mode->htotal - mode->hsync_start < 20) - min_sync_porch = 20; - if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2)) - min_sync_porch += 25; - - if (mode->htotal - mode->hsync_start < min_sync_porch) return MODE_HBLANK_NARROW; vbp = (mode->vtotal - mode->vsync_end) / (interlaced ? 2 : 1); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c linux-aws-5.13-5.13.0/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -243,8 +243,6 @@ struct dw_mipi_dsi *dmd; const struct rockchip_dw_dsi_chip_data *cdata; struct dw_mipi_dsi_plat_data pdata; - - bool dsi_bound; }; struct dphy_pll_parameter_map { @@ -755,6 +753,10 @@ if (mux < 0) return; + pm_runtime_get_sync(dsi->dev); + if (dsi->slave) + pm_runtime_get_sync(dsi->slave->dev); + /* * For the RK3399, the clk of grf must be enabled before writing grf * register. And for RK3288 or other soc, this grf_clk must be NULL, @@ -773,10 +775,20 @@ clk_disable_unprepare(dsi->grf_clk); } +static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) +{ + struct dw_mipi_dsi_rockchip *dsi = to_dsi(encoder); + + if (dsi->slave) + pm_runtime_put(dsi->slave->dev); + pm_runtime_put(dsi->dev); +} + static const struct drm_encoder_helper_funcs dw_mipi_dsi_encoder_helper_funcs = { .atomic_check = dw_mipi_dsi_encoder_atomic_check, .enable = dw_mipi_dsi_encoder_enable, + .disable = dw_mipi_dsi_encoder_disable, }; static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *dsi, @@ -906,14 +918,10 @@ put_device(second); } - pm_runtime_get_sync(dsi->dev); - if (dsi->slave) - pm_runtime_get_sync(dsi->slave->dev); - ret = clk_prepare_enable(dsi->pllref_clk); if (ret) { DRM_DEV_ERROR(dev, "Failed to enable pllref_clk: %d\n", ret); - goto out_pm_runtime; + return ret; } /* @@ -925,7 +933,7 @@ ret = clk_prepare_enable(dsi->grf_clk); if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); - goto out_pll_clk; + return ret; } dw_mipi_dsi_rockchip_config(dsi); @@ -937,27 +945,16 @@ ret = rockchip_dsi_drm_create_encoder(dsi, drm_dev); if (ret) { DRM_DEV_ERROR(dev, "Failed to create drm encoder\n"); - goto out_pll_clk; + return ret; } ret = dw_mipi_dsi_bind(dsi->dmd, &dsi->encoder); if (ret) { DRM_DEV_ERROR(dev, "Failed to bind: %d\n", ret); - goto out_pll_clk; + return ret; } - dsi->dsi_bound = true; - return 0; - -out_pll_clk: - clk_disable_unprepare(dsi->pllref_clk); -out_pm_runtime: - pm_runtime_put(dsi->dev); - if (dsi->slave) - pm_runtime_put(dsi->slave->dev); - - return ret; } static void dw_mipi_dsi_rockchip_unbind(struct device *dev, @@ -969,15 +966,9 @@ if (dsi->is_slave) return; - dsi->dsi_bound = false; - dw_mipi_dsi_unbind(dsi->dmd); clk_disable_unprepare(dsi->pllref_clk); - - pm_runtime_put(dsi->dev); - if (dsi->slave) - pm_runtime_put(dsi->slave->dev); } static const struct component_ops dw_mipi_dsi_rockchip_ops = { @@ -1035,36 +1026,6 @@ .detach = dw_mipi_dsi_rockchip_host_detach, }; -static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev) -{ - struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev); - int ret; - - /* - * Re-configure DSI state, if we were previously initialized. We need - * to do this before rockchip_drm_drv tries to re-enable() any panels. - */ - if (dsi->dsi_bound) { - ret = clk_prepare_enable(dsi->grf_clk); - if (ret) { - DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); - return ret; - } - - dw_mipi_dsi_rockchip_config(dsi); - if (dsi->slave) - dw_mipi_dsi_rockchip_config(dsi->slave); - - clk_disable_unprepare(dsi->grf_clk); - } - - return 0; -} - -static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = { - SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume) -}; - static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1165,10 +1126,14 @@ if (ret != -EPROBE_DEFER) DRM_DEV_ERROR(dev, "Failed to probe dw_mipi_dsi: %d\n", ret); - return ret; + goto err_clkdisable; } return 0; + +err_clkdisable: + clk_disable_unprepare(dsi->pllref_clk); + return ret; } static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev) @@ -1284,7 +1249,6 @@ .remove = dw_mipi_dsi_rockchip_remove, .driver = { .of_match_table = dw_mipi_dsi_rockchip_dt_ids, - .pm = &dw_mipi_dsi_rockchip_pm_ops, .name = "dw-mipi-dsi-rockchip", }, }; diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/tegra/drm.c linux-aws-5.13-5.13.0/drivers/gpu/drm/tegra/drm.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/tegra/drm.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/tegra/drm.c @@ -20,10 +20,6 @@ #include #include -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) -#include -#endif - #include "drm.h" #include "gem.h" @@ -913,17 +909,6 @@ struct iommu_group *group = NULL; int err; -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) - if (client->dev->archdata.mapping) { - struct dma_iommu_mapping *mapping = - to_dma_iommu_mapping(client->dev); - arm_iommu_detach_device(client->dev); - arm_iommu_release_mapping(mapping); - - domain = iommu_get_domain_for_dev(client->dev); - } -#endif - /* * If the host1x client is already attached to an IOMMU domain that is * not the shared IOMMU domain, don't try to attach it to a different reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/tegra/vic.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/tegra/vic.c @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -283,8 +282,10 @@ if (!client->group) { virt = dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL); + + err = dma_mapping_error(vic->dev, iova); + if (err < 0) + return err; - if (!virt) - return -ENOMEM; } else { virt = tegra_drm_alloc(tegra, size, &iova); } diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/ttm/ttm_bo.c linux-aws-5.13-5.13.0/drivers/gpu/drm/ttm/ttm_bo.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/ttm/ttm_bo.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/ttm/ttm_bo.c @@ -681,8 +681,6 @@ ret = ttm_bo_evict(bo, ctx); if (locked) ttm_bo_unreserve(bo); - else - ttm_bo_move_to_lru_tail_unlocked(bo); ttm_bo_put(bo); return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vboxvideo/vbox_main.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -127,8 +127,8 @@ /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */ vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1, "vboxvideo-accel"); + if (!vbox->guest_pool) + return -ENOMEM; - if (IS_ERR(vbox->guest_pool)) - return PTR_ERR(vbox->guest_pool); ret = gen_pool_add_virt(vbox->guest_pool, (unsigned long)vbox->guest_heap, diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_crtc.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_crtc.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_crtc.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -43,7 +42,6 @@ #include #include "vc4_drv.h" -#include "vc4_hdmi.h" #include "vc4_regs.h" #define HVS_FIFO_LATENCY_PIX 6 @@ -498,10 +496,8 @@ enum vc4_encoder_type encoder_type; const struct vc4_pv_data *pv_data; struct drm_encoder *encoder; - struct vc4_hdmi *vc4_hdmi; unsigned encoder_sel; int channel; - int ret; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || @@ -529,20 +525,7 @@ if (WARN_ON(!encoder)) return 0; - vc4_hdmi = encoder_to_vc4_hdmi(encoder); - ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); - if (ret) - return ret; - - ret = vc4_crtc_disable(crtc, encoder, NULL, channel); - if (ret) - return ret; - - ret = pm_runtime_put(&vc4_hdmi->pdev->dev); - if (ret) - return ret; - - return 0; + return vc4_crtc_disable(crtc, encoder, NULL, channel); } static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, @@ -708,14 +691,14 @@ struct drm_crtc *crtc = &vc4_crtc->base; struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); - u32 chan = vc4_crtc->current_hvs_channel; + struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); + u32 chan = vc4_state->assigned_channel; unsigned long flags; spin_lock_irqsave(&dev->event_lock, flags); - spin_lock(&vc4_crtc->irq_lock); if (vc4_crtc->event && - (vc4_crtc->current_dlist == HVS_READ(SCALER_DISPLACTX(chan)) || - vc4_crtc->feeds_txp)) { + (vc4_state->mm.start == HVS_READ(SCALER_DISPLACTX(chan)) || + vc4_state->feed_txp)) { drm_crtc_send_vblank_event(crtc, vc4_crtc->event); vc4_crtc->event = NULL; drm_crtc_vblank_put(crtc); @@ -728,7 +711,6 @@ */ vc4_hvs_unmask_underrun(dev, chan); } - spin_unlock(&vc4_crtc->irq_lock); spin_unlock_irqrestore(&dev->event_lock, flags); } @@ -894,6 +876,7 @@ return NULL; old_vc4_state = to_vc4_crtc_state(crtc->state); + vc4_state->feed_txp = old_vc4_state->feed_txp; vc4_state->margins = old_vc4_state->margins; vc4_state->assigned_channel = old_vc4_state->assigned_channel; @@ -954,7 +937,6 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { .mode_valid = vc4_crtc_mode_valid, .atomic_check = vc4_crtc_atomic_check, - .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_crtc_atomic_enable, .atomic_disable = vc4_crtc_atomic_disable, @@ -1129,7 +1111,6 @@ return PTR_ERR(primary_plane); } - spin_lock_init(&vc4_crtc->irq_lock); drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL, crtc_funcs, NULL); drm_crtc_helper_add(crtc, crtc_helper_funcs); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_drv.h linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_drv.h --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_drv.h +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_drv.h @@ -493,33 +493,6 @@ struct drm_pending_vblank_event *event; struct debugfs_regset32 regset; - - /** - * @feeds_txp: True if the CRTC feeds our writeback controller. - */ - bool feeds_txp; - - /** - * @irq_lock: Spinlock protecting the resources shared between - * the atomic code and our vblank handler. - */ - spinlock_t irq_lock; - - /** - * @current_dlist: Start offset of the display list currently - * set in the HVS for that CRTC. Protected by @irq_lock, and - * copied in vc4_hvs_update_dlist() for the CRTC interrupt - * handler to have access to that value. - */ - unsigned int current_dlist; - - /** - * @current_hvs_channel: HVS channel currently assigned to the - * CRTC. Protected by @irq_lock, and copied in - * vc4_hvs_atomic_begin() for the CRTC interrupt handler to have - * access to that value. - */ - unsigned int current_hvs_channel; }; static inline struct vc4_crtc * @@ -546,6 +519,7 @@ struct drm_crtc_state base; /* Dlist area for this CRTC configuration. */ struct drm_mm_node mm; + bool feed_txp; bool txp_armed; unsigned int assigned_channel; @@ -932,7 +906,6 @@ void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output); int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output); int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state); -void vc4_hvs_atomic_begin(struct drm_crtc *crtc, struct drm_atomic_state *state); void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state); void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state); void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_hdmi.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_hdmi.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_hdmi.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -90,7 +90,6 @@ # define VC4_HD_M_SW_RST BIT(2) # define VC4_HD_M_ENABLE BIT(0) -#define HSM_MIN_CLOCK_FREQ 120000000 #define CEC_CLOCK_FREQ 40000 #define VC4_HSM_MID_CLOCK 149985000 @@ -2012,19 +2011,6 @@ vc4_hdmi->disable_wifi_frequencies = of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence"); - /* - * If we boot without any cable connected to the HDMI connector, - * the firmware will skip the HSM initialization and leave it - * with a rate of 0, resulting in a bus lockup when we're - * accessing the registers even if it's enabled. - * - * Let's put a sensible default at runtime_resume so that we - * don't end up in this situation. - */ - ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); - if (ret) - goto err_put_ddc; - if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_hvs.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/vc4/vc4_hvs.c @@ -365,16 +365,17 @@ struct vc4_dev *vc4 = to_vc4_dev(dev); struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); - unsigned long flags; if (crtc->state->event) { + unsigned long flags; + crtc->state->event->pipe = drm_crtc_index(crtc); WARN_ON(drm_crtc_vblank_get(crtc) != 0); spin_lock_irqsave(&dev->event_lock, flags); + if (!vc4_state->feed_txp || vc4_state->txp_armed) { - if (!vc4_crtc->feeds_txp || vc4_state->txp_armed) { vc4_crtc->event = crtc->state->event; crtc->state->event = NULL; } @@ -387,22 +388,6 @@ HVS_WRITE(SCALER_DISPLISTX(vc4_state->assigned_channel), vc4_state->mm.start); } - - spin_lock_irqsave(&vc4_crtc->irq_lock, flags); - vc4_crtc->current_dlist = vc4_state->mm.start; - spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); -} - -void vc4_hvs_atomic_begin(struct drm_crtc *crtc, - struct drm_atomic_state *state) -{ - struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); - struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); - unsigned long flags; - - spin_lock_irqsave(&vc4_crtc->irq_lock, flags); - vc4_crtc->current_hvs_channel = vc4_state->assigned_channel; - spin_unlock_irqrestore(&vc4_crtc->irq_lock, flags); } void vc4_hvs_atomic_enable(struct drm_crtc *crtc, @@ -410,9 +395,10 @@ { struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); + struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(new_crtc_state); struct drm_display_mode *mode = &crtc->state->adjusted_mode; + bool oneshot = vc4_state->feed_txp; - struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); - bool oneshot = vc4_crtc->feeds_txp; vc4_hvs_update_dlist(crtc); vc4_hvs_init_channel(vc4, crtc, mode, oneshot); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_kms.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_kms.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_kms.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_kms.c @@ -233,7 +233,6 @@ unsigned int i; for_each_new_crtc_in_state(state, crtc, crtc_state, i) { - struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc_state); u32 dispctrl; u32 dsp3_mux; @@ -254,7 +253,7 @@ * TXP IP, and we need to disable the FIFO2 -> pixelvalve1 * route. */ - if (vc4_crtc->feeds_txp) + if (vc4_state->feed_txp) dsp3_mux = VC4_SET_FIELD(3, SCALER_DISPCTRL_DSP3_MUX); else dsp3_mux = VC4_SET_FIELD(2, SCALER_DISPCTRL_DSP3_MUX); diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_txp.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_txp.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_txp.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vc4/vc4_txp.c @@ -391,6 +391,7 @@ { struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc_state); int ret; ret = vc4_hvs_atomic_check(crtc, state); @@ -398,6 +399,7 @@ return ret; crtc_state->no_vblank = true; + vc4_state->feed_txp = true; return 0; } @@ -435,7 +437,6 @@ static const struct drm_crtc_helper_funcs vc4_txp_crtc_helper_funcs = { .atomic_check = vc4_txp_atomic_check, - .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_txp_atomic_enable, .atomic_disable = vc4_txp_atomic_disable, @@ -481,7 +482,6 @@ vc4_crtc->pdev = pdev; vc4_crtc->data = &vc4_txp_crtc_data; - vc4_crtc->feeds_txp = true; txp->pdev = pdev; diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/ttm_memory.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/ttm_memory.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/ttm_memory.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/ttm_memory.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -172,7 +173,69 @@ .sysfs_ops = &ttm_mem_zone_ops, .default_attrs = ttm_mem_zone_attrs, }; -static struct kobj_type ttm_mem_glob_kobj_type = {0}; + +static struct attribute ttm_mem_global_lower_mem_limit = { + .name = "lower_mem_limit", + .mode = S_IRUGO | S_IWUSR +}; + +static ssize_t ttm_mem_global_show(struct kobject *kobj, + struct attribute *attr, + char *buffer) +{ + struct ttm_mem_global *glob = + container_of(kobj, struct ttm_mem_global, kobj); + uint64_t val = 0; + + spin_lock(&glob->lock); + val = glob->lower_mem_limit; + spin_unlock(&glob->lock); + /* convert from number of pages to KB */ + val <<= (PAGE_SHIFT - 10); + return snprintf(buffer, PAGE_SIZE, "%llu\n", + (unsigned long long) val); +} + +static ssize_t ttm_mem_global_store(struct kobject *kobj, + struct attribute *attr, + const char *buffer, + size_t size) +{ + int chars; + uint64_t val64; + unsigned long val; + struct ttm_mem_global *glob = + container_of(kobj, struct ttm_mem_global, kobj); + + chars = sscanf(buffer, "%lu", &val); + if (chars == 0) + return size; + + val64 = val; + /* convert from KB to number of pages */ + val64 >>= (PAGE_SHIFT - 10); + + spin_lock(&glob->lock); + glob->lower_mem_limit = val64; + spin_unlock(&glob->lock); + + return size; +} + +static struct attribute *ttm_mem_global_attrs[] = { + &ttm_mem_global_lower_mem_limit, + NULL +}; + +static const struct sysfs_ops ttm_mem_global_ops = { + .show = &ttm_mem_global_show, + .store = &ttm_mem_global_store, +}; + +static struct kobj_type ttm_mem_glob_kobj_type = { + .sysfs_ops = &ttm_mem_global_ops, + .default_attrs = ttm_mem_global_attrs, +}; static bool ttm_zones_above_swap_target(struct ttm_mem_global *glob, bool from_wq, uint64_t extra) @@ -372,6 +435,11 @@ si_meminfo(&si); + spin_lock(&glob->lock); + /* set it as 0 by default to keep original behavior of OOM */ + glob->lower_mem_limit = 0; + spin_unlock(&glob->lock); + ret = ttm_mem_init_kernel_zone(glob, &si); if (unlikely(ret != 0)) goto out_no_zone; @@ -459,6 +527,35 @@ } EXPORT_SYMBOL(ttm_mem_global_free); +/* + * check if the available mem is under lower memory limit + * + * a. if no swap disk at all or free swap space is under swap_mem_limit + * but available system mem is bigger than sys_mem_limit, allow TTM + * allocation; + * + * b. if the available system mem is less than sys_mem_limit but free + * swap disk is bigger than swap_mem_limit, allow TTM allocation. + */ +bool +ttm_check_under_lowerlimit(struct ttm_mem_global *glob, + uint64_t num_pages, + struct ttm_operation_ctx *ctx) +{ + int64_t available; + + /* We allow over commit during suspend */ + if (ctx->force_alloc) + return false; + + available = get_nr_swap_pages() + si_mem_available(); + available -= num_pages; + if (available < glob->lower_mem_limit) + return true; + + return false; +} + static int ttm_mem_global_reserve(struct ttm_mem_global *glob, struct ttm_mem_zone *single_zone, uint64_t amount, bool reserve) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/ttm_memory.h +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/vmwgfx/ttm_memory.h @@ -50,6 +50,8 @@ * @work: The workqueue callback for the shrink queue. * @lock: Lock to protect the @shrink - and the memory accounting members, * that is, essentially the whole structure with some exceptions. + * @lower_mem_limit: include lower limit of swap space and lower limit of + * system memory. * @zones: Array of pointers to accounting zones. * @num_zones: Number of populated entries in the @zones array. * @zone_kernel: Pointer to the kernel zone. @@ -67,6 +69,7 @@ struct workqueue_struct *swap_queue; struct work_struct work; spinlock_t lock; + uint64_t lower_mem_limit; struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; unsigned int num_zones; struct ttm_mem_zone *zone_kernel; @@ -88,5 +91,6 @@ void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page, uint64_t size); size_t ttm_round_pot(size_t size); +bool ttm_check_under_lowerlimit(struct ttm_mem_global *glob, uint64_t num_pages, + struct ttm_operation_ctx *ctx); - #endif reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1492,40 +1492,34 @@ ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "svgadrmfb"); if (ret) + return ret; - goto out_error; ret = pcim_enable_device(pdev); if (ret) + return ret; - goto out_error; vmw = devm_drm_dev_alloc(&pdev->dev, &driver, struct vmw_private, drm); + if (IS_ERR(vmw)) + return PTR_ERR(vmw); - if (IS_ERR(vmw)) { - ret = PTR_ERR(vmw); - goto out_error; - } pci_set_drvdata(pdev, &vmw->drm); ret = ttm_mem_global_init(&ttm_mem_glob, &pdev->dev); if (ret) + return ret; - goto out_error; ret = vmw_driver_load(vmw, ent->device); if (ret) + return ret; - goto out_release; ret = drm_dev_register(&vmw->drm, 0); + if (ret) { + vmw_driver_unload(&vmw->drm); + return ret; + } - if (ret) - goto out_unload; return 0; -out_unload: - vmw_driver_unload(&vmw->drm); -out_release: - ttm_mem_global_release(&ttm_mem_glob); -out_error: - return ret; } static int __init vmwgfx_init(void) diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -60,8 +60,11 @@ #define VMWGFX_DRIVER_MINOR 18 #define VMWGFX_DRIVER_PATCHLEVEL 1 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) +#define VMWGFX_MAX_RELOCATIONS 2048 +#define VMWGFX_MAX_VALIDATIONS 2048 #define VMWGFX_MAX_DISPLAYS 16 #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 +#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1 #define VMWGFX_PCI_ID_SVGA2 0x0405 diff -u linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * - * Copyright 2012-2021 VMware, Inc., Palo Alto, CA., USA + * Copyright 2012-2015 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -29,6 +29,12 @@ #include "vmwgfx_drv.h" +/* + * If we set up the screen target otable, screen objects stop working. + */ + +#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE ? 0 : 1)) + #ifdef CONFIG_64BIT #define VMW_PPN_SIZE 8 #define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PTDEPTH64_0 @@ -69,7 +75,7 @@ {VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE, NULL, true}, {VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE, NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, - NULL, true} + NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE} }; static const struct vmw_otable dx_tables[] = { @@ -78,7 +84,7 @@ {VMWGFX_NUM_GB_CONTEXT * SVGA3D_OTABLE_CONTEXT_ENTRY_SIZE, NULL, true}, {VMWGFX_NUM_GB_SHADER * SVGA3D_OTABLE_SHADER_ENTRY_SIZE, NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, - NULL, true}, + NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE}, {VMWGFX_NUM_DXCONTEXT * sizeof(SVGAOTableDXContextEntry), NULL, true}, }; reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -1872,8 +1872,8 @@ int i, ret; + /* Do nothing if Screen Target support is turned off */ + if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE || !dev_priv->has_mob) - /* Do nothing if there's no support for MOBs */ - if (!dev_priv->has_mob) return -ENOSYS; if (!(dev_priv->capabilities & SVGA_CAP_GBOBJECTS)) reverted: --- linux-aws-5.13-5.13.0/drivers/gpu/host1x/dev.c +++ linux-aws-5.13-5.13.0.orig/drivers/gpu/host1x/dev.c @@ -18,10 +18,6 @@ #include #undef CREATE_TRACE_POINTS -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) -#include -#endif - #include "bus.h" #include "channel.h" #include "debug.h" @@ -242,17 +238,6 @@ struct iommu_domain *domain = iommu_get_domain_for_dev(host->dev); int err; -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) - if (host->dev->archdata.mapping) { - struct dma_iommu_mapping *mapping = - to_dma_iommu_mapping(host->dev); - arm_iommu_detach_device(host->dev); - arm_iommu_release_mapping(mapping); - - domain = iommu_get_domain_for_dev(host->dev); - } -#endif - /* * We may not always want to enable IOMMU support (for example if the * host1x firewall is already enabled and we don't support addressing diff -u linux-aws-5.13-5.13.0/drivers/hid/hid-apple.c linux-aws-5.13-5.13.0/drivers/hid/hid-apple.c --- linux-aws-5.13-5.13.0/drivers/hid/hid-apple.c +++ linux-aws-5.13-5.13.0/drivers/hid/hid-apple.c @@ -415,7 +415,7 @@ if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) { hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n"); - asc->quirks &= ~APPLE_HAS_FN; + asc->quirks = 0; } return 0; diff -u linux-aws-5.13-5.13.0/drivers/hid/hid-ids.h linux-aws-5.13-5.13.0/drivers/hid/hid-ids.h --- linux-aws-5.13-5.13.0/drivers/hid/hid-ids.h +++ linux-aws-5.13-5.13.0/drivers/hid/hid-ids.h @@ -395,7 +395,6 @@ #define USB_DEVICE_ID_HP_X2 0x074d #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 -#define I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100 0x29CF #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A diff -u linux-aws-5.13-5.13.0/drivers/hid/hid-input.c linux-aws-5.13-5.13.0/drivers/hid/hid-input.c --- linux-aws-5.13-5.13.0/drivers/hid/hid-input.c +++ linux-aws-5.13-5.13.0/drivers/hid/hid-input.c @@ -326,8 +326,6 @@ HID_BATTERY_QUIRK_IGNORE }, { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN), HID_BATTERY_QUIRK_IGNORE }, - { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100), - HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15), HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN), @@ -1310,12 +1308,6 @@ input = field->hidinput->input; - if (usage->type == EV_ABS && - (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || - ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) { - value = field->logical_maximum - value; - } - if (usage->hat_min < usage->hat_max || usage->hat_dir) { int hat_dir = usage->hat_dir; if (!hat_dir) reverted: --- linux-aws-5.13-5.13.0/drivers/hid/hid-magicmouse.c +++ linux-aws-5.13-5.13.0.orig/drivers/hid/hid-magicmouse.c @@ -57,8 +57,6 @@ #define MOUSE_REPORT_ID 0x29 #define MOUSE2_REPORT_ID 0x12 #define DOUBLE_REPORT_ID 0xf7 -#define USB_BATTERY_TIMEOUT_MS 60000 - /* These definitions are not precise, but they're close enough. (Bits * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem * to be some kind of bit mask -- 0x20 may be a near-field reading, @@ -134,7 +132,6 @@ struct hid_device *hdev; struct delayed_work work; - struct timer_list battery_timer; }; static int magicmouse_firm_touch(struct magicmouse_sc *msc) @@ -686,44 +683,6 @@ hid_err(msc->hdev, "unable to request touch data (%d)\n", ret); } -static int magicmouse_fetch_battery(struct hid_device *hdev) -{ -#ifdef CONFIG_HID_BATTERY_STRENGTH - struct hid_report_enum *report_enum; - struct hid_report *report; - - if (!hdev->battery || hdev->vendor != USB_VENDOR_ID_APPLE || - (hdev->product != USB_DEVICE_ID_APPLE_MAGICMOUSE2 && - hdev->product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)) - return -1; - - report_enum = &hdev->report_enum[hdev->battery_report_type]; - report = report_enum->report_id_hash[hdev->battery_report_id]; - - if (!report || report->maxfield < 1) - return -1; - - if (hdev->battery_capacity == hdev->battery_max) - return -1; - - hid_hw_request(hdev, report, HID_REQ_GET_REPORT); - return 0; -#else - return -1; -#endif -} - -static void magicmouse_battery_timer_tick(struct timer_list *t) -{ - struct magicmouse_sc *msc = from_timer(msc, t, battery_timer); - struct hid_device *hdev = msc->hdev; - - if (magicmouse_fetch_battery(hdev) == 0) { - mod_timer(&msc->battery_timer, - jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS)); - } -} - static int magicmouse_probe(struct hid_device *hdev, const struct hid_device_id *id) { @@ -731,6 +690,11 @@ struct hid_report *report; int ret; + if (id->vendor == USB_VENDOR_ID_APPLE && + id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && + hdev->type != HID_TYPE_USBMOUSE) + return -ENODEV; + msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); if (msc == NULL) { hid_err(hdev, "can't alloc magicmouse descriptor\n"); @@ -756,16 +720,6 @@ return ret; } - timer_setup(&msc->battery_timer, magicmouse_battery_timer_tick, 0); - mod_timer(&msc->battery_timer, - jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS)); - magicmouse_fetch_battery(hdev); - - if (id->vendor == USB_VENDOR_ID_APPLE && - (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 || - (id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && hdev->type != HID_TYPE_USBMOUSE))) - return 0; - if (!msc->input) { hid_err(hdev, "magicmouse input not registered\n"); ret = -ENOMEM; @@ -826,52 +780,17 @@ { struct magicmouse_sc *msc = hid_get_drvdata(hdev); + if (msc) - if (msc) { cancel_delayed_work_sync(&msc->work); - del_timer_sync(&msc->battery_timer); - } hid_hw_stop(hdev); } -static __u8 *magicmouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) -{ - /* - * Change the usage from: - * 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 0 - * 0x09, 0x0b, // Usage (Vendor Usage 0x0b) 3 - * To: - * 0x05, 0x01, // Usage Page (Generic Desktop) 0 - * 0x09, 0x02, // Usage (Mouse) 2 - */ - if (hdev->vendor == USB_VENDOR_ID_APPLE && - (hdev->product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 || - hdev->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) && - *rsize == 83 && rdesc[46] == 0x84 && rdesc[58] == 0x85) { - hid_info(hdev, - "fixing up magicmouse battery report descriptor\n"); - *rsize = *rsize - 1; - rdesc = kmemdup(rdesc + 1, *rsize, GFP_KERNEL); - if (!rdesc) - return NULL; - - rdesc[0] = 0x05; - rdesc[1] = 0x01; - rdesc[2] = 0x09; - rdesc[3] = 0x02; - } - - return rdesc; -} - static const struct hid_device_id magic_mice[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE), .driver_data = 0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE2), .driver_data = 0 }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, - USB_DEVICE_ID_APPLE_MAGICMOUSE2), .driver_data = 0 }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD), .driver_data = 0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, @@ -887,7 +806,6 @@ .id_table = magic_mice, .probe = magicmouse_probe, .remove = magicmouse_remove, - .report_fixup = magicmouse_report_fixup, .raw_event = magicmouse_raw_event, .event = magicmouse_event, .input_mapping = magicmouse_input_mapping, diff -u linux-aws-5.13-5.13.0/drivers/hid/hid-uclogic-params.c linux-aws-5.13-5.13.0/drivers/hid/hid-uclogic-params.c --- linux-aws-5.13-5.13.0/drivers/hid/hid-uclogic-params.c +++ linux-aws-5.13-5.13.0/drivers/hid/hid-uclogic-params.c @@ -66,7 +66,7 @@ __u8 idx, size_t len) { int rc; - struct usb_device *udev; + struct usb_device *udev = hid_to_usb_dev(hdev); __u8 *buf = NULL; /* Check arguments */ @@ -75,8 +75,6 @@ goto cleanup; } - udev = hid_to_usb_dev(hdev); - buf = kmalloc(len, GFP_KERNEL); if (buf == NULL) { rc = -ENOMEM; @@ -452,7 +450,7 @@ { int rc; bool found = false; - struct usb_device *usb_dev; + struct usb_device *usb_dev = hid_to_usb_dev(hdev); char *str_buf = NULL; const size_t str_len = 16; @@ -462,8 +460,6 @@ goto cleanup; } - usb_dev = hid_to_usb_dev(hdev); - /* * Enable generic button mode */ @@ -711,9 +707,9 @@ struct hid_device *hdev) { int rc; - struct usb_device *udev; - struct usb_interface *iface; - __u8 bInterfaceNumber; + struct usb_device *udev = hid_to_usb_dev(hdev); + struct usb_interface *iface = to_usb_interface(hdev->dev.parent); + __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p = {0, }; @@ -727,10 +723,6 @@ goto cleanup; } - udev = hid_to_usb_dev(hdev); - iface = to_usb_interface(hdev->dev.parent); - bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; - /* If it's not a pen interface */ if (bInterfaceNumber != 0) { /* TODO: Consider marking the interface invalid */ @@ -842,10 +834,10 @@ struct hid_device *hdev) { int rc; - struct usb_device *udev; - __u8 bNumInterfaces; - struct usb_interface *iface; - __u8 bInterfaceNumber; + struct usb_device *udev = hid_to_usb_dev(hdev); + __u8 bNumInterfaces = udev->config->desc.bNumInterfaces; + struct usb_interface *iface = to_usb_interface(hdev->dev.parent); + __u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; bool found; /* The resulting parameters (noop) */ struct uclogic_params p = {0, }; @@ -856,11 +848,6 @@ goto cleanup; } - udev = hid_to_usb_dev(hdev); - bNumInterfaces = udev->config->desc.bNumInterfaces; - iface = to_usb_interface(hdev->dev.parent); - bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; - /* * Set replacement report descriptor if the original matches the * specified size. Otherwise keep interface unchanged. diff -u linux-aws-5.13-5.13.0/drivers/hid/hid-vivaldi.c linux-aws-5.13-5.13.0/drivers/hid/hid-vivaldi.c --- linux-aws-5.13-5.13.0/drivers/hid/hid-vivaldi.c +++ linux-aws-5.13-5.13.0/drivers/hid/hid-vivaldi.c @@ -74,11 +74,10 @@ struct hid_usage *usage) { struct vivaldi_data *drvdata = hid_get_drvdata(hdev); - struct hid_report *report = field->report; int fn_key; int ret; u32 report_len; - u8 *report_data, *buf; + u8 *buf; if (field->logical != HID_USAGE_FN_ROW_PHYSMAP || (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL) @@ -90,24 +89,12 @@ if (fn_key > drvdata->max_function_row_key) drvdata->max_function_row_key = fn_key; - report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL); - if (!report_data) + buf = hid_alloc_report_buf(field->report, GFP_KERNEL); + if (!buf) return; - report_len = hid_report_len(report); - if (!report->id) { - /* - * hid_hw_raw_request() will stuff report ID (which will be 0) - * into the first byte of the buffer even for unnumbered - * reports, so we need to account for this to avoid getting - * -EOVERFLOW in return. - * Note that hid_alloc_report_buf() adds 7 bytes to the size - * so we can safely say that we have space for an extra byte. - */ - report_len++; - } - - ret = hid_hw_raw_request(hdev, report->id, report_data, + report_len = hid_report_len(field->report); + ret = hid_hw_raw_request(hdev, field->report->id, buf, report_len, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); if (ret < 0) { @@ -116,16 +103,7 @@ goto out; } - if (!report->id) { - /* - * Undo the damage from hid_hw_raw_request() for unnumbered - * reports. - */ - report_data++; - report_len--; - } - - ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data, + ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf, report_len, 0); if (ret) { dev_warn(&hdev->dev, "failed to report feature %d\n", reverted: --- linux-aws-5.13-5.13.0/drivers/hid/uhid.c +++ linux-aws-5.13-5.13.0.orig/drivers/hid/uhid.c @@ -28,22 +28,11 @@ struct uhid_device { struct mutex devlock; - - /* This flag tracks whether the HID device is usable for commands from - * userspace. The flag is already set before hid_add_device(), which - * runs in workqueue context, to allow hid_add_device() to communicate - * with userspace. - * However, if hid_add_device() fails, the flag is cleared without - * holding devlock. - * We guarantee that if @running changes from true to false while you're - * holding @devlock, it's still fine to access @hid. - */ bool running; __u8 *rd_data; uint rd_size; - /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ struct hid_device *hid; struct uhid_event input_buf; @@ -74,18 +63,9 @@ if (ret) { hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); + hid_destroy_device(uhid->hid); + uhid->hid = NULL; - /* We used to call hid_destroy_device() here, but that's really - * messy to get right because we have to coordinate with - * concurrent writes from userspace that might be in the middle - * of using uhid->hid. - * Just leave uhid->hid as-is for now, and clean it up when - * userspace tries to close or reinitialize the uhid instance. - * - * However, we do have to clear the ->running flag and do a - * wakeup to make sure userspace knows that the device is gone. - */ uhid->running = false; - wake_up_interruptible(&uhid->report_wait); } } @@ -494,7 +474,7 @@ void *rd_data; int ret; + if (uhid->running) - if (uhid->hid) return -EALREADY; rd_size = ev->u.create2.rd_size; @@ -576,7 +556,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) { + if (!uhid->running) - if (!uhid->hid) return -EINVAL; uhid->running = false; @@ -585,7 +565,6 @@ cancel_work_sync(&uhid->worker); hid_destroy_device(uhid->hid); - uhid->hid = NULL; kfree(uhid->rd_data); return 0; diff -u linux-aws-5.13-5.13.0/drivers/hid/wacom_wac.c linux-aws-5.13-5.13.0/drivers/hid/wacom_wac.c --- linux-aws-5.13-5.13.0/drivers/hid/wacom_wac.c +++ linux-aws-5.13-5.13.0/drivers/hid/wacom_wac.c @@ -2658,10 +2658,6 @@ hid_data->confidence = true; - hid_data->cc_report = 0; - hid_data->cc_index = -1; - hid_data->cc_value_index = -1; - for (i = 0; i < report->maxfield; i++) { struct hid_field *field = report->field[i]; int j; reverted: --- linux-aws-5.13-5.13.0/drivers/hsi/hsi_core.c +++ linux-aws-5.13-5.13.0.orig/drivers/hsi/hsi_core.c @@ -102,7 +102,6 @@ if (device_register(&cl->device) < 0) { pr_err("hsi: failed to register client: %s\n", info->name); put_device(&cl->device); - goto err; } return cl; diff -u linux-aws-5.13-5.13.0/drivers/hwmon/lm90.c linux-aws-5.13-5.13.0/drivers/hwmon/lm90.c --- linux-aws-5.13-5.13.0/drivers/hwmon/lm90.c +++ linux-aws-5.13-5.13.0/drivers/hwmon/lm90.c @@ -373,7 +373,7 @@ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, .alert_alarms = 0x7c, - .max_convrate = 7, + .max_convrate = 8, }, [lm86] = { .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT @@ -394,13 +394,12 @@ .max_convrate = 9, }, [max6646] = { - .flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT, + .flags = LM90_HAVE_CRIT, .alert_alarms = 0x7c, .max_convrate = 6, .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, }, [max6654] = { - .flags = LM90_HAVE_BROKEN_ALERT, .alert_alarms = 0x7c, .max_convrate = 7, .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, @@ -419,7 +418,7 @@ }, [max6680] = { .flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT - | LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT, + | LM90_HAVE_CRIT_ALRM_SWP, .alert_alarms = 0x7c, .max_convrate = 7, }, reverted: --- linux-aws-5.13-5.13.0/drivers/hwmon/mr75203.c +++ linux-aws-5.13-5.13.0.orig/drivers/hwmon/mr75203.c @@ -93,7 +93,7 @@ #define VM_CH_REQ BIT(21) #define IP_TMR 0x05 +#define POWER_DELAY_CYCLE_256 0x80 -#define POWER_DELAY_CYCLE_256 0x100 #define POWER_DELAY_CYCLE_64 0x40 #define PVT_POLL_DELAY_US 20 reverted: --- linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-designware-pcidrv.c +++ linux-aws-5.13-5.13.0.orig/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -39,10 +39,10 @@ }; struct dw_scl_sda_cfg { + u32 ss_hcnt; + u32 fs_hcnt; + u32 ss_lcnt; + u32 fs_lcnt; - u16 ss_hcnt; - u16 fs_hcnt; - u16 ss_lcnt; - u16 fs_lcnt; u32 sda_hold; }; reverted: --- linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-i801.c +++ linux-aws-5.13-5.13.0.orig/drivers/i2c/busses/i2c-i801.c @@ -801,11 +801,6 @@ int result = 0; unsigned char hostc; - if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) - data->block[0] = I2C_SMBUS_BLOCK_MAX; - else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) - return -EPROTO; - if (command == I2C_SMBUS_I2C_BLOCK_DATA) { if (read_write == I2C_SMBUS_WRITE) { /* set I2C_EN bit in configuration register */ @@ -819,6 +814,16 @@ } } + if (read_write == I2C_SMBUS_WRITE + || command == I2C_SMBUS_I2C_BLOCK_DATA) { + if (data->block[0] < 1) + data->block[0] = 1; + if (data->block[0] > I2C_SMBUS_BLOCK_MAX) + data->block[0] = I2C_SMBUS_BLOCK_MAX; + } else { + data->block[0] = 32; /* max for SMBus block reads */ + } + /* Experience has shown that the block buffer can only be used for SMBus (not I2C) block transactions, even though the datasheet doesn't mention this limitation. */ diff -u linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-mpc.c linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-mpc.c --- linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-mpc.c +++ linux-aws-5.13-5.13.0/drivers/i2c/busses/i2c-mpc.c @@ -119,30 +119,23 @@ /* Sometimes 9th clock pulse isn't generated, and slave doesn't release * the bus, because it wants to send ACK. * Following sequence of enabling/disabling and sending start/stop generates - * the 9 pulses, each with a START then ending with STOP, so it's all OK. + * the 9 pulses, so it's all OK. */ static void mpc_i2c_fixup(struct mpc_i2c *i2c) { int k; - unsigned long flags; + u32 delay_val = 1000000 / i2c->real_clk + 1; + + if (delay_val < 2) + delay_val = 2; for (k = 9; k; k--) { writeccr(i2c, 0); - writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ - writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ - readb(i2c->base + MPC_I2C_DR); /* init xfer */ - udelay(15); /* let it hit the bus */ - local_irq_save(flags); /* should not be delayed further */ - writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ + writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); readb(i2c->base + MPC_I2C_DR); - if (k != 1) - udelay(5); - local_irq_restore(flags); + writeccr(i2c, CCR_MEN); + udelay(delay_val << 1); } - writeccr(i2c, CCR_MEN); /* Initiate STOP */ - readb(i2c->base + MPC_I2C_DR); - udelay(15); /* Let STOP propagate */ - writeccr(i2c, 0); } static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask) reverted: --- linux-aws-5.13-5.13.0/drivers/iio/adc/ti-adc081c.c +++ linux-aws-5.13-5.13.0.orig/drivers/iio/adc/ti-adc081c.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -152,16 +151,13 @@ { struct iio_dev *iio; struct adc081c *adc; + struct adcxx1c_model *model; - const struct adcxx1c_model *model; int err; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; + model = &adcxx1c_models[id->driver_data]; - if (dev_fwnode(&client->dev)) - model = device_get_match_data(&client->dev); - else - model = &adcxx1c_models[id->driver_data]; iio = devm_iio_device_alloc(&client->dev, sizeof(*adc)); if (!iio) @@ -228,17 +224,10 @@ }; MODULE_DEVICE_TABLE(i2c, adc081c_id); -static const struct acpi_device_id adc081c_acpi_match[] = { - /* Used on some AAEON boards */ - { "ADC081C", (kernel_ulong_t)&adcxx1c_models[ADC081C] }, - { } -}; -MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match); - static const struct of_device_id adc081c_of_match[] = { + { .compatible = "ti,adc081c" }, + { .compatible = "ti,adc101c" }, + { .compatible = "ti,adc121c" }, - { .compatible = "ti,adc081c", .data = &adcxx1c_models[ADC081C] }, - { .compatible = "ti,adc101c", .data = &adcxx1c_models[ADC101C] }, - { .compatible = "ti,adc121c", .data = &adcxx1c_models[ADC121C] }, { } }; MODULE_DEVICE_TABLE(of, adc081c_of_match); @@ -247,7 +236,6 @@ .driver = { .name = "adc081c", .of_match_table = adc081c_of_match, - .acpi_match_table = adc081c_acpi_match, }, .probe = adc081c_probe, .remove = adc081c_remove, diff -u linux-aws-5.13-5.13.0/drivers/iio/industrialio-trigger.c linux-aws-5.13-5.13.0/drivers/iio/industrialio-trigger.c --- linux-aws-5.13-5.13.0/drivers/iio/industrialio-trigger.c +++ linux-aws-5.13-5.13.0/drivers/iio/industrialio-trigger.c @@ -158,39 +158,6 @@ return trig; } -static void iio_reenable_work_fn(struct work_struct *work) -{ - struct iio_trigger *trig = container_of(work, struct iio_trigger, - reenable_work); - - /* - * This 'might' occur after the trigger state is set to disabled - - * in that case the driver should skip reenabling. - */ - trig->ops->reenable(trig); -} - -/* - * In general, reenable callbacks may need to sleep and this path is - * not performance sensitive, so just queue up a work item - * to reneable the trigger for us. - * - * Races that can cause this. - * 1) A handler occurs entirely in interrupt context so the counter - * the final decrement is still in this interrupt. - * 2) The trigger has been removed, but one last interrupt gets through. - * - * For (1) we must call reenable, but not in atomic context. - * For (2) it should be safe to call reenanble, if drivers never blindly - * reenable after state is off. - */ -static void iio_trigger_notify_done_atomic(struct iio_trigger *trig) -{ - if (atomic_dec_and_test(&trig->use_count) && trig->ops && - trig->ops->reenable) - schedule_work(&trig->reenable_work); -} - void iio_trigger_poll(struct iio_trigger *trig) { int i; @@ -202,7 +169,7 @@ if (trig->subirqs[i].enabled) generic_handle_irq(trig->subirq_base + i); else - iio_trigger_notify_done_atomic(trig); + iio_trigger_notify_done(trig); } } } @@ -561,7 +528,6 @@ trig->dev.type = &iio_trig_type; trig->dev.bus = &iio_bus_type; device_initialize(&trig->dev); - INIT_WORK(&trig->reenable_work, iio_reenable_work_fn); mutex_init(&trig->pool_lock); trig->subirq_base = irq_alloc_descs(-1, 0, diff -u linux-aws-5.13-5.13.0/drivers/infiniband/core/cma.c linux-aws-5.13-5.13.0/drivers/infiniband/core/cma.c --- linux-aws-5.13-5.13.0/drivers/infiniband/core/cma.c +++ linux-aws-5.13-5.13.0/drivers/infiniband/core/cma.c @@ -766,7 +766,6 @@ unsigned int p; u16 pkey, index; enum ib_port_state port_state; - int ret; int i; cma_dev = NULL; @@ -785,14 +784,9 @@ if (ib_get_cached_port_state(cur_dev->device, p, &port_state)) continue; - - for (i = 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; - ++i) { - ret = rdma_query_gid(cur_dev->device, p, i, - &gid); - if (ret) - continue; - + for (i = 0; !rdma_query_gid(cur_dev->device, + p, i, &gid); + i++) { if (!memcmp(&gid, dgid, sizeof(gid))) { cma_dev = cur_dev; sgid = gid; @@ -4034,7 +4028,8 @@ memset(&req, 0, sizeof req); offset = cma_user_data_offset(id_priv); - if (check_add_overflow(offset, conn_param->private_data_len, &req.private_data_len)) + req.private_data_len = offset + conn_param->private_data_len; + if (req.private_data_len < conn_param->private_data_len) return -EINVAL; if (req.private_data_len) { @@ -4093,7 +4088,8 @@ memset(&req, 0, sizeof req); offset = cma_user_data_offset(id_priv); - if (check_add_overflow(offset, conn_param->private_data_len, &req.private_data_len)) + req.private_data_len = offset + conn_param->private_data_len; + if (req.private_data_len < conn_param->private_data_len) return -EINVAL; if (req.private_data_len) { reverted: --- linux-aws-5.13-5.13.0/drivers/infiniband/core/device.c +++ linux-aws-5.13-5.13.0.orig/drivers/infiniband/core/device.c @@ -2464,8 +2464,7 @@ ++i) { ret = rdma_query_gid(device, port, i, &tmp_gid); if (ret) + return ret; - continue; - if (!memcmp(&tmp_gid, gid, sizeof *gid)) { *port_num = port; if (index) reverted: --- linux-aws-5.13-5.13.0/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ linux-aws-5.13-5.13.0.orig/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -618,6 +618,8 @@ if (!cmdq->cmdq_bitmap) goto fail; + cmdq->bmap_size = bmap_size; + /* Allocate one extra to hold the QP1 entries */ rcfw->qp_tbl_size = qp_tbl_sz + 1; rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node), @@ -665,8 +667,8 @@ iounmap(cmdq->cmdq_mbox.reg.bar_reg); iounmap(creq->creq_db.reg.bar_reg); + indx = find_first_bit(cmdq->cmdq_bitmap, cmdq->bmap_size); + if (indx != cmdq->bmap_size) - indx = find_first_bit(cmdq->cmdq_bitmap, rcfw->cmdq_depth); - if (indx != rcfw->cmdq_depth) dev_err(&rcfw->pdev->dev, "disabling RCFW with pending cmd-bit %lx\n", indx); reverted: --- linux-aws-5.13-5.13.0/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +++ linux-aws-5.13-5.13.0.orig/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h @@ -152,6 +152,7 @@ wait_queue_head_t waitq; unsigned long flags; unsigned long *cmdq_bitmap; + u32 bmap_size; u32 seq_num; }; diff -u linux-aws-5.13-5.13.0/drivers/infiniband/hw/cxgb4/qp.c linux-aws-5.13-5.13.0/drivers/infiniband/hw/cxgb4/qp.c --- linux-aws-5.13-5.13.0/drivers/infiniband/hw/cxgb4/qp.c +++ linux-aws-5.13-5.13.0/drivers/infiniband/hw/cxgb4/qp.c @@ -2472,7 +2472,6 @@ memset(attr, 0, sizeof(*attr)); memset(init_attr, 0, sizeof(*init_attr)); attr->qp_state = to_ib_qp_state(qhp->attr.state); - attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; diff -u linux-aws-5.13-5.13.0/drivers/infiniband/hw/hns/hns_roce_main.c linux-aws-5.13-5.13.0/drivers/infiniband/hw/hns/hns_roce_main.c --- linux-aws-5.13-5.13.0/drivers/infiniband/hw/hns/hns_roce_main.c +++ linux-aws-5.13-5.13.0/drivers/infiniband/hw/hns/hns_roce_main.c @@ -269,9 +269,6 @@ static int hns_roce_query_pkey(struct ib_device *ib_dev, u32 port, u16 index, u16 *pkey) { - if (index > 0) - return -EINVAL; - *pkey = PKEY_ID; return 0; @@ -351,7 +348,7 @@ return rdma_user_mmap_io(context, vma, to_hr_ucontext(context)->uar.pfn, PAGE_SIZE, - pgprot_device(vma->vm_page_prot), + pgprot_noncached(vma->vm_page_prot), NULL); /* vm_pgoff: 1 -- TPTR */ diff -u linux-aws-5.13-5.13.0/drivers/infiniband/hw/qedr/verbs.c linux-aws-5.13-5.13.0/drivers/infiniband/hw/qedr/verbs.c --- linux-aws-5.13-5.13.0/drivers/infiniband/hw/qedr/verbs.c +++ linux-aws-5.13-5.13.0/drivers/infiniband/hw/qedr/verbs.c @@ -1926,7 +1926,6 @@ /* db offset was calculated in copy_qp_uresp, now set in the user q */ if (qedr_qp_has_sq(qp)) { qp->usq.db_addr = ctx->dpi_addr + uresp.sq_db_offset; - qp->sq.max_wr = attrs->cap.max_send_wr; rc = qedr_db_recovery_add(dev, qp->usq.db_addr, &qp->usq.db_rec_data->db_data, DB_REC_WIDTH_32B, @@ -1937,7 +1936,6 @@ if (qedr_qp_has_rq(qp)) { qp->urq.db_addr = ctx->dpi_addr + uresp.rq_db_offset; - qp->rq.max_wr = attrs->cap.max_recv_wr; rc = qedr_db_recovery_add(dev, qp->urq.db_addr, &qp->urq.db_rec_data->db_data, DB_REC_WIDTH_32B, reverted: --- linux-aws-5.13-5.13.0/drivers/infiniband/sw/rxe/rxe_opcode.c +++ linux-aws-5.13-5.13.0.orig/drivers/infiniband/sw/rxe/rxe_opcode.c @@ -110,7 +110,7 @@ } }, [IB_OPCODE_RC_SEND_MIDDLE] = { + .name = "IB_OPCODE_RC_SEND_MIDDLE]", - .name = "IB_OPCODE_RC_SEND_MIDDLE", .mask = RXE_PAYLOAD_MASK | RXE_REQ_MASK | RXE_SEND_MASK | RXE_MIDDLE_MASK, .length = RXE_BTH_BYTES, diff -u linux-aws-5.13-5.13.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c linux-aws-5.13-5.13.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c --- linux-aws-5.13-5.13.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ linux-aws-5.13-5.13.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -861,7 +861,7 @@ struct rtrs_clt_sess *min_path = NULL; struct rtrs_clt *clt = it->clt; struct rtrs_clt_sess *sess; - ktime_t min_latency = KTIME_MAX; + ktime_t min_latency = INT_MAX; ktime_t latency; list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) { reverted: --- linux-aws-5.13-5.13.0/drivers/interconnect/qcom/icc-rpm.c +++ linux-aws-5.13-5.13.0.orig/drivers/interconnect/qcom/icc-rpm.c @@ -68,7 +68,6 @@ rate = max(sum_bw, max_peak_bw); do_div(rate, qn->buswidth); - rate = min_t(u64, rate, LONG_MAX); if (qn->rate == rate) return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/iommu/amd/amd_iommu_types.h +++ linux-aws-5.13-5.13.0.orig/drivers/iommu/amd/amd_iommu_types.h @@ -643,6 +643,8 @@ /* DebugFS Info */ struct dentry *debugfs; #endif + /* IRQ notifier for IntCapXT interrupt */ + struct irq_affinity_notify intcapxt_notify; }; static inline struct amd_iommu *dev_to_amd_iommu(struct device *dev) diff -u linux-aws-5.13-5.13.0/drivers/iommu/amd/init.c linux-aws-5.13-5.13.0/drivers/iommu/amd/init.c --- linux-aws-5.13-5.13.0/drivers/iommu/amd/init.c +++ linux-aws-5.13-5.13.0/drivers/iommu/amd/init.c @@ -804,26 +804,15 @@ { #ifdef CONFIG_IRQ_REMAP u32 status, i; - u64 entry; if (!iommu->ga_log) return -EINVAL; - /* Check if already running */ status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); - if (WARN_ON(status & (MMIO_STATUS_GALOG_RUN_MASK))) - return 0; - - entry = iommu_virt_to_phys(iommu->ga_log) | GA_LOG_SIZE_512; - memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_BASE_OFFSET, - &entry, sizeof(entry)); - entry = (iommu_virt_to_phys(iommu->ga_log_tail) & - (BIT_ULL(52)-1)) & ~7ULL; - memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_TAIL_OFFSET, - &entry, sizeof(entry)); - writel(0x00, iommu->mmio_base + MMIO_GA_HEAD_OFFSET); - writel(0x00, iommu->mmio_base + MMIO_GA_TAIL_OFFSET); + /* Check if already running */ + if (status & (MMIO_STATUS_GALOG_RUN_MASK)) + return 0; iommu_feature_enable(iommu, CONTROL_GAINT_EN); iommu_feature_enable(iommu, CONTROL_GALOG_EN); @@ -834,15 +823,17 @@ break; } - if (WARN_ON(i >= LOOP_TIMEOUT)) + if (i >= LOOP_TIMEOUT) return -EINVAL; #endif /* CONFIG_IRQ_REMAP */ return 0; } +#ifdef CONFIG_IRQ_REMAP static int iommu_init_ga_log(struct amd_iommu *iommu) { -#ifdef CONFIG_IRQ_REMAP + u64 entry; + if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) return 0; @@ -856,13 +847,32 @@ if (!iommu->ga_log_tail) goto err_out; + entry = iommu_virt_to_phys(iommu->ga_log) | GA_LOG_SIZE_512; + memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_BASE_OFFSET, + &entry, sizeof(entry)); + entry = (iommu_virt_to_phys(iommu->ga_log_tail) & + (BIT_ULL(52)-1)) & ~7ULL; + memcpy_toio(iommu->mmio_base + MMIO_GA_LOG_TAIL_OFFSET, + &entry, sizeof(entry)); + writel(0x00, iommu->mmio_base + MMIO_GA_HEAD_OFFSET); + writel(0x00, iommu->mmio_base + MMIO_GA_TAIL_OFFSET); + return 0; err_out: free_ga_log(iommu); return -EINVAL; -#else - return 0; +} #endif /* CONFIG_IRQ_REMAP */ + +static int iommu_init_ga(struct amd_iommu *iommu) +{ + int ret = 0; + +#ifdef CONFIG_IRQ_REMAP + ret = iommu_init_ga_log(iommu); +#endif /* CONFIG_IRQ_REMAP */ + + return ret; } static int __init alloc_cwwb_sem(struct amd_iommu *iommu) @@ -1844,7 +1854,7 @@ if (iommu_feature(iommu, FEATURE_PPR) && alloc_ppr_log(iommu)) return -ENOMEM; - ret = iommu_init_ga_log(iommu); + ret = iommu_init_ga(iommu); if (ret) return ret; @@ -2009,18 +2019,48 @@ }; } __attribute__ ((packed)); +/* + * There isn't really any need to mask/unmask at the irqchip level because + * the 64-bit INTCAPXT registers can be updated atomically without tearing + * when the affinity is being updated. + */ +static void intcapxt_unmask_irq(struct irq_data *data) +{ +} + +static void intcapxt_mask_irq(struct irq_data *data) +{ +} static struct irq_chip intcapxt_controller; static int intcapxt_irqdomain_activate(struct irq_domain *domain, struct irq_data *irqd, bool reserve) { + struct amd_iommu *iommu = irqd->chip_data; + struct irq_cfg *cfg = irqd_cfg(irqd); + union intcapxt xt; + + xt.capxt = 0ULL; + xt.dest_mode_logical = apic->dest_mode_logical; + xt.vector = cfg->vector; + xt.destid_0_23 = cfg->dest_apicid & GENMASK(23, 0); + xt.destid_24_31 = cfg->dest_apicid >> 24; + + /** + * Current IOMMU implemtation uses the same IRQ for all + * 3 IOMMU interrupts. + */ + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); + writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); return 0; } static void intcapxt_irqdomain_deactivate(struct irq_domain *domain, struct irq_data *irqd) { + intcapxt_mask_irq(irqd); } @@ -2054,38 +2094,6 @@ irq_domain_free_irqs_top(domain, virq, nr_irqs); } - -static void intcapxt_unmask_irq(struct irq_data *irqd) -{ - struct amd_iommu *iommu = irqd->chip_data; - struct irq_cfg *cfg = irqd_cfg(irqd); - union intcapxt xt; - - xt.capxt = 0ULL; - xt.dest_mode_logical = apic->dest_mode_logical; - xt.vector = cfg->vector; - xt.destid_0_23 = cfg->dest_apicid & GENMASK(23, 0); - xt.destid_24_31 = cfg->dest_apicid >> 24; - - /** - * Current IOMMU implementation uses the same IRQ for all - * 3 IOMMU interrupts. - */ - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); - writeq(xt.capxt, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); -} - -static void intcapxt_mask_irq(struct irq_data *irqd) -{ - struct amd_iommu *iommu = irqd->chip_data; - - writeq(0, iommu->mmio_base + MMIO_INTCAPXT_EVT_OFFSET); - writeq(0, iommu->mmio_base + MMIO_INTCAPXT_PPR_OFFSET); - writeq(0, iommu->mmio_base + MMIO_INTCAPXT_GALOG_OFFSET); -} - - static int intcapxt_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force) { @@ -2095,12 +2103,8 @@ ret = parent->chip->irq_set_affinity(parent, mask, force); if (ret < 0 || ret == IRQ_SET_MASK_OK_DONE) return ret; - return 0; -} -static int intcapxt_set_wake(struct irq_data *irqd, unsigned int on) -{ - return on ? -EOPNOTSUPP : 0; + return intcapxt_irqdomain_activate(irqd->domain, irqd, false); } static struct irq_chip intcapxt_controller = { @@ -2110,8 +2114,7 @@ .irq_ack = irq_chip_ack_parent, .irq_retrigger = irq_chip_retrigger_hierarchy, .irq_set_affinity = intcapxt_set_affinity, - .irq_set_wake = intcapxt_set_wake, - .flags = IRQCHIP_MASK_ON_SUSPEND, + .flags = IRQCHIP_SKIP_SET_WAKE, }; static const struct irq_domain_ops intcapxt_domain_ops = { @@ -2173,6 +2176,7 @@ return ret; } + iommu_feature_enable(iommu, CONTROL_INTCAPXT_EN); return 0; } @@ -2195,10 +2199,6 @@ iommu->int_enabled = true; enable_faults: - - if (amd_iommu_xt_mode == IRQ_REMAP_X2APIC_MODE) - iommu_feature_enable(iommu, CONTROL_INTCAPXT_EN); - iommu_feature_enable(iommu, CONTROL_EVT_INT_EN); if (iommu->ppr_log != NULL) reverted: --- linux-aws-5.13-5.13.0/drivers/iommu/io-pgtable-arm-v7s.c +++ linux-aws-5.13-5.13.0.orig/drivers/iommu/io-pgtable-arm-v7s.c @@ -246,17 +246,13 @@ __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl == 2) table = kmem_cache_zalloc(data->l2_tables, gfp); - - if (!table) - return NULL; - phys = virt_to_phys(table); if (phys != (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ dev_err(dev, "Page table does not fit in PTE: %pa", &phys); goto out_free; } + if (table && !cfg->coherent_walk) { - if (!cfg->coherent_walk) { dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma)) goto out_free; reverted: --- linux-aws-5.13-5.13.0/drivers/iommu/io-pgtable-arm.c +++ linux-aws-5.13-5.13.0.orig/drivers/iommu/io-pgtable-arm.c @@ -302,12 +302,11 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, arm_lpae_iopte *ptep, arm_lpae_iopte curr, + struct io_pgtable_cfg *cfg) - struct arm_lpae_io_pgtable *data) { arm_lpae_iopte old, new; - struct io_pgtable_cfg *cfg = &data->iop.cfg; + new = __pa(table) | ARM_LPAE_PTE_TYPE_TABLE; - new = paddr_to_iopte(__pa(table), data) | ARM_LPAE_PTE_TYPE_TABLE; if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) new |= ARM_LPAE_PTE_NSTABLE; @@ -358,7 +357,7 @@ if (!cptep) return -ENOMEM; + pte = arm_lpae_install_table(cptep, ptep, 0, cfg); - pte = arm_lpae_install_table(cptep, ptep, 0, data); if (pte) __arm_lpae_free_pages(cptep, tblsz, cfg); } else if (!cfg->coherent_walk && !(pte & ARM_LPAE_PTE_SW_SYNC)) { @@ -547,7 +546,7 @@ __arm_lpae_init_pte(data, blk_paddr, pte, lvl, &tablep[i]); } + pte = arm_lpae_install_table(tablep, ptep, blk_pte, cfg); - pte = arm_lpae_install_table(tablep, ptep, blk_pte, data); if (pte != blk_pte) { __arm_lpae_free_pages(tablep, tablesz, cfg); /* reverted: --- linux-aws-5.13-5.13.0/drivers/iommu/iova.c +++ linux-aws-5.13-5.13.0.orig/drivers/iommu/iova.c @@ -83,7 +83,8 @@ if (!has_iova_flush_queue(iovad)) return; + if (timer_pending(&iovad->fq_timer)) + del_timer(&iovad->fq_timer); - del_timer_sync(&iovad->fq_timer); fq_destroy_all_entries(iovad); diff -u linux-aws-5.13-5.13.0/drivers/irqchip/irq-gic-v3.c linux-aws-5.13-5.13.0/drivers/irqchip/irq-gic-v3.c --- linux-aws-5.13-5.13.0/drivers/irqchip/irq-gic-v3.c +++ linux-aws-5.13-5.13.0/drivers/irqchip/irq-gic-v3.c @@ -915,22 +915,6 @@ { u64 typer = gic_read_typer(ptr + GICR_TYPER); - /* Boot-time cleanip */ - if ((typer & GICR_TYPER_VLPIS) && (typer & GICR_TYPER_RVPEID)) { - u64 val; - - /* Deactivate any present vPE */ - val = gicr_read_vpendbaser(ptr + SZ_128K + GICR_VPENDBASER); - if (val & GICR_VPENDBASER_Valid) - gicr_write_vpendbaser(GICR_VPENDBASER_PendingLast, - ptr + SZ_128K + GICR_VPENDBASER); - - /* Mark the VPE table as invalid */ - val = gicr_read_vpropbaser(ptr + SZ_128K + GICR_VPROPBASER); - val &= ~GICR_VPROPBASER_4_1_VALID; - gicr_write_vpropbaser(val, ptr + SZ_128K + GICR_VPROPBASER); - } - gic_data.rdists.has_vlpis &= !!(typer & GICR_TYPER_VLPIS); /* RVPEID implies some form of DirectLPI, no matter what the doc says... :-/ */ reverted: --- linux-aws-5.13-5.13.0/drivers/irqchip/irq-realtek-rtl.c +++ linux-aws-5.13-5.13.0.orig/drivers/irqchip/irq-realtek-rtl.c @@ -62,7 +62,7 @@ static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { + irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq); - irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq); return 0; } @@ -95,8 +95,7 @@ * SoC interrupts are cascaded to MIPS CPU interrupts according to the * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts + * thus go into 4 IRRs. - * thus go into 4 IRRs. A routing value of '0' means the interrupt is left - * disconnected. Routing values {1..15} connect to output lines {0..14}. */ static int __init map_interrupts(struct device_node *node, struct irq_domain *domain) { @@ -135,7 +134,7 @@ of_node_put(cpu_ictl); cpu_int = be32_to_cpup(imap + 2); + if (cpu_int > 7) - if (cpu_int > 7 || cpu_int < 2) return -EINVAL; if (!(mips_irqs_set & BIT(cpu_int))) { @@ -144,8 +143,7 @@ mips_irqs_set |= BIT(cpu_int); } + regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32; - /* Use routing values (1..6) for CPU interrupts (2..7) */ - regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32; imap += 3; } diff -u linux-aws-5.13-5.13.0/drivers/md/dm.c linux-aws-5.13-5.13.0/drivers/md/dm.c --- linux-aws-5.13-5.13.0/drivers/md/dm.c +++ linux-aws-5.13-5.13.0/drivers/md/dm.c @@ -1903,10 +1903,8 @@ if (IS_ENABLED(CONFIG_DAX_DRIVER)) { md->dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops, 0); - if (IS_ERR(md->dax_dev)) { - md->dax_dev = NULL; + if (IS_ERR(md->dax_dev)) goto bad; - } } add_disk_no_queue_reg(md->disk); reverted: --- linux-aws-5.13-5.13.0/drivers/md/persistent-data/dm-btree.c +++ linux-aws-5.13-5.13.0.orig/drivers/md/persistent-data/dm-btree.c @@ -83,16 +83,14 @@ } static int insert_at(size_t value_size, struct btree_node *node, unsigned index, + uint64_t key, void *value) + __dm_written_to_disk(value) - uint64_t key, void *value) - __dm_written_to_disk(value) { uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); - uint32_t max_entries = le32_to_cpu(node->header.max_entries); __le64 key_le = cpu_to_le64(key); if (index > nr_entries || + index >= le32_to_cpu(node->header.max_entries)) { - index >= max_entries || - nr_entries >= max_entries) { DMERR("too many entries in btree node for insert"); __dm_unbless_for_disk(value); return -ENOMEM; reverted: --- linux-aws-5.13-5.13.0/drivers/md/persistent-data/dm-space-map-common.c +++ linux-aws-5.13-5.13.0.orig/drivers/md/persistent-data/dm-space-map-common.c @@ -281,11 +281,6 @@ struct disk_index_entry ie_disk; struct dm_block *blk; - if (b >= ll->nr_blocks) { - DMERR_LIMIT("metadata block out of bounds"); - return -EINVAL; - } - b = do_div(index, ll->entries_per_block); r = ll->load_ie(ll, index, &ie_disk); if (r < 0) reverted: --- linux-aws-5.13-5.13.0/drivers/media/Kconfig +++ linux-aws-5.13-5.13.0.orig/drivers/media/Kconfig @@ -141,10 +141,10 @@ prompt "Test drivers" if MEDIA_SUPPORT_FILTER default y if !MEDIA_SUPPORT_FILTER help + Those drivers should not be used on production Kernels, but + can be useful on debug ones. It enables several dummy drivers + that simulate a real hardware. Very useful to test userspace + applications and to validate if the subsystem core is doesn't - These drivers should not be used on production kernels, but - can be useful on debug ones. This option enables several dummy drivers - that simulate real hardware. Very useful to test userspace - applications and to validate if the subsystem core doesn't have regressions. Say Y if you want to use some virtual test driver. diff -u linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-adap.c linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-adap.c --- linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-adap.c +++ linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-adap.c @@ -161,10 +161,10 @@ u64 ts = ktime_get_ns(); struct cec_fh *fh; - mutex_lock(&adap->devnode.lock_fhs); + mutex_lock(&adap->devnode.lock); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, ev, ts); - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } /* Notify userspace that the CEC pin changed state at the given time. */ @@ -178,12 +178,11 @@ }; struct cec_fh *fh; - mutex_lock(&adap->devnode.lock_fhs); - list_for_each_entry(fh, &adap->devnode.fhs, list) { + mutex_lock(&adap->devnode.lock); + list_for_each_entry(fh, &adap->devnode.fhs, list) if (fh->mode_follower == CEC_MODE_MONITOR_PIN) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - } - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } EXPORT_SYMBOL_GPL(cec_queue_pin_cec_event); @@ -196,10 +195,10 @@ }; struct cec_fh *fh; - mutex_lock(&adap->devnode.lock_fhs); + mutex_lock(&adap->devnode.lock); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } EXPORT_SYMBOL_GPL(cec_queue_pin_hpd_event); @@ -212,10 +211,10 @@ }; struct cec_fh *fh; - mutex_lock(&adap->devnode.lock_fhs); + mutex_lock(&adap->devnode.lock); list_for_each_entry(fh, &adap->devnode.fhs, list) cec_queue_event_fh(fh, &ev, ktime_to_ns(ts)); - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } EXPORT_SYMBOL_GPL(cec_queue_pin_5v_event); @@ -287,12 +286,12 @@ u32 monitor_mode = valid_la ? CEC_MODE_MONITOR : CEC_MODE_MONITOR_ALL; - mutex_lock(&adap->devnode.lock_fhs); + mutex_lock(&adap->devnode.lock); list_for_each_entry(fh, &adap->devnode.fhs, list) { if (fh->mode_follower >= monitor_mode) cec_queue_msg_fh(fh, msg); } - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } /* @@ -303,12 +302,12 @@ { struct cec_fh *fh; - mutex_lock(&adap->devnode.lock_fhs); + mutex_lock(&adap->devnode.lock); list_for_each_entry(fh, &adap->devnode.fhs, list) { if (fh->mode_follower == CEC_MODE_FOLLOWER) cec_queue_msg_fh(fh, msg); } - mutex_unlock(&adap->devnode.lock_fhs); + mutex_unlock(&adap->devnode.lock); } /* Notify userspace of an adapter state change. */ @@ -1574,7 +1573,6 @@ /* Disabling monitor all mode should always succeed */ if (adap->monitor_all_cnt) WARN_ON(call_op(adap, adap_monitor_all_enable, false)); - /* serialize adap_enable */ mutex_lock(&adap->devnode.lock); if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { WARN_ON(adap->ops->adap_enable(adap, false)); @@ -1586,16 +1584,14 @@ return; } - /* serialize adap_enable */ mutex_lock(&adap->devnode.lock); adap->last_initiator = 0xff; adap->transmit_in_progress = false; - if (adap->needs_hpd || list_empty(&adap->devnode.fhs)) { - if (adap->ops->adap_enable(adap, true)) { - mutex_unlock(&adap->devnode.lock); - return; - } + if ((adap->needs_hpd || list_empty(&adap->devnode.fhs)) && + adap->ops->adap_enable(adap, true)) { + mutex_unlock(&adap->devnode.lock); + return; } if (adap->monitor_all_cnt && reverted: --- linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-api.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/cec/core/cec-api.c @@ -586,7 +586,6 @@ return err; } - /* serialize adap_enable */ mutex_lock(&devnode->lock); if (list_empty(&devnode->fhs) && !adap->needs_hpd && @@ -625,9 +624,7 @@ } #endif - mutex_lock(&devnode->lock_fhs); list_add(&fh->list, &devnode->fhs); - mutex_unlock(&devnode->lock_fhs); mutex_unlock(&devnode->lock); return 0; @@ -656,11 +653,8 @@ cec_monitor_all_cnt_dec(adap); mutex_unlock(&adap->lock); - /* serialize adap_enable */ mutex_lock(&devnode->lock); - mutex_lock(&devnode->lock_fhs); list_del(&fh->list); - mutex_unlock(&devnode->lock_fhs); if (cec_is_registered(adap) && list_empty(&devnode->fhs) && !adap->needs_hpd && adap->phys_addr == CEC_PHYS_ADDR_INVALID) { WARN_ON(adap->ops->adap_enable(adap, false)); reverted: --- linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-core.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/cec/core/cec-core.c @@ -169,10 +169,8 @@ devnode->registered = false; devnode->unregistered = true; - mutex_lock(&devnode->lock_fhs); list_for_each_entry(fh, &devnode->fhs, list) wake_up_interruptible(&fh->wait); - mutex_unlock(&devnode->lock_fhs); mutex_unlock(&devnode->lock); @@ -274,7 +272,6 @@ /* adap->devnode initialization */ INIT_LIST_HEAD(&adap->devnode.fhs); - mutex_init(&adap->devnode.lock_fhs); mutex_init(&adap->devnode.lock); adap->kthread = kthread_run(cec_thread_func, adap, "cec-%s", name); reverted: --- linux-aws-5.13-5.13.0/drivers/media/cec/core/cec-pin.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/cec/core/cec-pin.c @@ -1033,7 +1033,6 @@ { struct cec_adapter *adap = _adap; struct cec_pin *pin = adap->pin; - bool irq_enabled = false; for (;;) { wait_event_interruptible(pin->kthread_waitq, @@ -1061,7 +1060,6 @@ ns_to_ktime(pin->work_rx_msg.rx_ts)); msg->len = 0; } - if (pin->work_tx_status) { unsigned int tx_status = pin->work_tx_status; @@ -1085,39 +1083,27 @@ switch (atomic_xchg(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED)) { case CEC_PIN_IRQ_DISABLE: + pin->ops->disable_irq(adap); - if (irq_enabled) { - pin->ops->disable_irq(adap); - irq_enabled = false; - } cec_pin_high(pin); cec_pin_to_idle(pin); hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); break; case CEC_PIN_IRQ_ENABLE: - if (irq_enabled) - break; pin->enable_irq_failed = !pin->ops->enable_irq(adap); if (pin->enable_irq_failed) { cec_pin_to_idle(pin); hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); - } else { - irq_enabled = true; } break; default: break; } + if (kthread_should_stop()) break; } - if (pin->ops->disable_irq && irq_enabled) - pin->ops->disable_irq(adap); - hrtimer_cancel(&pin->timer); - cec_pin_read(pin); - cec_pin_to_idle(pin); - pin->state = CEC_ST_OFF; return 0; } @@ -1144,7 +1130,13 @@ hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); } else { + if (pin->ops->disable_irq) + pin->ops->disable_irq(adap); + hrtimer_cancel(&pin->timer); kthread_stop(pin->kthread); + cec_pin_read(pin); + cec_pin_to_idle(pin); + pin->state = CEC_ST_OFF; } return 0; } @@ -1165,8 +1157,11 @@ if (pin->state != CEC_ST_RX_IRQ) return; + atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); + pin->ops->disable_irq(pin->adap); + cec_pin_high(pin); + cec_pin_to_idle(pin); + hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); - atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_DISABLE); - wake_up_interruptible(&pin->kthread_waitq); } static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, reverted: --- linux-aws-5.13-5.13.0/drivers/media/common/saa7146/saa7146_fops.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/common/saa7146/saa7146_fops.c @@ -521,7 +521,7 @@ ERR("out of memory. aborting.\n"); kfree(vv); v4l2_ctrl_handler_free(hdl); + return -1; - return -ENOMEM; } saa7146_video_uops.init(dev,vv); diff -u linux-aws-5.13-5.13.0/drivers/media/common/videobuf2/videobuf2-dma-contig.c linux-aws-5.13-5.13.0/drivers/media/common/videobuf2/videobuf2-dma-contig.c --- linux-aws-5.13-5.13.0/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ linux-aws-5.13-5.13.0/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -157,7 +157,7 @@ GFP_KERNEL | vb->vb2_queue->gfp_flags, buf->attrs); if (!buf->cookie) { - dev_err(dev, "dma_alloc_coherent of size %lu failed\n", size); + dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } @@ -204,9 +204,9 @@ vma->vm_ops->open(vma); - pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", - __func__, (unsigned long)buf->dma_addr, vma->vm_start, - buf->size); + pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", + __func__, (unsigned long)buf->dma_addr, vma->vm_start, + buf->size); return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/media/dvb-core/dmxdev.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/dvb-core/dmxdev.c @@ -1413,7 +1413,7 @@ }; int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) { + int i; - int i, ret; if (dmxdev->demux->open(dmxdev->demux) < 0) return -EUSERS; @@ -1432,26 +1432,14 @@ DMXDEV_STATE_FREE); } + dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, - ret = dvb_register_device(dvb_adapter, &dmxdev->dvbdev, &dvbdev_demux, dmxdev, DVB_DEVICE_DEMUX, dmxdev->filternum); + dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, - if (ret < 0) - goto err_register_dvbdev; - - ret = dvb_register_device(dvb_adapter, &dmxdev->dvr_dvbdev, &dvbdev_dvr, dmxdev, DVB_DEVICE_DVR, dmxdev->filternum); - if (ret < 0) - goto err_register_dvr_dvbdev; dvb_ringbuffer_init(&dmxdev->dvr_buffer, NULL, 8192); return 0; - -err_register_dvr_dvbdev: - dvb_unregister_device(dmxdev->dvbdev); -err_register_dvbdev: - vfree(dmxdev->filter); - dmxdev->filter = NULL; - return ret; } EXPORT_SYMBOL(dvb_dmxdev_init); diff -u linux-aws-5.13-5.13.0/drivers/media/dvb-frontends/dib8000.c linux-aws-5.13-5.13.0/drivers/media/dvb-frontends/dib8000.c --- linux-aws-5.13-5.13.0/drivers/media/dvb-frontends/dib8000.c +++ linux-aws-5.13-5.13.0/drivers/media/dvb-frontends/dib8000.c @@ -4473,10 +4473,8 @@ state->timf_default = cfg->pll->timf; - if (dib8000_identify(&state->i2c) == 0) { - kfree(fe); + if (dib8000_identify(&state->i2c) == 0) goto error; - } dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); reverted: --- linux-aws-5.13-5.13.0/drivers/media/i2c/imx274.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/i2c/imx274.c @@ -1367,10 +1367,6 @@ int min, max, def; int ret; - ret = pm_runtime_resume_and_get(&imx274->client->dev); - if (ret < 0) - return ret; - mutex_lock(&imx274->lock); ret = imx274_set_frame_interval(imx274, fi->interval); @@ -1402,7 +1398,6 @@ unlock: mutex_unlock(&imx274->lock); - pm_runtime_put(&imx274->client->dev); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/media/i2c/ov8865.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/i2c/ov8865.c @@ -2330,27 +2330,27 @@ if (ret) { dev_err(sensor->dev, "failed to enable DOVDD regulator\n"); + goto disable; - return ret; } ret = regulator_enable(sensor->avdd); if (ret) { dev_err(sensor->dev, "failed to enable AVDD regulator\n"); + goto disable; - goto disable_dovdd; } ret = regulator_enable(sensor->dvdd); if (ret) { dev_err(sensor->dev, "failed to enable DVDD regulator\n"); + goto disable; - goto disable_avdd; } ret = clk_prepare_enable(sensor->extclk); if (ret) { dev_err(sensor->dev, "failed to enable EXTCLK clock\n"); + goto disable; - goto disable_dvdd; } gpiod_set_value_cansleep(sensor->reset, 0); @@ -2359,16 +2359,14 @@ /* Time to enter streaming mode according to power timings. */ usleep_range(10000, 12000); } else { +disable: gpiod_set_value_cansleep(sensor->powerdown, 1); gpiod_set_value_cansleep(sensor->reset, 1); clk_disable_unprepare(sensor->extclk); -disable_dvdd: regulator_disable(sensor->dvdd); -disable_avdd: regulator_disable(sensor->avdd); -disable_dovdd: regulator_disable(sensor->dovdd); } @@ -2895,16 +2893,14 @@ if (ret) goto error_mutex; - mutex_lock(&sensor->mutex); ret = ov8865_state_init(sensor); - mutex_unlock(&sensor->mutex); if (ret) goto error_ctrls; /* Runtime PM */ + pm_runtime_enable(sensor->dev); pm_runtime_set_suspended(sensor->dev); - pm_runtime_enable(sensor->dev); /* V4L2 subdev register */ reverted: --- linux-aws-5.13-5.13.0/drivers/media/pci/b2c2/flexcop-pci.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/pci/b2c2/flexcop-pci.c @@ -185,8 +185,6 @@ dma_addr_t cur_addr = fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; - if (cur_pos > fc_pci->dma[0].size * 2) - goto error; deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", jiffies_to_usecs(jiffies - fc_pci->last_irq), @@ -227,7 +225,6 @@ ret = IRQ_NONE; } -error: spin_unlock_irqrestore(&fc_pci->irq_lock, flags); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/media/pci/saa7146/hexium_gemini.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/pci/saa7146/hexium_gemini.c @@ -284,12 +284,7 @@ hexium_set_input(hexium, 0); hexium->cur_input = 0; + saa7146_vv_init(dev, &vv_data); - ret = saa7146_vv_init(dev, &vv_data); - if (ret) { - i2c_del_adapter(&hexium->i2c_adapter); - kfree(hexium); - return ret; - } vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; vv_data.vid_ops.vidioc_g_input = vidioc_g_input; reverted: --- linux-aws-5.13-5.13.0/drivers/media/pci/saa7146/hexium_orion.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/pci/saa7146/hexium_orion.c @@ -355,16 +355,10 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) { struct hexium *hexium = (struct hexium *) dev->ext_priv; - int ret; DEB_EE("\n"); + saa7146_vv_init(dev, &vv_data); - ret = saa7146_vv_init(dev, &vv_data); - if (ret) { - pr_err("Error in saa7146_vv_init()\n"); - return ret; - } - vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; vv_data.vid_ops.vidioc_g_input = vidioc_g_input; vv_data.vid_ops.vidioc_s_input = vidioc_s_input; reverted: --- linux-aws-5.13-5.13.0/drivers/media/pci/saa7146/mxb.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/pci/saa7146/mxb.c @@ -683,16 +683,10 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) { struct mxb *mxb; - int ret; DEB_EE("dev:%p\n", dev); + saa7146_vv_init(dev, &vv_data); - ret = saa7146_vv_init(dev, &vv_data); - if (ret) { - ERR("Error in saa7146_vv_init()"); - return ret; - } - if (mxb_probe(dev)) { saa7146_vv_release(dev); return -1; reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/aspeed-video.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/aspeed-video.c @@ -500,10 +500,6 @@ aspeed_video_update(video, VE_INTERRUPT_CTRL, 0, VE_INTERRUPT_MODE_DETECT); - /* Disable mode detect in order to re-trigger */ - aspeed_video_update(video, VE_SEQ_CTRL, - VE_SEQ_CTRL_TRIG_MODE_DET, 0); - /* Trigger mode detect */ aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET); } @@ -556,8 +552,6 @@ set_bit(VIDEO_RES_CHANGE, &video->flags); clear_bit(VIDEO_FRAME_INPRG, &video->flags); - video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL; - aspeed_video_off(video); aspeed_video_bufs_done(video, VB2_BUF_STATE_ERROR); @@ -792,6 +786,10 @@ return; } + /* Disable mode detect in order to re-trigger */ + aspeed_video_update(video, VE_SEQ_CTRL, + VE_SEQ_CTRL_TRIG_MODE_DET, 0); + aspeed_video_check_and_set_polarity(video); aspeed_video_enable_mode_detect(video); @@ -1339,6 +1337,7 @@ struct delayed_work *dwork = to_delayed_work(work); struct aspeed_video *video = container_of(dwork, struct aspeed_video, res_work); + u32 input_status = video->v4l2_input_status; aspeed_video_on(video); @@ -1351,7 +1350,8 @@ aspeed_video_get_resolution(video); if (video->detected_timings.width != video->active_timings.width || + video->detected_timings.height != video->active_timings.height || + input_status != video->v4l2_input_status) { - video->detected_timings.height != video->active_timings.height) { static const struct v4l2_event ev = { .type = V4L2_EVENT_SOURCE_CHANGE, .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/coda/coda-common.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/coda/coda-common.c @@ -1537,13 +1537,11 @@ if (!wait_for_completion_timeout(&ctx->completion, msecs_to_jiffies(1000))) { + dev_err(dev->dev, "CODA PIC_RUN timeout\n"); - if (ctx->use_bit) { - dev_err(dev->dev, "CODA PIC_RUN timeout\n"); + ctx->hold = true; - ctx->hold = true; + coda_hw_reset(ctx); - coda_hw_reset(ctx); - } if (ctx->ops->run_timeout) ctx->ops->run_timeout(ctx); reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/coda/coda-jpeg.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/coda/coda-jpeg.c @@ -1127,8 +1127,7 @@ coda_write(dev, 0, CODA9_REG_JPEG_GBU_BT_PTR); coda_write(dev, 0, CODA9_REG_JPEG_GBU_WD_PTR); coda_write(dev, 0, CODA9_REG_JPEG_GBU_BBSR); + coda_write(dev, 0, CODA9_REG_JPEG_BBC_STRM_CTRL); - coda_write(dev, BIT(31) | ((end_addr - start_addr - header_len) / 256), - CODA9_REG_JPEG_BBC_STRM_CTRL); coda_write(dev, 0, CODA9_REG_JPEG_GBU_CTRL); coda_write(dev, 0, CODA9_REG_JPEG_GBU_FF_RPTR); coda_write(dev, 127, CODA9_REG_JPEG_GBU_BBER); @@ -1258,23 +1257,6 @@ coda_hw_reset(ctx); } -static void coda9_jpeg_encode_timeout(struct coda_ctx *ctx) -{ - struct coda_dev *dev = ctx->dev; - u32 end_addr, wr_ptr; - - /* Handle missing BBC overflow interrupt via timeout */ - end_addr = coda_read(dev, CODA9_REG_JPEG_BBC_END_ADDR); - wr_ptr = coda_read(dev, CODA9_REG_JPEG_BBC_WR_PTR); - if (wr_ptr >= end_addr - 256) { - v4l2_err(&dev->v4l2_dev, "JPEG too large for capture buffer\n"); - coda9_jpeg_finish_encode(ctx); - return; - } - - coda_hw_reset(ctx); -} - static void coda9_jpeg_release(struct coda_ctx *ctx) { int i; @@ -1294,7 +1276,6 @@ .start_streaming = coda9_jpeg_start_encoding, .prepare_run = coda9_jpeg_prepare_encode, .finish_run = coda9_jpeg_finish_encode, - .run_timeout = coda9_jpeg_encode_timeout, .release = coda9_jpeg_release, }; reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/coda/imx-vdoa.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/coda/imx-vdoa.c @@ -287,11 +287,7 @@ struct resource *res; int ret; + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) { - dev_err(&pdev->dev, "DMA enable failed\n"); - return ret; - } vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL); if (!vdoa) reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/imx-pxp.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/imx-pxp.c @@ -1661,8 +1661,6 @@ if (irq < 0) return irq; - spin_lock_init(&dev->irqlock); - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, pxp_irq_handler, IRQF_ONESHOT, dev_name(&pdev->dev), dev); if (ret < 0) { @@ -1680,6 +1678,8 @@ goto err_clk; } + spin_lock_init(&dev->irqlock); + ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_clk; reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -218,11 +218,11 @@ mtk_v4l2_debug(1, "[%d] encoder", ctx->id); mutex_lock(&dev->dev_mutex); - v4l2_m2m_ctx_release(ctx->m2m_ctx); mtk_vcodec_enc_release(ctx); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); + v4l2_m2m_ctx_release(ctx->m2m_ctx); list_del_init(&ctx->list); kfree(ctx); diff -u linux-aws-5.13-5.13.0/drivers/media/platform/qcom/venus/core.c linux-aws-5.13-5.13.0/drivers/media/platform/qcom/venus/core.c --- linux-aws-5.13-5.13.0/drivers/media/platform/qcom/venus/core.c +++ linux-aws-5.13-5.13.0/drivers/media/platform/qcom/venus/core.c @@ -349,11 +349,11 @@ ret = venus_firmware_init(core); if (ret) - goto err_of_depopulate; + goto err_runtime_disable; ret = venus_boot(core); if (ret) - goto err_firmware_deinit; + goto err_runtime_disable; ret = hfi_core_resume(core, true); if (ret) @@ -385,10 +385,6 @@ v4l2_device_unregister(&core->v4l2_dev); err_venus_shutdown: venus_shutdown(core); -err_firmware_deinit: - venus_firmware_deinit(core); -err_of_depopulate: - of_platform_depopulate(dev); err_runtime_disable: pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); @@ -476,8 +472,7 @@ err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: - if (pm_ops->core_power) - pm_ops->core_power(core, POWER_ON); + pm_ops->core_power(core, POWER_ON); return ret; } reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/qcom/venus/pm_helpers.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/qcom/venus/pm_helpers.c @@ -163,12 +163,14 @@ struct venus_inst *inst = NULL; u32 mbs_per_sec = 0; + mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { if (inst->session_type != session_type) continue; mbs_per_sec += load_per_instance(inst); } + mutex_unlock(&core->lock); return mbs_per_sec; } @@ -217,12 +219,14 @@ struct venus_inst *inst = NULL; u32 mbs_per_sec, avg, peak, total_avg = 0, total_peak = 0; + mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { mbs_per_sec = load_per_instance(inst); mbs_to_bw(inst, mbs_per_sec, &avg, &peak); total_avg += avg; total_peak += peak; } + mutex_unlock(&core->lock); /* * keep minimum bandwidth vote for "video-mem" path, @@ -249,9 +253,8 @@ struct device *dev = core->dev; u32 mbs_per_sec; unsigned int i; + int ret; - int ret = 0; - mutex_lock(&core->lock); mbs_per_sec = load_per_type(core, VIDC_SESSION_TYPE_ENC) + load_per_type(core, VIDC_SESSION_TYPE_DEC); @@ -276,19 +279,17 @@ if (ret) { dev_err(dev, "failed to set clock rate %lu (%d)\n", freq, ret); + return ret; - goto exit; } ret = load_scale_bw(core); if (ret) { dev_err(dev, "failed to set bandwidth (%d)\n", ret); + return ret; - goto exit; } + return 0; -exit: - mutex_unlock(&core->lock); - return ret; } static int core_get_v1(struct venus_core *core) @@ -1056,13 +1057,13 @@ struct device *dev = core->dev; unsigned long freq = 0, freq_core1 = 0, freq_core2 = 0; unsigned long filled_len = 0; + int i, ret; - int i, ret = 0; for (i = 0; i < inst->num_input_bufs; i++) filled_len = max(filled_len, inst->payloads[i]); if (inst->session_type == VIDC_SESSION_TYPE_DEC && !filled_len) + return 0; - return ret; freq = calculate_inst_freq(inst, filled_len); inst->clk_data.freq = freq; @@ -1078,6 +1079,7 @@ freq_core2 += inst->clk_data.freq; } } + mutex_unlock(&core->lock); freq = max(freq_core1, freq_core2); @@ -1101,19 +1103,17 @@ if (ret) { dev_err(dev, "failed to set clock rate %lu (%d)\n", freq, ret); + return ret; - goto exit; } ret = load_scale_bw(core); if (ret) { dev_err(dev, "failed to set bandwidth (%d)\n", ret); + return ret; - goto exit; } + return 0; -exit: - mutex_unlock(&core->lock); - return ret; } static const struct venus_pm_ops pm_ops_v4 = { diff -u linux-aws-5.13-5.13.0/drivers/media/platform/rcar-vin/rcar-csi2.c linux-aws-5.13-5.13.0/drivers/media/platform/rcar-vin/rcar-csi2.c --- linux-aws-5.13-5.13.0/drivers/media/platform/rcar-vin/rcar-csi2.c +++ linux-aws-5.13-5.13.0/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -436,23 +436,16 @@ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps) { const struct rcsi2_mbps_reg *hsfreq; - const struct rcsi2_mbps_reg *hsfreq_prev = NULL; - for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) { + for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++) if (hsfreq->mbps >= mbps) break; - hsfreq_prev = hsfreq; - } if (!hsfreq->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); return -ERANGE; } - if (hsfreq_prev && - ((mbps - hsfreq_prev->mbps) <= (hsfreq->mbps - mbps))) - hsfreq = hsfreq_prev; - rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg)); return 0; @@ -978,17 +971,10 @@ const struct rcsi2_mbps_reg *values, u16 code) { const struct rcsi2_mbps_reg *value; - const struct rcsi2_mbps_reg *prev_value = NULL; - for (value = values; value->mbps; value++) { + for (value = values; value->mbps; value++) if (value->mbps >= mbps) break; - prev_value = value; - } - - if (prev_value && - ((mbps - prev_value->mbps) <= (value->mbps - mbps))) - value = prev_value; if (!value->mbps) { dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps); reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -175,27 +175,20 @@ break; } + /* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ - /* Hardware limits width alignment based on format. */ switch (pix->pixelformat) { - /* Multiple of 32 (2^5) for NV12/16. */ case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV16: walign = 5; break; + default: - /* Multiple of 2 (2^1) for YUV. */ - case V4L2_PIX_FMT_YUYV: - case V4L2_PIX_FMT_UYVY: walign = 1; break; - /* No multiple for RGB. */ - default: - walign = 0; - break; } /* Limit to VIN capabilities */ + v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign, + &pix->height, 4, vin->info->max_height, 2, 0); - v4l_bound_align_image(&pix->width, 5, vin->info->max_width, walign, - &pix->height, 2, vin->info->max_height, 0, 0); pix->bytesperline = rvin_format_bytesperline(vin, pix); pix->sizeimage = rvin_format_sizeimage(pix); reverted: --- linux-aws-5.13-5.13.0/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -426,7 +426,7 @@ { struct rkisp1_debug *debug = &rkisp1->debug; + debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); - debug->debugfs_dir = debugfs_create_dir(dev_name(rkisp1->dev), NULL); debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir, &debug->data_loss); debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir, diff -u linux-aws-5.13-5.13.0/drivers/media/radio/si470x/radio-si470x-i2c.c linux-aws-5.13-5.13.0/drivers/media/radio/si470x/radio-si470x-i2c.c --- linux-aws-5.13-5.13.0/drivers/media/radio/si470x/radio-si470x-i2c.c +++ linux-aws-5.13-5.13.0/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -368,7 +368,7 @@ if (radio->hdl.error) { retval = radio->hdl.error; dev_err(&client->dev, "couldn't register control\n"); - goto err_all; + goto err_dev; } /* video device initialization */ @@ -463,6 +463,7 @@ return 0; err_all: v4l2_ctrl_handler_free(&radio->hdl); +err_dev: v4l2_device_unregister(&radio->v4l2_dev); err_initial: return retval; reverted: --- linux-aws-5.13-5.13.0/drivers/media/rc/igorplugusb.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/rc/igorplugusb.c @@ -64,11 +64,9 @@ if (start >= len) { dev_err(ir->dev, "receive overflow invalid: %u", overflow); } else { + if (overflow > 0) - if (overflow > 0) { dev_warn(ir->dev, "receive overflow, at least %u lost", overflow); - ir_raw_event_reset(ir->rc); - } do { rawir.duration = ir->buf_in[i] * 85; diff -u linux-aws-5.13-5.13.0/drivers/media/rc/mceusb.c linux-aws-5.13-5.13.0/drivers/media/rc/mceusb.c --- linux-aws-5.13-5.13.0/drivers/media/rc/mceusb.c +++ linux-aws-5.13-5.13.0/drivers/media/rc/mceusb.c @@ -1430,7 +1430,7 @@ */ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, - data, USB_CTRL_MSG_SZ, 3000); + data, USB_CTRL_MSG_SZ, HZ * 3); dev_dbg(dev, "set address - ret = %d", ret); dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", data[0], data[1]); @@ -1438,20 +1438,20 @@ /* set feature: bit rate 38400 bps */ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, - 0xc04e, 0x0000, NULL, 0, 3000); + 0xc04e, 0x0000, NULL, 0, HZ * 3); dev_dbg(dev, "set feature - ret = %d", ret); /* bRequest 4: set char length to 8 bits */ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 4, USB_TYPE_VENDOR, - 0x0808, 0x0000, NULL, 0, 3000); + 0x0808, 0x0000, NULL, 0, HZ * 3); dev_dbg(dev, "set char length - retB = %d", ret); /* bRequest 2: set handshaking to use DTR/DSR */ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 2, USB_TYPE_VENDOR, - 0x0000, 0x0100, NULL, 0, 3000); + 0x0000, 0x0100, NULL, 0, HZ * 3); dev_dbg(dev, "set handshake - retC = %d", ret); /* device resume */ reverted: --- linux-aws-5.13-5.13.0/drivers/media/rc/redrat3.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/rc/redrat3.c @@ -404,7 +404,7 @@ udev = rr3->udev; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), cmd, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + 0x0000, 0x0000, data, sizeof(u8), HZ * 10); - 0x0000, 0x0000, data, sizeof(u8), 10000); if (res < 0) { dev_err(rr3->dev, "%s: Error sending rr3 cmd res %d, data %d", @@ -480,7 +480,7 @@ pipe = usb_rcvctrlpipe(rr3->udev, 0); ret = usb_control_msg(rr3->udev, pipe, RR3_GET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, HZ * 5); - RR3_IR_IO_SIG_TIMEOUT, 0, tmp, len, 5000); if (ret != len) dev_warn(rr3->dev, "Failed to read timeout from hardware\n"); else { @@ -510,7 +510,7 @@ ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_SIG_TIMEOUT, 0, timeout, sizeof(*timeout), + HZ * 25); - 25000); dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", be32_to_cpu(*timeout), ret); @@ -542,32 +542,32 @@ *val = 0x01; rc = usb_control_msg(udev, rxpipe, RR3_RESET, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); - RR3_CPUCS_REG_ADDR, 0, val, len, 25000); dev_dbg(dev, "reset returned 0x%02x\n", rc); *val = length_fuzz; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); - RR3_IR_IO_LENGTH_FUZZ, 0, val, len, 25000); dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); *val = (65536 - (minimum_pause * 2000)) / 256; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); - RR3_IR_IO_MIN_PAUSE, 0, val, len, 25000); dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); *val = periods_measure_carrier; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); - RR3_IR_IO_PERIODS_MF, 0, val, len, 25000); dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, rc); *val = RR3_DRIVER_MAXLENS; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); - RR3_IR_IO_MAX_LENGTHS, 0, val, len, 25000); dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); kfree(val); @@ -585,7 +585,7 @@ rc = usb_control_msg(rr3->udev, usb_rcvctrlpipe(rr3->udev, 0), RR3_FW_VERSION, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + 0, 0, buffer, RR3_FW_VERSION_LEN, HZ * 5); - 0, 0, buffer, RR3_FW_VERSION_LEN, 5000); if (rc >= 0) dev_info(rr3->dev, "Firmware rev: %s", buffer); @@ -825,14 +825,14 @@ pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); ret = usb_bulk_msg(rr3->udev, pipe, irdata, + sendbuf_len, &ret_len, 10 * HZ); - sendbuf_len, &ret_len, 10000); dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); /* now tell the hardware to transmit what we sent it */ pipe = usb_rcvctrlpipe(rr3->udev, 0); ret = usb_control_msg(rr3->udev, pipe, RR3_TX_SEND_SIGNAL, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + 0, 0, irdata, 2, HZ * 10); - 0, 0, irdata, 2, 10000); if (ret < 0) dev_err(dev, "Error: control msg send failed, rc %d\n", ret); reverted: --- linux-aws-5.13-5.13.0/drivers/media/tuners/msi001.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/tuners/msi001.c @@ -442,13 +442,6 @@ V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); - if (dev->hdl.error) { - ret = dev->hdl.error; - dev_err(&spi->dev, "Could not initialize controls\n"); - /* control init failed, free handler */ - goto err_ctrl_handler_free; - } - v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); reverted: --- linux-aws-5.13-5.13.0/drivers/media/tuners/si2157.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/tuners/si2157.c @@ -90,7 +90,7 @@ dev_dbg(&client->dev, "\n"); /* Try to get Xtal trim property, to verify tuner still running */ + memcpy(cmd.args, "\x15\x00\x04\x02", 4); - memcpy(cmd.args, "\x15\x00\x02\x04", 4); cmd.wlen = 4; cmd.rlen = 4; ret = si2157_cmd_execute(client, &cmd); reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/b2c2/flexcop-usb.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/b2c2/flexcop-usb.c @@ -87,7 +87,7 @@ 0, fc_usb->data, sizeof(u32), + B2C2_WAIT_FOR_OPERATION_RDW * HZ); - B2C2_WAIT_FOR_OPERATION_RDW); if (ret != sizeof(u32)) { err("error while %s dword from %d (%d).", read ? "reading" : @@ -155,7 +155,7 @@ wIndex, fc_usb->data, buflen, + nWaitTime * HZ); - nWaitTime); if (ret != buflen) ret = -EIO; @@ -248,13 +248,13 @@ /* DKT 020208 - add this to support special case of DiSEqC */ case USB_FUNC_I2C_CHECKWRITE: pipe = B2C2_USB_CTRL_PIPE_OUT; + nWaitTime = 2; - nWaitTime = 2000; request_type |= USB_DIR_OUT; break; case USB_FUNC_I2C_READ: case USB_FUNC_I2C_REPEATREAD: pipe = B2C2_USB_CTRL_PIPE_IN; + nWaitTime = 2; - nWaitTime = 2000; request_type |= USB_DIR_IN; break; default: @@ -281,7 +281,7 @@ wIndex, fc_usb->data, buflen, + nWaitTime * HZ); - nWaitTime); if (ret != buflen) ret = -EIO; reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/b2c2/flexcop-usb.h +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/b2c2/flexcop-usb.h @@ -91,13 +91,13 @@ UTILITY_SRAM_TESTVERIFY = 0x16, } flexcop_usb_utility_function_t; +#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) +#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) +#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) -#define B2C2_WAIT_FOR_OPERATION_RW 1000 -#define B2C2_WAIT_FOR_OPERATION_RDW 3000 -#define B2C2_WAIT_FOR_OPERATION_WDW 1000 +#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) +#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) +#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) -#define B2C2_WAIT_FOR_OPERATION_V8READ 3000 -#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000 -#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000 typedef enum { V8_MEMORY_PAGE_DVB_CI = 0x20, diff -u linux-aws-5.13-5.13.0/drivers/media/usb/cpia2/cpia2_usb.c linux-aws-5.13-5.13.0/drivers/media/usb/cpia2/cpia2_usb.c --- linux-aws-5.13-5.13.0/drivers/media/usb/cpia2/cpia2_usb.c +++ linux-aws-5.13-5.13.0/drivers/media/usb/cpia2/cpia2_usb.c @@ -550,7 +550,7 @@ 0, /* index */ buf, /* buffer */ size, - 1000); + HZ); kfree(buf); return ret; @@ -582,7 +582,7 @@ 0, /* index */ buf, /* buffer */ size, - 1000); + HZ); if (ret >= 0) memcpy(registers, buf, size); reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/dvb-usb/dib0700_core.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/dvb-usb/dib0700_core.c @@ -618,6 +618,8 @@ deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); if (onoff) st->channel_state |= 1 << (adap->id); + else + st->channel_state |= 1 << ~(adap->id); } else { if (onoff) st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/dvb-usb/dw2102.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/dvb-usb/dw2102.c @@ -2150,153 +2150,46 @@ } }; +static const struct dvb_usb_device_description d1100 = { + "Prof 1100 USB ", + {&dw2102_table[PROF_1100], NULL}, + {NULL}, +}; -static struct dvb_usb_device_properties p1100_properties = { - .caps = DVB_USB_IS_AN_I2C_ADAPTER, - .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct dw2102_state), - .firmware = P1100_FIRMWARE, - .no_reconnect = 1, +static const struct dvb_usb_device_description d660 = { + "TeVii S660 USB", + {&dw2102_table[TEVII_S660], NULL}, + {NULL}, +}; - .i2c_algo = &s6x0_i2c_algo, - .rc.core = { - .rc_interval = 150, - .rc_codes = RC_MAP_TBS_NEC, - .module_name = "dw2102", - .allowed_protos = RC_PROTO_BIT_NEC, - .rc_query = prof_rc_query, - }, +static const struct dvb_usb_device_description d480_1 = { + "TeVii S480.1 USB", + {&dw2102_table[TEVII_S480_1], NULL}, + {NULL}, - .generic_bulk_ctrl_endpoint = 0x81, - .num_adapters = 1, - .download_firmware = dw2102_load_firmware, - .read_mac_address = s6x0_read_mac_address, - .adapter = { - { - .num_frontends = 1, - .fe = {{ - .frontend_attach = stv0288_frontend_attach, - .stream = { - .type = USB_BULK, - .count = 8, - .endpoint = 0x82, - .u = { - .bulk = { - .buffersize = 4096, - } - } - }, - } }, - } - }, - .num_device_descs = 1, - .devices = { - {"Prof 1100 USB ", - {&dw2102_table[PROF_1100], NULL}, - {NULL}, - }, - } }; +static const struct dvb_usb_device_description d480_2 = { + "TeVii S480.2 USB", + {&dw2102_table[TEVII_S480_2], NULL}, + {NULL}, +}; -static struct dvb_usb_device_properties s660_properties = { - .caps = DVB_USB_IS_AN_I2C_ADAPTER, - .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct dw2102_state), - .firmware = S660_FIRMWARE, - .no_reconnect = 1, +static const struct dvb_usb_device_description d7500 = { + "Prof 7500 USB DVB-S2", + {&dw2102_table[PROF_7500], NULL}, + {NULL}, +}; - .i2c_algo = &s6x0_i2c_algo, - .rc.core = { - .rc_interval = 150, - .rc_codes = RC_MAP_TEVII_NEC, - .module_name = "dw2102", - .allowed_protos = RC_PROTO_BIT_NEC, - .rc_query = dw2102_rc_query, - }, +static const struct dvb_usb_device_description d421 = { + "TeVii S421 PCI", + {&dw2102_table[TEVII_S421], NULL}, + {NULL}, - .generic_bulk_ctrl_endpoint = 0x81, - .num_adapters = 1, - .download_firmware = dw2102_load_firmware, - .read_mac_address = s6x0_read_mac_address, - .adapter = { - { - .num_frontends = 1, - .fe = {{ - .frontend_attach = ds3000_frontend_attach, - .stream = { - .type = USB_BULK, - .count = 8, - .endpoint = 0x82, - .u = { - .bulk = { - .buffersize = 4096, - } - } - }, - } }, - } - }, - .num_device_descs = 3, - .devices = { - {"TeVii S660 USB", - {&dw2102_table[TEVII_S660], NULL}, - {NULL}, - }, - {"TeVii S480.1 USB", - {&dw2102_table[TEVII_S480_1], NULL}, - {NULL}, - }, - {"TeVii S480.2 USB", - {&dw2102_table[TEVII_S480_2], NULL}, - {NULL}, - }, - } }; +static const struct dvb_usb_device_description d632 = { + "TeVii S632 USB", + {&dw2102_table[TEVII_S632], NULL}, + {NULL}, -static struct dvb_usb_device_properties p7500_properties = { - .caps = DVB_USB_IS_AN_I2C_ADAPTER, - .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct dw2102_state), - .firmware = P7500_FIRMWARE, - .no_reconnect = 1, - - .i2c_algo = &s6x0_i2c_algo, - .rc.core = { - .rc_interval = 150, - .rc_codes = RC_MAP_TBS_NEC, - .module_name = "dw2102", - .allowed_protos = RC_PROTO_BIT_NEC, - .rc_query = prof_rc_query, - }, - - .generic_bulk_ctrl_endpoint = 0x81, - .num_adapters = 1, - .download_firmware = dw2102_load_firmware, - .read_mac_address = s6x0_read_mac_address, - .adapter = { - { - .num_frontends = 1, - .fe = {{ - .frontend_attach = prof_7500_frontend_attach, - .stream = { - .type = USB_BULK, - .count = 8, - .endpoint = 0x82, - .u = { - .bulk = { - .buffersize = 4096, - } - } - }, - } }, - } - }, - .num_device_descs = 1, - .devices = { - {"Prof 7500 USB DVB-S2", - {&dw2102_table[PROF_7500], NULL}, - {NULL}, - }, - } }; static struct dvb_usb_device_properties su3000_properties = { @@ -2380,59 +2273,6 @@ } }; -static struct dvb_usb_device_properties s421_properties = { - .caps = DVB_USB_IS_AN_I2C_ADAPTER, - .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = sizeof(struct dw2102_state), - .power_ctrl = su3000_power_ctrl, - .num_adapters = 1, - .identify_state = su3000_identify_state, - .i2c_algo = &su3000_i2c_algo, - - .rc.core = { - .rc_interval = 150, - .rc_codes = RC_MAP_SU3000, - .module_name = "dw2102", - .allowed_protos = RC_PROTO_BIT_RC5, - .rc_query = su3000_rc_query, - }, - - .read_mac_address = su3000_read_mac_address, - - .generic_bulk_ctrl_endpoint = 0x01, - - .adapter = { - { - .num_frontends = 1, - .fe = {{ - .streaming_ctrl = su3000_streaming_ctrl, - .frontend_attach = m88rs2000_frontend_attach, - .stream = { - .type = USB_BULK, - .count = 8, - .endpoint = 0x82, - .u = { - .bulk = { - .buffersize = 4096, - } - } - } - } }, - } - }, - .num_device_descs = 2, - .devices = { - { "TeVii S421 PCI", - { &dw2102_table[TEVII_S421], NULL }, - { NULL }, - }, - { "TeVii S632 USB", - { &dw2102_table[TEVII_S632], NULL }, - { NULL }, - }, - } -}; - static struct dvb_usb_device_properties t220_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, @@ -2550,33 +2390,101 @@ static int dw2102_probe(struct usb_interface *intf, const struct usb_device_id *id) { + int retval = -ENOMEM; + struct dvb_usb_device_properties *p1100; + struct dvb_usb_device_properties *s660; + struct dvb_usb_device_properties *p7500; + struct dvb_usb_device_properties *s421; + + p1100 = kmemdup(&s6x0_properties, + sizeof(struct dvb_usb_device_properties), GFP_KERNEL); + if (!p1100) + goto err0; + + /* copy default structure */ + /* fill only different fields */ + p1100->firmware = P1100_FIRMWARE; + p1100->devices[0] = d1100; + p1100->rc.core.rc_query = prof_rc_query; + p1100->rc.core.rc_codes = RC_MAP_TBS_NEC; + p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach; + + s660 = kmemdup(&s6x0_properties, + sizeof(struct dvb_usb_device_properties), GFP_KERNEL); + if (!s660) + goto err1; + + s660->firmware = S660_FIRMWARE; + s660->num_device_descs = 3; + s660->devices[0] = d660; + s660->devices[1] = d480_1; + s660->devices[2] = d480_2; + s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach; + + p7500 = kmemdup(&s6x0_properties, + sizeof(struct dvb_usb_device_properties), GFP_KERNEL); + if (!p7500) + goto err2; + + p7500->firmware = P7500_FIRMWARE; + p7500->devices[0] = d7500; + p7500->rc.core.rc_query = prof_rc_query; + p7500->rc.core.rc_codes = RC_MAP_TBS_NEC; + p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach; + + + s421 = kmemdup(&su3000_properties, + sizeof(struct dvb_usb_device_properties), GFP_KERNEL); + if (!s421) + goto err3; + + s421->num_device_descs = 2; + s421->devices[0] = d421; + s421->devices[1] = d632; + s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach; + + if (0 == dvb_usb_device_init(intf, &dw2102_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &dw2104_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &dw3101_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &s6x0_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, p1100, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, s660, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, p7500, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, s421, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &su3000_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &t220_properties, + THIS_MODULE, NULL, adapter_nr) || + 0 == dvb_usb_device_init(intf, &tt_s2_4600_properties, + THIS_MODULE, NULL, adapter_nr)) { + + /* clean up copied properties */ + kfree(s421); + kfree(p7500); + kfree(s660); + kfree(p1100); - if (!(dvb_usb_device_init(intf, &dw2102_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &dw2104_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &dw3101_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &s6x0_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &p1100_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &s660_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &p7500_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &s421_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &su3000_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &t220_properties, - THIS_MODULE, NULL, adapter_nr) && - dvb_usb_device_init(intf, &tt_s2_4600_properties, - THIS_MODULE, NULL, adapter_nr))) { return 0; } + retval = -ENODEV; + kfree(s421); +err3: + kfree(p7500); +err2: + kfree(s660); +err1: + kfree(p1100); +err0: + return retval; - return -ENODEV; } static void dw2102_disconnect(struct usb_interface *intf) reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/dvb-usb/m920x.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/dvb-usb/m920x.c @@ -274,13 +274,6 @@ /* Should check for ack here, if we knew how. */ } if (msg[i].flags & I2C_M_RD) { - char *read = kmalloc(1, GFP_KERNEL); - if (!read) { - ret = -ENOMEM; - kfree(read); - goto unlock; - } - for (j = 0; j < msg[i].len; j++) { /* Last byte of transaction? * Send STOP, otherwise send ACK. */ @@ -288,12 +281,9 @@ if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, 0x20 | stop, + &msg[i].buf[j], 1)) != 0) - read, 1)) != 0) goto unlock; - msg[i].buf[j] = read[0]; } - - kfree(read); } else { for (j = 0; j < msg[i].len; j++) { /* Last byte of transaction? Then send STOP. */ diff -u linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-cards.c linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-cards.c --- linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-cards.c +++ linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-cards.c @@ -3625,10 +3625,8 @@ if (dev->is_audio_only) { retval = em28xx_audio_setup(dev); - if (retval) { - retval = -ENODEV; - goto err_deinit_media; - } + if (retval) + return -ENODEV; em28xx_init_extension(dev); return 0; @@ -3647,7 +3645,7 @@ dev_err(&dev->intf->dev, "%s: em28xx_i2c_register bus 0 - error [%d]!\n", __func__, retval); - goto err_deinit_media; + return retval; } /* register i2c bus 1 */ @@ -3663,7 +3661,9 @@ "%s: em28xx_i2c_register bus 1 - error [%d]!\n", __func__, retval); - goto err_unreg_i2c; + em28xx_i2c_unregister(dev, 0); + + return retval; } } @@ -3671,12 +3671,6 @@ em28xx_card_setup(dev); return 0; - -err_unreg_i2c: - em28xx_i2c_unregister(dev, 0); -err_deinit_media: - em28xx_unregister_media_device(dev); - return retval; } static int em28xx_duplicate_dev(struct em28xx *dev) diff -u linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-core.c linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-core.c --- linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-core.c +++ linux-aws-5.13-5.13.0/drivers/media/usb/em28xx/em28xx-core.c @@ -89,7 +89,7 @@ mutex_lock(&dev->ctrl_urb_lock); ret = usb_control_msg(udev, pipe, req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, 1000); + 0x0000, reg, dev->urb_buf, len, HZ); if (ret < 0) { em28xx_regdbg("(pipe 0x%08x): IN: %02x %02x %02x %02x %02x %02x %02x %02x failed with error %i\n", pipe, @@ -158,7 +158,7 @@ memcpy(dev->urb_buf, buf, len); ret = usb_control_msg(udev, pipe, req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x0000, reg, dev->urb_buf, len, 1000); + 0x0000, reg, dev->urb_buf, len, HZ); mutex_unlock(&dev->ctrl_urb_lock); if (ret < 0) { diff -u linux-aws-5.13-5.13.0/drivers/media/usb/pvrusb2/pvrusb2-hdw.c linux-aws-5.13-5.13.0/drivers/media/usb/pvrusb2/pvrusb2-hdw.c --- linux-aws-5.13-5.13.0/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ linux-aws-5.13-5.13.0/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -1467,7 +1467,7 @@ for (address = 0; address < fwsize; address += 0x800) { memcpy(fw_ptr, fw_entry->data + address, 0x800); ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, - 0, fw_ptr, 0x800, 1000); + 0, fw_ptr, 0x800, HZ); } trace_firmware("Upload done, releasing device's CPU"); @@ -1605,7 +1605,7 @@ ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, - &actual_length, 1000); + &actual_length, HZ); ret |= (actual_length != bcnt); if (ret) break; fw_done += bcnt; @@ -3438,7 +3438,7 @@ 0xa0,0xc0, address,0, hdw->fw_buffer+address, - 0x800,1000); + 0x800,HZ); if (ret < 0) break; } @@ -3977,7 +3977,7 @@ /* Write the CPUCS register on the 8051. The lsb of the register is the reset bit; a 1 asserts reset while a 0 clears it. */ pipe = usb_sndctrlpipe(hdw->usb_dev, 0); - ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); + ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); if (ret < 0) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "cpureset_assert(%d) error=%d",val,ret); reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/s2255/s2255drv.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/s2255/s2255drv.c @@ -1884,7 +1884,7 @@ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, Value, Index, buf, + TransferBufferLength, HZ * 5); - TransferBufferLength, USB_CTRL_SET_TIMEOUT); if (r >= 0) memcpy(TransferBuffer, buf, TransferBufferLength); @@ -1893,7 +1893,7 @@ r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, Value, Index, buf, + TransferBufferLength, HZ * 5); - TransferBufferLength, USB_CTRL_SET_TIMEOUT); } kfree(buf); return r; reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/stk1160/stk1160-core.c +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/stk1160/stk1160-core.c @@ -65,7 +65,7 @@ return -ENOMEM; ret = usb_control_msg(dev->udev, pipe, 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x00, reg, buf, sizeof(u8), HZ); - 0x00, reg, buf, sizeof(u8), 1000); if (ret < 0) { stk1160_err("read failed on reg 0x%x (%d)\n", reg, ret); @@ -85,7 +85,7 @@ ret = usb_control_msg(dev->udev, pipe, 0x01, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, reg, NULL, 0, HZ); - value, reg, NULL, 0, 1000); if (ret < 0) { stk1160_err("write failed on reg 0x%x (%d)\n", reg, ret); reverted: --- linux-aws-5.13-5.13.0/drivers/media/usb/uvc/uvcvideo.h +++ linux-aws-5.13-5.13.0.orig/drivers/media/usb/uvc/uvcvideo.h @@ -189,7 +189,7 @@ /* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 +#define UVC_CTRL_CONTROL_TIMEOUT 500 -#define UVC_CTRL_CONTROL_TIMEOUT 5000 #define UVC_CTRL_STREAMING_TIMEOUT 5000 /* Maximum allowed number of control mappings per device */ diff -u linux-aws-5.13-5.13.0/drivers/media/v4l2-core/v4l2-ioctl.c linux-aws-5.13-5.13.0/drivers/media/v4l2-core/v4l2-ioctl.c --- linux-aws-5.13-5.13.0/drivers/media/v4l2-core/v4l2-ioctl.c +++ linux-aws-5.13-5.13.0/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2088,7 +2088,6 @@ static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { - struct video_device *vfd = video_devdata(file); struct v4l2_streamparm *p = arg; v4l2_std_id std; int ret = check_fmt(file, p->type); @@ -2100,8 +2099,7 @@ if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; - if (vfd->device_caps & V4L2_CAP_READWRITE) - p->parm.capture.readbuffers = 2; + p->parm.capture.readbuffers = 2; ret = ops->vidioc_g_std(file, fh, &std); if (ret == 0) v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); diff -u linux-aws-5.13-5.13.0/drivers/memory/renesas-rpc-if.c linux-aws-5.13-5.13.0/drivers/memory/renesas-rpc-if.c --- linux-aws-5.13-5.13.0/drivers/memory/renesas-rpc-if.c +++ linux-aws-5.13-5.13.0/drivers/memory/renesas-rpc-if.c @@ -244,7 +244,7 @@ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); rpc->dirmap = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(rpc->dirmap)) - return PTR_ERR(rpc->dirmap); + rpc->dirmap = NULL; rpc->size = resource_size(res); rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); reverted: --- linux-aws-5.13-5.13.0/drivers/mfd/atmel-flexcom.c +++ linux-aws-5.13-5.13.0.orig/drivers/mfd/atmel-flexcom.c @@ -87,7 +87,8 @@ }; MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); +#ifdef CONFIG_PM_SLEEP +static int atmel_flexcom_resume(struct device *dev) -static int __maybe_unused atmel_flexcom_resume_noirq(struct device *dev) { struct atmel_flexcom *ddata = dev_get_drvdata(dev); int err; @@ -104,16 +105,16 @@ return 0; } +#endif +static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, + atmel_flexcom_resume); -static const struct dev_pm_ops atmel_flexcom_pm_ops = { - .resume_noirq = atmel_flexcom_resume_noirq, -}; static struct platform_driver atmel_flexcom_driver = { .probe = atmel_flexcom_probe, .driver = { .name = "atmel_flexcom", + .pm = &atmel_flexcom_pm_ops, - .pm = pm_ptr(&atmel_flexcom_pm_ops), .of_match_table = atmel_flexcom_of_match, }, }; reverted: --- linux-aws-5.13-5.13.0/drivers/mfd/tps65910.c +++ linux-aws-5.13-5.13.0.orig/drivers/mfd/tps65910.c @@ -436,6 +436,15 @@ tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); + /* + * The PWR_OFF bit needs to be set separately, before transitioning + * to the OFF state. It enables the "sequential" power-off mode on + * TPS65911, it's a NO-OP on TPS65910. + */ + if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, + DEVCTRL_PWR_OFF_MASK) < 0) + return; + regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_OFF_MASK | DEVCTRL_DEV_ON_MASK, DEVCTRL_DEV_OFF_MASK); @@ -495,19 +504,6 @@ tps65910_sleepinit(tps65910, pmic_plat_data); if (pmic_plat_data->pm_off && !pm_power_off) { - /* - * The PWR_OFF bit needs to be set separately, before - * transitioning to the OFF state. It enables the "sequential" - * power-off mode on TPS65911, it's a NO-OP on TPS65910. - */ - ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, - DEVCTRL_PWR_OFF_MASK); - if (ret) { - dev_err(&i2c->dev, "failed to set power-off mode: %d\n", - ret); - return ret; - } - tps65910_i2c_client = i2c; pm_power_off = tps65910_power_off; } reverted: --- linux-aws-5.13-5.13.0/drivers/misc/lattice-ecp3-config.c +++ linux-aws-5.13-5.13.0.orig/drivers/misc/lattice-ecp3-config.c @@ -76,12 +76,12 @@ if (fw == NULL) { dev_err(&spi->dev, "Cannot load firmware, aborting\n"); + return; - goto out; } if (fw->size == 0) { dev_err(&spi->dev, "Error: Firmware size is 0!\n"); + return; - goto out; } /* Fill dummy data (24 stuffing bits for commands) */ @@ -103,7 +103,7 @@ dev_err(&spi->dev, "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", jedec_id); + return; - goto out; } dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); @@ -116,7 +116,7 @@ buffer = kzalloc(fw->size + 8, GFP_KERNEL); if (!buffer) { dev_err(&spi->dev, "Error: Can't allocate memory!\n"); + return; - goto out; } /* @@ -155,7 +155,7 @@ "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", status); kfree(buffer); + return; - goto out; } dev_info(&spi->dev, "Configuring the FPGA...\n"); @@ -181,7 +181,7 @@ release_firmware(fw); kfree(buffer); + -out: complete(&data->fw_loaded); } reverted: --- linux-aws-5.13-5.13.0/drivers/misc/lkdtm/Makefile +++ linux-aws-5.13-5.13.0.orig/drivers/misc/lkdtm/Makefile @@ -20,7 +20,7 @@ OBJCOPYFLAGS := OBJCOPYFLAGS_rodata_objcopy.o := \ + --rename-section .noinstr.text=.rodata,alloc,readonly,load - --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents targets += rodata.o rodata_objcopy.o $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE $(call if_changed,objcopy) diff -u linux-aws-5.13-5.13.0/drivers/misc/mei/hbm.c linux-aws-5.13-5.13.0/drivers/misc/mei/hbm.c --- linux-aws-5.13-5.13.0/drivers/misc/mei/hbm.c +++ linux-aws-5.13-5.13.0/drivers/misc/mei/hbm.c @@ -672,14 +672,10 @@ if (!cl) return; - if (res->status) { - dev_err(dev->dev, "cl dma map failed %d\n", res->status); - cl->status = -EFAULT; - } else { - dev_dbg(dev->dev, "cl dma map succeeded\n"); + dev_dbg(dev->dev, "cl dma map result = %d\n", res->status); + cl->status = res->status; + if (!cl->status) cl->dma_mapped = 1; - cl->status = 0; - } wake_up(&cl->wait); } @@ -702,14 +698,10 @@ if (!cl) return; - if (res->status) { - dev_err(dev->dev, "cl dma unmap failed %d\n", res->status); - cl->status = -EFAULT; - } else { - dev_dbg(dev->dev, "cl dma unmap succeeded\n"); + dev_dbg(dev->dev, "cl dma unmap result = %d\n", res->status); + cl->status = res->status; + if (!cl->status) cl->dma_mapped = 0; - cl->status = 0; - } wake_up(&cl->wait); } reverted: --- linux-aws-5.13-5.13.0/drivers/mmc/core/sdio.c +++ linux-aws-5.13-5.13.0.orig/drivers/mmc/core/sdio.c @@ -708,8 +708,6 @@ if (host->ops->init_card) host->ops->init_card(host, card); - card->ocr = ocr_card; - /* * If the host and card support UHS-I mode request the card * to switch to 1.8V signaling level. No 1.8v signalling if @@ -822,7 +820,7 @@ goto mismatch; } } + card->ocr = ocr_card; - mmc_fixup_device(card, sdio_fixup_methods); if (card->type == MMC_TYPE_SD_COMBO) { diff -u linux-aws-5.13-5.13.0/drivers/mmc/host/meson-mx-sdhc-mmc.c linux-aws-5.13-5.13.0/drivers/mmc/host/meson-mx-sdhc-mmc.c --- linux-aws-5.13-5.13.0/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ linux-aws-5.13-5.13.0/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -854,11 +854,6 @@ goto err_disable_pclk; irq = platform_get_irq(pdev, 0); - if (irq < 0) { - ret = irq; - goto err_disable_pclk; - } - ret = devm_request_threaded_irq(dev, irq, meson_mx_sdhc_irq, meson_mx_sdhc_irq_thread, IRQF_ONESHOT, NULL, host); reverted: --- linux-aws-5.13-5.13.0/drivers/mmc/host/meson-mx-sdio.c +++ linux-aws-5.13-5.13.0.orig/drivers/mmc/host/meson-mx-sdio.c @@ -662,11 +662,6 @@ } irq = platform_get_irq(pdev, 0); - if (irq < 0) { - ret = irq; - goto error_free_mmc; - } - ret = devm_request_threaded_irq(host->controller_dev, irq, meson_mx_mmc_irq, meson_mx_mmc_irq_thread, IRQF_ONESHOT, diff -u linux-aws-5.13-5.13.0/drivers/mmc/host/mtk-sd.c linux-aws-5.13-5.13.0/drivers/mmc/host/mtk-sd.c --- linux-aws-5.13-5.13.0/drivers/mmc/host/mtk-sd.c +++ linux-aws-5.13-5.13.0/drivers/mmc/host/mtk-sd.c @@ -628,11 +628,12 @@ u32 val; sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_RST); - readl_poll_timeout(host->base + MSDC_CFG, val, !(val & MSDC_CFG_RST), 0, 0); + while (readl(host->base + MSDC_CFG) & MSDC_CFG_RST) + cpu_relax(); sdr_set_bits(host->base + MSDC_FIFOCS, MSDC_FIFOCS_CLR); - readl_poll_timeout(host->base + MSDC_FIFOCS, val, - !(val & MSDC_FIFOCS_CLR), 0, 0); + while (readl(host->base + MSDC_FIFOCS) & MSDC_FIFOCS_CLR) + cpu_relax(); val = readl(host->base + MSDC_INT); writel(val, host->base + MSDC_INT); @@ -809,9 +810,8 @@ clk_disable_unprepare(host->h_clk); } -static int msdc_ungate_clock(struct msdc_host *host) +static void msdc_ungate_clock(struct msdc_host *host) { - u32 val; int ret; clk_prepare_enable(host->h_clk); @@ -821,11 +821,11 @@ ret = clk_bulk_prepare_enable(MSDC_NR_CLOCKS, host->bulk_clks); if (ret) { dev_err(host->dev, "Cannot enable pclk/axi/ahb clock gates\n"); - return ret; + return; } - return readl_poll_timeout(host->base + MSDC_CFG, val, - (val & MSDC_CFG_CKSTB), 1, 20000); + while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) + cpu_relax(); } static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) @@ -836,7 +836,6 @@ u32 div; u32 sclk; u32 tune_reg = host->dev_comp->pad_tune_reg; - u32 val; if (!hz) { dev_dbg(host->dev, "set mclk to 0\n"); @@ -917,7 +916,8 @@ else clk_prepare_enable(clk_get_parent(host->src_clk)); - readl_poll_timeout(host->base + MSDC_CFG, val, (val & MSDC_CFG_CKSTB), 0, 0); + while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) + cpu_relax(); sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN); mmc->actual_clock = sclk; host->mclk = hz; @@ -1227,13 +1227,13 @@ static inline bool msdc_cmd_is_ready(struct msdc_host *host, struct mmc_request *mrq, struct mmc_command *cmd) { - u32 val; - int ret; - /* The max busy time we can endure is 20ms */ - ret = readl_poll_timeout_atomic(host->base + SDC_STS, val, - !(val & SDC_STS_CMDBUSY), 1, 20000); - if (ret) { + unsigned long tmo = jiffies + msecs_to_jiffies(20); + + while ((readl(host->base + SDC_STS) & SDC_STS_CMDBUSY) && + time_before(jiffies, tmo)) + cpu_relax(); + if (readl(host->base + SDC_STS) & SDC_STS_CMDBUSY) { dev_err(host->dev, "CMD bus busy detected\n"); host->error |= REQ_CMD_BUSY; msdc_cmd_done(host, MSDC_INT_CMDTMO, mrq, cmd); @@ -1241,10 +1241,12 @@ } if (mmc_resp_type(cmd) == MMC_RSP_R1B || cmd->data) { + tmo = jiffies + msecs_to_jiffies(20); /* R1B or with data, should check SDCBUSY */ - ret = readl_poll_timeout_atomic(host->base + SDC_STS, val, - !(val & SDC_STS_SDCBUSY), 1, 20000); - if (ret) { + while ((readl(host->base + SDC_STS) & SDC_STS_SDCBUSY) && + time_before(jiffies, tmo)) + cpu_relax(); + if (readl(host->base + SDC_STS) & SDC_STS_SDCBUSY) { dev_err(host->dev, "Controller busy detected\n"); host->error |= REQ_CMD_BUSY; msdc_cmd_done(host, MSDC_INT_CMDTMO, mrq, cmd); @@ -1370,8 +1372,6 @@ (MSDC_INT_XFER_COMPL | MSDC_INT_DATCRCERR | MSDC_INT_DATTMO | MSDC_INT_DMA_BDCSERR | MSDC_INT_DMA_GPDCSERR | MSDC_INT_DMA_PROTECT); - u32 val; - int ret; spin_lock_irqsave(&host->lock, flags); done = !host->data; @@ -1388,14 +1388,8 @@ readl(host->base + MSDC_DMA_CFG)); sdr_set_field(host->base + MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); - - ret = readl_poll_timeout_atomic(host->base + MSDC_DMA_CFG, val, - !(val & MSDC_DMA_CFG_STS), 1, 20000); - if (ret) { - dev_dbg(host->dev, "DMA stop timed out\n"); - return false; - } - + while (readl(host->base + MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) + cpu_relax(); sdr_clr_bits(host->base + MSDC_INTEN, data_ints_mask); dev_dbg(host->dev, "DMA stop\n"); @@ -2609,11 +2603,7 @@ spin_lock_init(&host->lock); platform_set_drvdata(pdev, mmc); - ret = msdc_ungate_clock(host); - if (ret) { - dev_err(&pdev->dev, "Cannot ungate clocks!\n"); - goto release_mem; - } + msdc_ungate_clock(host); msdc_init_hw(host); if (mmc->caps2 & MMC_CAP2_CQE) { @@ -2772,12 +2762,8 @@ { struct mmc_host *mmc = dev_get_drvdata(dev); struct msdc_host *host = mmc_priv(mmc); - int ret; - - ret = msdc_ungate_clock(host); - if (ret) - return ret; + msdc_ungate_clock(host); msdc_restore_reg(host); return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/mmc/host/sdhci-pci-gli.c +++ linux-aws-5.13-5.13.0.orig/drivers/mmc/host/sdhci-pci-gli.c @@ -12,7 +12,6 @@ #include #include #include -#include #include "sdhci.h" #include "sdhci-pci.h" #include "cqhci.h" @@ -117,8 +116,6 @@ #define PCI_GLI_9755_PECONF 0x44 #define PCI_GLI_9755_LFCLK GENMASK(14, 12) #define PCI_GLI_9755_DMACLK BIT(29) -#define PCI_GLI_9755_INVERT_CD BIT(30) -#define PCI_GLI_9755_INVERT_WP BIT(31) #define PCI_GLI_9755_CFG2 0x48 #define PCI_GLI_9755_CFG2_L1DLY GENMASK(28, 24) @@ -573,14 +570,6 @@ gl9755_wt_on(pdev); pci_read_config_dword(pdev, PCI_GLI_9755_PECONF, &value); - /* - * Apple ARM64 platforms using these chips may have - * inverted CD/WP detection. - */ - if (of_property_read_bool(pdev->dev.of_node, "cd-inverted")) - value |= PCI_GLI_9755_INVERT_CD; - if (of_property_read_bool(pdev->dev.of_node, "wp-inverted")) - value |= PCI_GLI_9755_INVERT_WP; value &= ~PCI_GLI_9755_LFCLK; value &= ~PCI_GLI_9755_DMACLK; pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value); diff -u linux-aws-5.13-5.13.0/drivers/mmc/host/tmio_mmc_core.c linux-aws-5.13-5.13.0/drivers/mmc/host/tmio_mmc_core.c --- linux-aws-5.13-5.13.0/drivers/mmc/host/tmio_mmc_core.c +++ linux-aws-5.13-5.13.0/drivers/mmc/host/tmio_mmc_core.c @@ -960,8 +960,14 @@ case MMC_POWER_OFF: tmio_mmc_power_off(host); /* For R-Car Gen2+, we need to reset SDHI specific SCC */ - if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) - tmio_mmc_reset(host); + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) { + host->reset(host); + + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | + TMIO_STAT_CARD_INSERT); + } host->set_clock(host, 0); break; @@ -1169,7 +1175,6 @@ if (mmc_can_gpio_cd(mmc)) _host->ops.get_cd = mmc_gpio_get_cd; - /* must be set before tmio_mmc_reset() */ _host->native_hotplug = !(mmc_can_gpio_cd(mmc) || mmc->caps & MMC_CAP_NEEDS_POLL || !mmc_card_is_removable(mmc)); @@ -1290,6 +1295,10 @@ if (host->clk_cache) host->set_clock(host, host->clk_cache); + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + tmio_mmc_enable_dma(host, true); return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/hyperbus/rpc-if.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/hyperbus/rpc-if.c @@ -124,9 +124,7 @@ if (!hyperbus) return -ENOMEM; + rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent); - error = rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent); - if (error) - return error; platform_set_drvdata(pdev, hyperbus); @@ -152,9 +150,9 @@ { struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); int error = hyperbus_unregister_device(&hyperbus->hbdev); + struct rpcif *rpc = dev_get_drvdata(pdev->dev.parent); + rpcif_disable_rpm(rpc); - rpcif_disable_rpm(&hyperbus->rpc); - return error; } reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/mtdpart.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/mtdpart.c @@ -313,7 +313,7 @@ if (err) return err; + list_del(&child->part.node); - list_del(&mtd->part.node); free_partition(mtd); return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/nand/bbt.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/nand/bbt.c @@ -123,7 +123,7 @@ unsigned int rbits = bits_per_block + offs - BITS_PER_LONG; pos[1] &= ~GENMASK(rbits - 1, 0); + pos[1] |= val >> rbits; - pos[1] |= val >> (bits_per_block - rbits); } return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/davinci_nand.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/nand/raw/davinci_nand.c @@ -371,6 +371,77 @@ return corrected; } +/** + * nand_read_page_hwecc_oob_first - hw ecc, read oob first + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip->oob_poi + * @page: page number to read + * + * Hardware ECC for large page chips, require OOB to be read first. For this + * ECC mode, the write_page method is re-used from ECC_HW. These methods + * read/write ECC from the OOB area, unlike the ECC_HW_SYNDROME support with + * multiple ECC steps, follows the "infix ECC" scheme and reads/writes ECC from + * the data area, by overwriting the NAND manufacturer bad block markings. + */ +static int nand_davinci_read_page_hwecc_oob_first(struct nand_chip *chip, + uint8_t *buf, + int oob_required, int page) +{ + struct mtd_info *mtd = nand_to_mtd(chip); + int i, eccsize = chip->ecc.size, ret; + int eccbytes = chip->ecc.bytes; + int eccsteps = chip->ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_code = chip->ecc.code_buf; + uint8_t *ecc_calc = chip->ecc.calc_buf; + unsigned int max_bitflips = 0; + + /* Read the OOB area first */ + ret = nand_read_oob_op(chip, page, 0, chip->oob_poi, mtd->oobsize); + if (ret) + return ret; + + ret = nand_read_page_op(chip, page, 0, NULL, 0); + if (ret) + return ret; + + ret = mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0, + chip->ecc.total); + if (ret) + return ret; + + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + int stat; + + chip->ecc.hwctl(chip, NAND_ECC_READ); + + ret = nand_read_data_op(chip, p, eccsize, false, false); + if (ret) + return ret; + + chip->ecc.calculate(chip, p, &ecc_calc[i]); + + stat = chip->ecc.correct(chip, p, &ecc_code[i], NULL); + if (stat == -EBADMSG && + (chip->ecc.options & NAND_ECC_GENERIC_ERASED_CHECK)) { + /* check for empty pages with bitflips */ + stat = nand_check_erased_ecc_chunk(p, eccsize, + &ecc_code[i], + eccbytes, NULL, 0, + chip->ecc.strength); + } + + if (stat < 0) { + mtd->ecc_stats.failed++; + } else { + mtd->ecc_stats.corrected += stat; + max_bitflips = max_t(unsigned int, max_bitflips, stat); + } + } + return max_bitflips; +} + /*----------------------------------------------------------------------*/ /* An ECC layout for using 4-bit ECC with small-page flash, storing @@ -580,7 +651,7 @@ } else if (chunks == 4 || chunks == 8) { mtd_set_ooblayout(mtd, nand_get_large_page_ooblayout()); + chip->ecc.read_page = nand_davinci_read_page_hwecc_oob_first; - chip->ecc.read_page = nand_read_page_hwecc_oob_first; } else { return -EIO; } reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -713,32 +713,14 @@ (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD : 0); } +static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this) -static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this) { struct gpmi_nfc_hardware_timing *hw = &this->hw; struct resources *r = &this->resources; void __iomem *gpmi_regs = r->gpmi_regs; unsigned int dll_wait_time_us; - int ret; - - /* Clock dividers do NOT guarantee a clean clock signal on its output - * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8, - * all clock dividers provide these guarantee. - */ - if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) - clk_disable_unprepare(r->clock[0]); + clk_set_rate(r->clock[0], hw->clk_rate); - ret = clk_set_rate(r->clock[0], hw->clk_rate); - if (ret) { - dev_err(this->dev, "cannot set clock rate to %lu Hz: %d\n", hw->clk_rate, ret); - return ret; - } - - if (GPMI_IS_MX6Q(this) || GPMI_IS_MX6SX(this)) { - ret = clk_prepare_enable(r->clock[0]); - if (ret) - return ret; - } writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0); writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1); @@ -757,8 +739,6 @@ /* Wait for the DLL to settle. */ udelay(dll_wait_time_us); - - return 0; } static int gpmi_setup_interface(struct nand_chip *chip, int chipnr, @@ -1054,6 +1034,15 @@ r->clock[i] = clk; } + if (GPMI_IS_MX6(this)) + /* + * Set the default value for the gpmi clock. + * + * If you want to use the ONFI nand which is in the + * Synchronous Mode, you should change the clock as you need. + */ + clk_set_rate(r->clock[0], 22000000); + return 0; err_clock: @@ -2291,9 +2280,7 @@ */ if (this->hw.must_apply_timings) { this->hw.must_apply_timings = false; + gpmi_nfc_apply_timings(this); - ret = gpmi_nfc_apply_timings(this); - if (ret) - return ret; } dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); reverted: --- linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +++ linux-aws-5.13-5.13.0.orig/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c @@ -32,7 +32,6 @@ unsigned long addr_offset; unsigned long cmd_offset; const struct mtd_ooblayout_ops *oob_layout; - bool oob_first; }; struct ingenic_nand_cs { @@ -241,9 +240,6 @@ if (chip->bbt_options & NAND_BBT_USE_FLASH) chip->bbt_options |= NAND_BBT_NO_OOB; - if (nfc->soc_info->oob_first) - chip->ecc.read_page = nand_read_page_hwecc_oob_first; - /* For legacy reasons we use a different layout on the qi,lb60 board. */ if (of_machine_is_compatible("qi,lb60")) mtd_set_ooblayout(mtd, &qi_lb60_ooblayout_ops); @@ -538,7 +534,6 @@ .data_offset = 0x00000000, .cmd_offset = 0x00008000, .addr_offset = 0x00010000, - .oob_first = true, }; static const struct jz_soc_info jz4725b_soc_info = { diff -u linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/mpc5121_nfc.c linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/mpc5121_nfc.c --- linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/mpc5121_nfc.c +++ linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/mpc5121_nfc.c @@ -291,6 +291,7 @@ /* Control chips select signal on ADS5121 board */ static void ads5121_select_chip(struct nand_chip *nand, int chip) { + struct mtd_info *mtd = nand_to_mtd(nand); struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand); u8 v; diff -u linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/nand_base.c linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/nand_base.c --- linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/nand_base.c +++ linux-aws-5.13-5.13.0/drivers/mtd/nand/raw/nand_base.c @@ -2989,73 +2989,6 @@ } /** - * nand_read_page_hwecc_oob_first - Hardware ECC page read with ECC - * data read from OOB area - * @chip: nand chip info structure - * @buf: buffer to store read data - * @oob_required: caller requires OOB data read to chip->oob_poi - * @page: page number to read - * - * Hardware ECC for large page chips, which requires the ECC data to be - * extracted from the OOB before the actual data is read. - */ -int nand_read_page_hwecc_oob_first(struct nand_chip *chip, uint8_t *buf, - int oob_required, int page) -{ - struct mtd_info *mtd = nand_to_mtd(chip); - int i, eccsize = chip->ecc.size, ret; - int eccbytes = chip->ecc.bytes; - int eccsteps = chip->ecc.steps; - uint8_t *p = buf; - uint8_t *ecc_code = chip->ecc.code_buf; - unsigned int max_bitflips = 0; - - /* Read the OOB area first */ - ret = nand_read_oob_op(chip, page, 0, chip->oob_poi, mtd->oobsize); - if (ret) - return ret; - - /* Move read cursor to start of page */ - ret = nand_change_read_column_op(chip, 0, NULL, 0, false); - if (ret) - return ret; - - ret = mtd_ooblayout_get_eccbytes(mtd, ecc_code, chip->oob_poi, 0, - chip->ecc.total); - if (ret) - return ret; - - for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { - int stat; - - chip->ecc.hwctl(chip, NAND_ECC_READ); - - ret = nand_read_data_op(chip, p, eccsize, false, false); - if (ret) - return ret; - - stat = chip->ecc.correct(chip, p, &ecc_code[i], NULL); - if (stat == -EBADMSG && - (chip->ecc.options & NAND_ECC_GENERIC_ERASED_CHECK)) { - /* check for empty pages with bitflips */ - stat = nand_check_erased_ecc_chunk(p, eccsize, - &ecc_code[i], - eccbytes, NULL, 0, - chip->ecc.strength); - } - - if (stat < 0) { - mtd->ecc_stats.failed++; - } else { - mtd->ecc_stats.corrected += stat; - max_bitflips = max_t(unsigned int, max_bitflips, stat); - } - } - return max_bitflips; -} -EXPORT_SYMBOL_GPL(nand_read_page_hwecc_oob_first); - -/** * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read * @chip: nand chip info structure * @buf: buffer to store read data diff -u linux-aws-5.13-5.13.0/drivers/net/bonding/bond_main.c linux-aws-5.13-5.13.0/drivers/net/bonding/bond_main.c --- linux-aws-5.13-5.13.0/drivers/net/bonding/bond_main.c +++ linux-aws-5.13-5.13.0/drivers/net/bonding/bond_main.c @@ -1077,6 +1077,9 @@ slave = rcu_dereference(bond->curr_active_slave); rcu_read_unlock(); + netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", + slave ? slave->dev->name : "NULL"); + if (!slave || !bond->send_peer_notif || bond->send_peer_notif % max(1, bond->params.peer_notif_delay) != 0 || @@ -1084,9 +1087,6 @@ test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) return false; - netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", - slave ? slave->dev->name : "NULL"); - return true; } @@ -4623,39 +4623,25 @@ struct bonding *bond = netdev_priv(bond_dev); struct slave *slave = NULL; struct list_head *iter; - bool xmit_suc = false; - bool skb_used = false; bond_for_each_slave_rcu(bond, slave, iter) { - struct sk_buff *skb2; - - if (!(bond_slave_is_up(slave) && slave->link == BOND_LINK_UP)) - continue; + if (bond_is_last_slave(bond, slave)) + break; + if (bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) { + struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); - if (bond_is_last_slave(bond, slave)) { - skb2 = skb; - skb_used = true; - } else { - skb2 = skb_clone(skb, GFP_ATOMIC); if (!skb2) { net_err_ratelimited("%s: Error: %s: skb_clone() failed\n", bond_dev->name, __func__); continue; } + bond_dev_queue_xmit(bond, skb2, slave->dev); } - - if (bond_dev_queue_xmit(bond, skb2, slave->dev) == NETDEV_TX_OK) - xmit_suc = true; } + if (slave && bond_slave_is_up(slave) && slave->link == BOND_LINK_UP) + return bond_dev_queue_xmit(bond, skb, slave->dev); - if (!skb_used) - dev_kfree_skb_any(skb); - - if (xmit_suc) - return NETDEV_TX_OK; - - atomic_long_inc(&bond_dev->tx_dropped); - return NET_XMIT_DROP; + return bond_tx_drop(bond_dev, skb); } /*------------------------- Device initialization ---------------------------*/ reverted: --- linux-aws-5.13-5.13.0/drivers/net/can/m_can/tcan4x5x-regmap.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/can/m_can/tcan4x5x-regmap.c @@ -12,7 +12,7 @@ #define TCAN4X5X_SPI_INSTRUCTION_WRITE (0x61 << 24) #define TCAN4X5X_SPI_INSTRUCTION_READ (0x41 << 24) +#define TCAN4X5X_MAX_REGISTER 0x8ffc -#define TCAN4X5X_MAX_REGISTER 0x87fc static int tcan4x5x_regmap_gather_write(void *context, const void *reg, size_t reg_len, reverted: --- linux-aws-5.13-5.13.0/drivers/net/can/softing/softing_cs.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/can/softing/softing_cs.c @@ -293,7 +293,7 @@ return 0; platform_failed: + kfree(dev); - platform_device_put(pdev); mem_failed: pcmcia_bad: pcmcia_failed: reverted: --- linux-aws-5.13-5.13.0/drivers/net/can/softing/softing_fw.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/can/softing/softing_fw.c @@ -565,19 +565,18 @@ if (ret < 0) goto failed; } + /* enable_error_frame */ + /* - - /* enable_error_frame - * * Error reporting is switched off at the moment since * the receiving of them is not yet 100% verified * This should be enabled sooner or later + * + if (error_reporting) { - */ - if (0 && error_reporting) { ret = softing_fct_cmd(card, 51, "enable_error_frame"); if (ret < 0) goto failed; } + */ - /* initialize interface */ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); diff -u linux-aws-5.13-5.13.0/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c linux-aws-5.13-5.13.0/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c --- linux-aws-5.13-5.13.0/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ linux-aws-5.13-5.13.0/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -1336,7 +1336,7 @@ len > tx_ring->obj_num || offset + len > tx_ring->obj_num)) { netdev_err(priv->ndev, - "Trying to read too many TEF objects (max=%d, offset=%d, len=%d).\n", + "Trying to read to many TEF objects (max=%d, offset=%d, len=%d).\n", tx_ring->obj_num, offset, len); return -ERANGE; } @@ -2619,7 +2619,7 @@ if (!mcp251xfd_is_251X(priv) && priv->devtype_data.model != devtype_data->model) { netdev_info(ndev, - "Detected %s, but firmware specifies a %s. Fixing up.\n", + "Detected %s, but firmware specifies a %s. Fixing up.", __mcp251xfd_get_model_str(devtype_data->model), mcp251xfd_get_model_str(priv)); } @@ -2656,7 +2656,7 @@ return 0; netdev_info(priv->ndev, - "RX_INT active after softreset, disabling RX_INT support.\n"); + "RX_INT active after softreset, disabling RX_INT support."); devm_gpiod_put(&priv->spi->dev, priv->rx_int); priv->rx_int = NULL; reverted: --- linux-aws-5.13-5.13.0/drivers/net/can/xilinx_can.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/can/xilinx_can.c @@ -1762,12 +1762,7 @@ spin_lock_init(&priv->tx_lock); /* Get IRQ for the device */ + ndev->irq = platform_get_irq(pdev, 0); - ret = platform_get_irq(pdev, 0); - if (ret < 0) - goto err_free; - - ndev->irq = ret; - ndev->flags |= IFF_ECHO; /* We support local echo */ platform_set_drvdata(pdev, ndev); diff -u linux-aws-5.13-5.13.0/drivers/net/dsa/hirschmann/hellcreek.c linux-aws-5.13-5.13.0/drivers/net/dsa/hirschmann/hellcreek.c --- linux-aws-5.13-5.13.0/drivers/net/dsa/hirschmann/hellcreek.c +++ linux-aws-5.13-5.13.0/drivers/net/dsa/hirschmann/hellcreek.c @@ -710,9 +710,8 @@ u16 meta = 0; dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=%pM, MASK=0x%02x, " - "OBT=%d, PASS_BLOCKED=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac, - entry->portmask, entry->is_obt, entry->pass_blocked, - entry->reprio_en, entry->reprio_tc); + "OBT=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac, entry->portmask, + entry->is_obt, entry->reprio_en, entry->reprio_tc); /* Add mac address */ hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWDH); @@ -723,8 +722,6 @@ meta |= entry->portmask << HR_FDBWRM0_PORTMASK_SHIFT; if (entry->is_obt) meta |= HR_FDBWRM0_OBT; - if (entry->pass_blocked) - meta |= HR_FDBWRM0_PASS_BLOCKED; if (entry->reprio_en) { meta |= HR_FDBWRM0_REPRIO_EN; meta |= entry->reprio_tc << HR_FDBWRM0_REPRIO_TC_SHIFT; @@ -1053,7 +1050,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek) { - static struct hellcreek_fdb_entry l2_ptp = { + static struct hellcreek_fdb_entry ptp = { /* MAC: 01-1B-19-00-00-00 */ .mac = { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 }, .portmask = 0x03, /* Management ports */ @@ -1064,94 +1061,24 @@ .reprio_tc = 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en = 1, }; - static struct hellcreek_fdb_entry udp4_ptp = { - /* MAC: 01-00-5E-00-01-81 */ - .mac = { 0x01, 0x00, 0x5e, 0x00, 0x01, 0x81 }, - .portmask = 0x03, /* Management ports */ - .age = 0, - .is_obt = 0, - .pass_blocked = 0, - .is_static = 1, - .reprio_tc = 6, - .reprio_en = 1, - }; - static struct hellcreek_fdb_entry udp6_ptp = { - /* MAC: 33-33-00-00-01-81 */ - .mac = { 0x33, 0x33, 0x00, 0x00, 0x01, 0x81 }, - .portmask = 0x03, /* Management ports */ - .age = 0, - .is_obt = 0, - .pass_blocked = 0, - .is_static = 1, - .reprio_tc = 6, - .reprio_en = 1, - }; - static struct hellcreek_fdb_entry l2_p2p = { + static struct hellcreek_fdb_entry p2p = { /* MAC: 01-80-C2-00-00-0E */ .mac = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e }, .portmask = 0x03, /* Management ports */ .age = 0, .is_obt = 0, - .pass_blocked = 1, + .pass_blocked = 0, .is_static = 1, .reprio_tc = 6, /* TC: 6 as per IEEE 802.1AS */ .reprio_en = 1, }; - static struct hellcreek_fdb_entry udp4_p2p = { - /* MAC: 01-00-5E-00-00-6B */ - .mac = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x6b }, - .portmask = 0x03, /* Management ports */ - .age = 0, - .is_obt = 0, - .pass_blocked = 1, - .is_static = 1, - .reprio_tc = 6, - .reprio_en = 1, - }; - static struct hellcreek_fdb_entry udp6_p2p = { - /* MAC: 33-33-00-00-00-6B */ - .mac = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x6b }, - .portmask = 0x03, /* Management ports */ - .age = 0, - .is_obt = 0, - .pass_blocked = 1, - .is_static = 1, - .reprio_tc = 6, - .reprio_en = 1, - }; - static struct hellcreek_fdb_entry stp = { - /* MAC: 01-80-C2-00-00-00 */ - .mac = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }, - .portmask = 0x03, /* Management ports */ - .age = 0, - .is_obt = 0, - .pass_blocked = 1, - .is_static = 1, - .reprio_tc = 6, - .reprio_en = 1, - }; int ret; mutex_lock(&hellcreek->reg_lock); - ret = __hellcreek_fdb_add(hellcreek, &l2_ptp); - if (ret) - goto out; - ret = __hellcreek_fdb_add(hellcreek, &udp4_ptp); - if (ret) - goto out; - ret = __hellcreek_fdb_add(hellcreek, &udp6_ptp); - if (ret) - goto out; - ret = __hellcreek_fdb_add(hellcreek, &l2_p2p); - if (ret) - goto out; - ret = __hellcreek_fdb_add(hellcreek, &udp4_p2p); - if (ret) - goto out; - ret = __hellcreek_fdb_add(hellcreek, &udp6_p2p); + ret = __hellcreek_fdb_add(hellcreek, &ptp); if (ret) goto out; - ret = __hellcreek_fdb_add(hellcreek, &stp); + ret = __hellcreek_fdb_add(hellcreek, &p2p); out: mutex_unlock(&hellcreek->reg_lock); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h @@ -1850,14 +1850,6 @@ /* Vxlan/Geneve related information */ u16 udp_tunnel_ports[BNX2X_UDP_PORT_MAX]; - -#define FW_CAP_INVALIDATE_VF_FP_HSI BIT(0) - u32 fw_cap; - - u32 fw_major; - u32 fw_minor; - u32 fw_rev; - u32 fw_eng; }; /* Tx queues may be less or equal to Rx queues */ @@ -2534,6 +2526,5 @@ * Meant for implicit re-load flows. */ int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp); + -int bnx2x_init_firmware(struct bnx2x *bp); -void bnx2x_release_firmware(struct bnx2x *bp); #endif /* bnx2x.h */ diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -2364,8 +2364,10 @@ if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { /* build my FW version dword */ - u32 my_fw = (bp->fw_major) + (bp->fw_minor << 8) + - (bp->fw_rev << 16) + (bp->fw_eng << 24); + u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) + + (BCM_5710_FW_MINOR_VERSION << 8) + + (BCM_5710_FW_REVISION_VERSION << 16) + + (BCM_5710_FW_ENGINEERING_VERSION << 24); /* read loaded FW from chip */ u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h @@ -241,8 +241,6 @@ IRO[221].m2)) #define XSTORM_VF_TO_PF_OFFSET(funcId) \ (IRO[48].base + ((funcId) * IRO[48].m1)) -#define XSTORM_ETH_FUNCTION_INFO_FP_HSI_VALID_E2_OFFSET(fid) \ - (IRO[386].base + ((fid) * IRO[386].m1)) #define COMMON_ASM_INVALID_ASSERT_OPCODE 0x0 /* eth hsi version */ reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h @@ -3024,8 +3024,7 @@ #define BCM_5710_FW_MAJOR_VERSION 7 #define BCM_5710_FW_MINOR_VERSION 13 +#define BCM_5710_FW_REVISION_VERSION 15 -#define BCM_5710_FW_REVISION_VERSION 21 -#define BCM_5710_FW_REVISION_VERSION_V15 15 #define BCM_5710_FW_ENGINEERING_VERSION 0 #define BCM_5710_FW_COMPILE_FLAGS 1 reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -74,19 +74,9 @@ __stringify(BCM_5710_FW_MINOR_VERSION) "." \ __stringify(BCM_5710_FW_REVISION_VERSION) "." \ __stringify(BCM_5710_FW_ENGINEERING_VERSION) - -#define FW_FILE_VERSION_V15 \ - __stringify(BCM_5710_FW_MAJOR_VERSION) "." \ - __stringify(BCM_5710_FW_MINOR_VERSION) "." \ - __stringify(BCM_5710_FW_REVISION_VERSION_V15) "." \ - __stringify(BCM_5710_FW_ENGINEERING_VERSION) - #define FW_FILE_NAME_E1 "bnx2x/bnx2x-e1-" FW_FILE_VERSION ".fw" #define FW_FILE_NAME_E1H "bnx2x/bnx2x-e1h-" FW_FILE_VERSION ".fw" #define FW_FILE_NAME_E2 "bnx2x/bnx2x-e2-" FW_FILE_VERSION ".fw" -#define FW_FILE_NAME_E1_V15 "bnx2x/bnx2x-e1-" FW_FILE_VERSION_V15 ".fw" -#define FW_FILE_NAME_E1H_V15 "bnx2x/bnx2x-e1h-" FW_FILE_VERSION_V15 ".fw" -#define FW_FILE_NAME_E2_V15 "bnx2x/bnx2x-e2-" FW_FILE_VERSION_V15 ".fw" /* Time in jiffies before concluding the transmitter is hung */ #define TX_TIMEOUT (5*HZ) @@ -757,7 +747,9 @@ CHIP_IS_E1(bp) ? "everest1" : CHIP_IS_E1H(bp) ? "everest1h" : CHIP_IS_E2(bp) ? "everest2" : "everest3", + BCM_5710_FW_MAJOR_VERSION, + BCM_5710_FW_MINOR_VERSION, + BCM_5710_FW_REVISION_VERSION); - bp->fw_major, bp->fw_minor, bp->fw_rev); return rc; } @@ -12361,15 +12353,6 @@ bnx2x_read_fwinfo(bp); - if (IS_PF(bp)) { - rc = bnx2x_init_firmware(bp); - - if (rc) { - bnx2x_free_mem_bp(bp); - return rc; - } - } - func = BP_FUNC(bp); /* need to reset chip if undi was active */ @@ -12382,7 +12365,6 @@ rc = bnx2x_prev_unload(bp); if (rc) { - bnx2x_release_firmware(bp); bnx2x_free_mem_bp(bp); return rc; } @@ -13380,11 +13362,16 @@ /* Check FW version */ offset = be32_to_cpu(fw_hdr->fw_version.offset); fw_ver = firmware->data + offset; + if ((fw_ver[0] != BCM_5710_FW_MAJOR_VERSION) || + (fw_ver[1] != BCM_5710_FW_MINOR_VERSION) || + (fw_ver[2] != BCM_5710_FW_REVISION_VERSION) || + (fw_ver[3] != BCM_5710_FW_ENGINEERING_VERSION)) { - if (fw_ver[0] != bp->fw_major || fw_ver[1] != bp->fw_minor || - fw_ver[2] != bp->fw_rev || fw_ver[3] != bp->fw_eng) { BNX2X_ERR("Bad FW version:%d.%d.%d.%d. Should be %d.%d.%d.%d\n", + fw_ver[0], fw_ver[1], fw_ver[2], fw_ver[3], + BCM_5710_FW_MAJOR_VERSION, + BCM_5710_FW_MINOR_VERSION, + BCM_5710_FW_REVISION_VERSION, + BCM_5710_FW_ENGINEERING_VERSION); - fw_ver[0], fw_ver[1], fw_ver[2], fw_ver[3], - bp->fw_major, bp->fw_minor, bp->fw_rev, bp->fw_eng); return -EINVAL; } @@ -13462,51 +13449,34 @@ (u8 *)bp->arr, len); \ } while (0) +static int bnx2x_init_firmware(struct bnx2x *bp) -int bnx2x_init_firmware(struct bnx2x *bp) { + const char *fw_file_name; - const char *fw_file_name, *fw_file_name_v15; struct bnx2x_fw_file_hdr *fw_hdr; int rc; if (bp->firmware) return 0; + if (CHIP_IS_E1(bp)) - if (CHIP_IS_E1(bp)) { fw_file_name = FW_FILE_NAME_E1; + else if (CHIP_IS_E1H(bp)) - fw_file_name_v15 = FW_FILE_NAME_E1_V15; - } else if (CHIP_IS_E1H(bp)) { fw_file_name = FW_FILE_NAME_E1H; + else if (!CHIP_IS_E1x(bp)) - fw_file_name_v15 = FW_FILE_NAME_E1H_V15; - } else if (!CHIP_IS_E1x(bp)) { fw_file_name = FW_FILE_NAME_E2; + else { - fw_file_name_v15 = FW_FILE_NAME_E2_V15; - } else { BNX2X_ERR("Unsupported chip revision\n"); return -EINVAL; } - BNX2X_DEV_INFO("Loading %s\n", fw_file_name); rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev); if (rc) { + BNX2X_ERR("Can't load firmware file %s\n", + fw_file_name); + goto request_firmware_exit; - BNX2X_DEV_INFO("Trying to load older fw %s\n", fw_file_name_v15); - - /* try to load prev version */ - rc = request_firmware(&bp->firmware, fw_file_name_v15, &bp->pdev->dev); - - if (rc) - goto request_firmware_exit; - - bp->fw_rev = BCM_5710_FW_REVISION_VERSION_V15; - } else { - bp->fw_cap |= FW_CAP_INVALIDATE_VF_FP_HSI; - bp->fw_rev = BCM_5710_FW_REVISION_VERSION; } - bp->fw_major = BCM_5710_FW_MAJOR_VERSION; - bp->fw_minor = BCM_5710_FW_MINOR_VERSION; - bp->fw_eng = BCM_5710_FW_ENGINEERING_VERSION; - rc = bnx2x_check_firmware(bp); if (rc) { BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name); @@ -13562,7 +13532,7 @@ return rc; } +static void bnx2x_release_firmware(struct bnx2x *bp) -void bnx2x_release_firmware(struct bnx2x *bp) { kfree(bp->init_ops_offsets); kfree(bp->init_ops); @@ -14079,7 +14049,6 @@ return 0; init_one_freemem: - bnx2x_release_firmware(bp); bnx2x_free_mem_bp(bp); init_one_exit: diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c @@ -758,18 +758,9 @@ void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid) { - u16 abs_fid; - - abs_fid = FW_VF_HANDLE(abs_vfid); - /* set the VF-PF association in the FW */ - storm_memset_vf_to_pf(bp, abs_fid, BP_FUNC(bp)); - storm_memset_func_en(bp, abs_fid, 1); - - /* Invalidate fp_hsi version for vfs */ - if (bp->fw_cap & FW_CAP_INVALIDATE_VF_FP_HSI) - REG_WR8(bp, BAR_XSTRORM_INTMEM + - XSTORM_ETH_FUNCTION_INFO_FP_HSI_VALID_E2_OFFSET(abs_fid), 0); + storm_memset_vf_to_pf(bp, FW_VF_HANDLE(abs_vfid), BP_FUNC(bp)); + storm_memset_func_en(bp, FW_VF_HANDLE(abs_vfid), 1); /* clear vf errors*/ bnx2x_vf_semi_clear_err(bp, abs_vfid); diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -3729,7 +3729,7 @@ record->low_version = 0; record->high_version = 1; record->asic_state = 0; - strscpy(record->system_name, utsname()->nodename, + strlcpy(record->system_name, utsname()->nodename, sizeof(record->system_name)); record->year = cpu_to_le16(tm.tm_year + 1900); record->month = cpu_to_le16(tm.tm_mon + 1); @@ -3741,12 +3741,11 @@ strcpy(record->commandline, "ethtool -w"); record->total_segments = cpu_to_le32(total_segs); - if (sscanf(utsname()->release, "%u.%u", &os_ver_major, &os_ver_minor) != 2) - netdev_warn(bp->dev, "Unknown OS release in coredump\n"); + sscanf(utsname()->release, "%u.%u", &os_ver_major, &os_ver_minor); record->os_ver_major = cpu_to_le32(os_ver_major); record->os_ver_minor = cpu_to_le32(os_ver_minor); - strscpy(record->os_name, utsname()->sysname, sizeof(record->os_name)); + strlcpy(record->os_name, utsname()->sysname, 32); time64_to_tm(end, 0, &tm); record->end_year = cpu_to_le16(tm.tm_year + 1900); record->end_month = cpu_to_le16(tm.tm_mon + 1); @@ -3764,7 +3763,7 @@ record->ioctl_high_version = 0; } -static int __bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len) +static int bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len) { u32 ver_get_resp_len = sizeof(struct hwrm_ver_get_output); u32 offset = 0, seg_hdr_len, seg_record_len, buf_len = 0; @@ -3867,30 +3866,6 @@ return rc; } -static int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len) -{ - if (dump_type == BNXT_DUMP_CRASH) { -#ifdef CONFIG_TEE_BNXT_FW - return tee_bnxt_copy_coredump(buf, 0, *dump_len); -#else - return -EOPNOTSUPP; -#endif - } else { - return __bnxt_get_coredump(bp, buf, dump_len); - } -} - -static u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type) -{ - u32 len = 0; - - if (dump_type == BNXT_DUMP_CRASH) - len = BNXT_CRASH_DUMP_LEN; - else - __bnxt_get_coredump(bp, NULL, &len); - return len; -} - static int bnxt_set_dump(struct net_device *dev, struct ethtool_dump *dump) { struct bnxt *bp = netdev_priv(dev); @@ -3922,7 +3897,10 @@ bp->ver_resp.hwrm_fw_rsvd_8b; dump->flag = bp->dump_flag; - dump->len = bnxt_get_coredump_length(bp, bp->dump_flag); + if (bp->dump_flag == BNXT_DUMP_CRASH) + dump->len = BNXT_CRASH_DUMP_LEN; + else + bnxt_get_coredump(bp, NULL, &dump->len); return 0; } @@ -3937,7 +3915,15 @@ memset(buf, 0, dump->len); dump->flag = bp->dump_flag; - return bnxt_get_coredump(bp, dump->flag, buf, &dump->len); + if (dump->flag == BNXT_DUMP_CRASH) { +#ifdef CONFIG_TEE_BNXT_FW + return tee_bnxt_copy_coredump(buf, 0, dump->len); +#endif + } else { + return bnxt_get_coredump(bp, buf, &dump->len); + } + + return 0; } void bnxt_ethtool_init(struct bnxt *bp) diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3962,12 +3962,10 @@ /* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; - if (priv->wol_irq > 0) { - err = devm_request_irq(&pdev->dev, priv->wol_irq, - bcmgenet_wol_isr, 0, dev->name, priv); - if (!err) - device_set_wakeup_capable(&pdev->dev, 1); - } + err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, + dev->name, priv); + if (!err) + device_set_wakeup_capable(&pdev->dev, 1); /* Set the needed headroom to account for any possible * features enabling/disabling at runtime reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c @@ -32,7 +32,6 @@ #include #include -#include #include #include @@ -100,7 +99,7 @@ rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, peer_port, local_port, IPPROTO_TCP, + tos, 0); - tos & ~INET_ECN_MASK, 0); if (IS_ERR(rt)) return NULL; n = dst_neigh_lookup(&rt->dst, &peer_ip); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/cortina/gemini.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/cortina/gemini.c @@ -305,21 +305,21 @@ switch (phydev->speed) { case 1000: status.bits.speed = GMAC_SPEED_1000; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) - if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii = GMAC_PHY_RGMII_1000; netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n", phydev_name(phydev)); break; case 100: status.bits.speed = GMAC_SPEED_100; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) - if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n", phydev_name(phydev)); break; case 10: status.bits.speed = GMAC_SPEED_10; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) - if (phy_interface_mode_is_rgmii(phydev->interface)) status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n", phydev_name(phydev)); @@ -389,9 +389,6 @@ status.bits.mii_rmii = GMAC_PHY_GMII; break; case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_RGMII_ID: - case PHY_INTERFACE_MODE_RGMII_TXID: - case PHY_INTERFACE_MODE_RGMII_RXID: netdev_dbg(netdev, "RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n"); status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/freescale/fman/mac.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/freescale/fman/mac.c @@ -94,17 +94,14 @@ __func__, ex); } +static void set_fman_mac_params(struct mac_device *mac_dev, + struct fman_mac_params *params) -static int set_fman_mac_params(struct mac_device *mac_dev, - struct fman_mac_params *params) { struct mac_priv_s *priv = mac_dev->priv; params->base_addr = (typeof(params->base_addr)) devm_ioremap(priv->dev, mac_dev->res->start, resource_size(mac_dev->res)); - if (!params->base_addr) - return -ENOMEM; - memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr)); params->max_speed = priv->max_speed; params->phy_if = mac_dev->phy_if; @@ -115,8 +112,6 @@ params->event_cb = mac_exception; params->dev_id = mac_dev; params->internal_phy_node = priv->internal_phy_node; - - return 0; } static int tgec_initialization(struct mac_device *mac_dev) @@ -128,9 +123,7 @@ priv = mac_dev->priv; + set_fman_mac_params(mac_dev, ¶ms); - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; mac_dev->fman_mac = tgec_config(¶ms); if (!mac_dev->fman_mac) { @@ -176,9 +169,7 @@ priv = mac_dev->priv; + set_fman_mac_params(mac_dev, ¶ms); - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; mac_dev->fman_mac = dtsec_config(¶ms); if (!mac_dev->fman_mac) { @@ -227,9 +218,7 @@ priv = mac_dev->priv; + set_fman_mac_params(mac_dev, ¶ms); - err = set_fman_mac_params(mac_dev, ¶ms); - if (err) - goto _return; if (priv->max_speed == SPEED_10000) params.phy_if = PHY_INTERFACE_MODE_XGMII; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/freescale/xgmac_mdio.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -49,7 +49,6 @@ struct mdio_fsl_priv { struct tgec_mdio_controller __iomem *mdio_base; bool is_little_endian; - bool has_a009885; bool has_a011043; }; @@ -185,10 +184,10 @@ { struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; struct tgec_mdio_controller __iomem *regs = priv->mdio_base; - unsigned long flags; uint16_t dev_addr; uint32_t mdio_stat; uint32_t mdio_ctl; + uint16_t value; int ret; bool endian = priv->is_little_endian; @@ -220,18 +219,12 @@ return ret; } - if (priv->has_a009885) - /* Once the operation completes, i.e. MDIO_STAT_BSY clears, we - * must read back the data register within 16 MDC cycles. - */ - local_irq_save(flags); - /* Initiate the read */ xgmac_write32(mdio_ctl | MDIO_CTL_READ, ®s->mdio_ctl, endian); ret = xgmac_wait_until_done(&bus->dev, regs, endian); if (ret) + return ret; - goto irq_restore; /* Return all Fs if nothing was there */ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) && @@ -239,17 +232,13 @@ dev_dbg(&bus->dev, "Error while reading PHY%d reg at %d.%hhu\n", phy_id, dev_addr, regnum); + return 0xffff; - ret = 0xffff; - } else { - ret = xgmac_read32(®s->mdio_data, endian) & 0xffff; - dev_dbg(&bus->dev, "read %04x\n", ret); } + value = xgmac_read32(®s->mdio_data, endian) & 0xffff; + dev_dbg(&bus->dev, "read %04x\n", value); -irq_restore: - if (priv->has_a009885) - local_irq_restore(flags); + return value; - return ret; } static int xgmac_mdio_probe(struct platform_device *pdev) @@ -293,8 +282,6 @@ priv->is_little_endian = device_property_read_bool(&pdev->dev, "little-endian"); - priv->has_a009885 = device_property_read_bool(&pdev->dev, - "fsl,erratum-a009885"); priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); @@ -320,10 +307,9 @@ static int xgmac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); - struct mdio_fsl_priv *priv = bus->priv; mdiobus_unregister(bus); + iounmap(bus->priv); - iounmap(priv->mdio_base); mdiobus_free(bus); return 0; diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c linux-aws-5.13-5.13.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2473,7 +2473,8 @@ break; } - hclgevf_enable_vector(&hdev->misc_vector, true); + if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) + hclgevf_enable_vector(&hdev->misc_vector, true); return IRQ_HANDLED; } reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/i825xx/sni_82596.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/i825xx/sni_82596.c @@ -117,10 +117,9 @@ netdevice->dev_addr[5] = readb(eth_addr + 0x06); iounmap(eth_addr); + if (!netdevice->irq) { - if (netdevice->irq < 0) { printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", __FILE__, netdevice->base_addr); - retval = netdevice->irq; goto probe_failed; } diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/ibm/ibmvnic.c linux-aws-5.13-5.13.0/drivers/net/ethernet/ibm/ibmvnic.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/ibm/ibmvnic.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/ibm/ibmvnic.c @@ -2328,7 +2328,6 @@ bool saved_state = false; unsigned long flags; u32 reset_state; - int num_fails = 0; int rc = 0; adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset); @@ -2376,23 +2375,11 @@ rc = do_hard_reset(adapter, rwi, reset_state); rtnl_unlock(); } - if (rc) - num_fails++; - else - num_fails = 0; - - /* If auto-priority-failover is enabled we can get - * back to back failovers during resets, resulting - * in at least two failed resets (from high-priority - * backing device to low-priority one and then back) - * If resets continue to fail beyond that, give the - * adapter some time to settle down before retrying. - */ - if (num_fails >= 3) { + if (rc) { + /* give backing device time to settle down */ netdev_dbg(adapter->netdev, - "[S:%s] Hard reset failed %d times, waiting 60 secs\n", - adapter_state_to_string(adapter->state), - num_fails); + "[S:%s] Hard reset failed, waiting 60 secs\n", + adapter_state_to_string(adapter->state)); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(60 * HZ); } @@ -3559,25 +3546,11 @@ struct device *dev = &adapter->vdev->dev; union ibmvnic_crq crq; int max_entries; - int cap_reqs; - - /* We send out 6 or 7 REQUEST_CAPABILITY CRQs below (depending on - * the PROMISC flag). Initialize this count upfront. When the tasklet - * receives a response to all of these, it will send the next protocol - * message (QUERY_IP_OFFLOAD). - */ - if (!(adapter->netdev->flags & IFF_PROMISC) || - adapter->promisc_supported) - cap_reqs = 7; - else - cap_reqs = 6; if (!retry) { /* Sub-CRQ entries are 32 byte long */ int entries_page = 4 * PAGE_SIZE / (sizeof(u64) * 4); - atomic_set(&adapter->running_cap_crqs, cap_reqs); - if (adapter->min_tx_entries_per_subcrq > entries_page || adapter->min_rx_add_entries_per_subcrq > entries_page) { dev_err(dev, "Fatal, invalid entries per sub-crq\n"); @@ -3638,45 +3611,44 @@ adapter->opt_rx_comp_queues; adapter->req_rx_add_queues = adapter->max_rx_add_queues; - } else { - atomic_add(cap_reqs, &adapter->running_cap_crqs); } + memset(&crq, 0, sizeof(crq)); crq.request_capability.first = IBMVNIC_CRQ_CMD; crq.request_capability.cmd = REQUEST_CAPABILITY; crq.request_capability.capability = cpu_to_be16(REQ_TX_QUEUES); crq.request_capability.number = cpu_to_be64(adapter->req_tx_queues); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); crq.request_capability.capability = cpu_to_be16(REQ_RX_QUEUES); crq.request_capability.number = cpu_to_be64(adapter->req_rx_queues); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); crq.request_capability.capability = cpu_to_be16(REQ_RX_ADD_QUEUES); crq.request_capability.number = cpu_to_be64(adapter->req_rx_add_queues); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); crq.request_capability.capability = cpu_to_be16(REQ_TX_ENTRIES_PER_SUBCRQ); crq.request_capability.number = cpu_to_be64(adapter->req_tx_entries_per_subcrq); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); crq.request_capability.capability = cpu_to_be16(REQ_RX_ADD_ENTRIES_PER_SUBCRQ); crq.request_capability.number = cpu_to_be64(adapter->req_rx_add_entries_per_subcrq); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); crq.request_capability.capability = cpu_to_be16(REQ_MTU); crq.request_capability.number = cpu_to_be64(adapter->req_mtu); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); if (adapter->netdev->flags & IFF_PROMISC) { @@ -3684,21 +3656,16 @@ crq.request_capability.capability = cpu_to_be16(PROMISC_REQUESTED); crq.request_capability.number = cpu_to_be64(1); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); } } else { crq.request_capability.capability = cpu_to_be16(PROMISC_REQUESTED); crq.request_capability.number = cpu_to_be64(0); - cap_reqs--; + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); } - - /* Keep at end to catch any discrepancy between expected and actual - * CRQs sent. - */ - WARN_ON(cap_reqs != 0); } static int pending_scrq(struct ibmvnic_adapter *adapter, @@ -4104,132 +4071,118 @@ static void send_query_cap(struct ibmvnic_adapter *adapter) { union ibmvnic_crq crq; - int cap_reqs; - - /* We send out 25 QUERY_CAPABILITY CRQs below. Initialize this count - * upfront. When the tasklet receives a response to all of these, it - * can send out the next protocol messaage (REQUEST_CAPABILITY). - */ - cap_reqs = 25; - - atomic_set(&adapter->running_cap_crqs, cap_reqs); + atomic_set(&adapter->running_cap_crqs, 0); memset(&crq, 0, sizeof(crq)); crq.query_capability.first = IBMVNIC_CRQ_CMD; crq.query_capability.cmd = QUERY_CAPABILITY; crq.query_capability.capability = cpu_to_be16(MIN_TX_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MIN_RX_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MIN_RX_ADD_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_TX_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_RX_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_RX_ADD_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MIN_TX_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MIN_RX_ADD_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_TX_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_RX_ADD_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(TCP_IP_OFFLOAD); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(PROMISC_SUPPORTED); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MIN_MTU); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_MTU); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_MULTICAST_FILTERS); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(VLAN_HEADER_INSERTION); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(RX_VLAN_HEADER_INSERTION); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(MAX_TX_SG_ENTRIES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(RX_SG_SUPPORTED); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(OPT_TX_COMP_SUB_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(OPT_RX_COMP_QUEUES); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(OPT_RX_BUFADD_Q_PER_RX_COMP_Q); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(OPT_TX_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(OPT_RXBA_ENTRIES_PER_SUBCRQ); + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; crq.query_capability.capability = cpu_to_be16(TX_RX_DESC_REQ); - + atomic_inc(&adapter->running_cap_crqs); ibmvnic_send_crq(adapter, &crq); - cap_reqs--; - - /* Keep at end to catch any discrepancy between expected and actual - * CRQs sent. - */ - WARN_ON(cap_reqs != 0); } static void send_query_ip_offload(struct ibmvnic_adapter *adapter) @@ -4534,8 +4487,6 @@ char *name; atomic_dec(&adapter->running_cap_crqs); - netdev_dbg(adapter->netdev, "Outstanding request-caps: %d\n", - atomic_read(&adapter->running_cap_crqs)); switch (be16_to_cpu(crq->request_capability_rsp.capability)) { case REQ_TX_QUEUES: req_value = &adapter->req_tx_queues; @@ -5206,6 +5157,12 @@ ibmvnic_handle_crq(crq, adapter); crq->generic.first = 0; } + + /* remain in tasklet until all + * capabilities responses are received + */ + if (!adapter->wait_capability) + done = true; } /* if capabilities CRQ's were sent in this tasklet, the following * tasklet must wait until all responses are received diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e.h linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e.h --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e.h +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e.h @@ -174,6 +174,7 @@ struct i40e_lump_tracking { u16 num_entries; + u16 search_hint; u16 list[0]; #define I40E_PILE_VALID_BIT 0x8000 #define I40E_IWARP_IRQ_PILE_ID (I40E_PILE_VALID_BIT - 2) @@ -770,12 +771,12 @@ struct rtnl_link_stats64 net_stats_offsets; struct i40e_eth_stats eth_stats; struct i40e_eth_stats eth_stats_offsets; - u64 tx_restart; - u64 tx_busy; + u32 tx_restart; + u32 tx_busy; u64 tx_linearize; u64 tx_force_wb; - u64 rx_buf_failed; - u64 rx_page_failed; + u32 rx_buf_failed; + u32 rx_page_failed; /* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings; diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_debugfs.c linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_debugfs.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_debugfs.c @@ -240,7 +240,7 @@ (unsigned long int)vsi->net_stats_offsets.rx_compressed, (unsigned long int)vsi->net_stats_offsets.tx_compressed); dev_info(&pf->pdev->dev, - " tx_restart = %llu, tx_busy = %llu, rx_buf_failed = %llu, rx_page_failed = %llu\n", + " tx_restart = %d, tx_busy = %d, rx_buf_failed = %d, rx_page_failed = %d\n", vsi->tx_restart, vsi->tx_busy, vsi->rx_buf_failed, vsi->rx_page_failed); rcu_read_lock(); diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_main.c linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_main.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_main.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -196,6 +196,10 @@ * @id: an owner id to stick on the items assigned * * Returns the base item index of the lump, or negative for error + * + * The search_hint trick and lack of advanced fit-finding only work + * because we're highly likely to have all the same size lump requests. + * Linear search time and any fragmentation should be minimal. **/ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, u16 needed, u16 id) @@ -210,21 +214,8 @@ return -EINVAL; } - /* Allocate last queue in the pile for FDIR VSI queue - * so it doesn't fragment the qp_pile - */ - if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { - if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) { - dev_err(&pf->pdev->dev, - "Cannot allocate queue %d for I40E_VSI_FDIR\n", - pile->num_entries - 1); - return -ENOMEM; - } - pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT; - return pile->num_entries - 1; - } - - i = 0; + /* start the linear search with an imperfect hint */ + i = pile->search_hint; while (i < pile->num_entries) { /* skip already allocated entries */ if (pile->list[i] & I40E_PILE_VALID_BIT) { @@ -243,6 +234,7 @@ for (j = 0; j < needed; j++) pile->list[i+j] = id | I40E_PILE_VALID_BIT; ret = i; + pile->search_hint = i + j; break; } @@ -265,7 +257,7 @@ { int valid_id = (id | I40E_PILE_VALID_BIT); int count = 0; - u16 i; + int i; if (!pile || index >= pile->num_entries) return -EINVAL; @@ -277,6 +269,8 @@ count++; } + if (count && index < pile->search_hint) + pile->search_hint = index; return count; } @@ -778,9 +772,9 @@ struct rtnl_link_stats64 *ns; /* netdev stats */ struct i40e_eth_stats *oes; struct i40e_eth_stats *es; /* device's eth stats */ - u64 tx_restart, tx_busy; + u32 tx_restart, tx_busy; struct i40e_ring *p; - u64 rx_page, rx_buf; + u32 rx_page, rx_buf; u64 bytes, packets; unsigned int start; u64 tx_linearize; @@ -10577,9 +10571,15 @@ } i40e_get_oem_version(&pf->hw); - if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { - /* The following delay is necessary for firmware update. */ - mdelay(1000); + if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && + ((hw->aq.fw_maj_ver == 4 && hw->aq.fw_min_ver <= 33) || + hw->aq.fw_maj_ver < 4) && hw->mac.type == I40E_MAC_XL710) { + /* The following delay is necessary for 4.33 firmware and older + * to recover after EMP reset. 200 ms should suffice but we + * put here 300 ms to be sure that FW is ready to operate + * after reset. + */ + mdelay(300); } /* re-verify the eeprom if we just had an EMP reset */ @@ -11789,6 +11789,7 @@ return -ENOMEM; pf->irq_pile->num_entries = vectors; + pf->irq_pile->search_hint = 0; /* track first vector for misc interrupts, ignore return */ (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); @@ -12591,6 +12592,7 @@ goto sw_init_done; } pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; + pf->qp_pile->search_hint = 0; pf->tx_timeout_recovery_level = 1; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_register.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/intel/i40e/i40e_register.h @@ -404,9 +404,6 @@ #define I40E_VFINT_DYN_CTLN(_INTVF) (0x00024800 + ((_INTVF) * 4)) /* _i=0...511 */ /* Reset: VFR */ #define I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT 1 #define I40E_VFINT_DYN_CTLN_CLEARPBA_MASK I40E_MASK(0x1, I40E_VFINT_DYN_CTLN_CLEARPBA_SHIFT) -#define I40E_VFINT_ICR0_ADMINQ_SHIFT 30 -#define I40E_VFINT_ICR0_ADMINQ_MASK I40E_MASK(0x1, I40E_VFINT_ICR0_ADMINQ_SHIFT) -#define I40E_VFINT_ICR0_ENA(_VF) (0x0002C000 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */ #define I40E_VPINT_AEQCTL(_VF) (0x0002B800 + ((_VF) * 4)) /* _i=0...127 */ /* Reset: CORER */ #define I40E_VPINT_AEQCTL_MSIX_INDX_SHIFT 0 #define I40E_VPINT_AEQCTL_ITR_INDX_SHIFT 11 diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1377,32 +1377,6 @@ } /** - * i40e_sync_vfr_reset - * @hw: pointer to hw struct - * @vf_id: VF identifier - * - * Before trigger hardware reset, we need to know if no other process has - * reserved the hardware for any reset operations. This check is done by - * examining the status of the RSTAT1 register used to signal the reset. - **/ -static int i40e_sync_vfr_reset(struct i40e_hw *hw, int vf_id) -{ - u32 reg; - int i; - - for (i = 0; i < I40E_VFR_WAIT_COUNT; i++) { - reg = rd32(hw, I40E_VFINT_ICR0_ENA(vf_id)) & - I40E_VFINT_ICR0_ADMINQ_MASK; - if (reg) - return 0; - - usleep_range(100, 200); - } - - return -EAGAIN; -} - -/** * i40e_trigger_vf_reset * @vf: pointer to the VF structure * @flr: VFLR was issued or not @@ -1416,11 +1390,9 @@ struct i40e_pf *pf = vf->pf; struct i40e_hw *hw = &pf->hw; u32 reg, reg_idx, bit_idx; - bool vf_active; - u32 radq; /* warn the VF */ - vf_active = test_and_clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states); + clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states); /* Disable VF's configuration API during reset. The flag is re-enabled * in i40e_alloc_vf_res(), when it's safe again to access VF's VSI. @@ -1434,19 +1406,7 @@ * just need to clean up, so don't hit the VFRTRIG register. */ if (!flr) { - /* Sync VFR reset before trigger next one */ - radq = rd32(hw, I40E_VFINT_ICR0_ENA(vf->vf_id)) & - I40E_VFINT_ICR0_ADMINQ_MASK; - if (vf_active && !radq) - /* waiting for finish reset by virtual driver */ - if (i40e_sync_vfr_reset(hw, vf->vf_id)) - dev_info(&pf->pdev->dev, - "Reset VF %d never finished\n", - vf->vf_id); - - /* Reset VF using VPGEN_VFRTRIG reg. It is also setting - * in progress state in rstat1 register. - */ + /* reset VF using VPGEN_VFRTRIG reg */ reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); reg |= I40E_VPGEN_VFRTRIG_VFSWR_MASK; wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); @@ -2658,59 +2618,6 @@ } /** - * i40e_check_enough_queue - find big enough queue number - * @vf: pointer to the VF info - * @needed: the number of items needed - * - * Returns the base item index of the queue, or negative for error - **/ -static int i40e_check_enough_queue(struct i40e_vf *vf, u16 needed) -{ - unsigned int i, cur_queues, more, pool_size; - struct i40e_lump_tracking *pile; - struct i40e_pf *pf = vf->pf; - struct i40e_vsi *vsi; - - vsi = pf->vsi[vf->lan_vsi_idx]; - cur_queues = vsi->alloc_queue_pairs; - - /* if current allocated queues are enough for need */ - if (cur_queues >= needed) - return vsi->base_queue; - - pile = pf->qp_pile; - if (cur_queues > 0) { - /* if the allocated queues are not zero - * just check if there are enough queues for more - * behind the allocated queues. - */ - more = needed - cur_queues; - for (i = vsi->base_queue + cur_queues; - i < pile->num_entries; i++) { - if (pile->list[i] & I40E_PILE_VALID_BIT) - break; - - if (more-- == 1) - /* there is enough */ - return vsi->base_queue; - } - } - - pool_size = 0; - for (i = 0; i < pile->num_entries; i++) { - if (pile->list[i] & I40E_PILE_VALID_BIT) { - pool_size = 0; - continue; - } - if (needed <= ++pool_size) - /* there is enough */ - return i; - } - - return -ENOMEM; -} - -/** * i40e_vc_request_queues_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer @@ -2744,12 +2651,6 @@ req_pairs - cur_pairs, pf->queues_left); vfres->num_queue_pairs = pf->queues_left + cur_pairs; - } else if (i40e_check_enough_queue(vf, req_pairs) < 0) { - dev_warn(&pf->pdev->dev, - "VF %d requested %d more queues, but there is not enough for it.\n", - vf->vf_id, - req_pairs - cur_pairs); - vfres->num_queue_pairs = cur_pairs; } else { /* successful request */ vf->num_req_queues = req_pairs; diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h --- linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h @@ -19,7 +19,6 @@ #define I40E_MAX_VF_PROMISC_FLAGS 3 #define I40E_VF_STATE_WAIT_COUNT 20 -#define I40E_VFR_WAIT_COUNT 100 /* Various queue ctrls */ enum i40e_queue_ctrl { reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/marvell/octeontx2/af/rpm.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/marvell/octeontx2/af/rpm.c @@ -251,19 +251,22 @@ if (!rpm || lmac_id >= rpm->lmac_count) return -ENODEV; lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); + if (lmac_type == LMAC_MODE_100G_R) { + cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); + if (enable) + cfg |= RPMX_MTI_PCS_LBK; + else + cfg &= ~RPMX_MTI_PCS_LBK; + rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); + } else { + cfg = rpm_read(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1); + if (enable) + cfg |= RPMX_MTI_PCS_LBK; + else + cfg &= ~RPMX_MTI_PCS_LBK; + rpm_write(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1, cfg); - if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) { - dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); - return 0; } - cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); - - if (enable) - cfg |= RPMX_MTI_PCS_LBK; - else - cfg &= ~RPMX_MTI_PCS_LBK; - rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); - return 0; } diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c linux-aws-5.13-5.13.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -387,12 +387,7 @@ dst_mdev->msg_size = mbox_hdr->msg_size; dst_mdev->num_msgs = num_msgs; err = otx2_sync_mbox_msg(dst_mbox); - /* Error code -EIO indicate there is a communication failure - * to the AF. Rest of the error codes indicate that AF processed - * VF messages and set the error codes in response messages - * (if any) so simply forward responses to VF. - */ - if (err == -EIO) { + if (err) { dev_warn(pf->dev, "AF not responding to VF%d messages\n", vf); /* restore PF mbase and exit */ reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -91,53 +91,46 @@ } dev_err(eth->dev, "mdio: MDIO timeout\n"); + return -1; - return -ETIMEDOUT; } +static u32 _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, + u32 phy_register, u32 write_data) -static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg, - u32 write_data) { + if (mtk_mdio_busy_wait(eth)) + return -1; + + write_data &= 0xffff; - int ret; + mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_WRITE | + (phy_register << PHY_IAC_REG_SHIFT) | + (phy_addr << PHY_IAC_ADDR_SHIFT) | write_data, - ret = mtk_mdio_busy_wait(eth); - if (ret < 0) - return ret; - - mtk_w32(eth, PHY_IAC_ACCESS | - PHY_IAC_START_C22 | - PHY_IAC_CMD_WRITE | - PHY_IAC_REG(phy_reg) | - PHY_IAC_ADDR(phy_addr) | - PHY_IAC_DATA(write_data), MTK_PHY_IAC); + if (mtk_mdio_busy_wait(eth)) + return -1; - ret = mtk_mdio_busy_wait(eth); - if (ret < 0) - return ret; return 0; } +static u32 _mtk_mdio_read(struct mtk_eth *eth, int phy_addr, int phy_reg) -static int _mtk_mdio_read(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg) { + u32 d; + + if (mtk_mdio_busy_wait(eth)) + return 0xffff; - int ret; + mtk_w32(eth, PHY_IAC_ACCESS | PHY_IAC_START | PHY_IAC_READ | + (phy_reg << PHY_IAC_REG_SHIFT) | + (phy_addr << PHY_IAC_ADDR_SHIFT), - ret = mtk_mdio_busy_wait(eth); - if (ret < 0) - return ret; - - mtk_w32(eth, PHY_IAC_ACCESS | - PHY_IAC_START_C22 | - PHY_IAC_CMD_C22_READ | - PHY_IAC_REG(phy_reg) | - PHY_IAC_ADDR(phy_addr), MTK_PHY_IAC); + if (mtk_mdio_busy_wait(eth)) + return 0xffff; + + d = mtk_r32(eth, MTK_PHY_IAC) & 0xffff; - ret = mtk_mdio_busy_wait(eth); - if (ret < 0) - return ret; + return d; - return mtk_r32(eth, MTK_PHY_IAC) & PHY_IAC_DATA_MASK; } static int mtk_mdio_write(struct mii_bus *bus, int phy_addr, @@ -224,7 +217,7 @@ phylink_config); struct mtk_eth *eth = mac->hw; u32 mcr_cur, mcr_new, sid, i; + int val, ge_mode, err; - int val, ge_mode, err = 0; /* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) && reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -341,17 +341,11 @@ /* PHY Indirect Access Control registers */ #define MTK_PHY_IAC 0x10004 #define PHY_IAC_ACCESS BIT(31) +#define PHY_IAC_READ BIT(19) +#define PHY_IAC_WRITE BIT(18) +#define PHY_IAC_START BIT(16) +#define PHY_IAC_ADDR_SHIFT 20 +#define PHY_IAC_REG_SHIFT 25 -#define PHY_IAC_REG_MASK GENMASK(29, 25) -#define PHY_IAC_REG(x) FIELD_PREP(PHY_IAC_REG_MASK, (x)) -#define PHY_IAC_ADDR_MASK GENMASK(24, 20) -#define PHY_IAC_ADDR(x) FIELD_PREP(PHY_IAC_ADDR_MASK, (x)) -#define PHY_IAC_CMD_MASK GENMASK(19, 18) -#define PHY_IAC_CMD_WRITE FIELD_PREP(PHY_IAC_CMD_MASK, 1) -#define PHY_IAC_CMD_C22_READ FIELD_PREP(PHY_IAC_CMD_MASK, 2) -#define PHY_IAC_START_MASK GENMASK(17, 16) -#define PHY_IAC_START_C22 FIELD_PREP(PHY_IAC_START_MASK, 1) -#define PHY_IAC_DATA_MASK GENMASK(15, 0) -#define PHY_IAC_DATA(x) FIELD_PREP(PHY_IAC_DATA_MASK, (x)) #define PHY_IAC_TIMEOUT HZ #define MTK_MAC_MISC 0x1000c diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/cmd.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/cmd.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -147,12 +147,8 @@ if (!refcount_dec_and_test(&ent->refcnt)) return; - if (ent->idx >= 0) { - struct mlx5_cmd *cmd = ent->cmd; - - cmd_free_index(cmd, ent->idx); - up(ent->page_queue ? &cmd->pages_sem : &cmd->sem); - } + if (ent->idx >= 0) + cmd_free_index(ent->cmd, ent->idx); cmd_free_ent(ent); } @@ -899,6 +895,25 @@ return cmd->allowed_opcode == opcode; } +static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) +{ + unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); + int idx; + +retry: + idx = cmd_alloc_index(cmd); + if (idx < 0 && time_before(jiffies, alloc_end)) { + /* Index allocation can fail on heavy load of commands. This is a temporary + * situation as the current command already holds the semaphore, meaning that + * another command completion is being handled and it is expected to release + * the entry index soon. + */ + cpu_relax(); + goto retry; + } + return idx; +} + bool mlx5_cmd_is_down(struct mlx5_core_dev *dev) { return pci_channel_offline(dev->pdev) || @@ -923,7 +938,7 @@ sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); if (!ent->page_queue) { - alloc_ret = cmd_alloc_index(cmd); + alloc_ret = cmd_alloc_index_retry(cmd); if (alloc_ret < 0) { mlx5_core_err_rl(dev, "failed to allocate command entry\n"); if (ent->callback) { @@ -1579,6 +1594,8 @@ vector = vec & 0xffffffff; for (i = 0; i < (1 << cmd->log_sz); i++) { if (test_bit(i, &vector)) { + struct semaphore *sem; + ent = cmd->ent_arr[i]; /* if we already completed the command, ignore it */ @@ -1601,6 +1618,10 @@ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) cmd_ent_put(ent); + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); dump_command(dev, ent, 0); @@ -1654,6 +1675,7 @@ */ complete(&ent->done); } + up(sem); } } } diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* Copyright (c) 2018 Mellanox Technologies. */ -#include #include #include #include @@ -227,7 +226,7 @@ int err; /* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK; + attr.fl.fl4.flowi4_tos = tun_key->tos; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl; @@ -338,7 +337,7 @@ int err; /* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK; + attr.fl.fl4.flowi4_tos = tun_key->tos; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl; diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c @@ -1537,8 +1537,6 @@ struct net_device *fib_dev; fen_info = container_of(info, struct fib_entry_notifier_info, info); - if (fen_info->fi->nh) - return NULL; fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev; if (!fib_dev || fib_dev->netdev_ops != &mlx5e_netdev_ops || fen_info->dst_len != 32) reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c @@ -11,13 +11,13 @@ { struct device *dev = mlx5_core_dma_dev(priv->mdev); + return xsk_pool_dma_map(pool, dev, 0); - return xsk_pool_dma_map(pool, dev, DMA_ATTR_SKIP_CPU_SYNC); } static void mlx5e_xsk_unmap_pool(struct mlx5e_priv *priv, struct xsk_buff_pool *pool) { + return xsk_pool_dma_unmap(pool, 0); - return xsk_pool_dma_unmap(pool, DMA_ATTR_SKIP_CPU_SYNC); } static int mlx5e_xsk_get_pools(struct mlx5e_xsk *xsk) diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_main.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_main.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4899,22 +4899,15 @@ } if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; } if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { - netdev->hw_features |= NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM; - netdev->hw_enc_features |= NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM; - netdev->gso_partial_features |= NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM; + netdev->hw_features |= NETIF_F_GSO_GRE; + netdev->hw_enc_features |= NETIF_F_GSO_GRE; + netdev->gso_partial_features |= NETIF_F_GSO_GRE; } if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -48,7 +48,6 @@ #include "en/devlink.h" #include "fs_core.h" #include "lib/mlx5.h" -#include "lib/vxlan.h" #define CREATE_TRACE_POINTS #include "diag/en_rep_tracepoint.h" @@ -986,7 +985,6 @@ rtnl_lock(); if (netif_running(netdev)) mlx5e_open(netdev); - udp_tunnel_nic_reset_ntf(priv->netdev); netif_device_attach(netdev); rtnl_unlock(); } @@ -1007,7 +1005,6 @@ mlx5_notifier_unregister(mdev, &priv->events_nb); mlx5e_rep_tc_disable(priv); mlx5_lag_remove(mdev); - mlx5_vxlan_reset_to_default(mdev->vxlan); } static MLX5E_DEFINE_STATS_GRP(sw_rep, 0); diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -271,8 +271,8 @@ if (unlikely(!dma_info->page)) return -ENOMEM; - dma_info->addr = dma_map_page_attrs(rq->pdev, dma_info->page, 0, PAGE_SIZE, - rq->buff.map_dir, DMA_ATTR_SKIP_CPU_SYNC); + dma_info->addr = dma_map_page(rq->pdev, dma_info->page, 0, + PAGE_SIZE, rq->buff.map_dir); if (unlikely(dma_mapping_error(rq->pdev, dma_info->addr))) { page_pool_recycle_direct(rq->page_pool, dma_info->page); dma_info->page = NULL; @@ -293,8 +293,7 @@ void mlx5e_page_dma_unmap(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_info) { - dma_unmap_page_attrs(rq->pdev, dma_info->addr, PAGE_SIZE, rq->buff.map_dir, - DMA_ATTR_SKIP_CPU_SYNC); + dma_unmap_page(rq->pdev, dma_info->addr, PAGE_SIZE, rq->buff.map_dir); } void mlx5e_page_release_dynamic(struct mlx5e_rq *rq, diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -1871,111 +1871,6 @@ return ip_version; } -/* Tunnel device follows RFC 6040, see include/net/inet_ecn.h. - * And changes inner ip_ecn depending on inner and outer ip_ecn as follows: - * +---------+----------------------------------------+ - * |Arriving | Arriving Outer Header | - * | Inner +---------+---------+---------+----------+ - * | Header | Not-ECT | ECT(0) | ECT(1) | CE | - * +---------+---------+---------+---------+----------+ - * | Not-ECT | Not-ECT | Not-ECT | Not-ECT | | - * | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* | - * | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* | - * | CE | CE | CE | CE | CE | - * +---------+---------+---------+---------+----------+ - * - * Tc matches on inner after decapsulation on tunnel device, but hw offload matches - * the inner ip_ecn value before hardware decap action. - * - * Cells marked are changed from original inner packet ip_ecn value during decap, and - * so matching those values on inner ip_ecn before decap will fail. - * - * The following helper allows offload when inner ip_ecn won't be changed by outer ip_ecn, - * except for the outer ip_ecn = CE, where in all cases inner ip_ecn will be changed to CE, - * and such we can drop the inner ip_ecn=CE match. - */ - -static int mlx5e_tc_verify_tunnel_ecn(struct mlx5e_priv *priv, - struct flow_cls_offload *f, - bool *match_inner_ecn) -{ - u8 outer_ecn_mask = 0, outer_ecn_key = 0, inner_ecn_mask = 0, inner_ecn_key = 0; - struct flow_rule *rule = flow_cls_offload_flow_rule(f); - struct netlink_ext_ack *extack = f->common.extack; - struct flow_match_ip match; - - *match_inner_ecn = true; - - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IP)) { - flow_rule_match_enc_ip(rule, &match); - outer_ecn_key = match.key->tos & INET_ECN_MASK; - outer_ecn_mask = match.mask->tos & INET_ECN_MASK; - } - - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IP)) { - flow_rule_match_ip(rule, &match); - inner_ecn_key = match.key->tos & INET_ECN_MASK; - inner_ecn_mask = match.mask->tos & INET_ECN_MASK; - } - - if (outer_ecn_mask != 0 && outer_ecn_mask != INET_ECN_MASK) { - NL_SET_ERR_MSG_MOD(extack, "Partial match on enc_tos ecn bits isn't supported"); - netdev_warn(priv->netdev, "Partial match on enc_tos ecn bits isn't supported"); - return -EOPNOTSUPP; - } - - if (!outer_ecn_mask) { - if (!inner_ecn_mask) - return 0; - - NL_SET_ERR_MSG_MOD(extack, - "Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported"); - netdev_warn(priv->netdev, - "Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported"); - return -EOPNOTSUPP; - } - - if (inner_ecn_mask && inner_ecn_mask != INET_ECN_MASK) { - NL_SET_ERR_MSG_MOD(extack, - "Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported"); - netdev_warn(priv->netdev, - "Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported"); - return -EOPNOTSUPP; - } - - if (!inner_ecn_mask) - return 0; - - /* Both inner and outer have full mask on ecn */ - - if (outer_ecn_key == INET_ECN_ECT_1) { - /* inner ecn might change by DECAP action */ - - NL_SET_ERR_MSG_MOD(extack, "Match on enc_tos ecn = ECT(1) isn't supported"); - netdev_warn(priv->netdev, "Match on enc_tos ecn = ECT(1) isn't supported"); - return -EOPNOTSUPP; - } - - if (outer_ecn_key != INET_ECN_CE) - return 0; - - if (inner_ecn_key != INET_ECN_CE) { - /* Can't happen in software, as packet ecn will be changed to CE after decap */ - NL_SET_ERR_MSG_MOD(extack, - "Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported"); - netdev_warn(priv->netdev, - "Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported"); - return -EOPNOTSUPP; - } - - /* outer ecn = CE, inner ecn = CE, as decap will change inner ecn to CE in anycase, - * drop match on inner ecn - */ - *match_inner_ecn = false; - - return 0; -} - static int parse_tunnel_attr(struct mlx5e_priv *priv, struct mlx5e_tc_flow *flow, struct mlx5_flow_spec *spec, @@ -2169,7 +2064,6 @@ struct flow_rule *rule = flow_cls_offload_flow_rule(f); struct flow_dissector *dissector = rule->match.dissector; enum fs_flow_table_type fs_type; - bool match_inner_ecn = true; u16 addr_type = 0; u8 ip_proto = 0; u8 *match_level; @@ -2223,10 +2117,6 @@ headers_c = get_match_inner_headers_criteria(spec); headers_v = get_match_inner_headers_value(spec); } - - err = mlx5e_tc_verify_tunnel_ecn(priv, f, &match_inner_ecn); - if (err) - return err; } err = mlx5e_flower_parse_meta(filter_dev, f); @@ -2448,12 +2338,10 @@ struct flow_match_ip match; flow_rule_match_ip(rule, &match); - if (match_inner_ecn) { - MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, - match.mask->tos & 0x3); - MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, - match.key->tos & 0x3); - } + MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, + match.mask->tos & 0x3); + MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, + match.key->tos & 0x3); MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_dscp, match.mask->tos >> 2); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c @@ -265,8 +265,10 @@ fen_info = container_of(info, struct fib_entry_notifier_info, info); fi = fen_info->fi; + if (fi->nh) { + NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); + return notifier_from_errno(-EINVAL); + } - if (fi->nh) - return NOTIFY_DONE; fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev; if (fib_dev != ldev->pf[MLX5_LAG_P1].netdev && fib_dev != ldev->pf[MLX5_LAG_P2].netdev) { diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/main.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -96,8 +96,6 @@ MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS = 0x1, }; -#define LOG_MAX_SUPPORTED_QPS 0xff - static struct mlx5_profile profile[] = { [0] = { .mask = 0, @@ -109,7 +107,7 @@ [2] = { .mask = MLX5_PROF_MASK_QP_SIZE | MLX5_PROF_MASK_MR_CACHE, - .log_max_qp = LOG_MAX_SUPPORTED_QPS, + .log_max_qp = 18, .mr_cache[0] = { .size = 500, .limit = 250 @@ -526,9 +524,7 @@ to_fw_pkey_sz(dev, 128)); /* Check log_max_qp from HCA caps to set in current profile */ - if (prof->log_max_qp == LOG_MAX_SUPPORTED_QPS) { - prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); - } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { + if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", prof->log_max_qp, MLX5_CAP_GEN_MAX(dev, log_max_qp)); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c @@ -28,7 +28,10 @@ { struct mlx5_sf_dev_table *table = dev->priv.sf_dev_table; + if (!mlx5_sf_dev_supported(dev)) + return false; + + return !xa_empty(&table->devices); - return table && !xa_empty(&table->devices); } static ssize_t sfnum_show(struct device *dev, struct device_attribute *attr, char *buf) reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlxsw/cmd.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mellanox/mlxsw/cmd.h @@ -935,18 +935,6 @@ */ MLXSW_ITEM32(cmd_mbox, sw2hw_dq, cq, 0x00, 24, 8); -enum mlxsw_cmd_mbox_sw2hw_dq_sdq_lp { - MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE, - MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE, -}; - -/* cmd_mbox_sw2hw_dq_sdq_lp - * SDQ local Processing - * 0: local processing by wqe.lp - * 1: local processing (ignoring wqe.lp) - */ -MLXSW_ITEM32(cmd_mbox, sw2hw_dq, sdq_lp, 0x00, 23, 1); - /* cmd_mbox_sw2hw_dq_sdq_tclass * SDQ: CPU Egress TClass * RDQ: Reserved diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlxsw/pci.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlxsw/pci.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -285,7 +285,6 @@ struct mlxsw_pci_queue *q) { int tclass; - int lp; int i; int err; @@ -293,12 +292,9 @@ q->consumer_counter = 0; tclass = q->num == MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_PCI_SDQ_EMAD_TC : MLXSW_PCI_SDQ_CTL_TC; - lp = q->num == MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE : - MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE; /* Set CQ of same number of this SDQ. */ mlxsw_cmd_mbox_sw2hw_dq_cq_set(mbox, q->num); - mlxsw_cmd_mbox_sw2hw_dq_sdq_lp_set(mbox, lp); mlxsw_cmd_mbox_sw2hw_dq_sdq_tclass_set(mbox, tclass); mlxsw_cmd_mbox_sw2hw_dq_log2_dq_sz_set(mbox, 3); /* 8 pages */ for (i = 0; i < MLXSW_PCI_AQ_PAGES; i++) { @@ -1687,7 +1683,7 @@ wqe = elem_info->elem; mlxsw_pci_wqe_c_set(wqe, 1); /* always report completion */ - mlxsw_pci_wqe_lp_set(wqe, 0); + mlxsw_pci_wqe_lp_set(wqe, !!tx_info->is_emad); mlxsw_pci_wqe_type_set(wqe, MLXSW_PCI_WQE_TYPE_ETHERNET); err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data, @@ -1982,7 +1978,6 @@ { pci_driver->probe = mlxsw_pci_probe; pci_driver->remove = mlxsw_pci_remove; - pci_driver->shutdown = mlxsw_pci_remove; return pci_register_driver(pci_driver); } EXPORT_SYMBOL(mlxsw_pci_driver_register); diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/mscc/ocelot.c linux-aws-5.13-5.13.0/drivers/net/ethernet/mscc/ocelot.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mscc/ocelot.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/mscc/ocelot.c @@ -1269,7 +1269,8 @@ } EXPORT_SYMBOL(ocelot_get_ts_info); -static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond) +static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond, + bool only_active_ports) { u32 mask = 0; int port; @@ -1280,8 +1281,12 @@ if (!ocelot_port) continue; - if (ocelot_port->bond == bond) + if (ocelot_port->bond == bond) { + if (only_active_ports && !ocelot_port->lag_tx_active) + continue; + mask |= BIT(port); + } } return mask; @@ -1368,8 +1373,10 @@ mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge); mask |= cpu_fwd_mask; mask &= ~BIT(port); - if (bond) - mask &= ~ocelot_get_bond_mask(ocelot, bond); + if (bond) { + mask &= ~ocelot_get_bond_mask(ocelot, bond, + false); + } } else { /* Standalone ports forward only to DSA tag_8021q CPU * ports (if those exist), or to the hardware CPU port @@ -1687,17 +1694,13 @@ if (!bond || (visited & BIT(lag))) continue; - bond_mask = ocelot_get_bond_mask(ocelot, bond); + bond_mask = ocelot_get_bond_mask(ocelot, bond, true); for_each_set_bit(port, &bond_mask, ocelot->num_phys_ports) { - struct ocelot_port *ocelot_port = ocelot->ports[port]; - // Destination mask ocelot_write_rix(ocelot, bond_mask, ANA_PGID_PGID, port); - - if (ocelot_port->lag_tx_active) - aggr_idx[num_active_ports++] = port; + aggr_idx[num_active_ports++] = port; } for_each_aggr_pgid(ocelot, i) { @@ -1746,7 +1749,8 @@ bond = ocelot_port->bond; if (bond) { - int lag = __ffs(ocelot_get_bond_mask(ocelot, bond)); + int lag = __ffs(ocelot_get_bond_mask(ocelot, bond, + false)); ocelot_rmw_gix(ocelot, ANA_PORT_PORT_CFG_PORTID_VAL(lag), reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/mscc/ocelot_flower.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/mscc/ocelot_flower.c @@ -467,6 +467,13 @@ return -EOPNOTSUPP; } + if (filter->block_id == VCAP_IS1 && + !is_zero_ether_addr(match.mask->dst)) { + NL_SET_ERR_MSG_MOD(extack, + "Key type S1_NORMAL cannot match on destination MAC"); + return -EOPNOTSUPP; + } + /* The hw support mac matches only for MAC_ETYPE key, * therefore if other matches(port, tcp flags, etc) are added * then just bail out @@ -481,14 +488,6 @@ return -EOPNOTSUPP; flow_rule_match_eth_addrs(rule, &match); - - if (filter->block_id == VCAP_IS1 && - !is_zero_ether_addr(match.mask->dst)) { - NL_SET_ERR_MSG_MOD(extack, - "Key type S1_NORMAL cannot match on destination MAC"); - return -EOPNOTSUPP; - } - filter->key_type = OCELOT_VCAP_KEY_ETYPE; ether_addr_copy(filter->key.etype.dmac.value, match.key->dst); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/renesas/ravb_main.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/renesas/ravb_main.c @@ -29,7 +29,8 @@ #include #include #include + +#include -#include #include "ravb.h" @@ -1944,7 +1945,8 @@ if (!rate) return -EINVAL; + inc = 1000000000ULL << 20; + do_div(inc, rate); - inc = div64_ul(1000000000ULL << 20, rate); if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) { dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n", reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/rocker/rocker_ofdpa.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/rocker/rocker_ofdpa.c @@ -2772,8 +2772,7 @@ if (!ofdpa_port) continue; nh->fib_nh_flags &= ~RTNH_F_OFFLOAD; + ofdpa_flow_tbl_del(ofdpa_port, OFDPA_OP_FLAG_REMOVE, - ofdpa_flow_tbl_del(ofdpa_port, - OFDPA_OP_FLAG_REMOVE | OFDPA_OP_FLAG_NOWAIT, flow_entry); } spin_unlock_irqrestore(&ofdpa->flow_tbl_lock, flags); reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/ef10.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/sfc/ef10.c @@ -3990,30 +3990,6 @@ } } -static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx) -{ - unsigned int ret = EFX_RECYCLE_RING_SIZE_10G; - - /* There is no difference between PFs and VFs. The side is based on - * the maximum link speed of a given NIC. - */ - switch (efx->pci_dev->device & 0xfff) { - case 0x0903: /* Farmingdale can do up to 10G */ - break; - case 0x0923: /* Greenport can do up to 40G */ - case 0x0a03: /* Medford can do up to 40G */ - ret *= 4; - break; - default: /* Medford2 can do up to 100G */ - ret *= 10; - } - - if (IS_ENABLED(CONFIG_PPC64)) - ret *= 4; - - return ret; -} - #define EF10_OFFLOAD_FEATURES \ (NETIF_F_IP_CSUM | \ NETIF_F_HW_VLAN_CTAG_FILTER | \ @@ -4130,7 +4106,6 @@ .check_caps = ef10_check_caps, .print_additional_fwver = efx_ef10_print_additional_fwver, .sensor_event = efx_mcdi_sensor_event, - .rx_recycle_ring_size = efx_ef10_recycle_ring_size, }; const struct efx_nic_type efx_hunt_a0_nic_type = { @@ -4268,5 +4243,4 @@ .check_caps = ef10_check_caps, .print_additional_fwver = efx_ef10_print_additional_fwver, .sensor_event = efx_mcdi_sensor_event, - .rx_recycle_ring_size = efx_ef10_recycle_ring_size, }; diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/ef100_nic.c linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/ef100_nic.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/ef100_nic.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/ef100_nic.c @@ -23,7 +23,6 @@ #include "ef100_rx.h" #include "ef100_tx.h" #include "ef100_netdev.h" -#include "rx_common.h" #define EF100_MAX_VIS 4096 #define EF100_NUM_MCDI_BUFFERS 1 @@ -697,12 +696,6 @@ } } -static unsigned int efx_ef100_recycle_ring_size(const struct efx_nic *efx) -{ - /* Maximum link speed for Riverhead is 100G */ - return 10 * EFX_RECYCLE_RING_SIZE_10G; -} - /* NIC level access functions */ #define EF100_OFFLOAD_FEATURES (NETIF_F_HW_CSUM | NETIF_F_RXCSUM | \ @@ -777,7 +770,6 @@ .rx_push_rss_context_config = efx_mcdi_rx_push_rss_context_config, .rx_pull_rss_context_config = efx_mcdi_rx_pull_rss_context_config, .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts, - .rx_recycle_ring_size = efx_ef100_recycle_ring_size, .reconfigure_mac = ef100_reconfigure_mac, .reconfigure_port = efx_mcdi_port_reconfigure, @@ -857,7 +849,6 @@ .rx_pull_rss_config = efx_mcdi_rx_pull_rss_config, .rx_push_rss_config = efx_mcdi_pf_rx_push_rss_config, .rx_restore_rss_contexts = efx_mcdi_rx_restore_rss_contexts, - .rx_recycle_ring_size = efx_ef100_recycle_ring_size, .reconfigure_mac = ef100_reconfigure_mac, .test_nvram = efx_new_mcdi_nvram_test_all, reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/net_driver.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/sfc/net_driver.h @@ -1274,7 +1274,6 @@ * @udp_tnl_has_port: Check if a port has been added as UDP tunnel * @print_additional_fwver: Dump NIC-specific additional FW version info * @sensor_event: Handle a sensor event from MCDI - * @rx_recycle_ring_size: Size of the RX recycle ring * @revision: Hardware architecture revision * @txd_ptr_tbl_base: TX descriptor ring base address * @rxd_ptr_tbl_base: RX descriptor ring base address @@ -1453,7 +1452,6 @@ size_t (*print_additional_fwver)(struct efx_nic *efx, char *buf, size_t len); void (*sensor_event)(struct efx_nic *efx, efx_qword_t *ev); - unsigned int (*rx_recycle_ring_size)(const struct efx_nic *efx); int revision; unsigned int txd_ptr_tbl_base; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/nic_common.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/sfc/nic_common.h @@ -195,11 +195,6 @@ efx->type->sensor_event(efx, ev); } -static inline unsigned int efx_rx_recycle_ring_size(const struct efx_nic *efx) -{ - return efx->type->rx_recycle_ring_size(efx); -} - /* Some statistics are computed as A - B where A and B each increase * linearly with some hardware counter(s) and the counters are read * asynchronously. If the counters contributing to B are always read diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/rx_common.c linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/rx_common.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/rx_common.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/rx_common.c @@ -23,6 +23,13 @@ MODULE_PARM_DESC(rx_refill_threshold, "RX descriptor ring refill threshold (%)"); +/* Number of RX buffers to recycle pages for. When creating the RX page recycle + * ring, this number is divided by the number of buffers per page to calculate + * the number of pages to store in the RX page recycle ring. + */ +#define EFX_RECYCLE_RING_SIZE_IOMMU 4096 +#define EFX_RECYCLE_RING_SIZE_NOIOMMU (2 * EFX_RX_PREFERRED_BATCH) + /* RX maximum head room required. * * This must be at least 1 to prevent overflow, plus one packet-worth @@ -134,7 +141,16 @@ unsigned int bufs_in_recycle_ring, page_ring_size; struct efx_nic *efx = rx_queue->efx; - bufs_in_recycle_ring = efx_rx_recycle_ring_size(efx); + /* Set the RX recycle ring size */ +#ifdef CONFIG_PPC64 + bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU; +#else + if (iommu_present(&pci_bus_type)) + bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_IOMMU; + else + bufs_in_recycle_ring = EFX_RECYCLE_RING_SIZE_NOIOMMU; +#endif /* CONFIG_PPC64 */ + page_ring_size = roundup_pow_of_two(bufs_in_recycle_ring / efx->rx_bufs_per_page); rx_queue->page_ring = kcalloc(page_ring_size, reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/rx_common.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/sfc/rx_common.h @@ -18,12 +18,6 @@ #define EFX_RX_MAX_FRAGS DIV_ROUND_UP(EFX_MAX_FRAME_LEN(EFX_MAX_MTU), \ EFX_RX_USR_BUF_SIZE) -/* Number of RX buffers to recycle pages for. When creating the RX page recycle - * ring, this number is divided by the number of buffers per page to calculate - * the number of pages to store in the RX page recycle ring. - */ -#define EFX_RECYCLE_RING_SIZE_10G 256 - static inline u8 *efx_rx_buf_va(struct efx_rx_buffer *buf) { return page_address(buf->page) + buf->page_offset; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/sfc/siena.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/sfc/siena.c @@ -25,7 +25,6 @@ #include "mcdi_port_common.h" #include "selftest.h" #include "siena_sriov.h" -#include "rx_common.h" /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */ @@ -959,12 +958,6 @@ return 0; } -static unsigned int efx_siena_recycle_ring_size(const struct efx_nic *efx) -{ - /* Maximum link speed is 10G */ - return EFX_RECYCLE_RING_SIZE_10G; -} - /************************************************************************** * * Revision-dependent attributes used by efx.c and nic.c @@ -1105,5 +1098,4 @@ .rx_hash_key_size = 16, .check_caps = siena_check_caps, .sensor_event = efx_mcdi_sensor_event, - .rx_recycle_ring_size = efx_siena_recycle_ring_size, }; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -113,10 +113,8 @@ rgmii_writel(ethqos, temp, offset); } +static void rgmii_dump(struct qcom_ethqos *ethqos) -static void rgmii_dump(void *priv) { - struct qcom_ethqos *ethqos = priv; - dev_dbg(ðqos->pdev->dev, "Rgmii register dump\n"); dev_dbg(ðqos->pdev->dev, "RGMII_IO_MACRO_CONFIG: %x\n", rgmii_readl(ethqos, RGMII_IO_MACRO_CONFIG)); @@ -503,7 +501,6 @@ plat_dat->bsp_priv = ethqos; plat_dat->fix_mac_speed = ethqos_fix_mac_speed; - plat_dat->dump_debug_regs = rgmii_dump; plat_dat->has_gmac4 = 1; plat_dat->pmt = 1; plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); @@ -512,6 +509,8 @@ if (ret) goto err_clk; + rgmii_dump(ethqos); + return ret; err_clk: diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -22,21 +22,21 @@ #define ETHER_CLK_SEL_RMII_CLK_EN BIT(2) #define ETHER_CLK_SEL_RMII_CLK_RST BIT(3) #define ETHER_CLK_SEL_DIV_SEL_2 BIT(4) -#define ETHER_CLK_SEL_DIV_SEL_20 0 +#define ETHER_CLK_SEL_DIV_SEL_20 BIT(0) #define ETHER_CLK_SEL_FREQ_SEL_125M (BIT(9) | BIT(8)) #define ETHER_CLK_SEL_FREQ_SEL_50M BIT(9) #define ETHER_CLK_SEL_FREQ_SEL_25M BIT(8) #define ETHER_CLK_SEL_FREQ_SEL_2P5M 0 -#define ETHER_CLK_SEL_TX_CLK_EXT_SEL_IN 0 +#define ETHER_CLK_SEL_TX_CLK_EXT_SEL_IN BIT(0) #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC BIT(10) #define ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV BIT(11) -#define ETHER_CLK_SEL_RX_CLK_EXT_SEL_IN 0 +#define ETHER_CLK_SEL_RX_CLK_EXT_SEL_IN BIT(0) #define ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC BIT(12) #define ETHER_CLK_SEL_RX_CLK_EXT_SEL_DIV BIT(13) -#define ETHER_CLK_SEL_TX_CLK_O_TX_I 0 +#define ETHER_CLK_SEL_TX_CLK_O_TX_I BIT(0) #define ETHER_CLK_SEL_TX_CLK_O_RMII_I BIT(14) #define ETHER_CLK_SEL_TX_O_E_N_IN BIT(15) -#define ETHER_CLK_SEL_RMII_CLK_SEL_IN 0 +#define ETHER_CLK_SEL_RMII_CLK_SEL_IN BIT(0) #define ETHER_CLK_SEL_RMII_CLK_SEL_RX_C BIT(16) #define ETHER_CLK_SEL_RX_TX_CLK_EN (ETHER_CLK_SEL_RX_CLK_EN | ETHER_CLK_SEL_TX_CLK_EN) @@ -96,41 +96,31 @@ val |= ETHER_CLK_SEL_TX_O_E_N_IN; writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - /* Set Clock-Mux, Start clock, Set TX_O direction */ switch (dwmac->phy_intf_sel) { case ETHER_CONFIG_INTF_RGMII: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val |= ETHER_CLK_SEL_RX_TX_CLK_EN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); break; case ETHER_CONFIG_INTF_RMII: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_DIV | - ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | + ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN | ETHER_CLK_SEL_RMII_CLK_SEL_RX_C; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val |= ETHER_CLK_SEL_RMII_CLK_RST; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val |= ETHER_CLK_SEL_RMII_CLK_EN | ETHER_CLK_SEL_RX_TX_CLK_EN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); break; case ETHER_CONFIG_INTF_MII: default: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC | - ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val |= ETHER_CLK_SEL_RX_TX_CLK_EN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | + ETHER_CLK_SEL_RMII_CLK_EN; break; } + /* Start clock */ + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + val |= ETHER_CLK_SEL_RX_TX_CLK_EN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + spin_unlock_irqrestore(&dwmac->lock, flags); } diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -891,9 +891,6 @@ bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; int ret; - if (priv->plat->ptp_clk_freq_config) - priv->plat->ptp_clk_freq_config(priv); - ret = stmmac_init_tstamp_counter(priv, STMMAC_HWTS_ACTIVE); if (ret) return ret; @@ -916,6 +913,8 @@ priv->hwts_tx_en = 0; priv->hwts_rx_en = 0; + stmmac_ptp_register(priv); + return 0; } @@ -3238,7 +3237,7 @@ /** * stmmac_hw_setup - setup mac in a usable state. * @dev : pointer to the device structure. - * @ptp_register: register PTP if set + * @init_ptp: initialize PTP if set * Description: * this is the main function to setup the HW in a usable state because the * dma engine is reset, the core registers are configured (e.g. AXI, @@ -3248,7 +3247,7 @@ * 0 on success and an appropriate (-)ve integer as defined in errno.h * file on failure. */ -static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) +static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) { struct stmmac_priv *priv = netdev_priv(dev); u32 rx_cnt = priv->plat->rx_queues_to_use; @@ -3305,13 +3304,13 @@ stmmac_mmc_setup(priv); - ret = stmmac_init_ptp(priv); - if (ret == -EOPNOTSUPP) - netdev_warn(priv->dev, "PTP not supported by HW\n"); - else if (ret) - netdev_warn(priv->dev, "PTP init failed\n"); - else if (ptp_register) - stmmac_ptp_register(priv); + if (init_ptp) { + ret = stmmac_init_ptp(priv); + if (ret == -EOPNOTSUPP) + netdev_warn(priv->dev, "PTP not supported by HW\n"); + else if (ret) + netdev_warn(priv->dev, "PTP init failed\n"); + } priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; @@ -7066,9 +7065,6 @@ stmmac_init_fs(ndev); #endif - if (priv->plat->dump_debug_regs) - priv->plat->dump_debug_regs(priv->plat->bsp_priv); - /* Let pm_runtime_put() disable the clocks. * If CONFIG_PM is not enabled, the clocks will stay powered. */ reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -258,6 +258,9 @@ { int i; + if (priv->plat->ptp_clk_freq_config) + priv->plat->ptp_clk_freq_config(priv); + for (i = 0; i < priv->dma_cap.pps_out_num; i++) { if (i >= STMMAC_PPS_MAX) break; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/ti/cpsw.c @@ -349,7 +349,7 @@ struct cpsw_common *cpsw = ndev_to_cpsw(xmeta->ndev); int pkt_size = cpsw->rx_packet_max; int ret = 0, port, ch = xmeta->ch; + int headroom = CPSW_HEADROOM; - int headroom = CPSW_HEADROOM_NA; struct net_device *ndev = xmeta->ndev; struct cpsw_priv *priv; struct page_pool *pool; @@ -392,7 +392,7 @@ } if (priv->xdp_prog) { + int headroom = CPSW_HEADROOM, size = len; - int size = len; xdp_init_buff(&xdp, PAGE_SIZE, &priv->xdp_rxq[ch]); if (status & CPDMA_RX_VLAN_ENCAP) { @@ -442,7 +442,7 @@ xmeta->ndev = ndev; xmeta->ch = ch; + dma = page_pool_get_dma_addr(new_page) + CPSW_HEADROOM; - dma = page_pool_get_dma_addr(new_page) + CPSW_HEADROOM_NA; ret = cpdma_chan_submit_mapped(cpsw->rxv[ch].ch, new_page, dma, pkt_size, 0); if (ret < 0) { diff -u linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw_new.c linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw_new.c --- linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw_new.c +++ linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw_new.c @@ -282,7 +282,7 @@ { struct page *new_page, *page = token; void *pa = page_address(page); - int headroom = CPSW_HEADROOM_NA; + int headroom = CPSW_HEADROOM; struct cpsw_meta_xdp *xmeta; struct cpsw_common *cpsw; struct net_device *ndev; @@ -335,7 +335,7 @@ } if (priv->xdp_prog) { - int size = len; + int headroom = CPSW_HEADROOM, size = len; xdp_init_buff(&xdp, PAGE_SIZE, &priv->xdp_rxq[ch]); if (status & CPDMA_RX_VLAN_ENCAP) { @@ -385,7 +385,7 @@ xmeta->ndev = ndev; xmeta->ch = ch; - dma = page_pool_get_dma_addr(new_page) + CPSW_HEADROOM_NA; + dma = page_pool_get_dma_addr(new_page) + CPSW_HEADROOM; ret = cpdma_chan_submit_mapped(cpsw->rxv[ch].ch, new_page, dma, pkt_size, 0); if (ret < 0) { reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/ti/cpsw_priv.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/ti/cpsw_priv.c @@ -1120,7 +1120,7 @@ xmeta->ndev = priv->ndev; xmeta->ch = ch; + dma = page_pool_get_dma_addr(page) + CPSW_HEADROOM; - dma = page_pool_get_dma_addr(page) + CPSW_HEADROOM_NA; ret = cpdma_chan_idle_submit_mapped(cpsw->rxv[ch].ch, page, dma, cpsw->rx_packet_max, @@ -1144,7 +1144,7 @@ static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw, int size) { + struct page_pool_params pp_params; - struct page_pool_params pp_params = {}; struct page_pool *pool; pp_params.order = 0; reverted: --- linux-aws-5.13-5.13.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -41,9 +41,8 @@ #include "xilinx_axienet.h" /* Descriptors defines for Tx and Rx DMA */ +#define TX_BD_NUM_DEFAULT 64 -#define TX_BD_NUM_DEFAULT 128 #define RX_BD_NUM_DEFAULT 1024 -#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 @@ -497,8 +496,7 @@ static int __axienet_device_reset(struct axienet_local *lp) { + u32 timeout; - u32 value; - int ret; /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending @@ -508,23 +506,15 @@ * they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, XAXIDMA_CR_RESET_MASK); + timeout = DELAY_OF_ONE_MILLISEC; + while (axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET) & + XAXIDMA_CR_RESET_MASK) { + udelay(1); + if (--timeout == 0) { + netdev_err(lp->ndev, "%s: DMA reset timeout!\n", + __func__); + return -ETIMEDOUT; + } - ret = read_poll_timeout(axienet_dma_in32, value, - !(value & XAXIDMA_CR_RESET_MASK), - DELAY_OF_ONE_MILLISEC, 50000, false, lp, - XAXIDMA_TX_CR_OFFSET); - if (ret) { - dev_err(lp->dev, "%s: DMA reset timeout!\n", __func__); - return ret; - } - - /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ - ret = read_poll_timeout(axienet_ior, value, - value & XAE_INT_PHYRSTCMPLT_MASK, - DELAY_OF_ONE_MILLISEC, 50000, false, lp, - XAE_IS_OFFSET); - if (ret) { - dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); - return ret; } return 0; @@ -633,8 +623,6 @@ if (nr_bds == -1 && !(status & XAXIDMA_BD_STS_COMPLETE_MASK)) break; - /* Ensure we see complete descriptor update */ - dma_rmb(); phys = desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, (cur_p->cntrl & XAXIDMA_BD_CTRL_LENGTH_MASK), @@ -643,15 +631,13 @@ if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK)) dev_consume_skb_irq(cur_p->skb); + cur_p->cntrl = 0; cur_p->app0 = 0; cur_p->app1 = 0; cur_p->app2 = 0; cur_p->app4 = 0; + cur_p->status = 0; cur_p->skb = NULL; - /* ensure our transmit path and device don't prematurely see status cleared */ - wmb(); - cur_p->cntrl = 0; - cur_p->status = 0; if (sizep) *sizep += status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; @@ -661,32 +647,6 @@ } /** - * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy - * @lp: Pointer to the axienet_local structure - * @num_frag: The number of BDs to check for - * - * Return: 0, on success - * NETDEV_TX_BUSY, if any of the descriptors are not free - * - * This function is invoked before BDs are allocated and transmission starts. - * This function returns 0 if a BD or group of BDs can be allocated for - * transmission. If the BD or any of the BDs are not free the function - * returns a busy status. This is invoked from axienet_start_xmit. - */ -static inline int axienet_check_tx_bd_space(struct axienet_local *lp, - int num_frag) -{ - struct axidma_bd *cur_p; - - /* Ensure we see all descriptor updates from device or TX IRQ path */ - rmb(); - cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->cntrl) - return NETDEV_TX_BUSY; - return 0; -} - -/** * axienet_start_xmit_done - Invoked once a transmit is completed by the * Axi DMA Tx channel. * @ndev: Pointer to the net_device structure @@ -715,8 +675,30 @@ /* Matches barrier in axienet_start_xmit */ smp_mb(); + netif_wake_queue(ndev); +} + +/** + * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy + * @lp: Pointer to the axienet_local structure + * @num_frag: The number of BDs to check for + * + * Return: 0, on success + * NETDEV_TX_BUSY, if any of the descriptors are not free + * + * This function is invoked before BDs are allocated and transmission starts. + * This function returns 0 if a BD or group of BDs can be allocated for + * transmission. If the BD or any of the BDs are not free the function + * returns a busy status. This is invoked from axienet_start_xmit. + */ +static inline int axienet_check_tx_bd_space(struct axienet_local *lp, + int num_frag) +{ + struct axidma_bd *cur_p; + cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; + if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) + return NETDEV_TX_BUSY; + return 0; - if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) - netif_wake_queue(ndev); } /** @@ -748,15 +730,20 @@ num_frag = skb_shinfo(skb)->nr_frags; cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; + if (axienet_check_tx_bd_space(lp, num_frag)) { + if (netif_queue_stopped(ndev)) + return NETDEV_TX_BUSY; + - if (axienet_check_tx_bd_space(lp, num_frag + 1)) { - /* Should not happen as last start_xmit call should have - * checked for sufficient space and queue should only be - * woken when sufficient space is available. - */ netif_stop_queue(ndev); + + /* Matches barrier in axienet_start_xmit_done */ + smp_mb(); + + /* Space might have just been freed - check again */ + if (axienet_check_tx_bd_space(lp, num_frag)) + return NETDEV_TX_BUSY; + + netif_wake_queue(ndev); - if (net_ratelimit()) - netdev_warn(ndev, "TX ring unexpectedly full\n"); - return NETDEV_TX_BUSY; } if (skb->ip_summed == CHECKSUM_PARTIAL) { @@ -817,18 +804,6 @@ if (++lp->tx_bd_tail >= lp->tx_bd_num) lp->tx_bd_tail = 0; - /* Stop queue if next transmit may not have space */ - if (axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { - netif_stop_queue(ndev); - - /* Matches barrier in axienet_start_xmit_done */ - smp_mb(); - - /* Space might have just been freed - check again */ - if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) - netif_wake_queue(ndev); - } - return NETDEV_TX_OK; } @@ -859,8 +834,6 @@ tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci; - /* Ensure we see complete descriptor update */ - dma_rmb(); phys = desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, lp->max_frm_size, DMA_FROM_DEVICE); @@ -1373,8 +1346,7 @@ if (ering->rx_pending > RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || + ering->rx_pending > TX_BD_NUM_MAX) - ering->tx_pending < TX_BD_NUM_MIN || - ering->tx_pending > TX_BD_NUM_MAX) return -EINVAL; if (netif_running(ndev)) @@ -2102,11 +2074,6 @@ lp->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD; lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; - /* Reset core now that clocks are enabled, prior to accessing MDIO */ - ret = __axienet_device_reset(lp); - if (ret) - goto cleanup_clk; - lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (lp->phy_node) { ret = axienet_mdio_setup(lp); reverted: --- linux-aws-5.13-5.13.0/drivers/net/hamradio/yam.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/hamradio/yam.c @@ -951,7 +951,9 @@ sizeof(struct yamdrv_ioctl_mcs)); if (IS_ERR(ym)) return PTR_ERR(ym); + if (ym->cmd != SIOCYAMSMCS) + return -EINVAL; + if (ym->bitrate > YAM_MAXBITRATE) { - if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) { kfree(ym); return -EINVAL; } diff -u linux-aws-5.13-5.13.0/drivers/net/ipa/ipa_endpoint.c linux-aws-5.13-5.13.0/drivers/net/ipa/ipa_endpoint.c --- linux-aws-5.13-5.13.0/drivers/net/ipa/ipa_endpoint.c +++ linux-aws-5.13-5.13.0/drivers/net/ipa/ipa_endpoint.c @@ -1067,7 +1067,6 @@ { struct gsi *gsi; u32 backlog; - int delta; if (!endpoint->replenish_enabled) { if (add_one) @@ -1085,8 +1084,10 @@ try_again_later: /* The last one didn't succeed, so fix the backlog */ - delta = add_one ? 2 : 1; - backlog = atomic_add_return(delta, &endpoint->replenish_backlog); + backlog = atomic_inc_return(&endpoint->replenish_backlog); + + if (add_one) + atomic_inc(&endpoint->replenish_backlog); /* Whenever a receive buffer transaction completes we'll try to * replenish again. It's unlikely, but if we fail to supply even diff -u linux-aws-5.13-5.13.0/drivers/net/phy/broadcom.c linux-aws-5.13-5.13.0/drivers/net/phy/broadcom.c --- linux-aws-5.13-5.13.0/drivers/net/phy/broadcom.c +++ linux-aws-5.13-5.13.0/drivers/net/phy/broadcom.c @@ -768,7 +768,6 @@ .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM54616S", /* PHY_GBIT_FEATURES */ - .soft_reset = genphy_soft_reset, .config_init = bcm54xx_config_init, .config_aneg = bcm54616s_config_aneg, .config_intr = bcm_phy_config_intr, reverted: --- linux-aws-5.13-5.13.0/drivers/net/phy/marvell.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/phy/marvell.c @@ -179,8 +179,6 @@ #define MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII 0x1 /* SGMII to copper */ #define MII_88E1510_GEN_CTRL_REG_1_RESET 0x8000 /* Soft reset */ -#define MII_88E1510_MSCR_2 0x15 - #define MII_VCT5_TX_RX_MDI0_COUPLING 0x10 #define MII_VCT5_TX_RX_MDI1_COUPLING 0x11 #define MII_VCT5_TX_RX_MDI2_COUPLING 0x12 @@ -1244,12 +1242,6 @@ if (err < 0) return err; - if (phy_interface_is_rgmii(phydev)) { - err = m88e1121_config_aneg_rgmii_delays(phydev); - if (err < 0) - return err; - } - /* Adjust LED Control */ if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) err = phy_write(phydev, 0x10, 0x1100); @@ -1908,58 +1900,6 @@ data[i] = marvell_get_stat(phydev, i); } -static int m88e1510_loopback(struct phy_device *phydev, bool enable) -{ - int err; - - if (enable) { - u16 bmcr_ctl = 0, mscr2_ctl = 0; - - if (phydev->speed == SPEED_1000) - bmcr_ctl = BMCR_SPEED1000; - else if (phydev->speed == SPEED_100) - bmcr_ctl = BMCR_SPEED100; - - if (phydev->duplex == DUPLEX_FULL) - bmcr_ctl |= BMCR_FULLDPLX; - - err = phy_write(phydev, MII_BMCR, bmcr_ctl); - if (err < 0) - return err; - - if (phydev->speed == SPEED_1000) - mscr2_ctl = BMCR_SPEED1000; - else if (phydev->speed == SPEED_100) - mscr2_ctl = BMCR_SPEED100; - - err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, - MII_88E1510_MSCR_2, BMCR_SPEED1000 | - BMCR_SPEED100, mscr2_ctl); - if (err < 0) - return err; - - /* Need soft reset to have speed configuration takes effect */ - err = genphy_soft_reset(phydev); - if (err < 0) - return err; - - /* FIXME: Based on trial and error test, it seem 1G need to have - * delay between soft reset and loopback enablement. - */ - if (phydev->speed == SPEED_1000) - msleep(1000); - - return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, - BMCR_LOOPBACK); - } else { - err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); - if (err < 0) - return err; - - return phy_config_aneg(phydev); - } -} - static int marvell_vct5_wait_complete(struct phy_device *phydev) { int i; @@ -3012,7 +2952,7 @@ .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, + .set_loopback = genphy_loopback, - .set_loopback = m88e1510_loopback, .get_tunable = m88e1011_get_tunable, .set_tunable = m88e1011_set_tunable, .cable_test_start = marvell_vct7_cable_test_start, diff -u linux-aws-5.13-5.13.0/drivers/net/phy/mdio_bus.c linux-aws-5.13-5.13.0/drivers/net/phy/mdio_bus.c --- linux-aws-5.13-5.13.0/drivers/net/phy/mdio_bus.c +++ linux-aws-5.13-5.13.0/drivers/net/phy/mdio_bus.c @@ -591,7 +591,7 @@ mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); bus->state = MDIOBUS_REGISTERED; - dev_dbg(&bus->dev, "probed\n"); + pr_info("%s: probed\n", bus->name); return 0; error: diff -u linux-aws-5.13-5.13.0/drivers/net/phy/micrel.c linux-aws-5.13-5.13.0/drivers/net/phy/micrel.c --- linux-aws-5.13-5.13.0/drivers/net/phy/micrel.c +++ linux-aws-5.13-5.13.0/drivers/net/phy/micrel.c @@ -1203,8 +1203,8 @@ .config_init = kszphy_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ8021, .phy_id_mask = 0x00ffffff, @@ -1218,8 +1218,8 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ8031, .phy_id_mask = 0x00ffffff, @@ -1233,8 +1233,8 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ8041, .phy_id_mask = MICREL_PHY_ID_MASK, @@ -1265,8 +1265,8 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .name = "Micrel KSZ8051", /* PHY_BASIC_FEATURES */ @@ -1279,8 +1279,8 @@ .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, .match_phy_device = ksz8051_match_phy_device, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ8001, .name = "Micrel KSZ8001 or KS8721", @@ -1294,8 +1294,8 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ8081, .name = "Micrel KSZ8081 or KSZ8091", @@ -1320,8 +1320,8 @@ .config_init = ksz8061_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, }, { .phy_id = PHY_ID_KSZ9021, .phy_id_mask = 0x000ffffe, @@ -1336,8 +1336,8 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, - .resume = kszphy_resume, + .suspend = genphy_suspend, + .resume = genphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, }, { @@ -1355,7 +1355,7 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, + .suspend = genphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_LAN8814, @@ -1383,7 +1383,7 @@ .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = kszphy_suspend, + .suspend = genphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8873MLL, reverted: --- linux-aws-5.13-5.13.0/drivers/net/phy/phy-core.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/phy/phy-core.c @@ -161,11 +161,11 @@ PHY_SETTING( 2500, FULL, 2500baseT_Full ), PHY_SETTING( 2500, FULL, 2500baseX_Full ), /* 1G */ + PHY_SETTING( 1000, FULL, 1000baseKX_Full ), PHY_SETTING( 1000, FULL, 1000baseT_Full ), PHY_SETTING( 1000, HALF, 1000baseT_Half ), PHY_SETTING( 1000, FULL, 1000baseT1_Full ), PHY_SETTING( 1000, FULL, 1000baseX_Full ), - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), /* 100M */ PHY_SETTING( 100, FULL, 100baseT_Full ), PHY_SETTING( 100, FULL, 100baseT1_Full ), diff -u linux-aws-5.13-5.13.0/drivers/net/phy/phy_device.c linux-aws-5.13-5.13.0/drivers/net/phy/phy_device.c --- linux-aws-5.13-5.13.0/drivers/net/phy/phy_device.c +++ linux-aws-5.13-5.13.0/drivers/net/phy/phy_device.c @@ -1699,9 +1699,6 @@ phy_driver_is_genphy_10g(phydev)) device_release_driver(&phydev->mdio.dev); - /* Assert the reset signal */ - phy_device_reset(phydev, 1); - /* * The phydev might go away on the put_device() below, so avoid * a use-after-free bug by reading the underlying bus first. @@ -1713,6 +1710,9 @@ ndev_owner = dev->dev.parent->driver->owner; if (ndev_owner != bus->owner) module_put(bus->owner); + + /* Assert the reset signal */ + phy_device_reset(phydev, 1); } EXPORT_SYMBOL(phy_detach); reverted: --- linux-aws-5.13-5.13.0/drivers/net/phy/sfp-bus.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/phy/sfp-bus.c @@ -646,11 +646,6 @@ else if (ret < 0) return ERR_PTR(ret); - if (!fwnode_device_is_available(ref.fwnode)) { - fwnode_handle_put(ref.fwnode); - return NULL; - } - bus = sfp_bus_get(ref.fwnode); fwnode_handle_put(ref.fwnode); if (!bus) diff -u linux-aws-5.13-5.13.0/drivers/net/phy/sfp.c linux-aws-5.13-5.13.0/drivers/net/phy/sfp.c --- linux-aws-5.13-5.13.0/drivers/net/phy/sfp.c +++ linux-aws-5.13-5.13.0/drivers/net/phy/sfp.c @@ -1641,20 +1641,17 @@ static int sfp_module_parse_power(struct sfp *sfp) { u32 power_mW = 1000; - bool supports_a2; if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_POWER_DECL)) power_mW = 1500; if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_HIGH_POWER_LEVEL)) power_mW = 2000; - supports_a2 = sfp->id.ext.sff8472_compliance != - SFP_SFF8472_COMPLIANCE_NONE || - sfp->id.ext.diagmon & SFP_DIAGMON_DDM; - if (power_mW > sfp->max_power_mW) { /* Module power specification exceeds the allowed maximum. */ - if (!supports_a2) { + if (sfp->id.ext.sff8472_compliance == + SFP_SFF8472_COMPLIANCE_NONE && + !(sfp->id.ext.diagmon & SFP_DIAGMON_DDM)) { /* The module appears not to implement bus address * 0xa2, so assume that the module powers up in the * indicated mode. @@ -1671,25 +1668,11 @@ } } - if (power_mW <= 1000) { - /* Modules below 1W do not require a power change sequence */ - sfp->module_power_mW = power_mW; - return 0; - } - - if (!supports_a2) { - /* The module power level is below the host maximum and the - * module appears not to implement bus address 0xa2, so assume - * that the module powers up in the indicated mode. - */ - return 0; - } - /* If the module requires a higher power mode, but also requires * an address change sequence, warn the user that the module may * not be functional. */ - if (sfp->id.ext.diagmon & SFP_DIAGMON_ADDRMODE) { + if (sfp->id.ext.diagmon & SFP_DIAGMON_ADDRMODE && power_mW > 1000) { dev_warn(sfp->dev, "Address Change Sequence not supported but module requires %u.%uW, module may not be functional\n", power_mW / 1000, (power_mW / 100) % 10); diff -u linux-aws-5.13-5.13.0/drivers/net/ppp/ppp_generic.c linux-aws-5.13-5.13.0/drivers/net/ppp/ppp_generic.c --- linux-aws-5.13-5.13.0/drivers/net/ppp/ppp_generic.c +++ linux-aws-5.13-5.13.0/drivers/net/ppp/ppp_generic.c @@ -69,8 +69,6 @@ #define MPHDRLEN 6 /* multilink protocol header length */ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ -#define PPP_PROTO_LEN 2 - /* * An instance of /dev/ppp can be associated with either a ppp * interface unit or a ppp channel. In both cases, file->private_data @@ -499,9 +497,6 @@ if (!pf) return -ENXIO; - /* All PPP packets should start with the 2-byte protocol */ - if (count < PPP_PROTO_LEN) - return -EINVAL; ret = -ENOMEM; skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); if (!skb) @@ -1769,7 +1764,7 @@ } ++ppp->stats64.tx_packets; - ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; + ppp->stats64.tx_bytes += skb->len - 2; switch (proto) { case PPP_IP: reverted: --- linux-aws-5.13-5.13.0/drivers/net/usb/mcs7830.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/usb/mcs7830.c @@ -108,16 +108,8 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) { + return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, + 0x0000, index, data, size); - int ret; - - ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, - 0x0000, index, data, size); - if (ret < 0) - return ret; - else if (ret < size) - return -ENODATA; - - return ret; } static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ar5523/ar5523.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ar5523/ar5523.c @@ -153,10 +153,6 @@ ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); return; } - if (!cmd->odata) { - ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); - return; - } memcpy(cmd->odata, hdr + 1, sizeof(u32)); cmd->olen = sizeof(u32); cmd->res = 0; diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/core.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/core.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/core.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/core.c @@ -89,7 +89,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = true, .dynamic_sar_support = false, }, @@ -125,7 +124,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = true, .dynamic_sar_support = false, }, @@ -162,7 +160,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -193,7 +190,6 @@ .num_wds_entries = 0x20, .uart_pin_workaround = true, .tx_stats_over_pktlog = false, - .credit_size_workaround = false, .bmi_large_size_download = true, .supports_peer_stats_info = true, .dynamic_sar_support = true, @@ -230,7 +226,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -266,7 +261,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -302,7 +296,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -341,7 +334,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = true, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .supports_peer_stats_info = true, .dynamic_sar_support = true, @@ -384,7 +376,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -433,7 +424,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -479,7 +469,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -515,7 +504,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -553,7 +541,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = true, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -583,7 +570,6 @@ .ast_skid_limit = 0x10, .num_wds_entries = 0x20, .uart_pin_workaround = true, - .credit_size_workaround = true, .dynamic_sar_support = false, }, { @@ -625,7 +611,6 @@ .rri_on_ddr = false, .hw_filter_reset_required = true, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = false, }, @@ -654,7 +639,6 @@ .rri_on_ddr = true, .hw_filter_reset_required = false, .fw_diag_ce_download = false, - .credit_size_workaround = false, .tx_stats_over_pktlog = false, .dynamic_sar_support = true, }, @@ -730,7 +714,6 @@ static int ath10k_init_sdio(struct ath10k *ar, enum ath10k_firmware_mode mode) { - bool mtu_workaround = ar->hw_params.credit_size_workaround; int ret; u32 param = 0; @@ -748,7 +731,7 @@ param |= HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET; - if (mode == ATH10K_FIRMWARE_MODE_NORMAL && !mtu_workaround) + if (mode == ATH10K_FIRMWARE_MODE_NORMAL) param |= HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE; else param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE; reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/htt_tx.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -147,9 +147,6 @@ htt->num_pending_tx--; if (htt->num_pending_tx == htt->max_num_pending_tx - 1) ath10k_mac_tx_unlock(htt->ar, ATH10K_TX_PAUSE_Q_FULL); - - if (htt->num_pending_tx == 0) - wake_up(&htt->empty_tx_wq); } int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt) reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/hw.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath10k/hw.h @@ -618,9 +618,6 @@ */ bool uart_pin_workaround; - /* Workaround for the credit size calculation */ - bool credit_size_workaround; - /* tx stats support over pktlog */ bool tx_stats_over_pktlog; reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath10k/txrx.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath10k/txrx.c @@ -82,6 +82,8 @@ flags = skb_cb->flags; ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); ath10k_htt_tx_dec_pending(htt); + if (htt->num_pending_tx == 0) + wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); rcu_read_lock(); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/ahb.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/ahb.c @@ -175,11 +175,8 @@ ath11k_ahb_ext_grp_disable(irq_grp); + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); - if (irq_grp->napi_enabled) { - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); - irq_grp->napi_enabled = false; - } } } @@ -209,13 +206,13 @@ static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) { + const struct ce_pipe_config *ce_config; - const struct ce_attr *ce_attr; + ce_config = &ab->hw_params.target_ce_config[ce_id]; + if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); + if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { - if (ce_attr->dest_nentries) { ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); @@ -224,13 +221,13 @@ static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) { + const struct ce_pipe_config *ce_config; - const struct ce_attr *ce_attr; + ce_config = &ab->hw_params.target_ce_config[ce_id]; + if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); + if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { - if (ce_attr->dest_nentries) { ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); @@ -303,10 +300,7 @@ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + napi_enable(&irq_grp->napi); - if (!irq_grp->napi_enabled) { - napi_enable(&irq_grp->napi); - irq_grp->napi_enabled = true; - } ath11k_ahb_ext_grp_enable(irq_grp); } } reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/core.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/core.h @@ -131,7 +131,6 @@ u32 num_irq; u32 grp_id; u64 timestamp; - bool napi_enabled; struct napi_struct napi; struct net_device napi_ndev; }; @@ -701,6 +700,7 @@ u32 wlan_init_status; int irq_num[ATH11K_IRQ_NUM_MAX]; struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; + struct napi_struct *napi; struct ath11k_targ_cap target_caps; u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; bool pdevs_macaddr_valid; reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/dp.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/dp.h @@ -515,8 +515,7 @@ } __packed; #define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) +#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) -#define HTT_PPDU_STATS_CFG_SOC_STATS BIT(8) -#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 9) #define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16) enum htt_ppdu_stats_tag_type { reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/dp_tx.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -895,7 +895,7 @@ cmd->msg = FIELD_PREP(HTT_PPDU_STATS_CFG_MSG_TYPE, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG); + pdev_mask = 1 << (i + 1); - pdev_mask = 1 << (ar->pdev_idx + i); cmd->msg |= FIELD_PREP(HTT_PPDU_STATS_CFG_PDEV_ID, pdev_mask); cmd->msg |= FIELD_PREP(HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK, mask); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/hal.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/hal.c @@ -937,7 +937,6 @@ srng->msi_data = params->msi_data; srng->initialized = 1; spin_lock_init(&srng->lock); - lockdep_set_class(&srng->lock, hal->srng_key + ring_id); for (i = 0; i < HAL_SRNG_NUM_REG_GRP; i++) { srng->hwreg_base[i] = srng_config->reg_start[i] + @@ -1224,24 +1223,6 @@ return 0; } -static void ath11k_hal_register_srng_key(struct ath11k_base *ab) -{ - struct ath11k_hal *hal = &ab->hal; - u32 ring_id; - - for (ring_id = 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) - lockdep_register_key(hal->srng_key + ring_id); -} - -static void ath11k_hal_unregister_srng_key(struct ath11k_base *ab) -{ - struct ath11k_hal *hal = &ab->hal; - u32 ring_id; - - for (ring_id = 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) - lockdep_unregister_key(hal->srng_key + ring_id); -} - int ath11k_hal_srng_init(struct ath11k_base *ab) { struct ath11k_hal *hal = &ab->hal; @@ -1261,8 +1242,6 @@ if (ret) goto err_free_cont_rdp; - ath11k_hal_register_srng_key(ab); - return 0; err_free_cont_rdp: @@ -1277,7 +1256,6 @@ { struct ath11k_hal *hal = &ab->hal; - ath11k_hal_unregister_srng_key(ab); ath11k_hal_free_cont_rdp(ab); ath11k_hal_free_cont_wrp(ab); kfree(hal->srng_config); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/hal.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/hal.h @@ -899,8 +899,6 @@ /* shadow register configuration */ u32 shadow_reg_addr[HAL_SHADOW_NUM_REGS]; int num_shadow_reg_configured; - - struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX]; }; u32 ath11k_hal_reo_qdesc_size(u32 ba_window_size, u8 tid); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/hw.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/hw.c @@ -695,6 +695,8 @@ const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = { .tx = { ATH11K_TX_RING_MASK_0, + ATH11K_TX_RING_MASK_1, + ATH11K_TX_RING_MASK_2, }, .rx_mon_status = { 0, 0, 0, 0, diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/mac.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/mac.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/mac.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/mac.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -768,15 +767,11 @@ if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) arvif->rsnie_present = true; - else - arvif->rsnie_present = false; if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, WLAN_OUI_TYPE_MICROSOFT_WPA, ies, (skb_tail_pointer(bcn) - ies))) arvif->wpaie_present = true; - else - arvif->wpaie_present = false; ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); @@ -2575,12 +2570,9 @@ arg.scan_id = ATH11K_SCAN_ID; if (req->ie_len) { - arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); - if (!arg.extraie.ptr) { - ret = -ENOMEM; - goto exit; - } arg.extraie.len = req->ie_len; + arg.extraie.ptr = kzalloc(req->ie_len, GFP_KERNEL); + memcpy(arg.extraie.ptr, req->ie, req->ie_len); } if (req->n_ssids) { @@ -2657,7 +2649,9 @@ return 0; if (cmd == DISABLE_KEY) { - arg.key_cipher = WMI_CIPHER_NONE; + /* TODO: Check if FW expects value other than NONE for del */ + /* arg.key_cipher = WMI_CIPHER_NONE; */ + arg.key_len = 0; arg.key_data = NULL; goto install; } @@ -2789,7 +2783,7 @@ /* flush the fragments cache during key (re)install to * ensure all frags in the new frag list belong to the same key. */ - if (peer && sta && cmd == SET_KEY) + if (peer && cmd == SET_KEY) ath11k_peer_frags_flush(ar, peer); spin_unlock_bh(&ab->base_lock); @@ -4131,32 +4125,23 @@ return 0; } -static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) +int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) { - struct sk_buff *msdu; + struct sk_buff *msdu = skb; struct ieee80211_tx_info *info; + struct ath11k *ar = ctx; + struct ath11k_base *ab = ar->ab; spin_lock_bh(&ar->txmgmt_idr_lock); - msdu = idr_remove(&ar->txmgmt_idr, buf_id); + idr_remove(&ar->txmgmt_idr, buf_id); spin_unlock_bh(&ar->txmgmt_idr_lock); - - if (!msdu) - return; - - dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, + dma_unmap_single(ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, DMA_TO_DEVICE); info = IEEE80211_SKB_CB(msdu); memset(&info->status, 0, sizeof(info->status)); ieee80211_free_txskb(ar->hw, msdu); -} - -int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) -{ - struct ath11k *ar = ctx; - - ath11k_mac_tx_mgmt_free(ar, buf_id); return 0; } @@ -4165,10 +4150,17 @@ { struct ieee80211_vif *vif = ctx; struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB((struct sk_buff *)skb); + struct sk_buff *msdu = skb; struct ath11k *ar = skb_cb->ar; + struct ath11k_base *ab = ar->ab; - if (skb_cb->vif == vif) - ath11k_mac_tx_mgmt_free(ar, buf_id); + if (skb_cb->vif == vif) { + spin_lock_bh(&ar->txmgmt_idr_lock); + idr_remove(&ar->txmgmt_idr, buf_id); + spin_unlock_bh(&ar->txmgmt_idr_lock); + dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, + DMA_TO_DEVICE); + } return 0; } @@ -4183,8 +4175,6 @@ int buf_id; int ret; - ATH11K_SKB_CB(skb)->ar = ar; - spin_lock_bh(&ar->txmgmt_idr_lock); buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, ATH11K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/pci.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath11k/pci.c @@ -629,11 +629,8 @@ ath11k_pci_ext_grp_disable(irq_grp); + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); - if (irq_grp->napi_enabled) { - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); - irq_grp->napi_enabled = false; - } } } @@ -652,10 +649,7 @@ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + napi_enable(&irq_grp->napi); - if (!irq_grp->napi_enabled) { - napi_enable(&irq_grp->napi); - irq_grp->napi_enabled = true; - } ath11k_pci_ext_grp_enable(irq_grp); } } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/qmi.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/qmi.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/qmi.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/qmi.c @@ -1770,7 +1770,7 @@ chunk->vaddr = dma_alloc_coherent(ab->dev, chunk->size, &chunk->paddr, - GFP_KERNEL | __GFP_NOWARN); + GFP_KERNEL); if (!chunk->vaddr) { if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) { ath11k_dbg(ab, ATH11K_DBG_QMI, diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/reg.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/reg.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/reg.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/reg.c @@ -459,9 +459,6 @@ { u16 bw; - if (end_freq <= start_freq) - return 0; - bw = end_freq - start_freq; bw = min_t(u16, bw, max_bw); @@ -469,10 +466,8 @@ bw = 80; else if (bw >= 40 && bw < 80) bw = 40; - else if (bw >= 20 && bw < 40) + else if (bw < 40) bw = 20; - else - bw = 0; return bw; } @@ -496,77 +491,73 @@ struct cur_reg_rule *reg_rule, u8 *rule_idx, u32 flags, u16 max_bw) { - u32 start_freq; u32 end_freq; u16 bw; u8 i; i = *rule_idx; - /* there might be situations when even the input rule must be dropped */ - i--; - - /* frequencies below weather radar */ bw = ath11k_reg_adjust_bw(reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, max_bw); - if (bw > 0) { - i++; - ath11k_reg_update_rule(regd->reg_rules + i, - reg_rule->start_freq, - ETSI_WEATHER_RADAR_BAND_LOW, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); - - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, reg_rule->start_freq, - ETSI_WEATHER_RADAR_BAND_LOW, bw, reg_rule->ant_gain, - reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, - flags); - } + ath11k_reg_update_rule(regd->reg_rules + i, reg_rule->start_freq, + ETSI_WEATHER_RADAR_BAND_LOW, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); + + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, + bw, reg_rule->ant_gain, reg_rule->reg_power, + regd->reg_rules[i].dfs_cac_ms, + flags); + + if (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_HIGH) + end_freq = ETSI_WEATHER_RADAR_BAND_HIGH; + else + end_freq = reg_rule->end_freq; + + bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_LOW, end_freq, + max_bw); + + i++; - /* weather radar frequencies */ - start_freq = max_t(u32, reg_rule->start_freq, - ETSI_WEATHER_RADAR_BAND_LOW); - end_freq = min_t(u32, reg_rule->end_freq, ETSI_WEATHER_RADAR_BAND_HIGH); - - bw = ath11k_reg_adjust_bw(start_freq, end_freq, max_bw); - if (bw > 0) { - i++; - - ath11k_reg_update_rule(regd->reg_rules + i, start_freq, - end_freq, bw, reg_rule->ant_gain, - reg_rule->reg_power, flags); - - regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; - - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, start_freq, end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - regd->reg_rules[i].dfs_cac_ms, flags); + ath11k_reg_update_rule(regd->reg_rules + i, + ETSI_WEATHER_RADAR_BAND_LOW, end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); + + regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; + + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, ETSI_WEATHER_RADAR_BAND_LOW, end_freq, + bw, reg_rule->ant_gain, reg_rule->reg_power, + regd->reg_rules[i].dfs_cac_ms, + flags); + + if (end_freq == reg_rule->end_freq) { + regd->n_reg_rules--; + *rule_idx = i; + return; } - /* frequencies above weather radar */ bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, max_bw); - if (bw > 0) { - i++; - ath11k_reg_update_rule(regd->reg_rules + i, - ETSI_WEATHER_RADAR_BAND_HIGH, - reg_rule->end_freq, bw, - reg_rule->ant_gain, reg_rule->reg_power, - flags); - - ath11k_dbg(ab, ATH11K_DBG_REG, - "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", - i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, - reg_rule->end_freq, bw, reg_rule->ant_gain, - reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, - flags); - } + i++; + + ath11k_reg_update_rule(regd->reg_rules + i, ETSI_WEATHER_RADAR_BAND_HIGH, + reg_rule->end_freq, bw, + reg_rule->ant_gain, reg_rule->reg_power, + flags); + + ath11k_dbg(ab, ATH11K_DBG_REG, + "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", + i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, + bw, reg_rule->ant_gain, reg_rule->reg_power, + regd->reg_rules[i].dfs_cac_ms, + flags); *rule_idx = i; } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/wmi.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/wmi.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/wmi.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath11k/wmi.c @@ -1671,8 +1671,7 @@ tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd)); tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | FIELD_PREP(WMI_TLV_LEN, key_len_aligned); - if (arg->key_data) - memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); + memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); ret = ath11k_wmi_cmd_send(wmi, skb, WMI_VDEV_INSTALL_KEY_CMDID); if (ret) { @@ -5853,7 +5852,7 @@ ar = ab->pdevs[pdev_idx].ar; kfree(ab->new_regd[pdev_idx]); ab->new_regd[pdev_idx] = regd; - queue_work(ab->workqueue, &ar->regd_update_work); + ieee80211_queue_work(ar->hw, &ar->regd_update_work); } else { /* This regd would be applied during mac registration and is * held constant throughout for regd intersection purpose reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath9k/hif_usb.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -590,13 +590,6 @@ return; } - if (pkt_len > 2 * MAX_RX_BUF_SIZE) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); - RX_STAT_INC(skb_dropped); - return; - } - pad_len = 4 - (pkt_len & 0x3); if (pad_len == 4) pad_len = 0; reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath9k/htc.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath9k/htc.h @@ -281,7 +281,6 @@ struct ath9k_htc_rx { struct list_head rxbuf; spinlock_t rxbuflock; - bool initialized; }; #define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */ @@ -306,7 +305,6 @@ DECLARE_BITMAP(tx_slot, MAX_TX_BUF_NUM); struct timer_list cleanup_timer; spinlock_t tx_lock; - bool initialized; }; struct ath9k_htc_tx_ctl { reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -813,11 +813,6 @@ skb_queue_head_init(&priv->tx.data_vi_queue); skb_queue_head_init(&priv->tx.data_vo_queue); skb_queue_head_init(&priv->tx.tx_failed); - - /* Allow ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) to operate. */ - smp_wmb(); - priv->tx.initialized = true; - return 0; } @@ -1135,10 +1130,6 @@ struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; unsigned long flags; - /* Check if ath9k_rx_init() completed. */ - if (!data_race(priv->rx.initialized)) - goto err; - spin_lock_irqsave(&priv->rx.rxbuflock, flags); list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) { if (!tmp_buf->in_process) { @@ -1194,10 +1185,6 @@ list_add_tail(&rxbuf->list, &priv->rx.rxbuf); } - /* Allow ath9k_htc_rxep() to operate. */ - smp_wmb(); - priv->rx.initialized = true; - return 0; err: reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/ath9k/wmi.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/ath/ath9k/wmi.c @@ -169,10 +169,6 @@ &wmi->drv_priv->fatal_work); break; case WMI_TXSTATUS_EVENTID: - /* Check if ath9k_tx_init() completed. */ - if (!data_race(priv->tx.initialized)) - break; - spin_lock_bh(&priv->tx.tx_lock); if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { spin_unlock_bh(&priv->tx.tx_lock); diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/dxe.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/dxe.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/dxe.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/dxe.c @@ -272,21 +272,6 @@ return 0; } -static void wcn36xx_dxe_disable_ch_int(struct wcn36xx *wcn, u16 wcn_ch) -{ - int reg_data = 0; - - wcn36xx_dxe_read_register(wcn, - WCN36XX_DXE_INT_MASK_REG, - ®_data); - - reg_data &= ~wcn_ch; - - wcn36xx_dxe_write_register(wcn, - WCN36XX_DXE_INT_MASK_REG, - (int)reg_data); -} - static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl *ctl, gfp_t gfp) @@ -884,6 +869,7 @@ WCN36XX_DXE_WQ_TX_L); wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); /***************************************/ /* Init descriptors for TX HIGH channel */ @@ -907,6 +893,9 @@ wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data); + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); + /***************************************/ /* Init descriptors for RX LOW channel */ /***************************************/ @@ -916,6 +905,7 @@ goto out_err_rxl_ch; } + /* For RX we need to preallocated buffers */ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch); @@ -938,6 +928,9 @@ WCN36XX_DXE_REG_CTL_RX_L, WCN36XX_DXE_CH_DEFAULT_CTL_RX_L); + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); + /***************************************/ /* Init descriptors for RX HIGH channel */ /***************************************/ @@ -969,18 +962,15 @@ WCN36XX_DXE_REG_CTL_RX_H, WCN36XX_DXE_CH_DEFAULT_CTL_RX_H); + /* Enable channel interrupts */ + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); + ret = wcn36xx_dxe_request_irqs(wcn); if (ret < 0) goto out_err_irq; timer_setup(&wcn->tx_ack_timer, wcn36xx_dxe_tx_timer, 0); - /* Enable channel interrupts */ - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); - wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); - return 0; out_err_irq: @@ -997,14 +987,6 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) { - int reg_data = 0; - - /* Disable channel interrupts */ - wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H); - wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L); - wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H); - wcn36xx_dxe_disable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L); - free_irq(wcn->tx_irq, wcn); free_irq(wcn->rx_irq, wcn); del_timer(&wcn->tx_ack_timer); @@ -1016,13 +998,4 @@ - /* Put the DXE block into reset before freeing memory */ - reg_data = WCN36XX_DXE_REG_RESET; - wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CSR_RESET, reg_data); - wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch); wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch); - - wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_l_ch); - wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_tx_h_ch); - wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_l_ch); - wcn36xx_dxe_deinit_descs(wcn->dev, &wcn->dxe_rx_h_ch); } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/main.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/main.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/main.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/main.c @@ -397,7 +397,6 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) { struct wcn36xx *wcn = hw->priv; - int ret; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed); @@ -413,31 +412,17 @@ * want to receive/transmit regular data packets, then * simply stop the scan session and exit PS mode. */ - if (wcn->sw_scan_channel) - wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); - if (wcn->sw_scan_init) { - wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); - } + wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, + wcn->sw_scan_vif); + wcn->sw_scan_channel = 0; } else if (wcn->sw_scan) { /* A scan is ongoing, do not change the operating * channel, but start a scan session on the channel. */ - if (wcn->sw_scan_channel) - wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); - if (!wcn->sw_scan_init) { - /* This can fail if we are unable to notify the - * operating channel. - */ - ret = wcn36xx_smd_init_scan(wcn, - HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); - if (ret) { - mutex_unlock(&wcn->conf_mutex); - return -EIO; - } - } + wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN, + wcn->sw_scan_vif); wcn36xx_smd_start_scan(wcn, ch); + wcn->sw_scan_channel = ch; } else { wcn36xx_change_opchannel(wcn, ch); } @@ -725,12 +710,7 @@ struct wcn36xx *wcn = hw->priv; /* ensure that any scan session is finished */ - if (wcn->sw_scan_channel) - wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); - if (wcn->sw_scan_init) { - wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); - } + wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); wcn->sw_scan = false; wcn->sw_scan_opchannel = 0; } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/smd.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/smd.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/smd.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/smd.c @@ -731,7 +731,6 @@ wcn36xx_err("hal_init_scan response failed err=%d\n", ret); goto out; } - wcn->sw_scan_init = true; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -762,7 +761,6 @@ wcn36xx_err("hal_start_scan response failed err=%d\n", ret); goto out; } - wcn->sw_scan_channel = scan_channel; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -793,7 +791,6 @@ wcn36xx_err("hal_end_scan response failed err=%d\n", ret); goto out; } - wcn->sw_scan_channel = 0; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -835,7 +832,6 @@ wcn36xx_err("hal_finish_scan response failed err=%d\n", ret); goto out; } - wcn->sw_scan_init = false; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -953,7 +949,7 @@ INIT_HAL_MSG((*msg_body), WCN36XX_HAL_UPDATE_CHANNEL_LIST_REQ); - msg_body->num_channel = min_t(u8, req->n_channels, ARRAY_SIZE(msg_body->channels)); + msg_body->num_channel = min_t(u8, req->n_channels, sizeof(msg_body->channels)); for (i = 0; i < msg_body->num_channel; i++) { struct wcn36xx_hal_channel_param *param = &msg_body->channels[i]; u32 min_power = WCN36XX_HAL_DEFAULT_MIN_POWER; @@ -2689,7 +2685,7 @@ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", tmp->bss_index); vif = wcn36xx_priv_to_vif(tmp); - ieee80211_beacon_loss(vif); + ieee80211_connection_loss(vif); } return 0; } @@ -2704,7 +2700,7 @@ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n", rsp->bss_index); vif = wcn36xx_priv_to_vif(tmp); - ieee80211_beacon_loss(vif); + ieee80211_connection_loss(vif); return 0; } } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/txrx.c linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/txrx.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/txrx.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -237,6 +237,7 @@ const struct wcn36xx_rate *rate; struct ieee80211_hdr *hdr; struct wcn36xx_rx_bd *bd; + struct ieee80211_supported_band *sband; u16 fc, sn; /* @@ -258,6 +259,8 @@ fc = __le16_to_cpu(hdr->frame_control); sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)); + status.freq = WCN36XX_CENTER_FREQ(wcn); + status.band = WCN36XX_BAND(wcn); status.mactime = 10; status.signal = -get_rssi0(bd); status.antenna = 1; @@ -269,36 +272,18 @@ wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x\n", status.flag); - if (bd->scan_learn) { - /* If packet originate from hardware scanning, extract the - * band/channel from bd descriptor. - */ - u8 hwch = (bd->reserved0 << 4) + bd->rx_ch; - - if (bd->rf_band != 1 && hwch <= sizeof(ab_rx_ch_map) && hwch >= 1) { - status.band = NL80211_BAND_5GHZ; - status.freq = ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1], - status.band); - } else { - status.band = NL80211_BAND_2GHZ; - status.freq = ieee80211_channel_to_frequency(hwch, status.band); - } - } else { - status.band = WCN36XX_BAND(wcn); - status.freq = WCN36XX_CENTER_FREQ(wcn); - } - if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) { rate = &wcn36xx_rate_table[bd->rate_id]; status.encoding = rate->encoding; status.enc_flags = rate->encoding_flags; status.bw = rate->bw; status.rate_idx = rate->mcs_or_legacy_index; + sband = wcn->hw->wiphy->bands[status.band]; status.nss = 1; if (status.band == NL80211_BAND_5GHZ && status.encoding == RX_ENC_LEGACY && - status.rate_idx >= 4) { + status.rate_idx >= sband->n_bitrates) { /* no dsss rates in 5Ghz rates table */ status.rate_idx -= 4; } @@ -313,6 +298,22 @@ ieee80211_is_probe_resp(hdr->frame_control)) status.boottime_ns = ktime_get_boottime_ns(); + if (bd->scan_learn) { + /* If packet originates from hardware scanning, extract the + * band/channel from bd descriptor. + */ + u8 hwch = (bd->reserved0 << 4) + bd->rx_ch; + + if (bd->rf_band != 1 && hwch <= sizeof(ab_rx_ch_map) && hwch >= 1) { + status.band = NL80211_BAND_5GHZ; + status.freq = ieee80211_channel_to_frequency(ab_rx_ch_map[hwch - 1], + status.band); + } else { + status.band = NL80211_BAND_2GHZ; + status.freq = ieee80211_channel_to_frequency(hwch, status.band); + } + } + memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); if (ieee80211_is_beacon(hdr->frame_control)) { diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/wcn36xx.h linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/wcn36xx.h --- linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ linux-aws-5.13-5.13.0/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -231,7 +231,6 @@ struct cfg80211_scan_request *scan_req; bool sw_scan; u8 sw_scan_opchannel; - bool sw_scan_init; u8 sw_scan_channel; struct ieee80211_vif *sw_scan_vif; struct mutex scan_lock; diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/iwl-drv.c linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/iwl-drv.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -131,9 +131,6 @@ for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) iwl_free_fw_img(drv, drv->fw.img + i); - - /* clear the data for the aborted load case */ - memset(&drv->fw, 0, sizeof(drv->fw)); } static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, @@ -1325,7 +1322,6 @@ int i; bool load_module = false; bool usniffer_images = false; - bool failure = true; fw->ucode_capa.max_probe_length = IWL_DEFAULT_MAX_PROBE_LENGTH; fw->ucode_capa.standard_phy_calibration_size = @@ -1586,9 +1582,15 @@ * else from proceeding if the module fails to load * or hangs loading. */ - if (load_module) + if (load_module) { request_module("%s", op->name); - failure = false; +#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR + if (err) + IWL_ERR(drv, + "failed to load module %s (error %d), is dynamic loading enabled?\n", + op->name, err); +#endif + } goto free; try_again: @@ -1604,9 +1606,6 @@ complete(&drv->request_firmware_complete); device_release_driver(drv->trans->dev); free: - if (failure) - iwl_dealloc_ucode(drv); - if (pieces) { for (i = 0; i < ARRAY_SIZE(pieces->img); i++) kfree(pieces->img[i].sec); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c @@ -495,7 +495,7 @@ rcu_read_lock(); sta = rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id]); + if (sta->mfp) - if (sta->mfp && (peer->ftm.trigger_based || peer->ftm.non_trigger_based)) FTM_PUT_FLAG(PMF); rcu_read_unlock(); @@ -990,7 +990,7 @@ overshoot = IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT; alpha = IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA; + rtt_avg = (alpha * rtt + (100 - alpha) * resp->rtt_avg) / 100; - rtt_avg = div_s64(alpha * rtt + (100 - alpha) * resp->rtt_avg, 100); IWL_DEBUG_INFO(mvm, "%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n", diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1687,7 +1687,6 @@ struct iwl_mvm_mc_iter_data iter_data = { .mvm = mvm, }; - int ret; lockdep_assert_held(&mvm->mutex); @@ -1697,22 +1696,6 @@ ieee80211_iterate_active_interfaces_atomic( mvm->hw, IEEE80211_IFACE_ITER_NORMAL, iwl_mvm_mc_iface_iterator, &iter_data); - - /* - * Send a (synchronous) ech command so that we wait for the - * multiple asynchronous MCAST_FILTER_CMD commands sent by - * the interface iterator. Otherwise, we might get here over - * and over again (by userspace just sending a lot of these) - * and the CPU can send them faster than the firmware can - * process them. - * Note that the CPU is still faster - but with this we'll - * actually send fewer commands overall because the CPU will - * not schedule the work in mac80211 as frequently if it's - * still running when rescheduled (possibly multiple times). - */ - ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); - if (ret) - IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); } static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -121,39 +121,12 @@ struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; unsigned int headlen, fraglen, pad_len = 0; unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); - u8 mic_crc_len = u8_get_bits(desc->mac_flags1, - IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK) << 1; if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) { len -= 2; pad_len = 2; } - /* - * For non monitor interface strip the bytes the RADA might not have - * removed. As monitor interface cannot exist with other interfaces - * this removal is safe. - */ - if (mic_crc_len && !ieee80211_hw_check(mvm->hw, RX_INCLUDES_FCS)) { - u32 pkt_flags = le32_to_cpu(pkt->len_n_flags); - - /* - * If RADA was not enabled then decryption was not performed so - * the MIC cannot be removed. - */ - if (!(pkt_flags & FH_RSCSR_RADA_EN)) { - if (WARN_ON(crypt_len > mic_crc_len)) - return -EINVAL; - - mic_crc_len -= crypt_len; - } - - if (WARN_ON(mic_crc_len > len)) - return -EINVAL; - - len -= mic_crc_len; - } - /* If frame is small enough to fit in skb->head, pull it completely. * If not, only pull ieee80211_hdr (including crypto if present, and * an additional 8 bytes for SNAP/ethertype, see below) so that diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/scan.c linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/scan.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1905,19 +1905,22 @@ } /* - * 6GHz passive scan is allowed in a defined time interval following HW - * reset or resume flow, or while not associated and a large interval - * has passed since the last 6GHz passive scan. + * 6GHz passive scan is allowed while associated in a defined time + * interval following HW reset or resume flow */ - if ((vif->bss_conf.assoc || - time_after(mvm->last_6ghz_passive_scan_jiffies + - (IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT * HZ), jiffies)) && + if (vif->bss_conf.assoc && (time_before(mvm->last_reset_or_resume_time_jiffies + (IWL_MVM_6GHZ_PASSIVE_SCAN_ASSOC_TIMEOUT * HZ), jiffies))) { - IWL_DEBUG_SCAN(mvm, "6GHz passive scan: %s\n", - vif->bss_conf.assoc ? "associated" : - "timeout did not expire"); + IWL_DEBUG_SCAN(mvm, "6GHz passive scan: associated\n"); + return; + } + + /* No need for 6GHz passive scan if not enough time elapsed */ + if (time_after(mvm->last_6ghz_passive_scan_jiffies + + (IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT * HZ), jiffies)) { + IWL_DEBUG_SCAN(mvm, + "6GHz passive scan: timeout did not expire\n"); return; } @@ -2475,7 +2478,7 @@ return -EIO; } -#define SCAN_TIMEOUT 30000 +#define SCAN_TIMEOUT 20000 void iwl_mvm_scan_timeout_wk(struct work_struct *work) { diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c @@ -42,13 +42,14 @@ struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, roc_done_wk); /* - * Clear the ROC_RUNNING status bit. + * Clear the ROC_RUNNING /ROC_AUX_RUNNING status bit. * This will cause the TX path to drop offchannel transmissions. * That would also be done by mac80211, but it is racy, in particular * in the case that the time event actually completed in the firmware * (which is handled in iwl_mvm_te_handle_notif). */ clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); + clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); synchronize_net(); @@ -74,19 +75,9 @@ mvmvif = iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif); iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true); } - } - - /* - * Clear the ROC_AUX_RUNNING status bit. - * This will cause the TX path to drop offchannel transmissions. - * That would also be done by mac80211, but it is racy, in particular - * in the case that the time event actually completed in the firmware - * (which is handled in iwl_mvm_te_handle_notif). - */ - if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { + } else { /* do the same in case of hot spot 2.0 */ iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true); - /* In newer version of this command an aux station is added only * in cases of dedicated tx queue and need to be removed in end * of use */ @@ -660,14 +651,11 @@ iwl_mvm_te_clear_data(mvm, te_data); spin_unlock_bh(&mvm->time_event_lock); - /* When session protection is used, the te_data->id field + /* When session protection is supported, the te_data->id field * is reused to save session protection's configuration. - * For AUX ROC, HOT_SPOT_CMD is used and the te_data->id field is set - * to HOT_SPOT_CMD. */ if (fw_has_capa(&mvm->fw->ucode_capa, - IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD) && - id != HOT_SPOT_CMD) { + IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) { if (mvmvif && id < SESSION_PROTECT_CONF_MAX_ID) { /* Session protection is still ongoing. Cancel it */ iwl_mvm_cancel_session_protection(mvm, mvmvif); @@ -1001,7 +989,7 @@ set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); } else { iwl_mvm_remove_aux_roc_te(mvm, mvmvif, - &mvmvif->hs_time_event_data); + &mvmvif->time_event_data); } iwl_mvm_roc_finished(mvm); @@ -1134,10 +1122,15 @@ cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)), .action = cpu_to_le32(FW_CTXT_ACTION_ADD), - .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), .duration_tu = cpu_to_le32(MSEC_TO_TU(duration)), }; + /* The time_event_data.id field is reused to save session + * protection's configuration. + */ + mvmvif->time_event_data.id = SESSION_PROTECT_CONF_ASSOC; + cmd.conf_id = cpu_to_le32(mvmvif->time_event_data.id); + lockdep_assert_held(&mvm->mutex); spin_lock_bh(&mvm->time_event_lock); @@ -1151,11 +1144,6 @@ } iwl_mvm_te_clear_data(mvm, te_data); - /* - * The time_event_data.id field is reused to save session - * protection's configuration. - */ - te_data->id = le32_to_cpu(cmd.conf_id); te_data->duration = le32_to_cpu(cmd.duration_tu); spin_unlock_bh(&mvm->time_event_lock); diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -2289,12 +2289,7 @@ } } - /* - * In some rare cases when the HW is in a bad state, we may - * get this interrupt too early, when prph_info is still NULL. - * So make sure that it's not NULL to prevent crashing. - */ - if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP && trans_pcie->prph_info) { + if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP) { u32 sleep_notif = le32_to_cpu(trans_pcie->prph_info->sleep_notif); if (sleep_notif == IWL_D3_SLEEP_STATUS_SUSPEND || reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1072,7 +1072,6 @@ return 0; err_free_tfds: dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr); - txq->tfds = NULL; error: if (txq->entries && cmd_queue) for (i = 0; i < slots_num; i++) reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -365,12 +365,10 @@ sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { sta_ptr->tx_pause = tp->tx_pause; - spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); - } else { - spin_unlock_bh(&priv->sta_list_spinlock); } + spin_unlock_bh(&priv->sta_list_spinlock); } } @@ -402,13 +400,11 @@ sta_ptr = mwifiex_get_sta_entry(priv, tp->peermac); if (sta_ptr && sta_ptr->tx_pause != tp->tx_pause) { sta_ptr->tx_pause = tp->tx_pause; - spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_update_ralist_tx_pause(priv, tp->peermac, tp->tx_pause); - } else { - spin_unlock_bh(&priv->sta_list_spinlock); } + spin_unlock_bh(&priv->sta_list_spinlock); } } } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/marvell/mwifiex/usb.c linux-aws-5.13-5.13.0/drivers/net/wireless/marvell/mwifiex/usb.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/marvell/mwifiex/usb.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/marvell/mwifiex/usb.c @@ -130,8 +130,7 @@ default: mwifiex_dbg(adapter, ERROR, "unknown recv_type %#x\n", recv_type); - ret = -1; - goto exit_restore_skb; + return -1; } break; case MWIFIEX_USB_EP_DATA: diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -210,9 +210,11 @@ mvif->mt76.omac_idx = idx; mvif->mt76.band_idx = ext_phy; - mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP; - if (ext_phy) - mvif->mt76.wmm_idx += 2; + if (mt7615_ext_phy(dev)) + mvif->mt76.wmm_idx = ext_phy * (MT7615_MAX_WMM_SETS / 2) + + mvif->mt76.idx % (MT7615_MAX_WMM_SETS / 2); + else + mvif->mt76.wmm_idx = mvif->mt76.idx % MT7615_MAX_WMM_SETS; dev->mt76.vif_mask |= BIT(mvif->mt76.idx); dev->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c @@ -28,6 +28,8 @@ return; mt7615_init_work(dev); + if (dev->dbdc_support) + mt7615_register_ext_phy(dev); } static int mt7615_init_hardware(struct mt7615_dev *dev) @@ -154,12 +156,6 @@ mt7615_init_txpower(dev, &dev->mphy.sband_2g.sband); mt7615_init_txpower(dev, &dev->mphy.sband_5g.sband); - if (dev->dbdc_support) { - ret = mt7615_register_ext_phy(dev); - if (ret) - return ret; - } - return mt7615_init_debugfs(dev); } diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -288,6 +288,12 @@ mtxq->wcid = &mvif->sta.wcid; } + if (vif->type != NL80211_IFTYPE_AP && + (!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3)) + vif->offload_flags = 0; + + vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR; + out: mt7921_mutex_release(dev); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/main.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/realtek/rtw88/main.c @@ -1770,7 +1770,7 @@ /* default rx filter setting */ rtwdev->hal.rcr = BIT_APP_FCS | BIT_APP_MIC | BIT_APP_ICV | + BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | - BIT_PKTCTL_DLEN | BIT_HTC_LOC_CTRL | BIT_APP_PHYSTS | BIT_AB | BIT_AM | BIT_APM; ret = rtw_load_firmware(rtwdev, RTW_NORMAL_FW); reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8821c.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/realtek/rtw88/rtw8821c.h @@ -131,7 +131,7 @@ #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 +#define WLAN_MAC_OPT_FUNC2 0x30810041 -#define WLAN_MAC_OPT_FUNC2 0xb0810041 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \ reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8822b.c +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/realtek/rtw88/rtw8822b.c @@ -204,7 +204,7 @@ #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 +#define WLAN_MAC_OPT_FUNC2 0x30810041 -#define WLAN_MAC_OPT_FUNC2 0xb0810041 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ (WLAN_SIFS_OFDM_CONT_TX << BIT_SHIFT_SIFS_OFDM_CTX) | \ diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8822c.c linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8822c.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1956,7 +1956,7 @@ #define WLAN_TX_FUNC_CFG2 0x30 #define WLAN_MAC_OPT_NORM_FUNC1 0x98 #define WLAN_MAC_OPT_LB_FUNC1 0x80 -#define WLAN_MAC_OPT_FUNC2 0xb0810041 +#define WLAN_MAC_OPT_FUNC2 0x30810041 #define WLAN_MAC_INT_MIG_CFG 0x33330000 #define WLAN_SIFS_CFG (WLAN_SIFS_CCK_CONT_TX | \ diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_main.c linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_main.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_main.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_main.c @@ -23,7 +23,6 @@ #include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" -#include "rsi_usb.h" u32 rsi_zone_enabled = /* INFO_ZONE | INIT_ZONE | @@ -169,9 +168,6 @@ frame_desc = &rx_pkt[index]; actual_length = *(u16 *)&frame_desc[0]; offset = *(u16 *)&frame_desc[2]; - if (!rcv_pkt_len && offset > - RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) - goto fail; queueno = rsi_get_queueno(frame_desc, offset); length = rsi_get_length(frame_desc, offset); diff -u linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_usb.c linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_usb.c --- linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_usb.c +++ linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -269,12 +269,8 @@ struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data; int status = -EINVAL; - if (!rx_cb->rx_skb) - return; - if (urb->status) { dev_kfree_skb(rx_cb->rx_skb); - rx_cb->rx_skb = NULL; return; } @@ -298,10 +294,8 @@ if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); - if (status) { + if (status) dev_kfree_skb(rx_cb->rx_skb); - rx_cb->rx_skb = NULL; - } } static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) @@ -330,6 +324,7 @@ struct sk_buff *skb; u8 dword_align_bytes = 0; +#define RSI_MAX_RX_USB_PKT_SIZE 3000 skb = dev_alloc_skb(RSI_MAX_RX_USB_PKT_SIZE); if (!skb) return -ENOMEM; reverted: --- linux-aws-5.13-5.13.0/drivers/net/wireless/rsi/rsi_usb.h +++ linux-aws-5.13-5.13.0.orig/drivers/net/wireless/rsi/rsi_usb.h @@ -44,8 +44,6 @@ #define RSI_USB_BUF_SIZE 4096 #define RSI_USB_CTRL_BUF_SIZE 0x04 -#define RSI_MAX_RX_USB_PKT_SIZE 3000 - struct rx_usb_ctrl_block { u8 *data; struct urb *rx_urb; diff -u linux-aws-5.13-5.13.0/drivers/nvmem/core.c linux-aws-5.13-5.13.0/drivers/nvmem/core.c --- linux-aws-5.13-5.13.0/drivers/nvmem/core.c +++ linux-aws-5.13-5.13.0/drivers/nvmem/core.c @@ -306,8 +306,6 @@ struct device *dev = kobj_to_dev(kobj); struct nvmem_device *nvmem = to_nvmem_device(dev); - attr->size = nvmem->size; - return nvmem_bin_attr_get_umode(nvmem); } reverted: --- linux-aws-5.13-5.13.0/drivers/of/base.c +++ linux-aws-5.13-5.13.0.orig/drivers/of/base.c @@ -1328,14 +1328,9 @@ * property data length */ if (it->cur + count > it->list_end) { + pr_err("%pOF: %s = %d found %d\n", + it->parent, it->cells_name, + count, it->cell_count); - if (it->cells_name) - pr_err("%pOF: %s = %d found %td\n", - it->parent, it->cells_name, - count, it->list_end - it->cur); - else - pr_err("%pOF: phandle %s needs %d, found %td\n", - it->parent, of_node_full_name(it->node), - count, it->list_end - it->cur); goto err; } } diff -u linux-aws-5.13-5.13.0/drivers/of/fdt.c linux-aws-5.13-5.13.0/drivers/of/fdt.c --- linux-aws-5.13-5.13.0/drivers/of/fdt.c +++ linux-aws-5.13-5.13.0/drivers/of/fdt.c @@ -1159,11 +1159,9 @@ if (nomap) { /* * If the memory is already reserved (by another region), we - * should not allow it to be marked nomap, but don't worry - * if the region isn't memory as it won't be mapped. + * should not allow it to be marked nomap. */ - if (memblock_overlaps_region(&memblock.memory, base, size) && - memblock_is_region_reserved(base, size)) + if (memblock_is_region_reserved(base, size)) return -EBUSY; return memblock_mark_nomap(base, size); diff -u linux-aws-5.13-5.13.0/drivers/of/unittest.c linux-aws-5.13-5.13.0/drivers/of/unittest.c --- linux-aws-5.13-5.13.0/drivers/of/unittest.c +++ linux-aws-5.13-5.13.0/drivers/of/unittest.c @@ -911,18 +911,11 @@ if (!rc) { phys_addr_t paddr; dma_addr_t dma_addr; - struct device *dev_bogus; + struct device dev_bogus; - dev_bogus = kzalloc(sizeof(struct device), GFP_KERNEL); - if (!dev_bogus) { - unittest(0, "kzalloc() failed\n"); - kfree(map); - return; - } - - dev_bogus->dma_range_map = map; - paddr = dma_to_phys(dev_bogus, expect_dma_addr); - dma_addr = phys_to_dma(dev_bogus, expect_paddr); + dev_bogus.dma_range_map = map; + paddr = dma_to_phys(&dev_bogus, expect_dma_addr); + dma_addr = phys_to_dma(&dev_bogus, expect_paddr); unittest(paddr == expect_paddr, "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n", @@ -932,7 +925,6 @@ &dma_addr, expect_dma_addr, np); kfree(map); - kfree(dev_bogus); } of_node_put(np); #endif @@ -942,9 +934,8 @@ { of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", 0x0, 0x20000000); - if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) - of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", - 0x100000000, 0x20000000); + of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", + 0x100000000, 0x20000000); of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", 0x80000000, 0x20000000); } reverted: --- linux-aws-5.13-5.13.0/drivers/parisc/pdc_stable.c +++ linux-aws-5.13-5.13.0.orig/drivers/parisc/pdc_stable.c @@ -979,10 +979,8 @@ entry->kobj.kset = paths_kset; err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, "%s", entry->name); + if (err) - if (err) { - kobject_put(&entry->kobj); return err; - } /* kobject is now registered */ write_lock(&entry->rw_lock); diff -u linux-aws-5.13-5.13.0/drivers/pci/controller/pci-aardvark.c linux-aws-5.13-5.13.0/drivers/pci/controller/pci-aardvark.c --- linux-aws-5.13-5.13.0/drivers/pci/controller/pci-aardvark.c +++ linux-aws-5.13-5.13.0/drivers/pci/controller/pci-aardvark.c @@ -872,6 +872,7 @@ return PCI_BRIDGE_EMUL_HANDLED; } + case PCI_CAP_LIST_ID: case PCI_EXP_DEVCAP: case PCI_EXP_DEVCTL: *value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); @@ -952,9 +953,6 @@ /* Support interrupt A for MSI feature */ bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE; - /* Aardvark HW provides PCIe Capability structure in version 2 */ - bridge->pcie_conf.cap = cpu_to_le16(2); - /* Indicates supports for Completion Retry Status */ bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); reverted: --- linux-aws-5.13-5.13.0/drivers/pci/controller/pci-mvebu.c +++ linux-aws-5.13-5.13.0.orig/drivers/pci/controller/pci-mvebu.c @@ -573,8 +573,6 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { struct pci_bridge_emul *bridge = &port->bridge; - u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP); - u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); bridge->conf.vendor = PCI_VENDOR_ID_MARVELL; bridge->conf.device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; @@ -587,12 +585,6 @@ bridge->conf.iolimit = PCI_IO_RANGE_TYPE_32; } - /* - * Older mvebu hardware provides PCIe Capability structure only in - * version 1. New hardware provides it in version 2. - */ - bridge->pcie_conf.cap = cpu_to_le16(pcie_cap_ver); - bridge->has_pcie = true; bridge->data = port; bridge->ops = &mvebu_pci_bridge_emul_ops; reverted: --- linux-aws-5.13-5.13.0/drivers/pci/controller/pci-xgene.c +++ linux-aws-5.13-5.13.0.orig/drivers/pci/controller/pci-xgene.c @@ -466,7 +466,7 @@ return 1; } + if ((size > SZ_1K) && (size < SZ_1T) && !(*ib_reg_mask & (1 << 0))) { - if ((size > SZ_1K) && (size < SZ_4G) && !(*ib_reg_mask & (1 << 0))) { *ib_reg_mask |= (1 << 0); return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp.h +++ linux-aws-5.13-5.13.0.orig/drivers/pci/hotplug/pciehp.h @@ -72,8 +72,6 @@ * @reset_lock: prevents access to the Data Link Layer Link Active bit in the * Link Status register and to the Presence Detect State bit in the Slot * Status register during a slot reset which may cause them to flap - * @depth: Number of additional hotplug ports in the path to the root bus, - * used as lock subclass for @reset_lock * @ist_running: flag to keep user request waiting while IRQ thread is running * @request_result: result of last user request submitted to the IRQ thread * @requester: wait queue to wake up on completion of user request, @@ -105,7 +103,6 @@ struct hotplug_slot hotplug_slot; /* hotplug core interface */ struct rw_semaphore reset_lock; - unsigned int depth; unsigned int ist_running; int request_result; wait_queue_head_t requester; reverted: --- linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp_core.c +++ linux-aws-5.13-5.13.0.orig/drivers/pci/hotplug/pciehp_core.c @@ -166,7 +166,7 @@ { int occupied; + down_read(&ctrl->reset_lock); - down_read_nested(&ctrl->reset_lock, ctrl->depth); mutex_lock(&ctrl->state_lock); occupied = pciehp_card_present_or_link_active(ctrl); diff -u linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp_hpc.c linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp_hpc.c --- linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp_hpc.c +++ linux-aws-5.13-5.13.0/drivers/pci/hotplug/pciehp_hpc.c @@ -583,7 +583,7 @@ * the corresponding link change may have been ignored above. * Synthesize it to ensure that it is acted on. */ - down_read_nested(&ctrl->reset_lock, ctrl->depth); + down_read(&ctrl->reset_lock); if (!pciehp_check_link_active(ctrl)) pciehp_request(ctrl, PCI_EXP_SLTSTA_DLLSC); up_read(&ctrl->reset_lock); @@ -746,7 +746,7 @@ * Disable requests have higher priority than Presence Detect Changed * or Data Link Layer State Changed events. */ - down_read_nested(&ctrl->reset_lock, ctrl->depth); + down_read(&ctrl->reset_lock); if (events & DISABLE_SLOT) pciehp_handle_disable_request(ctrl); else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC)) @@ -880,7 +880,7 @@ if (probe) return 0; - down_write_nested(&ctrl->reset_lock, ctrl->depth); + down_write(&ctrl->reset_lock); if (!ATTN_BUTTN(ctrl)) { ctrl_mask |= PCI_EXP_SLTCTL_PDCE; @@ -936,20 +936,6 @@ #define FLAG(x, y) (((x) & (y)) ? '+' : '-') -static inline int pcie_hotplug_depth(struct pci_dev *dev) -{ - struct pci_bus *bus = dev->bus; - int depth = 0; - - while (bus->parent) { - bus = bus->parent; - if (bus->self && bus->self->is_hotplug_bridge) - depth++; - } - - return depth; -} - struct controller *pcie_init(struct pcie_device *dev) { struct controller *ctrl; @@ -963,7 +949,6 @@ return NULL; ctrl->pcie = dev; - ctrl->depth = pcie_hotplug_depth(dev->port); pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, &slot_cap); if (pdev->hotplug_user_indicators) diff -u linux-aws-5.13-5.13.0/drivers/pci/msi.c linux-aws-5.13-5.13.0/drivers/pci/msi.c --- linux-aws-5.13-5.13.0/drivers/pci/msi.c +++ linux-aws-5.13-5.13.0/drivers/pci/msi.c @@ -1284,24 +1284,19 @@ /** * pci_irq_vector - return Linux IRQ number of a device vector - * @dev: PCI device to operate on - * @nr: Interrupt vector index (0-based) - * - * @nr has the following meanings depending on the interrupt mode: - * MSI-X: The index in the MSI-X vector table - * MSI: The index of the enabled MSI vectors - * INTx: Must be 0 - * - * Return: The Linux interrupt number or -EINVAl if @nr is out of range. + * @dev: PCI device to operate on + * @nr: device-relative interrupt vector index (0-based). */ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) { if (dev->msix_enabled) { struct msi_desc *entry; + int i = 0; for_each_pci_msi_entry(entry, dev) { - if (entry->msi_attrib.entry_nr == nr) + if (i == nr) return entry->irq; + i++; } WARN_ON_ONCE(1); return -EINVAL; @@ -1325,22 +1320,17 @@ * pci_irq_get_affinity - return the affinity of a particular MSI vector * @dev: PCI device to operate on * @nr: device-relative interrupt vector index (0-based). - * - * @nr has the following meanings depending on the interrupt mode: - * MSI-X: The index in the MSI-X vector table - * MSI: The index of the enabled MSI vectors - * INTx: Must be 0 - * - * Return: A cpumask pointer or NULL if @nr is out of range */ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) { if (dev->msix_enabled) { struct msi_desc *entry; + int i = 0; for_each_pci_msi_entry(entry, dev) { - if (entry->msi_attrib.entry_nr == nr) + if (i == nr) return &entry->affinity->mask; + i++; } WARN_ON_ONCE(1); return NULL; diff -u linux-aws-5.13-5.13.0/drivers/pci/pci-bridge-emul.c linux-aws-5.13-5.13.0/drivers/pci/pci-bridge-emul.c --- linux-aws-5.13-5.13.0/drivers/pci/pci-bridge-emul.c +++ linux-aws-5.13-5.13.0/drivers/pci/pci-bridge-emul.c @@ -139,13 +139,8 @@ .ro = GENMASK(7, 0), }, - /* - * If expansion ROM is unsupported then ROM Base Address register must - * be implemented as read-only register that return 0 when read, same - * as for unused Base Address registers. - */ [PCI_ROM_ADDRESS1 / 4] = { - .ro = ~0, + .rw = GENMASK(31, 11) | BIT(0), }, /* @@ -176,55 +171,41 @@ [PCI_CAP_LIST_ID / 4] = { /* * Capability ID, Next Capability Pointer and - * bits [14:0] of Capabilities register are all read-only. - * Bit 15 of Capabilities register is reserved. + * Capabilities register are all read-only. */ - .ro = GENMASK(30, 0), + .ro = ~0, }, [PCI_EXP_DEVCAP / 4] = { - /* - * Bits [31:29] and [17:16] are reserved. - * Bits [27:18] are reserved for non-upstream ports. - * Bits 28 and [14:6] are reserved for non-endpoint devices. - * Other bits are read-only. - */ - .ro = BIT(15) | GENMASK(5, 0), + .ro = ~0, }, [PCI_EXP_DEVCTL / 4] = { - /* - * Device control register is RW, except bit 15 which is - * reserved for non-endpoints or non-PCIe-to-PCI/X bridges. - */ - .rw = GENMASK(14, 0), + /* Device control register is RW */ + .rw = GENMASK(15, 0), /* * Device status register has bits 6 and [3:0] W1C, [5:4] RO, - * the rest is reserved. Also bit 6 is reserved for non-upstream - * ports. + * the rest is reserved */ - .w1c = GENMASK(3, 0) << 16, + .w1c = (BIT(6) | GENMASK(3, 0)) << 16, .ro = GENMASK(5, 4) << 16, }, [PCI_EXP_LNKCAP / 4] = { - /* - * All bits are RO, except bit 23 which is reserved and - * bit 18 which is reserved for non-upstream ports. - */ - .ro = lower_32_bits(~(BIT(23) | PCI_EXP_LNKCAP_CLKPM)), + /* All bits are RO, except bit 23 which is reserved */ + .ro = lower_32_bits(~BIT(23)), }, [PCI_EXP_LNKCTL / 4] = { /* * Link control has bits [15:14], [11:3] and [1:0] RW, the - * rest is reserved. Bit 8 is reserved for non-upstream ports. + * rest is reserved. * * Link status has bits [13:0] RO, and bits [15:14] * W1C. */ - .rw = GENMASK(15, 14) | GENMASK(11, 9) | GENMASK(7, 3) | GENMASK(1, 0), + .rw = GENMASK(15, 14) | GENMASK(11, 3) | GENMASK(1, 0), .ro = GENMASK(13, 0) << 16, .w1c = GENMASK(15, 14) << 16, }, @@ -296,9 +277,11 @@ if (bridge->has_pcie) { bridge->conf.capabilities_pointer = PCI_CAP_PCIE_START; - bridge->conf.status |= cpu_to_le16(PCI_STATUS_CAP_LIST); bridge->pcie_conf.cap_id = PCI_CAP_ID_EXP; - bridge->pcie_conf.cap |= cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4); + /* Set PCIe v2, root port, slot support */ + bridge->pcie_conf.cap = + cpu_to_le16(PCI_EXP_TYPE_ROOT_PORT << 4 | 2 | + PCI_EXP_FLAGS_SLOT); bridge->pcie_cap_regs_behavior = kmemdup(pcie_cap_regs_behavior, sizeof(pcie_cap_regs_behavior), @@ -307,27 +290,6 @@ kfree(bridge->pci_regs_behavior); return -ENOMEM; } - /* These bits are applicable only for PCI and reserved on PCIe */ - bridge->pci_regs_behavior[PCI_CACHE_LINE_SIZE / 4].ro &= - ~GENMASK(15, 8); - bridge->pci_regs_behavior[PCI_COMMAND / 4].ro &= - ~((PCI_COMMAND_SPECIAL | PCI_COMMAND_INVALIDATE | - PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_WAIT | - PCI_COMMAND_FAST_BACK) | - (PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | - PCI_STATUS_DEVSEL_MASK) << 16); - bridge->pci_regs_behavior[PCI_PRIMARY_BUS / 4].ro &= - ~GENMASK(31, 24); - bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro &= - ~((PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK | - PCI_STATUS_DEVSEL_MASK) << 16); - bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].rw &= - ~((PCI_BRIDGE_CTL_MASTER_ABORT | - BIT(8) | BIT(9) | BIT(11)) << 16); - bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].ro &= - ~((PCI_BRIDGE_CTL_FAST_BACK) << 16); - bridge->pci_regs_behavior[PCI_INTERRUPT_LINE / 4].w1c &= - ~(BIT(10) << 16); } if (flags & PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR) { diff -u linux-aws-5.13-5.13.0/drivers/pci/quirks.c linux-aws-5.13-5.13.0/drivers/pci/quirks.c --- linux-aws-5.13-5.13.0/drivers/pci/quirks.c +++ linux-aws-5.13-5.13.0/drivers/pci/quirks.c @@ -4082,9 +4082,6 @@ quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, quirk_dma_func1_alias); -/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, - quirk_dma_func1_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, quirk_dma_func1_alias); /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ reverted: --- linux-aws-5.13-5.13.0/drivers/pcmcia/cs.c +++ linux-aws-5.13-5.13.0.orig/drivers/pcmcia/cs.c @@ -666,16 +666,18 @@ if (events || sysfs_events) continue; - set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; + set_current_state(TASK_INTERRUPTIBLE); + schedule(); + /* make sure we are running */ + __set_current_state(TASK_RUNNING); + try_to_freeze(); } - /* make sure we are running before we exit */ - __set_current_state(TASK_RUNNING); /* shut down socket, if a device is still present */ if (skt->state & SOCKET_PRESENT) { reverted: --- linux-aws-5.13-5.13.0/drivers/pcmcia/rsrc_nonstatic.c +++ linux-aws-5.13-5.13.0.orig/drivers/pcmcia/rsrc_nonstatic.c @@ -690,9 +690,6 @@ unsigned long min = base; int ret; - if (!res) - return NULL; - data.mask = align - 1; data.offset = base & data.mask; data.map = &s_data->io_db; @@ -812,9 +809,6 @@ unsigned long min, max; int ret, i, j; - if (!res) - return NULL; - low = low || !(s->features & SS_CAP_PAGE_REGS); data.mask = align - 1; diff -u linux-aws-5.13-5.13.0/drivers/perf/arm-cmn.c linux-aws-5.13-5.13.0/drivers/perf/arm-cmn.c --- linux-aws-5.13-5.13.0/drivers/perf/arm-cmn.c +++ linux-aws-5.13-5.13.0/drivers/perf/arm-cmn.c @@ -1561,8 +1561,7 @@ err = perf_pmu_register(&cmn->pmu, name, -1); if (err) - cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node); - + cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); return err; } @@ -1574,7 +1573,7 @@ writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL); perf_pmu_unregister(&cmn->pmu); - cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node); + cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); for (i = 0; i < cmn->num_dtcs; i++) irq_set_affinity_hint(cmn->dtc[i].irq, NULL); reverted: --- linux-aws-5.13-5.13.0/drivers/phy/cadence/phy-cadence-sierra.c +++ linux-aws-5.13-5.13.0.orig/drivers/phy/cadence/phy-cadence-sierra.c @@ -215,10 +215,7 @@ [CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK }, }; +static u32 cdns_sierra_pll_mux_table[] = { 0, 1 }; -static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] = { - [CMN_PLLLC] = { 0, 1 }, - [CMN_PLLLC1] = { 1, 0 }, -}; struct cdns_sierra_inst { struct phy *phy; @@ -439,25 +436,11 @@ static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw) { struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); - struct regmap_field *plllc1en_field = mux->plllc1en_field; - struct regmap_field *termen_field = mux->termen_field; struct regmap_field *field = mux->pfdclk_sel_preg; unsigned int val; - int index; regmap_field_read(field, &val); + return clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table, 0, val); - - if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) { - index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1], 0, val); - if (index == 1) { - regmap_field_write(plllc1en_field, 1); - regmap_field_write(termen_field, 1); - } - } else { - index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC], 0, val); - } - - return index; } static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) @@ -475,11 +458,7 @@ ret |= regmap_field_write(termen_field, 1); } + val = cdns_sierra_pll_mux_table[index]; - if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) - val = cdns_sierra_pll_mux_table[CMN_PLLLC1][index]; - else - val = cdns_sierra_pll_mux_table[CMN_PLLLC][index]; - ret |= regmap_field_write(field, val); return ret; @@ -517,8 +496,8 @@ for (i = 0; i < num_parents; i++) { clk = sp->input_clks[pll_mux_parent_index[clk_index][i]]; if (IS_ERR_OR_NULL(clk)) { + dev_err(dev, "No parent clock for derived_refclk\n"); + return PTR_ERR(clk); - dev_err(dev, "No parent clock for PLL mux clocks\n"); - return IS_ERR(clk) ? PTR_ERR(clk) : -ENOENT; } parent_names[i] = __clk_get_name(clk); } reverted: --- linux-aws-5.13-5.13.0/drivers/phy/mediatek/phy-mtk-mipi-dsi.c +++ linux-aws-5.13-5.13.0.orig/drivers/phy/mediatek/phy-mtk-mipi-dsi.c @@ -147,8 +147,6 @@ return -ENOMEM; mipi_tx->driver_data = of_device_get_match_data(dev); - if (!mipi_tx->driver_data) - return -ENODEV; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mipi_tx->regs = devm_ioremap_resource(dev, mem); reverted: --- linux-aws-5.13-5.13.0/drivers/phy/socionext/phy-uniphier-usb3ss.c +++ linux-aws-5.13-5.13.0.orig/drivers/phy/socionext/phy-uniphier-usb3ss.c @@ -22,13 +22,11 @@ #include #define SSPHY_TESTI 0x0 +#define SSPHY_TESTO 0x4 #define TESTI_DAT_MASK GENMASK(13, 6) #define TESTI_ADR_MASK GENMASK(5, 1) #define TESTI_WR_EN BIT(0) -#define SSPHY_TESTO 0x4 -#define TESTO_DAT_MASK GENMASK(7, 0) - #define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) } #define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */ @@ -86,12 +84,12 @@ val = FIELD_PREP(TESTI_DAT_MASK, 1); val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); + val = readl(priv->base + SSPHY_TESTO); - val = readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK; /* update value */ + val &= ~FIELD_PREP(TESTI_DAT_MASK, field_mask); - val &= ~field_mask; data = field_mask & (p->value << p->field.lsb); + val = FIELD_PREP(TESTI_DAT_MASK, data); - val = FIELD_PREP(TESTI_DAT_MASK, data | val); val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no); uniphier_u3ssphy_testio_write(priv, val); uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN); reverted: --- linux-aws-5.13-5.13.0/drivers/power/reset/mt6323-poweroff.c +++ linux-aws-5.13-5.13.0.orig/drivers/power/reset/mt6323-poweroff.c @@ -57,9 +57,6 @@ return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -EINVAL; - pwrc->base = res->start; pwrc->regmap = mt6397_chip->regmap; pwrc->dev = &pdev->dev; reverted: --- linux-aws-5.13-5.13.0/drivers/regulator/da9121-regulator.c +++ linux-aws-5.13-5.13.0.orig/drivers/regulator/da9121-regulator.c @@ -253,11 +253,6 @@ goto error; } - if (rdev->desc->ops->is_enabled(rdev)) { - ret = -EBUSY; - goto error; - } - ret = da9121_ceiling_selector(rdev, min_ua, max_ua, &sel); if (ret < 0) goto error; reverted: --- linux-aws-5.13-5.13.0/drivers/regulator/qcom-labibb-regulator.c +++ linux-aws-5.13-5.13.0.orig/drivers/regulator/qcom-labibb-regulator.c @@ -260,7 +260,7 @@ /* If the regulator is not enabled, this is a fake event */ if (!ops->is_enabled(vreg->rdev)) + return 0; - return IRQ_HANDLED; /* If we tried to recover for too many times it's not getting better */ if (vreg->ocp_irq_count > LABIBB_MAX_OCP_COUNT) reverted: --- linux-aws-5.13-5.13.0/drivers/regulator/qcom_smd-regulator.c +++ linux-aws-5.13-5.13.0.orig/drivers/regulator/qcom_smd-regulator.c @@ -9,7 +9,6 @@ #include #include #include -#include #include struct qcom_rpm_reg { @@ -1108,91 +1107,52 @@ }; MODULE_DEVICE_TABLE(of, rpm_of_match); +static int rpm_reg_probe(struct platform_device *pdev) -/** - * rpm_regulator_init_vreg() - initialize all attributes of a qcom_smd-regulator - * @vreg: Pointer to the individual qcom_smd-regulator resource - * @dev: Pointer to the top level qcom_smd-regulator PMIC device - * @node: Pointer to the individual qcom_smd-regulator resource - * device node - * @rpm: Pointer to the rpm bus node - * @pmic_rpm_data: Pointer to a null-terminated array of qcom_smd-regulator - * resources defined for the top level PMIC device - * - * Return: 0 on success, errno on failure - */ -static int rpm_regulator_init_vreg(struct qcom_rpm_reg *vreg, struct device *dev, - struct device_node *node, struct qcom_smd_rpm *rpm, - const struct rpm_regulator_data *pmic_rpm_data) { + const struct rpm_regulator_data *reg; + const struct of_device_id *match; + struct regulator_config config = { }; - struct regulator_config config = {}; - const struct rpm_regulator_data *rpm_data; struct regulator_dev *rdev; - int ret; - - for (rpm_data = pmic_rpm_data; rpm_data->name; rpm_data++) - if (of_node_name_eq(node, rpm_data->name)) - break; - - if (!rpm_data->name) { - dev_err(dev, "Unknown regulator %pOFn\n", node); - return -EINVAL; - } - - vreg->dev = dev; - vreg->rpm = rpm; - vreg->type = rpm_data->type; - vreg->id = rpm_data->id; - - memcpy(&vreg->desc, rpm_data->desc, sizeof(vreg->desc)); - vreg->desc.name = rpm_data->name; - vreg->desc.supply_name = rpm_data->supply; - vreg->desc.owner = THIS_MODULE; - vreg->desc.type = REGULATOR_VOLTAGE; - vreg->desc.of_match = rpm_data->name; - - config.dev = dev; - config.of_node = node; - config.driver_data = vreg; - - rdev = devm_regulator_register(dev, &vreg->desc, &config); - if (IS_ERR(rdev)) { - ret = PTR_ERR(rdev); - dev_err(dev, "%pOFn: devm_regulator_register() failed, ret=%d\n", node, ret); - return ret; - } - - return 0; -} - -static int rpm_reg_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - const struct rpm_regulator_data *vreg_data; - struct device_node *node; struct qcom_rpm_reg *vreg; struct qcom_smd_rpm *rpm; - int ret; rpm = dev_get_drvdata(pdev->dev.parent); if (!rpm) { + dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); - dev_err(&pdev->dev, "Unable to retrieve handle to rpm\n"); return -ENODEV; } + match = of_match_device(rpm_of_match, &pdev->dev); + if (!match) { + dev_err(&pdev->dev, "failed to match device\n"); - vreg_data = of_device_get_match_data(dev); - if (!vreg_data) return -ENODEV; + } + for (reg = match->data; reg->name; reg++) { - for_each_available_child_of_node(dev->of_node, node) { vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); if (!vreg) return -ENOMEM; + vreg->dev = &pdev->dev; + vreg->type = reg->type; + vreg->id = reg->id; + vreg->rpm = rpm; + + memcpy(&vreg->desc, reg->desc, sizeof(vreg->desc)); + + vreg->desc.id = -1; + vreg->desc.owner = THIS_MODULE; + vreg->desc.type = REGULATOR_VOLTAGE; + vreg->desc.name = reg->name; + vreg->desc.supply_name = reg->supply; + vreg->desc.of_match = reg->name; + + config.dev = &pdev->dev; + config.driver_data = vreg; + rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); + if (IS_ERR(rdev)) { + dev_err(&pdev->dev, "failed to register %s\n", reg->name); + return PTR_ERR(rdev); - ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); - - if (ret < 0) { - of_node_put(node); - return ret; } } diff -u linux-aws-5.13-5.13.0/drivers/remoteproc/imx_rproc.c linux-aws-5.13-5.13.0/drivers/remoteproc/imx_rproc.c --- linux-aws-5.13-5.13.0/drivers/remoteproc/imx_rproc.c +++ linux-aws-5.13-5.13.0/drivers/remoteproc/imx_rproc.c @@ -682,7 +682,6 @@ clk_disable_unprepare(priv->clk); rproc_del(rproc); imx_rproc_free_mbox(rproc); - destroy_workqueue(priv->workqueue); rproc_free(rproc); return 0; reverted: --- linux-aws-5.13-5.13.0/drivers/rpmsg/rpmsg_char.c +++ linux-aws-5.13-5.13.0.orig/drivers/rpmsg/rpmsg_char.c @@ -92,7 +92,7 @@ /* wake up any blocked readers */ wake_up_interruptible(&eptdev->readq); + device_del(&eptdev->dev); - cdev_device_del(&eptdev->cdev, &eptdev->dev); put_device(&eptdev->dev); return 0; @@ -335,6 +335,7 @@ ida_simple_remove(&rpmsg_ept_ida, dev->id); ida_simple_remove(&rpmsg_minor_ida, MINOR(eptdev->dev.devt)); + cdev_del(&eptdev->cdev); kfree(eptdev); } @@ -379,13 +380,19 @@ dev->id = ret; dev_set_name(dev, "rpmsg%d", ret); + ret = cdev_add(&eptdev->cdev, dev->devt, 1); - ret = cdev_device_add(&eptdev->cdev, &eptdev->dev); if (ret) goto free_ept_ida; /* We can now rely on the release function for cleanup */ dev->release = rpmsg_eptdev_release_device; + ret = device_add(dev); + if (ret) { + dev_err(dev, "device_add failed: %d\n", ret); + put_device(dev); + } + return ret; free_ept_ida: @@ -454,6 +461,7 @@ ida_simple_remove(&rpmsg_ctrl_ida, dev->id); ida_simple_remove(&rpmsg_minor_ida, MINOR(dev->devt)); + cdev_del(&ctrldev->cdev); kfree(ctrldev); } @@ -488,13 +496,19 @@ dev->id = ret; dev_set_name(&ctrldev->dev, "rpmsg_ctrl%d", ret); + ret = cdev_add(&ctrldev->cdev, dev->devt, 1); - ret = cdev_device_add(&ctrldev->cdev, &ctrldev->dev); if (ret) goto free_ctrl_ida; /* We can now rely on the release function for cleanup */ dev->release = rpmsg_ctrldev_release_device; + ret = device_add(dev); + if (ret) { + dev_err(&rpdev->dev, "device_add failed: %d\n", ret); + put_device(dev); + } + dev_set_drvdata(&rpdev->dev, ctrldev); return ret; @@ -520,7 +534,7 @@ if (ret) dev_warn(&rpdev->dev, "failed to nuke endpoints: %d\n", ret); + device_del(&ctrldev->dev); - cdev_device_del(&ctrldev->cdev, &ctrldev->dev); put_device(&ctrldev->dev); } reverted: --- linux-aws-5.13-5.13.0/drivers/rpmsg/rpmsg_core.c +++ linux-aws-5.13-5.13.0.orig/drivers/rpmsg/rpmsg_core.c @@ -517,25 +517,13 @@ err = rpdrv->probe(rpdev); if (err) { dev_err(dev, "%s: failed: %d\n", __func__, err); + if (ept) + rpmsg_destroy_ept(ept); + goto out; - goto destroy_ept; } + if (ept && rpdev->ops->announce_create) - if (ept && rpdev->ops->announce_create) { err = rpdev->ops->announce_create(rpdev); - if (err) { - dev_err(dev, "failed to announce creation\n"); - goto remove_rpdev; - } - } - - return 0; - -remove_rpdev: - if (rpdrv->remove) - rpdrv->remove(rpdev); -destroy_ept: - if (ept) - rpmsg_destroy_ept(ept); out: return err; } diff -u linux-aws-5.13-5.13.0/drivers/rtc/rtc-cmos.c linux-aws-5.13-5.13.0/drivers/rtc/rtc-cmos.c --- linux-aws-5.13-5.13.0/drivers/rtc/rtc-cmos.c +++ linux-aws-5.13-5.13.0/drivers/rtc/rtc-cmos.c @@ -463,10 +463,7 @@ min = t->time.tm_min; sec = t->time.tm_sec; - spin_lock_irq(&rtc_lock); rtc_control = CMOS_READ(RTC_CONTROL); - spin_unlock_irq(&rtc_lock); - if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { /* Writing 0xff means "don't care" or "match all". */ mon = (mon <= 12) ? bin2bcd(mon) : 0xff; reverted: --- linux-aws-5.13-5.13.0/drivers/rtc/rtc-pxa.c +++ linux-aws-5.13-5.13.0.orig/drivers/rtc/rtc-pxa.c @@ -330,10 +330,6 @@ if (sa1100_rtc->irq_alarm < 0) return -ENXIO; - sa1100_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); - if (IS_ERR(sa1100_rtc->rtc)) - return PTR_ERR(sa1100_rtc->rtc); - pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start, resource_size(pxa_rtc->ress)); if (!pxa_rtc->base) { reverted: --- linux-aws-5.13-5.13.0/drivers/s390/scsi/zfcp_fc.c +++ linux-aws-5.13-5.13.0.orig/drivers/s390/scsi/zfcp_fc.c @@ -521,8 +521,6 @@ goto out; } - /* re-init to undo drop from zfcp_fc_adisc() */ - port->d_id = ntoh24(adisc_resp->adisc_port_id); /* port is good, unblock rport without going through erp */ zfcp_scsi_schedule_rport_register(port); out: @@ -536,7 +534,6 @@ struct zfcp_fc_req *fc_req; struct zfcp_adapter *adapter = port->adapter; struct Scsi_Host *shost = adapter->scsi_host; - u32 d_id; int ret; fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC); @@ -561,15 +558,7 @@ fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); + ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els, - d_id = port->d_id; /* remember as destination for send els below */ - /* - * Force fresh GID_PN lookup on next port recovery. - * Must happen after request setup and before sending request, - * to prevent race with port->d_id re-init in zfcp_fc_adisc_handler(). - */ - port->d_id = 0; - - ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els, ZFCP_FC_CTELS_TMO); if (ret) kmem_cache_free(zfcp_fc_req_cache, fc_req); reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -82,7 +82,7 @@ static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba); static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface, struct device *parent, int npiv); +static void bnx2fc_destroy_work(struct work_struct *work); -static void bnx2fc_port_destroy(struct fcoe_port *port); static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev); static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device @@ -907,6 +907,9 @@ __bnx2fc_destroy(interface); } mutex_unlock(&bnx2fc_dev_lock); + + /* Ensure ALL destroy work has been completed before return */ + flush_workqueue(bnx2fc_wq); return; default: @@ -1212,8 +1215,8 @@ mutex_unlock(&n_port->lp_mutex); bnx2fc_free_vport(interface->hba, port->lport); bnx2fc_port_shutdown(port->lport); - bnx2fc_port_destroy(port); bnx2fc_interface_put(interface); + queue_work(bnx2fc_wq, &port->destroy_work); return 0; } @@ -1522,6 +1525,7 @@ port->lport = lport; port->priv = interface; port->get_netdev = bnx2fc_netdev; + INIT_WORK(&port->destroy_work, bnx2fc_destroy_work); /* Configure fcoe_port */ rc = bnx2fc_lport_config(lport); @@ -1649,8 +1653,8 @@ bnx2fc_interface_cleanup(interface); bnx2fc_stop(interface); list_del(&interface->list); - bnx2fc_port_destroy(port); bnx2fc_interface_put(interface); + queue_work(bnx2fc_wq, &port->destroy_work); } /** @@ -1690,12 +1694,15 @@ return rc; } +static void bnx2fc_destroy_work(struct work_struct *work) -static void bnx2fc_port_destroy(struct fcoe_port *port) { + struct fcoe_port *port; struct fc_lport *lport; + port = container_of(work, struct fcoe_port, destroy_work); lport = port->lport; + + BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n"); - BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport); bnx2fc_if_destroy(lport); } @@ -2549,6 +2556,9 @@ __bnx2fc_destroy(interface); mutex_unlock(&bnx2fc_dev_lock); + /* Ensure ALL destroy work has been completed before return */ + flush_workqueue(bnx2fc_wq); + bnx2fc_ulp_stop(hba); /* unregister cnic device */ if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc.h +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/lpfc/lpfc.h @@ -771,6 +771,7 @@ #define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ #define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */ +#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */ #define HBA_RECOVERABLE_UE 0x20000 /* Firmware supports recoverable UE */ #define HBA_FORCED_LINK_SPEED 0x40000 /* * Firmware supports Forced Link Speed @@ -783,7 +784,6 @@ #define HBA_HBEAT_TMO 0x8000000 /* HBEAT initiated after timeout */ #define HBA_FLOGI_OUTSTANDING 0x10000000 /* FLOGI is outstanding */ - struct completion *fw_dump_cmpl; /* cmpl event tracker for fw_dump */ uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p; diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_attr.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_attr.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_attr.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_attr.c @@ -1530,25 +1530,25 @@ before_fc_flag = phba->pport->fc_flag; sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; - if (opcode == LPFC_FW_DUMP) { - init_completion(&online_compl); - phba->fw_dump_cmpl = &online_compl; - } else { - /* Disable SR-IOV virtual functions if enabled */ - if (phba->cfg_sriov_nr_virtfn) { - pci_disable_sriov(pdev); - phba->cfg_sriov_nr_virtfn = 0; - } + /* Disable SR-IOV virtual functions if enabled */ + if (phba->cfg_sriov_nr_virtfn) { + pci_disable_sriov(pdev); + phba->cfg_sriov_nr_virtfn = 0; + } - status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); + if (opcode == LPFC_FW_DUMP) + phba->hba_flag |= HBA_FW_DUMP_OP; - if (status != 0) - return status; + status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); - /* wait for the device to be quiesced before firmware reset */ - msleep(100); + if (status != 0) { + phba->hba_flag &= ~HBA_FW_DUMP_OP; + return status; } + /* wait for the device to be quiesced before firmware reset */ + msleep(100); + reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); @@ -1577,42 +1577,24 @@ lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "3153 Fail to perform the requested " "access: x%x\n", reg_val); - if (phba->fw_dump_cmpl) - phba->fw_dump_cmpl = NULL; return rc; } /* keep the original port state */ - if (before_fc_flag & FC_OFFLINE_MODE) { - if (phba->fw_dump_cmpl) - phba->fw_dump_cmpl = NULL; + if (before_fc_flag & FC_OFFLINE_MODE) goto out; - } - /* Firmware dump will trigger an HA_ERATT event, and - * lpfc_handle_eratt_s4 routine already handles bringing the port back - * online. - */ - if (opcode == LPFC_FW_DUMP) { - wait_for_completion(phba->fw_dump_cmpl); - } else { - init_completion(&online_compl); - job_posted = lpfc_workq_post_event(phba, &status, &online_compl, - LPFC_EVT_ONLINE); - if (!job_posted) - goto out; + init_completion(&online_compl); + job_posted = lpfc_workq_post_event(phba, &status, &online_compl, + LPFC_EVT_ONLINE); + if (!job_posted) + goto out; + + wait_for_completion(&online_compl); - wait_for_completion(&online_compl); - } out: /* in any case, restore the virtual functions enabled as before */ if (sriov_nr_virtfn) { - /* If fw_dump was performed, first disable to clean up */ - if (opcode == LPFC_FW_DUMP) { - pci_disable_sriov(pdev); - phba->cfg_sriov_nr_virtfn = 0; - } - sriov_err = lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn); if (!sriov_err) diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_els.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_els.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_els.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_els.c @@ -3365,6 +3365,11 @@ return 1; } + /* This will cause the callback-function lpfc_cmpl_els_cmd to + * trigger the release of node. + */ + if (!(vport->fc_flag & FC_PT2PT)) + lpfc_nlp_put(ndlp); return 0; } @@ -6092,7 +6097,6 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context) { LPFC_MBOXQ_t *mbox = NULL; - struct lpfc_dmabuf *mp; int rc; mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); @@ -6108,11 +6112,8 @@ mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) { - mp = (struct lpfc_dmabuf *)mbox->ctx_buf; - lpfc_mbuf_free(phba, mp->virt, mp->phys); + if (rc == MBX_NOT_FINISHED) goto issue_mbox_fail; - } return 0; diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_hbadisc.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_hbadisc.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_hbadisc.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -635,16 +635,10 @@ if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) lpfc_sli4_post_async_mbox(phba); - if (ha_copy & HA_ERATT) { + if (ha_copy & HA_ERATT) /* Handle the error attention event */ lpfc_handle_eratt(phba); - if (phba->fw_dump_cmpl) { - complete(phba->fw_dump_cmpl); - phba->fw_dump_cmpl = NULL; - } - } - if (ha_copy & HA_MBATT) lpfc_sli_handle_mb_event(phba); diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_init.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_init.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_init.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_init.c @@ -5075,10 +5075,8 @@ */ if (!(phba->hba_flag & HBA_FCOE_MODE)) { rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) { - lpfc_mbuf_free(phba, mp->virt, mp->phys); + if (rc == MBX_NOT_FINISHED) goto out_free_dmabuf; - } return; } /* @@ -5387,10 +5385,8 @@ } rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); - if (rc == MBX_NOT_FINISHED) { - lpfc_mbuf_free(phba, mp->virt, mp->phys); + if (rc == MBX_NOT_FINISHED) goto out_free_dmabuf; - } return; out_free_dmabuf: diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_nportdisc.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_nportdisc.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_nportdisc.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -322,7 +322,6 @@ { struct lpfc_hba *phba = vport->phba; struct lpfc_dmabuf *pcmd; - struct lpfc_dmabuf *mp; uint64_t nlp_portwwn = 0; uint32_t *lp; IOCB_t *icmd; @@ -572,11 +571,6 @@ * a default RPI. */ if (phba->sli_rev == LPFC_SLI_REV4) { - mp = (struct lpfc_dmabuf *)login_mbox->ctx_buf; - if (mp) { - lpfc_mbuf_free(phba, mp->virt, mp->phys); - kfree(mp); - } mempool_free(login_mbox, phba->mbox_mem_pool); login_mbox = NULL; } else { diff -u linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_sli.c linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_sli.c --- linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_sli.c +++ linux-aws-5.13-5.13.0/drivers/scsi/lpfc/lpfc_sli.c @@ -4788,6 +4788,12 @@ phba->fcf.fcf_flag = 0; spin_unlock_irq(&phba->hbalock); + /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */ + if (phba->hba_flag & HBA_FW_DUMP_OP) { + phba->hba_flag &= ~HBA_FW_DUMP_OP; + return rc; + } + /* Now physically reset the device */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0389 Performing PCI function reset!\n"); diff -u linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr.h linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr.h --- linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr.h +++ linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr.h @@ -78,8 +78,7 @@ /* Operational queue management definitions */ #define MPI3MR_OP_REQ_Q_QD 512 -#define MPI3MR_OP_REP_Q_QD 1024 -#define MPI3MR_OP_REP_Q_QD4K 4096 +#define MPI3MR_OP_REP_Q_QD 4096 #define MPI3MR_OP_REQ_Q_SEG_SIZE 4096 #define MPI3MR_OP_REP_Q_SEG_SIZE 4096 #define MPI3MR_MAX_SEG_LIST_SIZE 4096 diff -u linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr_fw.c linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr_fw.c --- linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ linux-aws-5.13-5.13.0/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -1277,7 +1277,7 @@ mrioc->op_reply_qinfo[q_idx].q_segment_list = NULL; } } else - size = mrioc->req_qinfo[q_idx].segment_qd * + size = mrioc->req_qinfo[q_idx].num_requests * mrioc->facts.op_req_sz; for (j = 0; j < mrioc->req_qinfo[q_idx].num_segments; j++) { @@ -1564,8 +1564,6 @@ reply_qid = qidx + 1; op_reply_q->num_replies = MPI3MR_OP_REP_Q_QD; - if (!mrioc->pdev->revision) - op_reply_q->num_replies = MPI3MR_OP_REP_Q_QD4K; op_reply_q->ci = 0; op_reply_q->ephase = 1; atomic_set(&op_reply_q->pend_ios, 0); diff -u linux-aws-5.13-5.13.0/drivers/scsi/pm8001/pm8001_hwi.c linux-aws-5.13-5.13.0/drivers/scsi/pm8001/pm8001_hwi.c --- linux-aws-5.13-5.13.0/drivers/scsi/pm8001/pm8001_hwi.c +++ linux-aws-5.13-5.13.0/drivers/scsi/pm8001/pm8001_hwi.c @@ -1325,9 +1325,7 @@ int q_index = circularQ - pm8001_ha->inbnd_q_tbl; int rv = -1; - if (WARN_ON(q_index >= pm8001_ha->max_q_num)) - return -EINVAL; - + WARN_ON(q_index >= PM8001_MAX_INB_NUM); spin_lock_irqsave(&circularQ->iq_lock, flags); rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, &pMessage); diff -u linux-aws-5.13-5.13.0/drivers/scsi/scsi.c linux-aws-5.13-5.13.0/drivers/scsi/scsi.c --- linux-aws-5.13-5.13.0/drivers/scsi/scsi.c +++ linux-aws-5.13-5.13.0/drivers/scsi/scsi.c @@ -216,11 +216,11 @@ /* - * 1024 is big enough for saturating fast SCSI LUNs. + * 1024 is big enough for saturating the fast scsi LUN now */ int scsi_device_max_queue_depth(struct scsi_device *sdev) { - return min_t(int, sdev->host->can_queue, 1024); + return max_t(int, sdev->host->can_queue, 1024); } /** reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/scsi_debugfs.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/scsi_debugfs.c @@ -9,7 +9,6 @@ static const char *const scsi_cmd_flags[] = { SCSI_CMD_FLAG_NAME(TAGGED), SCSI_CMD_FLAG_NAME(INITIALIZED), - SCSI_CMD_FLAG_NAME(LAST), }; #undef SCSI_CMD_FLAG_NAME reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/scsi_pm.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/scsi_pm.c @@ -262,7 +262,7 @@ blk_pre_runtime_resume(sdev->request_queue); if (pm && pm->runtime_resume) err = pm->runtime_resume(dev); + blk_post_runtime_resume(sdev->request_queue, err); - blk_post_runtime_resume(sdev->request_queue); return err; } diff -u linux-aws-5.13-5.13.0/drivers/scsi/sr.c linux-aws-5.13-5.13.0/drivers/scsi/sr.c --- linux-aws-5.13-5.13.0/drivers/scsi/sr.c +++ linux-aws-5.13-5.13.0/drivers/scsi/sr.c @@ -900,7 +900,7 @@ /* allocate transfer buffer */ - buffer = kmalloc(512, GFP_KERNEL); + buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); if (!buffer) { sr_printk(KERN_ERR, cd, "out of memory.\n"); return; reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/sr_vendor.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/sr_vendor.c @@ -131,7 +131,7 @@ if (cd->vendor == VENDOR_TOSHIBA) density = (blocklength > 2048) ? 0x81 : 0x83; + buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); - buffer = kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; @@ -179,7 +179,7 @@ if (cd->cdi.mask & CDC_MULTI_SESSION) return 0; + buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); - buffer = kmalloc(512, GFP_KERNEL); if (!buffer) return -ENOMEM; reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/ufs/tc-dwc-g210-pci.c @@ -135,6 +135,7 @@ return err; } + pci_set_drvdata(pdev, hba); pm_runtime_put_noidle(&pdev->dev); pm_runtime_allow(&pdev->dev); reverted: --- linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufs-mediatek.c +++ linux-aws-5.13-5.13.0.orig/drivers/scsi/ufs/ufs-mediatek.c @@ -501,7 +501,7 @@ struct ufs_mtk_host *host = ufshcd_get_variant(hba); host->reg_va09 = regulator_get(hba->dev, "va09"); + if (!host->reg_va09) - if (IS_ERR(host->reg_va09)) dev_info(hba->dev, "failed to get va09"); else host->caps |= UFS_MTK_CAP_VA09_PWR_CTRL; diff -u linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pci.c linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pci.c --- linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pci.c +++ linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pci.c @@ -589,6 +589,8 @@ return err; } + pci_set_drvdata(pdev, hba); + hba->vops = (struct ufs_hba_variant_ops *)id->driver_data; err = ufshcd_init(hba, mmio_base, pdev->irq); diff -u linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pltfrm.c linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pltfrm.c --- linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pltfrm.c +++ linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -408,6 +408,8 @@ goto dealloc_host; } + platform_set_drvdata(pdev, hba); + pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); diff -u linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd.c linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd.c --- linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd.c +++ linux-aws-5.13-5.13.0/drivers/scsi/ufs/ufshcd.c @@ -1673,8 +1673,7 @@ bool flush_result; unsigned long flags; - if (!ufshcd_is_clkgating_allowed(hba) || - !hba->clk_gating.is_initialized) + if (!ufshcd_is_clkgating_allowed(hba)) goto out; spin_lock_irqsave(hba->host->host_lock, flags); hba->clk_gating.active_reqs++; @@ -1834,7 +1833,7 @@ if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL || - hba->outstanding_tasks || !hba->clk_gating.is_initialized || + hba->outstanding_tasks || hba->active_uic_cmd || hba->uic_async_done || hba->clk_gating.state == CLKS_OFF) return; @@ -1969,15 +1968,11 @@ { if (!hba->clk_gating.is_initialized) return; - ufshcd_remove_clk_gating_sysfs(hba); - - /* Ungate the clock if necessary. */ - ufshcd_hold(hba, false); - hba->clk_gating.is_initialized = false; - ufshcd_release(hba); - + cancel_work_sync(&hba->clk_gating.ungate_work); + cancel_delayed_work_sync(&hba->clk_gating.gate_work); destroy_workqueue(hba->clk_gating.clk_gating_workq); + hba->clk_gating.is_initialized = false; } /* Must be called with host lock acquired */ @@ -9250,13 +9245,6 @@ struct device *dev = hba->dev; char eh_wq_name[sizeof("ufs_eh_wq_00")]; - /* - * dev_set_drvdata() must be called before any callbacks are registered - * that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, - * sysfs). - */ - dev_set_drvdata(dev, hba); - if (!mmio_base) { dev_err(hba->dev, "Invalid memory reference for mmio_base is NULL\n"); reverted: --- linux-aws-5.13-5.13.0/drivers/soc/qcom/cpr.c +++ linux-aws-5.13-5.13.0.orig/drivers/soc/qcom/cpr.c @@ -1043,7 +1043,7 @@ return corner->uV; temp = f_diff * (uV_high - uV_low); + do_div(temp, f_high - f_low); - temp = div64_ul(temp, f_high - f_low); /* * max_volt_scale has units of uV/MHz while freq values reverted: --- linux-aws-5.13-5.13.0/drivers/soc/ti/pruss.c +++ linux-aws-5.13-5.13.0.orig/drivers/soc/ti/pruss.c @@ -129,7 +129,7 @@ clks_np = of_get_child_by_name(cfg_node, "clocks"); if (!clks_np) { + dev_err(dev, "%pOF is missing its 'clocks' node\n", clks_np); - dev_err(dev, "%pOF is missing its 'clocks' node\n", cfg_node); return -ENODEV; } reverted: --- linux-aws-5.13-5.13.0/drivers/spi/spi-meson-spifc.c +++ linux-aws-5.13-5.13.0.orig/drivers/spi/spi-meson-spifc.c @@ -349,7 +349,6 @@ return 0; out_clk: clk_disable_unprepare(spifc->clk); - pm_runtime_disable(spifc->dev); out_err: spi_master_put(master); return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/spi/spi-uniphier.c +++ linux-aws-5.13-5.13.0.orig/drivers/spi/spi-uniphier.c @@ -767,13 +767,12 @@ static int uniphier_spi_remove(struct platform_device *pdev) { + struct uniphier_spi_priv *priv = platform_get_drvdata(pdev); - struct spi_master *master = platform_get_drvdata(pdev); - struct uniphier_spi_priv *priv = spi_master_get_devdata(master); + if (priv->master->dma_tx) + dma_release_channel(priv->master->dma_tx); + if (priv->master->dma_rx) + dma_release_channel(priv->master->dma_rx); - if (master->dma_tx) - dma_release_channel(master->dma_tx); - if (master->dma_rx) - dma_release_channel(master->dma_rx); clk_disable_unprepare(priv->clk); diff -u linux-aws-5.13-5.13.0/drivers/staging/greybus/audio_topology.c linux-aws-5.13-5.13.0/drivers/staging/greybus/audio_topology.c --- linux-aws-5.13-5.13.0/drivers/staging/greybus/audio_topology.c +++ linux-aws-5.13-5.13.0/drivers/staging/greybus/audio_topology.c @@ -147,9 +147,6 @@ items = le32_to_cpu(gbenum->items); strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); - if (!strings) - return NULL; - data = gbenum->names; for (i = 0; i < items; i++) { @@ -658,8 +655,6 @@ /* since count=1, and reg is dummy */ gbe->items = le32_to_cpu(gb_enum->items); gbe->texts = gb_generate_enum_strings(gb, gb_enum); - if (!gbe->texts) - return -ENOMEM; /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items, @@ -867,8 +862,6 @@ /* since count=1, and reg is dummy */ gbe->items = le32_to_cpu(gb_enum->items); gbe->texts = gb_generate_enum_strings(gb, gb_enum); - if (!gbe->texts) - return -ENOMEM; /* debug enum info */ dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items, @@ -1079,10 +1072,6 @@ csize += le16_to_cpu(gbenum->names_length); control->texts = (const char * const *) gb_generate_enum_strings(module, gbenum); - if (!control->texts) { - ret = -ENOMEM; - goto error; - } control->items = le32_to_cpu(gbenum->items); } else { csize = sizeof(struct gb_audio_control); @@ -1192,10 +1181,6 @@ csize += le16_to_cpu(gbenum->names_length); control->texts = (const char * const *) gb_generate_enum_strings(module, gbenum); - if (!control->texts) { - ret = -ENOMEM; - goto error; - } control->items = le32_to_cpu(gbenum->items); } else { csize = sizeof(struct gb_audio_control); reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/i2c/ov2680.h +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/i2c/ov2680.h @@ -289,6 +289,8 @@ */ static struct ov2680_reg const ov2680_QCIF_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x24}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -332,6 +334,8 @@ */ static struct ov2680_reg const ov2680_CIF_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x24}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -373,6 +377,8 @@ */ static struct ov2680_reg const ov2680_QVGA_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x24}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -414,6 +420,8 @@ */ static struct ov2680_reg const ov2680_656x496_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x24}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -455,6 +463,8 @@ */ static struct ov2680_reg const ov2680_720x592_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x26}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0x00}, // X_ADDR_START; {0x3802, 0x00}, @@ -498,6 +508,8 @@ */ static struct ov2680_reg const ov2680_800x600_30fps[] = { {0x3086, 0x01}, + {0x3501, 0x26}, + {0x3502, 0x40}, {0x370a, 0x23}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -539,6 +551,8 @@ */ static struct ov2680_reg const ov2680_720p_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -580,6 +594,8 @@ */ static struct ov2680_reg const ov2680_1296x976_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0xa0}, {0x3802, 0x00}, @@ -621,6 +637,8 @@ */ static struct ov2680_reg const ov2680_1456x1096_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x90}, {0x3802, 0x00}, @@ -664,6 +682,8 @@ static struct ov2680_reg const ov2680_1616x916_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -706,6 +726,8 @@ #if 0 static struct ov2680_reg const ov2680_1616x1082_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, @@ -747,6 +769,8 @@ */ static struct ov2680_reg const ov2680_1616x1216_30fps[] = { {0x3086, 0x00}, + {0x3501, 0x48}, + {0x3502, 0xe0}, {0x370a, 0x21}, {0x3801, 0x00}, {0x3802, 0x00}, reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1138,10 +1138,9 @@ asd->frame_status[vb->i] = ATOMISP_FRAME_STATUS_OK; } + } else - } else { asd->frame_status[vb->i] = ATOMISP_FRAME_STATUS_OK; - } } else { asd->frame_status[vb->i] = ATOMISP_FRAME_STATUS_OK; } @@ -1715,12 +1714,6 @@ { unsigned long next; - if (!pipe->asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, pipe->vdev.name); - return; - } - if (delay != ATOMISP_WDT_KEEP_CURRENT_DELAY) pipe->wdt_duration = delay; @@ -1783,12 +1776,6 @@ /* ISP2401 */ void atomisp_wdt_stop_pipe(struct atomisp_video_pipe *pipe, bool sync) { - if (!pipe->asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, pipe->vdev.name); - return; - } - if (!atomisp_is_wdt_running(pipe)) return; @@ -4121,12 +4108,6 @@ unsigned long irqflags; bool need_to_enqueue_buffer = false; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, pipe->vdev.name); - return; - } - if (atomisp_is_vf_pipe(pipe)) return; @@ -4214,12 +4195,6 @@ struct atomisp_css_params *css_param = &asd->params.css_param; int ret; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (!asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream) { dev_err(asd->isp->dev, "%s: internal error!\n", __func__); return -EINVAL; @@ -4878,12 +4853,6 @@ int source_pad = atomisp_subdev_source_pad(vdev); int ret; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (!isp->inputs[asd->input_curr].camera) return -EINVAL; @@ -4972,9 +4941,9 @@ depth = get_pixel_depth(pixelformat); + if (field == V4L2_FIELD_ANY) - if (field == V4L2_FIELD_ANY) { field = V4L2_FIELD_NONE; + else if (field != V4L2_FIELD_NONE) { - } else if (field != V4L2_FIELD_NONE) { dev_err(isp->dev, "Wrong output field\n"); return -EINVAL; } @@ -5221,17 +5190,10 @@ int (*configure_pp_input)(struct atomisp_sub_device *asd, unsigned int width, unsigned int height) = configure_pp_input_nop; + u16 stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); - u16 stream_index; const struct atomisp_in_fmt_conv *fc; int ret, i; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); - v4l2_fh_init(&fh.vfh, vdev); isp_sink_crop = atomisp_subdev_get_rect( @@ -5527,8 +5489,7 @@ unsigned int padding_w, unsigned int padding_h, unsigned int dvs_env_w, unsigned int dvs_env_h) { + struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; - struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - struct atomisp_sub_device *asd = pipe->asd; const struct atomisp_format_bridge *format; struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_format vformat = { @@ -5536,7 +5497,7 @@ }; struct v4l2_mbus_framefmt *ffmt = &vformat.format; struct v4l2_mbus_framefmt *req_ffmt; + struct atomisp_device *isp = asd->isp; - struct atomisp_device *isp; struct atomisp_input_stream_info *stream_info = (struct atomisp_input_stream_info *)ffmt->reserved; u16 stream_index = ATOMISP_INPUT_STREAM_GENERAL; @@ -5544,14 +5505,6 @@ struct v4l2_subdev_fh fh; int ret; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - - isp = asd->isp; - v4l2_fh_init(&fh.vfh, vdev); stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); @@ -5642,12 +5595,6 @@ struct v4l2_subdev_fh fh; int ret; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (source_pad >= ATOMISP_SUBDEV_PADS_NUM) return -EINVAL; @@ -6080,12 +6027,6 @@ struct v4l2_subdev_fh fh; int ret; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - v4l2_fh_init(&fh.vfh, vdev); dev_dbg(isp->dev, "setting fmt %ux%u 0x%x for file inject\n", @@ -6410,12 +6351,6 @@ { struct atomisp_sub_device *asd = pipe->asd; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, pipe->vdev.name); - return false; - } - if (pipe == &asd->video_out_vf) return true; @@ -6629,23 +6564,17 @@ { struct atomisp_sub_device *asd = pipe->asd; + if (ATOMISP_USE_YUVPP(asd)) - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, pipe->vdev.name); - return -EINVAL; - } - - if (ATOMISP_USE_YUVPP(asd)) { return IA_CSS_PIPE_ID_YUVPP; + else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_SCALER) - } else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_SCALER) { return IA_CSS_PIPE_ID_VIDEO; + else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_LOWLAT) - } else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_LOWLAT) { return IA_CSS_PIPE_ID_CAPTURE; + else if (pipe == &asd->video_out_video_capture) - } else if (pipe == &asd->video_out_video_capture) { return IA_CSS_PIPE_ID_VIDEO; + else if (pipe == &asd->video_out_vf) - } else if (pipe == &asd->video_out_vf) { return IA_CSS_PIPE_ID_CAPTURE; + else if (pipe == &asd->video_out_preview) { - } else if (pipe == &asd->video_out_preview) { if (asd->run_mode->val == ATOMISP_RUN_MODE_VIDEO) return IA_CSS_PIPE_ID_VIDEO; else @@ -6672,12 +6601,6 @@ struct ia_css_pipe_info p_info; int ret; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (asd->isp->inputs[asd->input_curr].camera_caps-> sensor[asd->sensor_curr].stream_num > 1) { /* External ISP */ reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -877,11 +877,6 @@ else pipe->users++; rt_mutex_unlock(&isp->mutex); - - /* Ensure that a mode is set */ - if (asd) - v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode); - return 0; css_error: @@ -1176,12 +1171,6 @@ u32 origin_size, new_size; int ret; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (!(vma->vm_flags & (VM_WRITE | VM_READ))) return -EACCES; reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -481,7 +481,7 @@ static u8 gmin_get_pmic_id_and_addr(struct device *dev) { + struct i2c_client *power; - struct i2c_client *power = NULL; static u8 pmic_i2c_addr; if (pmic_id) reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -646,12 +646,6 @@ struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - rt_mutex_lock(&isp->mutex); *input = asd->input_curr; rt_mutex_unlock(&isp->mutex); @@ -671,12 +665,6 @@ struct v4l2_subdev *motor; int ret; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - rt_mutex_lock(&isp->mutex); if (input >= ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) { dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt); @@ -773,33 +761,18 @@ struct video_device *vdev = video_devdata(file); struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; + struct v4l2_subdev_mbus_code_enum code = { 0 }; - struct v4l2_subdev_mbus_code_enum code = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_subdev *camera; unsigned int i, fi = 0; int rval; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - - camera = isp->inputs[asd->input_curr].camera; - if(!camera) { - dev_err(isp->dev, "%s(): camera is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - rt_mutex_lock(&isp->mutex); + rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad, + enum_mbus_code, NULL, &code); - - rval = v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code); if (rval == -ENOIOCTLCMD) { dev_warn(isp->dev, + "enum_mbus_code pad op not supported. Please fix your sensor driver!\n"); + // rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, + // video, enum_mbus_fmt, 0, &code.code); - "enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n", - camera->name); } rt_mutex_unlock(&isp->mutex); @@ -829,8 +802,6 @@ f->pixelformat = format->pixelformat; return 0; } - dev_err(isp->dev, "%s(): format for code %x not found.\n", - __func__, code.code); return -EINVAL; } @@ -863,72 +834,6 @@ return 0; } -static int atomisp_adjust_fmt(struct v4l2_format *f) -{ - const struct atomisp_format_bridge *format_bridge; - u32 padded_width; - - format_bridge = atomisp_get_format_bridge(f->fmt.pix.pixelformat); - - padded_width = f->fmt.pix.width + pad_w; - - if (format_bridge->planar) { - f->fmt.pix.bytesperline = padded_width; - f->fmt.pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height * - DIV_ROUND_UP(format_bridge->depth * - padded_width, 8)); - } else { - f->fmt.pix.bytesperline = DIV_ROUND_UP(format_bridge->depth * - padded_width, 8); - f->fmt.pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height * f->fmt.pix.bytesperline); - } - - if (f->fmt.pix.field == V4L2_FIELD_ANY) - f->fmt.pix.field = V4L2_FIELD_NONE; - - format_bridge = atomisp_get_format_bridge(f->fmt.pix.pixelformat); - if (!format_bridge) - return -EINVAL; - - /* Currently, raw formats are broken!!! */ - if (format_bridge->sh_fmt == IA_CSS_FRAME_FORMAT_RAW) { - f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420; - - format_bridge = atomisp_get_format_bridge(f->fmt.pix.pixelformat); - if (!format_bridge) - return -EINVAL; - } - - padded_width = f->fmt.pix.width + pad_w; - - if (format_bridge->planar) { - f->fmt.pix.bytesperline = padded_width; - f->fmt.pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height * - DIV_ROUND_UP(format_bridge->depth * - padded_width, 8)); - } else { - f->fmt.pix.bytesperline = DIV_ROUND_UP(format_bridge->depth * - padded_width, 8); - f->fmt.pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height * f->fmt.pix.bytesperline); - } - - if (f->fmt.pix.field == V4L2_FIELD_ANY) - f->fmt.pix.field = V4L2_FIELD_NONE; - - /* - * FIXME: do we need to setup this differently, depending on the - * sensor or the pipeline? - */ - f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709; - f->fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_709; - f->fmt.pix.xfer_func = V4L2_XFER_FUNC_709; - - f->fmt.pix.width -= pad_w; - f->fmt.pix.height -= pad_h; - - return 0; -} - /* This function looks up the closest available resolution. */ static int atomisp_try_fmt_cap(struct file *file, void *fh, struct v4l2_format *f) @@ -940,11 +845,7 @@ rt_mutex_lock(&isp->mutex); ret = atomisp_try_fmt(vdev, &f->fmt.pix, NULL); rt_mutex_unlock(&isp->mutex); + return ret; - - if (ret) - return ret; - - return atomisp_adjust_fmt(f); } static int atomisp_s_fmt_cap(struct file *file, void *fh, @@ -1123,16 +1024,9 @@ struct ia_css_frame *frame; struct videobuf_vmalloc_memory *vm_mem; u16 source_pad = atomisp_subdev_source_pad(vdev); + u16 stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); - u16 stream_id; int ret = 0, i = 0; - if (!asd) { - dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - stream_id = atomisp_source_pad_to_stream_id(asd, source_pad); - if (req->count == 0) { mutex_lock(&pipe->capq.vb_lock); if (!list_empty(&pipe->capq.stream)) @@ -1260,12 +1154,6 @@ u32 pgnr; int ret = 0; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - rt_mutex_lock(&isp->mutex); if (isp->isp_fatal_error) { ret = -EIO; @@ -1501,12 +1389,6 @@ struct atomisp_device *isp = video_get_drvdata(vdev); int ret = 0; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - rt_mutex_lock(&isp->mutex); if (isp->isp_fatal_error) { @@ -1758,12 +1640,6 @@ int ret = 0; unsigned long irqflags; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - dev_dbg(isp->dev, "Start stream on pad %d for asd%d\n", atomisp_subdev_source_pad(vdev), asd->index); @@ -2025,12 +1901,6 @@ unsigned long flags; bool first_streamoff = false; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - dev_dbg(isp->dev, "Stop stream on pad %d for asd%d\n", atomisp_subdev_source_pad(vdev), asd->index); @@ -2280,12 +2150,6 @@ struct atomisp_device *isp = video_get_drvdata(vdev); int i, ret = -EINVAL; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - for (i = 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id == control->id) { ret = 0; @@ -2365,12 +2229,6 @@ struct atomisp_device *isp = video_get_drvdata(vdev); int i, ret = -EINVAL; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - for (i = 0; i < ctrls_num; i++) { if (ci_v4l2_controls[i].id == control->id) { ret = 0; @@ -2452,12 +2310,6 @@ struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_device *isp = video_get_drvdata(vdev); - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - switch (qc->id) { case V4L2_CID_FOCUS_ABSOLUTE: case V4L2_CID_FOCUS_RELATIVE: @@ -2503,12 +2355,6 @@ int i; int ret = 0; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (!IS_ISP2401) motor = isp->inputs[asd->input_curr].motor; else @@ -2620,12 +2466,6 @@ int i; int ret = 0; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (!IS_ISP2401) motor = isp->inputs[asd->input_curr].motor; else @@ -2751,12 +2591,6 @@ struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_device *isp = video_get_drvdata(vdev); - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; @@ -2779,12 +2613,6 @@ int rval; int fps; - if (!asd) { - dev_err(isp->dev, "%s(): asd is NULL, device is %s\n", - __func__, vdev->name); - return -EINVAL; - } - if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -1158,28 +1158,23 @@ atomisp_init_acc_pipe(asd, &asd->video_acc); + ret = atomisp_video_init(&asd->video_in, "MEMORY"); - ret = atomisp_video_init(&asd->video_in, "MEMORY", - ATOMISP_RUN_MODE_SDV); if (ret < 0) return ret; + ret = atomisp_video_init(&asd->video_out_capture, "CAPTURE"); - ret = atomisp_video_init(&asd->video_out_capture, "CAPTURE", - ATOMISP_RUN_MODE_STILL_CAPTURE); if (ret < 0) return ret; + ret = atomisp_video_init(&asd->video_out_vf, "VIEWFINDER"); - ret = atomisp_video_init(&asd->video_out_vf, "VIEWFINDER", - ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE); if (ret < 0) return ret; + ret = atomisp_video_init(&asd->video_out_preview, "PREVIEW"); - ret = atomisp_video_init(&asd->video_out_preview, "PREVIEW", - ATOMISP_RUN_MODE_PREVIEW); if (ret < 0) return ret; + ret = atomisp_video_init(&asd->video_out_video_capture, "VIDEO"); - ret = atomisp_video_init(&asd->video_out_video_capture, "VIDEO", - ATOMISP_RUN_MODE_VIDEO); if (ret < 0) return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -81,9 +81,6 @@ /* the link list to store per_frame parameters */ struct list_head per_frame_params; - /* Store here the initial run mode */ - unsigned int default_run_mode; - unsigned int buffers_in_css; /* irq_lock is used to protect video buffer state change operations and diff -u linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_v4l2.c linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_v4l2.c --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -447,8 +447,7 @@ .dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc), }; -int atomisp_video_init(struct atomisp_video_pipe *video, const char *name, - unsigned int run_mode) +int atomisp_video_init(struct atomisp_video_pipe *video, const char *name) { int ret; const char *direction; @@ -479,7 +478,6 @@ "ATOMISP ISP %s %s", name, direction); video->vdev.release = video_device_release_empty; video_set_drvdata(&video->vdev, video->isp); - video->default_run_mode = run_mode; return 0; } @@ -713,15 +711,15 @@ dev_dbg(isp->dev, "IUNIT power-%s.\n", enable ? "on" : "off"); - /* WA for P-Unit, if DVFS enabled, ISP timeout observed */ + /*WA:Enable DVFS*/ if (IS_CHT && enable) - punit_ddr_dvfs_enable(false); + punit_ddr_dvfs_enable(true); /* * FIXME:WA for ECS28A, with this sleep, CTS * android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceAbort * PASS, no impact on other platforms - */ + */ if (IS_BYT && enable) msleep(10); @@ -729,7 +727,7 @@ iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, val, MRFLD_ISPSSPM0_ISPSSC_MASK); - /* WA:Enable DVFS */ + /*WA:Enable DVFS*/ if (IS_CHT && !enable) punit_ddr_dvfs_enable(true); @@ -1184,7 +1182,6 @@ v4l2_device_unregister(&isp->v4l2_dev); media_device_unregister(&isp->media_dev); - media_device_cleanup(&isp->media_dev); } static int atomisp_register_entities(struct atomisp_device *isp) reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/atomisp_v4l2.h +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/atomisp_v4l2.h @@ -27,8 +27,7 @@ struct atomisp_device; struct firmware; +int atomisp_video_init(struct atomisp_video_pipe *video, const char *name); -int atomisp_video_init(struct atomisp_video_pipe *video, const char *name, - unsigned int run_mode); void atomisp_acc_init(struct atomisp_acc_pipe *video, const char *name); void atomisp_video_unregister(struct atomisp_video_pipe *video); void atomisp_acc_unregister(struct atomisp_acc_pipe *video); reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/sh_css.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/sh_css.c @@ -524,7 +524,6 @@ return bpp; } -/* TODO: move define to proper file in tools */ #define GP_ISEL_TPG_MODE 0x90058 #if !defined(ISP2401) @@ -577,8 +576,12 @@ vblank_cycles = vblank_lines * (width + hblank_cycles); sh_css_sp_configure_sync_gen(width, height, hblank_cycles, vblank_cycles); + if (!IS_ISP2401) { + if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) { + /* TODO: move define to proper file in tools */ + ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); + } + } - if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) - ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_config_input_network() leave:\n"); @@ -1013,14 +1016,16 @@ * ia_css_isys_stream_capture_indication() instead of * ia_css_pipeline_sp_wait_for_isys_stream_N() as isp processing of * capture takes longer than getting an ISYS frame + * + * Only 2401 relevant ?? */ +#if 0 // FIXME: NOT USED on Yocto Aero + isys_stream_descr->polling_mode + = early_polling ? INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST + : INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME; + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, + "sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n"); +#endif - if (IS_ISP2401) { - isys_stream_descr->polling_mode - = early_polling ? INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST - : INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME; - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, - "sh_css_translate_stream_cfg_to_isys_stream_descr() leave:\n"); - } return rc; } @@ -1443,7 +1448,7 @@ assert(me); /* all callers are in this file and call with non null argument */ + if (!IS_ISP2401) { - if (IS_ISP2401) { coord = &me->config.internal_frame_origin_bqs_on_sctbl; params = me->stream->isp_params_configs; } reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -378,17 +378,17 @@ { if (!IS_ISP2401) { if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) + return false; + else return true; - else - return false; } if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR || pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG || pipe->stream->config.mode == IA_CSS_INPUT_MODE_PRBS) + return false; - return true; + return true; - return false; } int @@ -428,17 +428,14 @@ return 0; /* AM TODO: Check */ } + if (!IS_ISP2401) - if (!IS_ISP2401) { port = (unsigned int)pipe->stream->config.source.port.port; + else + err = ia_css_mipi_is_source_port_valid(pipe, &port); - } else { - /* Returns true if port is valid. So, invert it */ - err = !ia_css_mipi_is_source_port_valid(pipe, &port); - } assert(port < N_CSI_PORTS); + if (port >= N_CSI_PORTS || err) { - if ((!IS_ISP2401 && port >= N_CSI_PORTS) || - (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n", pipe, port); @@ -563,17 +560,14 @@ return err; } + if (!IS_ISP2401) - if (!IS_ISP2401) { port = (unsigned int)pipe->stream->config.source.port.port; + else + err = ia_css_mipi_is_source_port_valid(pipe, &port); - } else { - /* Returns true if port is valid. So, invert it */ - err = !ia_css_mipi_is_source_port_valid(pipe, &port); - } assert(port < N_CSI_PORTS); + if (port >= N_CSI_PORTS || err) { - if ((!IS_ISP2401 && port >= N_CSI_PORTS) || - (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\n", pipe, port); @@ -678,17 +672,14 @@ /* TODO: AM: maybe this should be returning an error. */ } + if (!IS_ISP2401) - if (!IS_ISP2401) { port = (unsigned int)pipe->stream->config.source.port.port; + else + err = ia_css_mipi_is_source_port_valid(pipe, &port); - } else { - /* Returns true if port is valid. So, invert it */ - err = !ia_css_mipi_is_source_port_valid(pipe, &port); - } assert(port < N_CSI_PORTS); + if (port >= N_CSI_PORTS || err) { - if ((!IS_ISP2401 && port >= N_CSI_PORTS) || - (IS_ISP2401 && err)) { IA_CSS_ERROR("send_mipi_frames(%p) exit: invalid port specified (port=%d).\n", pipe, port); return err; reverted: --- linux-aws-5.13-5.13.0/drivers/staging/media/atomisp/pci/sh_css_params.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -2436,7 +2436,7 @@ unsigned int i; struct sh_css_ddr_address_map *ddr_ptrs; struct sh_css_ddr_address_map_size *ddr_ptrs_size; + int err = 0; - int err; size_t params_size; struct ia_css_isp_parameters *params = kvmalloc(sizeof(struct ia_css_isp_parameters), GFP_KERNEL); @@ -2481,11 +2481,7 @@ succ &= (ddr_ptrs->macc_tbl != mmgr_NULL); *isp_params_out = params; + return err; - - if (!succ) - return -ENOMEM; - - return 0; } static bool diff -u linux-aws-5.13-5.13.0/drivers/staging/media/hantro/hantro_drv.c linux-aws-5.13-5.13.0/drivers/staging/media/hantro/hantro_drv.c --- linux-aws-5.13-5.13.0/drivers/staging/media/hantro/hantro_drv.c +++ linux-aws-5.13-5.13.0/drivers/staging/media/hantro/hantro_drv.c @@ -829,7 +829,7 @@ ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks); if (ret) { dev_err(&pdev->dev, "Failed to prepare clocks\n"); - goto err_pm_disable; + return ret; } ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev); @@ -885,7 +885,6 @@ v4l2_device_unregister(&vpu->v4l2_dev); err_clk_unprepare: clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); -err_pm_disable: pm_runtime_dont_use_autosuspend(vpu->dev); pm_runtime_disable(vpu->dev); return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/staging/rtl8192e/rtllib.h +++ linux-aws-5.13-5.13.0.orig/drivers/staging/rtl8192e/rtllib.h @@ -1982,7 +1982,7 @@ void rtllib_stop_send_beacons(struct rtllib_device *ieee); void notify_wx_assoc_event(struct rtllib_device *ieee); void rtllib_start_ibss(struct rtllib_device *ieee); +void rtllib_softmac_init(struct rtllib_device *ieee); -int rtllib_softmac_init(struct rtllib_device *ieee); void rtllib_softmac_free(struct rtllib_device *ieee); void rtllib_disassociate(struct rtllib_device *ieee); void rtllib_stop_scan(struct rtllib_device *ieee); reverted: --- linux-aws-5.13-5.13.0/drivers/staging/rtl8192e/rtllib_module.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/rtl8192e/rtllib_module.c @@ -88,7 +88,7 @@ err = rtllib_networks_allocate(ieee); if (err) { pr_err("Unable to allocate beacon storage: %d\n", err); + goto failed; - goto free_netdev; } rtllib_networks_initialize(ieee); @@ -121,13 +121,11 @@ ieee->hwsec_active = 0; memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); + rtllib_softmac_init(ieee); - err = rtllib_softmac_init(ieee); - if (err) - goto free_crypt_info; ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); if (!ieee->pHTInfo) + return NULL; - goto free_softmac; HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); @@ -143,14 +141,8 @@ return dev; + failed: -free_softmac: - rtllib_softmac_free(ieee); -free_crypt_info: - lib80211_crypt_info_free(&ieee->crypt_info); - rtllib_networks_free(ieee); -free_netdev: free_netdev(dev); - return NULL; } EXPORT_SYMBOL(alloc_rtllib); reverted: --- linux-aws-5.13-5.13.0/drivers/staging/rtl8192e/rtllib_softmac.c +++ linux-aws-5.13-5.13.0.orig/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2952,7 +2952,7 @@ } } +void rtllib_softmac_init(struct rtllib_device *ieee) -int rtllib_softmac_init(struct rtllib_device *ieee) { int i; @@ -2963,8 +2963,7 @@ ieee->seq_ctrl[i] = 0; ieee->dot11d_info = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); if (!ieee->dot11d_info) + netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n"); - return -ENOMEM; - ieee->LinkDetectInfo.SlotIndex = 0; ieee->LinkDetectInfo.SlotNum = 2; ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0; @@ -3030,7 +3029,6 @@ tasklet_setup(&ieee->ps_task, rtllib_sta_ps); - return 0; } void rtllib_softmac_free(struct rtllib_device *ieee) reverted: --- linux-aws-5.13-5.13.0/drivers/tee/tee_core.c +++ linux-aws-5.13-5.13.0.orig/drivers/tee/tee_core.c @@ -98,10 +98,8 @@ static void teedev_close_context(struct tee_context *ctx) { + tee_device_put(ctx->teedev); - struct tee_device *teedev = ctx->teedev; - teedev_ctx_put(ctx); - tee_device_put(teedev); } static int tee_open(struct inode *inode, struct file *filp) reverted: --- linux-aws-5.13-5.13.0/drivers/thermal/imx8mm_thermal.c +++ linux-aws-5.13-5.13.0.orig/drivers/thermal/imx8mm_thermal.c @@ -21,7 +21,6 @@ #define TPS 0x4 #define TRITSR 0x20 /* TMU immediate temp */ -#define TER_ADC_PD BIT(30) #define TER_EN BIT(31) #define TRITSR_TEMP0_VAL_MASK 0xff #define TRITSR_TEMP1_VAL_MASK 0xff0000 @@ -114,8 +113,6 @@ val = readl_relaxed(tmu->base + TER); val = enable ? (val | TER_EN) : (val & ~TER_EN); - if (tmu->socdata->version == TMU_VER2) - val = enable ? (val & ~TER_ADC_PD) : (val | TER_ADC_PD); writel_relaxed(val, tmu->base + TER); } reverted: --- linux-aws-5.13-5.13.0/drivers/thermal/imx_thermal.c +++ linux-aws-5.13-5.13.0.orig/drivers/thermal/imx_thermal.c @@ -15,7 +15,6 @@ #include #include #include -#include #define REG_SET 0x4 #define REG_CLR 0x8 @@ -195,7 +194,6 @@ }; struct imx_thermal_data { - struct device *dev; struct cpufreq_policy *policy; struct thermal_zone_device *tz; struct thermal_cooling_device *cdev; @@ -254,15 +252,44 @@ const struct thermal_soc_data *soc_data = data->socdata; struct regmap *map = data->tempmon; unsigned int n_meas; + bool wait, run_measurement; u32 val; - int ret; + run_measurement = !data->irq_enabled; + if (!run_measurement) { + /* Check if a measurement is currently in progress */ + regmap_read(map, soc_data->temp_data, &val); + wait = !(val & soc_data->temp_valid_mask); + } else { + /* + * Every time we measure the temperature, we will power on the + * temperature sensor, enable measurements, take a reading, + * disable measurements, power off the temperature sensor. + */ + regmap_write(map, soc_data->sensor_ctrl + REG_CLR, + soc_data->power_down_mask); + regmap_write(map, soc_data->sensor_ctrl + REG_SET, + soc_data->measure_temp_mask); + + wait = true; + } + + /* + * According to the temp sensor designers, it may require up to ~17us + * to complete a measurement. + */ + if (wait) + usleep_range(20, 50); - ret = pm_runtime_resume_and_get(data->dev); - if (ret < 0) - return ret; regmap_read(map, soc_data->temp_data, &val); + if (run_measurement) { + regmap_write(map, soc_data->sensor_ctrl + REG_CLR, + soc_data->measure_temp_mask); + regmap_write(map, soc_data->sensor_ctrl + REG_SET, + soc_data->power_down_mask); + } + if ((val & soc_data->temp_valid_mask) == 0) { dev_dbg(&tz->device, "temp measurement never finished\n"); return -EAGAIN; @@ -301,8 +328,6 @@ enable_irq(data->irq); } - pm_runtime_put(data->dev); - return 0; } @@ -310,16 +335,24 @@ enum thermal_device_mode mode) { struct imx_thermal_data *data = tz->devdata; + struct regmap *map = data->tempmon; + const struct thermal_soc_data *soc_data = data->socdata; if (mode == THERMAL_DEVICE_ENABLED) { + regmap_write(map, soc_data->sensor_ctrl + REG_CLR, + soc_data->power_down_mask); + regmap_write(map, soc_data->sensor_ctrl + REG_SET, + soc_data->measure_temp_mask); - pm_runtime_get(data->dev); if (!data->irq_enabled) { data->irq_enabled = true; enable_irq(data->irq); } } else { + regmap_write(map, soc_data->sensor_ctrl + REG_CLR, + soc_data->measure_temp_mask); + regmap_write(map, soc_data->sensor_ctrl + REG_SET, + soc_data->power_down_mask); - pm_runtime_put(data->dev); if (data->irq_enabled) { disable_irq(data->irq); @@ -360,11 +393,6 @@ int temp) { struct imx_thermal_data *data = tz->devdata; - int ret; - - ret = pm_runtime_resume_and_get(data->dev); - if (ret < 0) - return ret; /* do not allow changing critical threshold */ if (trip == IMX_TRIP_CRITICAL) @@ -378,8 +406,6 @@ imx_set_alarm_temp(data, temp); - pm_runtime_put(data->dev); - return 0; } @@ -655,8 +681,6 @@ if (!data) return -ENOMEM; - data->dev = &pdev->dev; - map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon"); if (IS_ERR(map)) { ret = PTR_ERR(map); @@ -776,16 +800,6 @@ data->socdata->power_down_mask); regmap_write(map, data->socdata->sensor_ctrl + REG_SET, data->socdata->measure_temp_mask); - /* After power up, we need a delay before first access can be done. */ - usleep_range(20, 50); - - /* the core was configured and enabled just before */ - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(data->dev); - - ret = pm_runtime_resume_and_get(data->dev); - if (ret < 0) - goto disable_runtime_pm; data->irq_enabled = true; ret = thermal_zone_device_enable(data->tz); @@ -800,15 +814,10 @@ goto thermal_zone_unregister; } - pm_runtime_put(data->dev); - return 0; thermal_zone_unregister: thermal_zone_device_unregister(data->tz); -disable_runtime_pm: - pm_runtime_put_noidle(data->dev); - pm_runtime_disable(data->dev); clk_disable: clk_disable_unprepare(data->thermal_clk); legacy_cleanup: @@ -820,9 +829,13 @@ static int imx_thermal_remove(struct platform_device *pdev) { struct imx_thermal_data *data = platform_get_drvdata(pdev); + struct regmap *map = data->tempmon; + /* Disable measurements */ + regmap_write(map, data->socdata->sensor_ctrl + REG_SET, + data->socdata->power_down_mask); + if (!IS_ERR(data->thermal_clk)) + clk_disable_unprepare(data->thermal_clk); - pm_runtime_put_noidle(data->dev); - pm_runtime_disable(data->dev); thermal_zone_device_unregister(data->tz); imx_thermal_unregister_legacy_cooling(data); @@ -845,79 +858,29 @@ ret = thermal_zone_device_disable(data->tz); if (ret) return ret; - - return pm_runtime_force_suspend(data->dev); -} - -static int __maybe_unused imx_thermal_resume(struct device *dev) -{ - struct imx_thermal_data *data = dev_get_drvdata(dev); - int ret; - - ret = pm_runtime_force_resume(data->dev); - if (ret) - return ret; - /* Enabled thermal sensor after resume */ - return thermal_zone_device_enable(data->tz); -} - -static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev) -{ - struct imx_thermal_data *data = dev_get_drvdata(dev); - const struct thermal_soc_data *socdata = data->socdata; - struct regmap *map = data->tempmon; - int ret; - - ret = regmap_write(map, socdata->sensor_ctrl + REG_CLR, - socdata->measure_temp_mask); - if (ret) - return ret; - - ret = regmap_write(map, socdata->sensor_ctrl + REG_SET, - socdata->power_down_mask); - if (ret) - return ret; - clk_disable_unprepare(data->thermal_clk); return 0; } +static int __maybe_unused imx_thermal_resume(struct device *dev) -static int __maybe_unused imx_thermal_runtime_resume(struct device *dev) { struct imx_thermal_data *data = dev_get_drvdata(dev); - const struct thermal_soc_data *socdata = data->socdata; - struct regmap *map = data->tempmon; int ret; ret = clk_prepare_enable(data->thermal_clk); if (ret) return ret; + /* Enabled thermal sensor after resume */ + ret = thermal_zone_device_enable(data->tz); - - ret = regmap_write(map, socdata->sensor_ctrl + REG_CLR, - socdata->power_down_mask); - if (ret) - return ret; - - ret = regmap_write(map, socdata->sensor_ctrl + REG_SET, - socdata->measure_temp_mask); if (ret) return ret; - /* - * According to the temp sensor designers, it may require up to ~17us - * to complete a measurement. - */ - usleep_range(20, 50); - return 0; } +static SIMPLE_DEV_PM_OPS(imx_thermal_pm_ops, + imx_thermal_suspend, imx_thermal_resume); -static const struct dev_pm_ops imx_thermal_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume) - SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend, - imx_thermal_runtime_resume, NULL) -}; static struct platform_driver imx_thermal = { .driver = { reverted: --- linux-aws-5.13-5.13.0/drivers/thunderbolt/acpi.c +++ linux-aws-5.13-5.13.0.orig/drivers/thunderbolt/acpi.c @@ -7,7 +7,6 @@ */ #include -#include #include "tb.h" @@ -75,18 +74,8 @@ pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM))) { const struct device_link *link; - /* - * Make them both active first to make sure the NHI does - * not runtime suspend before the consumer. The - * pm_runtime_put() below then allows the consumer to - * runtime suspend again (which then allows NHI runtime - * suspend too now that the device link is established). - */ - pm_runtime_get_sync(&pdev->dev); - link = device_link_add(&pdev->dev, &nhi->pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER | - DL_FLAG_RPM_ACTIVE | DL_FLAG_PM_RUNTIME); if (link) { dev_dbg(&nhi->pdev->dev, "created link from %s\n", @@ -95,8 +84,6 @@ dev_warn(&nhi->pdev->dev, "device link creation from %s failed\n", dev_name(&pdev->dev)); } - - pm_runtime_put(&pdev->dev); } out_put: reverted: --- linux-aws-5.13-5.13.0/drivers/tty/n_gsm.c +++ linux-aws-5.13-5.13.0.orig/drivers/tty/n_gsm.c @@ -318,7 +318,6 @@ #define GSM1_ESCAPE_BITS 0x20 #define XON 0x11 #define XOFF 0x13 -#define ISO_IEC_646_MASK 0x7F static const struct tty_port_operations gsm_port_ops; @@ -528,8 +527,7 @@ int olen = 0; while (len--) { if (*input == GSM1_SOF || *input == GSM1_ESCAPE + || *input == XON || *input == XOFF) { - || (*input & ISO_IEC_646_MASK) == XON - || (*input & ISO_IEC_646_MASK) == XOFF) { *output++ = GSM1_ESCAPE; *output++ = *input++ ^ GSM1_ESCAPE_BITS; olen++; diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_bcm7271.c linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_bcm7271.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_bcm7271.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_bcm7271.c @@ -1076,18 +1076,14 @@ priv->rx_bufs = dma_alloc_coherent(dev, priv->rx_size, &priv->rx_addr, GFP_KERNEL); - if (!priv->rx_bufs) { - ret = -EINVAL; + if (!priv->rx_bufs) goto err; - } priv->tx_size = UART_XMIT_SIZE; priv->tx_buf = dma_alloc_coherent(dev, priv->tx_size, &priv->tx_addr, GFP_KERNEL); - if (!priv->tx_buf) { - ret = -EINVAL; + if (!priv->tx_buf) goto err; - } } ret = serial8250_register_8250_port(&up); @@ -1101,7 +1097,6 @@ if (priv->dma_enabled) { dma_irq = platform_get_irq_byname(pdev, "dma"); if (dma_irq < 0) { - ret = dma_irq; dev_err(dev, "no IRQ resource info\n"); goto err1; } @@ -1121,7 +1116,7 @@ err: brcmuart_free_bufs(dev, priv); brcmuart_arbitration(priv, 0); - return ret; + return -ENODEV; } static int brcmuart_remove(struct platform_device *pdev) diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_of.c linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_of.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_of.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_of.c @@ -83,17 +83,8 @@ port->mapsize = resource_size(&resource); /* Check for shifted address mapping */ - if (of_property_read_u32(np, "reg-offset", &prop) == 0) { - if (prop >= port->mapsize) { - dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", - prop, &port->mapsize); - ret = -EINVAL; - goto err_unprepare; - } - + if (of_property_read_u32(np, "reg-offset", &prop) == 0) port->mapbase += prop; - port->mapsize -= prop; - } port->iotype = UPIO_MEM; if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_pci.c linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_pci.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_pci.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/8250/8250_pci.c @@ -5171,30 +5171,8 @@ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ pbn_b2_4_115200 }, - /* Brainboxes Devices */ /* - * Brainboxes UC-101 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0BA1, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-235/246 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0AA1, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_1_115200 }, - /* - * Brainboxes UC-257 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0861, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-260/271/701/756 + * BrainBoxes UC-260 */ { PCI_VENDOR_ID_INTASHIELD, 0x0D21, PCI_ANY_ID, PCI_ANY_ID, @@ -5202,81 +5180,7 @@ pbn_b2_4_115200 }, { PCI_VENDOR_ID_INTASHIELD, 0x0E34, PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, - pbn_b2_4_115200 }, - /* - * Brainboxes UC-268 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0841, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_4_115200 }, - /* - * Brainboxes UC-275/279 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0881, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_8_115200 }, - /* - * Brainboxes UC-302 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x08E1, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-310 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x08C1, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-313 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x08A3, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-320/324 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0A61, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_1_115200 }, - /* - * Brainboxes UC-346 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0B02, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_4_115200 }, - /* - * Brainboxes UC-357 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0A81, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - { PCI_VENDOR_ID_INTASHIELD, 0x0A83, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_2_115200 }, - /* - * Brainboxes UC-368 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0C41, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, - pbn_b2_4_115200 }, - /* - * Brainboxes UC-420/431 - */ - { PCI_VENDOR_ID_INTASHIELD, 0x0921, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, + PCI_CLASS_COMMUNICATION_MULTISERIAL << 8, 0xffff00, pbn_b2_4_115200 }, /* * Perle PCI-RAS cards reverted: --- linux-aws-5.13-5.13.0/drivers/tty/serial/amba-pl010.c +++ linux-aws-5.13-5.13.0.orig/drivers/tty/serial/amba-pl010.c @@ -446,11 +446,14 @@ if ((termios->c_cflag & CREAD) == 0) uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; + /* first, disable everything */ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; if (UART_ENABLE_MS(port, termios->c_cflag)) old_cr |= UART010_CR_MSIE; + writel(0, uap->port.membase + UART010_CR); + /* Set baud rate */ quot -= 1; writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/amba-pl011.c linux-aws-5.13-5.13.0/drivers/tty/serial/amba-pl011.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/amba-pl011.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/amba-pl011.c @@ -2003,7 +2003,9 @@ if (UART_ENABLE_MS(port, termios->c_cflag)) pl011_enable_ms(port); + /* first, disable everything */ old_cr = pl011_read(uap, REG_CR); + pl011_write(0, uap, REG_CR); if (termios->c_cflag & CRTSCTS) { if (old_cr & UART011_CR_RTS) @@ -2080,12 +2082,31 @@ } /* + * Release the memory region(s) being used by 'port' + */ +static void pl011_release_port(struct uart_port *port) +{ + release_mem_region(port->mapbase, SZ_4K); +} + +/* + * Request the memory region(s) being used by 'port' + */ +static int pl011_request_port(struct uart_port *port) +{ + return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") + != NULL ? 0 : -EBUSY; +} + +/* * Configure/autoconfigure the port. */ static void pl011_config_port(struct uart_port *port, int flags) { - if (flags & UART_CONFIG_TYPE) + if (flags & UART_CONFIG_TYPE) { port->type = PORT_AMBA; + pl011_request_port(port); + } } /* @@ -2100,8 +2121,6 @@ ret = -EINVAL; if (ser->baud_base < 9600) ret = -EINVAL; - if (port->mapbase != (unsigned long) ser->iomem_base) - ret = -EINVAL; return ret; } @@ -2119,6 +2138,8 @@ .flush_buffer = pl011_dma_flush_buffer, .set_termios = pl011_set_termios, .type = pl011_type, + .release_port = pl011_release_port, + .request_port = pl011_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL @@ -2148,6 +2169,8 @@ .shutdown = sbsa_uart_shutdown, .set_termios = sbsa_uart_set_termios, .type = pl011_type, + .release_port = pl011_release_port, + .request_port = pl011_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL reverted: --- linux-aws-5.13-5.13.0/drivers/tty/serial/atmel_serial.c +++ linux-aws-5.13-5.13.0.orig/drivers/tty/serial/atmel_serial.c @@ -1004,13 +1004,6 @@ desc->callback = atmel_complete_tx_dma; desc->callback_param = atmel_port; atmel_port->cookie_tx = dmaengine_submit(desc); - if (dma_submit_error(atmel_port->cookie_tx)) { - dev_err(port->dev, "dma_submit_error %d\n", - atmel_port->cookie_tx); - return; - } - - dma_async_issue_pending(chan); } if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1265,13 +1258,6 @@ desc->callback_param = port; atmel_port->desc_rx = desc; atmel_port->cookie_rx = dmaengine_submit(desc); - if (dma_submit_error(atmel_port->cookie_rx)) { - dev_err(port->dev, "dma_submit_error %d\n", - atmel_port->cookie_rx); - goto chan_err; - } - - dma_async_issue_pending(atmel_port->chan_rx); return 0; diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/imx.c linux-aws-5.13-5.13.0/drivers/tty/serial/imx.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/imx.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/imx.c @@ -484,21 +484,18 @@ static void imx_uart_stop_rx(struct uart_port *port) { struct imx_port *sport = (struct imx_port *)port; - u32 ucr1, ucr2, ucr4; + u32 ucr1, ucr2; ucr1 = imx_uart_readl(sport, UCR1); ucr2 = imx_uart_readl(sport, UCR2); - ucr4 = imx_uart_readl(sport, UCR4); if (sport->dma_is_enabled) { ucr1 &= ~(UCR1_RXDMAEN | UCR1_ATDMAEN); } else { ucr1 &= ~UCR1_RRDYEN; ucr2 &= ~UCR2_ATEN; - ucr4 &= ~UCR4_OREN; } imx_uart_writel(sport, ucr1, UCR1); - imx_uart_writel(sport, ucr4, UCR4); ucr2 &= ~UCR2_RXEN; imx_uart_writel(sport, ucr2, UCR2); @@ -1549,7 +1546,7 @@ imx_uart_writel(sport, ucr1, UCR1); ucr4 = imx_uart_readl(sport, UCR4); - ucr4 &= ~UCR4_TCEN; + ucr4 &= ~(UCR4_OREN | UCR4_TCEN); imx_uart_writel(sport, ucr4, UCR4); spin_unlock_irqrestore(&sport->port.lock, flags); diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/liteuart.c linux-aws-5.13-5.13.0/drivers/tty/serial/liteuart.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/liteuart.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/liteuart.c @@ -418 +418 @@ -MODULE_ALIAS("platform:liteuart"); +MODULE_ALIAS("platform: liteuart"); diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/serial_core.c linux-aws-5.13-5.13.0/drivers/tty/serial/serial_core.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/serial_core.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/serial_core.c @@ -162,7 +162,7 @@ int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); if (raise) { - if (rs485_on && RTS_after_send) { + if (rs485_on && !RTS_after_send) { uart_set_mctrl(uport, TIOCM_DTR); uart_clear_mctrl(uport, TIOCM_RTS); } else { @@ -171,7 +171,7 @@ } else { unsigned int clear = TIOCM_DTR; - clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; + clear |= (!rs485_on || !RTS_after_send) ? TIOCM_RTS : 0; uart_clear_mctrl(uport, clear); } } @@ -2409,8 +2409,7 @@ * We probably don't need a spinlock around this, but */ spin_lock_irqsave(&port->lock, flags); - port->mctrl &= TIOCM_DTR; - port->ops->set_mctrl(port, port->mctrl); + port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); spin_unlock_irqrestore(&port->lock, flags); /* reverted: --- linux-aws-5.13-5.13.0/drivers/tty/serial/stm32-usart.c +++ linux-aws-5.13-5.13.0.orig/drivers/tty/serial/stm32-usart.c @@ -575,7 +575,7 @@ struct serial_rs485 *rs485conf = &port->rs485; struct circ_buf *xmit = &port->state->xmit; + if (uart_circ_empty(xmit)) - if (uart_circ_empty(xmit) && !port->x_char) return; if (rs485conf->flags & SER_RS485_ENABLED) { @@ -691,11 +691,6 @@ u32 val, isr; int ret; - if (stm32_port->tx_dma_busy) { - dmaengine_terminate_async(stm32_port->tx_ch); - stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAT); - } - /* Disable modem control interrupts */ stm32_usart_disable_ms(port); @@ -1422,6 +1417,7 @@ stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_DMAR); if (stm32_port->rx_ch) { + dmaengine_terminate_async(stm32_port->rx_ch); dma_release_channel(stm32_port->rx_ch); } diff -u linux-aws-5.13-5.13.0/drivers/tty/serial/uartlite.c linux-aws-5.13-5.13.0/drivers/tty/serial/uartlite.c --- linux-aws-5.13-5.13.0/drivers/tty/serial/uartlite.c +++ linux-aws-5.13-5.13.0/drivers/tty/serial/uartlite.c @@ -615,7 +615,7 @@ * * Returns: 0 on success, <0 otherwise */ -static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq, +static int ulite_assign(struct device *dev, int id, u32 base, int irq, struct uartlite_data *pdata) { struct uart_port *port; reverted: --- linux-aws-5.13-5.13.0/drivers/usb/cdns3/drd.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/cdns3/drd.c @@ -483,11 +483,11 @@ /* Indicate the cdns3 core was power lost before */ bool cdns_power_is_lost(struct cdns *cdns) { + if (cdns->version == CDNS3_CONTROLLER_V1) { + if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) - if (cdns->version == CDNS3_CONTROLLER_V0) { - if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) return true; } else { + if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) - if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) return true; } return false; reverted: --- linux-aws-5.13-5.13.0/drivers/usb/common/ulpi.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/common/ulpi.c @@ -39,11 +39,8 @@ struct ulpi *ulpi = to_ulpi_dev(dev); const struct ulpi_device_id *id; + /* Some ULPI devices don't have a vendor id so rely on OF match */ + if (ulpi->id.vendor == 0) - /* - * Some ULPI devices don't have a vendor id - * or provide an id_table so rely on OF match. - */ - if (ulpi->id.vendor == 0 || !drv->id_table) return of_driver_match_device(dev, driver); for (id = drv->id_table; id->vendor; id++) diff -u linux-aws-5.13-5.13.0/drivers/usb/core/hcd.c linux-aws-5.13-5.13.0/drivers/usb/core/hcd.c --- linux-aws-5.13-5.13.0/drivers/usb/core/hcd.c +++ linux-aws-5.13-5.13.0/drivers/usb/core/hcd.c @@ -1563,13 +1563,6 @@ urb->hcpriv = NULL; INIT_LIST_HEAD(&urb->urb_list); atomic_dec(&urb->use_count); - /* - * Order the write of urb->use_count above before the read - * of urb->reject below. Pairs with the memory barriers in - * usb_kill_urb() and usb_poison_urb(). - */ - smp_mb__after_atomic(); - atomic_dec(&urb->dev->urbnum); if (atomic_read(&urb->reject)) wake_up(&usb_kill_urb_queue); @@ -1672,13 +1665,6 @@ usb_anchor_resume_wakeups(anchor); atomic_dec(&urb->use_count); - /* - * Order the write of urb->use_count above before the read - * of urb->reject below. Pairs with the memory barriers in - * usb_kill_urb() and usb_poison_urb(). - */ - smp_mb__after_atomic(); - if (unlikely(atomic_read(&urb->reject))) wake_up(&usb_kill_urb_queue); usb_put_urb(urb); diff -u linux-aws-5.13-5.13.0/drivers/usb/core/hub.c linux-aws-5.13-5.13.0/drivers/usb/core/hub.c --- linux-aws-5.13-5.13.0/drivers/usb/core/hub.c +++ linux-aws-5.13-5.13.0/drivers/usb/core/hub.c @@ -1110,10 +1110,7 @@ } else { hub_power_on(hub, true); } - /* Give some time on remote wakeup to let links to transit to U0 */ - } else if (hub_is_superspeed(hub->hdev)) - msleep(20); - + } init2: /* reverted: --- linux-aws-5.13-5.13.0/drivers/usb/core/urb.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/core/urb.c @@ -706,12 +706,6 @@ if (!(urb && urb->dev && urb->ep)) return; atomic_inc(&urb->reject); - /* - * Order the write of urb->reject above before the read - * of urb->use_count below. Pairs with the barriers in - * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). - */ - smp_mb__after_atomic(); usb_hcd_unlink_urb(urb, -ENOENT); wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); @@ -753,12 +747,6 @@ if (!urb) return; atomic_inc(&urb->reject); - /* - * Order the write of urb->reject above before the read - * of urb->use_count below. Pairs with the barriers in - * __usb_hcd_giveback_urb() and usb_hcd_submit_urb(). - */ - smp_mb__after_atomic(); if (!urb->dev || !urb->ep) return; diff -u linux-aws-5.13-5.13.0/drivers/usb/dwc2/hcd.c linux-aws-5.13-5.13.0/drivers/usb/dwc2/hcd.c --- linux-aws-5.13-5.13.0/drivers/usb/dwc2/hcd.c +++ linux-aws-5.13-5.13.0/drivers/usb/dwc2/hcd.c @@ -4403,12 +4403,11 @@ * If not hibernation nor partial power down are supported, * clock gating is used to save power. */ - if (!hsotg->params.no_clock_gating) { + if (!hsotg->params.no_clock_gating) dwc2_host_enter_clock_gating(hsotg); - /* After entering suspend, hardware is not accessible */ - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - } + /* After entering suspend, hardware is not accessible */ + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); break; default: goto skip_power_saving; diff -u linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-meson-g12a.c linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-meson-g12a.c --- linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-meson-g12a.c +++ linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -755,16 +755,16 @@ ret = dwc3_meson_g12a_get_phys(priv); if (ret) - goto err_rearm; + goto err_disable_clks; ret = priv->drvdata->setup_regmaps(priv, base); if (ret) - goto err_rearm; + goto err_disable_clks; if (priv->vbus) { ret = regulator_enable(priv->vbus); if (ret) - goto err_rearm; + goto err_disable_clks; } /* Get dr_mode */ @@ -825,9 +825,6 @@ if (priv->vbus) regulator_disable(priv->vbus); -err_rearm: - reset_control_rearm(priv->reset); - err_disable_clks: clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); @@ -855,8 +852,6 @@ pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); - reset_control_rearm(priv->reset); - clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); @@ -897,7 +892,7 @@ phy_exit(priv->phys[i]); } - reset_control_rearm(priv->reset); + reset_control_assert(priv->reset); return 0; } @@ -907,9 +902,7 @@ struct dwc3_meson_g12a *priv = dev_get_drvdata(dev); int i, ret; - ret = reset_control_reset(priv->reset); - if (ret) - return ret; + reset_control_deassert(priv->reset); ret = priv->drvdata->usb_init(priv); if (ret) diff -u linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-qcom.c linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-qcom.c --- linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-qcom.c +++ linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-qcom.c @@ -769,12 +769,9 @@ if (qcom->acpi_pdata->is_urs) { qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev); - if (IS_ERR_OR_NULL(qcom->urs_usb)) { + if (!qcom->urs_usb) { dev_err(dev, "failed to create URS USB platdev\n"); - if (!qcom->urs_usb) - return -ENODEV; - else - return PTR_ERR(qcom->urs_usb); + return -ENODEV; } } } reverted: --- linux-aws-5.13-5.13.0/drivers/usb/dwc3/dwc3-xilinx.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/dwc3/dwc3-xilinx.c @@ -102,26 +102,14 @@ int ret; u32 reg; + usb3_phy = devm_phy_get(dev, "usb3-phy"); + if (PTR_ERR(usb3_phy) == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; - usb3_phy = devm_phy_optional_get(dev, "usb3-phy"); - if (IS_ERR(usb3_phy)) { - ret = PTR_ERR(usb3_phy); - dev_err_probe(dev, ret, - "failed to get USB3 PHY\n"); goto err; + } else if (IS_ERR(usb3_phy)) { + usb3_phy = NULL; } - /* - * The following core resets are not required unless a USB3 PHY - * is used, and the subsequent register settings are not required - * unless a core reset is performed (they should be set properly - * by the first-stage boot loader, but may be reverted by a core - * reset). They may also break the configuration if USB3 is actually - * in use but the usb3-phy entry is missing from the device tree. - * Therefore, skip these operations in this case. - */ - if (!usb3_phy) - goto skip_usb3_phy; - crst = devm_reset_control_get_exclusive(dev, "usb_crst"); if (IS_ERR(crst)) { ret = PTR_ERR(crst); @@ -200,7 +188,6 @@ goto err; } -skip_usb3_phy: /* * This routes the USB DMA traffic to go through FPD path instead * of reaching DDR directly. This traffic routing is needed to diff -u linux-aws-5.13-5.13.0/drivers/usb/gadget/function/f_fs.c linux-aws-5.13-5.13.0/drivers/usb/gadget/function/f_fs.c --- linux-aws-5.13-5.13.0/drivers/usb/gadget/function/f_fs.c +++ linux-aws-5.13-5.13.0/drivers/usb/gadget/function/f_fs.c @@ -614,7 +614,7 @@ file->private_data = ffs; ffs_data_opened(ffs); - return stream_open(inode, file); + return 0; } static int ffs_ep0_release(struct inode *inode, struct file *file) @@ -1154,7 +1154,7 @@ file->private_data = epfile; ffs_data_opened(epfile->ffs); - return stream_open(inode, file); + return 0; } static int ffs_aio_cancel(struct kiocb *kiocb) reverted: --- linux-aws-5.13-5.13.0/drivers/usb/gadget/function/f_sourcesink.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/gadget/function/f_sourcesink.c @@ -584,7 +584,6 @@ if (is_iso) { switch (speed) { - case USB_SPEED_SUPER_PLUS: case USB_SPEED_SUPER: size = ss->isoc_maxpacket * (ss->isoc_mult + 1) * reverted: --- linux-aws-5.13-5.13.0/drivers/usb/host/uhci-platform.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/host/uhci-platform.c @@ -113,8 +113,7 @@ num_ports); } if (of_device_is_compatible(np, "aspeed,ast2400-uhci") || + of_device_is_compatible(np, "aspeed,ast2500-uhci")) { - of_device_is_compatible(np, "aspeed,ast2500-uhci") || - of_device_is_compatible(np, "aspeed,ast2600-uhci")) { uhci->is_aspeed = 1; dev_info(&pdev->dev, "Enabled Aspeed implementation workarounds\n"); reverted: --- linux-aws-5.13-5.13.0/drivers/usb/host/xhci-plat.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/host/xhci-plat.c @@ -437,9 +437,6 @@ struct xhci_hcd *xhci = hcd_to_xhci(hcd); int ret; - if (pm_runtime_suspended(dev)) - pm_runtime_resume(dev); - ret = xhci_priv_suspend_quirk(hcd); if (ret) return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/usb/misc/ftdi-elan.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/misc/ftdi-elan.c @@ -202,7 +202,6 @@ mutex_unlock(&ftdi_module_lock); kfree(ftdi->bulk_in_buffer); ftdi->bulk_in_buffer = NULL; - kfree(ftdi); } static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) diff -u linux-aws-5.13-5.13.0/drivers/usb/storage/unusual_devs.h linux-aws-5.13-5.13.0/drivers/usb/storage/unusual_devs.h --- linux-aws-5.13-5.13.0/drivers/usb/storage/unusual_devs.h +++ linux-aws-5.13-5.13.0/drivers/usb/storage/unusual_devs.h @@ -2308,16 +2308,6 @@ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG ), -/* - * Reported by DocMAX - * and Thomas Weißschuh - */ -UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999, - "VIA Labs, Inc.", - "VL817 SATA Bridge", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_IGNORE_UAS), - UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, "ST", "2A", diff -u linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpci.c linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpci.c --- linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpci.c +++ linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpci.c @@ -75,25 +75,9 @@ static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); - bool vconn_pres; - enum typec_cc_polarity polarity = TYPEC_POLARITY_CC1; unsigned int reg; int ret; - ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS, ®); - if (ret < 0) - return ret; - - vconn_pres = !!(reg & TCPC_POWER_STATUS_VCONN_PRES); - if (vconn_pres) { - ret = regmap_read(tcpci->regmap, TCPC_TCPC_CTRL, ®); - if (ret < 0) - return ret; - - if (reg & TCPC_TCPC_CTRL_ORIENTATION) - polarity = TYPEC_POLARITY_CC2; - } - switch (cc) { case TYPEC_CC_RA: reg = (TCPC_ROLE_CTRL_CC_RA << TCPC_ROLE_CTRL_CC1_SHIFT) | @@ -128,16 +112,6 @@ break; } - if (vconn_pres) { - if (polarity == TYPEC_POLARITY_CC2) { - reg &= ~(TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT); - reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT); - } else { - reg &= ~(TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT); - reg |= (TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT); - } - } - ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); if (ret < 0) return ret; reverted: --- linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpci.h +++ linux-aws-5.13-5.13.0.orig/drivers/usb/typec/tcpm/tcpci.h @@ -98,7 +98,6 @@ #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4) #define TCPC_POWER_STATUS_VBUS_DET BIT(3) #define TCPC_POWER_STATUS_VBUS_PRES BIT(2) -#define TCPC_POWER_STATUS_VCONN_PRES BIT(1) #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) #define TCPC_FAULT_STATUS 0x1f diff -u linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpm.c linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpm.c --- linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpm.c +++ linux-aws-5.13-5.13.0/drivers/usb/typec/tcpm/tcpm.c @@ -5113,8 +5113,7 @@ case SNK_TRYWAIT_DEBOUNCE: break; case SNK_ATTACH_WAIT: - case SNK_DEBOUNCED: - /* Do nothing, as TCPM is still waiting for vbus to reaach VSAFE5V to connect */ + tcpm_set_state(port, SNK_UNATTACHED, 0); break; case SNK_NEGOTIATE_CAPABILITIES: @@ -5220,10 +5219,6 @@ case PR_SWAP_SNK_SRC_SINK_OFF: /* Do nothing, vsafe0v is expected during transition */ break; - case SNK_ATTACH_WAIT: - case SNK_DEBOUNCED: - /*Do nothing, still waiting for VSAFE5V for connect */ - break; default: if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) tcpm_set_state(port, SNK_UNATTACHED, 0); reverted: --- linux-aws-5.13-5.13.0/drivers/usb/typec/ucsi/ucsi_ccg.c +++ linux-aws-5.13-5.13.0.orig/drivers/usb/typec/ucsi/ucsi_ccg.c @@ -325,7 +325,7 @@ if (status < 0) return status; + if (!data) - if (!(data & DEV_INT)) return 0; status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); reverted: --- linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_base.c +++ linux-aws-5.13-5.13.0.orig/drivers/vdpa/ifcvf/ifcvf_base.c @@ -141,8 +141,8 @@ IFCVF_DBG(pdev, "hw->isr = %p\n", hw->isr); break; case VIRTIO_PCI_CAP_DEVICE_CFG: + hw->net_cfg = get_cap_addr(hw, &cap); + IFCVF_DBG(pdev, "hw->net_cfg = %p\n", hw->net_cfg); - hw->dev_cfg = get_cap_addr(hw, &cap); - IFCVF_DBG(pdev, "hw->dev_cfg = %p\n", hw->dev_cfg); break; } @@ -151,7 +151,7 @@ } if (hw->common_cfg == NULL || hw->notify_base == NULL || + hw->isr == NULL || hw->net_cfg == NULL) { - hw->isr == NULL || hw->dev_cfg == NULL) { IFCVF_ERR(pdev, "Incomplete PCI capabilities\n"); return -EIO; } @@ -168,7 +168,7 @@ IFCVF_DBG(pdev, "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n", hw->common_cfg, hw->notify_base, hw->isr, + hw->net_cfg, hw->notify_off_multiplier); - hw->dev_cfg, hw->notify_off_multiplier); return 0; } @@ -236,54 +236,33 @@ return 0; } +void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset, -u32 ifcvf_get_config_size(struct ifcvf_hw *hw) -{ - struct ifcvf_adapter *adapter; - u32 config_size; - - adapter = vf_to_adapter(hw); - switch (hw->dev_type) { - case VIRTIO_ID_NET: - config_size = sizeof(struct virtio_net_config); - break; - case VIRTIO_ID_BLOCK: - config_size = sizeof(struct virtio_blk_config); - break; - default: - config_size = 0; - IFCVF_ERR(adapter->pdev, "VIRTIO ID %u not supported\n", hw->dev_type); - } - - return config_size; -} - -void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset, void *dst, int length) { u8 old_gen, new_gen, *p; int i; + WARN_ON(offset + length > sizeof(struct virtio_net_config)); - WARN_ON(offset + length > hw->config_size); do { old_gen = ifc_ioread8(&hw->common_cfg->config_generation); p = dst; for (i = 0; i < length; i++) + *p++ = ifc_ioread8(hw->net_cfg + offset + i); - *p++ = ifc_ioread8(hw->dev_cfg + offset + i); new_gen = ifc_ioread8(&hw->common_cfg->config_generation); } while (old_gen != new_gen); } +void ifcvf_write_net_config(struct ifcvf_hw *hw, u64 offset, -void ifcvf_write_dev_config(struct ifcvf_hw *hw, u64 offset, const void *src, int length) { const u8 *p; int i; p = src; + WARN_ON(offset + length > sizeof(struct virtio_net_config)); - WARN_ON(offset + length > hw->config_size); for (i = 0; i < length; i++) + ifc_iowrite8(*p++, hw->net_cfg + offset + i); - ifc_iowrite8(*p++, hw->dev_cfg + offset + i); } static void ifcvf_set_features(struct ifcvf_hw *hw, u64 features) reverted: --- linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_base.h +++ linux-aws-5.13-5.13.0.orig/drivers/vdpa/ifcvf/ifcvf_base.h @@ -92,14 +92,12 @@ u64 hw_features; u32 dev_type; struct virtio_pci_common_cfg __iomem *common_cfg; + void __iomem *net_cfg; - void __iomem *dev_cfg; struct vring_info vring[IFCVF_MAX_QUEUE_PAIRS * 2]; void __iomem * const *base; char config_msix_name[256]; struct vdpa_callback config_cb; unsigned int config_irq; - /* virtio-net or virtio-blk device config size */ - u32 config_size; }; struct ifcvf_adapter { @@ -122,9 +120,9 @@ int ifcvf_start_hw(struct ifcvf_hw *hw); void ifcvf_stop_hw(struct ifcvf_hw *hw); void ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid); +void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset, -void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset, void *dst, int length); +void ifcvf_write_net_config(struct ifcvf_hw *hw, u64 offset, -void ifcvf_write_dev_config(struct ifcvf_hw *hw, u64 offset, const void *src, int length); u8 ifcvf_get_status(struct ifcvf_hw *hw); void ifcvf_set_status(struct ifcvf_hw *hw, u8 status); @@ -137,5 +135,4 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num); struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw); int ifcvf_probed_virtio_net(struct ifcvf_hw *hw); -u32 ifcvf_get_config_size(struct ifcvf_hw *hw); #endif /* _IFCVF_H_ */ diff -u linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_main.c linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_main.c --- linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_main.c +++ linux-aws-5.13-5.13.0/drivers/vdpa/ifcvf/ifcvf_main.c @@ -356,9 +356,24 @@ static size_t ifcvf_vdpa_get_config_size(struct vdpa_device *vdpa_dev) { + struct ifcvf_adapter *adapter = vdpa_to_adapter(vdpa_dev); struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); + struct pci_dev *pdev = adapter->pdev; + size_t size; - return vf->config_size; + switch (vf->dev_type) { + case VIRTIO_ID_NET: + size = sizeof(struct virtio_net_config); + break; + case VIRTIO_ID_BLOCK: + size = sizeof(struct virtio_blk_config); + break; + default: + size = 0; + IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", vf->dev_type); + } + + return size; } static void ifcvf_vdpa_get_config(struct vdpa_device *vdpa_dev, @@ -367,7 +382,8 @@ { struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); - ifcvf_read_dev_config(vf, offset, buf, len); + WARN_ON(offset + len > sizeof(struct virtio_net_config)); + ifcvf_read_net_config(vf, offset, buf, len); } static void ifcvf_vdpa_set_config(struct vdpa_device *vdpa_dev, @@ -376,7 +392,8 @@ { struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); - ifcvf_write_dev_config(vf, offset, buf, len); + WARN_ON(offset + len > sizeof(struct virtio_net_config)); + ifcvf_write_net_config(vf, offset, buf, len); } static void ifcvf_vdpa_set_config_cb(struct vdpa_device *vdpa_dev, @@ -497,7 +514,6 @@ vf->vring[i].irq = -EINVAL; vf->hw_features = ifcvf_get_hw_features(vf); - vf->config_size = ifcvf_get_config_size(vf); ret = vdpa_register_device(&adapter->vdpa, IFCVF_MAX_QUEUE_PAIRS * 2); if (ret) { diff -u linux-aws-5.13-5.13.0/drivers/vdpa/mlx5/net/mlx5_vnet.c linux-aws-5.13-5.13.0/drivers/vdpa/mlx5/net/mlx5_vnet.c --- linux-aws-5.13-5.13.0/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ linux-aws-5.13-5.13.0/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -827,6 +827,8 @@ MLX5_SET(virtio_q, vq_ctx, umem_3_id, mvq->umem3.id); MLX5_SET(virtio_q, vq_ctx, umem_3_size, mvq->umem3.size); MLX5_SET(virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); + if (MLX5_CAP_DEV_VDPA_EMULATION(ndev->mvdev.mdev, eth_frame_offload_type)) + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, 1); err = mlx5_cmd_exec(ndev->mvdev.mdev, in, inlen, out, sizeof(out)); if (err) diff -u linux-aws-5.13-5.13.0/drivers/vhost/net.c linux-aws-5.13-5.13.0/drivers/vhost/net.c --- linux-aws-5.13-5.13.0/drivers/vhost/net.c +++ linux-aws-5.13-5.13.0/drivers/vhost/net.c @@ -652,8 +652,6 @@ !vhost_vq_avail_empty(vq->dev, vq); } -#define SKB_FRAG_PAGE_ORDER get_order(32768) - static bool vhost_net_page_frag_refill(struct vhost_net *net, unsigned int sz, struct page_frag *pfrag, gfp_t gfp) { reverted: --- linux-aws-5.13-5.13.0/drivers/video/backlight/qcom-wled.c +++ linux-aws-5.13-5.13.0.orig/drivers/video/backlight/qcom-wled.c @@ -231,14 +231,14 @@ static int wled3_set_brightness(struct wled *wled, u16 brightness) { int rc, i; + u8 v[2]; - __le16 v; + v[0] = brightness & 0xff; + v[1] = (brightness >> 8) & 0xf; - v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX); for (i = 0; i < wled->cfg.num_strings; ++i) { rc = regmap_bulk_write(wled->regmap, wled->ctrl_addr + + WLED3_SINK_REG_BRIGHT(i), v, 2); - WLED3_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]), - &v, sizeof(v)); if (rc < 0) return rc; } @@ -250,18 +250,18 @@ { int rc, i; u16 low_limit = wled->max_brightness * 4 / 1000; + u8 v[2]; - __le16 v; /* WLED4's lower limit of operation is 0.4% */ if (brightness > 0 && brightness < low_limit) brightness = low_limit; + v[0] = brightness & 0xff; + v[1] = (brightness >> 8) & 0xf; - v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX); for (i = 0; i < wled->cfg.num_strings; ++i) { rc = regmap_bulk_write(wled->regmap, wled->sink_addr + + WLED4_SINK_REG_BRIGHT(i), v, 2); - WLED4_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]), - &v, sizeof(v)); if (rc < 0) return rc; } @@ -273,20 +273,21 @@ { int rc, offset; u16 low_limit = wled->max_brightness * 1 / 1000; + u8 v[2]; - __le16 v; /* WLED5's lower limit is 0.1% */ if (brightness < low_limit) brightness = low_limit; + v[0] = brightness & 0xff; + v[1] = (brightness >> 8) & 0x7f; - v = cpu_to_le16(brightness & WLED5_SINK_REG_BRIGHT_MAX_15B); offset = (wled->cfg.mod_sel == MOD_A) ? WLED5_SINK_REG_MOD_A_BRIGHTNESS_LSB : WLED5_SINK_REG_MOD_B_BRIGHTNESS_LSB; rc = regmap_bulk_write(wled->regmap, wled->sink_addr + offset, + v, 2); - &v, sizeof(v)); return rc; } @@ -571,7 +572,7 @@ static void wled_auto_string_detection(struct wled *wled) { + int rc = 0, i, delay_time_us; - int rc = 0, i, j, delay_time_us; u32 sink_config = 0; u8 sink_test = 0, sink_valid = 0, val; bool fault_set; @@ -618,15 +619,14 @@ /* Iterate through the strings one by one */ for (i = 0; i < wled->cfg.num_strings; i++) { + sink_test = BIT((WLED4_SINK_REG_CURR_SINK_SHFT + i)); - j = wled->cfg.enabled_strings[i]; - sink_test = BIT((WLED4_SINK_REG_CURR_SINK_SHFT + j)); /* Enable feedback control */ rc = regmap_write(wled->regmap, wled->ctrl_addr + + WLED3_CTRL_REG_FEEDBACK_CONTROL, i + 1); - WLED3_CTRL_REG_FEEDBACK_CONTROL, j + 1); if (rc < 0) { dev_err(wled->dev, "Failed to enable feedback for SINK %d rc = %d\n", + i + 1, rc); - j + 1, rc); goto failed_detect; } @@ -635,7 +635,7 @@ WLED4_SINK_REG_CURR_SINK, sink_test); if (rc < 0) { dev_err(wled->dev, "Failed to configure SINK %d rc=%d\n", + i + 1, rc); - j + 1, rc); goto failed_detect; } @@ -662,7 +662,7 @@ if (fault_set) dev_dbg(wled->dev, "WLED OVP fault detected with SINK %d\n", + i + 1); - j + 1); else sink_valid |= sink_test; @@ -702,16 +702,15 @@ /* Enable valid sinks */ if (wled->version == 4) { for (i = 0; i < wled->cfg.num_strings; i++) { - j = wled->cfg.enabled_strings[i]; if (sink_config & + BIT(WLED4_SINK_REG_CURR_SINK_SHFT + i)) - BIT(WLED4_SINK_REG_CURR_SINK_SHFT + j)) val = WLED4_SINK_REG_STR_MOD_MASK; else /* Disable modulator_en for unused sink */ val = 0; rc = regmap_write(wled->regmap, wled->sink_addr + + WLED4_SINK_REG_STR_MOD_EN(i), val); - WLED4_SINK_REG_STR_MOD_EN(j), val); if (rc < 0) { dev_err(wled->dev, "Failed to configure MODULATOR_EN rc=%d\n", rc); @@ -1257,6 +1256,21 @@ .size = 16, }; +static u32 wled3_num_strings_values_fn(u32 idx) +{ + return idx + 1; +} + +static const struct wled_var_cfg wled3_num_strings_cfg = { + .fn = wled3_num_strings_values_fn, + .size = 3, +}; + +static const struct wled_var_cfg wled4_num_strings_cfg = { + .fn = wled3_num_strings_values_fn, + .size = 4, +}; + static u32 wled3_switch_freq_values_fn(u32 idx) { return 19200 / (2 * (1 + idx)); @@ -1330,6 +1344,11 @@ .val_ptr = &cfg->switch_freq, .cfg = &wled3_switch_freq_cfg, }, + { + .name = "qcom,num-strings", + .val_ptr = &cfg->num_strings, + .cfg = &wled3_num_strings_cfg, + }, }; const struct wled_u32_opts wled4_opts[] = { @@ -1353,6 +1372,11 @@ .val_ptr = &cfg->switch_freq, .cfg = &wled3_switch_freq_cfg, }, + { + .name = "qcom,num-strings", + .val_ptr = &cfg->num_strings, + .cfg = &wled4_num_strings_cfg, + }, }; const struct wled_u32_opts wled5_opts[] = { @@ -1377,6 +1401,11 @@ .cfg = &wled3_switch_freq_cfg, }, { + .name = "qcom,num-strings", + .val_ptr = &cfg->num_strings, + .cfg = &wled4_num_strings_cfg, + }, + { .name = "qcom,modulator-sel", .val_ptr = &cfg->mod_sel, .cfg = &wled5_mod_sel_cfg, @@ -1494,57 +1523,16 @@ *bool_opts[i].val_ptr = true; } + cfg->num_strings = cfg->num_strings + 1; + string_len = of_property_count_elems_of_size(dev->of_node, "qcom,enabled-strings", sizeof(u32)); + if (string_len > 0) + of_property_read_u32_array(dev->of_node, - if (string_len > 0) { - if (string_len > wled->max_string_count) { - dev_err(dev, "Cannot have more than %d strings\n", - wled->max_string_count); - return -EINVAL; - } - - rc = of_property_read_u32_array(dev->of_node, "qcom,enabled-strings", wled->cfg.enabled_strings, + sizeof(u32)); - string_len); - if (rc) { - dev_err(dev, "Failed to read %d elements from qcom,enabled-strings: %d\n", - string_len, rc); - return rc; - } - - for (i = 0; i < string_len; ++i) { - if (wled->cfg.enabled_strings[i] >= wled->max_string_count) { - dev_err(dev, - "qcom,enabled-strings index %d at %d is out of bounds\n", - wled->cfg.enabled_strings[i], i); - return -EINVAL; - } - } - - cfg->num_strings = string_len; - } - - rc = of_property_read_u32(dev->of_node, "qcom,num-strings", &val); - if (!rc) { - if (val < 1 || val > wled->max_string_count) { - dev_err(dev, "qcom,num-strings must be between 1 and %d\n", - wled->max_string_count); - return -EINVAL; - } - - if (string_len > 0) { - dev_warn(dev, "Only one of qcom,num-strings or qcom,enabled-strings" - " should be set\n"); - if (val > string_len) { - dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); - return -EINVAL; - } - } - - cfg->num_strings = val; - } return 0; } reverted: --- linux-aws-5.13-5.13.0/drivers/video/fbdev/hyperv_fb.c +++ linux-aws-5.13-5.13.0.orig/drivers/video/fbdev/hyperv_fb.c @@ -286,6 +286,8 @@ static uint screen_width = HVFB_WIDTH; static uint screen_height = HVFB_HEIGHT; +static uint screen_width_max = HVFB_WIDTH; +static uint screen_height_max = HVFB_HEIGHT; static uint screen_depth; static uint screen_fb_size; static uint dio_fb_size; /* FB size for deferred IO */ @@ -579,6 +581,7 @@ int ret = 0; unsigned long t; u8 index; + int i; memset(msg, 0, sizeof(struct synthvid_msg)); msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST; @@ -609,6 +612,13 @@ goto out; } + for (i = 0; i < msg->resolution_resp.resolution_count; i++) { + screen_width_max = max_t(unsigned int, screen_width_max, + msg->resolution_resp.supported_resolution[i].width); + screen_height_max = max_t(unsigned int, screen_height_max, + msg->resolution_resp.supported_resolution[i].height); + } + screen_width = msg->resolution_resp.supported_resolution[index].width; screen_height = @@ -930,7 +940,7 @@ if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) && + (x > screen_width_max || y > screen_height_max)) || - (x * y * screen_depth / 8 > screen_fb_size)) || (par->synthvid_version == SYNTHVID_VERSION_WIN8 && x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || (par->synthvid_version == SYNTHVID_VERSION_WIN7 && @@ -1183,8 +1193,8 @@ } hvfb_get_option(info); + pr_info("Screen resolution: %dx%d, Color depth: %d\n", + screen_width, screen_height, screen_depth); - pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n", - screen_width, screen_height, screen_depth, screen_fb_size); ret = hvfb_getmem(hdev, info); if (ret) { diff -u linux-aws-5.13-5.13.0/drivers/virtio/virtio_mem.c linux-aws-5.13-5.13.0/drivers/virtio/virtio_mem.c --- linux-aws-5.13-5.13.0/drivers/virtio/virtio_mem.c +++ linux-aws-5.13-5.13.0/drivers/virtio/virtio_mem.c @@ -571,7 +571,7 @@ return -ENOMEM; mutex_lock(&vm->hotplug_mutex); - if (vm->sbm.sb_states) + if (new_bitmap) memcpy(new_bitmap, vm->sbm.sb_states, old_pages * PAGE_SIZE); old_bitmap = vm->sbm.sb_states; diff -u linux-aws-5.13-5.13.0/drivers/virtio/virtio_ring.c linux-aws-5.13-5.13.0/drivers/virtio/virtio_ring.c --- linux-aws-5.13-5.13.0/drivers/virtio/virtio_ring.c +++ linux-aws-5.13-5.13.0/drivers/virtio/virtio_ring.c @@ -1124,10 +1124,8 @@ if (virtqueue_use_indirect(_vq, total_sg)) { err = virtqueue_add_indirect_packed(vq, sgs, total_sg, out_sgs, in_sgs, data, gfp); - if (err != -ENOMEM) { - END_USE(vq); + if (err != -ENOMEM) return err; - } /* fall back on direct */ } reverted: --- linux-aws-5.13-5.13.0/drivers/w1/slaves/w1_ds28e04.c +++ linux-aws-5.13-5.13.0.orig/drivers/w1/slaves/w1_ds28e04.c @@ -32,7 +32,7 @@ module_param_named(strong_pullup, w1_strong_pullup, int, 0); /* enable/disable CRC checking on DS28E04-100 memory accesses */ +static char w1_enable_crccheck = 1; -static bool w1_enable_crccheck = true; #define W1_EEPROM_SIZE 512 #define W1_PAGE_COUNT 16 @@ -339,18 +339,32 @@ static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, char *buf) { + if (put_user(w1_enable_crccheck + 0x30, buf)) + return -EFAULT; + + return sizeof(w1_enable_crccheck); - return sysfs_emit(buf, "%d\n", w1_enable_crccheck); } static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + char val; + + if (count != 1 || !buf) + return -EINVAL; - int err = kstrtobool(buf, &w1_enable_crccheck); + if (get_user(val, buf)) + return -EFAULT; - if (err) - return err; + /* convert to decimal */ + val = val - 0x30; + if (val != 0 && val != 1) + return -EINVAL; + + /* set the new value */ + w1_enable_crccheck = val; + + return sizeof(w1_enable_crccheck); - return count; } static DEVICE_ATTR_RW(crccheck); diff -u linux-aws-5.13-5.13.0/drivers/xen/gntdev.c linux-aws-5.13-5.13.0/drivers/xen/gntdev.c --- linux-aws-5.13-5.13.0/drivers/xen/gntdev.c +++ linux-aws-5.13-5.13.0/drivers/xen/gntdev.c @@ -250,13 +250,13 @@ if (!refcount_dec_and_test(&map->users)) return; - if (map->pages && !use_ptemod) - unmap_grant_pages(map, 0, map->count); - if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { notify_remote_via_evtchn(map->notify.event); evtchn_put(map->notify.event); } + + if (map->pages && !use_ptemod) + unmap_grant_pages(map, 0, map->count); gntdev_free_map(map); } diff -u linux-aws-5.13-5.13.0/fs/btrfs/backref.c linux-aws-5.13-5.13.0/fs/btrfs/backref.c --- linux-aws-5.13-5.13.0/fs/btrfs/backref.c +++ linux-aws-5.13-5.13.0/fs/btrfs/backref.c @@ -1214,12 +1214,7 @@ ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); if (ret < 0) goto out; - if (ret == 0) { - /* This shouldn't happen, indicates a bug or fs corruption. */ - ASSERT(ret != 0); - ret = -EUCLEAN; - goto out; - } + BUG_ON(ret == 0); #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type != __TRANS_DUMMY) && @@ -1365,18 +1360,10 @@ goto out; if (!ret && extent_item_pos) { /* - * We've recorded that parent, so we must extend - * its inode list here. - * - * However if there was corruption we may not - * have found an eie, return an error in this - * case. + * we've recorded that parent, so we must extend + * its inode list here */ - ASSERT(eie); - if (!eie) { - ret = -EUCLEAN; - goto out; - } + BUG_ON(!eie); while (eie->next) eie = eie->next; eie->next = ref->inode_list; diff -u linux-aws-5.13-5.13.0/fs/btrfs/ctree.c linux-aws-5.13-5.13.0/fs/btrfs/ctree.c --- linux-aws-5.13-5.13.0/fs/btrfs/ctree.c +++ linux-aws-5.13-5.13.0/fs/btrfs/ctree.c @@ -1569,9 +1569,12 @@ { struct btrfs_fs_info *fs_info = root->fs_info; struct extent_buffer *b; - int root_lock = 0; + int root_lock; int level = 0; + /* We try very hard to do read locks on the root */ + root_lock = BTRFS_READ_LOCK; + if (p->search_commit_root) { /* * The commit roots are read only so we always do read locks, @@ -1609,9 +1612,6 @@ goto out; } - /* We try very hard to do read locks on the root */ - root_lock = BTRFS_READ_LOCK; - /* * If the level is set to maximum, we can skip trying to get the read * lock. @@ -1638,17 +1638,6 @@ level = btrfs_header_level(b); out: - /* - * The root may have failed to write out at some point, and thus is no - * longer valid, return an error in this case. - */ - if (!extent_buffer_uptodate(b)) { - if (root_lock) - btrfs_tree_unlock_rw(b, root_lock); - free_extent_buffer(b); - return ERR_PTR(-EIO); - } - p->nodes[level] = b; if (!p->skip_locking) p->locks[level] = root_lock; diff -u linux-aws-5.13-5.13.0/fs/btrfs/inode.c linux-aws-5.13-5.13.0/fs/btrfs/inode.c --- linux-aws-5.13-5.13.0/fs/btrfs/inode.c +++ linux-aws-5.13-5.13.0/fs/btrfs/inode.c @@ -10408,19 +10408,9 @@ struct btrfs_swap_info *bsi) { unsigned long nr_pages; - unsigned long max_pages; u64 first_ppage, first_ppage_reported, next_ppage; int ret; - /* - * Our swapfile may have had its size extended after the swap header was - * written. In that case activating the swapfile should not go beyond - * the max size set in the swap header. - */ - if (bsi->nr_pages >= sis->max) - return 0; - - max_pages = sis->max - bsi->nr_pages; first_ppage = ALIGN(bsi->block_start, PAGE_SIZE) >> PAGE_SHIFT; next_ppage = ALIGN_DOWN(bsi->block_start + bsi->block_len, PAGE_SIZE) >> PAGE_SHIFT; @@ -10428,7 +10418,6 @@ if (first_ppage >= next_ppage) return 0; nr_pages = next_ppage - first_ppage; - nr_pages = min(nr_pages, max_pages); first_ppage_reported = first_ppage; if (bsi->start == 0) diff -u linux-aws-5.13-5.13.0/fs/btrfs/ioctl.c linux-aws-5.13-5.13.0/fs/btrfs/ioctl.c --- linux-aws-5.13-5.13.0/fs/btrfs/ioctl.c +++ linux-aws-5.13-5.13.0/fs/btrfs/ioctl.c @@ -2990,8 +2990,10 @@ btrfs_inode_lock(inode, 0); err = btrfs_delete_subvolume(dir, dentry); btrfs_inode_unlock(inode, 0); - if (!err) - d_delete_notify(dir, dentry); + if (!err) { + fsnotify_rmdir(dir, dentry); + d_delete(dentry); + } out_dput: dput(dentry); diff -u linux-aws-5.13-5.13.0/fs/btrfs/qgroup.c linux-aws-5.13-5.13.0/fs/btrfs/qgroup.c --- linux-aws-5.13-5.13.0/fs/btrfs/qgroup.c +++ linux-aws-5.13-5.13.0/fs/btrfs/qgroup.c @@ -940,14 +940,6 @@ int ret = 0; int slot; - /* - * We need to have subvol_sem write locked, to prevent races between - * concurrent tasks trying to enable quotas, because we will unlock - * and relock qgroup_ioctl_lock before setting fs_info->quota_root - * and before setting BTRFS_FS_QUOTA_ENABLED. - */ - lockdep_assert_held_write(&fs_info->subvol_sem); - mutex_lock(&fs_info->qgroup_ioctl_lock); if (fs_info->quota_root) goto out; @@ -1125,19 +1117,8 @@ goto out_free_path; } - mutex_unlock(&fs_info->qgroup_ioctl_lock); - /* - * Commit the transaction while not holding qgroup_ioctl_lock, to avoid - * a deadlock with tasks concurrently doing other qgroup operations, such - * adding/removing qgroups or adding/deleting qgroup relations for example, - * because all qgroup operations first start or join a transaction and then - * lock the qgroup_ioctl_lock mutex. - * We are safe from a concurrent task trying to enable quotas, by calling - * this function, since we are serialized by fs_info->subvol_sem. - */ ret = btrfs_commit_transaction(trans); trans = NULL; - mutex_lock(&fs_info->qgroup_ioctl_lock); if (ret) goto out_free_path; diff -u linux-aws-5.13-5.13.0/fs/ceph/file.c linux-aws-5.13-5.13.0/fs/ceph/file.c --- linux-aws-5.13-5.13.0/fs/ceph/file.c +++ linux-aws-5.13-5.13.0/fs/ceph/file.c @@ -577,7 +577,6 @@ struct ceph_inode_info *ci = ceph_inode(dir); struct inode *inode; struct timespec64 now; - struct ceph_string *pool_ns; struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); struct ceph_vino vino = { .ino = req->r_deleg_ino, .snap = CEPH_NOSNAP }; @@ -627,12 +626,6 @@ in.max_size = cpu_to_le64(lo->stripe_unit); ceph_file_layout_to_legacy(lo, &in.layout); - /* lo is private, so pool_ns can't change */ - pool_ns = rcu_dereference_raw(lo->pool_ns); - if (pool_ns) { - iinfo.pool_ns_len = pool_ns->len; - iinfo.pool_ns_data = pool_ns->str; - } down_read(&mdsc->snap_rwsem); ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session, @@ -750,10 +743,8 @@ restore_deleg_ino(dir, req->r_deleg_ino); ceph_mdsc_put_request(req); try_async = false; - ceph_put_string(rcu_dereference_raw(lo.pool_ns)); goto retry; } - ceph_put_string(rcu_dereference_raw(lo.pool_ns)); goto out_req; } } reverted: --- linux-aws-5.13-5.13.0/fs/configfs/dir.c +++ linux-aws-5.13-5.13.0.orig/fs/configfs/dir.c @@ -1805,8 +1805,8 @@ configfs_detach_group(&group->cg_item); d_inode(dentry)->i_flags |= S_DEAD; dont_mount(dentry); - d_drop(dentry); fsnotify_rmdir(d_inode(parent), dentry); + d_delete(dentry); inode_unlock(d_inode(parent)); dput(dentry); @@ -1947,10 +1947,10 @@ configfs_detach_group(&group->cg_item); d_inode(dentry)->i_flags |= S_DEAD; dont_mount(dentry); + fsnotify_rmdir(d_inode(root), dentry); inode_unlock(d_inode(dentry)); + d_delete(dentry); - d_drop(dentry); - fsnotify_rmdir(d_inode(root), dentry); inode_unlock(d_inode(root)); diff -u linux-aws-5.13-5.13.0/fs/debugfs/file.c linux-aws-5.13-5.13.0/fs/debugfs/file.c --- linux-aws-5.13-5.13.0/fs/debugfs/file.c +++ linux-aws-5.13-5.13.0/fs/debugfs/file.c @@ -147,7 +147,7 @@ struct file *filp, const struct file_operations *real_fops) { - if ((inode->i_mode & 07777 & ~0444) == 0 && + if ((inode->i_mode & 07777) == 0444 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && reverted: --- linux-aws-5.13-5.13.0/fs/devpts/inode.c +++ linux-aws-5.13-5.13.0.orig/fs/devpts/inode.c @@ -621,8 +621,8 @@ dentry->d_fsdata = NULL; drop_nlink(dentry->d_inode); + fsnotify_unlink(d_inode(dentry->d_parent), dentry); d_drop(dentry); - fsnotify_unlink(d_inode(dentry->d_parent), dentry); dput(dentry); /* d_alloc_name() in devpts_pty_new() */ } reverted: --- linux-aws-5.13-5.13.0/fs/dlm/lock.c +++ linux-aws-5.13-5.13.0.orig/fs/dlm/lock.c @@ -3973,14 +3973,6 @@ int from = ms->m_header.h_nodeid; int error = 0; - /* currently mixing of user/kernel locks are not supported */ - if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { - log_error(lkb->lkb_resource->res_ls, - "got user dlm message for a kernel lock"); - error = -EINVAL; - goto out; - } - switch (ms->m_type) { case DLM_MSG_CONVERT: case DLM_MSG_UNLOCK: @@ -4009,7 +4001,6 @@ error = -EINVAL; } -out: if (error) log_error(lkb->lkb_resource->res_ls, "ignore invalid message %d from %d %x %x %x %d", diff -u linux-aws-5.13-5.13.0/fs/dlm/lowcomms.c linux-aws-5.13-5.13.0/fs/dlm/lowcomms.c --- linux-aws-5.13-5.13.0/fs/dlm/lowcomms.c +++ linux-aws-5.13-5.13.0/fs/dlm/lowcomms.c @@ -560,8 +560,8 @@ static void lowcomms_error_report(struct sock *sk) { struct connection *con; + struct sockaddr_storage saddr; void (*orig_report)(struct sock *) = NULL; - struct inet_sock *inet; read_lock_bh(&sk->sk_callback_lock); con = sock2con(sk); @@ -569,33 +569,34 @@ goto out; orig_report = listen_sock.sk_error_report; + if (con->sock == NULL || + kernel_getpeername(con->sock, (struct sockaddr *)&saddr) < 0) { + printk_ratelimited(KERN_ERR "dlm: node %d: socket error " + "sending to node %d, port %d, " + "sk_err=%d/%d\n", dlm_our_nodeid(), + con->nodeid, dlm_config.ci_tcp_port, + sk->sk_err, sk->sk_err_soft); + } else if (saddr.ss_family == AF_INET) { + struct sockaddr_in *sin4 = (struct sockaddr_in *)&saddr; - inet = inet_sk(sk); - switch (sk->sk_family) { - case AF_INET: printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "sending to node %d at %pI4, dport %d, " + "sending to node %d at %pI4, port %d, " "sk_err=%d/%d\n", dlm_our_nodeid(), - con->nodeid, &inet->inet_daddr, - ntohs(inet->inet_dport), sk->sk_err, + con->nodeid, &sin4->sin_addr.s_addr, + dlm_config.ci_tcp_port, sk->sk_err, sk->sk_err_soft); - break; -#if IS_ENABLED(CONFIG_IPV6) - case AF_INET6: + } else { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&saddr; + printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "sending to node %d at %pI6c, " - "dport %d, sk_err=%d/%d\n", dlm_our_nodeid(), - con->nodeid, &sk->sk_v6_daddr, - ntohs(inet->inet_dport), sk->sk_err, + "sending to node %d at %u.%u.%u.%u, " + "port %d, sk_err=%d/%d\n", dlm_our_nodeid(), + con->nodeid, sin6->sin6_addr.s6_addr32[0], + sin6->sin6_addr.s6_addr32[1], + sin6->sin6_addr.s6_addr32[2], + sin6->sin6_addr.s6_addr32[3], + dlm_config.ci_tcp_port, sk->sk_err, sk->sk_err_soft); - break; -#endif - default: - printk_ratelimited(KERN_ERR "dlm: node %d: socket error " - "invalid socket family %d set, " - "sk_err=%d/%d\n", dlm_our_nodeid(), - sk->sk_family, sk->sk_err, sk->sk_err_soft); - goto out; } /* below sendcon only handling */ diff -u linux-aws-5.13-5.13.0/fs/ext4/ext4.h linux-aws-5.13-5.13.0/fs/ext4/ext4.h --- linux-aws-5.13-5.13.0/fs/ext4/ext4.h +++ linux-aws-5.13-5.13.0/fs/ext4/ext4.h @@ -2861,7 +2861,6 @@ void ext4_fc_replay_cleanup(struct super_block *sb); int ext4_fc_commit(journal_t *journal, tid_t commit_tid); int __init ext4_fc_init_dentry_cache(void); -void ext4_fc_destroy_dentry_cache(void); /* mballoc.c */ extern const struct seq_operations ext4_mb_seq_groups_ops; diff -u linux-aws-5.13-5.13.0/fs/ext4/ext4_jbd2.c linux-aws-5.13-5.13.0/fs/ext4/ext4_jbd2.c --- linux-aws-5.13-5.13.0/fs/ext4/ext4_jbd2.c +++ linux-aws-5.13-5.13.0/fs/ext4/ext4_jbd2.c @@ -162,8 +162,6 @@ { if (!ext4_handle_valid(handle)) return 0; - if (is_handle_aborted(handle)) - return -EROFS; if (jbd2_handle_buffer_credits(handle) >= check_cred && handle->h_revoke_credits >= revoke_cred) return 0; diff -u linux-aws-5.13-5.13.0/fs/ext4/extents.c linux-aws-5.13-5.13.0/fs/ext4/extents.c --- linux-aws-5.13-5.13.0/fs/ext4/extents.c +++ linux-aws-5.13-5.13.0/fs/ext4/extents.c @@ -4638,6 +4638,8 @@ ret = ext4_mark_inode_dirty(handle, inode); if (unlikely(ret)) goto out_handle; + ext4_fc_track_range(handle, inode, offset >> inode->i_sb->s_blocksize_bits, + (offset + len - 1) >> inode->i_sb->s_blocksize_bits); /* Zero out partial block at the edges of the range */ ret = ext4_zero_partial_blocks(handle, inode, offset, len); if (ret >= 0) diff -u linux-aws-5.13-5.13.0/fs/ext4/fast_commit.c linux-aws-5.13-5.13.0/fs/ext4/fast_commit.c --- linux-aws-5.13-5.13.0/fs/ext4/fast_commit.c +++ linux-aws-5.13-5.13.0/fs/ext4/fast_commit.c @@ -1818,14 +1818,11 @@ } } - down_write(&EXT4_I(inode)->i_data_sem); - ret = ext4_ext_remove_space(inode, lrange.fc_lblk, - lrange.fc_lblk + lrange.fc_len - 1); - up_write(&EXT4_I(inode)->i_data_sem); - if (ret) { - iput(inode); - return 0; - } + ret = ext4_punch_hole(inode, + le32_to_cpu(lrange.fc_lblk) << sb->s_blocksize_bits, + le32_to_cpu(lrange.fc_len) << sb->s_blocksize_bits); + if (ret) + jbd_debug(1, "ext4_punch_hole returned %d", ret); ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >> sb->s_blocksize_bits); ext4_mark_inode_dirty(NULL, inode); @@ -2200,5 +2196,0 @@ - -void ext4_fc_destroy_dentry_cache(void) -{ - kmem_cache_destroy(ext4_fc_dentry_cachep); -} diff -u linux-aws-5.13-5.13.0/fs/ext4/inode.c linux-aws-5.13-5.13.0/fs/ext4/inode.c --- linux-aws-5.13-5.13.0/fs/ext4/inode.c +++ linux-aws-5.13-5.13.0/fs/ext4/inode.c @@ -742,11 +742,10 @@ if (ret) return ret; } - } - if (retval > 0 && (map->m_flags & EXT4_MAP_UNWRITTEN || - map->m_flags & EXT4_MAP_MAPPED)) ext4_fc_track_range(handle, inode, map->m_lblk, - map->m_lblk + map->m_len - 1); + map->m_lblk + map->m_len - 1); + } + if (retval < 0) ext_debug(inode, "failed with err %d\n", retval); return retval; @@ -4445,7 +4444,7 @@ static int __ext4_get_inode_loc_noinmem(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk = 0; + ext4_fsblk_t err_blk; int ret; ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, iloc, 0, @@ -4460,7 +4459,7 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk = 0; + ext4_fsblk_t err_blk; int ret; /* We have all inode data except xattrs in memory here. */ @@ -5468,7 +5467,8 @@ ext4_fc_track_range(handle, inode, (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >> inode->i_sb->s_blocksize_bits, - EXT_MAX_BLOCKS - 1); + (oldsize > 0 ? oldsize - 1 : 0) >> + inode->i_sb->s_blocksize_bits); else ext4_fc_track_range( handle, inode, reverted: --- linux-aws-5.13-5.13.0/fs/ext4/ioctl.c +++ linux-aws-5.13-5.13.0.orig/fs/ext4/ioctl.c @@ -1067,6 +1067,8 @@ sizeof(range))) return -EFAULT; + range.minlen = max((unsigned int)range.minlen, + q->limits.discard_granularity); ret = ext4_trim_fs(sb, &range); if (ret < 0) return ret; diff -u linux-aws-5.13-5.13.0/fs/ext4/mballoc.c linux-aws-5.13-5.13.0/fs/ext4/mballoc.c --- linux-aws-5.13-5.13.0/fs/ext4/mballoc.c +++ linux-aws-5.13-5.13.0/fs/ext4/mballoc.c @@ -4743,7 +4743,7 @@ */ static noinline_for_stack int ext4_mb_discard_group_preallocations(struct super_block *sb, - ext4_group_t group, int *busy) + ext4_group_t group, int needed) { struct ext4_group_info *grp = ext4_get_group_info(sb, group); struct buffer_head *bitmap_bh = NULL; @@ -4751,7 +4751,8 @@ struct list_head list; struct ext4_buddy e4b; int err; - int free = 0; + int busy = 0; + int free, free_total = 0; mb_debug(sb, "discard preallocation for group %u\n", group); if (list_empty(&grp->bb_prealloc_list)) @@ -4774,14 +4775,19 @@ goto out_dbg; } + if (needed == 0) + needed = EXT4_CLUSTERS_PER_GROUP(sb) + 1; + INIT_LIST_HEAD(&list); +repeat: + free = 0; ext4_lock_group(sb, group); list_for_each_entry_safe(pa, tmp, &grp->bb_prealloc_list, pa_group_list) { spin_lock(&pa->pa_lock); if (atomic_read(&pa->pa_count)) { spin_unlock(&pa->pa_lock); - *busy = 1; + busy = 1; continue; } if (pa->pa_deleted) { @@ -4821,13 +4827,22 @@ call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback); } + free_total += free; + + /* if we still need more blocks and some PAs were used, try again */ + if (free_total < needed && busy) { + ext4_unlock_group(sb, group); + cond_resched(); + busy = 0; + goto repeat; + } ext4_unlock_group(sb, group); ext4_mb_unload_buddy(&e4b); put_bh(bitmap_bh); out_dbg: mb_debug(sb, "discarded (%d) blocks preallocated for group %u bb_free (%d)\n", - free, group, grp->bb_free); - return free; + free_total, group, grp->bb_free); + return free_total; } /* @@ -5369,24 +5384,13 @@ { ext4_group_t i, ngroups = ext4_get_groups_count(sb); int ret; - int freed = 0, busy = 0; - int retry = 0; + int freed = 0; trace_ext4_mb_discard_preallocations(sb, needed); - - if (needed == 0) - needed = EXT4_CLUSTERS_PER_GROUP(sb) + 1; - repeat: for (i = 0; i < ngroups && needed > 0; i++) { - ret = ext4_mb_discard_group_preallocations(sb, i, &busy); + ret = ext4_mb_discard_group_preallocations(sb, i, needed); freed += ret; needed -= ret; - cond_resched(); - } - - if (needed > 0 && busy && ++retry < 3) { - busy = 0; - goto repeat; } return freed; @@ -6320,7 +6324,6 @@ */ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) { - struct request_queue *q = bdev_get_queue(sb->s_bdev); struct ext4_group_info *grp; ext4_group_t group, first_group, last_group; ext4_grpblk_t cnt = 0, first_cluster, last_cluster; @@ -6339,13 +6342,6 @@ start >= max_blks || range->len < sb->s_blocksize) return -EINVAL; - /* No point to try to trim less than discard granularity */ - if (range->minlen < q->limits.discard_granularity) { - minlen = EXT4_NUM_B2C(EXT4_SB(sb), - q->limits.discard_granularity >> sb->s_blocksize_bits); - if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) - goto out; - } if (end >= max_blks) end = max_blks - 1; if (end <= first_data_blk) reverted: --- linux-aws-5.13-5.13.0/fs/ext4/migrate.c +++ linux-aws-5.13-5.13.0.orig/fs/ext4/migrate.c @@ -437,12 +437,12 @@ percpu_down_write(&sbi->s_writepages_rwsem); /* + * Worst case we can touch the allocation bitmaps, a bgd + * block, and a block to link in the orphan list. We do need + * need to worry about credits for modifying the quota inode. - * Worst case we can touch the allocation bitmaps and a block - * group descriptor block. We do need need to worry about - * credits for modifying the quota inode. */ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, + 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); - 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); if (IS_ERR(handle)) { retval = PTR_ERR(handle); @@ -459,13 +459,6 @@ ext4_journal_stop(handle); goto out_unlock; } - /* - * Use the correct seed for checksum (i.e. the seed from 'inode'). This - * is so that the metadata blocks will have the correct checksum after - * the migration. - */ - ei = EXT4_I(inode); - EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; i_size_write(tmp_inode, i_size_read(inode)); /* * Set the i_nlink to zero so it will be deleted later @@ -474,6 +467,7 @@ clear_nlink(tmp_inode); ext4_ext_tree_init(handle, tmp_inode); + ext4_orphan_add(handle, tmp_inode); ext4_journal_stop(handle); /* @@ -498,10 +492,17 @@ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); if (IS_ERR(handle)) { + /* + * It is impossible to update on-disk structures without + * a handle, so just rollback in-core changes and live other + * work to orphan_list_cleanup() + */ + ext4_orphan_del(NULL, tmp_inode); retval = PTR_ERR(handle); goto out_tmp_inode; } + ei = EXT4_I(inode); i_data = ei->i_data; memset(&lb, 0, sizeof(lb)); diff -u linux-aws-5.13-5.13.0/fs/ext4/super.c linux-aws-5.13-5.13.0/fs/ext4/super.c --- linux-aws-5.13-5.13.0/fs/ext4/super.c +++ linux-aws-5.13-5.13.0/fs/ext4/super.c @@ -6425,7 +6425,10 @@ lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); err = dquot_quota_on(sb, type, format_id, path); - if (!err) { + if (err) { + lockdep_set_quota_inode(path->dentry->d_inode, + I_DATA_SEM_NORMAL); + } else { struct inode *inode = d_inode(path->dentry); handle_t *handle; @@ -6445,12 +6448,7 @@ ext4_journal_stop(handle); unlock_inode: inode_unlock(inode); - if (err) - dquot_quota_off(sb, type); } - if (err) - lockdep_set_quota_inode(path->dentry->d_inode, - I_DATA_SEM_NORMAL); return err; } @@ -6513,19 +6511,8 @@ "Failed to enable quota tracking " "(type=%d, err=%d). Please run " "e2fsck to fix.", type, err); - for (type--; type >= 0; type--) { - struct inode *inode; - - inode = sb_dqopt(sb)->files[type]; - if (inode) - inode = igrab(inode); + for (type--; type >= 0; type--) dquot_quota_off(sb, type); - if (inode) { - lockdep_set_quota_inode(inode, - I_DATA_SEM_NORMAL); - iput(inode); - } - } return err; } @@ -6629,7 +6616,7 @@ struct buffer_head *bh; handle_t *handle = journal_current_handle(); - if (!handle) { + if (EXT4_SB(sb)->s_journal && !handle) { ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" " cancelled because transaction is not started", (unsigned long long)off, (unsigned long long)len); @@ -6812,7 +6799,6 @@ out: unregister_as_ext2(); unregister_as_ext3(); - ext4_fc_destroy_dentry_cache(); out05: destroy_inodecache(); out1: @@ -6839,7 +6825,6 @@ unregister_as_ext2(); unregister_as_ext3(); unregister_filesystem(&ext4_fs_type); - ext4_fc_destroy_dentry_cache(); destroy_inodecache(); ext4_exit_mballoc(); ext4_exit_sysfs(); diff -u linux-aws-5.13-5.13.0/fs/f2fs/compress.c linux-aws-5.13-5.13.0/fs/f2fs/compress.c --- linux-aws-5.13-5.13.0/fs/f2fs/compress.c +++ linux-aws-5.13-5.13.0/fs/f2fs/compress.c @@ -1417,38 +1417,25 @@ enum iostat_type io_type) { struct address_space *mapping = cc->inode->i_mapping; - int _submitted, compr_blocks, ret, i; + int _submitted, compr_blocks, ret; + int i = -1, err = 0; compr_blocks = f2fs_compressed_blocks(cc); - - for (i = 0; i < cc->cluster_size; i++) { - if (!cc->rpages[i]) - continue; - - redirty_page_for_writepage(wbc, cc->rpages[i]); - unlock_page(cc->rpages[i]); + if (compr_blocks < 0) { + err = compr_blocks; + goto out_err; } - if (compr_blocks < 0) - return compr_blocks; - for (i = 0; i < cc->cluster_size; i++) { if (!cc->rpages[i]) continue; retry_write: - lock_page(cc->rpages[i]); - if (cc->rpages[i]->mapping != mapping) { -continue_unlock: unlock_page(cc->rpages[i]); continue; } - if (!PageDirty(cc->rpages[i])) - goto continue_unlock; - - if (!clear_page_dirty_for_io(cc->rpages[i])) - goto continue_unlock; + BUG_ON(!PageLocked(cc->rpages[i])); ret = f2fs_write_single_data_page(cc->rpages[i], &_submitted, NULL, NULL, wbc, io_type, @@ -1463,15 +1450,26 @@ * avoid deadlock caused by cluster update race * from foreground operation. */ - if (IS_NOQUOTA(cc->inode)) - return 0; + if (IS_NOQUOTA(cc->inode)) { + err = 0; + goto out_err; + } ret = 0; cond_resched(); congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); + lock_page(cc->rpages[i]); + + if (!PageDirty(cc->rpages[i])) { + unlock_page(cc->rpages[i]); + continue; + } + + clear_page_dirty_for_io(cc->rpages[i]); goto retry_write; } - return ret; + err = ret; + goto out_err; } *submitted += _submitted; @@ -1480,6 +1478,14 @@ f2fs_balance_fs(F2FS_M_SB(mapping), true); return 0; +out_err: + for (++i; i < cc->cluster_size; i++) { + if (!cc->rpages[i]) + continue; + redirty_page_for_writepage(wbc, cc->rpages[i]); + unlock_page(cc->rpages[i]); + } + return err; } int f2fs_write_multi_pages(struct compress_ctx *cc, diff -u linux-aws-5.13-5.13.0/fs/f2fs/f2fs.h linux-aws-5.13-5.13.0/fs/f2fs/f2fs.h --- linux-aws-5.13-5.13.0/fs/f2fs/f2fs.h +++ linux-aws-5.13-5.13.0/fs/f2fs/f2fs.h @@ -989,7 +989,6 @@ unsigned int segment_count; /* total # of segments */ unsigned int main_segments; /* # of segments in main area */ unsigned int reserved_segments; /* # of reserved segments */ - unsigned int additional_reserved_segments;/* reserved segs for IO align feature */ unsigned int ovp_segments; /* # of overprovision segments */ /* a threshold to reclaim prefree segments */ @@ -2167,11 +2166,6 @@ if (!__allow_reserved_blocks(sbi, inode, true)) avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks; - - if (F2FS_IO_ALIGNED(sbi)) - avail_user_block_count -= sbi->blocks_per_seg * - SM_I(sbi)->additional_reserved_segments; - if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) { if (avail_user_block_count > sbi->unusable_block_count) avail_user_block_count -= sbi->unusable_block_count; @@ -2418,11 +2412,6 @@ if (!__allow_reserved_blocks(sbi, inode, false)) valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks; - - if (F2FS_IO_ALIGNED(sbi)) - valid_block_count += sbi->blocks_per_seg * - SM_I(sbi)->additional_reserved_segments; - user_block_count = sbi->user_block_count; if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) user_block_count -= sbi->unusable_block_count; diff -u linux-aws-5.13-5.13.0/fs/f2fs/gc.c linux-aws-5.13-5.13.0/fs/f2fs/gc.c --- linux-aws-5.13-5.13.0/fs/f2fs/gc.c +++ linux-aws-5.13-5.13.0/fs/f2fs/gc.c @@ -1020,9 +1020,6 @@ set_sbi_flag(sbi, SBI_NEED_FSCK); } - if (f2fs_check_nid_range(sbi, dni->ino)) - return false; - *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); @@ -1036,7 +1033,7 @@ if (!test_and_set_bit(segno, SIT_I(sbi)->invalid_segmap)) { f2fs_err(sbi, "mismatched blkaddr %u (source_blkaddr %u) in seg %u\n", blkaddr, source_blkaddr, segno); - set_sbi_flag(sbi, SBI_NEED_FSCK); + f2fs_bug_on(sbi, 1); } } #endif @@ -1454,8 +1451,7 @@ if (phase == 3) { inode = f2fs_iget(sb, dni.ino); - if (IS_ERR(inode) || is_bad_inode(inode) || - special_file(inode->i_mode)) + if (IS_ERR(inode) || is_bad_inode(inode)) continue; if (!down_write_trylock( diff -u linux-aws-5.13-5.13.0/fs/f2fs/inode.c linux-aws-5.13-5.13.0/fs/f2fs/inode.c --- linux-aws-5.13-5.13.0/fs/f2fs/inode.c +++ linux-aws-5.13-5.13.0/fs/f2fs/inode.c @@ -516,11 +516,6 @@ } else if (ino == F2FS_COMPRESS_INO(sbi)) { #ifdef CONFIG_F2FS_FS_COMPRESSION inode->i_mapping->a_ops = &f2fs_compress_aops; - /* - * generic_error_remove_page only truncates pages of regular - * inode - */ - inode->i_mode |= S_IFREG; #endif mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE); reverted: --- linux-aws-5.13-5.13.0/fs/f2fs/segment.h +++ linux-aws-5.13-5.13.0.orig/fs/f2fs/segment.h @@ -537,8 +537,7 @@ static inline unsigned int reserved_segments(struct f2fs_sb_info *sbi) { + return SM_I(sbi)->reserved_segments; - return SM_I(sbi)->reserved_segments + - SM_I(sbi)->additional_reserved_segments; } static inline unsigned int free_sections(struct f2fs_sb_info *sbi) diff -u linux-aws-5.13-5.13.0/fs/f2fs/super.c linux-aws-5.13-5.13.0/fs/f2fs/super.c --- linux-aws-5.13-5.13.0/fs/f2fs/super.c +++ linux-aws-5.13-5.13.0/fs/f2fs/super.c @@ -303,46 +303,6 @@ F2FS_OPTION(sbi).s_resgid)); } -static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi) -{ - unsigned int sec_blks = sbi->blocks_per_seg * sbi->segs_per_sec; - unsigned int avg_vblocks; - unsigned int wanted_reserved_segments; - block_t avail_user_block_count; - - if (!F2FS_IO_ALIGNED(sbi)) - return 0; - - /* average valid block count in section in worst case */ - avg_vblocks = sec_blks / F2FS_IO_SIZE(sbi); - - /* - * we need enough free space when migrating one section in worst case - */ - wanted_reserved_segments = (F2FS_IO_SIZE(sbi) / avg_vblocks) * - reserved_segments(sbi); - wanted_reserved_segments -= reserved_segments(sbi); - - avail_user_block_count = sbi->user_block_count - - sbi->current_reserved_blocks - - F2FS_OPTION(sbi).root_reserved_blocks; - - if (wanted_reserved_segments * sbi->blocks_per_seg > - avail_user_block_count) { - f2fs_err(sbi, "IO align feature can't grab additional reserved segment: %u, available segments: %u", - wanted_reserved_segments, - avail_user_block_count >> sbi->log_blocks_per_seg); - return -ENOSPC; - } - - SM_I(sbi)->additional_reserved_segments = wanted_reserved_segments; - - f2fs_info(sbi, "IO align feature needs additional reserved segment: %u", - wanted_reserved_segments); - - return 0; -} - static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi) { if (!F2FS_OPTION(sbi).unusable_cap_perc) @@ -3987,10 +3947,6 @@ goto free_nm; } - err = adjust_reserved_segment(sbi); - if (err) - goto free_nm; - /* For write statistics */ sbi->sectors_written_start = f2fs_get_sectors_written(sbi); diff -u linux-aws-5.13-5.13.0/fs/f2fs/sysfs.c linux-aws-5.13-5.13.0/fs/f2fs/sysfs.c --- linux-aws-5.13-5.13.0/fs/f2fs/sysfs.c +++ linux-aws-5.13-5.13.0/fs/f2fs/sysfs.c @@ -400,9 +400,7 @@ if (a->struct_type == RESERVED_BLOCKS) { spin_lock(&sbi->stat_lock); if (t > (unsigned long)(sbi->user_block_count - - F2FS_OPTION(sbi).root_reserved_blocks - - sbi->blocks_per_seg * - SM_I(sbi)->additional_reserved_segments)) { + F2FS_OPTION(sbi).root_reserved_blocks)) { spin_unlock(&sbi->stat_lock); return -EINVAL; } diff -u linux-aws-5.13-5.13.0/fs/fuse/file.c linux-aws-5.13-5.13.0/fs/fuse/file.c --- linux-aws-5.13-5.13.0/fs/fuse/file.c +++ linux-aws-5.13-5.13.0/fs/fuse/file.c @@ -2918,7 +2918,7 @@ static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end) { - int err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX); + int err = filemap_write_and_wait_range(inode->i_mapping, start, -1); if (!err) fuse_sync_writes(inode); diff -u linux-aws-5.13-5.13.0/fs/io_uring.c linux-aws-5.13-5.13.0/fs/io_uring.c --- linux-aws-5.13-5.13.0/fs/io_uring.c +++ linux-aws-5.13-5.13.0/fs/io_uring.c @@ -5503,7 +5503,6 @@ * update those. For multishot, if we're racing with completion, just * let completion re-add it. */ - io_poll_remove_double(preq); completing = !__io_poll_remove_one(preq, &preq->poll, false); if (completing && (preq->poll.events & EPOLLONESHOT)) { ret = -EALREADY; @@ -7643,15 +7642,10 @@ struct io_ring_ctx *ctx = node->rsrc_data->ctx; unsigned long flags; bool first_add = false; - unsigned long delay = HZ; spin_lock_irqsave(&ctx->rsrc_ref_lock, flags); node->done = true; - /* if we are mid-quiesce then do not delay */ - if (node->rsrc_data->quiesce) - delay = 0; - while (!list_empty(&ctx->rsrc_ref_list)) { node = list_first_entry(&ctx->rsrc_ref_list, struct io_rsrc_node, node); @@ -7664,7 +7658,7 @@ spin_unlock_irqrestore(&ctx->rsrc_ref_lock, flags); if (first_add) - mod_delayed_work(system_wq, &ctx->rsrc_put_work, delay); + mod_delayed_work(system_wq, &ctx->rsrc_put_work, HZ); } static struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx) reverted: --- linux-aws-5.13-5.13.0/fs/jbd2/journal.c +++ linux-aws-5.13-5.13.0.orig/fs/jbd2/journal.c @@ -2791,7 +2791,6 @@ jbd_unlock_bh_journal_head(bh); return jh; } -EXPORT_SYMBOL(jbd2_journal_grab_journal_head); static void __journal_remove_journal_head(struct buffer_head *bh) { @@ -2844,7 +2843,6 @@ jbd_unlock_bh_journal_head(bh); } } -EXPORT_SYMBOL(jbd2_journal_put_journal_head); /* * Initialize jbd inode head reverted: --- linux-aws-5.13-5.13.0/fs/jffs2/file.c +++ linux-aws-5.13-5.13.0.orig/fs/jffs2/file.c @@ -136,15 +136,20 @@ struct page *pg; struct inode *inode = mapping->host; struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); pgoff_t index = pos >> PAGE_SHIFT; uint32_t pageofs = index << PAGE_SHIFT; int ret = 0; + pg = grab_cache_page_write_begin(mapping, index, flags); + if (!pg) + return -ENOMEM; + *pagep = pg; + jffs2_dbg(1, "%s()\n", __func__); if (pageofs > inode->i_size) { /* Make new hole frag from old EOF to new page */ + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); struct jffs2_raw_inode ri; struct jffs2_full_dnode *fn; uint32_t alloc_len; @@ -155,7 +160,7 @@ ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); if (ret) + goto out_page; - goto out_err; mutex_lock(&f->sem); memset(&ri, 0, sizeof(ri)); @@ -185,7 +190,7 @@ ret = PTR_ERR(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); + goto out_page; - goto out_err; } ret = jffs2_add_full_dnode_to_inode(c, f, fn); if (f->metadata) { @@ -200,7 +205,7 @@ jffs2_free_full_dnode(fn); jffs2_complete_reservation(c); mutex_unlock(&f->sem); + goto out_page; - goto out_err; } jffs2_complete_reservation(c); inode->i_size = pageofs; @@ -208,19 +213,6 @@ } /* - * While getting a page and reading data in, lock c->alloc_sem until - * the page is Uptodate. Otherwise GC task may attempt to read the same - * page in read_cache_page(), which causes a deadlock. - */ - mutex_lock(&c->alloc_sem); - pg = grab_cache_page_write_begin(mapping, index, flags); - if (!pg) { - ret = -ENOMEM; - goto release_sem; - } - *pagep = pg; - - /* * Read in the page if it wasn't already present. Cannot optimize away * the whole page write case until jffs2_write_end can handle the * case of a short-copy. @@ -229,17 +221,15 @@ mutex_lock(&f->sem); ret = jffs2_do_readpage_nolock(inode, pg); mutex_unlock(&f->sem); + if (ret) + goto out_page; - if (ret) { - unlock_page(pg); - put_page(pg); - goto release_sem; - } } jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); + return ret; +out_page: + unlock_page(pg); + put_page(pg); -release_sem: - mutex_unlock(&c->alloc_sem); -out_err: return ret; } diff -u linux-aws-5.13-5.13.0/fs/namei.c linux-aws-5.13-5.13.0/fs/namei.c --- linux-aws-5.13-5.13.0/fs/namei.c +++ linux-aws-5.13-5.13.0/fs/namei.c @@ -3900,12 +3900,13 @@ dentry->d_inode->i_flags |= S_DEAD; dont_mount(dentry); detach_mounts(dentry); + fsnotify_rmdir(dir, dentry); out: inode_unlock(dentry->d_inode); dput(dentry); if (!error) - d_delete_notify(dir, dentry); + d_delete(dentry); return error; } EXPORT_SYMBOL(vfs_rmdir); @@ -4025,6 +4026,7 @@ if (!error) { dont_mount(dentry); detach_mounts(dentry); + fsnotify_unlink(dir, dentry); } } } @@ -4032,11 +4034,9 @@ inode_unlock(target); /* We don't d_delete() NFS sillyrenamed files--they still exist. */ - if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { - fsnotify_unlink(dir, dentry); - } else if (!error) { + if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { fsnotify_link_count(target); - d_delete_notify(dir, dentry); + d_delete(dentry); } return error; diff -u linux-aws-5.13-5.13.0/fs/nfs/dir.c linux-aws-5.13-5.13.0/fs/nfs/dir.c --- linux-aws-5.13-5.13.0/fs/nfs/dir.c +++ linux-aws-5.13-5.13.0/fs/nfs/dir.c @@ -1982,24 +1982,6 @@ no_open: res = nfs_lookup(dir, dentry, lookup_flags); - if (!res) { - inode = d_inode(dentry); - if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) - res = ERR_PTR(-ENOTDIR); - else if (inode && S_ISREG(inode->i_mode)) - res = ERR_PTR(-EOPENSTALE); - } else if (!IS_ERR(res)) { - inode = d_inode(res); - if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) { - dput(res); - res = ERR_PTR(-ENOTDIR); - } else if (inode && S_ISREG(inode->i_mode)) { - dput(res); - res = ERR_PTR(-EOPENSTALE); - } - } if (switched) { d_lookup_done(dentry); if (!res) @@ -2400,8 +2382,6 @@ trace_nfs_link_enter(inode, dir, dentry); d_drop(dentry); - if (S_ISREG(inode->i_mode)) - nfs_sync_inode(inode); error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); if (error == 0) { ihold(inode); @@ -2490,8 +2470,6 @@ } } - if (S_ISREG(old_inode->i_mode)) - nfs_sync_inode(old_inode); task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL); if (IS_ERR(task)) { error = PTR_ERR(task); diff -u linux-aws-5.13-5.13.0/fs/nfsd/nfsctl.c linux-aws-5.13-5.13.0/fs/nfsd/nfsctl.c --- linux-aws-5.13-5.13.0/fs/nfsd/nfsctl.c +++ linux-aws-5.13-5.13.0/fs/nfsd/nfsctl.c @@ -1249,8 +1249,7 @@ clear_ncl(d_inode(dentry)); dget(dentry); ret = simple_unlink(dir, dentry); - d_drop(dentry); - fsnotify_unlink(dir, dentry); + d_delete(dentry); dput(dentry); WARN_ON_ONCE(ret); } @@ -1341,8 +1340,8 @@ dget(dentry); ret = simple_rmdir(dir, dentry); WARN_ON_ONCE(ret); - d_drop(dentry); fsnotify_rmdir(dir, dentry); + d_delete(dentry); dput(dentry); inode_unlock(dir); } diff -u linux-aws-5.13-5.13.0/fs/ocfs2/suballoc.c linux-aws-5.13-5.13.0/fs/ocfs2/suballoc.c --- linux-aws-5.13-5.13.0/fs/ocfs2/suballoc.c +++ linux-aws-5.13-5.13.0/fs/ocfs2/suballoc.c @@ -1251,23 +1251,26 @@ { struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; struct journal_head *jh; - int ret; + int ret = 1; if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) return 0; - jh = jbd2_journal_grab_journal_head(bg_bh); - if (!jh) + if (!buffer_jbd(bg_bh)) return 1; - spin_lock(&jh->b_state_lock); - bg = (struct ocfs2_group_desc *) jh->b_committed_data; - if (bg) - ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); - else - ret = 1; - spin_unlock(&jh->b_state_lock); - jbd2_journal_put_journal_head(jh); + jbd_lock_bh_journal_head(bg_bh); + if (buffer_jbd(bg_bh)) { + jh = bh2jh(bg_bh); + spin_lock(&jh->b_state_lock); + bg = (struct ocfs2_group_desc *) jh->b_committed_data; + if (bg) + ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); + else + ret = 1; + spin_unlock(&jh->b_state_lock); + } + jbd_unlock_bh_journal_head(bg_bh); return ret; } reverted: --- linux-aws-5.13-5.13.0/fs/select.c +++ linux-aws-5.13-5.13.0.orig/fs/select.c @@ -458,11 +458,9 @@ return max; } +#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN | EPOLLHUP | EPOLLERR) +#define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT | EPOLLERR) +#define POLLEX_SET (EPOLLPRI) -#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN | EPOLLHUP | EPOLLERR |\ - EPOLLNVAL) -#define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT | EPOLLERR |\ - EPOLLNVAL) -#define POLLEX_SET (EPOLLPRI | EPOLLNVAL) static inline void wait_key_set(poll_table *wait, unsigned long in, unsigned long out, unsigned long bit, @@ -529,7 +527,6 @@ break; if (!(bit & all_bits)) continue; - mask = EPOLLNVAL; f = fdget(i); if (f.file) { wait_key_set(wait, in, out, bit, @@ -537,34 +534,34 @@ mask = vfs_poll(f.file, wait); fdput(f); + if ((mask & POLLIN_SET) && (in & bit)) { + res_in |= bit; + retval++; + wait->_qproc = NULL; + } + if ((mask & POLLOUT_SET) && (out & bit)) { + res_out |= bit; + retval++; + wait->_qproc = NULL; + } + if ((mask & POLLEX_SET) && (ex & bit)) { + res_ex |= bit; + retval++; + wait->_qproc = NULL; + } + /* got something, stop busy polling */ + if (retval) { + can_busy_loop = false; + busy_flag = 0; + + /* + * only remember a returned + * POLL_BUSY_LOOP if we asked for it + */ + } else if (busy_flag & mask) + can_busy_loop = true; + } - if ((mask & POLLIN_SET) && (in & bit)) { - res_in |= bit; - retval++; - wait->_qproc = NULL; - } - if ((mask & POLLOUT_SET) && (out & bit)) { - res_out |= bit; - retval++; - wait->_qproc = NULL; - } - if ((mask & POLLEX_SET) && (ex & bit)) { - res_ex |= bit; - retval++; - wait->_qproc = NULL; - } - /* got something, stop busy polling */ - if (retval) { - can_busy_loop = false; - busy_flag = 0; - - /* - * only remember a returned - * POLL_BUSY_LOOP if we asked for it - */ - } else if (busy_flag & mask) - can_busy_loop = true; - } if (res_in) *rinp = res_in; diff -u linux-aws-5.13-5.13.0/fs/ubifs/super.c linux-aws-5.13-5.13.0/fs/ubifs/super.c --- linux-aws-5.13-5.13.0/fs/ubifs/super.c +++ linux-aws-5.13-5.13.0/fs/ubifs/super.c @@ -1853,6 +1853,7 @@ kthread_stop(c->bgt); c->bgt = NULL; } + free_wbufs(c); kfree(c->write_reserve_buf); c->write_reserve_buf = NULL; vfree(c->ileb_buf); reverted: --- linux-aws-5.13-5.13.0/fs/udf/ialloc.c +++ linux-aws-5.13-5.13.0.orig/fs/udf/ialloc.c @@ -77,7 +77,6 @@ GFP_KERNEL); } if (!iinfo->i_data) { - make_bad_inode(inode); iput(inode); return ERR_PTR(-ENOMEM); } @@ -87,7 +86,6 @@ dinfo->i_location.partitionReferenceNum, start, &err); if (err) { - make_bad_inode(inode); iput(inode); return ERR_PTR(err); } reverted: --- linux-aws-5.13-5.13.0/fs/udf/inode.c +++ linux-aws-5.13-5.13.0.orig/fs/udf/inode.c @@ -257,6 +257,10 @@ char *kaddr; struct udf_inode_info *iinfo = UDF_I(inode); int err; + struct writeback_control udf_wbc = { + .sync_mode = WB_SYNC_NONE, + .nr_to_write = 1, + }; WARN_ON_ONCE(!inode_is_locked(inode)); if (!iinfo->i_lenAlloc) { @@ -300,10 +304,8 @@ iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; /* from now on we have normal address_space methods */ inode->i_data.a_ops = &udf_aops; - set_page_dirty(page); - unlock_page(page); up_write(&iinfo->i_data_sem); + err = inode->i_data.a_ops->writepage(page, &udf_wbc); - err = filemap_fdatawrite(inode->i_mapping); if (err) { /* Restore everything back so that we don't lose data... */ lock_page(page); @@ -314,7 +316,6 @@ unlock_page(page); iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; inode->i_data.a_ops = &udf_adinicb_aops; - iinfo->i_lenAlloc = inode->i_size; up_write(&iinfo->i_data_sem); } put_page(page); diff -u linux-aws-5.13-5.13.0/include/acpi/acpi_bus.h linux-aws-5.13-5.13.0/include/acpi/acpi_bus.h --- linux-aws-5.13-5.13.0/include/acpi/acpi_bus.h +++ linux-aws-5.13-5.13.0/include/acpi/acpi_bus.h @@ -606,10 +606,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev); #ifdef CONFIG_X86 -bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status); +bool acpi_device_always_present(struct acpi_device *adev); #else -static inline bool acpi_device_override_status(struct acpi_device *adev, - unsigned long long *status) +static inline bool acpi_device_always_present(struct acpi_device *adev) { return false; } reverted: --- linux-aws-5.13-5.13.0/include/acpi/actypes.h +++ linux-aws-5.13-5.13.0.orig/include/acpi/actypes.h @@ -536,14 +536,8 @@ * Can be used with access_width of struct acpi_generic_address and access_size of * struct acpi_resource_generic_register. */ +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) +#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) -#define ACPI_ACCESS_BIT_SHIFT 2 -#define ACPI_ACCESS_BYTE_SHIFT -1 -#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) -#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) -#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) -#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) /******************************************************************************* * reverted: --- linux-aws-5.13-5.13.0/include/asm-generic/bitops/find.h +++ linux-aws-5.13-5.13.0.orig/include/asm-generic/bitops/find.h @@ -97,7 +97,6 @@ #ifdef CONFIG_GENERIC_FIND_FIRST_BIT -#ifndef find_first_bit /** * find_first_bit - find the first set bit in a memory region * @addr: The address to start the search at @@ -117,9 +116,7 @@ return _find_first_bit(addr, size); } -#endif -#ifndef find_first_zero_bit /** * find_first_zero_bit - find the first cleared bit in a memory region * @addr: The address to start the search at @@ -139,8 +136,6 @@ return _find_first_zero_bit(addr, size); } -#endif - #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ #ifndef find_first_bit diff -u linux-aws-5.13-5.13.0/include/linux/acpi.h linux-aws-5.13-5.13.0/include/linux/acpi.h --- linux-aws-5.13-5.13.0/include/linux/acpi.h +++ linux-aws-5.13-5.13.0/include/linux/acpi.h @@ -502,7 +502,7 @@ int acpi_resources_are_enforced(void); #ifdef CONFIG_HIBERNATION -extern int acpi_check_s4_hw_signature; +void __init acpi_no_s4_hw_signature(void); #endif #ifdef CONFIG_PM_SLEEP reverted: --- linux-aws-5.13-5.13.0/include/linux/blk-pm.h +++ linux-aws-5.13-5.13.0.orig/include/linux/blk-pm.h @@ -14,7 +14,7 @@ extern int blk_pre_runtime_suspend(struct request_queue *q); extern void blk_post_runtime_suspend(struct request_queue *q, int err); extern void blk_pre_runtime_resume(struct request_queue *q); +extern void blk_post_runtime_resume(struct request_queue *q, int err); -extern void blk_post_runtime_resume(struct request_queue *q); extern void blk_set_runtime_active(struct request_queue *q); #else static inline void blk_pm_runtime_init(struct request_queue *q, diff -u linux-aws-5.13-5.13.0/include/linux/bpf_verifier.h linux-aws-5.13-5.13.0/include/linux/bpf_verifier.h --- linux-aws-5.13-5.13.0/include/linux/bpf_verifier.h +++ linux-aws-5.13-5.13.0/include/linux/bpf_verifier.h @@ -382,13 +382,6 @@ log->level == BPF_LOG_KERNEL); } -static inline bool -bpf_verifier_log_attr_valid(const struct bpf_verifier_log *log) -{ - return log->len_total >= 128 && log->len_total <= UINT_MAX >> 2 && - log->level && log->ubuf && !(log->level & ~BPF_LOG_MASK); -} - #define BPF_MAX_SUBPROGS 256 struct bpf_subprog_info { diff -u linux-aws-5.13-5.13.0/include/linux/clocksource.h linux-aws-5.13-5.13.0/include/linux/clocksource.h --- linux-aws-5.13-5.13.0/include/linux/clocksource.h +++ linux-aws-5.13-5.13.0/include/linux/clocksource.h @@ -43,8 +43,6 @@ * @shift: Cycle to nanosecond divisor (power of two) * @max_idle_ns: Maximum idle time permitted by the clocksource (nsecs) * @maxadj: Maximum adjustment value to mult (~11%) - * @uncertainty_margin: Maximum uncertainty in nanoseconds per half second. - * Zero says to use default WATCHDOG_THRESHOLD. * @archdata: Optional arch-specific data * @max_cycles: Maximum safe cycle value which won't overflow on * multiplication @@ -100,7 +98,6 @@ u32 shift; u64 max_idle_ns; u32 maxadj; - u32 uncertainty_margin; #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA struct arch_clocksource_data archdata; #endif reverted: --- linux-aws-5.13-5.13.0/include/linux/fsnotify.h +++ linux-aws-5.13-5.13.0.orig/include/linux/fsnotify.h @@ -204,52 +204,16 @@ } /* - * fsnotify_delete - @dentry was unlinked and unhashed - * - * Caller must make sure that dentry->d_name is stable. - * - * Note: unlike fsnotify_unlink(), we have to pass also the unlinked inode - * as this may be called after d_delete() and old_dentry may be negative. - */ -static inline void fsnotify_delete(struct inode *dir, struct inode *inode, - struct dentry *dentry) -{ - __u32 mask = FS_DELETE; - - if (S_ISDIR(inode->i_mode)) - mask |= FS_ISDIR; - - fsnotify_name(dir, mask, inode, &dentry->d_name, 0); -} - -/** - * d_delete_notify - delete a dentry and call fsnotify_delete() - * @dentry: The dentry to delete - * - * This helper is used to guaranty that the unlinked inode cannot be found - * by lookup of this name after fsnotify_delete() event has been delivered. - */ -static inline void d_delete_notify(struct inode *dir, struct dentry *dentry) -{ - struct inode *inode = d_inode(dentry); - - ihold(inode); - d_delete(dentry); - fsnotify_delete(dir, inode, dentry); - iput(inode); -} - -/* * fsnotify_unlink - 'name' was unlinked * * Caller must make sure that dentry->d_name is stable. */ static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) { + /* Expected to be called before d_delete() */ + WARN_ON_ONCE(d_is_negative(dentry)); - if (WARN_ON_ONCE(d_is_negative(dentry))) - return; + fsnotify_dirent(dir, dentry, FS_DELETE); - fsnotify_delete(dir, d_inode(dentry), dentry); } /* @@ -269,10 +233,10 @@ */ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) { + /* Expected to be called before d_delete() */ + WARN_ON_ONCE(d_is_negative(dentry)); - if (WARN_ON_ONCE(d_is_negative(dentry))) - return; + fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR); - fsnotify_delete(dir, d_inode(dentry), dentry); } /* diff -u linux-aws-5.13-5.13.0/include/linux/hid.h linux-aws-5.13-5.13.0/include/linux/hid.h --- linux-aws-5.13-5.13.0/include/linux/hid.h +++ linux-aws-5.13-5.13.0/include/linux/hid.h @@ -348,8 +348,6 @@ /* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ #define HID_QUIRK_ALWAYS_POLL BIT(10) #define HID_QUIRK_INPUT_PER_APP BIT(11) -#define HID_QUIRK_X_INVERT BIT(12) -#define HID_QUIRK_Y_INVERT BIT(13) #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) reverted: --- linux-aws-5.13-5.13.0/include/linux/iio/trigger.h +++ linux-aws-5.13-5.13.0.orig/include/linux/iio/trigger.h @@ -55,7 +55,6 @@ * @attached_own_device:[INTERN] if we are using our own device as trigger, * i.e. if we registered a poll function to the same * device as the one providing the trigger. - * @reenable_work: [INTERN] work item used to ensure reenable can sleep. **/ struct iio_trigger { const struct iio_trigger_ops *ops; @@ -75,7 +74,6 @@ unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)]; struct mutex pool_lock; bool attached_own_device; - struct work_struct reenable_work; }; diff -u linux-aws-5.13-5.13.0/include/linux/ipv6.h linux-aws-5.13-5.13.0/include/linux/ipv6.h --- linux-aws-5.13-5.13.0/include/linux/ipv6.h +++ linux-aws-5.13-5.13.0/include/linux/ipv6.h @@ -129,7 +129,6 @@ __u16 dsthao; #endif __u16 frag_max_size; - __u16 srhoff; #define IP6SKB_XFRM_TRANSFORMED 1 #define IP6SKB_FORWARDED 2 @@ -139,7 +138,6 @@ #define IP6SKB_HOPBYHOP 32 #define IP6SKB_L3SLAVE 64 #define IP6SKB_JUMBOGRAM 128 -#define IP6SKB_SEG6 256 }; #if defined(CONFIG_NET_L3_MASTER_DEV) diff -u linux-aws-5.13-5.13.0/include/linux/mm.h linux-aws-5.13-5.13.0/include/linux/mm.h --- linux-aws-5.13-5.13.0/include/linux/mm.h +++ linux-aws-5.13-5.13.0/include/linux/mm.h @@ -1507,18 +1507,11 @@ static inline void page_kasan_tag_set(struct page *page, u8 tag) { - unsigned long old_flags, flags; - - if (!kasan_enabled()) - return; - - tag ^= 0xff; - old_flags = READ_ONCE(page->flags); - do { - flags = old_flags; - flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); - flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); + if (kasan_enabled()) { + tag ^= 0xff; + page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); + page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; + } } static inline void page_kasan_tag_reset(struct page *page) reverted: --- linux-aws-5.13-5.13.0/include/linux/mmzone.h +++ linux-aws-5.13-5.13.0.orig/include/linux/mmzone.h @@ -1003,15 +1003,6 @@ #endif } -#ifdef CONFIG_ZONE_DMA -bool has_managed_dma(void); -#else -static inline bool has_managed_dma(void) -{ - return false; -} -#endif - /** * is_highmem - helper function to quickly check if a struct zone is a * highmem zone or not. This is an attempt to keep references reverted: --- linux-aws-5.13-5.13.0/include/linux/mtd/rawnand.h +++ linux-aws-5.13-5.13.0.orig/include/linux/mtd/rawnand.h @@ -1389,8 +1389,6 @@ bool force_8bit, bool check_only); int nand_write_data_op(struct nand_chip *chip, const void *buf, unsigned int len, bool force_8bit); -int nand_read_page_hwecc_oob_first(struct nand_chip *chip, uint8_t *buf, - int oob_required, int page); /* Scan and identify a NAND device */ int nand_scan_with_ids(struct nand_chip *chip, unsigned int max_chips, diff -u linux-aws-5.13-5.13.0/include/linux/netdevice.h linux-aws-5.13-5.13.0/include/linux/netdevice.h --- linux-aws-5.13-5.13.0/include/linux/netdevice.h +++ linux-aws-5.13-5.13.0/include/linux/netdevice.h @@ -2616,7 +2616,6 @@ struct net_device *); bool (*id_match)(struct packet_type *ptype, struct sock *sk); - struct net *af_packet_net; void *af_packet_priv; struct list_head list; }; diff -u linux-aws-5.13-5.13.0/include/linux/perf_event.h linux-aws-5.13-5.13.0/include/linux/perf_event.h --- linux-aws-5.13-5.13.0/include/linux/perf_event.h +++ linux-aws-5.13-5.13.0/include/linux/perf_event.h @@ -680,6 +680,18 @@ u64 total_time_running; u64 tstamp; + /* + * timestamp shadows the actual context timing but it can + * be safely used in NMI interrupt context. It reflects the + * context time as it was when the event was last scheduled in, + * or when ctx_sched_in failed to schedule the event because we + * run out of PMC. + * + * ctx_time already accounts for ctx->timestamp. Therefore to + * compute ctx_time for a sample, simply add perf_clock(). + */ + u64 shadow_ctx_time; + struct perf_event_attr attr; u16 header_size; u16 id_header_size; @@ -825,7 +837,6 @@ */ u64 time; u64 timestamp; - u64 timeoffset; /* * These fields let us detect when two contexts have both @@ -908,8 +919,6 @@ struct perf_cgroup_info { u64 time; u64 timestamp; - u64 timeoffset; - int active; }; struct perf_cgroup { diff -u linux-aws-5.13-5.13.0/include/linux/pm_runtime.h linux-aws-5.13-5.13.0/include/linux/pm_runtime.h --- linux-aws-5.13-5.13.0/include/linux/pm_runtime.h +++ linux-aws-5.13-5.13.0/include/linux/pm_runtime.h @@ -58,7 +58,6 @@ extern void pm_runtime_put_suppliers(struct device *dev); extern void pm_runtime_new_link(struct device *dev); extern void pm_runtime_drop_link(struct device_link *link); -extern void pm_runtime_release_supplier(struct device_link *link, bool check_idle); /** * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter. @@ -280,8 +279,6 @@ static inline void pm_runtime_put_suppliers(struct device *dev) {} static inline void pm_runtime_new_link(struct device *dev) {} static inline void pm_runtime_drop_link(struct device_link *link) {} -static inline void pm_runtime_release_supplier(struct device_link *link, - bool check_idle) {} #endif /* !CONFIG_PM */ reverted: --- linux-aws-5.13-5.13.0/include/linux/psi.h +++ linux-aws-5.13-5.13.0.orig/include/linux/psi.h @@ -24,17 +24,18 @@ void psi_memstall_leave(unsigned long *flags); int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); + +#ifdef CONFIG_CGROUPS +int psi_cgroup_alloc(struct cgroup *cgrp); +void psi_cgroup_free(struct cgroup *cgrp); +void cgroup_move_task(struct task_struct *p, struct css_set *to); + struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, size_t nbytes, enum psi_res res); +void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t); -void psi_trigger_destroy(struct psi_trigger *t); __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, poll_table *wait); - -#ifdef CONFIG_CGROUPS -int psi_cgroup_alloc(struct cgroup *cgrp); -void psi_cgroup_free(struct cgroup *cgrp); -void cgroup_move_task(struct task_struct *p, struct css_set *to); #endif #else /* CONFIG_PSI */ reverted: --- linux-aws-5.13-5.13.0/include/linux/psi_types.h +++ linux-aws-5.13-5.13.0.orig/include/linux/psi_types.h @@ -21,17 +21,7 @@ * don't have to special case any state tracking for it. */ NR_ONCPU, + NR_PSI_TASK_COUNTS = 4, - /* - * For IO and CPU stalls the presence of running/oncpu tasks - * in the domain means a partial rather than a full stall. - * For memory it's not so simple because of page reclaimers: - * they are running/oncpu while representing a stall. To tell - * whether a domain has productivity left or not, we need to - * distinguish between regular running (i.e. productive) - * threads and memstall ones. - */ - NR_MEMSTALL_RUNNING, - NR_PSI_TASK_COUNTS = 5, }; /* Task state bitmasks */ @@ -39,7 +29,6 @@ #define TSK_MEMSTALL (1 << NR_MEMSTALL) #define TSK_RUNNING (1 << NR_RUNNING) #define TSK_ONCPU (1 << NR_ONCPU) -#define TSK_MEMSTALL_RUNNING (1 << NR_MEMSTALL_RUNNING) /* Resources that workloads could be stalled on */ enum psi_res { @@ -140,6 +129,9 @@ * events to one per window */ u64 last_event_time; + + /* Refcounting to prevent premature destruction */ + struct kref refcount; }; struct psi_group { diff -u linux-aws-5.13-5.13.0/include/linux/skbuff.h linux-aws-5.13-5.13.0/include/linux/skbuff.h --- linux-aws-5.13-5.13.0/include/linux/skbuff.h +++ linux-aws-5.13-5.13.0/include/linux/skbuff.h @@ -285,10 +285,7 @@ struct tc_skb_ext { __u32 chain; __u16 mru; - __u16 zone; - u8 post_ct:1; - u8 post_ct_snat:1; - u8 post_ct_dnat:1; + bool post_ct; }; #endif @@ -1363,7 +1360,7 @@ struct flow_dissector *flow_dissector, void *target_container, u16 *ctinfo_map, size_t mapsize, - bool post_ct, u16 zone); + bool post_ct); void skb_flow_dissect_tunnel_info(const struct sk_buff *skb, struct flow_dissector *flow_dissector, diff -u linux-aws-5.13-5.13.0/include/linux/stmmac.h linux-aws-5.13-5.13.0/include/linux/stmmac.h --- linux-aws-5.13-5.13.0/include/linux/stmmac.h +++ linux-aws-5.13-5.13.0/include/linux/stmmac.h @@ -218,7 +218,6 @@ int (*clks_config)(void *priv, bool enabled); int (*crosststamp)(ktime_t *device, struct system_counterval_t *system, void *ctx); - void (*dump_debug_regs)(void *priv); void *bsp_priv; struct clk *stmmac_clk; struct clk *pclk; reverted: --- linux-aws-5.13-5.13.0/include/linux/suspend.h +++ linux-aws-5.13-5.13.0.orig/include/linux/suspend.h @@ -446,7 +446,6 @@ extern asmlinkage int swsusp_arch_suspend(void); extern asmlinkage int swsusp_arch_resume(void); -extern u32 swsusp_hardware_signature; extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); extern int hibernate(void); extern bool system_entering_hibernation(void); @@ -506,14 +505,14 @@ /* drivers/base/power/wakeup.c */ extern bool events_check_enabled; +extern unsigned int pm_wakeup_irq; extern suspend_state_t pm_suspend_target_state; extern bool pm_wakeup_pending(void); extern void pm_system_wakeup(void); extern void pm_system_cancel_wakeup(void); +extern void pm_wakeup_clear(bool reset); -extern void pm_wakeup_clear(unsigned int irq_number); extern void pm_system_irq_wakeup(unsigned int irq_number); -extern unsigned int pm_wakeup_irq(void); extern bool pm_get_wakeup_count(unsigned int *count, bool block); extern bool pm_save_wakeup_count(unsigned int count); extern void pm_wakep_autosleep_enabled(bool set); reverted: --- linux-aws-5.13-5.13.0/include/linux/usb/role.h +++ linux-aws-5.13-5.13.0.orig/include/linux/usb/role.h @@ -91,12 +91,6 @@ static inline void usb_role_switch_put(struct usb_role_switch *sw) { } static inline struct usb_role_switch * -usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode) -{ - return NULL; -} - -static inline struct usb_role_switch * usb_role_switch_register(struct device *parent, const struct usb_role_switch_desc *desc) { reverted: --- linux-aws-5.13-5.13.0/include/media/cec.h +++ linux-aws-5.13-5.13.0.orig/include/media/cec.h @@ -26,17 +26,13 @@ * @dev: cec device * @cdev: cec character device * @minor: device node minor number - * @lock: lock to serialize open/release and registration * @registered: the device was correctly registered * @unregistered: the device was unregistered - * @lock_fhs: lock to control access to @fhs * @fhs: the list of open filehandles (cec_fh) + * @lock: lock to control access to this structure * * This structure represents a cec-related device node. * - * To add or remove filehandles from @fhs the @lock must be taken first, - * followed by @lock_fhs. It is safe to access @fhs if either lock is held. - * * The @parent is a physical device. It must be set by core or device drivers * before registering the node. */ @@ -47,13 +43,10 @@ /* device info */ int minor; - /* serialize open/release and registration */ - struct mutex lock; bool registered; bool unregistered; - /* protect access to fhs */ - struct mutex lock_fhs; struct list_head fhs; + struct mutex lock; }; struct cec_adapter; reverted: --- linux-aws-5.13-5.13.0/include/net/addrconf.h +++ linux-aws-5.13-5.13.0.orig/include/net/addrconf.h @@ -6,8 +6,6 @@ #define RTR_SOLICITATION_INTERVAL (4*HZ) #define RTR_SOLICITATION_MAX_INTERVAL (3600*HZ) /* 1 hour */ -#define MIN_VALID_LIFETIME (2*3600) /* 2 hours */ - #define TEMP_VALID_LIFETIME (7*86400) #define TEMP_PREFERRED_LIFETIME (86400) #define REGEN_MAX_RETRY (3) reverted: --- linux-aws-5.13-5.13.0/include/net/inet_frag.h +++ linux-aws-5.13-5.13.0.orig/include/net/inet_frag.h @@ -117,15 +117,8 @@ static inline void fqdir_pre_exit(struct fqdir *fqdir) { + fqdir->high_thresh = 0; /* prevent creation of new frags */ + fqdir->dead = true; - /* Prevent creation of new frags. - * Pairs with READ_ONCE() in inet_frag_find(). - */ - WRITE_ONCE(fqdir->high_thresh, 0); - - /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() - * and ip6frag_expire_frag_queue(). - */ - WRITE_ONCE(fqdir->dead, true); } void fqdir_exit(struct fqdir *fqdir); diff -u linux-aws-5.13-5.13.0/include/net/ip.h linux-aws-5.13-5.13.0/include/net/ip.h --- linux-aws-5.13-5.13.0/include/net/ip.h +++ linux-aws-5.13-5.13.0/include/net/ip.h @@ -506,18 +506,19 @@ { struct iphdr *iph = ip_hdr(skb); - /* We had many attacks based on IPID, use the private - * generator as much as we can. - */ - if (sk && inet_sk(sk)->inet_daddr) { - iph->id = htons(inet_sk(sk)->inet_id); - inet_sk(sk)->inet_id += segs; - return; - } if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) { - iph->id = 0; + /* This is only to work around buggy Windows95/2000 + * VJ compression implementations. If the ID field + * does not change, they drop every other packet in + * a TCP stream using header compression. + */ + if (sk && inet_sk(sk)->inet_daddr) { + iph->id = htons(inet_sk(sk)->inet_id); + inet_sk(sk)->inet_id += segs; + } else { + iph->id = 0; + } } else { - /* Unfortunately we need the big hammer to get a suitable IPID */ __ip_select_ident(net, iph, segs); } } diff -u linux-aws-5.13-5.13.0/include/net/ip6_fib.h linux-aws-5.13-5.13.0/include/net/ip6_fib.h --- linux-aws-5.13-5.13.0/include/net/ip6_fib.h +++ linux-aws-5.13-5.13.0/include/net/ip6_fib.h @@ -281,7 +281,7 @@ fn = rcu_dereference(f6i->fib6_node); if (fn) { - *cookie = READ_ONCE(fn->fn_sernum); + *cookie = fn->fn_sernum; /* pairs with smp_wmb() in fib6_update_sernum_upto_root() */ smp_rmb(); status = true; reverted: --- linux-aws-5.13-5.13.0/include/net/ipv6_frag.h +++ linux-aws-5.13-5.13.0.orig/include/net/ipv6_frag.h @@ -67,8 +67,7 @@ struct sk_buff *head; rcu_read_lock(); + if (fq->q.fqdir->dead) - /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ - if (READ_ONCE(fq->q.fqdir->dead)) goto out_rcu_unlock; spin_lock(&fq->q.lock); diff -u linux-aws-5.13-5.13.0/include/net/pkt_sched.h linux-aws-5.13-5.13.0/include/net/pkt_sched.h --- linux-aws-5.13-5.13.0/include/net/pkt_sched.h +++ linux-aws-5.13-5.13.0/include/net/pkt_sched.h @@ -197,10 +197,7 @@ struct qdisc_skb_cb qdisc_cb; u16 mru; - u8 post_ct:1; - u8 post_ct_snat:1; - u8 post_ct_dnat:1; - u16 zone; /* Only valid if post_ct = true */ + bool post_ct; }; static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) reverted: --- linux-aws-5.13-5.13.0/include/net/route.h +++ linux-aws-5.13-5.13.0.orig/include/net/route.h @@ -369,7 +369,7 @@ { struct neighbour *neigh; + neigh = __ipv4_neigh_lookup_noref(dev, daddr); - neigh = __ipv4_neigh_lookup_noref(dev, (__force u32)daddr); if (unlikely(!neigh)) neigh = __neigh_create(&arp_tbl, &daddr, dev, false); diff -u linux-aws-5.13-5.13.0/include/net/sch_generic.h linux-aws-5.13-5.13.0/include/net/sch_generic.h --- linux-aws-5.13-5.13.0/include/net/sch_generic.h +++ linux-aws-5.13-5.13.0/include/net/sch_generic.h @@ -1255,7 +1255,6 @@ u64 rate_bytes_ps; /* bytes per second */ u32 mult; u16 overhead; - u16 mpu; u8 linklayer; u8 shift; }; @@ -1265,9 +1264,6 @@ { len += r->overhead; - if (len < r->mpu) - len = r->mpu; - if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; @@ -1290,7 +1286,6 @@ res->rate = min_t(u64, r->rate_bytes_ps, ~0U); res->overhead = r->overhead; - res->mpu = r->mpu; res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); } reverted: --- linux-aws-5.13-5.13.0/include/net/seg6.h +++ linux-aws-5.13-5.13.0.orig/include/net/seg6.h @@ -58,30 +58,9 @@ extern void seg6_local_exit(void); extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced); -extern struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags); -extern void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt); extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto); extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh); extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr, u32 tbl_id); - -/* If the packet which invoked an ICMP error contains an SRH return - * the true destination address from within the SRH, otherwise use the - * destination address in the IP header. - */ -static inline const struct in6_addr *seg6_get_daddr(struct sk_buff *skb, - struct inet6_skb_parm *opt) -{ - struct ipv6_sr_hdr *srh; - - if (opt->flags & IP6SKB_SEG6) { - srh = (struct ipv6_sr_hdr *)(skb->data + opt->srhoff); - return &srh->segments[0]; - } - - return NULL; -} - - #endif diff -u linux-aws-5.13-5.13.0/include/net/sock.h linux-aws-5.13-5.13.0/include/net/sock.h --- linux-aws-5.13-5.13.0/include/net/sock.h +++ linux-aws-5.13-5.13.0/include/net/sock.h @@ -2709,6 +2709,7 @@ extern __u32 sysctl_wmem_default; extern __u32 sysctl_rmem_default; +#define SKB_FRAG_PAGE_ORDER get_order(32768) DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key); static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto) diff -u linux-aws-5.13-5.13.0/include/net/xfrm.h linux-aws-5.13-5.13.0/include/net/xfrm.h --- linux-aws-5.13-5.13.0/include/net/xfrm.h +++ linux-aws-5.13-5.13.0/include/net/xfrm.h @@ -193,11 +193,6 @@ struct xfrm_algo_aead *aead; const char *geniv; - /* mapping change rate limiting */ - __be16 new_mapping_sport; - u32 new_mapping; /* seconds */ - u32 mapping_maxage; /* seconds for input SA */ - /* Data for encapsulator */ struct xfrm_encap_tmpl *encap; struct sock __rcu *encap_sk; reverted: --- linux-aws-5.13-5.13.0/include/trace/events/cgroup.h +++ linux-aws-5.13-5.13.0.orig/include/trace/events/cgroup.h @@ -59,8 +59,8 @@ TP_STRUCT__entry( __field( int, root ) + __field( int, id ) __field( int, level ) - __field( u64, id ) __string( path, path ) ), @@ -71,7 +71,7 @@ __assign_str(path, path); ), + TP_printk("root=%d id=%d level=%d path=%s", - TP_printk("root=%d id=%llu level=%d path=%s", __entry->root, __entry->id, __entry->level, __get_str(path)) ); @@ -126,8 +126,8 @@ TP_STRUCT__entry( __field( int, dst_root ) + __field( int, dst_id ) __field( int, dst_level ) - __field( u64, dst_id ) __field( int, pid ) __string( dst_path, path ) __string( comm, task->comm ) @@ -142,7 +142,7 @@ __assign_str(comm, task->comm); ), + TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s", - TP_printk("dst_root=%d dst_id=%llu dst_level=%d dst_path=%s pid=%d comm=%s", __entry->dst_root, __entry->dst_id, __entry->dst_level, __get_str(dst_path), __entry->pid, __get_str(comm)) ); @@ -171,8 +171,8 @@ TP_STRUCT__entry( __field( int, root ) + __field( int, id ) __field( int, level ) - __field( u64, id ) __string( path, path ) __field( int, val ) ), @@ -185,7 +185,7 @@ __entry->val = val; ), + TP_printk("root=%d id=%d level=%d path=%s val=%d", - TP_printk("root=%d id=%llu level=%d path=%s val=%d", __entry->root, __entry->id, __entry->level, __get_str(path), __entry->val) ); reverted: --- linux-aws-5.13-5.13.0/include/uapi/linux/cyclades.h +++ linux-aws-5.13-5.13.0.orig/include/uapi/linux/cyclades.h @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ - -#ifndef _UAPI_LINUX_CYCLADES_H -#define _UAPI_LINUX_CYCLADES_H - -#warning "Support for features provided by this header has been removed" -#warning "Please consider updating your code" - -struct cyclades_monitor { - unsigned long int_count; - unsigned long char_count; - unsigned long char_max; - unsigned long char_last; -}; - -#define CYGETMON 0x435901 -#define CYGETTHRESH 0x435902 -#define CYSETTHRESH 0x435903 -#define CYGETDEFTHRESH 0x435904 -#define CYSETDEFTHRESH 0x435905 -#define CYGETTIMEOUT 0x435906 -#define CYSETTIMEOUT 0x435907 -#define CYGETDEFTIMEOUT 0x435908 -#define CYSETDEFTIMEOUT 0x435909 -#define CYSETRFLOW 0x43590a -#define CYGETRFLOW 0x43590b -#define CYSETRTSDTR_INV 0x43590c -#define CYGETRTSDTR_INV 0x43590d -#define CYZSETPOLLCYCLE 0x43590e -#define CYZGETPOLLCYCLE 0x43590f -#define CYGETCD1400VER 0x435910 -#define CYSETWAIT 0x435912 -#define CYGETWAIT 0x435913 - -#endif /* _UAPI_LINUX_CYCLADES_H */ reverted: --- linux-aws-5.13-5.13.0/include/uapi/linux/xfrm.h +++ linux-aws-5.13-5.13.0.orig/include/uapi/linux/xfrm.h @@ -308,7 +308,6 @@ XFRMA_SET_MARK, /* __u32 */ XFRMA_SET_MARK_MASK, /* __u32 */ XFRMA_IF_ID, /* __u32 */ - XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */ __XFRMA_MAX #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */ diff -u linux-aws-5.13-5.13.0/kernel/audit.c linux-aws-5.13-5.13.0/kernel/audit.c --- linux-aws-5.13-5.13.0/kernel/audit.c +++ linux-aws-5.13-5.13.0/kernel/audit.c @@ -1563,20 +1563,6 @@ nlh = nlmsg_next(nlh, &len); } audit_ctl_unlock(); - - /* can't block with the ctrl lock, so penalize the sender now */ - if (audit_backlog_limit && - (skb_queue_len(&audit_queue) > audit_backlog_limit)) { - DECLARE_WAITQUEUE(wait, current); - - /* wake kauditd to try and flush the queue */ - wake_up_interruptible(&kauditd_wait); - - add_wait_queue_exclusive(&audit_backlog_wait, &wait); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(audit_backlog_wait_time); - remove_wait_queue(&audit_backlog_wait, &wait); - } } /* Log information about who is connecting to the audit multicast socket */ @@ -1861,9 +1847,7 @@ * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() * using a PID anchored in the caller's namespace * 2. generator holding the audit_cmd_mutex - we don't want to block - * while holding the mutex, although we do penalize the sender - * later in audit_receive() when it is safe to block - */ + * while holding the mutex */ if (!(auditd_test_task(current) || audit_ctl_owner_current())) { long stime = audit_backlog_wait_time; reverted: --- linux-aws-5.13-5.13.0/kernel/bpf/btf.c +++ linux-aws-5.13-5.13.0.orig/kernel/bpf/btf.c @@ -4283,7 +4283,8 @@ log->len_total = log_size; /* log attributes have to be sane */ + if (log->len_total < 128 || log->len_total > UINT_MAX >> 8 || + !log->level || !log->ubuf) { - if (!bpf_verifier_log_attr_valid(log)) { err = -EINVAL; goto errout; } diff -u linux-aws-5.13-5.13.0/kernel/bpf/stackmap.c linux-aws-5.13-5.13.0/kernel/bpf/stackmap.c --- linux-aws-5.13-5.13.0/kernel/bpf/stackmap.c +++ linux-aws-5.13-5.13.0/kernel/bpf/stackmap.c @@ -519,14 +519,13 @@ u32, size, u64, flags) { struct pt_regs *regs; - long res = -EINVAL; + long res; if (!try_get_task_stack(task)) return -EFAULT; regs = task_pt_regs(task); - if (regs) - res = __bpf_get_stack(regs, task, NULL, buf, size, flags); + res = __bpf_get_stack(regs, task, NULL, buf, size, flags); put_task_stack(task); return res; diff -u linux-aws-5.13-5.13.0/kernel/bpf/verifier.c linux-aws-5.13-5.13.0/kernel/bpf/verifier.c --- linux-aws-5.13-5.13.0/kernel/bpf/verifier.c +++ linux-aws-5.13-5.13.0/kernel/bpf/verifier.c @@ -8960,13 +8960,9 @@ return 0; } - /* All special src_reg cases are listed below. From this point onwards - * we either succeed and assign a corresponding dst_reg->type after - * zeroing the offset, or fail and reject the program. - */ - mark_reg_known_zero(env, regs, insn->dst_reg); - if (insn->src_reg == BPF_PSEUDO_BTF_ID) { + mark_reg_known_zero(env, regs, insn->dst_reg); + dst_reg->type = aux->btf_var.reg_type; switch (dst_reg->type) { case PTR_TO_MEM: @@ -9003,6 +8999,7 @@ } map = env->used_maps[aux->map_index]; + mark_reg_known_zero(env, regs, insn->dst_reg); dst_reg->map_ptr = map; if (insn->src_reg == BPF_PSEUDO_MAP_VALUE) { @@ -13387,11 +13384,11 @@ log->ubuf = (char __user *) (unsigned long) attr->log_buf; log->len_total = attr->log_size; + ret = -EINVAL; /* log attributes have to be sane */ - if (!bpf_verifier_log_attr_valid(log)) { - ret = -EINVAL; + if (log->len_total < 128 || log->len_total > UINT_MAX >> 2 || + !log->level || !log->ubuf || log->level & ~BPF_LOG_MASK) goto err_unlock; - } } if (IS_ERR(btf_vmlinux)) { diff -u linux-aws-5.13-5.13.0/kernel/cgroup/cgroup.c linux-aws-5.13-5.13.0/kernel/cgroup/cgroup.c --- linux-aws-5.13-5.13.0/kernel/cgroup/cgroup.c +++ linux-aws-5.13-5.13.0/kernel/cgroup/cgroup.c @@ -3612,12 +3612,6 @@ cgroup_get(cgrp); cgroup_kn_unlock(of->kn); - /* Allow only one trigger per file descriptor */ - if (ctx->psi.trigger) { - cgroup_put(cgrp); - return -EBUSY; - } - psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi; new = psi_trigger_create(psi, buf, nbytes, res); if (IS_ERR(new)) { @@ -3625,7 +3619,8 @@ return PTR_ERR(new); } - smp_store_release(&ctx->psi.trigger, new); + psi_trigger_replace(&ctx->psi.trigger, new); + cgroup_put(cgrp); return nbytes; @@ -3664,7 +3659,7 @@ { struct cgroup_file_ctx *ctx = of->priv; - psi_trigger_destroy(ctx->psi.trigger); + psi_trigger_replace(&ctx->psi.trigger, NULL); } #endif /* CONFIG_PSI */ reverted: --- linux-aws-5.13-5.13.0/kernel/dma/pool.c +++ linux-aws-5.13-5.13.0.orig/kernel/dma/pool.c @@ -203,7 +203,7 @@ GFP_KERNEL); if (!atomic_pool_kernel) ret = -ENOMEM; + if (IS_ENABLED(CONFIG_ZONE_DMA)) { - if (has_managed_dma()) { atomic_pool_dma = __dma_atomic_pool_init(atomic_pool_size, GFP_KERNEL | GFP_DMA); if (!atomic_pool_dma) @@ -226,7 +226,7 @@ if (prev == NULL) { if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32)) return atomic_pool_dma32; + if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) - if (atomic_pool_dma && (gfp & GFP_DMA)) return atomic_pool_dma; return atomic_pool_kernel; } diff -u linux-aws-5.13-5.13.0/kernel/events/core.c linux-aws-5.13-5.13.0/kernel/events/core.c --- linux-aws-5.13-5.13.0/kernel/events/core.c +++ linux-aws-5.13-5.13.0/kernel/events/core.c @@ -678,23 +678,6 @@ WRITE_ONCE(event->state, state); } -/* - * UP store-release, load-acquire - */ - -#define __store_release(ptr, val) \ -do { \ - barrier(); \ - WRITE_ONCE(*(ptr), (val)); \ -} while (0) - -#define __load_acquire(ptr) \ -({ \ - __unqual_scalar_typeof(*(ptr)) ___p = READ_ONCE(*(ptr)); \ - barrier(); \ - ___p; \ -}) - #ifdef CONFIG_CGROUP_PERF static inline bool @@ -740,51 +723,34 @@ return t->time; } -static inline u64 perf_cgroup_event_time_now(struct perf_event *event, u64 now) +static inline void __update_cgrp_time(struct perf_cgroup *cgrp) { - struct perf_cgroup_info *t; + struct perf_cgroup_info *info; + u64 now; - t = per_cpu_ptr(event->cgrp->info, event->cpu); - if (!__load_acquire(&t->active)) - return t->time; - now += READ_ONCE(t->timeoffset); - return now; -} + now = perf_clock(); -static inline void __update_cgrp_time(struct perf_cgroup_info *info, u64 now, bool adv) -{ - if (adv) - info->time += now - info->timestamp; + info = this_cpu_ptr(cgrp->info); + + info->time += now - info->timestamp; info->timestamp = now; - /* - * see update_context_time() - */ - WRITE_ONCE(info->timeoffset, info->time - info->timestamp); } -static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx, bool final) +static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) { struct perf_cgroup *cgrp = cpuctx->cgrp; struct cgroup_subsys_state *css; - struct perf_cgroup_info *info; if (cgrp) { - u64 now = perf_clock(); - for (css = &cgrp->css; css; css = css->parent) { cgrp = container_of(css, struct perf_cgroup, css); - info = this_cpu_ptr(cgrp->info); - - __update_cgrp_time(info, now, true); - if (final) - __store_release(&info->active, 0); + __update_cgrp_time(cgrp); } } } static inline void update_cgrp_time_from_event(struct perf_event *event) { - struct perf_cgroup_info *info; struct perf_cgroup *cgrp; /* @@ -798,10 +764,8 @@ /* * Do not update time when cgroup is not active */ - if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) { - info = this_cpu_ptr(event->cgrp->info); - __update_cgrp_time(info, perf_clock(), true); - } + if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) + __update_cgrp_time(event->cgrp); } static inline void @@ -825,8 +789,7 @@ for (css = &cgrp->css; css; css = css->parent) { cgrp = container_of(css, struct perf_cgroup, css); info = this_cpu_ptr(cgrp->info); - __update_cgrp_time(info, ctx->timestamp, false); - __store_release(&info->active, 1); + info->timestamp = ctx->timestamp; } } @@ -1023,6 +986,14 @@ } static inline void +perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) +{ + struct perf_cgroup_info *t; + t = per_cpu_ptr(event->cgrp->info, event->cpu); + event->shadow_ctx_time = now - t->timestamp; +} + +static inline void perf_cgroup_event_enable(struct perf_event *event, struct perf_event_context *ctx) { struct perf_cpu_context *cpuctx; @@ -1099,8 +1070,7 @@ { } -static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx, - bool final) +static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) { } @@ -1132,12 +1102,12 @@ { } -static inline u64 perf_cgroup_event_time(struct perf_event *event) +static inline void +perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) { - return 0; } -static inline u64 perf_cgroup_event_time_now(struct perf_event *event, u64 now) +static inline u64 perf_cgroup_event_time(struct perf_event *event) { return 0; } @@ -1559,59 +1529,22 @@ /* * Update the record of the current time in a context. */ -static void __update_context_time(struct perf_event_context *ctx, bool adv) +static void update_context_time(struct perf_event_context *ctx) { u64 now = perf_clock(); - if (adv) - ctx->time += now - ctx->timestamp; + ctx->time += now - ctx->timestamp; ctx->timestamp = now; - - /* - * The above: time' = time + (now - timestamp), can be re-arranged - * into: time` = now + (time - timestamp), which gives a single value - * offset to compute future time without locks on. - * - * See perf_event_time_now(), which can be used from NMI context where - * it's (obviously) not possible to acquire ctx->lock in order to read - * both the above values in a consistent manner. - */ - WRITE_ONCE(ctx->timeoffset, ctx->time - ctx->timestamp); -} - -static void update_context_time(struct perf_event_context *ctx) -{ - __update_context_time(ctx, true); } static u64 perf_event_time(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; - if (unlikely(!ctx)) - return 0; - if (is_cgroup_event(event)) return perf_cgroup_event_time(event); - return ctx->time; -} - -static u64 perf_event_time_now(struct perf_event *event, u64 now) -{ - struct perf_event_context *ctx = event->ctx; - - if (unlikely(!ctx)) - return 0; - - if (is_cgroup_event(event)) - return perf_cgroup_event_time_now(event, now); - - if (!(__load_acquire(&ctx->is_active) & EVENT_TIME)) - return ctx->time; - - now += READ_ONCE(ctx->timeoffset); - return now; + return ctx ? ctx->time : 0; } static enum event_type_t get_event_type(struct perf_event *event) @@ -2417,7 +2350,7 @@ if (ctx->is_active & EVENT_TIME) { update_context_time(ctx); - update_cgrp_time_from_cpuctx(cpuctx, false); + update_cgrp_time_from_cpuctx(cpuctx); } event_sched_out(event, cpuctx, ctx); @@ -2428,9 +2361,6 @@ list_del_event(event, ctx); if (!ctx->nr_events && ctx->is_active) { - if (ctx == &cpuctx->ctx) - update_cgrp_time_from_cpuctx(cpuctx, true); - ctx->is_active = 0; ctx->rotate_necessary = 0; if (ctx->task) { @@ -2462,11 +2392,7 @@ * event_function_call() user. */ raw_spin_lock_irq(&ctx->lock); - /* - * Cgroup events are per-cpu events, and must IPI because of - * cgrp_cpuctx_list. - */ - if (!ctx->is_active && !is_cgroup_event(event)) { + if (!ctx->is_active) { __perf_remove_from_context(event, __get_cpu_context(ctx), ctx, (void *)flags); raw_spin_unlock_irq(&ctx->lock); @@ -2556,6 +2482,40 @@ irq_work_queue(&event->pending); } +static void perf_set_shadow_time(struct perf_event *event, + struct perf_event_context *ctx) +{ + /* + * use the correct time source for the time snapshot + * + * We could get by without this by leveraging the + * fact that to get to this function, the caller + * has most likely already called update_context_time() + * and update_cgrp_time_xx() and thus both timestamp + * are identical (or very close). Given that tstamp is, + * already adjusted for cgroup, we could say that: + * tstamp - ctx->timestamp + * is equivalent to + * tstamp - cgrp->timestamp. + * + * Then, in perf_output_read(), the calculation would + * work with no changes because: + * - event is guaranteed scheduled in + * - no scheduled out in between + * - thus the timestamp would be the same + * + * But this is a bit hairy. + * + * So instead, we have an explicit cgroup call to remain + * within the time source all along. We believe it + * is cleaner and simpler to understand. + */ + if (is_cgroup_event(event)) + perf_cgroup_set_shadow_time(event, event->tstamp); + else + event->shadow_ctx_time = event->tstamp - ctx->timestamp; +} + #define MAX_INTERRUPTS (~0ULL) static void perf_log_throttle(struct perf_event *event, int enable); @@ -2596,6 +2556,8 @@ perf_pmu_disable(event->pmu); + perf_set_shadow_time(event, ctx); + perf_log_itrace_start(event); if (event->pmu->add(event, PERF_EF_START)) { @@ -2899,14 +2861,11 @@ * perf_event_attr::disabled events will not run and can be initialized * without IPI. Except when this is the first event for the context, in * that case we need the magic of the IPI to set ctx->is_active. - * Similarly, cgroup events for the context also needs the IPI to - * manipulate the cgrp_cpuctx_list. * * The IOC_ENABLE that is sure to follow the creation of a disabled * event will issue the IPI and reprogram the hardware. */ - if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && - ctx->nr_events && !is_cgroup_event(event)) { + if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) { raw_spin_lock_irq(&ctx->lock); if (ctx->task == TASK_TOMBSTONE) { raw_spin_unlock_irq(&ctx->lock); @@ -3292,6 +3251,16 @@ return; } + ctx->is_active &= ~event_type; + if (!(ctx->is_active & EVENT_ALL)) + ctx->is_active = 0; + + if (ctx->task) { + WARN_ON_ONCE(cpuctx->task_ctx != ctx); + if (!ctx->is_active) + cpuctx->task_ctx = NULL; + } + /* * Always update time if it was set; not only when it changes. * Otherwise we can 'forget' to update time for any but the last @@ -3305,22 +3274,7 @@ if (is_active & EVENT_TIME) { /* update (and stop) ctx time */ update_context_time(ctx); - update_cgrp_time_from_cpuctx(cpuctx, ctx == &cpuctx->ctx); - /* - * CPU-release for the below ->is_active store, - * see __load_acquire() in perf_event_time_now() - */ - barrier(); - } - - ctx->is_active &= ~event_type; - if (!(ctx->is_active & EVENT_ALL)) - ctx->is_active = 0; - - if (ctx->task) { - WARN_ON_ONCE(cpuctx->task_ctx != ctx); - if (!ctx->is_active) - cpuctx->task_ctx = NULL; + update_cgrp_time_from_cpuctx(cpuctx); } is_active ^= ctx->is_active; /* changed bits */ @@ -3757,19 +3711,13 @@ return 0; } -/* - * Because the userpage is strictly per-event (there is no concept of context, - * so there cannot be a context indirection), every userpage must be updated - * when context time starts :-( - * - * IOW, we must not miss EVENT_TIME edges. - */ static inline bool event_update_userpage(struct perf_event *event) { if (likely(!atomic_read(&event->mmap_count))) return false; perf_event_update_time(event); + perf_set_shadow_time(event, event->ctx); perf_event_update_userpage(event); return true; @@ -3853,23 +3801,13 @@ struct task_struct *task) { int is_active = ctx->is_active; + u64 now; lockdep_assert_held(&ctx->lock); if (likely(!ctx->nr_events)) return; - if (is_active ^ EVENT_TIME) { - /* start ctx time */ - __update_context_time(ctx, false); - perf_cgroup_set_timestamp(task, ctx); - /* - * CPU-release for the below ->is_active store, - * see __load_acquire() in perf_event_time_now() - */ - barrier(); - } - ctx->is_active |= (event_type | EVENT_TIME); if (ctx->task) { if (!is_active) @@ -3880,6 +3818,13 @@ is_active ^= ctx->is_active; /* changed bits */ + if (is_active & EVENT_TIME) { + /* start ctx time */ + now = perf_clock(); + ctx->timestamp = now; + perf_cgroup_set_timestamp(task, ctx); + } + /* * First go through the list and put on any pinned groups * in order to give them the best chance of going on. @@ -4473,18 +4418,6 @@ return local64_read(&event->count) + atomic64_read(&event->child_count); } -static void calc_timer_values(struct perf_event *event, - u64 *now, - u64 *enabled, - u64 *running) -{ - u64 ctx_time; - - *now = perf_clock(); - ctx_time = perf_event_time_now(event, *now); - __perf_update_times(event, ctx_time, enabled, running); -} - /* * NMI-safe method to read a local event, that is an event that * is: @@ -4544,9 +4477,10 @@ *value = local64_read(&event->count); if (enabled || running) { - u64 __enabled, __running, __now;; + u64 now = event->shadow_ctx_time + perf_clock(); + u64 __enabled, __running; - calc_timer_values(event, &__now, &__enabled, &__running); + __perf_update_times(event, now, &__enabled, &__running); if (enabled) *enabled = __enabled; if (running) @@ -5855,6 +5789,18 @@ return event->pmu->event_idx(event); } +static void calc_timer_values(struct perf_event *event, + u64 *now, + u64 *enabled, + u64 *running) +{ + u64 ctx_time; + + *now = perf_clock(); + ctx_time = event->shadow_ctx_time + *now; + __perf_update_times(event, ctx_time, enabled, running); +} + static void perf_event_init_userpage(struct perf_event *event) { struct perf_event_mmap_page *userpg; @@ -6394,6 +6340,7 @@ ring_buffer_attach(event, rb); perf_event_update_time(event); + perf_set_shadow_time(event, event->ctx); perf_event_init_userpage(event); perf_event_update_userpage(event); } else { diff -u linux-aws-5.13-5.13.0/kernel/power/main.c linux-aws-5.13-5.13.0/kernel/power/main.c --- linux-aws-5.13-5.13.0/kernel/power/main.c +++ linux-aws-5.13-5.13.0/kernel/power/main.c @@ -504,10 +504,7 @@ struct kobj_attribute *attr, char *buf) { - if (!pm_wakeup_irq()) - return -ENODATA; - - return sprintf(buf, "%u\n", pm_wakeup_irq()); + return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA; } power_attr_ro(pm_wakeup_irq); reverted: --- linux-aws-5.13-5.13.0/kernel/power/power.h +++ linux-aws-5.13-5.13.0.orig/kernel/power/power.h @@ -168,7 +168,6 @@ #define SF_PLATFORM_MODE 1 #define SF_NOCOMPRESS_MODE 2 #define SF_CRC32_MODE 4 -#define SF_HW_SIG 8 /* kernel/power/hibernate.c */ extern int swsusp_check(void); reverted: --- linux-aws-5.13-5.13.0/kernel/power/process.c +++ linux-aws-5.13-5.13.0.orig/kernel/power/process.c @@ -134,7 +134,7 @@ if (!pm_freezing) atomic_inc(&system_freezing_cnt); + pm_wakeup_clear(true); - pm_wakeup_clear(0); pr_info("Freezing user space processes ... "); pm_freezing = true; error = try_to_freeze_tasks(true); reverted: --- linux-aws-5.13-5.13.0/kernel/power/suspend.c +++ linux-aws-5.13-5.13.0.orig/kernel/power/suspend.c @@ -138,6 +138,8 @@ break; } + pm_wakeup_clear(false); + s2idle_enter(); } diff -u linux-aws-5.13-5.13.0/kernel/power/swap.c linux-aws-5.13-5.13.0/kernel/power/swap.c --- linux-aws-5.13-5.13.0/kernel/power/swap.c +++ linux-aws-5.13-5.13.0/kernel/power/swap.c @@ -36,8 +36,6 @@ #define HIBERNATE_SIG "S1SUSPEND" -u32 swsusp_hardware_signature; - /* * When reading an {un,}compressed image, we may restore pages in place, * in which case some architectures need these pages cleaning before they @@ -106,8 +104,7 @@ struct swsusp_header { char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int) - - sizeof(u32) - sizeof(u32)]; - u32 hw_sig; + sizeof(u32)]; u32 crc32; sector_t image; unsigned int flags; /* Flags to pass to the "boot" kernel */ @@ -315,6 +312,7 @@ /* * Saving part */ + static int mark_swapfiles(struct swap_map_handle *handle, unsigned int flags) { int error; @@ -326,10 +324,6 @@ memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10); memcpy(swsusp_header->sig, HIBERNATE_SIG, 10); swsusp_header->image = handle->first_sector; - if (swsusp_hardware_signature) { - swsusp_header->hw_sig = swsusp_hardware_signature; - flags |= SF_HW_SIG; - } swsusp_header->flags = flags; if (flags & SF_CRC32_MODE) swsusp_header->crc32 = handle->crc32; @@ -1549,12 +1543,6 @@ } else { error = -EINVAL; } - if (!error && swsusp_header->flags & SF_HW_SIG && - swsusp_header->hw_sig != swsusp_hardware_signature) { - pr_info("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n", - swsusp_header->hw_sig, swsusp_hardware_signature); - error = -EINVAL; - } put: if (error) reverted: --- linux-aws-5.13-5.13.0/kernel/power/wakelock.c +++ linux-aws-5.13-5.13.0.orig/kernel/power/wakelock.c @@ -39,20 +39,23 @@ { struct rb_node *node; struct wakelock *wl; + char *str = buf; + char *end = buf + PAGE_SIZE; - int len = 0; mutex_lock(&wakelocks_lock); for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) { wl = rb_entry(node, struct wakelock, node); if (wl->ws->active == show_active) + str += scnprintf(str, end - str, "%s ", wl->name); - len += sysfs_emit_at(buf, len, "%s ", wl->name); } + if (str > buf) + str--; + str += scnprintf(str, end - str, "\n"); - len += sysfs_emit_at(buf, len, "\n"); mutex_unlock(&wakelocks_lock); + return (str - buf); - return len; } #if CONFIG_PM_WAKELOCKS_LIMIT > 0 diff -u linux-aws-5.13-5.13.0/kernel/rcu/tree.c linux-aws-5.13-5.13.0/kernel/rcu/tree.c --- linux-aws-5.13-5.13.0/kernel/rcu/tree.c +++ linux-aws-5.13-5.13.0/kernel/rcu/tree.c @@ -1641,11 +1641,10 @@ struct rcu_data *rdp) { rcu_lockdep_assert_cblist_protected(rdp); - if (!rcu_seq_state(rcu_seq_current(&rnp->gp_seq)) || !raw_spin_trylock_rcu_node(rnp)) + if (!rcu_seq_state(rcu_seq_current(&rnp->gp_seq)) || + !raw_spin_trylock_rcu_node(rnp)) return; - // The grace period cannot end while we hold the rcu_node lock. - if (rcu_seq_state(rcu_seq_current(&rnp->gp_seq))) - WARN_ON_ONCE(rcu_advance_cbs(rnp, rdp)); + WARN_ON_ONCE(rcu_advance_cbs(rnp, rdp)); raw_spin_unlock_rcu_node(rnp); } diff -u linux-aws-5.13-5.13.0/kernel/rcu/tree_exp.h linux-aws-5.13-5.13.0/kernel/rcu/tree_exp.h --- linux-aws-5.13-5.13.0/kernel/rcu/tree_exp.h +++ linux-aws-5.13-5.13.0/kernel/rcu/tree_exp.h @@ -387,7 +387,6 @@ continue; } if (get_cpu() == cpu) { - mask_ofl_test |= mask; put_cpu(); continue; } reverted: --- linux-aws-5.13-5.13.0/kernel/sched/cpuacct.c +++ linux-aws-5.13-5.13.0.orig/kernel/sched/cpuacct.c @@ -21,11 +21,15 @@ [CPUACCT_STAT_SYSTEM] = "system", }; +struct cpuacct_usage { + u64 usages[CPUACCT_STAT_NSTATS]; +}; + /* track CPU usage of a group of tasks and its child groups */ struct cpuacct { struct cgroup_subsys_state css; /* cpuusage holds pointer to a u64-type object on every CPU */ + struct cpuacct_usage __percpu *cpuusage; - u64 __percpu *cpuusage; struct kernel_cpustat __percpu *cpustat; }; @@ -45,7 +49,7 @@ return css_ca(ca->css.parent); } +static DEFINE_PER_CPU(struct cpuacct_usage, root_cpuacct_cpuusage); -static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage); static struct cpuacct root_cpuacct = { .cpustat = &kernel_cpustat, .cpuusage = &root_cpuacct_cpuusage, @@ -64,7 +68,7 @@ if (!ca) goto out; + ca->cpuusage = alloc_percpu(struct cpuacct_usage); - ca->cpuusage = alloc_percpu(u64); if (!ca->cpuusage) goto out_free_ca; @@ -95,8 +99,7 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, enum cpuacct_stat_index index) { + struct cpuacct_usage *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); - u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); - u64 *cpustat = per_cpu_ptr(ca->cpustat, cpu)->cpustat; u64 data; /* @@ -112,17 +115,14 @@ raw_spin_lock_irq(&cpu_rq(cpu)->lock); #endif + if (index == CPUACCT_STAT_NSTATS) { + int i = 0; + + data = 0; + for (i = 0; i < CPUACCT_STAT_NSTATS; i++) + data += cpuusage->usages[i]; + } else { + data = cpuusage->usages[index]; - switch (index) { - case CPUACCT_STAT_USER: - data = cpustat[CPUTIME_USER] + cpustat[CPUTIME_NICE]; - break; - case CPUACCT_STAT_SYSTEM: - data = cpustat[CPUTIME_SYSTEM] + cpustat[CPUTIME_IRQ] + - cpustat[CPUTIME_SOFTIRQ]; - break; - case CPUACCT_STAT_NSTATS: - data = *cpuusage; - break; } #ifndef CONFIG_64BIT @@ -132,14 +132,10 @@ return data; } +static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) -static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu) { + struct cpuacct_usage *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); + int i; - u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); - u64 *cpustat = per_cpu_ptr(ca->cpustat, cpu)->cpustat; - - /* Don't allow to reset global kernel_cpustat */ - if (ca == &root_cpuacct) - return; #ifndef CONFIG_64BIT /* @@ -147,10 +143,9 @@ */ raw_spin_lock_irq(&cpu_rq(cpu)->lock); #endif + + for (i = 0; i < CPUACCT_STAT_NSTATS; i++) + cpuusage->usages[i] = val; - *cpuusage = 0; - cpustat[CPUTIME_USER] = cpustat[CPUTIME_NICE] = 0; - cpustat[CPUTIME_SYSTEM] = cpustat[CPUTIME_IRQ] = 0; - cpustat[CPUTIME_SOFTIRQ] = 0; #ifndef CONFIG_64BIT raw_spin_unlock_irq(&cpu_rq(cpu)->lock); @@ -201,7 +196,7 @@ return -EINVAL; for_each_possible_cpu(cpu) + cpuacct_cpuusage_write(ca, cpu, 0); - cpuacct_cpuusage_write(ca, cpu); return 0; } @@ -248,10 +243,25 @@ seq_puts(m, "\n"); for_each_possible_cpu(cpu) { + struct cpuacct_usage *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); + seq_printf(m, "%d", cpu); + + for (index = 0; index < CPUACCT_STAT_NSTATS; index++) { +#ifndef CONFIG_64BIT + /* + * Take rq->lock to make 64-bit read safe on 32-bit + * platforms. + */ + raw_spin_lock_irq(&cpu_rq(cpu)->lock); +#endif + + seq_printf(m, " %llu", cpuusage->usages[index]); + +#ifndef CONFIG_64BIT + raw_spin_unlock_irq(&cpu_rq(cpu)->lock); +#endif + } - for (index = 0; index < CPUACCT_STAT_NSTATS; index++) - seq_printf(m, " %llu", - cpuacct_cpuusage_read(ca, cpu, index)); seq_puts(m, "\n"); } return 0; @@ -329,11 +339,16 @@ void cpuacct_charge(struct task_struct *tsk, u64 cputime) { struct cpuacct *ca; + int index = CPUACCT_STAT_SYSTEM; + struct pt_regs *regs = get_irq_regs() ? : task_pt_regs(tsk); + + if (regs && user_mode(regs)) + index = CPUACCT_STAT_USER; rcu_read_lock(); for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) + __this_cpu_add(ca->cpuusage->usages[index], cputime); - __this_cpu_add(*ca->cpuusage, cputime); rcu_read_unlock(); } reverted: --- linux-aws-5.13-5.13.0/kernel/sched/cputime.c +++ linux-aws-5.13-5.13.0.orig/kernel/sched/cputime.c @@ -148,10 +148,10 @@ /* Add guest time to cpustat. */ if (task_nice(p) > 0) { + cpustat[CPUTIME_NICE] += cputime; - task_group_account_field(p, CPUTIME_NICE, cputime); cpustat[CPUTIME_GUEST_NICE] += cputime; } else { + cpustat[CPUTIME_USER] += cputime; - task_group_account_field(p, CPUTIME_USER, cputime); cpustat[CPUTIME_GUEST] += cputime; } } diff -u linux-aws-5.13-5.13.0/kernel/sched/fair.c linux-aws-5.13-5.13.0/kernel/sched/fair.c --- linux-aws-5.13-5.13.0/kernel/sched/fair.c +++ linux-aws-5.13-5.13.0/kernel/sched/fair.c @@ -3423,6 +3423,7 @@ se->avg.last_update_time = n_last_update_time; } + /* * When on migration a sched_entity joins/leaves the PELT hierarchy, we need to * propagate its contribution. The key to this propagation is the invariant @@ -3490,6 +3491,7 @@ * XXX: only do this for the part of runnable > running ? * */ + static inline void update_tg_cfs_util(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq) { @@ -3718,19 +3720,7 @@ r = removed_util; sub_positive(&sa->util_avg, r); - sub_positive(&sa->util_sum, r * divider); - /* - * Because of rounding, se->util_sum might ends up being +1 more than - * cfs->util_sum. Although this is not a problem by itself, detaching - * a lot of tasks with the rounding problem between 2 updates of - * util_avg (~1ms) can make cfs->util_sum becoming null whereas - * cfs_util_avg is not. - * Check that util_sum is still above its lower bound for the new - * util_avg. Given that period_contrib might have moved since the last - * sync, we are only sure that util_sum must be above or equal to - * util_avg * minimum possible divider - */ - sa->util_sum = max_t(u32, sa->util_sum, sa->util_avg * PELT_MIN_DIVIDER); + sa->util_sum = sa->util_avg * divider; r = removed_runnable; sub_positive(&sa->runnable_avg, r); @@ -6380,10 +6370,8 @@ * pattern is IO completions. */ if (is_per_cpu_kthread(current) && - in_task() && prev == smp_processor_id() && - this_rq()->nr_running <= 1 && - asym_fits_capacity(task_util, prev)) { + this_rq()->nr_running <= 1) { return prev; } reverted: --- linux-aws-5.13-5.13.0/kernel/sched/membarrier.c +++ linux-aws-5.13-5.13.0.orig/kernel/sched/membarrier.c @@ -147,11 +147,11 @@ #endif #ifdef CONFIG_RSEQ +#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK \ -#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK \ (MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ \ + | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ_BITMASK) - | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ) #else +#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 -#define MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK 0 #endif #define MEMBARRIER_CMD_BITMASK \ @@ -159,8 +159,7 @@ | MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED \ | MEMBARRIER_CMD_PRIVATE_EXPEDITED \ | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED \ + | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK) - | MEMBARRIER_PRIVATE_EXPEDITED_SYNC_CORE_BITMASK \ - | MEMBARRIER_PRIVATE_EXPEDITED_RSEQ_BITMASK) static void ipi_mb(void *info) { reverted: --- linux-aws-5.13-5.13.0/kernel/sched/pelt.h +++ linux-aws-5.13-5.13.0.orig/kernel/sched/pelt.h @@ -37,11 +37,9 @@ } #endif -#define PELT_MIN_DIVIDER (LOAD_AVG_MAX - 1024) - static inline u32 get_pelt_divider(struct sched_avg *avg) { + return LOAD_AVG_MAX - 1024 + avg->period_contrib; - return PELT_MIN_DIVIDER + avg->period_contrib; } static inline void cfs_se_util_change(struct sched_avg *avg) diff -u linux-aws-5.13-5.13.0/kernel/sched/psi.c linux-aws-5.13-5.13.0/kernel/sched/psi.c --- linux-aws-5.13-5.13.0/kernel/sched/psi.c +++ linux-aws-5.13-5.13.0/kernel/sched/psi.c @@ -34,19 +34,13 @@ * delayed on that resource such that nobody is advancing and the CPU * goes idle. This leaves both workload and CPU unproductive. * - * SOME = nr_delayed_tasks != 0 - * FULL = nr_delayed_tasks != 0 && nr_productive_tasks == 0 - * - * What it means for a task to be productive is defined differently - * for each resource. For IO, productive means a running task. For - * memory, productive means a running task that isn't a reclaimer. For - * CPU, productive means an oncpu task. - * * Naturally, the FULL state doesn't exist for the CPU resource at the - * system level, but exist at the cgroup level. At the cgroup level, - * FULL means all non-idle tasks in the cgroup are delayed on the CPU - * resource which is being used by others outside of the cgroup or - * throttled by the cgroup cpu.max configuration. + * system level, but exist at the cgroup level, means all non-idle tasks + * in a cgroup are delayed on the CPU resource which used by others outside + * of the cgroup or throttled by the cgroup cpu.max configuration. + * + * SOME = nr_delayed_tasks != 0 + * FULL = nr_delayed_tasks != 0 && nr_running_tasks == 0 * * The percentage of wallclock time spent in those compound stall * states gives pressure numbers between 0 and 100 for each resource, @@ -87,13 +81,13 @@ * * threads = min(nr_nonidle_tasks, nr_cpus) * SOME = min(nr_delayed_tasks / threads, 1) - * FULL = (threads - min(nr_productive_tasks, threads)) / threads + * FULL = (threads - min(nr_running_tasks, threads)) / threads * * For the 257 number crunchers on 256 CPUs, this yields: * * threads = min(257, 256) * SOME = min(1 / 256, 1) = 0.4% - * FULL = (256 - min(256, 256)) / 256 = 0% + * FULL = (256 - min(257, 256)) / 256 = 0% * * For the 1 out of 4 memory-delayed tasks, this yields: * @@ -118,7 +112,7 @@ * For each runqueue, we track: * * tSOME[cpu] = time(nr_delayed_tasks[cpu] != 0) - * tFULL[cpu] = time(nr_delayed_tasks[cpu] && !nr_productive_tasks[cpu]) + * tFULL[cpu] = time(nr_delayed_tasks[cpu] && !nr_running_tasks[cpu]) * tNONIDLE[cpu] = time(nr_nonidle_tasks[cpu] != 0) * * and then periodically aggregate: @@ -235,8 +229,7 @@ case PSI_MEM_SOME: return unlikely(tasks[NR_MEMSTALL]); case PSI_MEM_FULL: - return unlikely(tasks[NR_MEMSTALL] && - tasks[NR_RUNNING] == tasks[NR_MEMSTALL_RUNNING]); + return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]); case PSI_CPU_SOME: return unlikely(tasks[NR_RUNNING] > tasks[NR_ONCPU]); case PSI_CPU_FULL: @@ -713,11 +706,10 @@ if (groupc->tasks[t]) { groupc->tasks[t]--; } else if (!psi_bug) { - printk_deferred(KERN_ERR "psi: task underflow! cpu=%d t=%d tasks=[%u %u %u %u %u] clear=%x set=%x\n", + printk_deferred(KERN_ERR "psi: task underflow! cpu=%d t=%d tasks=[%u %u %u %u] clear=%x set=%x\n", cpu, t, groupc->tasks[0], groupc->tasks[1], groupc->tasks[2], - groupc->tasks[3], groupc->tasks[4], - clear, set); + groupc->tasks[3], clear, set); psi_bug = 1; } } @@ -858,15 +850,12 @@ int clear = TSK_ONCPU, set = 0; /* - * When we're going to sleep, psi_dequeue() lets us - * handle TSK_RUNNING, TSK_MEMSTALL_RUNNING and - * TSK_IOWAIT here, where we can combine it with - * TSK_ONCPU and save walking common ancestors twice. + * When we're going to sleep, psi_dequeue() lets us handle + * TSK_RUNNING and TSK_IOWAIT here, where we can combine it + * with TSK_ONCPU and save walking common ancestors twice. */ if (sleep) { clear |= TSK_RUNNING; - if (prev->in_memstall) - clear |= TSK_MEMSTALL_RUNNING; if (prev->in_iowait) set |= TSK_IOWAIT; } @@ -915,7 +904,7 @@ rq = this_rq_lock_irq(&rf); current->in_memstall = 1; - psi_task_change(current, 0, TSK_MEMSTALL | TSK_MEMSTALL_RUNNING); + psi_task_change(current, 0, TSK_MEMSTALL); rq_unlock_irq(rq, &rf); } @@ -944,7 +933,7 @@ rq = this_rq_lock_irq(&rf); current->in_memstall = 0; - psi_task_change(current, TSK_MEMSTALL | TSK_MEMSTALL_RUNNING, 0); + psi_task_change(current, TSK_MEMSTALL, 0); rq_unlock_irq(rq, &rf); } @@ -1078,6 +1067,44 @@ return 0; } +static int psi_io_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_IO); +} + +static int psi_memory_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_MEM); +} + +static int psi_cpu_show(struct seq_file *m, void *v) +{ + return psi_show(m, &psi_system, PSI_CPU); +} + +static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) +{ + if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) + return -EPERM; + + return single_open(file, psi_show, NULL); +} + +static int psi_io_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_io_show); +} + +static int psi_memory_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_memory_show); +} + +static int psi_cpu_open(struct inode *inode, struct file *file) +{ + return psi_open(file, psi_cpu_show); +} + struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, size_t nbytes, enum psi_res res) { @@ -1120,6 +1147,7 @@ t->event = 0; t->last_event_time = 0; init_waitqueue_head(&t->event_wait); + kref_init(&t->refcount); mutex_lock(&group->trigger_lock); @@ -1148,19 +1176,15 @@ return t; } -void psi_trigger_destroy(struct psi_trigger *t) +static void psi_trigger_destroy(struct kref *ref) { - struct psi_group *group; + struct psi_trigger *t = container_of(ref, struct psi_trigger, refcount); + struct psi_group *group = t->group; struct task_struct *task_to_destroy = NULL; - /* - * We do not check psi_disabled since it might have been disabled after - * the trigger got created. - */ - if (!t) + if (static_branch_likely(&psi_disabled)) return; - group = t->group; /* * Wakeup waiters to stop polling. Can happen if cgroup is deleted * from under a polling process. @@ -1196,9 +1220,9 @@ mutex_unlock(&group->trigger_lock); /* - * Wait for psi_schedule_poll_work RCU to complete its read-side - * critical section before destroying the trigger and optionally the - * poll_task. + * Wait for both *trigger_ptr from psi_trigger_replace and + * poll_task RCUs to complete their read-side critical sections + * before destroying the trigger and optionally the poll_task */ synchronize_rcu(); /* @@ -1215,6 +1239,18 @@ kfree(t); } +void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new) +{ + struct psi_trigger *old = *trigger_ptr; + + if (static_branch_likely(&psi_disabled)) + return; + + rcu_assign_pointer(*trigger_ptr, new); + if (old) + kref_put(&old->refcount, psi_trigger_destroy); +} + __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, poll_table *wait) { @@ -1224,55 +1260,25 @@ if (static_branch_likely(&psi_disabled)) return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI; - t = smp_load_acquire(trigger_ptr); - if (!t) + rcu_read_lock(); + + t = rcu_dereference(*(void __rcu __force **)trigger_ptr); + if (!t) { + rcu_read_unlock(); return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI; + } + kref_get(&t->refcount); + + rcu_read_unlock(); poll_wait(file, &t->event_wait, wait); if (cmpxchg(&t->event, 1, 0) == 1) ret |= EPOLLPRI; - return ret; -} - -#ifdef CONFIG_PROC_FS -static int psi_io_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_IO); -} - -static int psi_memory_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_MEM); -} - -static int psi_cpu_show(struct seq_file *m, void *v) -{ - return psi_show(m, &psi_system, PSI_CPU); -} - -static int psi_open(struct file *file, int (*psi_show)(struct seq_file *, void *)) -{ - if (file->f_mode & FMODE_WRITE && !capable(CAP_SYS_RESOURCE)) - return -EPERM; - - return single_open(file, psi_show, NULL); -} + kref_put(&t->refcount, psi_trigger_destroy); -static int psi_io_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_io_show); -} - -static int psi_memory_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_memory_show); -} - -static int psi_cpu_open(struct inode *inode, struct file *file) -{ - return psi_open(file, psi_cpu_show); + return ret; } static ssize_t psi_write(struct file *file, const char __user *user_buf, @@ -1295,24 +1301,14 @@ buf[buf_size - 1] = '\0'; - seq = file->private_data; - - /* Take seq->lock to protect seq->private from concurrent writes */ - mutex_lock(&seq->lock); - - /* Allow only one trigger per file descriptor */ - if (seq->private) { - mutex_unlock(&seq->lock); - return -EBUSY; - } - new = psi_trigger_create(&psi_system, buf, nbytes, res); - if (IS_ERR(new)) { - mutex_unlock(&seq->lock); + if (IS_ERR(new)) return PTR_ERR(new); - } - smp_store_release(&seq->private, new); + seq = file->private_data; + /* Take seq->lock to protect seq->private from concurrent writes */ + mutex_lock(&seq->lock); + psi_trigger_replace(&seq->private, new); mutex_unlock(&seq->lock); return nbytes; @@ -1347,7 +1343,7 @@ { struct seq_file *seq = file->private_data; - psi_trigger_destroy(seq->private); + psi_trigger_replace(&seq->private, NULL); return single_release(inode, file); } @@ -1392,2 +1387,0 @@ - -#endif /* CONFIG_PROC_FS */ diff -u linux-aws-5.13-5.13.0/kernel/sched/rt.c linux-aws-5.13-5.13.0/kernel/sched/rt.c --- linux-aws-5.13-5.13.0/kernel/sched/rt.c +++ linux-aws-5.13-5.13.0/kernel/sched/rt.c @@ -52,8 +52,11 @@ rt_b->rt_period_timer.function = sched_rt_period_timer; } -static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) +static void start_rt_bandwidth(struct rt_bandwidth *rt_b) { + if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) + return; + raw_spin_lock(&rt_b->rt_runtime_lock); if (!rt_b->rt_period_active) { rt_b->rt_period_active = 1; @@ -72,14 +75,6 @@ raw_spin_unlock(&rt_b->rt_runtime_lock); } -static void start_rt_bandwidth(struct rt_bandwidth *rt_b) -{ - if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) - return; - - do_start_rt_bandwidth(rt_b); -} - void init_rt_rq(struct rt_rq *rt_rq) { struct rt_prio_array *array; @@ -1034,17 +1029,13 @@ for_each_sched_rt_entity(rt_se) { struct rt_rq *rt_rq = rt_rq_of_se(rt_se); - int exceeded; if (sched_rt_runtime(rt_rq) != RUNTIME_INF) { raw_spin_lock(&rt_rq->rt_runtime_lock); rt_rq->rt_time += delta_exec; - exceeded = sched_rt_runtime_exceeded(rt_rq); - if (exceeded) + if (sched_rt_runtime_exceeded(rt_rq)) resched_curr(rq); raw_spin_unlock(&rt_rq->rt_runtime_lock); - if (exceeded) - do_start_rt_bandwidth(sched_rt_bandwidth(rt_rq)); } } } @@ -2783,12 +2774,8 @@ static void sched_rt_do_global(void) { - unsigned long flags; - - raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); def_rt_bandwidth.rt_runtime = global_rt_runtime(); def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); - raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); } int sched_rt_handler(struct ctl_table *table, int write, void *buffer, reverted: --- linux-aws-5.13-5.13.0/kernel/sched/stats.h +++ linux-aws-5.13-5.13.0.orig/kernel/sched/stats.h @@ -69,9 +69,6 @@ if (static_branch_likely(&psi_disabled)) return; - if (p->in_memstall) - set |= TSK_MEMSTALL_RUNNING; - if (!wakeup || p->sched_psi_wake_requeue) { if (p->in_memstall) set |= TSK_MEMSTALL; @@ -102,7 +99,7 @@ return; if (p->in_memstall) + clear |= TSK_MEMSTALL; - clear |= (TSK_MEMSTALL | TSK_MEMSTALL_RUNNING); psi_task_change(p, clear, 0); } diff -u linux-aws-5.13-5.13.0/kernel/time/clocksource.c linux-aws-5.13-5.13.0/kernel/time/clocksource.c --- linux-aws-5.13-5.13.0/kernel/time/clocksource.c +++ linux-aws-5.13-5.13.0/kernel/time/clocksource.c @@ -93,20 +93,6 @@ static int finished_booting; static u64 suspend_start; -/* - * Threshold: 0.0312s, when doubled: 0.0625s. - * Also a default for cs->uncertainty_margin when registering clocks. - */ -#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 5) - -/* - * Maximum permissible delay between two readouts of the watchdog - * clocksource surrounding a read of the clocksource being validated. - * This delay could be due to SMIs, NMIs, or to VCPU preemptions. Used as - * a lower bound for cs->uncertainty_margin values when registering clocks. - */ -#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) - #ifdef CONFIG_CLOCKSOURCE_WATCHDOG static void clocksource_watchdog_work(struct work_struct *work); static void clocksource_select(void); @@ -133,9 +119,17 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating); /* - * Interval: 0.5sec. + * Interval: 0.5sec Threshold: 0.0625s */ #define WATCHDOG_INTERVAL (HZ >> 1) +#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) + +/* + * Maximum permissible delay between two readouts of the watchdog + * clocksource surrounding a read of the clocksource being validated. + * This delay could be due to SMIs, NMIs, or to VCPU preemptions. + */ +#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) static void clocksource_watchdog_work(struct work_struct *work) { @@ -200,24 +194,17 @@ static ulong max_cswd_read_retries = 3; module_param(max_cswd_read_retries, ulong, 0644); -enum wd_read_status { - WD_READ_SUCCESS, - WD_READ_UNSTABLE, - WD_READ_SKIP -}; - -static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) +static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) { unsigned int nretries; - u64 wd_end, wd_end2, wd_delta; - int64_t wd_delay, wd_seq_delay; + u64 wd_end, wd_delta; + int64_t wd_delay; for (nretries = 0; nretries <= max_cswd_read_retries; nretries++) { local_irq_disable(); *wdnow = watchdog->read(watchdog); *csnow = cs->read(cs); wd_end = watchdog->read(watchdog); - wd_end2 = watchdog->read(watchdog); local_irq_enable(); wd_delta = clocksource_delta(wd_end, *wdnow, watchdog->mask); @@ -228,34 +215,13 @@ pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n", smp_processor_id(), watchdog->name, nretries); } - return WD_READ_SUCCESS; + return true; } - - /* - * Now compute delay in consecutive watchdog read to see if - * there is too much external interferences that cause - * significant delay in reading both clocksource and watchdog. - * - * If consecutive WD read-back delay > WATCHDOG_MAX_SKEW/2, - * report system busy, reinit the watchdog and skip the current - * watchdog test. - */ - wd_delta = clocksource_delta(wd_end2, wd_end, watchdog->mask); - wd_seq_delay = clocksource_cyc2ns(wd_delta, watchdog->mult, watchdog->shift); - if (wd_seq_delay > WATCHDOG_MAX_SKEW/2) - goto skip_test; } pr_warn("timekeeping watchdog on CPU%d: %s read-back delay of %lldns, attempt %d, marking unstable\n", smp_processor_id(), watchdog->name, wd_delay, nretries); - return WD_READ_UNSTABLE; - -skip_test: - pr_info("timekeeping watchdog on CPU%d: %s wd-wd read-back delay of %lldns\n", - smp_processor_id(), watchdog->name, wd_seq_delay); - pr_info("wd-%s-wd read-back delay of %lldns, clock-skew test skipped!\n", - cs->name, wd_delay); - return WD_READ_SKIP; + return false; } static u64 csnow_mid; @@ -318,8 +284,6 @@ int next_cpu, reset_pending; int64_t wd_nsec, cs_nsec; struct clocksource *cs; - enum wd_read_status read_ret; - u32 md; spin_lock(&watchdog_lock); if (!watchdog_running) @@ -336,12 +300,9 @@ continue; } - read_ret = cs_watchdog_read(cs, &csnow, &wdnow); - - if (read_ret != WD_READ_SUCCESS) { - if (read_ret == WD_READ_UNSTABLE) - /* Clock readout unreliable, so give it up. */ - __clocksource_unstable(cs); + if (!cs_watchdog_read(cs, &csnow, &wdnow)) { + /* Clock readout unreliable, so give it up. */ + __clocksource_unstable(cs); continue; } @@ -369,8 +330,7 @@ continue; /* Check the deviation from the watchdog clocksource. */ - md = cs->uncertainty_margin + watchdog->uncertainty_margin; - if (abs(cs_nsec - wd_nsec) > md) { + if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is too large:\n", smp_processor_id(), cs->name); pr_warn(" '%s' wd_now: %llx wd_last: %llx mask: %llx\n", @@ -1017,26 +977,6 @@ clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, NSEC_PER_SEC / scale, sec * scale); } - - /* - * If the uncertainty margin is not specified, calculate it. - * If both scale and freq are non-zero, calculate the clock - * period, but bound below at 2*WATCHDOG_MAX_SKEW. However, - * if either of scale or freq is zero, be very conservative and - * take the tens-of-milliseconds WATCHDOG_THRESHOLD value for the - * uncertainty margin. Allow stupidly small uncertainty margins - * to be specified by the caller for testing purposes, but warn - * to discourage production use of this capability. - */ - if (scale && freq && !cs->uncertainty_margin) { - cs->uncertainty_margin = NSEC_PER_SEC / (scale * freq); - if (cs->uncertainty_margin < 2 * WATCHDOG_MAX_SKEW) - cs->uncertainty_margin = 2 * WATCHDOG_MAX_SKEW; - } else if (!cs->uncertainty_margin) { - cs->uncertainty_margin = WATCHDOG_THRESHOLD; - } - WARN_ON_ONCE(cs->uncertainty_margin < 2 * WATCHDOG_MAX_SKEW); - /* * Ensure clocksources that have large 'mult' values don't overflow * when adjusted. reverted: --- linux-aws-5.13-5.13.0/kernel/time/jiffies.c +++ linux-aws-5.13-5.13.0.orig/kernel/time/jiffies.c @@ -49,14 +49,13 @@ * for "tick-less" systems. */ static struct clocksource clocksource_jiffies = { + .name = "jiffies", + .rating = 1, /* lowest valid rating*/ + .read = jiffies_read, + .mask = CLOCKSOURCE_MASK(32), + .mult = TICK_NSEC << JIFFIES_SHIFT, /* details above */ + .shift = JIFFIES_SHIFT, + .max_cycles = 10, - .name = "jiffies", - .rating = 1, /* lowest valid rating*/ - .uncertainty_margin = 32 * NSEC_PER_MSEC, - .read = jiffies_read, - .mask = CLOCKSOURCE_MASK(32), - .mult = TICK_NSEC << JIFFIES_SHIFT, /* details above */ - .shift = JIFFIES_SHIFT, - .max_cycles = 10, }; __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(jiffies_lock); diff -u linux-aws-5.13-5.13.0/kernel/trace/bpf_trace.c linux-aws-5.13-5.13.0/kernel/trace/bpf_trace.c --- linux-aws-5.13-5.13.0/kernel/trace/bpf_trace.c +++ linux-aws-5.13-5.13.0/kernel/trace/bpf_trace.c @@ -1243,6 +1243,9 @@ BPF_CALL_4(bpf_read_branch_records, struct bpf_perf_event_data_kern *, ctx, void *, buf, u32, size, u64, flags) { +#ifndef CONFIG_X86 + return -ENOENT; +#else static const u32 br_entry_size = sizeof(struct perf_branch_entry); struct perf_branch_stack *br_stack = ctx->data->br_stack; u32 to_copy; @@ -1251,7 +1254,7 @@ return -EINVAL; if (unlikely(!br_stack)) - return -ENOENT; + return -EINVAL; if (flags & BPF_F_GET_BRANCH_RECORDS_SIZE) return br_stack->nr * br_entry_size; @@ -1263,6 +1266,7 @@ memcpy(buf, br_stack->entries, to_copy); return to_copy; +#endif } static const struct bpf_func_proto bpf_read_branch_records_proto = { diff -u linux-aws-5.13-5.13.0/kernel/trace/trace.c linux-aws-5.13-5.13.0/kernel/trace/trace.c --- linux-aws-5.13-5.13.0/kernel/trace/trace.c +++ linux-aws-5.13-5.13.0/kernel/trace/trace.c @@ -7605,8 +7605,7 @@ err = kzalloc(sizeof(*err), GFP_KERNEL); if (!err) err = ERR_PTR(-ENOMEM); - else - tr->n_err_log_entries++; + tr->n_err_log_entries++; return err; } diff -u linux-aws-5.13-5.13.0/kernel/trace/trace_events_hist.c linux-aws-5.13-5.13.0/kernel/trace/trace_events_hist.c --- linux-aws-5.13-5.13.0/kernel/trace/trace_events_hist.c +++ linux-aws-5.13-5.13.0/kernel/trace/trace_events_hist.c @@ -3531,7 +3531,6 @@ var_ref_idx = find_var_ref_idx(hist_data, var_ref); if (WARN_ON(var_ref_idx < 0)) { - kfree(p); ret = var_ref_idx; goto err; } diff -u linux-aws-5.13-5.13.0/kernel/trace/trace_kprobe.c linux-aws-5.13-5.13.0/kernel/trace/trace_kprobe.c --- linux-aws-5.13-5.13.0/kernel/trace/trace_kprobe.c +++ linux-aws-5.13-5.13.0/kernel/trace/trace_kprobe.c @@ -1188,18 +1188,15 @@ { struct dyn_event *ev = v; struct trace_kprobe *tk; - unsigned long nmissed; if (!is_trace_kprobe(ev)) return 0; tk = to_trace_kprobe(ev); - nmissed = trace_kprobe_is_return(tk) ? - tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed; seq_printf(m, " %-44s %15lu %15lu\n", trace_probe_name(&tk->tp), trace_kprobe_nhit(tk), - nmissed); + tk->rp.kp.nmissed); return 0; } reverted: --- linux-aws-5.13-5.13.0/kernel/trace/trace_syscalls.c +++ linux-aws-5.13-5.13.0.orig/kernel/trace/trace_syscalls.c @@ -323,7 +323,8 @@ trace_ctx = tracing_gen_ctx(); + buffer = tr->array_buffer.buffer; + event = trace_buffer_lock_reserve(buffer, - event = trace_event_buffer_lock_reserve(&buffer, trace_file, sys_data->enter_event->event.type, size, trace_ctx); if (!event) return; @@ -366,7 +367,8 @@ trace_ctx = tracing_gen_ctx(); + buffer = tr->array_buffer.buffer; + event = trace_buffer_lock_reserve(buffer, - event = trace_event_buffer_lock_reserve(&buffer, trace_file, sys_data->exit_event->event.type, sizeof(*entry), trace_ctx); if (!event) reverted: --- linux-aws-5.13-5.13.0/kernel/tsacct.c +++ linux-aws-5.13-5.13.0.orig/kernel/tsacct.c @@ -38,10 +38,11 @@ stats->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX); stats->ac_btime64 = btime; + if (thread_group_leader(tsk)) { - if (tsk->flags & PF_EXITING) stats->ac_exitcode = tsk->exit_code; + if (tsk->flags & PF_FORKNOEXEC) + stats->ac_flag |= AFORK; + } - if (thread_group_leader(tsk) && (tsk->flags & PF_FORKNOEXEC)) - stats->ac_flag |= AFORK; if (tsk->flags & PF_SUPERPRIV) stats->ac_flag |= ASU; if (tsk->flags & PF_DUMPCORE) reverted: --- linux-aws-5.13-5.13.0/lib/mpi/mpi-mod.c +++ linux-aws-5.13-5.13.0.orig/lib/mpi/mpi-mod.c @@ -40,8 +40,6 @@ mpi_normalize(m); ctx = kcalloc(1, sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return NULL; if (copy) { ctx->m = mpi_copy(m); reverted: --- linux-aws-5.13-5.13.0/lib/test_hmm.c +++ linux-aws-5.13-5.13.0.orig/lib/test_hmm.c @@ -965,33 +965,9 @@ return 0; } -static int dmirror_fops_mmap(struct file *file, struct vm_area_struct *vma) -{ - unsigned long addr; - - for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { - struct page *page; - int ret; - - page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (!page) - return -ENOMEM; - - ret = vm_insert_page(vma, addr, page); - if (ret) { - __free_page(page); - return ret; - } - put_page(page); - } - - return 0; -} - static const struct file_operations dmirror_fops = { .open = dmirror_fops_open, .release = dmirror_fops_release, - .mmap = dmirror_fops_mmap, .unlocked_ioctl = dmirror_fops_unlocked_ioctl, .llseek = default_llseek, .owner = THIS_MODULE, reverted: --- linux-aws-5.13-5.13.0/lib/test_meminit.c +++ linux-aws-5.13-5.13.0.orig/lib/test_meminit.c @@ -337,7 +337,6 @@ if (num) kmem_cache_free_bulk(c, num, objects); } - kmem_cache_destroy(c); *total_failures += fail; return 1; } diff -u linux-aws-5.13-5.13.0/mm/hmm.c linux-aws-5.13-5.13.0/mm/hmm.c --- linux-aws-5.13-5.13.0/mm/hmm.c +++ linux-aws-5.13-5.13.0/mm/hmm.c @@ -296,8 +296,7 @@ * Since each architecture defines a struct page for the zero page, just * fall through and treat it like a normal page. */ - if (!vm_normal_page(walk->vma, addr, pte) && - !pte_devmap(pte) && + if (pte_special(pte) && !pte_devmap(pte) && !is_zero_pfn(pte_pfn(pte))) { if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) { pte_unmap(ptep); @@ -515,7 +514,7 @@ struct hmm_range *range = hmm_vma_walk->range; struct vm_area_struct *vma = walk->vma; - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)) && + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP | VM_MIXEDMAP)) && vma->vm_flags & VM_READ) return 0; diff -u linux-aws-5.13-5.13.0/mm/page_alloc.c linux-aws-5.13-5.13.0/mm/page_alloc.c --- linux-aws-5.13-5.13.0/mm/page_alloc.c +++ linux-aws-5.13-5.13.0/mm/page_alloc.c @@ -4041,9 +4041,7 @@ va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); - if ((gfp_mask & __GFP_NOWARN) || - !__ratelimit(&nopage_rs) || - ((gfp_mask & __GFP_DMA) && !has_managed_dma())) + if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) return; va_start(args, fmt); @@ -9193,15 +9190,0 @@ - -#ifdef CONFIG_ZONE_DMA -bool has_managed_dma(void) -{ - struct pglist_data *pgdat; - - for_each_online_pgdat(pgdat) { - struct zone *zone = &pgdat->node_zones[ZONE_DMA]; - - if (managed_zone(zone)) - return true; - } - return false; -} -#endif /* CONFIG_ZONE_DMA */ diff -u linux-aws-5.13-5.13.0/mm/shmem.c linux-aws-5.13-5.13.0/mm/shmem.c --- linux-aws-5.13-5.13.0/mm/shmem.c +++ linux-aws-5.13-5.13.0/mm/shmem.c @@ -527,7 +527,7 @@ struct shmem_inode_info *info; struct page *page; unsigned long batch = sc ? sc->nr_to_scan : 128; - int split = 0; + int removed = 0, split = 0; if (list_empty(&sbinfo->shrinklist)) return SHRINK_STOP; @@ -542,6 +542,7 @@ /* inode is about to be evicted */ if (!inode) { list_del_init(&info->shrinklist); + removed++; goto next; } @@ -549,12 +550,12 @@ if (round_up(inode->i_size, PAGE_SIZE) == round_up(inode->i_size, HPAGE_PMD_SIZE)) { list_move(&info->shrinklist, &to_remove); + removed++; goto next; } list_move(&info->shrinklist, &list); next: - sbinfo->shrinklist_len--; if (!--batch) break; } @@ -574,7 +575,7 @@ inode = &info->vfs_inode; if (nr_to_split && split >= nr_to_split) - goto move_back; + goto leave; page = find_get_page(inode->i_mapping, (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT); @@ -588,44 +589,38 @@ } /* - * Move the inode on the list back to shrinklist if we failed - * to lock the page at this time. + * Leave the inode on the list if we failed to lock + * the page at this time. * * Waiting for the lock may lead to deadlock in the * reclaim path. */ if (!trylock_page(page)) { put_page(page); - goto move_back; + goto leave; } ret = split_huge_page(page); unlock_page(page); put_page(page); - /* If split failed move the inode on the list back to shrinklist */ + /* If split failed leave the inode on the list */ if (ret) - goto move_back; + goto leave; split++; drop: list_del_init(&info->shrinklist); - goto put; -move_back: - /* - * Make sure the inode is either on the global list or deleted - * from any local list before iput() since it could be deleted - * in another thread once we put the inode (then the local list - * is corrupted). - */ - spin_lock(&sbinfo->shrinklist_lock); - list_move(&info->shrinklist, &sbinfo->shrinklist); - sbinfo->shrinklist_len++; - spin_unlock(&sbinfo->shrinklist_lock); -put: + removed++; +leave: iput(inode); } + spin_lock(&sbinfo->shrinklist_lock); + list_splice_tail(&list, &sbinfo->shrinklist); + sbinfo->shrinklist_len -= removed; + spin_unlock(&sbinfo->shrinklist_lock); + return split; } diff -u linux-aws-5.13-5.13.0/net/ax25/af_ax25.c linux-aws-5.13-5.13.0/net/ax25/af_ax25.c --- linux-aws-5.13-5.13.0/net/ax25/af_ax25.c +++ linux-aws-5.13-5.13.0/net/ax25/af_ax25.c @@ -536,7 +536,7 @@ ax25_cb *ax25; struct net_device *dev; char devname[IFNAMSIZ]; - unsigned int opt; + unsigned long opt; int res = 0; if (level != SOL_AX25) @@ -568,7 +568,7 @@ break; case AX25_T1: - if (opt < 1 || opt > UINT_MAX / HZ) { + if (opt < 1 || opt > ULONG_MAX / HZ) { res = -EINVAL; break; } @@ -577,7 +577,7 @@ break; case AX25_T2: - if (opt < 1 || opt > UINT_MAX / HZ) { + if (opt < 1 || opt > ULONG_MAX / HZ) { res = -EINVAL; break; } @@ -593,7 +593,7 @@ break; case AX25_T3: - if (opt < 1 || opt > UINT_MAX / HZ) { + if (opt < 1 || opt > ULONG_MAX / HZ) { res = -EINVAL; break; } @@ -601,7 +601,7 @@ break; case AX25_IDLE: - if (opt > UINT_MAX / (60 * HZ)) { + if (opt > ULONG_MAX / (60 * HZ)) { res = -EINVAL; break; } reverted: --- linux-aws-5.13-5.13.0/net/batman-adv/netlink.c +++ linux-aws-5.13-5.13.0.orig/net/batman-adv/netlink.c @@ -1362,21 +1362,21 @@ { .cmd = BATADV_CMD_TP_METER, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_start, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_TP_METER_CANCEL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_cancel, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_GET_ROUTING_ALGOS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_algo_dump, }, { @@ -1391,68 +1391,68 @@ { .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_local_dump, }, { .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_global_dump, }, { .cmd = BATADV_CMD_GET_ORIGINATORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_orig_dump, }, { .cmd = BATADV_CMD_GET_NEIGHBORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_hardif_neigh_dump, }, { .cmd = BATADV_CMD_GET_GATEWAYS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_gw_dump, }, { .cmd = BATADV_CMD_GET_BLA_CLAIM, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_claim_dump, }, { .cmd = BATADV_CMD_GET_BLA_BACKBONE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_backbone_dump, }, { .cmd = BATADV_CMD_GET_DAT_CACHE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_dat_cache_dump, }, { .cmd = BATADV_CMD_GET_MCAST_FLAGS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_mcast_flags_dump, }, { .cmd = BATADV_CMD_SET_MESH, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_mesh, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_SET_HARDIF, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_hardif, .internal_flags = BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_HARDIF, @@ -1468,7 +1468,7 @@ { .cmd = BATADV_CMD_SET_VLAN, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_ADMIN_PERM, - .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_vlan, .internal_flags = BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_VLAN, diff -u linux-aws-5.13-5.13.0/net/bluetooth/cmtp/core.c linux-aws-5.13-5.13.0/net/bluetooth/cmtp/core.c --- linux-aws-5.13-5.13.0/net/bluetooth/cmtp/core.c +++ linux-aws-5.13-5.13.0/net/bluetooth/cmtp/core.c @@ -501,7 +501,9 @@ { BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); - return cmtp_init_sockets(); + cmtp_init_sockets(); + + return 0; } static void __exit cmtp_exit(void) diff -u linux-aws-5.13-5.13.0/net/bluetooth/hci_core.c linux-aws-5.13-5.13.0/net/bluetooth/hci_core.c --- linux-aws-5.13-5.13.0/net/bluetooth/hci_core.c +++ linux-aws-5.13-5.13.0/net/bluetooth/hci_core.c @@ -3971,7 +3971,6 @@ return id; err_wqueue: - debugfs_remove_recursive(hdev->debugfs); destroy_workqueue(hdev->workqueue); destroy_workqueue(hdev->req_workqueue); err: diff -u linux-aws-5.13-5.13.0/net/bluetooth/hci_event.c linux-aws-5.13-5.13.0/net/bluetooth/hci_event.c --- linux-aws-5.13-5.13.0/net/bluetooth/hci_event.c +++ linux-aws-5.13-5.13.0/net/bluetooth/hci_event.c @@ -5715,13 +5715,7 @@ struct hci_ev_le_advertising_info *ev = ptr; s8 rssi; - if (ptr > (void *)skb_tail_pointer(skb) - sizeof(*ev)) { - bt_dev_err(hdev, "Malicious advertising data."); - break; - } - - if (ev->length <= HCI_MAX_AD_LENGTH && - ev->data + ev->length <= skb_tail_pointer(skb)) { + if (ev->length <= HCI_MAX_AD_LENGTH) { rssi = ev->data[ev->length]; process_adv_report(hdev, ev->evt_type, &ev->bdaddr, ev->bdaddr_type, NULL, 0, rssi, diff -u linux-aws-5.13-5.13.0/net/bluetooth/hci_request.c linux-aws-5.13-5.13.0/net/bluetooth/hci_request.c --- linux-aws-5.13-5.13.0/net/bluetooth/hci_request.c +++ linux-aws-5.13-5.13.0/net/bluetooth/hci_request.c @@ -2299,7 +2299,7 @@ /* Set duration per instance since controller is responsible for * scheduling it. */ - if (adv_instance && adv_instance->timeout) { + if (adv_instance && adv_instance->duration) { u16 duration = adv_instance->timeout * MSEC_PER_SEC; /* Time = N * 10 ms */ diff -u linux-aws-5.13-5.13.0/net/bluetooth/l2cap_sock.c linux-aws-5.13-5.13.0/net/bluetooth/l2cap_sock.c --- linux-aws-5.13-5.13.0/net/bluetooth/l2cap_sock.c +++ linux-aws-5.13-5.13.0/net/bluetooth/l2cap_sock.c @@ -161,11 +161,7 @@ break; } - /* Use L2CAP_MODE_LE_FLOWCTL (CoC) in case of LE address and - * L2CAP_MODE_EXT_FLOWCTL (ECRED) has not been set. - */ - if (chan->psm && bdaddr_type_is_le(chan->src_type) && - chan->mode != L2CAP_MODE_EXT_FLOWCTL) + if (chan->psm && bdaddr_type_is_le(chan->src_type)) chan->mode = L2CAP_MODE_LE_FLOWCTL; chan->state = BT_BOUND; @@ -176,21 +172,6 @@ return err; } -static void l2cap_sock_init_pid(struct sock *sk) -{ - struct l2cap_chan *chan = l2cap_pi(sk)->chan; - - /* Only L2CAP_MODE_EXT_FLOWCTL ever need to access the PID in order to - * group the channels being requested. - */ - if (chan->mode != L2CAP_MODE_EXT_FLOWCTL) - return; - - spin_lock(&sk->sk_peer_lock); - sk->sk_peer_pid = get_pid(task_tgid(current)); - spin_unlock(&sk->sk_peer_lock); -} - static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) { @@ -259,15 +240,9 @@ return -EINVAL; } - /* Use L2CAP_MODE_LE_FLOWCTL (CoC) in case of LE address and - * L2CAP_MODE_EXT_FLOWCTL (ECRED) has not been set. - */ - if (chan->psm && bdaddr_type_is_le(chan->src_type) && - chan->mode != L2CAP_MODE_EXT_FLOWCTL) + if (chan->psm && bdaddr_type_is_le(chan->src_type) && !chan->mode) chan->mode = L2CAP_MODE_LE_FLOWCTL; - l2cap_sock_init_pid(sk); - err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), &la.l2_bdaddr, la.l2_bdaddr_type); if (err) @@ -323,8 +298,6 @@ goto done; } - l2cap_sock_init_pid(sk); - sk->sk_max_ack_backlog = backlog; sk->sk_ack_backlog = 0; @@ -903,8 +876,6 @@ struct l2cap_conn *conn; int len, err = 0; u32 opt; - u16 mtu; - u8 mode; BT_DBG("sk %p", sk); @@ -1087,16 +1058,16 @@ break; } - if (copy_from_sockptr(&mtu, optval, sizeof(u16))) { + if (copy_from_sockptr(&opt, optval, sizeof(u16))) { err = -EFAULT; break; } if (chan->mode == L2CAP_MODE_EXT_FLOWCTL && sk->sk_state == BT_CONNECTED) - err = l2cap_chan_reconfigure(chan, mtu); + err = l2cap_chan_reconfigure(chan, opt); else - chan->imtu = mtu; + chan->imtu = opt; break; @@ -1118,14 +1089,14 @@ break; } - if (copy_from_sockptr(&mode, optval, sizeof(u8))) { + if (copy_from_sockptr(&opt, optval, sizeof(u8))) { err = -EFAULT; break; } - BT_DBG("mode %u", mode); + BT_DBG("opt %u", opt); - err = l2cap_set_mode(chan, mode); + err = l2cap_set_mode(chan, opt); if (err) break; diff -u linux-aws-5.13-5.13.0/net/bluetooth/mgmt.c linux-aws-5.13-5.13.0/net/bluetooth/mgmt.c --- linux-aws-5.13-5.13.0/net/bluetooth/mgmt.c +++ linux-aws-5.13-5.13.0/net/bluetooth/mgmt.c @@ -3806,7 +3806,7 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, void *data, u16 data_len) { - char buf[62]; /* Enough space for 3 features */ + char buf[62]; /* Enough space for 3 features */ struct mgmt_rp_read_exp_features_info *rp = (void *)buf; u16 idx = 0; u32 flags; @@ -3892,186 +3892,150 @@ } #endif -#define EXP_FEAT(_uuid, _set_func) \ -{ \ - .uuid = _uuid, \ - .set_func = _set_func, \ -} - -/* The zero key uuid is special. Multiple exp features are set through it. */ -static int set_zero_key_func(struct sock *sk, struct hci_dev *hdev, - struct mgmt_cp_set_exp_feature *cp, u16 data_len) +static int set_exp_feature(struct sock *sk, struct hci_dev *hdev, + void *data, u16 data_len) { + struct mgmt_cp_set_exp_feature *cp = data; struct mgmt_rp_set_exp_feature rp; - memset(rp.uuid, 0, 16); - rp.flags = cpu_to_le32(0); - -#ifdef CONFIG_BT_FEATURE_DEBUG - if (!hdev) { - bool changed = bt_dbg_get(); - - bt_dbg_set(false); - - if (changed) - exp_debug_feature_changed(false, sk); - } -#endif - - if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) { - bool changed; - - changed = hci_dev_test_and_clear_flag(hdev, - HCI_ENABLE_LL_PRIVACY); - if (changed) - exp_ll_privacy_feature_changed(false, hdev, sk); - } - - hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); + bt_dev_dbg(hdev, "sock %p", sk); - return mgmt_cmd_complete(sk, hdev ? hdev->id : MGMT_INDEX_NONE, - MGMT_OP_SET_EXP_FEATURE, 0, - &rp, sizeof(rp)); -} + if (!memcmp(cp->uuid, ZERO_KEY, 16)) { + memset(rp.uuid, 0, 16); + rp.flags = cpu_to_le32(0); #ifdef CONFIG_BT_FEATURE_DEBUG -static int set_debug_func(struct sock *sk, struct hci_dev *hdev, - struct mgmt_cp_set_exp_feature *cp, u16 data_len) -{ - struct mgmt_rp_set_exp_feature rp; - - bool val, changed; - int err; + if (!hdev) { + bool changed = bt_dbg_get(); - /* Command requires to use the non-controller index */ - if (hdev) - return mgmt_cmd_status(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_INDEX); - - /* Parameters are limited to a single octet */ - if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1) - return mgmt_cmd_status(sk, MGMT_INDEX_NONE, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_PARAMS); - - /* Only boolean on/off is supported */ - if (cp->param[0] != 0x00 && cp->param[0] != 0x01) - return mgmt_cmd_status(sk, MGMT_INDEX_NONE, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_PARAMS); - - val = !!cp->param[0]; - changed = val ? !bt_dbg_get() : bt_dbg_get(); - bt_dbg_set(val); - - memcpy(rp.uuid, debug_uuid, 16); - rp.flags = cpu_to_le32(val ? BIT(0) : 0); - - hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); - - err = mgmt_cmd_complete(sk, MGMT_INDEX_NONE, - MGMT_OP_SET_EXP_FEATURE, 0, - &rp, sizeof(rp)); + bt_dbg_set(false); - if (changed) - exp_debug_feature_changed(val, sk); - - return err; -} + if (changed) + exp_debug_feature_changed(false, sk); + } #endif -static int set_rpa_resolution_func(struct sock *sk, struct hci_dev *hdev, - struct mgmt_cp_set_exp_feature *cp, - u16 data_len) -{ - struct mgmt_rp_set_exp_feature rp; - bool val, changed; - int err; - u32 flags; + if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) { + bool changed = hci_dev_test_flag(hdev, + HCI_ENABLE_LL_PRIVACY); - /* Command requires to use the controller index */ - if (!hdev) - return mgmt_cmd_status(sk, MGMT_INDEX_NONE, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_INDEX); - - /* Changes can only be made when controller is powered down */ - if (hdev_is_powered(hdev)) - return mgmt_cmd_status(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_REJECTED); - - /* Parameters are limited to a single octet */ - if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1) - return mgmt_cmd_status(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_PARAMS); - - /* Only boolean on/off is supported */ - if (cp->param[0] != 0x00 && cp->param[0] != 0x01) - return mgmt_cmd_status(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, - MGMT_STATUS_INVALID_PARAMS); + hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); - val = !!cp->param[0]; + if (changed) + exp_ll_privacy_feature_changed(false, hdev, sk); + } - if (val) { - changed = !hci_dev_test_and_set_flag(hdev, - HCI_ENABLE_LL_PRIVACY); - hci_dev_clear_flag(hdev, HCI_ADVERTISING); + hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); - /* Enable LL privacy + supported settings changed */ - flags = BIT(0) | BIT(1); - } else { - changed = hci_dev_test_and_clear_flag(hdev, - HCI_ENABLE_LL_PRIVACY); - - /* Disable LL privacy + supported settings changed */ - flags = BIT(1); + return mgmt_cmd_complete(sk, hdev ? hdev->id : MGMT_INDEX_NONE, + MGMT_OP_SET_EXP_FEATURE, 0, + &rp, sizeof(rp)); } - memcpy(rp.uuid, rpa_resolution_uuid, 16); - rp.flags = cpu_to_le32(flags); - - hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); +#ifdef CONFIG_BT_FEATURE_DEBUG + if (!memcmp(cp->uuid, debug_uuid, 16)) { + bool val, changed; + int err; + + /* Command requires to use the non-controller index */ + if (hdev) + return mgmt_cmd_status(sk, hdev->id, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_INDEX); + + /* Parameters are limited to a single octet */ + if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1) + return mgmt_cmd_status(sk, MGMT_INDEX_NONE, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_PARAMS); + + /* Only boolean on/off is supported */ + if (cp->param[0] != 0x00 && cp->param[0] != 0x01) + return mgmt_cmd_status(sk, MGMT_INDEX_NONE, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_PARAMS); + + val = !!cp->param[0]; + changed = val ? !bt_dbg_get() : bt_dbg_get(); + bt_dbg_set(val); + + memcpy(rp.uuid, debug_uuid, 16); + rp.flags = cpu_to_le32(val ? BIT(0) : 0); + + hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); + + err = mgmt_cmd_complete(sk, MGMT_INDEX_NONE, + MGMT_OP_SET_EXP_FEATURE, 0, + &rp, sizeof(rp)); - err = mgmt_cmd_complete(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, 0, - &rp, sizeof(rp)); + if (changed) + exp_debug_feature_changed(val, sk); - if (changed) - exp_ll_privacy_feature_changed(val, hdev, sk); + return err; + } +#endif - return err; -} + if (!memcmp(cp->uuid, rpa_resolution_uuid, 16)) { + bool val, changed; + int err; + u32 flags; + + /* Command requires to use the controller index */ + if (!hdev) + return mgmt_cmd_status(sk, MGMT_INDEX_NONE, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_INDEX); + + /* Changes can only be made when controller is powered down */ + if (hdev_is_powered(hdev)) + return mgmt_cmd_status(sk, hdev->id, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_REJECTED); + + /* Parameters are limited to a single octet */ + if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1) + return mgmt_cmd_status(sk, hdev->id, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_PARAMS); + + /* Only boolean on/off is supported */ + if (cp->param[0] != 0x00 && cp->param[0] != 0x01) + return mgmt_cmd_status(sk, hdev->id, + MGMT_OP_SET_EXP_FEATURE, + MGMT_STATUS_INVALID_PARAMS); -static const struct mgmt_exp_feature { - const u8 *uuid; - int (*set_func)(struct sock *sk, struct hci_dev *hdev, - struct mgmt_cp_set_exp_feature *cp, u16 data_len); -} exp_features[] = { - EXP_FEAT(ZERO_KEY, set_zero_key_func), -#ifdef CONFIG_BT_FEATURE_DEBUG - EXP_FEAT(debug_uuid, set_debug_func), -#endif - EXP_FEAT(rpa_resolution_uuid, set_rpa_resolution_func), + val = !!cp->param[0]; - /* end with a null feature */ - EXP_FEAT(NULL, NULL) -}; + if (val) { + changed = !hci_dev_test_flag(hdev, + HCI_ENABLE_LL_PRIVACY); + hci_dev_set_flag(hdev, HCI_ENABLE_LL_PRIVACY); + hci_dev_clear_flag(hdev, HCI_ADVERTISING); -static int set_exp_feature(struct sock *sk, struct hci_dev *hdev, - void *data, u16 data_len) -{ - struct mgmt_cp_set_exp_feature *cp = data; - size_t i = 0; + /* Enable LL privacy + supported settings changed */ + flags = BIT(0) | BIT(1); + } else { + changed = hci_dev_test_flag(hdev, + HCI_ENABLE_LL_PRIVACY); + hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY); + + /* Disable LL privacy + supported settings changed */ + flags = BIT(1); + } + + memcpy(rp.uuid, rpa_resolution_uuid, 16); + rp.flags = cpu_to_le32(flags); + + hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); + + err = mgmt_cmd_complete(sk, hdev->id, + MGMT_OP_SET_EXP_FEATURE, 0, + &rp, sizeof(rp)); - bt_dev_dbg(hdev, "sock %p", sk); + if (changed) + exp_ll_privacy_feature_changed(val, hdev, sk); - for (i = 0; exp_features[i].uuid; i++) { - if (!memcmp(cp->uuid, exp_features[i].uuid, 16)) - return exp_features[i].set_func(sk, hdev, cp, data_len); + return err; } return mgmt_cmd_status(sk, hdev ? hdev->id : MGMT_INDEX_NONE, reverted: --- linux-aws-5.13-5.13.0/net/bridge/br_netfilter_hooks.c +++ linux-aws-5.13-5.13.0.orig/net/bridge/br_netfilter_hooks.c @@ -743,9 +743,6 @@ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) mtu = nf_bridge->frag_max_size; - nf_bridge_update_protocol(skb); - nf_bridge_push_encap_header(skb); - if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { nf_bridge_info_free(skb); return br_dev_queue_push_xmit(net, sk, skb); @@ -763,6 +760,8 @@ IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; + nf_bridge_update_protocol(skb); + data = this_cpu_ptr(&brnf_frag_data_storage); if (skb_vlan_tag_present(skb)) { @@ -790,6 +789,8 @@ IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; + nf_bridge_update_protocol(skb); + data = this_cpu_ptr(&brnf_frag_data_storage); data->encap_size = nf_bridge_encap_header_len(skb); data->size = ETH_HLEN + data->encap_size; reverted: --- linux-aws-5.13-5.13.0/net/bridge/br_vlan.c +++ linux-aws-5.13-5.13.0.orig/net/bridge/br_vlan.c @@ -544,10 +544,10 @@ if (!br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { if (*state == BR_STATE_FORWARDING) { *state = br_vlan_get_pvid_state(vg); + return br_vlan_state_allowed(*state, true); + } else { + return true; - if (!br_vlan_state_allowed(*state, true)) - goto drop; } - return true; } } v = br_vlan_find(vg, *vid); @@ -2013,8 +2013,7 @@ goto out_err; } err = br_vlan_dump_dev(dev, skb, cb, dump_flags); + if (err && err != -EMSGSIZE) - /* if the dump completed without an error we return 0 here */ - if (err != -EMSGSIZE) goto out_err; } else { for_each_netdev_rcu(net, dev) { diff -u linux-aws-5.13-5.13.0/net/core/dev.c linux-aws-5.13-5.13.0/net/core/dev.c --- linux-aws-5.13-5.13.0/net/core/dev.c +++ linux-aws-5.13-5.13.0/net/core/dev.c @@ -9651,12 +9651,6 @@ goto out_unlock; } old_prog = link->prog; - if (old_prog->type != new_prog->type || - old_prog->expected_attach_type != new_prog->expected_attach_type) { - err = -EINVAL; - goto out_unlock; - } - if (old_prog == new_prog) { /* no-op, don't disturb drivers */ bpf_prog_put(new_prog); diff -u linux-aws-5.13-5.13.0/net/core/devlink.c linux-aws-5.13-5.13.0/net/core/devlink.c --- linux-aws-5.13-5.13.0/net/core/devlink.c +++ linux-aws-5.13-5.13.0/net/core/devlink.c @@ -8079,6 +8079,8 @@ GENL_DONT_VALIDATE_DUMP_STRICT, .dumpit = devlink_nl_cmd_health_reporter_dump_get_dumpit, .flags = GENL_ADMIN_PERM, + .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT | + DEVLINK_NL_FLAG_NO_LOCK, }, { .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, diff -u linux-aws-5.13-5.13.0/net/core/filter.c linux-aws-5.13-5.13.0/net/core/filter.c --- linux-aws-5.13-5.13.0/net/core/filter.c +++ linux-aws-5.13-5.13.0/net/core/filter.c @@ -4663,14 +4663,12 @@ switch (optname) { case SO_RCVBUF: val = min_t(u32, val, sysctl_rmem_max); - val = min_t(int, val, INT_MAX / 2); sk->sk_userlocks |= SOCK_RCVBUF_LOCK; WRITE_ONCE(sk->sk_rcvbuf, max_t(int, val * 2, SOCK_MIN_RCVBUF)); break; case SO_SNDBUF: val = min_t(u32, val, sysctl_wmem_max); - val = min_t(int, val, INT_MAX / 2); sk->sk_userlocks |= SOCK_SNDBUF_LOCK; WRITE_ONCE(sk->sk_sndbuf, max_t(int, val * 2, SOCK_MIN_SNDBUF)); @@ -8053,9 +8051,9 @@ { const u32 act_max = XDP_REDIRECT; - pr_warn_once("%s XDP return value %u, expect packet loss!\n", - act > act_max ? "Illegal" : "Driver unsupported", - act); + WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n", + act > act_max ? "Illegal" : "Driver unsupported", + act); } EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); diff -u linux-aws-5.13-5.13.0/net/core/flow_dissector.c linux-aws-5.13-5.13.0/net/core/flow_dissector.c --- linux-aws-5.13-5.13.0/net/core/flow_dissector.c +++ linux-aws-5.13-5.13.0/net/core/flow_dissector.c @@ -238,7 +238,7 @@ skb_flow_dissect_ct(const struct sk_buff *skb, struct flow_dissector *flow_dissector, void *target_container, u16 *ctinfo_map, - size_t mapsize, bool post_ct, u16 zone) + size_t mapsize, bool post_ct) { #if IS_ENABLED(CONFIG_NF_CONNTRACK) struct flow_dissector_key_ct *key; @@ -260,7 +260,6 @@ if (!ct) { key->ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | TCA_FLOWER_KEY_CT_FLAGS_INVALID; - key->ct_zone = zone; return; } reverted: --- linux-aws-5.13-5.13.0/net/core/net-procfs.c +++ linux-aws-5.13-5.13.0.orig/net/core/net-procfs.c @@ -190,23 +190,12 @@ .show = softnet_seq_show, }; +static void *ptype_get_idx(loff_t pos) -static void *ptype_get_idx(struct seq_file *seq, loff_t pos) { - struct list_head *ptype_list = NULL; struct packet_type *pt = NULL; - struct net_device *dev; loff_t i = 0; int t; - for_each_netdev_rcu(seq_file_net(seq), dev) { - ptype_list = &dev->ptype_all; - list_for_each_entry_rcu(pt, ptype_list, list) { - if (i == pos) - return pt; - ++i; - } - } - list_for_each_entry_rcu(pt, &ptype_all, list) { if (i == pos) return pt; @@ -227,40 +216,22 @@ __acquires(RCU) { rcu_read_lock(); + return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN; - return *pos ? ptype_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - struct net_device *dev; struct packet_type *pt; struct list_head *nxt; int hash; ++*pos; if (v == SEQ_START_TOKEN) + return ptype_get_idx(0); - return ptype_get_idx(seq, 0); pt = v; nxt = pt->list.next; - if (pt->dev) { - if (nxt != &pt->dev->ptype_all) - goto found; - - dev = pt->dev; - for_each_netdev_continue_rcu(seq_file_net(seq), dev) { - if (!list_empty(&dev->ptype_all)) { - nxt = dev->ptype_all.next; - goto found; - } - } - - nxt = ptype_all.next; - goto ptype_all; - } - if (pt->type == htons(ETH_P_ALL)) { -ptype_all: if (nxt != &ptype_all) goto found; hash = 0; @@ -289,8 +260,7 @@ if (v == SEQ_START_TOKEN) seq_puts(seq, "Type Device Function\n"); + else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) { - else if ((!pt->af_packet_net || net_eq(pt->af_packet_net, seq_file_net(seq))) && - (!pt->dev || net_eq(dev_net(pt->dev), seq_file_net(seq)))) { if (pt->type == htons(ETH_P_ALL)) seq_puts(seq, "ALL "); else diff -u linux-aws-5.13-5.13.0/net/core/net-sysfs.c linux-aws-5.13-5.13.0/net/core/net-sysfs.c --- linux-aws-5.13-5.13.0/net/core/net-sysfs.c +++ linux-aws-5.13-5.13.0/net/core/net-sysfs.c @@ -1820,9 +1820,6 @@ net_rx_queue_update_kobjects(dev, real_rx, 0); netdev_queue_update_kobjects(dev, real_tx, 0); - - dev->real_num_rx_queues = 0; - dev->real_num_tx_queues = 0; #ifdef CONFIG_SYSFS kset_unregister(dev->queues_kset); #endif diff -u linux-aws-5.13-5.13.0/net/core/net_namespace.c linux-aws-5.13-5.13.0/net/core/net_namespace.c --- linux-aws-5.13-5.13.0/net/core/net_namespace.c +++ linux-aws-5.13-5.13.0/net/core/net_namespace.c @@ -171,10 +171,8 @@ { struct net *net; if (ops->exit) { - list_for_each_entry(net, net_exit_list, exit_list) { + list_for_each_entry(net, net_exit_list, exit_list) ops->exit(net); - cond_resched(); - } } if (ops->exit_batch) ops->exit_batch(net_exit_list); diff -u linux-aws-5.13-5.13.0/net/core/sock.c linux-aws-5.13-5.13.0/net/core/sock.c --- linux-aws-5.13-5.13.0/net/core/sock.c +++ linux-aws-5.13-5.13.0/net/core/sock.c @@ -2488,7 +2488,6 @@ } } -#define SKB_FRAG_PAGE_ORDER get_order(32768) DEFINE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key); /** diff -u linux-aws-5.13-5.13.0/net/dsa/switch.c linux-aws-5.13-5.13.0/net/dsa/switch.c --- linux-aws-5.13-5.13.0/net/dsa/switch.c +++ linux-aws-5.13-5.13.0/net/dsa/switch.c @@ -428,7 +428,7 @@ int err = 0; int port; - if (!ds->ops->port_mrp_add_ring_role) + if (!ds->ops->port_mrp_add) return -EOPNOTSUPP; for (port = 0; port < ds->num_ports; port++) { @@ -447,7 +447,7 @@ dsa_switch_mrp_del_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_del_ring_role) + if (!ds->ops->port_mrp_del) return -EOPNOTSUPP; if (ds->index == info->sw_index) diff -u linux-aws-5.13-5.13.0/net/ipv4/esp4.c linux-aws-5.13-5.13.0/net/ipv4/esp4.c --- linux-aws-5.13-5.13.0/net/ipv4/esp4.c +++ linux-aws-5.13-5.13.0/net/ipv4/esp4.c @@ -448,6 +448,7 @@ struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; /* this is non-NULL only with TCP/UDP Encapsulation */ if (x->encap) { @@ -457,6 +458,10 @@ return err; } + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; + if (!skb_cloned(skb)) { if (tailen <= skb_tailroom(skb)) { nfrags = 1; diff -u linux-aws-5.13-5.13.0/net/ipv4/fib_semantics.c linux-aws-5.13-5.13.0/net/ipv4/fib_semantics.c --- linux-aws-5.13-5.13.0/net/ipv4/fib_semantics.c +++ linux-aws-5.13-5.13.0/net/ipv4/fib_semantics.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -252,6 +251,7 @@ pr_warn("Freeing alive fib_info %p\n", fi); return; } + fib_info_cnt--; call_rcu(&fi->rcu, free_fib_info_rcu); } @@ -262,10 +262,6 @@ spin_lock_bh(&fib_info_lock); if (fi && --fi->fib_treeref == 0) { hlist_del(&fi->fib_hash); - - /* Paired with READ_ONCE() in fib_create_info(). */ - WRITE_ONCE(fib_info_cnt, fib_info_cnt - 1); - if (fi->fib_prefsrc) hlist_del(&fi->fib_lhash); if (fi->nh) { @@ -322,15 +318,11 @@ static inline unsigned int fib_devindex_hashfn(unsigned int val) { - return hash_32(val, DEVINDEX_HASHBITS); -} + unsigned int mask = DEVINDEX_HASHSIZE - 1; -static struct hlist_head * -fib_info_devhash_bucket(const struct net_device *dev) -{ - u32 val = net_hash_mix(dev_net(dev)) ^ dev->ifindex; - - return &fib_info_devhash[fib_devindex_hashfn(val)]; + return (val ^ + (val >> DEVINDEX_HASHBITS) ^ + (val >> (DEVINDEX_HASHBITS * 2))) & mask; } static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope, @@ -440,11 +432,12 @@ { struct hlist_head *head; struct fib_nh *nh; + unsigned int hash; spin_lock(&fib_info_lock); - head = fib_info_devhash_bucket(dev); - + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; hlist_for_each_entry(nh, head, nh_hash) { if (nh->fib_nh_dev == dev && nh->fib_nh_gw4 == gw && @@ -1439,9 +1432,7 @@ #endif err = -ENOBUFS; - - /* Paired with WRITE_ONCE() in fib_release_info() */ - if (READ_ONCE(fib_info_cnt) >= fib_info_hash_size) { + if (fib_info_cnt >= fib_info_hash_size) { unsigned int new_size = fib_info_hash_size << 1; struct hlist_head *new_info_hash; struct hlist_head *new_laddrhash; @@ -1473,6 +1464,7 @@ return ERR_PTR(err); } + fib_info_cnt++; fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope; @@ -1599,7 +1591,6 @@ fi->fib_treeref++; refcount_set(&fi->fib_clntref, 1); spin_lock_bh(&fib_info_lock); - fib_info_cnt++; hlist_add_head(&fi->fib_hash, &fib_info_hash[fib_info_hashfn(fi)]); if (fi->fib_prefsrc) { @@ -1613,10 +1604,12 @@ } else { change_nexthops(fi) { struct hlist_head *head; + unsigned int hash; if (!nexthop_nh->fib_nh_dev) continue; - head = fib_info_devhash_bucket(nexthop_nh->fib_nh_dev); + hash = fib_devindex_hashfn(nexthop_nh->fib_nh_dev->ifindex); + head = &fib_info_devhash[hash]; hlist_add_head(&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) } @@ -1967,7 +1960,8 @@ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu) { - struct hlist_head *head = fib_info_devhash_bucket(dev); + unsigned int hash = fib_devindex_hashfn(dev->ifindex); + struct hlist_head *head = &fib_info_devhash[hash]; struct fib_nh *nh; hlist_for_each_entry(nh, head, nh_hash) { @@ -1986,11 +1980,12 @@ */ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force) { - struct hlist_head *head = fib_info_devhash_bucket(dev); - struct fib_info *prev_fi = NULL; + int ret = 0; int scope = RT_SCOPE_NOWHERE; + struct fib_info *prev_fi = NULL; + unsigned int hash = fib_devindex_hashfn(dev->ifindex); + struct hlist_head *head = &fib_info_devhash[hash]; struct fib_nh *nh; - int ret = 0; if (force) scope = -1; @@ -2135,6 +2130,7 @@ int fib_sync_up(struct net_device *dev, unsigned char nh_flags) { struct fib_info *prev_fi; + unsigned int hash; struct hlist_head *head; struct fib_nh *nh; int ret; @@ -2150,7 +2146,8 @@ } prev_fi = NULL; - head = fib_info_devhash_bucket(dev); + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; ret = 0; hlist_for_each_entry(nh, head, nh_hash) { reverted: --- linux-aws-5.13-5.13.0/net/ipv4/inet_fragment.c +++ linux-aws-5.13-5.13.0.orig/net/ipv4/inet_fragment.c @@ -235,9 +235,9 @@ /* The RCU read lock provides a memory barrier * guaranteeing that if fqdir->dead is false then * the hash table destruction will not start until + * after we unlock. Paired with inet_frags_exit_net(). - * after we unlock. Paired with fqdir_pre_exit(). */ + if (!fqdir->dead) { - if (!READ_ONCE(fqdir->dead)) { rhashtable_remove_fast(&fqdir->rhashtable, &fq->node, fqdir->f->rhash_params); refcount_dec(&fq->refcnt); @@ -352,11 +352,9 @@ /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key) { - /* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ - long high_thresh = READ_ONCE(fqdir->high_thresh); struct inet_frag_queue *fq = NULL, *prev; + if (!fqdir->high_thresh || frag_mem_limit(fqdir) > fqdir->high_thresh) - if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) return NULL; rcu_read_lock(); reverted: --- linux-aws-5.13-5.13.0/net/ipv4/ip_fragment.c +++ linux-aws-5.13-5.13.0.orig/net/ipv4/ip_fragment.c @@ -144,8 +144,7 @@ rcu_read_lock(); + if (qp->q.fqdir->dead) - /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ - if (READ_ONCE(qp->q.fqdir->dead)) goto out_rcu_unlock; spin_lock(&qp->q.lock); diff -u linux-aws-5.13-5.13.0/net/ipv4/ip_gre.c linux-aws-5.13-5.13.0/net/ipv4/ip_gre.c --- linux-aws-5.13-5.13.0/net/ipv4/ip_gre.c +++ linux-aws-5.13-5.13.0/net/ipv4/ip_gre.c @@ -599,9 +599,8 @@ key = &info->key; ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, - tunnel_id_to_key32(key->tun_id), - key->tos & ~INET_ECN_MASK, 0, skb->mark, - skb_get_hash(skb)); + tunnel_id_to_key32(key->tun_id), key->tos, 0, + skb->mark, skb_get_hash(skb)); rt = ip_route_output_key(dev_net(dev), &fl4); if (IS_ERR(rt)) return PTR_ERR(rt); diff -u linux-aws-5.13-5.13.0/net/ipv4/ip_output.c linux-aws-5.13-5.13.0/net/ipv4/ip_output.c --- linux-aws-5.13-5.13.0/net/ipv4/ip_output.c +++ linux-aws-5.13-5.13.0/net/ipv4/ip_output.c @@ -162,19 +162,12 @@ iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr); iph->saddr = saddr; iph->protocol = sk->sk_protocol; - /* Do not bother generating IPID for small packets (eg SYNACK) */ - if (skb->len <= IPV4_MIN_MTU || ip_dont_fragment(sk, &rt->dst)) { + if (ip_dont_fragment(sk, &rt->dst)) { iph->frag_off = htons(IP_DF); iph->id = 0; } else { iph->frag_off = 0; - /* TCP packets here are SYNACK with fat IPv4/TCP options. - * Avoid using the hashed IP ident generator. - */ - if (sk->sk_protocol == IPPROTO_TCP) - iph->id = (__force __be16)prandom_u32(); - else - __ip_select_ident(net, iph, 1); + __ip_select_ident(net, iph, 1); } if (opt && opt->opt.optlen) { @@ -622,6 +615,18 @@ } EXPORT_SYMBOL(ip_fraglist_init); +static void ip_fraglist_ipcb_prepare(struct sk_buff *skb, + struct ip_fraglist_iter *iter) +{ + struct sk_buff *to = iter->frag; + + /* Copy the flags to each fragment. */ + IPCB(to)->flags = IPCB(skb)->flags; + + if (iter->offset == 0) + ip_options_fragment(to); +} + void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter) { unsigned int hlen = iter->hlen; @@ -667,7 +672,7 @@ EXPORT_SYMBOL(ip_frag_init); static void ip_frag_ipcb(struct sk_buff *from, struct sk_buff *to, - bool first_frag) + bool first_frag, struct ip_frag_state *state) { /* Copy the flags to each fragment. */ IPCB(to)->flags = IPCB(from)->flags; @@ -846,20 +851,8 @@ /* Prepare header of the next frame, * before previous one went down. */ if (iter.frag) { - bool first_frag = (iter.offset == 0); - - IPCB(iter.frag)->flags = IPCB(skb)->flags; + ip_fraglist_ipcb_prepare(skb, &iter); ip_fraglist_prepare(skb, &iter); - if (first_frag && IPCB(skb)->opt.optlen) { - /* ipcb->opt is not populated for frags - * coming from __ip_make_skb(), - * ip_options_fragment() needs optlen - */ - IPCB(iter.frag)->opt.optlen = - IPCB(skb)->opt.optlen; - ip_options_fragment(iter.frag); - ip_send_check(iter.iph); - } } skb->tstamp = tstamp; @@ -913,7 +906,7 @@ err = PTR_ERR(skb2); goto fail; } - ip_frag_ipcb(skb, skb2, first_frag); + ip_frag_ipcb(skb, skb2, first_frag, &state); /* * Put this fragment into the sending queue. reverted: --- linux-aws-5.13-5.13.0/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ linux-aws-5.13-5.13.0.orig/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -505,11 +505,8 @@ if (IS_ERR(config)) return PTR_ERR(config); } + } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) - } else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) { - clusterip_config_entry_put(config); - clusterip_config_put(config); return -EINVAL; - } ret = nf_ct_netns_get(par->net, par->family); if (ret < 0) { reverted: --- linux-aws-5.13-5.13.0/net/ipv4/ping.c +++ linux-aws-5.13-5.13.0.orig/net/ipv4/ping.c @@ -220,8 +220,7 @@ continue; } + if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) - if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif && - sk->sk_bound_dev_if != inet_sdif(skb)) continue; sock_hold(sk); reverted: --- linux-aws-5.13-5.13.0/net/ipv4/raw.c +++ linux-aws-5.13-5.13.0.orig/net/ipv4/raw.c @@ -721,7 +721,6 @@ int ret = -EINVAL; int chk_addr_ret; - lock_sock(sk); if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) goto out; @@ -741,9 +740,7 @@ inet->inet_saddr = 0; /* Use device */ sk_dst_reset(sk); ret = 0; +out: return ret; -out: - release_sock(sk); - return ret; } /* diff -u linux-aws-5.13-5.13.0/net/ipv6/addrconf.c linux-aws-5.13-5.13.0/net/ipv6/addrconf.c --- linux-aws-5.13-5.13.0/net/ipv6/addrconf.c +++ linux-aws-5.13-5.13.0/net/ipv6/addrconf.c @@ -2580,7 +2580,7 @@ __u32 valid_lft, u32 prefered_lft) { struct inet6_ifaddr *ifp = ipv6_get_ifaddr(net, addr, dev, 1); - int create = 0, update_lft = 0; + int create = 0; if (!ifp && valid_lft) { int max_addresses = in6_dev->cnf.max_addresses; @@ -2624,32 +2624,19 @@ unsigned long now; u32 stored_lft; - /* update lifetime (RFC2462 5.5.3 e) */ + /* Update lifetime (RFC4862 5.5.3 e) + * We deviate from RFC4862 by honoring all Valid Lifetimes to + * improve the reaction of SLAAC to renumbering events + * (draft-gont-6man-slaac-renum-06, Section 4.2) + */ spin_lock_bh(&ifp->lock); now = jiffies; if (ifp->valid_lft > (now - ifp->tstamp) / HZ) stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; else stored_lft = 0; - if (!create && stored_lft) { - const u32 minimum_lft = min_t(u32, - stored_lft, MIN_VALID_LIFETIME); - valid_lft = max(valid_lft, minimum_lft); - - /* RFC4862 Section 5.5.3e: - * "Note that the preferred lifetime of the - * corresponding address is always reset to - * the Preferred Lifetime in the received - * Prefix Information option, regardless of - * whether the valid lifetime is also reset or - * ignored." - * - * So we should always update prefered_lft here. - */ - update_lft = 1; - } - if (update_lft) { + if (!create && stored_lft) { ifp->valid_lft = valid_lft; ifp->prefered_lft = prefered_lft; ifp->tstamp = now; diff -u linux-aws-5.13-5.13.0/net/ipv6/esp6.c linux-aws-5.13-5.13.0/net/ipv6/esp6.c --- linux-aws-5.13-5.13.0/net/ipv6/esp6.c +++ linux-aws-5.13-5.13.0/net/ipv6/esp6.c @@ -483,6 +483,7 @@ struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; if (x->encap) { int err = esp6_output_encap(x, skb, esp); @@ -491,6 +492,10 @@ return err; } + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; + if (!skb_cloned(skb)) { if (tailen <= skb_tailroom(skb)) { nfrags = 1; reverted: --- linux-aws-5.13-5.13.0/net/ipv6/icmp.c +++ linux-aws-5.13-5.13.0.orig/net/ipv6/icmp.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -811,7 +810,6 @@ void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) { - struct inet6_skb_parm *opt = IP6CB(skb); const struct inet6_protocol *ipprot; int inner_offset; __be16 frag_off; @@ -821,8 +819,6 @@ if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) goto out; - seg6_icmp_srh(skb, opt); - nexthdr = ((struct ipv6hdr *)skb->data)->nexthdr; if (ipv6_ext_hdr(nexthdr)) { /* now skip over extension headers */ @@ -847,7 +843,7 @@ ipprot = rcu_dereference(inet6_protos[nexthdr]); if (ipprot && ipprot->err_handler) + ipprot->err_handler(skb, NULL, type, code, inner_offset, info); - ipprot->err_handler(skb, opt, type, code, inner_offset, info); raw6_icmp_error(skb, nexthdr, type, code, inner_offset, info); return; diff -u linux-aws-5.13-5.13.0/net/ipv6/ip6_fib.c linux-aws-5.13-5.13.0/net/ipv6/ip6_fib.c --- linux-aws-5.13-5.13.0/net/ipv6/ip6_fib.c +++ linux-aws-5.13-5.13.0/net/ipv6/ip6_fib.c @@ -110,7 +110,7 @@ fn = rcu_dereference_protected(f6i->fib6_node, lockdep_is_held(&f6i->fib6_table->tb6_lock)); if (fn) - WRITE_ONCE(fn->fn_sernum, fib6_new_sernum(net)); + fn->fn_sernum = fib6_new_sernum(net); } /* @@ -588,13 +588,12 @@ spin_unlock_bh(&table->tb6_lock); if (res > 0) { cb->args[4] = 1; - cb->args[5] = READ_ONCE(w->root->fn_sernum); + cb->args[5] = w->root->fn_sernum; } } else { - int sernum = READ_ONCE(w->root->fn_sernum); - if (cb->args[5] != sernum) { + if (cb->args[5] != w->root->fn_sernum) { /* Begin at the root if the tree changed */ - cb->args[5] = sernum; + cb->args[5] = w->root->fn_sernum; w->state = FWS_INIT; w->node = w->root; w->skip = w->count; @@ -1344,7 +1343,7 @@ /* paired with smp_rmb() in rt6_get_cookie_safe() */ smp_wmb(); while (fn) { - WRITE_ONCE(fn->fn_sernum, sernum); + fn->fn_sernum = sernum; fn = rcu_dereference_protected(fn->parent, lockdep_is_held(&rt->fib6_table->tb6_lock)); } @@ -2173,8 +2172,8 @@ }; if (c->sernum != FIB6_NO_SERNUM_CHANGE && - READ_ONCE(w->node->fn_sernum) != c->sernum) - WRITE_ONCE(w->node->fn_sernum, c->sernum); + w->node->fn_sernum != c->sernum) + w->node->fn_sernum = c->sernum; if (!c->func) { WARN_ON_ONCE(c->sernum == FIB6_NO_SERNUM_CHANGE); @@ -2538,7 +2537,7 @@ iter->w.state = FWS_INIT; iter->w.node = iter->w.root; iter->w.args = iter; - iter->sernum = READ_ONCE(iter->w.root->fn_sernum); + iter->sernum = iter->w.root->fn_sernum; INIT_LIST_HEAD(&iter->w.lh); fib6_walker_link(net, &iter->w); } @@ -2566,10 +2565,8 @@ static void ipv6_route_check_sernum(struct ipv6_route_iter *iter) { - int sernum = READ_ONCE(iter->w.root->fn_sernum); - - if (iter->sernum != sernum) { - iter->sernum = sernum; + if (iter->sernum != iter->w.root->fn_sernum) { + iter->sernum = iter->w.root->fn_sernum; iter->w.state = FWS_INIT; iter->w.node = iter->w.root; WARN_ON(iter->w.skip); reverted: --- linux-aws-5.13-5.13.0/net/ipv6/ip6_gre.c +++ linux-aws-5.13-5.13.0.orig/net/ipv6/ip6_gre.c @@ -755,7 +755,6 @@ fl6->daddr = key->u.ipv6.dst; fl6->flowlabel = key->label; fl6->flowi6_uid = sock_net_uid(dev_net(dev), NULL); - fl6->fl6_gre_key = tunnel_id_to_key32(key->tun_id); dsfield = key->tos; flags = key->tun_flags & @@ -991,7 +990,6 @@ fl6.daddr = key->u.ipv6.dst; fl6.flowlabel = key->label; fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); - fl6.fl6_gre_key = tunnel_id_to_key32(key->tun_id); dsfield = key->tos; if (!(tun_info->key.tun_flags & TUNNEL_ERSPAN_OPT)) @@ -1100,7 +1098,6 @@ fl6->flowi6_oif = p->link; fl6->flowlabel = 0; fl6->flowi6_proto = IPPROTO_GRE; - fl6->fl6_gre_key = t->parms.o_key; if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; @@ -1546,7 +1543,7 @@ static struct inet6_protocol ip6gre_protocol __read_mostly = { .handler = gre_rcv, .err_handler = ip6gre_err, + .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, - .flags = INET6_PROTO_FINAL, }; static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) diff -u linux-aws-5.13-5.13.0/net/ipv6/ip6_tunnel.c linux-aws-5.13-5.13.0/net/ipv6/ip6_tunnel.c --- linux-aws-5.13-5.13.0/net/ipv6/ip6_tunnel.c +++ linux-aws-5.13-5.13.0/net/ipv6/ip6_tunnel.c @@ -1035,14 +1035,14 @@ if (unlikely(!ipv6_chk_addr_and_flags(net, laddr, ldev, false, 0, IFA_F_TENTATIVE))) - pr_warn_ratelimited("%s xmit: Local address not yet configured!\n", - p->name); + pr_warn("%s xmit: Local address not yet configured!\n", + p->name); else if (!(p->flags & IP6_TNL_F_ALLOW_LOCAL_REMOTE) && !ipv6_addr_is_multicast(raddr) && unlikely(ipv6_chk_addr_and_flags(net, raddr, ldev, true, 0, IFA_F_TENTATIVE))) - pr_warn_ratelimited("%s xmit: Routing loop! Remote address found on this node!\n", - p->name); + pr_warn("%s xmit: Routing loop! Remote address found on this node!\n", + p->name); else ret = 1; rcu_read_unlock(); diff -u linux-aws-5.13-5.13.0/net/ipv6/route.c linux-aws-5.13-5.13.0/net/ipv6/route.c --- linux-aws-5.13-5.13.0/net/ipv6/route.c +++ linux-aws-5.13-5.13.0/net/ipv6/route.c @@ -2675,7 +2675,7 @@ if (from) { fn = rcu_dereference(from->fib6_node); if (fn && (rt->rt6i_flags & RTF_DEFAULT)) - WRITE_ONCE(fn->fn_sernum, -1); + fn->fn_sernum = -1; } } rcu_read_unlock(); reverted: --- linux-aws-5.13-5.13.0/net/ipv6/seg6.c +++ linux-aws-5.13-5.13.0.orig/net/ipv6/seg6.c @@ -75,65 +75,6 @@ return true; } -struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags) -{ - struct ipv6_sr_hdr *srh; - int len, srhoff = 0; - - if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, &flags) < 0) - return NULL; - - if (!pskb_may_pull(skb, srhoff + sizeof(*srh))) - return NULL; - - srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); - - len = (srh->hdrlen + 1) << 3; - - if (!pskb_may_pull(skb, srhoff + len)) - return NULL; - - /* note that pskb_may_pull may change pointers in header; - * for this reason it is necessary to reload them when needed. - */ - srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); - - if (!seg6_validate_srh(srh, len, true)) - return NULL; - - return srh; -} - -/* Determine if an ICMP invoking packet contains a segment routing - * header. If it does, extract the offset to the true destination - * address, which is in the first segment address. - */ -void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt) -{ - __u16 network_header = skb->network_header; - struct ipv6_sr_hdr *srh; - - /* Update network header to point to the invoking packet - * inside the ICMP packet, so we can use the seg6_get_srh() - * helper. - */ - skb_reset_network_header(skb); - - srh = seg6_get_srh(skb, 0); - if (!srh) - goto out; - - if (srh->type != IPV6_SRCRT_TYPE_4) - goto out; - - opt->flags |= IP6SKB_SEG6; - opt->srhoff = (unsigned char *)srh - skb->data; - -out: - /* Restore the network header back to the ICMP packet */ - skb->network_header = network_header; -} - static struct genl_family seg6_genl_family; static const struct nla_policy seg6_genl_policy[SEG6_ATTR_MAX + 1] = { reverted: --- linux-aws-5.13-5.13.0/net/ipv6/seg6_local.c +++ linux-aws-5.13-5.13.0.orig/net/ipv6/seg6_local.c @@ -149,11 +149,40 @@ return (struct seg6_local_lwt *)lwt->data; } +static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb, int flags) +{ + struct ipv6_sr_hdr *srh; + int len, srhoff = 0; + + if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, &flags) < 0) + return NULL; + + if (!pskb_may_pull(skb, srhoff + sizeof(*srh))) + return NULL; + + srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); + + len = (srh->hdrlen + 1) << 3; + + if (!pskb_may_pull(skb, srhoff + len)) + return NULL; + + /* note that pskb_may_pull may change pointers in header; + * for this reason it is necessary to reload them when needed. + */ + srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); + + if (!seg6_validate_srh(srh, len, true)) + return NULL; + + return srh; +} + static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb) { struct ipv6_sr_hdr *srh; + srh = get_srh(skb, IP6_FH_F_SKIP_RH); - srh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH); if (!srh) return NULL; @@ -170,7 +199,7 @@ struct ipv6_sr_hdr *srh; unsigned int off = 0; + srh = get_srh(skb, 0); - srh = seg6_get_srh(skb, 0); if (srh && srh->segments_left > 0) return false; diff -u linux-aws-5.13-5.13.0/net/ipv6/udp.c linux-aws-5.13-5.13.0/net/ipv6/udp.c --- linux-aws-5.13-5.13.0/net/ipv6/udp.c +++ linux-aws-5.13-5.13.0/net/ipv6/udp.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -562,7 +561,7 @@ struct ipv6_pinfo *np; const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; const struct in6_addr *saddr = &hdr->saddr; - const struct in6_addr *daddr = seg6_get_daddr(skb, opt) ? : &hdr->daddr; + const struct in6_addr *daddr = &hdr->daddr; struct udphdr *uh = (struct udphdr *)(skb->data+offset); bool tunnel = false; struct sock *sk; diff -u linux-aws-5.13-5.13.0/net/mac80211/rx.c linux-aws-5.13-5.13.0/net/mac80211/rx.c --- linux-aws-5.13-5.13.0/net/mac80211/rx.c +++ linux-aws-5.13-5.13.0/net/mac80211/rx.c @@ -4856,7 +4856,7 @@ goto drop; break; case RX_ENC_VHT: - if (WARN_ONCE(status->rate_idx > 11 || + if (WARN_ONCE(status->rate_idx > 9 || !status->nss || status->nss > 8, "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", diff -u linux-aws-5.13-5.13.0/net/netfilter/nf_conntrack_core.c linux-aws-5.13-5.13.0/net/netfilter/nf_conntrack_core.c --- linux-aws-5.13-5.13.0/net/netfilter/nf_conntrack_core.c +++ linux-aws-5.13-5.13.0/net/netfilter/nf_conntrack_core.c @@ -1847,17 +1847,15 @@ pr_debug("nf_conntrack_in: Can't track with proto module\n"); nf_conntrack_put(&ct->ct_general); skb->_nfct = 0; + NF_CT_STAT_INC_ATOMIC(state->net, invalid); + if (ret == -NF_DROP) + NF_CT_STAT_INC_ATOMIC(state->net, drop); /* Special case: TCP tracker reports an attempt to reopen a * closed/aborted connection. We have to go back and create a * fresh conntrack. */ if (ret == -NF_REPEAT) goto repeat; - - NF_CT_STAT_INC_ATOMIC(state->net, invalid); - if (ret == -NF_DROP) - NF_CT_STAT_INC_ATOMIC(state->net, drop); - ret = -ret; goto out; } reverted: --- linux-aws-5.13-5.13.0/net/netfilter/nft_payload.c +++ linux-aws-5.13-5.13.0.orig/net/netfilter/nft_payload.c @@ -502,9 +502,6 @@ struct sk_buff *skb, unsigned int *l4csum_offset) { - if (pkt->xt.fragoff) - return -1; - switch (pkt->tprot) { case IPPROTO_TCP: *l4csum_offset = offsetof(struct tcphdr, check); reverted: --- linux-aws-5.13-5.13.0/net/netfilter/nft_set_pipapo.c +++ linux-aws-5.13-5.13.0.orig/net/netfilter/nft_set_pipapo.c @@ -1290,11 +1290,6 @@ if (!new->scratch_aligned) goto out_scratch; #endif - for_each_possible_cpu(i) - *per_cpu_ptr(new->scratch, i) = NULL; - - if (pipapo_realloc_scratch(new, old->bsize_max)) - goto out_scratch_realloc; rcu_head_init(&new->rcu); @@ -1339,9 +1334,6 @@ kvfree(dst->lt); dst--; } -out_scratch_realloc: - for_each_possible_cpu(i) - kfree(*per_cpu_ptr(new->scratch, i)); #ifdef NFT_PIPAPO_ALIGN free_percpu(new->scratch_aligned); #endif diff -u linux-aws-5.13-5.13.0/net/netrom/af_netrom.c linux-aws-5.13-5.13.0/net/netrom/af_netrom.c --- linux-aws-5.13-5.13.0/net/netrom/af_netrom.c +++ linux-aws-5.13-5.13.0/net/netrom/af_netrom.c @@ -298,7 +298,7 @@ { struct sock *sk = sock->sk; struct nr_sock *nr = nr_sk(sk); - unsigned int opt; + unsigned long opt; if (level != SOL_NETROM) return -ENOPROTOOPT; @@ -306,18 +306,18 @@ if (optlen < sizeof(unsigned int)) return -EINVAL; - if (copy_from_sockptr(&opt, optval, sizeof(opt))) + if (copy_from_sockptr(&opt, optval, sizeof(unsigned long))) return -EFAULT; switch (optname) { case NETROM_T1: - if (opt < 1 || opt > UINT_MAX / HZ) + if (opt < 1 || opt > ULONG_MAX / HZ) return -EINVAL; nr->t1 = opt * HZ; return 0; case NETROM_T2: - if (opt < 1 || opt > UINT_MAX / HZ) + if (opt < 1 || opt > ULONG_MAX / HZ) return -EINVAL; nr->t2 = opt * HZ; return 0; @@ -329,13 +329,13 @@ return 0; case NETROM_T4: - if (opt < 1 || opt > UINT_MAX / HZ) + if (opt < 1 || opt > ULONG_MAX / HZ) return -EINVAL; nr->t4 = opt * HZ; return 0; case NETROM_IDLE: - if (opt > UINT_MAX / (60 * HZ)) + if (opt > ULONG_MAX / (60 * HZ)) return -EINVAL; nr->idle = opt * 60 * HZ; return 0; reverted: --- linux-aws-5.13-5.13.0/net/nfc/llcp_sock.c +++ linux-aws-5.13-5.13.0.orig/net/nfc/llcp_sock.c @@ -789,11 +789,6 @@ lock_sock(sk); - if (!llcp_sock->local) { - release_sock(sk); - return -ENODEV; - } - if (sk->sk_type == SOCK_DGRAM) { DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, msg->msg_name); reverted: --- linux-aws-5.13-5.13.0/net/openvswitch/flow.c +++ linux-aws-5.13-5.13.0.orig/net/openvswitch/flow.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "conntrack.h" #include "datapath.h" @@ -858,9 +857,8 @@ #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) struct tc_skb_ext *tc_ext; #endif + bool post_ct = false; - bool post_ct = false, post_ct_snat = false, post_ct_dnat = false; int res, err; - u16 zone = 0; /* Extract metadata from packet. */ if (tun_info) { @@ -899,9 +897,6 @@ key->recirc_id = tc_ext ? tc_ext->chain : 0; OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; post_ct = tc_ext ? tc_ext->post_ct : false; - post_ct_snat = post_ct ? tc_ext->post_ct_snat : false; - post_ct_dnat = post_ct ? tc_ext->post_ct_dnat : false; - zone = post_ct ? tc_ext->zone : 0; } else { key->recirc_id = 0; } @@ -910,19 +905,8 @@ #endif err = key_extract(skb, key); + if (!err) - if (!err) { ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ - if (post_ct) { - if (!skb_get_nfct(skb)) { - key->ct_zone = zone; - } else { - if (!post_ct_dnat) - key->ct_state &= ~OVS_CS_F_DST_NAT; - if (!post_ct_snat) - key->ct_state &= ~OVS_CS_F_SRC_NAT; - } - } - } return err; } diff -u linux-aws-5.13-5.13.0/net/packet/af_packet.c linux-aws-5.13-5.13.0/net/packet/af_packet.c --- linux-aws-5.13-5.13.0/net/packet/af_packet.c +++ linux-aws-5.13-5.13.0/net/packet/af_packet.c @@ -1736,7 +1736,6 @@ match->prot_hook.dev = po->prot_hook.dev; match->prot_hook.func = packet_rcv_fanout; match->prot_hook.af_packet_priv = match; - match->prot_hook.af_packet_net = read_pnet(&match->net); match->prot_hook.id_match = match_fanout_group; match->max_num_members = args->max_num_members; list_add(&match->list, &fanout_list); @@ -3325,7 +3324,6 @@ po->prot_hook.func = packet_rcv_spkt; po->prot_hook.af_packet_priv = sk; - po->prot_hook.af_packet_net = sock_net(sk); if (proto) { po->prot_hook.type = proto; reverted: --- linux-aws-5.13-5.13.0/net/rxrpc/call_event.c +++ linux-aws-5.13-5.13.0.orig/net/rxrpc/call_event.c @@ -157,7 +157,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) { struct sk_buff *skb; + unsigned long resend_at, rto_j; - unsigned long resend_at; rxrpc_seq_t cursor, seq, top; ktime_t now, max_age, oldest, ack_ts; int ix; @@ -165,8 +165,10 @@ _enter("{%d,%d}", call->tx_hard_ack, call->tx_top); + rto_j = call->peer->rto_j; + now = ktime_get_real(); + max_age = ktime_sub(now, jiffies_to_usecs(rto_j)); - max_age = ktime_sub(now, jiffies_to_usecs(call->peer->rto_j)); spin_lock_bh(&call->lock); @@ -211,7 +213,7 @@ } resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest))); + resend_at += jiffies + rto_j; - resend_at += jiffies + rxrpc_get_rto_backoff(call->peer, retrans); WRITE_ONCE(call->resend_at, resend_at); if (unacked) reverted: --- linux-aws-5.13-5.13.0/net/rxrpc/output.c +++ linux-aws-5.13-5.13.0.orig/net/rxrpc/output.c @@ -468,7 +468,7 @@ if (call->peer->rtt_count > 1) { unsigned long nowj = jiffies, ack_lost_at; + ack_lost_at = rxrpc_get_rto_backoff(call->peer, retrans); - ack_lost_at = rxrpc_get_rto_backoff(call->peer, false); ack_lost_at += nowj; WRITE_ONCE(call->ack_lost_at, ack_lost_at); rxrpc_reduce_call_timer(call, ack_lost_at, nowj, diff -u linux-aws-5.13-5.13.0/net/sched/act_ct.c linux-aws-5.13-5.13.0/net/sched/act_ct.c --- linux-aws-5.13-5.13.0/net/sched/act_ct.c +++ linux-aws-5.13-5.13.0/net/sched/act_ct.c @@ -839,12 +839,6 @@ } err = nf_nat_packet(ct, ctinfo, hooknum, skb); - if (err == NF_ACCEPT) { - if (maniptype == NF_NAT_MANIP_SRC) - tc_skb_cb(skb)->post_ct_snat = 1; - if (maniptype == NF_NAT_MANIP_DST) - tc_skb_cb(skb)->post_ct_dnat = 1; - } out: return err; } @@ -1055,7 +1049,6 @@ skb_push_rcsum(skb, nh_ofs); tc_skb_cb(skb)->post_ct = true; - tc_skb_cb(skb)->zone = p->zone; out_clear: if (defrag) qdisc_skb_cb(skb)->pkt_len = skb->len; diff -u linux-aws-5.13-5.13.0/net/sched/cls_api.c linux-aws-5.13-5.13.0/net/sched/cls_api.c --- linux-aws-5.13-5.13.0/net/sched/cls_api.c +++ linux-aws-5.13-5.13.0/net/sched/cls_api.c @@ -1633,9 +1633,6 @@ ext->chain = last_executed_chain; ext->mru = cb->mru; ext->post_ct = cb->post_ct; - ext->post_ct_snat = cb->post_ct_snat; - ext->post_ct_dnat = cb->post_ct_dnat; - ext->zone = cb->zone; } return ret; @@ -1958,9 +1955,9 @@ bool prio_allocate; u32 parent; u32 chain_index; - struct Qdisc *q = NULL; + struct Qdisc *q; struct tcf_chain_info chain_info; - struct tcf_chain *chain = NULL; + struct tcf_chain *chain; struct tcf_block *block; struct tcf_proto *tp; unsigned long cl; @@ -1988,6 +1985,8 @@ tp = NULL; cl = 0; block = NULL; + q = NULL; + chain = NULL; if (prio == 0) { /* If no priority is provided by the user, @@ -2808,8 +2807,8 @@ struct tcmsg *t; u32 parent; u32 chain_index; - struct Qdisc *q = NULL; - struct tcf_chain *chain = NULL; + struct Qdisc *q; + struct tcf_chain *chain; struct tcf_block *block; unsigned long cl; int err; @@ -2819,6 +2818,7 @@ return -EPERM; replay: + q = NULL; err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); if (err < 0) diff -u linux-aws-5.13-5.13.0/net/sched/cls_flower.c linux-aws-5.13-5.13.0/net/sched/cls_flower.c --- linux-aws-5.13-5.13.0/net/sched/cls_flower.c +++ linux-aws-5.13-5.13.0/net/sched/cls_flower.c @@ -311,7 +311,6 @@ { struct cls_fl_head *head = rcu_dereference_bh(tp->root); bool post_ct = tc_skb_cb(skb)->post_ct; - u16 zone = tc_skb_cb(skb)->zone; struct fl_flow_key skb_key; struct fl_flow_mask *mask; struct cls_fl_filter *f; @@ -329,7 +328,7 @@ skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, fl_ct_info_to_flower_map, ARRAY_SIZE(fl_ct_info_to_flower_map), - post_ct, zone); + post_ct); skb_flow_dissect_hash(skb, &mask->dissector, &skb_key); skb_flow_dissect(skb, &mask->dissector, &skb_key, 0); diff -u linux-aws-5.13-5.13.0/net/sched/sch_api.c linux-aws-5.13-5.13.0/net/sched/sch_api.c --- linux-aws-5.13-5.13.0/net/sched/sch_api.c +++ linux-aws-5.13-5.13.0/net/sched/sch_api.c @@ -1062,7 +1062,7 @@ qdisc_offload_graft_root(dev, new, old, extack); - if (new && new->ops->attach && !ingress) + if (new && new->ops->attach) goto skip; for (i = 0; i < num_q; i++) { diff -u linux-aws-5.13-5.13.0/net/sched/sch_generic.c linux-aws-5.13-5.13.0/net/sched/sch_generic.c --- linux-aws-5.13-5.13.0/net/sched/sch_generic.c +++ linux-aws-5.13-5.13.0/net/sched/sch_generic.c @@ -1428,7 +1428,6 @@ { memset(r, 0, sizeof(*r)); r->overhead = conf->overhead; - r->mpu = conf->mpu; r->rate_bytes_ps = max_t(u64, conf->rate, rate64); r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); psched_ratecfg_precompute__(r->rate_bytes_ps, &r->mult, &r->shift); diff -u linux-aws-5.13-5.13.0/net/sched/sch_htb.c linux-aws-5.13-5.13.0/net/sched/sch_htb.c --- linux-aws-5.13-5.13.0/net/sched/sch_htb.c +++ linux-aws-5.13-5.13.0/net/sched/sch_htb.c @@ -1768,26 +1768,6 @@ if (!hopt->rate.rate || !hopt->ceil.rate) goto failure; - if (q->offload) { - /* Options not supported by the offload. */ - if (hopt->rate.overhead || hopt->ceil.overhead) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the overhead parameter"); - goto failure; - } - if (hopt->rate.mpu || hopt->ceil.mpu) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the mpu parameter"); - goto failure; - } - if (hopt->quantum) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the quantum parameter"); - goto failure; - } - if (hopt->prio) { - NL_SET_ERR_MSG(extack, "HTB offload doesn't support the prio parameter"); - goto failure; - } - } - /* Keeping backward compatible with rate_table based iproute2 tc */ if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) qdisc_put_rtab(qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB], diff -u linux-aws-5.13-5.13.0/net/smc/af_smc.c linux-aws-5.13-5.13.0/net/smc/af_smc.c --- linux-aws-5.13-5.13.0/net/smc/af_smc.c +++ linux-aws-5.13-5.13.0/net/smc/af_smc.c @@ -548,17 +548,12 @@ mutex_unlock(&net->smc.mutex_fback_rsn); } -static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) +static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code) { wait_queue_head_t *smc_wait = sk_sleep(&smc->sk); - wait_queue_head_t *clc_wait; + wait_queue_head_t *clc_wait = sk_sleep(smc->clcsock->sk); unsigned long flags; - mutex_lock(&smc->clcsock_release_lock); - if (!smc->clcsock) { - mutex_unlock(&smc->clcsock_release_lock); - return -EBADF; - } smc->use_fallback = true; smc->fallback_rsn = reason_code; smc_stat_fallback(smc); @@ -572,30 +567,18 @@ * smc socket->wq, which should be removed * to clcsocket->wq during the fallback. */ - clc_wait = sk_sleep(smc->clcsock->sk); spin_lock_irqsave(&smc_wait->lock, flags); spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING); list_splice_init(&smc_wait->head, &clc_wait->head); spin_unlock(&clc_wait->lock); spin_unlock_irqrestore(&smc_wait->lock, flags); } - mutex_unlock(&smc->clcsock_release_lock); - return 0; } /* fall back during connect */ static int smc_connect_fallback(struct smc_sock *smc, int reason_code) { - struct net *net = sock_net(&smc->sk); - int rc = 0; - - rc = smc_switch_to_fallback(smc, reason_code); - if (rc) { /* fallback fails */ - this_cpu_inc(net->smc.smc_stats->clnt_hshake_err_cnt); - if (smc->sk.sk_state == SMC_INIT) - sock_put(&smc->sk); /* passive closing */ - return rc; - } + smc_switch_to_fallback(smc, reason_code); smc_copy_sock_settings_to_clc(smc); smc->connect_nonblock = 0; if (smc->sk.sk_state == SMC_INIT) @@ -630,12 +613,10 @@ static void smc_conn_abort(struct smc_sock *smc, int local_first) { - struct smc_connection *conn = &smc->conn; - struct smc_link_group *lgr = conn->lgr; - - smc_conn_free(conn); if (local_first) - smc_lgr_cleanup_early(lgr); + smc_lgr_cleanup_early(&smc->conn); + else + smc_conn_free(&smc->conn); } /* check if there is a rdma device available for this connection. */ @@ -1401,12 +1382,11 @@ { /* RDMA setup failed, switch back to TCP */ smc_conn_abort(new_smc, local_first); - if (reason_code < 0 || - smc_switch_to_fallback(new_smc, reason_code)) { - /* error, no fallback possible */ + if (reason_code < 0) { /* error, no fallback possible */ smc_listen_out_err(new_smc); return; } + smc_switch_to_fallback(new_smc, reason_code); if (reason_code && reason_code != SMC_CLC_DECL_PEERDECL) { if (smc_clc_send_decline(new_smc, reason_code, version) < 0) { smc_listen_out_err(new_smc); @@ -1779,11 +1759,8 @@ /* check if peer is smc capable */ if (!tcp_sk(newclcsock->sk)->syn_smc) { - rc = smc_switch_to_fallback(new_smc, SMC_CLC_DECL_PEERNOSMC); - if (rc) - smc_listen_out_err(new_smc); - else - smc_listen_out_connected(new_smc); + smc_switch_to_fallback(new_smc, SMC_CLC_DECL_PEERNOSMC); + smc_listen_out_connected(new_smc); return; } @@ -2069,9 +2046,7 @@ if (msg->msg_flags & MSG_FASTOPEN) { if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { - rc = smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); - if (rc) - goto out; + smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); } else { rc = -EINVAL; goto out; @@ -2264,11 +2239,6 @@ /* generic setsockopts reaching us here always apply to the * CLC socket */ - mutex_lock(&smc->clcsock_release_lock); - if (!smc->clcsock) { - mutex_unlock(&smc->clcsock_release_lock); - return -EBADF; - } if (unlikely(!smc->clcsock->ops->setsockopt)) rc = -EOPNOTSUPP; else @@ -2278,7 +2248,6 @@ sk->sk_err = smc->clcsock->sk->sk_err; sk->sk_error_report(sk); } - mutex_unlock(&smc->clcsock_release_lock); if (optlen < sizeof(int)) return -EINVAL; @@ -2295,7 +2264,7 @@ case TCP_FASTOPEN_NO_COOKIE: /* option not supported by SMC */ if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { - rc = smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); + smc_switch_to_fallback(smc, SMC_CLC_DECL_OPTUNSUPP); } else { rc = -EINVAL; } @@ -2338,23 +2307,13 @@ char __user *optval, int __user *optlen) { struct smc_sock *smc; - int rc; smc = smc_sk(sock->sk); - mutex_lock(&smc->clcsock_release_lock); - if (!smc->clcsock) { - mutex_unlock(&smc->clcsock_release_lock); - return -EBADF; - } /* socket options apply to the CLC socket */ - if (unlikely(!smc->clcsock->ops->getsockopt)) { - mutex_unlock(&smc->clcsock_release_lock); + if (unlikely(!smc->clcsock->ops->getsockopt)) return -EOPNOTSUPP; - } - rc = smc->clcsock->ops->getsockopt(smc->clcsock, level, optname, - optval, optlen); - mutex_unlock(&smc->clcsock_release_lock); - return rc; + return smc->clcsock->ops->getsockopt(smc->clcsock, level, optname, + optval, optlen); } static int smc_ioctl(struct socket *sock, unsigned int cmd, diff -u linux-aws-5.13-5.13.0/net/smc/smc_core.c linux-aws-5.13-5.13.0/net/smc/smc_core.c --- linux-aws-5.13-5.13.0/net/smc/smc_core.c +++ linux-aws-5.13-5.13.0/net/smc/smc_core.c @@ -170,10 +170,8 @@ if (!conn->lgr->is_smcd) { rc = smcr_lgr_conn_assign_link(conn, first); - if (rc) { - conn->lgr = NULL; + if (rc) return rc; - } } /* find a new alert_token_local value not yet used by some connection * in this link group @@ -581,13 +579,15 @@ return skb->len; } -void smc_lgr_cleanup_early(struct smc_link_group *lgr) +void smc_lgr_cleanup_early(struct smc_connection *conn) { + struct smc_link_group *lgr = conn->lgr; spinlock_t *lgr_lock; if (!lgr) return; + smc_conn_free(conn); smc_lgr_list_head(lgr, &lgr_lock); spin_lock_bh(lgr_lock); /* do not use this link group for new connections */ @@ -1402,11 +1402,16 @@ /* Called when an SMCR device is removed or the smc module is unloaded. * If smcibdev is given, all SMCR link groups using this device are terminated. * If smcibdev is NULL, all SMCR link groups are terminated. + * + * We must wait here for QPs been destroyed before we destroy the CQs, + * or we won't received any CQEs and cdc_pend_tx_wr cannot reach 0 thus + * smc_sock cannot be released. */ void smc_smcr_terminate_all(struct smc_ib_device *smcibdev) { struct smc_link_group *lgr, *lg; LIST_HEAD(lgr_free_list); + LIST_HEAD(lgr_linkdown_list); int i; spin_lock_bh(&smc_lgr_list.lock); @@ -1418,7 +1423,7 @@ list_for_each_entry_safe(lgr, lg, &smc_lgr_list.list, list) { for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { if (lgr->lnk[i].smcibdev == smcibdev) - smcr_link_down_cond_sched(&lgr->lnk[i]); + list_move_tail(&lgr->list, &lgr_linkdown_list); } } } @@ -1430,6 +1435,16 @@ __smc_lgr_terminate(lgr, false); } + list_for_each_entry_safe(lgr, lg, &lgr_linkdown_list, list) { + for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { + if (lgr->lnk[i].smcibdev == smcibdev) { + mutex_lock(&lgr->llc_conf_mutex); + smcr_link_down_cond(&lgr->lnk[i]); + mutex_unlock(&lgr->llc_conf_mutex); + } + } + } + if (smcibdev) { if (atomic_read(&smcibdev->lnk_cnt)) wait_event(smcibdev->lnks_deleted, @@ -1750,10 +1765,8 @@ write_lock_bh(&lgr->conns_lock); rc = smc_lgr_register_conn(conn, true); write_unlock_bh(&lgr->conns_lock); - if (rc) { - smc_lgr_cleanup_early(lgr); + if (rc) goto out; - } } conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE; conn->local_tx_ctrl.len = SMC_WR_TX_SIZE; diff -u linux-aws-5.13-5.13.0/net/smc/smc_core.h linux-aws-5.13-5.13.0/net/smc/smc_core.h --- linux-aws-5.13-5.13.0/net/smc/smc_core.h +++ linux-aws-5.13-5.13.0/net/smc/smc_core.h @@ -419,7 +419,7 @@ struct smc_sock; struct smc_clc_msg_accept_confirm; -void smc_lgr_cleanup_early(struct smc_link_group *lgr); +void smc_lgr_cleanup_early(struct smc_connection *conn); void smc_lgr_terminate_sched(struct smc_link_group *lgr); void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport); void smcr_port_err(struct smc_ib_device *smcibdev, u8 ibport); reverted: --- linux-aws-5.13-5.13.0/net/sunrpc/rpc_pipe.c +++ linux-aws-5.13-5.13.0.orig/net/sunrpc/rpc_pipe.c @@ -600,9 +600,9 @@ dget(dentry); ret = simple_rmdir(dir, dentry); - d_drop(dentry); if (!ret) fsnotify_rmdir(dir, dentry); + d_delete(dentry); dput(dentry); return ret; } @@ -613,9 +613,9 @@ dget(dentry); ret = simple_unlink(dir, dentry); - d_drop(dentry); if (!ret) fsnotify_unlink(dir, dentry); + d_delete(dentry); dput(dentry); return ret; } reverted: --- linux-aws-5.13-5.13.0/net/unix/garbage.c +++ linux-aws-5.13-5.13.0.orig/net/unix/garbage.c @@ -192,11 +192,8 @@ { /* If number of inflight sockets is insane, * force a garbage collect right now. - * Paired with the WRITE_ONCE() in unix_inflight(), - * unix_notinflight() and gc_in_progress(). */ + if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) - if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && - !READ_ONCE(gc_in_progress)) unix_gc(); wait_event(unix_gc_wait, gc_in_progress == false); } @@ -216,9 +213,7 @@ if (gc_in_progress) goto out; + gc_in_progress = true; - /* Paired with READ_ONCE() in wait_for_unix_gc(). */ - WRITE_ONCE(gc_in_progress, true); - /* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference. @@ -304,10 +299,7 @@ /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); + gc_in_progress = false; - - /* Paired with READ_ONCE() in wait_for_unix_gc(). */ - WRITE_ONCE(gc_in_progress, false); - wake_up(&unix_gc_wait); out: reverted: --- linux-aws-5.13-5.13.0/net/unix/scm.c +++ linux-aws-5.13-5.13.0.orig/net/unix/scm.c @@ -60,8 +60,7 @@ } else { BUG_ON(list_empty(&u->link)); } + unix_tot_inflight++; - /* Paired with READ_ONCE() in wait_for_unix_gc() */ - WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); } user->unix_inflight++; spin_unlock(&unix_gc_lock); @@ -81,8 +80,7 @@ if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); + unix_tot_inflight--; - /* Paired with READ_ONCE() in wait_for_unix_gc() */ - WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); } user->unix_inflight--; spin_unlock(&unix_gc_lock); diff -u linux-aws-5.13-5.13.0/net/xfrm/xfrm_compat.c linux-aws-5.13-5.13.0/net/xfrm/xfrm_compat.c --- linux-aws-5.13-5.13.0/net/xfrm/xfrm_compat.c +++ linux-aws-5.13-5.13.0/net/xfrm/xfrm_compat.c @@ -127,7 +127,6 @@ [XFRMA_SET_MARK] = { .type = NLA_U32 }, [XFRMA_SET_MARK_MASK] = { .type = NLA_U32 }, [XFRMA_IF_ID] = { .type = NLA_U32 }, - [XFRMA_MTIMER_THRESH] = { .type = NLA_U32 }, }; static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb, @@ -275,10 +274,9 @@ case XFRMA_SET_MARK: case XFRMA_SET_MARK_MASK: case XFRMA_IF_ID: - case XFRMA_MTIMER_THRESH: return xfrm_nla_cpy(dst, src, nla_len(src)); default: - BUILD_BUG_ON(XFRMA_MAX != XFRMA_MTIMER_THRESH); + BUILD_BUG_ON(XFRMA_MAX != XFRMA_IF_ID); pr_warn_once("unsupported nla_type %d\n", src->nla_type); return -EOPNOTSUPP; } @@ -433,7 +431,7 @@ int err; if (type > XFRMA_MAX) { - BUILD_BUG_ON(XFRMA_MAX != XFRMA_MTIMER_THRESH); + BUILD_BUG_ON(XFRMA_MAX != XFRMA_IF_ID); NL_SET_ERR_MSG(extack, "Bad attribute"); return -EOPNOTSUPP; } reverted: --- linux-aws-5.13-5.13.0/net/xfrm/xfrm_interface.c +++ linux-aws-5.13-5.13.0.orig/net/xfrm/xfrm_interface.c @@ -636,16 +636,11 @@ struct netlink_ext_ack *extack) { struct net *net = dev_net(dev); + struct xfrm_if_parms p; - struct xfrm_if_parms p = {}; struct xfrm_if *xi; int err; xfrmi_netlink_parms(data, &p); - if (!p.if_id) { - NL_SET_ERR_MSG(extack, "if_id must be non zero"); - return -EINVAL; - } - xi = xfrmi_locate(net, &p); if (xi) return -EEXIST; @@ -670,12 +665,7 @@ { struct xfrm_if *xi = netdev_priv(dev); struct net *net = xi->net; + struct xfrm_if_parms p; - struct xfrm_if_parms p = {}; - - if (!p.if_id) { - NL_SET_ERR_MSG(extack, "if_id must be non zero"); - return -EINVAL; - } xfrmi_netlink_parms(data, &p); xi = xfrmi_locate(net, &p); diff -u linux-aws-5.13-5.13.0/net/xfrm/xfrm_policy.c linux-aws-5.13-5.13.0/net/xfrm/xfrm_policy.c --- linux-aws-5.13-5.13.0/net/xfrm/xfrm_policy.c +++ linux-aws-5.13-5.13.0/net/xfrm/xfrm_policy.c @@ -31,10 +31,8 @@ #include #include #include -#include #include #include -#include #if IS_ENABLED(CONFIG_IPV6_MIP6) #include #endif @@ -3295,7 +3293,7 @@ fl4->flowi4_proto = iph->protocol; fl4->daddr = reverse ? iph->saddr : iph->daddr; fl4->saddr = reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK; + fl4->flowi4_tos = iph->tos; if (!ip_is_fragment(iph)) { switch (iph->protocol) { @@ -3423,26 +3421,6 @@ } fl6->flowi6_proto = nexthdr; return; - case IPPROTO_GRE: - if (!onlyproto && - (nh + offset + 12 < skb->data || - pskb_may_pull(skb, nh + offset + 12 - skb->data))) { - struct gre_base_hdr *gre_hdr; - __be32 *gre_key; - - nh = skb_network_header(skb); - gre_hdr = (struct gre_base_hdr *)(nh + offset); - gre_key = (__be32 *)(gre_hdr + 1); - - if (gre_hdr->flags & GRE_KEY) { - if (gre_hdr->flags & GRE_CSUM) - gre_key++; - fl6->fl6_gre_key = *gre_key; - } - } - fl6->flowi6_proto = nexthdr; - return; - #if IS_ENABLED(CONFIG_IPV6_MIP6) case IPPROTO_MH: offset += ipv6_optlen(exthdr); diff -u linux-aws-5.13-5.13.0/net/xfrm/xfrm_state.c linux-aws-5.13-5.13.0/net/xfrm/xfrm_state.c --- linux-aws-5.13-5.13.0/net/xfrm/xfrm_state.c +++ linux-aws-5.13-5.13.0/net/xfrm/xfrm_state.c @@ -1559,9 +1559,6 @@ x->km.seq = orig->km.seq; x->replay = orig->replay; x->preplay = orig->preplay; - x->mapping_maxage = orig->mapping_maxage; - x->new_mapping = 0; - x->new_mapping_sport = 0; return x; @@ -2213,7 +2210,7 @@ } EXPORT_SYMBOL(km_query); -static int __km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport) +int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport) { int err = -EINVAL; struct xfrm_mgr *km; @@ -2228,24 +2225,6 @@ rcu_read_unlock(); return err; } - -int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport) -{ - int ret = 0; - - if (x->mapping_maxage) { - if ((jiffies / HZ - x->new_mapping) > x->mapping_maxage || - x->new_mapping_sport != sport) { - x->new_mapping_sport = sport; - x->new_mapping = jiffies / HZ; - ret = __km_new_mapping(x, ipaddr, sport); - } - } else { - ret = __km_new_mapping(x, ipaddr, sport); - } - - return ret; -} EXPORT_SYMBOL(km_new_mapping); void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid) diff -u linux-aws-5.13-5.13.0/net/xfrm/xfrm_user.c linux-aws-5.13-5.13.0/net/xfrm/xfrm_user.c --- linux-aws-5.13-5.13.0/net/xfrm/xfrm_user.c +++ linux-aws-5.13-5.13.0/net/xfrm/xfrm_user.c @@ -282,10 +282,6 @@ err = 0; - if (attrs[XFRMA_MTIMER_THRESH]) - if (!attrs[XFRMA_ENCAP]) - err = -EINVAL; - out: return err; } @@ -525,7 +521,6 @@ struct nlattr *lt = attrs[XFRMA_LTIME_VAL]; struct nlattr *et = attrs[XFRMA_ETIMER_THRESH]; struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH]; - struct nlattr *mt = attrs[XFRMA_MTIMER_THRESH]; if (re) { struct xfrm_replay_state_esn *replay_esn; @@ -557,9 +552,6 @@ if (rt) x->replay_maxdiff = nla_get_u32(rt); - - if (mt) - x->mapping_maxage = nla_get_u32(mt); } static void xfrm_smark_init(struct nlattr **attrs, struct xfrm_mark *m) @@ -629,13 +621,8 @@ xfrm_smark_init(attrs, &x->props.smark); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!x->if_id) { - err = -EINVAL; - goto error; - } - } err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]); if (err) @@ -1037,13 +1024,8 @@ if (ret) goto out; } - if (x->security) { + if (x->security) ret = copy_sec_ctx(x->security, skb); - if (ret) - goto out; - } - if (x->mapping_maxage) - ret = nla_put_u32(skb, XFRMA_MTIMER_THRESH, x->mapping_maxage); out: return ret; } @@ -1431,13 +1413,8 @@ mark = xfrm_mark_get(attrs, &m); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!if_id) { - err = -EINVAL; - goto out_noput; - } - } if (p->info.seq) { x = xfrm_find_acq_byseq(net, mark, p->info.seq); @@ -1750,13 +1727,8 @@ xfrm_mark_get(attrs, &xp->mark); - if (attrs[XFRMA_IF_ID]) { + if (attrs[XFRMA_IF_ID]) xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]); - if (!xp->if_id) { - err = -EINVAL; - goto error; - } - } return xp; error: @@ -2986,7 +2958,7 @@ if (x->props.extra_flags) l += nla_total_size(sizeof(x->props.extra_flags)); if (x->xso.dev) - l += nla_total_size(sizeof(struct xfrm_user_offload)); + l += nla_total_size(sizeof(x->xso)); if (x->props.smark.v | x->props.smark.m) { l += nla_total_size(sizeof(x->props.smark.v)); l += nla_total_size(sizeof(x->props.smark.m)); @@ -2997,9 +2969,6 @@ /* Must count x->lastused as it may become non-zero behind our back. */ l += nla_total_size_64bit(sizeof(u64)); - if (x->mapping_maxage) - l += nla_total_size(sizeof(x->mapping_maxage)); - return l; } reverted: --- linux-aws-5.13-5.13.0/scripts/dtc/dtx_diff +++ linux-aws-5.13-5.13.0.orig/scripts/dtc/dtx_diff @@ -59,8 +59,12 @@ or '/include/' to be processed. If DTx_1 and DTx_2 are in different architectures, then this script + may not work since \${ARCH} is part of the include path. Two possible + workarounds: + + `basename $0` \\ + <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ + <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) - may not work since \${ARCH} is part of the include path. The following - workaround can be used: `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts reverted: --- linux-aws-5.13-5.13.0/scripts/sphinx-pre-install +++ linux-aws-5.13-5.13.0.orig/scripts/sphinx-pre-install @@ -76,7 +76,6 @@ 'ucs.sty' => 'texlive-ucs', 'upquote.sty' => 'texlive-upquote', 'wrapfig.sty' => 'texlive-wrapfig', - 'ctexhook.sty' => 'texlive-ctex', ); # @@ -371,9 +370,6 @@ ); if ($pdf) { - check_missing_file(["/usr/share/texlive/texmf-dist/tex/latex/ctex/ctexhook.sty"], - "texlive-lang-chinese", 2); - check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"], "fonts-dejavu", 2); diff -u linux-aws-5.13-5.13.0/security/selinux/hooks.c linux-aws-5.13-5.13.0/security/selinux/hooks.c --- linux-aws-5.13-5.13.0/security/selinux/hooks.c +++ linux-aws-5.13-5.13.0/security/selinux/hooks.c @@ -1010,22 +1010,18 @@ static int selinux_add_opt(int token, const char *s, void **mnt_opts) { struct selinux_mnt_opts *opts = *mnt_opts; - bool is_alloc_opts = false; if (token == Opt_seclabel) /* eaten and completely ignored */ return 0; - if (!s) - return -ENOMEM; - if (!opts) { opts = kzalloc(sizeof(struct selinux_mnt_opts), GFP_KERNEL); if (!opts) return -ENOMEM; *mnt_opts = opts; - is_alloc_opts = true; } - + if (!s) + return -ENOMEM; switch (token) { case Opt_context: if (opts->context || opts->defcontext) @@ -1050,10 +1046,6 @@ } return 0; Einval: - if (is_alloc_opts) { - kfree(opts); - *mnt_opts = NULL; - } pr_warn(SEL_MOUNT_FAIL_MSG); return -EINVAL; } diff -u linux-aws-5.13-5.13.0/sound/core/jack.c linux-aws-5.13-5.13.0/sound/core/jack.c --- linux-aws-5.13-5.13.0/sound/core/jack.c +++ linux-aws-5.13-5.13.0/sound/core/jack.c @@ -62,13 +62,10 @@ struct snd_card *card = device->card; struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; - down_write(&card->controls_rwsem); list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { list_del_init(&jack_kctl->list); snd_ctl_remove(card, jack_kctl->kctl); } - up_write(&card->controls_rwsem); - if (jack->private_free) jack->private_free(jack); diff -u linux-aws-5.13-5.13.0/sound/core/oss/pcm_oss.c linux-aws-5.13-5.13.0/sound/core/oss/pcm_oss.c --- linux-aws-5.13-5.13.0/sound/core/oss/pcm_oss.c +++ linux-aws-5.13-5.13.0/sound/core/oss/pcm_oss.c @@ -2056,7 +2056,7 @@ int err, cmd; #ifdef OSS_DEBUG - pr_debug("pcm_oss: trigger = 0x%x\n", trigger); + pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); #endif psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; reverted: --- linux-aws-5.13-5.13.0/sound/core/pcm.c +++ linux-aws-5.13-5.13.0.orig/sound/core/pcm.c @@ -810,11 +810,7 @@ static void free_chmap(struct snd_pcm_str *pstr) { if (pstr->chmap_kctl) { + snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); - struct snd_card *card = pstr->pcm->card; - - down_write(&card->controls_rwsem); - snd_ctl_remove(card, pstr->chmap_kctl); - up_write(&card->controls_rwsem); pstr->chmap_kctl = NULL; } } reverted: --- linux-aws-5.13-5.13.0/sound/core/seq/seq_queue.c +++ linux-aws-5.13-5.13.0.orig/sound/core/seq/seq_queue.c @@ -234,15 +234,12 @@ /* -------------------------------------------------------- */ -#define MAX_CELL_PROCESSES_IN_QUEUE 1000 - void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) { unsigned long flags; struct snd_seq_event_cell *cell; snd_seq_tick_time_t cur_tick; snd_seq_real_time_t cur_time; - int processed = 0; if (q == NULL) return; @@ -265,8 +262,6 @@ if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); - if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) - goto out; /* the rest processed at the next batch */ } /* Process time queue... */ @@ -276,19 +271,14 @@ if (!cell) break; snd_seq_dispatch_event(cell, atomic, hop); - if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) - goto out; /* the rest processed at the next batch */ } - out: /* free lock */ spin_lock_irqsave(&q->check_lock, flags); if (q->check_again) { q->check_again = 0; + spin_unlock_irqrestore(&q->check_lock, flags); + goto __again; - if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { - spin_unlock_irqrestore(&q->check_lock, flags); - goto __again; - } } q->check_blocked = 0; spin_unlock_irqrestore(&q->check_lock, flags); diff -u linux-aws-5.13-5.13.0/sound/hda/hdac_stream.c linux-aws-5.13-5.13.0/sound/hda/hdac_stream.c --- linux-aws-5.13-5.13.0/sound/hda/hdac_stream.c +++ linux-aws-5.13-5.13.0/sound/hda/hdac_stream.c @@ -534,11 +534,17 @@ cc->mask = CLOCKSOURCE_MASK(32); /* - * Calculate the optimal mult/shift values. The counter wraps - * around after ~178.9 seconds. + * Converting from 24 MHz to ns means applying a 125/3 factor. + * To avoid any saturation issues in intermediate operations, + * the 125 factor is applied first. The division is applied + * last after reading the timecounter value. + * Applying the 1/3 factor as part of the multiplication + * requires at least 20 bits for a decent precision, however + * overflows occur after about 4 hours or less, not a option. */ - clocks_calc_mult_shift(&cc->mult, &cc->shift, 24000000, - NSEC_PER_SEC, 178); + + cc->mult = 125; /* saturation after 195 years */ + cc->shift = 0; nsec = 0; /* audio time is elapsed time since trigger */ timecounter_init(tc, cc, nsec); diff -u linux-aws-5.13-5.13.0/sound/pci/hda/hda_codec.c linux-aws-5.13-5.13.0/sound/pci/hda/hda_codec.c --- linux-aws-5.13-5.13.0/sound/pci/hda/hda_codec.c +++ linux-aws-5.13-5.13.0/sound/pci/hda/hda_codec.c @@ -1727,11 +1727,8 @@ { int i; struct hda_nid_item *items = codec->mixers.list; - - down_write(&codec->card->controls_rwsem); for (i = 0; i < codec->mixers.used; i++) snd_ctl_remove(codec->card, items[i].kctl); - up_write(&codec->card->controls_rwsem); snd_array_free(&codec->mixers); snd_array_free(&codec->nids); } diff -u linux-aws-5.13-5.13.0/sound/pci/hda/hda_controller.c linux-aws-5.13-5.13.0/sound/pci/hda/hda_controller.c --- linux-aws-5.13-5.13.0/sound/pci/hda/hda_controller.c +++ linux-aws-5.13-5.13.0/sound/pci/hda/hda_controller.c @@ -504,6 +504,7 @@ snd_pcm_gettime(substream->runtime, system_ts); nsec = timecounter_read(&azx_dev->core.tc); + nsec = div_u64(nsec, 3); /* can be optimized */ if (audio_tstamp_config->report_delay) nsec = azx_adjust_codec_delay(substream, nsec); diff -u linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409-tables.c linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409-tables.c --- linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409-tables.c +++ linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409-tables.c @@ -252,7 +252,6 @@ .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, - .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -444,7 +443,6 @@ .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, - .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -458,7 +456,6 @@ .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, - .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 1, diff -u linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.c linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.c --- linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.c +++ linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.c @@ -628,17 +628,15 @@ cs8409_i2c_write(cs42l42, 0x1b74, 0x07); cs8409_i2c_write(cs42l42, 0x131b, 0xFD); cs8409_i2c_write(cs42l42, 0x1120, 0x80); - /* Wait ~20ms*/ - usleep_range(20000, 25000); + /* Wait ~100us*/ + usleep_range(100, 200); cs8409_i2c_write(cs42l42, 0x111f, 0x77); cs8409_i2c_write(cs42l42, 0x1120, 0xc0); } static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) { - int status_changed = cs42l42->force_status_change; - - cs42l42->force_status_change = 0; + int status_changed = 0; /* TIP_SENSE INSERT/REMOVE */ switch (reg_ts_status) { @@ -793,7 +791,6 @@ cs42l42->last_page = 0; cs42l42->hp_jack_in = 0; cs42l42->mic_jack_in = 0; - cs42l42->force_status_change = 1; /* Put CS42L42 into Reset */ gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); diff -u linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.h linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.h --- linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.h +++ linux-aws-5.13-5.13.0/sound/pci/hda/patch_cs8409.h @@ -305,7 +305,6 @@ unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; - unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1; unsigned int last_page; reverted: --- linux-aws-5.13-5.13.0/sound/soc/codecs/rt5663.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/codecs/rt5663.c @@ -3461,7 +3461,6 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) { int table_size; - int ret; device_property_read_u32(dev, "realtek,dc_offset_l_manual", &rt5663->pdata.dc_offset_l_manual); @@ -3478,11 +3477,9 @@ table_size = sizeof(struct impedance_mapping_table) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); + device_property_read_u32_array(dev, - ret = device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); - if (ret) - return ret; } return 0; @@ -3507,11 +3504,8 @@ if (pdata) rt5663->pdata = *pdata; + else + rt5663_parse_dp(rt5663, &i2c->dev); - else { - ret = rt5663_parse_dp(rt5663, &i2c->dev); - if (ret) - return ret; - } for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++) rt5663->supplies[i].supply = rt5663_supply_names[i]; reverted: --- linux-aws-5.13-5.13.0/sound/soc/fsl/fsl_asrc.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/fsl/fsl_asrc.c @@ -19,7 +19,6 @@ #include "fsl_asrc.h" #define IDEAL_RATIO_DECIMAL_DEPTH 26 -#define DIVIDER_NUM 64 #define pair_err(fmt, ...) \ dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__) @@ -102,55 +101,6 @@ }, }; -/* - * According to RM, the divider range is 1 ~ 8, - * prescaler is power of 2 from 1 ~ 128. - */ -static int asrc_clk_divider[DIVIDER_NUM] = { - 1, 2, 4, 8, 16, 32, 64, 128, /* divider = 1 */ - 2, 4, 8, 16, 32, 64, 128, 256, /* divider = 2 */ - 3, 6, 12, 24, 48, 96, 192, 384, /* divider = 3 */ - 4, 8, 16, 32, 64, 128, 256, 512, /* divider = 4 */ - 5, 10, 20, 40, 80, 160, 320, 640, /* divider = 5 */ - 6, 12, 24, 48, 96, 192, 384, 768, /* divider = 6 */ - 7, 14, 28, 56, 112, 224, 448, 896, /* divider = 7 */ - 8, 16, 32, 64, 128, 256, 512, 1024, /* divider = 8 */ -}; - -/* - * Check if the divider is available for internal ratio mode - */ -static bool fsl_asrc_divider_avail(int clk_rate, int rate, int *div) -{ - u32 rem, i; - u64 n; - - if (div) - *div = 0; - - if (clk_rate == 0 || rate == 0) - return false; - - n = clk_rate; - rem = do_div(n, rate); - - if (div) - *div = n; - - if (rem != 0) - return false; - - for (i = 0; i < DIVIDER_NUM; i++) { - if (n == asrc_clk_divider[i]) - break; - } - - if (i == DIVIDER_NUM) - return false; - - return true; -} - /** * fsl_asrc_sel_proc - Select the pre-processing and post-processing options * @inrate: input sample rate @@ -380,12 +330,12 @@ enum asrc_word_width input_word_width; enum asrc_word_width output_word_width; u32 inrate, outrate, indiv, outdiv; + u32 clk_index[2], div[2], rem[2]; - u32 clk_index[2], div[2]; u64 clk_rate; int in, out, channels; int pre_proc, post_proc; struct clk *clk; + bool ideal; - bool ideal, div_avail; if (!config) { pair_err("invalid pair config\n"); @@ -465,7 +415,8 @@ clk = asrc_priv->asrck_clk[clk_index[ideal ? OUT : IN]]; clk_rate = clk_get_rate(clk); + rem[IN] = do_div(clk_rate, inrate); + div[IN] = (u32)clk_rate; - div_avail = fsl_asrc_divider_avail(clk_rate, inrate, &div[IN]); /* * The divider range is [1, 1024], defined by the hardware. For non- @@ -474,7 +425,7 @@ * only result in different converting speeds. So remainder does not * matter, as long as we keep the divider within its valid range. */ + if (div[IN] == 0 || (!ideal && (div[IN] > 1024 || rem[IN] != 0))) { - if (div[IN] == 0 || (!ideal && !div_avail)) { pair_err("failed to support input sample rate %dHz by asrck_%x\n", inrate, clk_index[ideal ? OUT : IN]); return -EINVAL; @@ -485,12 +436,13 @@ clk = asrc_priv->asrck_clk[clk_index[OUT]]; clk_rate = clk_get_rate(clk); if (ideal && use_ideal_rate) + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE); - div_avail = fsl_asrc_divider_avail(clk_rate, IDEAL_RATIO_RATE, &div[OUT]); else + rem[OUT] = do_div(clk_rate, outrate); + div[OUT] = clk_rate; - div_avail = fsl_asrc_divider_avail(clk_rate, outrate, &div[OUT]); /* Output divider has the same limitation as the input one */ + if (div[OUT] == 0 || (!ideal && (div[OUT] > 1024 || rem[OUT] != 0))) { - if (div[OUT] == 0 || (!ideal && !div_avail)) { pair_err("failed to support output sample rate %dHz by asrck_%x\n", outrate, clk_index[OUT]); return -EINVAL; @@ -669,7 +621,8 @@ clk_index = asrc_priv->clk_map[j][i]; clk_rate = clk_get_rate(asrc_priv->asrck_clk[clk_index]); /* Only match a perfect clock source with no remainder */ + if (clk_rate != 0 && (clk_rate / rate[j]) <= 1024 && + (clk_rate % rate[j]) == 0) - if (fsl_asrc_divider_avail(clk_rate, rate[j], NULL)) break; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/fsl/fsl_mqs.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/fsl/fsl_mqs.c @@ -337,4 +337,4 @@ MODULE_AUTHOR("Shengjiu Wang "); MODULE_DESCRIPTION("MQS codec driver"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform: fsl-mqs"); -MODULE_ALIAS("platform:fsl-mqs"); reverted: --- linux-aws-5.13-5.13.0/sound/soc/fsl/imx-hdmi.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/fsl/imx-hdmi.c @@ -145,8 +145,6 @@ data->dai.capture_only = false; data->dai.init = imx_hdmi_init; - put_device(&cpu_pdev->dev); - if (of_node_name_eq(cpu_np, "sai")) { data->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1; data->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1; reverted: --- linux-aws-5.13-5.13.0/sound/soc/intel/catpt/dsp.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/intel/catpt/dsp.c @@ -65,7 +65,6 @@ { struct dma_async_tx_descriptor *desc; enum dma_status status; - int ret; desc = dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size, DMA_CTRL_ACK); @@ -78,22 +77,13 @@ catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id)); + dmaengine_submit(desc); - - ret = dma_submit_error(dmaengine_submit(desc)); - if (ret) { - dev_err(cdev->dev, "submit tx failed: %d\n", ret); - goto clear_hdda; - } - status = dma_wait_for_async_tx(desc); - ret = (status == DMA_COMPLETE) ? 0 : -EPROTO; - -clear_hdda: /* regardless of status, disable access to HOST memory in demand mode */ catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0); + return (status == DMA_COMPLETE) ? 0 : -EPROTO; - return ret; } int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan, diff -u linux-aws-5.13-5.13.0/sound/soc/intel/skylake/skl-pcm.c linux-aws-5.13-5.13.0/sound/soc/intel/skylake/skl-pcm.c --- linux-aws-5.13-5.13.0/sound/soc/intel/skylake/skl-pcm.c +++ linux-aws-5.13-5.13.0/sound/soc/intel/skylake/skl-pcm.c @@ -1258,6 +1258,7 @@ snd_pcm_gettime(substream->runtime, system_ts); nsec = timecounter_read(&hstr->tc); + nsec = div_u64(nsec, 3); /* can be optimized */ if (audio_tstamp_config->report_delay) nsec = skl_adjust_codec_delay(substream, nsec); reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8173/mt8173-max98090.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8173/mt8173-max98090.c @@ -180,9 +180,6 @@ if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); - - of_node_put(codec_node); - of_node_put(platform_node); return ret; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -218,8 +218,6 @@ if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); - - of_node_put(platform_node); return ret; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -285,8 +285,6 @@ if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); - - of_node_put(platform_node); return ret; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -323,8 +323,6 @@ if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); - - of_node_put(platform_node); return ret; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -781,11 +781,7 @@ return ret; } + return devm_snd_soc_register_card(&pdev->dev, card); - ret = devm_snd_soc_register_card(&pdev->dev, card); - - of_node_put(platform_node); - of_node_put(hdmi_codec); - return ret; } #ifdef CONFIG_OF reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -780,12 +780,7 @@ __func__, ret); } + return devm_snd_soc_register_card(&pdev->dev, card); - ret = devm_snd_soc_register_card(&pdev->dev, card); - - of_node_put(platform_node); - of_node_put(ec_codec); - of_node_put(hdmi_codec); - return ret; } #ifdef CONFIG_OF reverted: --- linux-aws-5.13-5.13.0/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -1172,11 +1172,7 @@ return ret; } + return devm_snd_soc_register_card(&pdev->dev, card); - ret = devm_snd_soc_register_card(&pdev->dev, card); - - of_node_put(platform_node); - of_node_put(hdmi_codec); - return ret; } #ifdef CONFIG_OF reverted: --- linux-aws-5.13-5.13.0/sound/soc/samsung/idma.c +++ linux-aws-5.13-5.13.0.orig/sound/soc/samsung/idma.c @@ -360,8 +360,6 @@ buf->addr = idma.lp_tx_addr; buf->bytes = idma_hardware.buffer_bytes_max; buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); - if (!buf->area) - return -ENOMEM; return 0; } reverted: --- linux-aws-5.13-5.13.0/sound/soc/uniphier/Kconfig +++ linux-aws-5.13-5.13.0.orig/sound/soc/uniphier/Kconfig @@ -23,6 +23,7 @@ tristate "UniPhier LD11/LD20 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO + select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier LD11/LD20 input and output that can be used with other codecs. @@ -33,6 +34,7 @@ tristate "UniPhier PXs2 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO + select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier PXs2 input and output that can be used with other codecs. diff -u linux-aws-5.13-5.13.0/sound/usb/format.c linux-aws-5.13-5.13.0/sound/usb/format.c --- linux-aws-5.13-5.13.0/sound/usb/format.c +++ linux-aws-5.13-5.13.0/sound/usb/format.c @@ -375,7 +375,7 @@ for (rate = min; rate <= max; rate += res) { /* Filter out invalid rates on Presonus Studio 1810c */ - if (chip->usb_id == USB_ID(0x194f, 0x010c) && + if (chip->usb_id == USB_ID(0x0194f, 0x010c) && !s1810c_valid_sample_rate(fp, rate)) goto skip_rate; diff -u linux-aws-5.13-5.13.0/sound/usb/mixer_quirks.c linux-aws-5.13-5.13.0/sound/usb/mixer_quirks.c --- linux-aws-5.13-5.13.0/sound/usb/mixer_quirks.c +++ linux-aws-5.13-5.13.0/sound/usb/mixer_quirks.c @@ -3107,7 +3107,7 @@ err = snd_rme_controls_create(mixer); break; - case USB_ID(0x194f, 0x010c): /* Presonus Studio 1810c */ + case USB_ID(0x0194f, 0x010c): /* Presonus Studio 1810c */ err = snd_sc1810_init_mixer(mixer); break; case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */ diff -u linux-aws-5.13-5.13.0/sound/usb/quirks.c linux-aws-5.13-5.13.0/sound/usb/quirks.c --- linux-aws-5.13-5.13.0/sound/usb/quirks.c +++ linux-aws-5.13-5.13.0/sound/usb/quirks.c @@ -1317,7 +1317,7 @@ if (chip->usb_id == USB_ID(0x0763, 0x2012)) return fasttrackpro_skip_setting_quirk(chip, iface, altno); /* presonus studio 1810c: skip altsets incompatible with device_setup */ - if (chip->usb_id == USB_ID(0x194f, 0x010c)) + if (chip->usb_id == USB_ID(0x0194f, 0x010c)) return s1810c_skip_setting_quirk(chip, iface, altno); reverted: --- linux-aws-5.13-5.13.0/tools/bpf/bpftool/Documentation/Makefile +++ linux-aws-5.13-5.13.0.orig/tools/bpf/bpftool/Documentation/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak INSTALL ?= install RM ?= rm -f reverted: --- linux-aws-5.13-5.13.0/tools/bpf/bpftool/Makefile +++ linux-aws-5.13-5.13.0.orig/tools/bpf/bpftool/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../scripts/Makefile.include +include ../../scripts/utilities.mak ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR))) diff -u linux-aws-5.13-5.13.0/tools/bpf/bpftool/main.c linux-aws-5.13-5.13.0/tools/bpf/bpftool/main.c --- linux-aws-5.13-5.13.0/tools/bpf/bpftool/main.c +++ linux-aws-5.13-5.13.0/tools/bpf/bpftool/main.c @@ -399,8 +399,6 @@ }; int opt, ret; - setlinebuf(stdout); - last_do_help = do_help; pretty_output = false; json_output = false; diff -u linux-aws-5.13-5.13.0/tools/bpf/bpftool/prog.c linux-aws-5.13-5.13.0/tools/bpf/bpftool/prog.c --- linux-aws-5.13-5.13.0/tools/bpf/bpftool/prog.c +++ linux-aws-5.13-5.13.0/tools/bpf/bpftool/prog.c @@ -626,8 +626,8 @@ char func_sig[1024]; unsigned char *buf; __u32 member_len; - int fd, err = -1; ssize_t n; + int fd; if (mode == DUMP_JITED) { if (info->jited_prog_len == 0 || !info->jited_prog_insns) { @@ -663,7 +663,7 @@ if (fd < 0) { p_err("can't open file %s: %s", filepath, strerror(errno)); - goto exit_free; + return -1; } n = write(fd, buf, member_len); @@ -671,7 +671,7 @@ if (n != (ssize_t)member_len) { p_err("error writing output file: %s", n < 0 ? strerror(errno) : "short write"); - goto exit_free; + return -1; } if (json_output) @@ -685,7 +685,7 @@ info->netns_ino, &disasm_opt); if (!name) - goto exit_free; + return -1; } if (info->nr_jited_func_lens && info->jited_func_lens) { @@ -780,12 +780,9 @@ kernel_syms_destroy(&dd); } - err = 0; - -exit_free: btf__free(btf); - bpf_prog_linfo__free(prog_linfo); - return err; + + return 0; } static int do_dump(int argc, char **argv) reverted: --- linux-aws-5.13-5.13.0/tools/include/nolibc/nolibc.h +++ linux-aws-5.13-5.13.0.orig/tools/include/nolibc/nolibc.h @@ -399,22 +399,16 @@ }) /* startup code */ -/* - * x86-64 System V ABI mandates: - * 1) %rsp must be 16-byte aligned right before the function call. - * 2) The deepest stack frame should be zero (the %rbp). - * - */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %rdi\n" // argc (first arg, %rdi) "mov %rsp, %rsi\n" // argv[] (second arg, %rsi) "lea 8(%rsi,%rdi,8),%rdx\n" // then a NULL then envp (third arg, %rdx) + "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned when + "sub $8, %rsp\n" // entering the callee - "xor %ebp, %ebp\n" // zero the stack frame - "and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned before call "call main\n" // main() returns the status code, we'll exit with it. + "movzb %al, %rdi\n" // retrieve exit code from 8 lower bits - "mov %eax, %edi\n" // retrieve exit code (32 bit) "mov $60, %rax\n" // NR_exit == 60 "syscall\n" // really exit "hlt\n" // ensure it does not return @@ -583,28 +577,20 @@ }) /* startup code */ -/* - * i386 System V ABI mandates: - * 1) last pushed argument must be 16-byte aligned. - * 2) The deepest stack frame should be set to zero - * - */ asm(".section .text\n" ".global _start\n" "_start:\n" "pop %eax\n" // argc (first arg, %eax) "mov %esp, %ebx\n" // argv[] (second arg, %ebx) "lea 4(%ebx,%eax,4),%ecx\n" // then a NULL then envp (third arg, %ecx) + "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned when - "xor %ebp, %ebp\n" // zero the stack frame - "and $-16, %esp\n" // x86 ABI : esp must be 16-byte aligned before - "sub $4, %esp\n" // the call instruction (args are aligned) "push %ecx\n" // push all registers on the stack so that we "push %ebx\n" // support both regparm and plain stack modes "push %eax\n" "call main\n" // main() returns the status code in %eax + "movzbl %al, %ebx\n" // retrieve exit code from lower 8 bits + "movl $1, %eax\n" // NR_exit == 1 + "int $0x80\n" // exit now - "mov %eax, %ebx\n" // retrieve exit code (32-bit int) - "movl $1, %eax\n" // NR_exit == 1 - "int $0x80\n" // exit now "hlt\n" // ensure it does not ""); @@ -788,6 +774,7 @@ "and %r3, %r1, $-8\n" // AAPCS : sp must be 8-byte aligned in the "mov %sp, %r3\n" // callee, an bl doesn't push (lr=pc) "bl main\n" // main() returns the status code, we'll exit with it. + "and %r0, %r0, $0xff\n" // limit exit code to 8 bits "movs r7, $1\n" // NR_exit == 1 "svc $0x00\n" ""); @@ -984,6 +971,7 @@ "add x2, x2, x1\n" // + argv "and sp, x1, -16\n" // sp must be 16-byte aligned in the callee "bl main\n" // main() returns the status code, we'll exit with it. + "and x0, x0, 0xff\n" // limit exit code to 8 bits "mov x8, 93\n" // NR_exit == 93 "svc #0\n" ""); @@ -1188,7 +1176,7 @@ "addiu $sp,$sp,-16\n" // the callee expects to save a0..a3 there! "jal main\n" // main() returns the status code, we'll exit with it. "nop\n" // delayed slot + "and $a0, $v0, 0xff\n" // limit exit code to 8 bits - "move $a0, $v0\n" // retrieve 32-bit exit code from v0 "li $v0, 4001\n" // NR_exit == 4001 "syscall\n" ".end __start\n" @@ -1386,6 +1374,7 @@ "add a2,a2,a1\n" // + argv "andi sp,a1,-16\n" // sp must be 16-byte aligned "call main\n" // main() returns the status code, we'll exit with it. + "andi a0, a0, 0xff\n" // limit exit code to 8 bits "li a7, 93\n" // NR_exit == 93 "ecall\n" ""); diff -u linux-aws-5.13-5.13.0/tools/lib/bpf/btf.c linux-aws-5.13-5.13.0/tools/lib/bpf/btf.c --- linux-aws-5.13-5.13.0/tools/lib/bpf/btf.c +++ linux-aws-5.13-5.13.0/tools/lib/bpf/btf.c @@ -3340,8 +3340,8 @@ } /* - * Check structural compatibility of two STRUCTs/UNIONs, ignoring referenced - * type IDs. This check is performed during type graph equivalence check and + * Check structural compatibility of two FUNC_PROTOs, ignoring referenced type + * IDs. This check is performed during type graph equivalence check and * referenced types equivalence is checked separately. */ static bool btf_shallow_equal_struct(struct btf_type *t1, struct btf_type *t2) @@ -3712,31 +3712,6 @@ return btf_equal_array(t1, t2); } -/* Check if given two types are identical STRUCT/UNION definitions */ -static bool btf_dedup_identical_structs(struct btf_dedup *d, __u32 id1, __u32 id2) -{ - const struct btf_member *m1, *m2; - struct btf_type *t1, *t2; - int n, i; - - t1 = btf_type_by_id(d->btf, id1); - t2 = btf_type_by_id(d->btf, id2); - - if (!btf_is_composite(t1) || btf_kind(t1) != btf_kind(t2)) - return false; - - if (!btf_shallow_equal_struct(t1, t2)) - return false; - - m1 = btf_members(t1); - m2 = btf_members(t2); - for (i = 0, n = btf_vlen(t1); i < n; i++, m1++, m2++) { - if (m1->type != m2->type) - return false; - } - return true; -} - /* * Check equivalence of BTF type graph formed by candidate struct/union (we'll * call it "candidate graph" in this description for brevity) to a type graph @@ -3848,8 +3823,6 @@ hypot_type_id = d->hypot_map[canon_id]; if (hypot_type_id <= BTF_MAX_NR_TYPES) { - if (hypot_type_id == cand_id) - return 1; /* In some cases compiler will generate different DWARF types * for *identical* array type definitions and use them for * different fields within the *same* struct. This breaks type @@ -3858,18 +3831,8 @@ * types within a single CU. So work around that by explicitly * allowing identical array types here. */ - if (btf_dedup_identical_arrays(d, hypot_type_id, cand_id)) - return 1; - /* It turns out that similar situation can happen with - * struct/union sometimes, sigh... Handle the case where - * structs/unions are exactly the same, down to the referenced - * type IDs. Anything more complicated (e.g., if referenced - * types are different, but equivalent) is *way more* - * complicated and requires a many-to-many equivalence mapping. - */ - if (btf_dedup_identical_structs(d, hypot_type_id, cand_id)) - return 1; - return 0; + return hypot_type_id == cand_id || + btf_dedup_identical_arrays(d, hypot_type_id, cand_id); } if (btf_dedup_hypot_map_add(d, canon_id, cand_id)) diff -u linux-aws-5.13-5.13.0/tools/lib/bpf/libbpf.c linux-aws-5.13-5.13.0/tools/lib/bpf/libbpf.c --- linux-aws-5.13-5.13.0/tools/lib/bpf/libbpf.c +++ linux-aws-5.13-5.13.0/tools/lib/bpf/libbpf.c @@ -9595,10 +9595,7 @@ pr_warn("error: inner_map_fd already specified\n"); return -EINVAL; } - if (map->inner_map) { - bpf_map__destroy(map->inner_map); - zfree(&map->inner_map); - } + zfree(&map->inner_map); map->inner_map_fd = fd; return 0; } diff -u linux-aws-5.13-5.13.0/tools/lib/bpf/linker.c linux-aws-5.13-5.13.0/tools/lib/bpf/linker.c --- linux-aws-5.13-5.13.0/tools/lib/bpf/linker.c +++ linux-aws-5.13-5.13.0/tools/lib/bpf/linker.c @@ -209,7 +209,6 @@ } free(linker->secs); - free(linker->glob_syms); free(linker); } @@ -1992,7 +1991,7 @@ static int linker_append_elf_relos(struct bpf_linker *linker, struct src_obj *obj) { struct src_sec *src_symtab = &obj->secs[obj->symtab_sec_idx]; - struct dst_sec *dst_symtab; + struct dst_sec *dst_symtab = &linker->secs[linker->symtab_sec_idx]; int i, err; for (i = 1; i < obj->sec_cnt; i++) { @@ -2025,9 +2024,6 @@ return -1; } - /* add_dst_sec() above could have invalidated linker->secs */ - dst_symtab = &linker->secs[linker->symtab_sec_idx]; - /* shdr->sh_link points to SYMTAB */ dst_sec->shdr->sh_link = linker->symtab_sec_idx; reverted: --- linux-aws-5.13-5.13.0/tools/perf/util/debug.c +++ linux-aws-5.13-5.13.0.orig/tools/perf/util/debug.c @@ -179,7 +179,7 @@ break; case BINARY_PRINT_CHAR_DATA: printed += color_fprintf(fp, color, "%c", + isprint(ch) ? ch : '.'); - isprint(ch) && isascii(ch) ? ch : '.'); break; case BINARY_PRINT_CHAR_PAD: printed += color_fprintf(fp, color, " "); reverted: --- linux-aws-5.13-5.13.0/tools/perf/util/evsel.c +++ linux-aws-5.13-5.13.0.orig/tools/perf/util/evsel.c @@ -1044,17 +1044,6 @@ evsel__set_sample_bit(evsel, WEIGHT); } -static void evsel__set_default_freq_period(struct record_opts *opts, - struct perf_event_attr *attr) -{ - if (opts->freq) { - attr->freq = 1; - attr->sample_freq = opts->freq; - } else { - attr->sample_period = opts->default_interval; - } -} - /* * The enable_on_exec/disabled value strategy: * @@ -1121,12 +1110,14 @@ * We default some events to have a default interval. But keep * it a weak assumption overridable by the user. */ + if (!attr->sample_period) { + if (opts->freq) { + attr->freq = 1; + attr->sample_freq = opts->freq; + } else { + attr->sample_period = opts->default_interval; + } + } - if ((evsel->is_libpfm_event && !attr->sample_period) || - (!evsel->is_libpfm_event && (!attr->sample_period || - opts->user_freq != UINT_MAX || - opts->user_interval != ULLONG_MAX))) - evsel__set_default_freq_period(opts, attr); - /* * If attr->freq was set (here or earlier), ask for period * to be sampled. diff -u linux-aws-5.13-5.13.0/tools/perf/util/probe-event.c linux-aws-5.13-5.13.0/tools/perf/util/probe-event.c --- linux-aws-5.13-5.13.0/tools/perf/util/probe-event.c +++ linux-aws-5.13-5.13.0/tools/perf/util/probe-event.c @@ -3045,9 +3045,6 @@ for (j = 0; j < num_matched_functions; j++) { sym = syms[j]; - if (sym->type != STT_FUNC) - continue; - /* There can be duplicated symbols in the map */ for (i = 0; i < j; i++) if (sym->start == syms[i]->start) { reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/bpf/btf_helpers.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/bpf/btf_helpers.c @@ -246,23 +246,18 @@ d = btf_dump__new(btf, NULL, &opts, btf_dump_printf); if (libbpf_get_error(d)) { fprintf(stderr, "Failed to create btf_dump instance: %ld\n", libbpf_get_error(d)); + return NULL; - goto err_out; } for (i = 1; i <= btf__get_nr_types(btf); i++) { err = btf_dump__dump_type(d, i); if (err) { fprintf(stderr, "Failed to dump type [%d]: %d\n", i, err); + return NULL; - goto err_out; } } - btf_dump__free(d); fflush(buf_file); fclose(buf_file); return buf; -err_out: - btf_dump__free(d); - fclose(buf_file); - return NULL; } reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/bpf/prog_tests/bpf_iter.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/bpf/prog_tests/bpf_iter.c @@ -1197,14 +1197,13 @@ goto out; /* Read CMP_BUFFER_SIZE (1kB) from bpf_iter. Read in small chunks + * to trigger seq_file corner cases. The expected output is much + * longer than 1kB, so the while loop will terminate. - * to trigger seq_file corner cases. */ len = 0; while (len < CMP_BUFFER_SIZE) { err = read_fd_into_buffer(iter_fd, task_vma_output + len, min(read_size, CMP_BUFFER_SIZE - len)); - if (!err) - break; if (CHECK(err < 0, "read_iter_fd", "read_iter_fd failed\n")) goto out; len += err; reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/bpf/prog_tests/skb_ctx.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/bpf/prog_tests/skb_ctx.c @@ -105,6 +105,4 @@ "ctx_out_mark", "skb->mark == %u, expected %d\n", skb.mark, 10); - - bpf_object__close(obj); } reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/bpf/prog_tests/tc_redirect.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/bpf/prog_tests/tc_redirect.c @@ -104,13 +104,6 @@ if (!ASSERT_OK(err, "unshare")) return err; - /* Make our /sys mount private, so the following umount won't - * trigger the global umount in case it's shared. - */ - err = mount("none", "/sys", NULL, MS_PRIVATE, NULL); - if (!ASSERT_OK(err, "remount private /sys")) - return err; - err = umount2("/sys", MNT_DETACH); if (!ASSERT_OK(err, "umount2 /sys")) return err; reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/clone3/clone3.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/clone3/clone3.c @@ -52,12 +52,6 @@ size = sizeof(struct __clone_args); switch (test_mode) { - case CLONE3_ARGS_NO_TEST: - /* - * Uses default 'flags' and 'SIGCHLD' - * assignment. - */ - break; case CLONE3_ARGS_ALL_0: args.flags = 0; args.exit_signal = 0; reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/ftrace/test.d/kprobe/profile.tc +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/ftrace/test.d/kprobe/profile.tc @@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 +# description: Kprobe dynamic event - adding and removing -# description: Kprobe profile # requires: kprobe_events ! grep -q 'myevent' kprobe_profile reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/kselftest_harness.h +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/kselftest_harness.h @@ -969,7 +969,7 @@ t->passed = 1; t->skip = 0; t->trigger = 0; + t->step = 0; - t->step = 1; t->no_print = 0; memset(t->results->reason, 0, sizeof(t->results->reason)); reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/powerpc/security/spectre_v2.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/powerpc/security/spectre_v2.c @@ -193,7 +193,7 @@ * We are not vulnerable and reporting otherwise, so * missing such a mismatch is safe. */ + if (state == VULNERABLE) - if (miss_percent > 95) return 4; return 1; reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/powerpc/signal/Makefile +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/powerpc/signal/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 TEST_GEN_PROGS := signal signal_tm sigfuz sigreturn_vdso sig_sc_double_restart -TEST_GEN_PROGS += sigreturn_kernel CFLAGS += -maltivec $(OUTPUT)/signal_tm: CFLAGS += -mhtm reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c @@ -1,132 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Test that we can't sigreturn to kernel addresses, or to kernel mode. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include - -#include "utils.h" - -#define MSR_PR (1ul << 14) - -static volatile unsigned long long sigreturn_addr; -static volatile unsigned long long sigreturn_msr_mask; - -static void sigusr1_handler(int signo, siginfo_t *si, void *uc_ptr) -{ - ucontext_t *uc = (ucontext_t *)uc_ptr; - - if (sigreturn_addr) - UCONTEXT_NIA(uc) = sigreturn_addr; - - if (sigreturn_msr_mask) - UCONTEXT_MSR(uc) &= sigreturn_msr_mask; -} - -static pid_t fork_child(void) -{ - pid_t pid; - - pid = fork(); - if (pid == 0) { - raise(SIGUSR1); - exit(0); - } - - return pid; -} - -static int expect_segv(pid_t pid) -{ - int child_ret; - - waitpid(pid, &child_ret, 0); - FAIL_IF(WIFEXITED(child_ret)); - FAIL_IF(!WIFSIGNALED(child_ret)); - FAIL_IF(WTERMSIG(child_ret) != 11); - - return 0; -} - -int test_sigreturn_kernel(void) -{ - struct sigaction act; - int child_ret, i; - pid_t pid; - - act.sa_sigaction = sigusr1_handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - - FAIL_IF(sigaction(SIGUSR1, &act, NULL)); - - for (i = 0; i < 2; i++) { - // Return to kernel - sigreturn_addr = 0xcull << 60; - pid = fork_child(); - expect_segv(pid); - - // Return to kernel virtual - sigreturn_addr = 0xc008ull << 48; - pid = fork_child(); - expect_segv(pid); - - // Return out of range - sigreturn_addr = 0xc010ull << 48; - pid = fork_child(); - expect_segv(pid); - - // Return to no-man's land, just below PAGE_OFFSET - sigreturn_addr = (0xcull << 60) - (64 * 1024); - pid = fork_child(); - expect_segv(pid); - - // Return to no-man's land, above TASK_SIZE_4PB - sigreturn_addr = 0x1ull << 52; - pid = fork_child(); - expect_segv(pid); - - // Return to 0xd space - sigreturn_addr = 0xdull << 60; - pid = fork_child(); - expect_segv(pid); - - // Return to 0xe space - sigreturn_addr = 0xeull << 60; - pid = fork_child(); - expect_segv(pid); - - // Return to 0xf space - sigreturn_addr = 0xfull << 60; - pid = fork_child(); - expect_segv(pid); - - // Attempt to set PR=0 for 2nd loop (should be blocked by kernel) - sigreturn_msr_mask = ~MSR_PR; - } - - printf("All children killed as expected\n"); - - // Don't change address, just MSR, should return to user as normal - sigreturn_addr = 0; - sigreturn_msr_mask = ~MSR_PR; - pid = fork_child(); - waitpid(pid, &child_ret, 0); - FAIL_IF(!WIFEXITED(child_ret)); - FAIL_IF(WIFSIGNALED(child_ret)); - FAIL_IF(WEXITSTATUS(child_ret) != 0); - - return 0; -} - -int main(void) -{ - return test_harness(test_sigreturn_kernel, "sigreturn_kernel"); -} reverted: --- linux-aws-5.13-5.13.0/tools/testing/selftests/vm/hmm-tests.c +++ linux-aws-5.13-5.13.0.orig/tools/testing/selftests/vm/hmm-tests.c @@ -1251,48 +1251,6 @@ /* * Test memory snapshot without faulting in pages accessed by the device. */ -TEST_F(hmm, mixedmap) -{ - struct hmm_buffer *buffer; - unsigned long npages; - unsigned long size; - unsigned char *m; - int ret; - - npages = 1; - size = npages << self->page_shift; - - buffer = malloc(sizeof(*buffer)); - ASSERT_NE(buffer, NULL); - - buffer->fd = -1; - buffer->size = size; - buffer->mirror = malloc(npages); - ASSERT_NE(buffer->mirror, NULL); - - - /* Reserve a range of addresses. */ - buffer->ptr = mmap(NULL, size, - PROT_READ | PROT_WRITE, - MAP_PRIVATE, - self->fd, 0); - ASSERT_NE(buffer->ptr, MAP_FAILED); - - /* Simulate a device snapshotting CPU pagetables. */ - ret = hmm_dmirror_cmd(self->fd, HMM_DMIRROR_SNAPSHOT, buffer, npages); - ASSERT_EQ(ret, 0); - ASSERT_EQ(buffer->cpages, npages); - - /* Check what the device saw. */ - m = buffer->mirror; - ASSERT_EQ(m[0], HMM_DMIRROR_PROT_READ); - - hmm_buffer_free(buffer); -} - -/* - * Test memory snapshot without faulting in pages accessed by the device. - */ TEST_F(hmm2, snapshot) { struct hmm_buffer *buffer; reverted: --- linux-aws-5.13-5.13.0/usr/include/Makefile +++ linux-aws-5.13-5.13.0.orig/usr/include/Makefile @@ -34,6 +34,7 @@ no-header-test += linux/ivtv.h no-header-test += linux/kexec.h no-header-test += linux/matroxfb.h +no-header-test += linux/nfc.h no-header-test += linux/omap3isp.h no-header-test += linux/omapfb.h no-header-test += linux/patchkey.h diff -u linux-aws-5.13-5.13.0/virt/kvm/kvm_main.c linux-aws-5.13-5.13.0/virt/kvm/kvm_main.c --- linux-aws-5.13-5.13.0/virt/kvm/kvm_main.c +++ linux-aws-5.13-5.13.0/virt/kvm/kvm_main.c @@ -1863,6 +1863,7 @@ { return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn); } +EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot); bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) { only in patch2: unchanged: --- linux-aws-5.13-5.13.0.orig/include/net/esp.h +++ linux-aws-5.13-5.13.0/include/net/esp.h @@ -4,6 +4,8 @@ #include +#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER) + struct ip_esp_hdr; static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)