diff -u linux-lowlatency-5.15.0/Documentation/admin-guide/sysctl/net.rst linux-lowlatency-5.15.0/Documentation/admin-guide/sysctl/net.rst --- linux-lowlatency-5.15.0/Documentation/admin-guide/sysctl/net.rst +++ linux-lowlatency-5.15.0/Documentation/admin-guide/sysctl/net.rst @@ -31,18 +31,18 @@ Table : Subdirectories in /proc/sys/net - ========= =================== = ========== ================== + ========= =================== = ========== =================== Directory Content Directory Content - ========= =================== = ========== ================== - 802 E802 protocol mptcp Multipath TCP - appletalk Appletalk protocol netfilter Network Filter + ========= =================== = ========== =================== + 802 E802 protocol mptcp Multipath TCP + appletalk Appletalk protocol netfilter Network Filter ax25 AX25 netrom NET/ROM - bridge Bridging rose X.25 PLP layer - core General parameter tipc TIPC - ethernet Ethernet protocol unix Unix domain sockets - ipv4 IP version 4 x25 X.25 protocol + bridge Bridging rose X.25 PLP layer + core General parameter tipc TIPC + ethernet Ethernet protocol unix Unix domain sockets + ipv4 IP version 4 x25 X.25 protocol ipv6 IP version 6 - ========= =================== = ========== ================== + ========= =================== = ========== =================== 1. /proc/sys/net/core - Network core options ============================================ diff -u linux-lowlatency-5.15.0/Makefile linux-lowlatency-5.15.0/Makefile --- linux-lowlatency-5.15.0/Makefile +++ linux-lowlatency-5.15.0/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 15 -SUBLEVEL = 136 +SUBLEVEL = 143 EXTRAVERSION = NAME = Trick or Treat diff -u linux-lowlatency-5.15.0/arch/arm/boot/dts/imx7s.dtsi linux-lowlatency-5.15.0/arch/arm/boot/dts/imx7s.dtsi --- linux-lowlatency-5.15.0/arch/arm/boot/dts/imx7s.dtsi +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/imx7s.dtsi @@ -438,7 +438,7 @@ }; gpt1: timer@302d0000 { - compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; + compatible = "fsl,imx7d-gpt", "fsl,imx6dl-gpt"; reg = <0x302d0000 0x10000>; interrupts = ; clocks = <&clks IMX7D_GPT1_ROOT_CLK>, @@ -447,7 +447,7 @@ }; gpt2: timer@302e0000 { - compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; + compatible = "fsl,imx7d-gpt", "fsl,imx6dl-gpt"; reg = <0x302e0000 0x10000>; interrupts = ; clocks = <&clks IMX7D_GPT2_ROOT_CLK>, @@ -457,7 +457,7 @@ }; gpt3: timer@302f0000 { - compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; + compatible = "fsl,imx7d-gpt", "fsl,imx6dl-gpt"; reg = <0x302f0000 0x10000>; interrupts = ; clocks = <&clks IMX7D_GPT3_ROOT_CLK>, @@ -467,7 +467,7 @@ }; gpt4: timer@30300000 { - compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; + compatible = "fsl,imx7d-gpt", "fsl,imx6dl-gpt"; reg = <0x30300000 0x10000>; interrupts = ; clocks = <&clks IMX7D_GPT4_ROOT_CLK>, diff -u linux-lowlatency-5.15.0/arch/arm/boot/dts/motorola-mapphone-common.dtsi linux-lowlatency-5.15.0/arch/arm/boot/dts/motorola-mapphone-common.dtsi --- linux-lowlatency-5.15.0/arch/arm/boot/dts/motorola-mapphone-common.dtsi +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/motorola-mapphone-common.dtsi @@ -640,6 +640,7 @@ &uart3 { interrupts-extended = <&wakeupgen GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH &omap4_pmx_core 0x17c>; + overrun-throttle-ms = <500>; }; &uart4 { diff -u linux-lowlatency-5.15.0/arch/arm/boot/dts/qcom-mdm9615.dtsi linux-lowlatency-5.15.0/arch/arm/boot/dts/qcom-mdm9615.dtsi --- linux-lowlatency-5.15.0/arch/arm/boot/dts/qcom-mdm9615.dtsi +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/qcom-mdm9615.dtsi @@ -82,14 +82,12 @@ }; }; - regulators { - vsdcc_fixed: vsdcc-regulator { - compatible = "regulator-fixed"; - regulator-name = "SDCC Power"; - regulator-min-microvolt = <2700000>; - regulator-max-microvolt = <2700000>; - regulator-always-on; - }; + vsdcc_fixed: vsdcc-regulator { + compatible = "regulator-fixed"; + regulator-name = "SDCC Power"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <2700000>; + regulator-always-on; }; soc: soc { diff -u linux-lowlatency-5.15.0/arch/arm/mach-imx/mmdc.c linux-lowlatency-5.15.0/arch/arm/mach-imx/mmdc.c --- linux-lowlatency-5.15.0/arch/arm/mach-imx/mmdc.c +++ linux-lowlatency-5.15.0/arch/arm/mach-imx/mmdc.c @@ -502,6 +502,10 @@ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "mmdc%d", ret); + if (!name) { + ret = -ENOMEM; + goto pmu_release_id; + } pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk; pmu_mmdc->devtype_data = (struct fsl_mmdc_devtype_data *)of_id->data; @@ -524,9 +528,10 @@ pmu_register_err: pr_warn("MMDC Perf PMU failed (%d), disabled\n", ret); - ida_simple_remove(&mmdc_ida, pmu_mmdc->id); cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); hrtimer_cancel(&pmu_mmdc->hrtimer); +pmu_release_id: + ida_simple_remove(&mmdc_ida, pmu_mmdc->id); pmu_free: kfree(pmu_mmdc); return ret; diff -u linux-lowlatency-5.15.0/arch/arm64/Kconfig linux-lowlatency-5.15.0/arch/arm64/Kconfig --- linux-lowlatency-5.15.0/arch/arm64/Kconfig +++ linux-lowlatency-5.15.0/arch/arm64/Kconfig @@ -1153,6 +1153,8 @@ config CPU_BIG_ENDIAN bool "Build big-endian kernel" depends on !LD_IS_LLD || LLD_VERSION >= 130000 + # https://github.com/llvm/llvm-project/commit/1379b150991f70a5782e9a143c2ba5308da1161c + depends on AS_IS_GNU || AS_VERSION >= 150000 help Say Y if you plan on running a kernel with a big-endian userspace. diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi @@ -1179,26 +1179,34 @@ dma-coherent; }; - usb0: usb@3100000 { - status = "disabled"; - compatible = "snps,dwc3"; - reg = <0x0 0x3100000 0x0 0x10000>; - interrupts = <0 80 0x4>; /* Level high type */ - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; - }; + bus: bus { + #address-cells = <2>; + #size-cells = <2>; + compatible = "simple-bus"; + ranges; + dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x00000000>; + + usb0: usb@3100000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3100000 0x0 0x10000>; + interrupts = <0 80 0x4>; /* Level high type */ + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; + status = "disabled"; + }; - usb1: usb@3110000 { - status = "disabled"; - compatible = "snps,dwc3"; - reg = <0x0 0x3110000 0x0 0x10000>; - interrupts = <0 81 0x4>; /* Level high type */ - dr_mode = "host"; - snps,quirk-frame-length-adjustment = <0x20>; - snps,dis_rxdet_inp3_quirk; - snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; + usb1: usb@3110000 { + compatible = "snps,dwc3"; + reg = <0x0 0x3110000 0x0 0x10000>; + interrupts = <0 81 0x4>; /* Level high type */ + dr_mode = "host"; + snps,quirk-frame-length-adjustment = <0x20>; + snps,dis_rxdet_inp3_quirk; + snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; + status = "disabled"; + }; }; ccn@4000000 { diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mm.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mm.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mm.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mm.dtsi @@ -366,6 +366,7 @@ "pll8k", "pll11k", "clkext3"; dmas = <&sdma2 24 25 0x80000000>; dma-names = "rx"; + #sound-dai-cells = <0>; status = "disabled"; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi @@ -340,6 +340,7 @@ "pll8k", "pll11k", "clkext3"; dmas = <&sdma2 24 25 0x80000000>; dma-names = "rx"; + #sound-dai-cells = <0>; status = "disabled"; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -913,6 +913,7 @@ phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; snps,gfladj-refclk-lpm-sel-quirk; + snps,parkmode-disable-ss-quirk; }; }; @@ -954,6 +955,7 @@ phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; snps,gfladj-refclk-lpm-sel-quirk; + snps,parkmode-disable-ss-quirk; }; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mq.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mq.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -1382,7 +1382,7 @@ phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; power-domains = <&pgc_otg1>; - usb3-resume-missing-cas; + snps,parkmode-disable-ss-quirk; status = "disabled"; }; @@ -1414,7 +1414,7 @@ phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; power-domains = <&pgc_otg2>; - usb3-resume-missing-cas; + snps,parkmode-disable-ss-quirk; status = "disabled"; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts @@ -69,7 +69,7 @@ }; }; - memory { + memory@40000000 { reg = <0 0x40000000 0 0x40000000>; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -108,7 +108,7 @@ #size-cells = <2>; ranges; - scp_mem_reserved: scp_mem_region { + scp_mem_reserved: memory@50000000 { compatible = "shared-dma-pool"; reg = <0 0x50000000 0 0x2900000>; no-map; @@ -407,13 +407,13 @@ &pio { bt_pins: bt-pins { - pins_bt_en { + pins-bt-en { pinmux = ; output-low; }; }; - ec_ap_int_odl: ec_ap_int_odl { + ec_ap_int_odl: ec-ap-int-odl { pins1 { pinmux = ; input-enable; @@ -421,7 +421,7 @@ }; }; - h1_int_od_l: h1_int_od_l { + h1_int_od_l: h1-int-od-l { pins1 { pinmux = ; input-enable; @@ -429,7 +429,7 @@ }; i2c0_pins: i2c0 { - pins_bus { + pins-bus { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -438,7 +438,7 @@ }; i2c1_pins: i2c1 { - pins_bus { + pins-bus { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -447,7 +447,7 @@ }; i2c2_pins: i2c2 { - pins_bus { + pins-bus { pinmux = , ; bias-disable; @@ -456,7 +456,7 @@ }; i2c3_pins: i2c3 { - pins_bus { + pins-bus { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -465,7 +465,7 @@ }; i2c4_pins: i2c4 { - pins_bus { + pins-bus { pinmux = , ; bias-disable; @@ -474,7 +474,7 @@ }; i2c5_pins: i2c5 { - pins_bus { + pins-bus { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -483,7 +483,7 @@ }; i2c6_pins: i2c6 { - pins_bus { + pins-bus { pinmux = , ; bias-disable; @@ -491,7 +491,7 @@ }; mmc0_pins_default: mmc0-pins-default { - pins_cmd_dat { + pins-cmd-dat { pinmux = , , , @@ -506,13 +506,13 @@ mediatek,pull-up-adv = <01>; }; - pins_clk { + pins-clk { pinmux = ; drive-strength = ; mediatek,pull-down-adv = <10>; }; - pins_rst { + pins-rst { pinmux = ; drive-strength = ; mediatek,pull-down-adv = <01>; @@ -520,7 +520,7 @@ }; mmc0_pins_uhs: mmc0-pins-uhs { - pins_cmd_dat { + pins-cmd-dat { pinmux = , , , @@ -535,19 +535,19 @@ mediatek,pull-up-adv = <01>; }; - pins_clk { + pins-clk { pinmux = ; drive-strength = ; mediatek,pull-down-adv = <10>; }; - pins_ds { + pins-ds { pinmux = ; drive-strength = ; mediatek,pull-down-adv = <10>; }; - pins_rst { + pins-rst { pinmux = ; drive-strength = ; mediatek,pull-up-adv = <01>; @@ -555,7 +555,7 @@ }; mmc1_pins_default: mmc1-pins-default { - pins_cmd_dat { + pins-cmd-dat { pinmux = , , , @@ -565,7 +565,7 @@ mediatek,pull-up-adv = <10>; }; - pins_clk { + pins-clk { pinmux = ; input-enable; mediatek,pull-down-adv = <10>; @@ -573,7 +573,7 @@ }; mmc1_pins_uhs: mmc1-pins-uhs { - pins_cmd_dat { + pins-cmd-dat { pinmux = , , , @@ -584,7 +584,7 @@ mediatek,pull-up-adv = <10>; }; - pins_clk { + pins-clk { pinmux = ; drive-strength = ; mediatek,pull-down-adv = <10>; @@ -592,15 +592,15 @@ }; }; - panel_pins_default: panel_pins_default { - panel_reset { + panel_pins_default: panel-pins-default { + panel-reset { pinmux = ; output-low; bias-pull-up; }; }; - pwm0_pin_default: pwm0_pin_default { + pwm0_pin_default: pwm0-pin-default { pins1 { pinmux = ; output-high; @@ -612,14 +612,14 @@ }; scp_pins: scp { - pins_scp_uart { + pins-scp-uart { pinmux = , ; }; }; spi0_pins: spi0 { - pins_spi{ + pins-spi { pinmux = , , , @@ -629,7 +629,7 @@ }; spi1_pins: spi1 { - pins_spi{ + pins-spi { pinmux = , , , @@ -639,20 +639,20 @@ }; spi2_pins: spi2 { - pins_spi{ + pins-spi { pinmux = , , ; bias-disable; }; - pins_spi_mi { + pins-spi-mi { pinmux = ; mediatek,pull-down-adv = <00>; }; }; spi3_pins: spi3 { - pins_spi{ + pins-spi { pinmux = , , , @@ -662,7 +662,7 @@ }; spi4_pins: spi4 { - pins_spi{ + pins-spi { pinmux = , , , @@ -672,7 +672,7 @@ }; spi5_pins: spi5 { - pins_spi{ + pins-spi { pinmux = , , , @@ -682,63 +682,63 @@ }; uart0_pins_default: uart0-pins-default { - pins_rx { + pins-rx { pinmux = ; input-enable; bias-pull-up; }; - pins_tx { + pins-tx { pinmux = ; }; }; uart1_pins_default: uart1-pins-default { - pins_rx { + pins-rx { pinmux = ; input-enable; bias-pull-up; }; - pins_tx { + pins-tx { pinmux = ; }; - pins_rts { + pins-rts { pinmux = ; output-enable; }; - pins_cts { + pins-cts { pinmux = ; input-enable; }; }; uart1_pins_sleep: uart1-pins-sleep { - pins_rx { + pins-rx { pinmux = ; input-enable; bias-pull-up; }; - pins_tx { + pins-tx { pinmux = ; }; - pins_rts { + pins-rts { pinmux = ; output-enable; }; - pins_cts { + pins-cts { pinmux = ; input-enable; }; }; wifi_pins_pwrseq: wifi-pins-pwrseq { - pins_wifi_enable { + pins-wifi-enable { pinmux = ; output-low; }; }; wifi_pins_wakeup: wifi-pins-wakeup { - pins_wifi_wakeup { + pins-wifi-wakeup { pinmux = ; input-enable; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -766,127 +766,6 @@ nvmem-cell-names = "calibration-data"; }; - thermal_zones: thermal-zones { - cpu_thermal: cpu_thermal { - polling-delay-passive = <100>; - polling-delay = <500>; - thermal-sensors = <&thermal 0>; - sustainable-power = <5000>; - - trips { - threshold: trip-point0 { - temperature = <68000>; - hysteresis = <2000>; - type = "passive"; - }; - - target: trip-point1 { - temperature = <80000>; - hysteresis = <2000>; - type = "passive"; - }; - - cpu_crit: cpu-crit { - temperature = <115000>; - hysteresis = <2000>; - type = "critical"; - }; - }; - - cooling-maps { - map0 { - trip = <&target>; - cooling-device = <&cpu0 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu1 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu2 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu3 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>; - contribution = <3072>; - }; - map1 { - trip = <&target>; - cooling-device = <&cpu4 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu5 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu6 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>, - <&cpu7 - THERMAL_NO_LIMIT - THERMAL_NO_LIMIT>; - contribution = <1024>; - }; - }; - }; - - /* The tzts1 ~ tzts6 don't need to polling */ - /* The tzts1 ~ tzts6 don't need to thermal throttle */ - - tzts1: tzts1 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 1>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - - tzts2: tzts2 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 2>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - - tzts3: tzts3 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 3>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - - tzts4: tzts4 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 4>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - - tzts5: tzts5 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 5>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - - tztsABB: tztsABB { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&thermal 6>; - sustainable-power = <5000>; - trips {}; - cooling-maps {}; - }; - }; - pwm0: pwm@1100e000 { compatible = "mediatek,mt8183-disp-pwm"; reg = <0 0x1100e000 0 0x1000>; @@ -1497,2 +1376,123 @@ }; + + thermal_zones: thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <100>; + polling-delay = <500>; + thermal-sensors = <&thermal 0>; + sustainable-power = <5000>; + + trips { + threshold: trip-point0 { + temperature = <68000>; + hysteresis = <2000>; + type = "passive"; + }; + + target: trip-point1 { + temperature = <80000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit: cpu-crit { + temperature = <115000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&target>; + cooling-device = <&cpu0 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu1 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu2 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu3 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>; + contribution = <3072>; + }; + map1 { + trip = <&target>; + cooling-device = <&cpu4 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu5 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu6 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>, + <&cpu7 + THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>; + contribution = <1024>; + }; + }; + }; + + /* The tzts1 ~ tzts6 don't need to polling */ + /* The tzts1 ~ tzts6 don't need to thermal throttle */ + + tzts1: tzts1 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 1>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts2: tzts2 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 2>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts3: tzts3 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 3>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts4: tzts4 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 4>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tzts5: tzts5 { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 5>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + + tztsABB: tztsABB { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&thermal 6>; + sustainable-power = <5000>; + trips {}; + cooling-maps {}; + }; + }; }; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/apq8016-sbc.dts linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/apq8016-sbc.dts --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/apq8016-sbc.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/apq8016-sbc.dts @@ -190,6 +190,9 @@ pd-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>; avdd-supply = <&pm8916_l6>; + a2vdd-supply = <&pm8916_l6>; + dvdd-supply = <&pm8916_l6>; + pvdd-supply = <&pm8916_l6>; v1p2-supply = <&pm8916_l6>; v3p3-supply = <&pm8916_l17>; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -129,12 +129,6 @@ }; }; - tcsr_mutex: hwlock { - compatible = "qcom,tcsr-mutex"; - syscon = <&tcsr_mutex_regs 0 0x80>; - #hwlock-cells = <1>; - }; - pmuv8: pmu { compatible = "arm,cortex-a53-pmu"; interrupts = ; - hwlocks = <&tcsr_mutex 0>; + hwlocks = <&tcsr_mutex 3>; }; soc: soc { @@ -253,9 +247,10 @@ #reset-cells = <1>; }; - tcsr_mutex_regs: syscon@1905000 { - compatible = "syscon"; - reg = <0x0 0x01905000 0x0 0x8000>; + tcsr_mutex: hwlock@1905000 { + compatible = "qcom,ipq6018-tcsr-mutex", "qcom,tcsr-mutex"; + reg = <0x0 0x01905000 0x0 0x20000>; + #hwlock-cells = <1>; }; tcsr: syscon@1937000 { diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8916.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8916.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -1233,7 +1233,7 @@ #size-cells = <1>; #iommu-cells = <1>; compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; - ranges = <0 0x01e20000 0x40000>; + ranges = <0 0x01e20000 0x20000>; reg = <0x01ef0000 0x3000>; clocks = <&gcc GCC_SMMU_CFG_CLK>, <&gcc GCC_APSS_TCU_CLK>; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/msm8992-xiaomi-libra.dts @@ -99,11 +99,6 @@ qcom,client-id = <1>; }; - audio_mem: audio@cb400000 { - reg = <0 0xcb000000 0 0x400000>; - no-mem; - }; - qseecom_mem: qseecom@cb400000 { reg = <0 0xcb400000 0 0x1c00000>; no-mem; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/sc7280.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/sc7280.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -1851,6 +1851,14 @@ reg = <0 0x18591000 0 0x1000>, <0 0x18592000 0 0x1000>, <0 0x18593000 0 0x1000>; + + interrupts = , + , + ; + interrupt-names = "dcvsh-irq-0", + "dcvsh-irq-1", + "dcvsh-irq-2"; + clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_GPLL0>; clock-names = "xo", "alternate"; #freq-domain-cells = <1>; diff -u linux-lowlatency-5.15.0/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux-lowlatency-5.15.0/arch/arm64/boot/dts/rockchip/rk3399.dtsi --- linux-lowlatency-5.15.0/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -993,7 +993,9 @@ power-domain@RK3399_PD_VDU { reg = ; clocks = <&cru ACLK_VDU>, - <&cru HCLK_VDU>; + <&cru HCLK_VDU>, + <&cru SCLK_VDU_CA>, + <&cru SCLK_VDU_CORE>; pm_qos = <&qos_video_m1_r>, <&qos_video_m1_w>; #power-domain-cells = <0>; @@ -1260,7 +1262,7 @@ vdec: video-codec@ff660000 { compatible = "rockchip,rk3399-vdec"; - reg = <0x0 0xff660000 0x0 0x400>; + reg = <0x0 0xff660000 0x0 0x480>; interrupts = ; clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>, <&cru SCLK_VDU_CA>, <&cru SCLK_VDU_CORE>; diff -u linux-lowlatency-5.15.0/arch/mips/Kconfig linux-lowlatency-5.15.0/arch/mips/Kconfig --- linux-lowlatency-5.15.0/arch/mips/Kconfig +++ linux-lowlatency-5.15.0/arch/mips/Kconfig @@ -480,6 +480,7 @@ config MACH_LOONGSON64 bool "Loongson 64-bit family of machines" + select ARCH_DMA_DEFAULT_COHERENT select ARCH_SPARSEMEM_ENABLE select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO @@ -1379,6 +1380,7 @@ select CPU_SUPPORTS_MSA select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT select CPU_MIPSR2_IRQ_VI + select DMA_NONCOHERENT select WEAK_ORDERING select WEAK_REORDERING_BEYOND_LLSC select MIPS_ASID_BITS_VARIABLE diff -u linux-lowlatency-5.15.0/arch/parisc/kernel/entry.S linux-lowlatency-5.15.0/arch/parisc/kernel/entry.S --- linux-lowlatency-5.15.0/arch/parisc/kernel/entry.S +++ linux-lowlatency-5.15.0/arch/parisc/kernel/entry.S @@ -497,13 +497,13 @@ * to a CPU TLB 4k PFN (4k => 12 bits to shift) */ #define PAGE_ADD_SHIFT (PAGE_SHIFT-12) #define PAGE_ADD_HUGE_SHIFT (REAL_HPAGE_SHIFT-12) + #define PFN_START_BIT (63-ASM_PFN_PTE_SHIFT+(63-58)-PAGE_ADD_SHIFT) /* Drop prot bits and convert to page addr for iitlbt and idtlbt */ .macro convert_for_tlb_insert20 pte,tmp #ifdef CONFIG_HUGETLB_PAGE copy \pte,\tmp - extrd,u \tmp,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\ - 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte + extrd,u \tmp,PFN_START_BIT,PFN_START_BIT+1,\pte depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\ (63-58)+PAGE_ADD_SHIFT,\pte @@ -511,8 +511,7 @@ depdi _HUGE_PAGE_SIZE_ENCODING_DEFAULT,63,\ (63-58)+PAGE_ADD_HUGE_SHIFT,\pte #else /* Huge pages disabled */ - extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58)+PAGE_ADD_SHIFT,\ - 64-PAGE_SHIFT-PAGE_ADD_SHIFT,\pte + extrd,u \pte,PFN_START_BIT,PFN_START_BIT+1,\pte depdi _PAGE_SIZE_ENCODING_DEFAULT,63,\ (63-58)+PAGE_ADD_SHIFT,\pte #endif diff -u linux-lowlatency-5.15.0/arch/parisc/kernel/head.S linux-lowlatency-5.15.0/arch/parisc/kernel/head.S --- linux-lowlatency-5.15.0/arch/parisc/kernel/head.S +++ linux-lowlatency-5.15.0/arch/parisc/kernel/head.S @@ -69,9 +69,8 @@ stw,ma %arg2,4(%r1) stw,ma %arg3,4(%r1) -#if !defined(CONFIG_64BIT) && defined(CONFIG_PA20) - /* This 32-bit kernel was compiled for PA2.0 CPUs. Check current CPU - * and halt kernel if we detect a PA1.x CPU. */ +#if defined(CONFIG_PA20) + /* check for 64-bit capable CPU as required by current kernel */ ldi 32,%r10 mtctl %r10,%cr11 .level 2.0 diff -u linux-lowlatency-5.15.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h linux-lowlatency-5.15.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h --- linux-lowlatency-5.15.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h +++ linux-lowlatency-5.15.0/arch/powerpc/include/asm/book3s/32/mmu-hash.h @@ -64,7 +64,82 @@ #define SR_KP 0x20000000 /* User key */ #define SR_KS 0x40000000 /* Supervisor key */ -#ifndef __ASSEMBLY__ +#ifdef __ASSEMBLY__ + +#include + +.macro uus_addi sr reg1 reg2 imm + .if NUM_USER_SEGMENTS > \sr + addi \reg1,\reg2,\imm + .endif +.endm + +.macro uus_mtsr sr reg1 + .if NUM_USER_SEGMENTS > \sr + mtsr \sr, \reg1 + .endif +.endm + +/* + * This isync() shouldn't be necessary as the kernel is not excepted to run + * any instruction in userspace soon after the update of segments and 'rfi' + * instruction is used to return to userspace, but hash based cores + * (at least G3) seem to exhibit a random behaviour when the 'isync' is not + * there. 603 cores don't have this behaviour so don't do the 'isync' as it + * saves several CPU cycles. + */ +.macro uus_isync +#ifdef CONFIG_PPC_BOOK3S_604 +BEGIN_MMU_FTR_SECTION + isync +END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) +#endif +.endm + +.macro update_user_segments_by_4 tmp1 tmp2 tmp3 tmp4 + uus_addi 1, \tmp2, \tmp1, 0x111 + uus_addi 2, \tmp3, \tmp1, 0x222 + uus_addi 3, \tmp4, \tmp1, 0x333 + + uus_mtsr 0, \tmp1 + uus_mtsr 1, \tmp2 + uus_mtsr 2, \tmp3 + uus_mtsr 3, \tmp4 + + uus_addi 4, \tmp1, \tmp1, 0x444 + uus_addi 5, \tmp2, \tmp2, 0x444 + uus_addi 6, \tmp3, \tmp3, 0x444 + uus_addi 7, \tmp4, \tmp4, 0x444 + + uus_mtsr 4, \tmp1 + uus_mtsr 5, \tmp2 + uus_mtsr 6, \tmp3 + uus_mtsr 7, \tmp4 + + uus_addi 8, \tmp1, \tmp1, 0x444 + uus_addi 9, \tmp2, \tmp2, 0x444 + uus_addi 10, \tmp3, \tmp3, 0x444 + uus_addi 11, \tmp4, \tmp4, 0x444 + + uus_mtsr 8, \tmp1 + uus_mtsr 9, \tmp2 + uus_mtsr 10, \tmp3 + uus_mtsr 11, \tmp4 + + uus_addi 12, \tmp1, \tmp1, 0x444 + uus_addi 13, \tmp2, \tmp2, 0x444 + uus_addi 14, \tmp3, \tmp3, 0x444 + uus_addi 15, \tmp4, \tmp4, 0x444 + + uus_mtsr 12, \tmp1 + uus_mtsr 13, \tmp2 + uus_mtsr 14, \tmp3 + uus_mtsr 15, \tmp4 + + uus_isync +.endm + +#else /* * This macro defines the mapping from contexts to VSIDs (virtual diff -u linux-lowlatency-5.15.0/arch/powerpc/include/asm/interrupt.h linux-lowlatency-5.15.0/arch/powerpc/include/asm/interrupt.h --- linux-lowlatency-5.15.0/arch/powerpc/include/asm/interrupt.h +++ linux-lowlatency-5.15.0/arch/powerpc/include/asm/interrupt.h @@ -139,12 +139,10 @@ if (!arch_irq_disabled_regs(regs)) trace_hardirqs_off(); - if (user_mode(regs)) { - kuep_lock(); + if (user_mode(regs)) account_cpu_user_entry(); - } else { + else kuap_save_and_lock(regs); - } #endif #ifdef CONFIG_PPC64 diff -u linux-lowlatency-5.15.0/arch/powerpc/kernel/entry_32.S linux-lowlatency-5.15.0/arch/powerpc/kernel/entry_32.S --- linux-lowlatency-5.15.0/arch/powerpc/kernel/entry_32.S +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/entry_32.S @@ -73,6 +73,34 @@ _ASM_NOKPROBE_SYMBOL(prepare_transfer_to_handler) #endif /* CONFIG_PPC_BOOK3S_32 || CONFIG_E500 */ +#if defined(CONFIG_PPC_KUEP) && defined(CONFIG_PPC_BOOK3S_32) + .globl __kuep_lock +__kuep_lock: + mfsr r9,0 + rlwinm r9,r9,0,8,3 + oris r9,r9,SR_NX@h + update_user_segments_by_4 r9, r10, r11, r12 + blr + +__kuep_unlock: + mfsr r9,0 + rlwinm r9,r9,0,8,2 + update_user_segments_by_4 r9, r10, r11, r12 + blr + +.macro kuep_lock + bl __kuep_lock +.endm +.macro kuep_unlock + bl __kuep_unlock +.endm +#else +.macro kuep_lock +.endm +.macro kuep_unlock +.endm +#endif + .globl transfer_to_syscall transfer_to_syscall: stw r11, GPR1(r1) @@ -93,6 +121,7 @@ SAVE_GPRS(3, 8, r1) addi r2,r10,-THREAD SAVE_NVGPRS(r1) + kuep_lock /* Calling convention has r9 = orig r0, r10 = regs */ addi r10,r1,STACK_FRAME_OVERHEAD @@ -107,8 +136,10 @@ lis r4,icache_44x_need_flush@ha lwz r5,icache_44x_need_flush@l(r4) cmplwi cr0,r5,0 - bne- 2f + bne- .L44x_icache_flush #endif /* CONFIG_PPC_47x */ +.L44x_icache_flush_return: + kuep_unlock lwz r4,_LINK(r1) lwz r5,_CCR(r1) mtlr r4 @@ -143,10 +174,11 @@ b 1b #ifdef CONFIG_44x -2: li r7,0 +.L44x_icache_flush: + li r7,0 iccci r0,r0 stw r7,icache_44x_need_flush@l(r4) - b 1b + b .L44x_icache_flush_return #endif /* CONFIG_44x */ .globl ret_from_fork @@ -272,6 +304,7 @@ beq .Lkernel_interrupt_return bl interrupt_exit_user_prepare cmpwi r3,0 + kuep_unlock bne- .Lrestore_nvgprs .Lfast_user_interrupt_return: diff -u linux-lowlatency-5.15.0/arch/powerpc/kernel/head_32.h linux-lowlatency-5.15.0/arch/powerpc/kernel/head_32.h --- linux-lowlatency-5.15.0/arch/powerpc/kernel/head_32.h +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/head_32.h @@ -135,6 +135,12 @@ andi. r12,r9,MSR_PR bne 777f bl prepare_transfer_to_handler +#ifdef CONFIG_PPC_KUEP + b 778f +777: + bl __kuep_lock +778: +#endif 777: #endif .endm diff -u linux-lowlatency-5.15.0/arch/powerpc/kernel/interrupt.c linux-lowlatency-5.15.0/arch/powerpc/kernel/interrupt.c --- linux-lowlatency-5.15.0/arch/powerpc/kernel/interrupt.c +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/interrupt.c @@ -83,8 +83,6 @@ { syscall_fn f; - kuep_lock(); - regs->orig_gpr3 = r3; if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) @@ -408,7 +406,6 @@ /* Restore user access locks last */ kuap_user_restore(regs); - kuep_unlock(); return ret; } diff -u linux-lowlatency-5.15.0/arch/powerpc/kernel/setup-common.c linux-lowlatency-5.15.0/arch/powerpc/kernel/setup-common.c --- linux-lowlatency-5.15.0/arch/powerpc/kernel/setup-common.c +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/setup-common.c @@ -899,6 +899,8 @@ /* Parse memory topology */ mem_topology_setup(); + /* Set max_mapnr before paging_init() */ + set_max_mapnr(max_pfn); /* * Release secondary cpus out of their spinloops at 0x60 now that diff -u linux-lowlatency-5.15.0/arch/powerpc/kernel/traps.c linux-lowlatency-5.15.0/arch/powerpc/kernel/traps.c --- linux-lowlatency-5.15.0/arch/powerpc/kernel/traps.c +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/traps.c @@ -1148,6 +1148,7 @@ __single_step_exception(regs); } +#ifdef CONFIG_PPC_FPU_REGS static inline int __parse_fpscr(unsigned long fpscr) { int ret = FPE_FLTUNK; @@ -1174,6 +1175,7 @@ return ret; } +#endif static void parse_fpe(struct pt_regs *regs) { diff -u linux-lowlatency-5.15.0/arch/powerpc/mm/mem.c linux-lowlatency-5.15.0/arch/powerpc/mm/mem.c --- linux-lowlatency-5.15.0/arch/powerpc/mm/mem.c +++ linux-lowlatency-5.15.0/arch/powerpc/mm/mem.c @@ -288,7 +288,6 @@ #endif high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); - set_max_mapnr(max_pfn); kasan_late_init(); diff -u linux-lowlatency-5.15.0/arch/powerpc/perf/core-book3s.c linux-lowlatency-5.15.0/arch/powerpc/perf/core-book3s.c --- linux-lowlatency-5.15.0/arch/powerpc/perf/core-book3s.c +++ linux-lowlatency-5.15.0/arch/powerpc/perf/core-book3s.c @@ -1342,8 +1342,7 @@ /* * Disable instruction sampling if it was enabled */ - if (cpuhw->mmcr.mmcra & MMCRA_SAMPLE_ENABLE) - val &= ~MMCRA_SAMPLE_ENABLE; + val &= ~MMCRA_SAMPLE_ENABLE; /* Disable BHRB via mmcra (BHRBRD) for p10 */ if (ppmu->flags & PPMU_ARCH_31) @@ -1354,7 +1353,7 @@ * instruction sampling or BHRB. */ if (val != mmcra) { - mtspr(SPRN_MMCRA, mmcra); + mtspr(SPRN_MMCRA, val); mb(); isync(); } diff -u linux-lowlatency-5.15.0/arch/powerpc/perf/imc-pmu.c linux-lowlatency-5.15.0/arch/powerpc/perf/imc-pmu.c --- linux-lowlatency-5.15.0/arch/powerpc/perf/imc-pmu.c +++ linux-lowlatency-5.15.0/arch/powerpc/perf/imc-pmu.c @@ -50,7 +50,7 @@ * core and trace-imc */ static struct imc_pmu_ref imc_global_refc = { - .lock = __SPIN_LOCK_INITIALIZER(imc_global_refc.lock), + .lock = __SPIN_LOCK_UNLOCKED(imc_global_refc.lock), .id = 0, .refc = 0, }; diff -u linux-lowlatency-5.15.0/arch/powerpc/platforms/powernv/opal-prd.c linux-lowlatency-5.15.0/arch/powerpc/platforms/powernv/opal-prd.c --- linux-lowlatency-5.15.0/arch/powerpc/platforms/powernv/opal-prd.c +++ linux-lowlatency-5.15.0/arch/powerpc/platforms/powernv/opal-prd.c @@ -24,13 +24,20 @@ #include +struct opal_prd_msg { + union { + struct opal_prd_msg_header header; + DECLARE_FLEX_ARRAY(u8, data); + }; +}; + /* * The msg member must be at the end of the struct, as it's followed by the * message data. */ struct opal_prd_msg_queue_item { - struct list_head list; - struct opal_prd_msg_header msg; + struct list_head list; + struct opal_prd_msg msg; }; static struct device_node *prd_node; @@ -156,7 +163,7 @@ int rc; /* we need at least a header's worth of data */ - if (count < sizeof(item->msg)) + if (count < sizeof(item->msg.header)) return -EINVAL; if (*ppos) @@ -186,7 +193,7 @@ return -EINTR; } - size = be16_to_cpu(item->msg.size); + size = be16_to_cpu(item->msg.header.size); if (size > count) { err = -EINVAL; goto err_requeue; @@ -352,7 +359,7 @@ if (!item) return -ENOMEM; - memcpy(&item->msg, msg->params, msg_size); + memcpy(&item->msg.data, msg->params, msg_size); spin_lock_irqsave(&opal_prd_msg_queue_lock, flags); list_add_tail(&item->list, &opal_prd_msg_queue); diff -u linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/iommu.c linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/iommu.c --- linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/iommu.c +++ linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/iommu.c @@ -1241,7 +1241,6 @@ u32 ddw_avail[DDW_APPLICABLE_SIZE]; struct dma_win *window; struct property *win64; - bool ddw_enabled = false; struct failed_ddw_pdn *fpdn; bool default_win_removed = false, direct_mapping = false; bool pmem_present; @@ -1256,7 +1255,6 @@ if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) { direct_mapping = (len >= max_ram_len); - ddw_enabled = true; goto out_unlock; } @@ -1411,8 +1409,8 @@ dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n", dn, ret); - /* Make sure to clean DDW if any TCE was set*/ - clean_dma_window(pdn, win64->value); + /* Make sure to clean DDW if any TCE was set*/ + clean_dma_window(pdn, win64->value); goto out_del_list; } } else { @@ -1459,7 +1457,6 @@ spin_unlock(&dma_win_list_lock); dev->dev.archdata.dma_offset = win_addr; - ddw_enabled = true; goto out_unlock; out_del_list: @@ -1495,10 +1492,10 @@ * as RAM, then we failed to create a window to cover persistent * memory and need to set the DMA limit. */ - if (pmem_present && ddw_enabled && direct_mapping && len == max_ram_len) + if (pmem_present && direct_mapping && len == max_ram_len) dev->dev.bus_dma_limit = dev->dev.archdata.dma_offset + (1ULL << len); - return ddw_enabled && direct_mapping; + return direct_mapping; } static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) diff -u linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/lpar.c linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/lpar.c --- linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/lpar.c +++ linux-lowlatency-5.15.0/arch/powerpc/platforms/pseries/lpar.c @@ -524,8 +524,10 @@ if (cmd) { rc = init_cpu_associativity(); - if (rc) + if (rc) { + destroy_cpu_associativity(); goto out; + } for_each_possible_cpu(cpu) { disp = per_cpu_ptr(&vcpu_disp_data, cpu); diff -u linux-lowlatency-5.15.0/arch/riscv/kernel/probes/simulate-insn.c linux-lowlatency-5.15.0/arch/riscv/kernel/probes/simulate-insn.c --- linux-lowlatency-5.15.0/arch/riscv/kernel/probes/simulate-insn.c +++ linux-lowlatency-5.15.0/arch/riscv/kernel/probes/simulate-insn.c @@ -24,7 +24,7 @@ unsigned long val) { if (index == 0) - return false; + return true; else if (index <= 31) *((unsigned long *)regs + index) = val; else diff -u linux-lowlatency-5.15.0/arch/s390/mm/pgtable.c linux-lowlatency-5.15.0/arch/s390/mm/pgtable.c --- linux-lowlatency-5.15.0/arch/s390/mm/pgtable.c +++ linux-lowlatency-5.15.0/arch/s390/mm/pgtable.c @@ -731,7 +731,7 @@ pte_clear(mm, addr, ptep); } if (reset) - pgste_val(pgste) &= ~_PGSTE_GPS_USAGE_MASK; + pgste_val(pgste) &= ~(_PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT); pgste_set_unlock(ptep, pgste); preempt_enable(); } diff -u linux-lowlatency-5.15.0/arch/sh/Kconfig.debug linux-lowlatency-5.15.0/arch/sh/Kconfig.debug --- linux-lowlatency-5.15.0/arch/sh/Kconfig.debug +++ linux-lowlatency-5.15.0/arch/sh/Kconfig.debug @@ -22,6 +22,17 @@ every function call and will therefore incur a major performance hit. Most users should say N. +config EARLY_PRINTK + bool "Early printk" + depends on SH_STANDARD_BIOS + help + Say Y here to redirect kernel printk messages to the serial port + used by the SH-IPL bootloader, starting very early in the boot + process and ending when the kernel's serial console is initialised. + This option is only useful while porting the kernel to a new machine, + when the kernel may crash or hang before the serial console is + initialised. If unsure, say N. + config 4KSTACKS bool "Use 4Kb for kernel stacks instead of 8Kb" depends on DEBUG_KERNEL && (MMU || BROKEN) && !PAGE_SIZE_64KB diff -u linux-lowlatency-5.15.0/arch/x86/events/intel/lbr.c linux-lowlatency-5.15.0/arch/x86/events/intel/lbr.c --- linux-lowlatency-5.15.0/arch/x86/events/intel/lbr.c +++ linux-lowlatency-5.15.0/arch/x86/events/intel/lbr.c @@ -4,7 +4,6 @@ #include #include -#include #include "../perf_event.h" @@ -74,65 +73,6 @@ #define LBR_FROM_SIGNEXT_2MSB (BIT_ULL(60) | BIT_ULL(59)) /* - * x86control flow change classification - * x86control flow changes include branches, interrupts, traps, faults - */ -enum { - X86_BR_NONE = 0, /* unknown */ - - X86_BR_USER = 1 << 0, /* branch target is user */ - X86_BR_KERNEL = 1 << 1, /* branch target is kernel */ - - X86_BR_CALL = 1 << 2, /* call */ - X86_BR_RET = 1 << 3, /* return */ - X86_BR_SYSCALL = 1 << 4, /* syscall */ - X86_BR_SYSRET = 1 << 5, /* syscall return */ - X86_BR_INT = 1 << 6, /* sw interrupt */ - X86_BR_IRET = 1 << 7, /* return from interrupt */ - X86_BR_JCC = 1 << 8, /* conditional */ - X86_BR_JMP = 1 << 9, /* jump */ - X86_BR_IRQ = 1 << 10,/* hw interrupt or trap or fault */ - X86_BR_IND_CALL = 1 << 11,/* indirect calls */ - X86_BR_ABORT = 1 << 12,/* transaction abort */ - X86_BR_IN_TX = 1 << 13,/* in transaction */ - X86_BR_NO_TX = 1 << 14,/* not in transaction */ - X86_BR_ZERO_CALL = 1 << 15,/* zero length call */ - X86_BR_CALL_STACK = 1 << 16,/* call stack */ - X86_BR_IND_JMP = 1 << 17,/* indirect jump */ - - X86_BR_TYPE_SAVE = 1 << 18,/* indicate to save branch type */ - -}; - -#define X86_BR_PLM (X86_BR_USER | X86_BR_KERNEL) -#define X86_BR_ANYTX (X86_BR_NO_TX | X86_BR_IN_TX) - -#define X86_BR_ANY \ - (X86_BR_CALL |\ - X86_BR_RET |\ - X86_BR_SYSCALL |\ - X86_BR_SYSRET |\ - X86_BR_INT |\ - X86_BR_IRET |\ - X86_BR_JCC |\ - X86_BR_JMP |\ - X86_BR_IRQ |\ - X86_BR_ABORT |\ - X86_BR_IND_CALL |\ - X86_BR_IND_JMP |\ - X86_BR_ZERO_CALL) - -#define X86_BR_ALL (X86_BR_PLM | X86_BR_ANY) - -#define X86_BR_ANY_CALL \ - (X86_BR_CALL |\ - X86_BR_IND_CALL |\ - X86_BR_ZERO_CALL |\ - X86_BR_SYSCALL |\ - X86_BR_IRQ |\ - X86_BR_INT) - -/* * Intel LBR_CTL bits * * Hardware branch filter for Arch LBR @@ -1168,219 +1108,6 @@ return ret; } -/* - * return the type of control flow change at address "from" - * instruction is not necessarily a branch (in case of interrupt). - * - * The branch type returned also includes the priv level of the - * target of the control flow change (X86_BR_USER, X86_BR_KERNEL). - * - * If a branch type is unknown OR the instruction cannot be - * decoded (e.g., text page not present), then X86_BR_NONE is - * returned. - */ -static int branch_type(unsigned long from, unsigned long to, int abort) -{ - struct insn insn; - void *addr; - int bytes_read, bytes_left; - int ret = X86_BR_NONE; - int ext, to_plm, from_plm; - u8 buf[MAX_INSN_SIZE]; - int is64 = 0; - - to_plm = kernel_ip(to) ? X86_BR_KERNEL : X86_BR_USER; - from_plm = kernel_ip(from) ? X86_BR_KERNEL : X86_BR_USER; - - /* - * maybe zero if lbr did not fill up after a reset by the time - * we get a PMU interrupt - */ - if (from == 0 || to == 0) - return X86_BR_NONE; - - if (abort) - return X86_BR_ABORT | to_plm; - - if (from_plm == X86_BR_USER) { - /* - * can happen if measuring at the user level only - * and we interrupt in a kernel thread, e.g., idle. - */ - if (!current->mm) - return X86_BR_NONE; - - /* may fail if text not present */ - bytes_left = copy_from_user_nmi(buf, (void __user *)from, - MAX_INSN_SIZE); - bytes_read = MAX_INSN_SIZE - bytes_left; - if (!bytes_read) - return X86_BR_NONE; - - addr = buf; - } else { - /* - * The LBR logs any address in the IP, even if the IP just - * faulted. This means userspace can control the from address. - * Ensure we don't blindly read any address by validating it is - * a known text address. - */ - if (kernel_text_address(from)) { - addr = (void *)from; - /* - * Assume we can get the maximum possible size - * when grabbing kernel data. This is not - * _strictly_ true since we could possibly be - * executing up next to a memory hole, but - * it is very unlikely to be a problem. - */ - bytes_read = MAX_INSN_SIZE; - } else { - return X86_BR_NONE; - } - } - - /* - * decoder needs to know the ABI especially - * on 64-bit systems running 32-bit apps - */ -#ifdef CONFIG_X86_64 - is64 = kernel_ip((unsigned long)addr) || any_64bit_mode(current_pt_regs()); -#endif - insn_init(&insn, addr, bytes_read, is64); - if (insn_get_opcode(&insn)) - return X86_BR_ABORT; - - switch (insn.opcode.bytes[0]) { - case 0xf: - switch (insn.opcode.bytes[1]) { - case 0x05: /* syscall */ - case 0x34: /* sysenter */ - ret = X86_BR_SYSCALL; - break; - case 0x07: /* sysret */ - case 0x35: /* sysexit */ - ret = X86_BR_SYSRET; - break; - case 0x80 ... 0x8f: /* conditional */ - ret = X86_BR_JCC; - break; - default: - ret = X86_BR_NONE; - } - break; - case 0x70 ... 0x7f: /* conditional */ - ret = X86_BR_JCC; - break; - case 0xc2: /* near ret */ - case 0xc3: /* near ret */ - case 0xca: /* far ret */ - case 0xcb: /* far ret */ - ret = X86_BR_RET; - break; - case 0xcf: /* iret */ - ret = X86_BR_IRET; - break; - case 0xcc ... 0xce: /* int */ - ret = X86_BR_INT; - break; - case 0xe8: /* call near rel */ - if (insn_get_immediate(&insn) || insn.immediate1.value == 0) { - /* zero length call */ - ret = X86_BR_ZERO_CALL; - break; - } - fallthrough; - case 0x9a: /* call far absolute */ - ret = X86_BR_CALL; - break; - case 0xe0 ... 0xe3: /* loop jmp */ - ret = X86_BR_JCC; - break; - case 0xe9 ... 0xeb: /* jmp */ - ret = X86_BR_JMP; - break; - case 0xff: /* call near absolute, call far absolute ind */ - if (insn_get_modrm(&insn)) - return X86_BR_ABORT; - - ext = (insn.modrm.bytes[0] >> 3) & 0x7; - switch (ext) { - case 2: /* near ind call */ - case 3: /* far ind call */ - ret = X86_BR_IND_CALL; - break; - case 4: - case 5: - ret = X86_BR_IND_JMP; - break; - } - break; - default: - ret = X86_BR_NONE; - } - /* - * interrupts, traps, faults (and thus ring transition) may - * occur on any instructions. Thus, to classify them correctly, - * we need to first look at the from and to priv levels. If they - * are different and to is in the kernel, then it indicates - * a ring transition. If the from instruction is not a ring - * transition instr (syscall, systenter, int), then it means - * it was a irq, trap or fault. - * - * we have no way of detecting kernel to kernel faults. - */ - if (from_plm == X86_BR_USER && to_plm == X86_BR_KERNEL - && ret != X86_BR_SYSCALL && ret != X86_BR_INT) - ret = X86_BR_IRQ; - - /* - * branch priv level determined by target as - * is done by HW when LBR_SELECT is implemented - */ - if (ret != X86_BR_NONE) - ret |= to_plm; - - return ret; -} - -#define X86_BR_TYPE_MAP_MAX 16 - -static int branch_map[X86_BR_TYPE_MAP_MAX] = { - PERF_BR_CALL, /* X86_BR_CALL */ - PERF_BR_RET, /* X86_BR_RET */ - PERF_BR_SYSCALL, /* X86_BR_SYSCALL */ - PERF_BR_SYSRET, /* X86_BR_SYSRET */ - PERF_BR_UNKNOWN, /* X86_BR_INT */ - PERF_BR_UNKNOWN, /* X86_BR_IRET */ - PERF_BR_COND, /* X86_BR_JCC */ - PERF_BR_UNCOND, /* X86_BR_JMP */ - PERF_BR_UNKNOWN, /* X86_BR_IRQ */ - PERF_BR_IND_CALL, /* X86_BR_IND_CALL */ - PERF_BR_UNKNOWN, /* X86_BR_ABORT */ - PERF_BR_UNKNOWN, /* X86_BR_IN_TX */ - PERF_BR_UNKNOWN, /* X86_BR_NO_TX */ - PERF_BR_CALL, /* X86_BR_ZERO_CALL */ - PERF_BR_UNKNOWN, /* X86_BR_CALL_STACK */ - PERF_BR_IND, /* X86_BR_IND_JMP */ -}; - -static int -common_branch_type(int type) -{ - int i; - - type >>= 2; /* skip X86_BR_USER and X86_BR_KERNEL */ - - if (type) { - i = __ffs(type); - if (i < X86_BR_TYPE_MAP_MAX) - return branch_map[i]; - } - - return PERF_BR_UNKNOWN; -} - enum { ARCH_LBR_BR_TYPE_JCC = 0, ARCH_LBR_BR_TYPE_NEAR_IND_JMP = 1, diff -u linux-lowlatency-5.15.0/arch/x86/events/intel/pt.c linux-lowlatency-5.15.0/arch/x86/events/intel/pt.c --- linux-lowlatency-5.15.0/arch/x86/events/intel/pt.c +++ linux-lowlatency-5.15.0/arch/x86/events/intel/pt.c @@ -1360,20 +1360,10 @@ } #ifdef CONFIG_X86_64 -static u64 canonical_address(u64 vaddr, u8 vaddr_bits) -{ - return ((s64)vaddr << (64 - vaddr_bits)) >> (64 - vaddr_bits); -} - -static u64 is_canonical_address(u64 vaddr, u8 vaddr_bits) -{ - return canonical_address(vaddr, vaddr_bits) == vaddr; -} - /* Clamp to a canonical address greater-than-or-equal-to the address given */ static u64 clamp_to_ge_canonical_addr(u64 vaddr, u8 vaddr_bits) { - return is_canonical_address(vaddr, vaddr_bits) ? + return __is_canonical_address(vaddr, vaddr_bits) ? vaddr : -BIT_ULL(vaddr_bits - 1); } @@ -1381,7 +1371,7 @@ /* Clamp to a canonical address less-than-or-equal-to the address given */ static u64 clamp_to_le_canonical_addr(u64 vaddr, u8 vaddr_bits) { - return is_canonical_address(vaddr, vaddr_bits) ? + return __is_canonical_address(vaddr, vaddr_bits) ? vaddr : BIT_ULL(vaddr_bits - 1) - 1; } diff -u linux-lowlatency-5.15.0/arch/x86/events/perf_event.h linux-lowlatency-5.15.0/arch/x86/events/perf_event.h --- linux-lowlatency-5.15.0/arch/x86/events/perf_event.h +++ linux-lowlatency-5.15.0/arch/x86/events/perf_event.h @@ -1182,6 +1182,68 @@ regs->ip = ip; } +/* + * x86control flow change classification + * x86control flow changes include branches, interrupts, traps, faults + */ +enum { + X86_BR_NONE = 0, /* unknown */ + + X86_BR_USER = 1 << 0, /* branch target is user */ + X86_BR_KERNEL = 1 << 1, /* branch target is kernel */ + + X86_BR_CALL = 1 << 2, /* call */ + X86_BR_RET = 1 << 3, /* return */ + X86_BR_SYSCALL = 1 << 4, /* syscall */ + X86_BR_SYSRET = 1 << 5, /* syscall return */ + X86_BR_INT = 1 << 6, /* sw interrupt */ + X86_BR_IRET = 1 << 7, /* return from interrupt */ + X86_BR_JCC = 1 << 8, /* conditional */ + X86_BR_JMP = 1 << 9, /* jump */ + X86_BR_IRQ = 1 << 10,/* hw interrupt or trap or fault */ + X86_BR_IND_CALL = 1 << 11,/* indirect calls */ + X86_BR_ABORT = 1 << 12,/* transaction abort */ + X86_BR_IN_TX = 1 << 13,/* in transaction */ + X86_BR_NO_TX = 1 << 14,/* not in transaction */ + X86_BR_ZERO_CALL = 1 << 15,/* zero length call */ + X86_BR_CALL_STACK = 1 << 16,/* call stack */ + X86_BR_IND_JMP = 1 << 17,/* indirect jump */ + + X86_BR_TYPE_SAVE = 1 << 18,/* indicate to save branch type */ + +}; + +#define X86_BR_PLM (X86_BR_USER | X86_BR_KERNEL) +#define X86_BR_ANYTX (X86_BR_NO_TX | X86_BR_IN_TX) + +#define X86_BR_ANY \ + (X86_BR_CALL |\ + X86_BR_RET |\ + X86_BR_SYSCALL |\ + X86_BR_SYSRET |\ + X86_BR_INT |\ + X86_BR_IRET |\ + X86_BR_JCC |\ + X86_BR_JMP |\ + X86_BR_IRQ |\ + X86_BR_ABORT |\ + X86_BR_IND_CALL |\ + X86_BR_IND_JMP |\ + X86_BR_ZERO_CALL) + +#define X86_BR_ALL (X86_BR_PLM | X86_BR_ANY) + +#define X86_BR_ANY_CALL \ + (X86_BR_CALL |\ + X86_BR_IND_CALL |\ + X86_BR_ZERO_CALL |\ + X86_BR_SYSCALL |\ + X86_BR_IRQ |\ + X86_BR_INT) + +int common_branch_type(int type); +int branch_type(unsigned long from, unsigned long to, int abort); + ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event); ssize_t intel_event_sysfs_show(char *page, u64 config); diff -u linux-lowlatency-5.15.0/arch/x86/include/asm/msr-index.h linux-lowlatency-5.15.0/arch/x86/include/asm/msr-index.h --- linux-lowlatency-5.15.0/arch/x86/include/asm/msr-index.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/msr-index.h @@ -511,6 +511,7 @@ #define MSR_AMD64_CPUID_FN_1 0xc0011004 #define MSR_AMD64_LS_CFG 0xc0011020 #define MSR_AMD64_DC_CFG 0xc0011022 +#define MSR_AMD64_TW_CFG 0xc0011023 #define MSR_AMD64_DE_CFG 0xc0011029 #define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1 diff -u linux-lowlatency-5.15.0/arch/x86/include/asm/uaccess.h linux-lowlatency-5.15.0/arch/x86/include/asm/uaccess.h --- linux-lowlatency-5.15.0/arch/x86/include/asm/uaccess.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/uaccess.h @@ -543,7 +543,7 @@ #define copy_mc_to_kernel copy_mc_to_kernel unsigned long __must_check -copy_mc_to_user(void *to, const void *from, unsigned len); +copy_mc_to_user(void __user *to, const void *from, unsigned len); #endif /* diff -u linux-lowlatency-5.15.0/arch/x86/kernel/acpi/boot.c linux-lowlatency-5.15.0/arch/x86/kernel/acpi/boot.c --- linux-lowlatency-5.15.0/arch/x86/kernel/acpi/boot.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/acpi/boot.c @@ -139,6 +139,9 @@ pr_debug("Local APIC address 0x%08x\n", madt->address); } + if (madt->flags & ACPI_MADT_PCAT_COMPAT) + legacy_pic_pcat_compat(); + default_acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); diff -u linux-lowlatency-5.15.0/arch/x86/kernel/cpu/amd.c linux-lowlatency-5.15.0/arch/x86/kernel/cpu/amd.c --- linux-lowlatency-5.15.0/arch/x86/kernel/cpu/amd.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/cpu/amd.c @@ -1286,6 +1286,9 @@ void amd_check_microcode(void) { + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) + return; + on_each_cpu(zenbleed_check_cpu, NULL, 1); } diff -u linux-lowlatency-5.15.0/arch/x86/kernel/cpu/bugs.c linux-lowlatency-5.15.0/arch/x86/kernel/cpu/bugs.c --- linux-lowlatency-5.15.0/arch/x86/kernel/cpu/bugs.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/cpu/bugs.c @@ -2477,7 +2477,7 @@ pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode")); pred_cmd: - if ((boot_cpu_has(X86_FEATURE_SRSO_NO) || srso_cmd == SRSO_CMD_OFF) && + if ((!boot_cpu_has_bug(X86_BUG_SRSO) || srso_cmd == SRSO_CMD_OFF) && boot_cpu_has(X86_FEATURE_SBPB)) x86_pred_cmd = PRED_CMD_SBPB; } diff -u linux-lowlatency-5.15.0/arch/x86/kernel/cpu/hygon.c linux-lowlatency-5.15.0/arch/x86/kernel/cpu/hygon.c --- linux-lowlatency-5.15.0/arch/x86/kernel/cpu/hygon.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/cpu/hygon.c @@ -86,8 +86,12 @@ if (!err) c->x86_coreid_bits = get_count_order(c->x86_max_cores); - /* Socket ID is ApicId[6] for these processors. */ - c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; + /* + * Socket ID is ApicId[6] for the processors with model <= 0x3 + * when running on host. + */ + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <= 0x3) + c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; cacheinfo_hygon_init_llc_id(c, cpu); } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { diff -u linux-lowlatency-5.15.0/arch/x86/kernel/head64.c linux-lowlatency-5.15.0/arch/x86/kernel/head64.c --- linux-lowlatency-5.15.0/arch/x86/kernel/head64.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/head64.c @@ -79,7 +79,7 @@ * while the kernel still uses a direct mapping. */ static struct desc_ptr startup_gdt_descr = { - .size = sizeof(startup_gdt), + .size = sizeof(startup_gdt)-1, .address = 0, }; diff -u linux-lowlatency-5.15.0/arch/x86/kernel/i8259.c linux-lowlatency-5.15.0/arch/x86/kernel/i8259.c --- linux-lowlatency-5.15.0/arch/x86/kernel/i8259.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/i8259.c @@ -32,6 +32,7 @@ */ static void init_8259A(int auto_eoi); +static bool pcat_compat __ro_after_init; static int i8259A_auto_eoi; DEFINE_RAW_SPINLOCK(i8259A_lock); @@ -301,15 +302,32 @@ static int probe_8259A(void) { + unsigned char new_val, probe_val = ~(1 << PIC_CASCADE_IR); unsigned long flags; - unsigned char probe_val = ~(1 << PIC_CASCADE_IR); - unsigned char new_val; + + /* + * If MADT has the PCAT_COMPAT flag set, then do not bother probing + * for the PIC. Some BIOSes leave the PIC uninitialized and probing + * fails. + * + * Right now this causes problems as quite some code depends on + * nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly + * when the system has an IO/APIC because then PIC is not required + * at all, except for really old machines where the timer interrupt + * must be routed through the PIC. So just pretend that the PIC is + * there and let legacy_pic->init() initialize it for nothing. + * + * Alternatively this could just try to initialize the PIC and + * repeat the probe, but for cases where there is no PIC that's + * just pointless. + */ + if (pcat_compat) + return nr_legacy_irqs(); + /* - * Check to see if we have a PIC. - * Mask all except the cascade and read - * back the value we just wrote. If we don't - * have a PIC, we will read 0xff as opposed to the - * value we wrote. + * Check to see if we have a PIC. Mask all except the cascade and + * read back the value we just wrote. If we don't have a PIC, we + * will read 0xff as opposed to the value we wrote. */ raw_spin_lock_irqsave(&i8259A_lock, flags); @@ -434,2 +452,6 @@ - device_initcall(i8259A_init_ops); + +void __init legacy_pic_pcat_compat(void) +{ + pcat_compat = true; +} diff -u linux-lowlatency-5.15.0/arch/x86/kernel/setup.c linux-lowlatency-5.15.0/arch/x86/kernel/setup.c --- linux-lowlatency-5.15.0/arch/x86/kernel/setup.c +++ linux-lowlatency-5.15.0/arch/x86/kernel/setup.c @@ -67,11 +67,6 @@ #endif -/* - * Range of the BSS area. The size of the BSS area is determined - * at link time, with RESERVE_BRK() facility reserving additional - * chunks. - */ unsigned long _brk_start = (unsigned long)__brk_base; unsigned long _brk_end = (unsigned long)__brk_base; diff -u linux-lowlatency-5.15.0/arch/x86/kernel/vmlinux.lds.S linux-lowlatency-5.15.0/arch/x86/kernel/vmlinux.lds.S --- linux-lowlatency-5.15.0/arch/x86/kernel/vmlinux.lds.S +++ linux-lowlatency-5.15.0/arch/x86/kernel/vmlinux.lds.S @@ -414,7 +414,7 @@ .brk : AT(ADDR(.brk) - LOAD_OFFSET) { __brk_base = .; . += 64 * 1024; /* 64k alignment slop space */ - *(.brk_reservation) /* areas brk users have reserved */ + *(.bss..brk) /* areas brk users have reserved */ __brk_limit = .; } diff -u linux-lowlatency-5.15.0/arch/x86/kvm/emulate.c linux-lowlatency-5.15.0/arch/x86/kvm/emulate.c --- linux-lowlatency-5.15.0/arch/x86/kvm/emulate.c +++ linux-lowlatency-5.15.0/arch/x86/kvm/emulate.c @@ -687,7 +687,7 @@ static inline bool emul_is_noncanonical_address(u64 la, struct x86_emulate_ctxt *ctxt) { - return get_canonical(la, ctxt_virt_addr_bits(ctxt)) != la; + return !__is_canonical_address(la, ctxt_virt_addr_bits(ctxt)); } /* @@ -737,7 +737,7 @@ case X86EMUL_MODE_PROT64: *linear = la; va_bits = ctxt_virt_addr_bits(ctxt); - if (get_canonical(la, va_bits) != la) + if (!__is_canonical_address(la, va_bits)) goto bad; *max_size = min_t(u64, ~0u, (1ull << va_bits) - la); diff -u linux-lowlatency-5.15.0/arch/x86/kvm/hyperv.c linux-lowlatency-5.15.0/arch/x86/kvm/hyperv.c --- linux-lowlatency-5.15.0/arch/x86/kvm/hyperv.c +++ linux-lowlatency-5.15.0/arch/x86/kvm/hyperv.c @@ -701,10 +701,12 @@ stimer_cleanup(stimer); stimer->count = count; - if (stimer->count == 0) - stimer->config.enable = 0; - else if (stimer->config.auto_enable) - stimer->config.enable = 1; + if (!host) { + if (stimer->count == 0) + stimer->config.enable = 0; + else if (stimer->config.auto_enable) + stimer->config.enable = 1; + } if (stimer->config.enable) stimer_mark_pending(stimer, false); diff -u linux-lowlatency-5.15.0/arch/x86/kvm/lapic.c linux-lowlatency-5.15.0/arch/x86/kvm/lapic.c --- linux-lowlatency-5.15.0/arch/x86/kvm/lapic.c +++ linux-lowlatency-5.15.0/arch/x86/kvm/lapic.c @@ -2411,13 +2411,17 @@ { u32 reg = kvm_lapic_get_reg(apic, lvt_type); int vector, mode, trig_mode; + int r; if (kvm_apic_hw_enabled(apic) && !(reg & APIC_LVT_MASKED)) { vector = reg & APIC_VECTOR_MASK; mode = reg & APIC_MODE_MASK; trig_mode = reg & APIC_LVT_LEVEL_TRIGGER; - return __apic_accept_irq(apic, mode, vector, 1, trig_mode, - NULL); + + r = __apic_accept_irq(apic, mode, vector, 1, trig_mode, NULL); + if (r && lvt_type == APIC_LVTPC) + kvm_lapic_set_reg(apic, APIC_LVTPC, reg | APIC_LVT_MASKED); + return r; } return 0; } diff -u linux-lowlatency-5.15.0/arch/x86/kvm/svm/svm.c linux-lowlatency-5.15.0/arch/x86/kvm/svm/svm.c --- linux-lowlatency-5.15.0/arch/x86/kvm/svm/svm.c +++ linux-lowlatency-5.15.0/arch/x86/kvm/svm/svm.c @@ -1749,15 +1749,17 @@ bool old_paging = is_paging(vcpu); #ifdef CONFIG_X86_64 - if (vcpu->arch.efer & EFER_LME && !vcpu->arch.guest_state_protected) { + if (vcpu->arch.efer & EFER_LME) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { vcpu->arch.efer |= EFER_LMA; - svm->vmcb->save.efer |= EFER_LMA | EFER_LME; + if (!vcpu->arch.guest_state_protected) + svm->vmcb->save.efer |= EFER_LMA | EFER_LME; } if (is_paging(vcpu) && !(cr0 & X86_CR0_PG)) { vcpu->arch.efer &= ~EFER_LMA; - svm->vmcb->save.efer &= ~(EFER_LMA | EFER_LME); + if (!vcpu->arch.guest_state_protected) + svm->vmcb->save.efer &= ~(EFER_LMA | EFER_LME); } } #endif diff -u linux-lowlatency-5.15.0/arch/x86/kvm/x86.c linux-lowlatency-5.15.0/arch/x86/kvm/x86.c --- linux-lowlatency-5.15.0/arch/x86/kvm/x86.c +++ linux-lowlatency-5.15.0/arch/x86/kvm/x86.c @@ -1745,7 +1745,7 @@ * value, and that something deterministic happens if the guest * invokes 64-bit SYSENTER. */ - data = get_canonical(data, vcpu_virt_addr_bits(vcpu)); + data = __canonical_address(data, vcpu_virt_addr_bits(vcpu)); break; case MSR_TSC_AUX: if (!kvm_is_supported_user_return_msr(MSR_TSC_AUX)) @@ -3393,6 +3393,7 @@ case MSR_AMD64_PATCH_LOADER: case MSR_AMD64_BU_CFG2: case MSR_AMD64_DC_CFG: + case MSR_AMD64_TW_CFG: case MSR_F15H_EX_CFG: break; @@ -3733,6 +3734,7 @@ case MSR_AMD64_BU_CFG2: case MSR_IA32_PERF_CTL: case MSR_AMD64_DC_CFG: + case MSR_AMD64_TW_CFG: case MSR_F15H_EX_CFG: /* * Intel Sandy Bridge CPUs must support the RAPL (running average power diff -u linux-lowlatency-5.15.0/arch/x86/kvm/x86.h linux-lowlatency-5.15.0/arch/x86/kvm/x86.h --- linux-lowlatency-5.15.0/arch/x86/kvm/x86.h +++ linux-lowlatency-5.15.0/arch/x86/kvm/x86.h @@ -211,14 +211,9 @@ return kvm_read_cr4_bits(vcpu, X86_CR4_LA57) ? 57 : 48; } -static inline u64 get_canonical(u64 la, u8 vaddr_bits) -{ - return ((int64_t)la << (64 - vaddr_bits)) >> (64 - vaddr_bits); -} - static inline bool is_noncanonical_address(u64 la, struct kvm_vcpu *vcpu) { - return get_canonical(la, vcpu_virt_addr_bits(vcpu)) != la; + return !__is_canonical_address(la, vcpu_virt_addr_bits(vcpu)); } static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu, diff -u linux-lowlatency-5.15.0/arch/x86/mm/numa.c linux-lowlatency-5.15.0/arch/x86/mm/numa.c --- linux-lowlatency-5.15.0/arch/x86/mm/numa.c +++ linux-lowlatency-5.15.0/arch/x86/mm/numa.c @@ -601,13 +601,6 @@ if (start >= end) continue; - /* - * Don't confuse VM with a node that doesn't have the - * minimum amount of memory: - */ - if (end && (end - start) < NODE_MIN_SIZE) - continue; - alloc_node_data(nid); } diff -u linux-lowlatency-5.15.0/block/blk-core.c linux-lowlatency-5.15.0/block/blk-core.c --- linux-lowlatency-5.15.0/block/blk-core.c +++ linux-lowlatency-5.15.0/block/blk-core.c @@ -693,18 +693,15 @@ #endif /* CONFIG_FAIL_MAKE_REQUEST */ -static inline bool bio_check_ro(struct bio *bio) +static inline void bio_check_ro(struct bio *bio) { if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) { if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) - return false; - pr_warn("Trying to write to read-only block-device %pg\n", - bio->bi_bdev); + return; + pr_warn_ratelimited("Trying to write to read-only block-device %pg\n", + bio->bi_bdev); /* Older lvm-tools actually trigger this */ - return false; } - - return false; } static noinline int should_fail_bio(struct bio *bio) @@ -810,8 +807,7 @@ if (should_fail_bio(bio)) goto end_io; - if (unlikely(bio_check_ro(bio))) - goto end_io; + bio_check_ro(bio); if (!bio_flagged(bio, BIO_REMAPPED)) { if (unlikely(bio_check_eod(bio))) goto end_io; diff -u linux-lowlatency-5.15.0/crypto/pcrypt.c linux-lowlatency-5.15.0/crypto/pcrypt.c --- linux-lowlatency-5.15.0/crypto/pcrypt.c +++ linux-lowlatency-5.15.0/crypto/pcrypt.c @@ -117,6 +117,8 @@ err = padata_do_parallel(ictx->psenc, padata, &ctx->cb_cpu); if (!err) return -EINPROGRESS; + if (err == -EBUSY) + return -EAGAIN; return err; } @@ -164,6 +166,8 @@ err = padata_do_parallel(ictx->psdec, padata, &ctx->cb_cpu); if (!err) return -EINPROGRESS; + if (err == -EBUSY) + return -EAGAIN; return err; } diff -u linux-lowlatency-5.15.0/debian.lowlatency/abi/abiname linux-lowlatency-5.15.0/debian.lowlatency/abi/abiname --- linux-lowlatency-5.15.0/debian.lowlatency/abi/abiname +++ linux-lowlatency-5.15.0/debian.lowlatency/abi/abiname @@ -1 +1 @@ -94 +97 diff -u linux-lowlatency-5.15.0/debian.lowlatency/abi/version linux-lowlatency-5.15.0/debian.lowlatency/abi/version --- linux-lowlatency-5.15.0/debian.lowlatency/abi/version +++ linux-lowlatency-5.15.0/debian.lowlatency/abi/version @@ -1 +1 @@ -5.15.0-94.104 +5.15.0-97.107 diff -u linux-lowlatency-5.15.0/debian.lowlatency/changelog linux-lowlatency-5.15.0/debian.lowlatency/changelog --- linux-lowlatency-5.15.0/debian.lowlatency/changelog +++ linux-lowlatency-5.15.0/debian.lowlatency/changelog @@ -1,3 +1,1134 @@ +linux-lowlatency (5.15.0-100.110) jammy; urgency=medium + + * jammy/linux-lowlatency: 5.15.0-100.110 -proposed tracker (LP: #2052079) + + [ Ubuntu: 5.15.0-100.110 ] + + * jammy/linux: 5.15.0-100.110 -proposed tracker (LP: #2052616) + * i915 regression introduced with 5.5 kernel (LP: #2044131) + - drm/i915: Skip some timing checks on BXT/GLK DSI transcoders + * Audio balancing setting doesn't work with the cirrus codec (LP: #2051050) + - ALSA: hda/cs8409: Suppress vmaster control for Dolphin models + * partproke is broken on empty loopback device (LP: #2049689) + - block: Move checking GENHD_FL_NO_PART to bdev_add_partition() + * CVE-2023-0340 + - vhost: use kzalloc() instead of kmalloc() followed by memset() + * CVE-2023-51780 + - atm: Fix Use-After-Free in do_vcc_ioctl + * CVE-2023-6915 + - ida: Fix crash in ida_free when the bitmap is empty + * CVE-2024-0646 + - net: tls, update curr on splice as well + * CVE-2024-0565 + - smb: client: fix OOB in receive_encrypted_standard() + * CVE-2023-51781 + - appletalk: Fix Use-After-Free in atalk_ioctl + * Jammy update: v5.15.143 upstream stable release (LP: #2050858) + - vdpa/mlx5: preserve CVQ vringh index + - hrtimers: Push pending hrtimers away from outgoing CPU earlier + - i2c: designware: Fix corrupted memory seen in the ISR + - netfilter: ipset: fix race condition between swap/destroy and kernel side + add/del/test + - tg3: Move the [rt]x_dropped counters to tg3_napi + - tg3: Increment tx_dropped in tg3_tso_bug() + - kconfig: fix memory leak from range properties + - drm/amdgpu: correct chunk_ptr to a pointer to chunk. + - platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum + - platform/x86: asus-wmi: Add support for ROG X13 tablet mode + - platform/x86: asus-wmi: Simplify tablet-mode-switch probing + - platform/x86: asus-wmi: Simplify tablet-mode-switch handling + - platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code + - of: dynamic: Fix of_reconfig_get_state_change() return value documentation + - platform/x86: wmi: Allow duplicate GUIDs for drivers that use struct + wmi_driver + - platform/x86: wmi: Skip blocks with zero instances + - ipv6: fix potential NULL deref in fib6_add() + - octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam + - octeontx2-af: Check return value of nix_get_nixlf before using nixlf + - hv_netvsc: rndis_filter needs to select NLS + - r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE + - r8152: Add RTL8152_INACCESSIBLE checks to more loops + - r8152: Add RTL8152_INACCESSIBLE to r8156b_wait_loading_flash() + - r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() + - r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() + - mlxbf-bootctl: correctly identify secure boot with development keys + - platform/mellanox: Add null pointer checks for devm_kasprintf() + - platform/mellanox: Check devm_hwmon_device_register_with_groups() return + value + - arcnet: restoring support for multiple Sohard Arcnet cards + - net: stmmac: fix FPE events losing + - octeontx2-af: fix a use-after-free in rvu_npa_register_reporters + - i40e: Fix unexpected MFS warning message + - net: bnxt: fix a potential use-after-free in bnxt_init_tc + - ionic: fix snprintf format length warning + - ionic: Fix dim work handling in split interrupt mode + - ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() + - net: hns: fix fake link up on xge port + - octeontx2-af: Update Tx link register range + - netfilter: nf_tables: validate family when identifying table via handle + - netfilter: xt_owner: Fix for unsafe access of sk->sk_socket + - tcp: do not accept ACK of bytes we never sent + - bpf: sockmap, updating the sg structure should also update curr + - psample: Require 'CAP_NET_ADMIN' when joining "packets" group + - net: add missing kdoc for struct genl_multicast_group::flags + - drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group + - tee: optee: Fix supplicant based device enumeration + - RDMA/hns: Fix unnecessary err return when using invalid congest control + algorithm + - RDMA/irdma: Do not modify to SQD on error + - RDMA/irdma: Add wait for suspend on SQD + - arm64: dts: rockchip: Expand reg size of vdec node for RK3399 + - RDMA/rtrs-srv: Do not unconditionally enable irq + - RDMA/rtrs-clt: Start hb after path_up + - RDMA/rtrs-srv: Check return values while processing info request + - RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true + - RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight + - RDMA/rtrs-clt: Fix the max_send_wr setting + - RDMA/rtrs-clt: Remove the warnings for req in_use check + - RDMA/bnxt_re: Correct module description string + - hwmon: (acpi_power_meter) Fix 4.29 MW bug + - hwmon: (nzxt-kraken2) Fix error handling path in kraken2_probe() + - ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate + - RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz + - RDMA/irdma: Avoid free the non-cqp_request scratch + - arm64: dts: imx8mq: drop usb3-resume-missing-cas from usb + - arm64: dts: imx8mp: imx8mq: Add parkmode-disable-ss-quirk on DWC3 + - ARM: dts: imx6ul-pico: Describe the Ethernet PHY clock + - tracing: Fix a warning when allocating buffered events fails + - scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() + - ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init + - ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt + - ARM: dts: imx28-xea: Pass the 'model' property + - riscv: fix misaligned access handling of C.SWSP and C.SDSP + - md: introduce md_ro_state + - md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly() + - kprobes: consistent rcu api usage for kretprobe holder + - nvme-pci: Add sleep quirk for Kingston drives + - io_uring: fix mutex_unlock with unreferenced ctx + - ALSA: usb-audio: Add Pioneer DJM-450 mixer controls + - ALSA: pcm: fix out-of-bounds in snd_pcm_state_names + - nilfs2: fix missing error check for sb_set_blocksize call + - nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() + - checkstack: fix printed address + - tracing: Always update snapshot buffer size + - tracing: Disable snapshot buffer when stopping instance tracers + - tracing: Fix incomplete locking when disabling buffered events + - tracing: Fix a possible race when disabling buffered events + - packet: Move reference count in packet_sock to atomic_long_t + - regmap: fix bogus error on regcache_sync success + - platform/surface: aggregator: fix recv_buf() return value + - arm64: dts: mediatek: mt7622: fix memory node warning check + - arm64: dts: mediatek: mt8183-kukui-jacuzzi: fix dsi unnecessary cells + properties + - arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names + - arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory + - binder: fix memory leaks of spam and pending work + - kallsyms: Make kallsyms_on_each_symbol generally available + - coresight: etm4x: Make etm4_remove_dev() return void + - coresight: etm4x: Remove bogous __exit annotation for some functions + - misc: mei: client.c: return negative error code in mei_cl_write + - misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write + - ring-buffer: Force absolute timestamp on discard of event + - tracing: Set actual size after ring buffer resize + - tracing: Stop current tracer when resizing buffer + - r8169: fix rtl8125b PAUSE frames blasting when suspended + - mm: fix oops when filemap_map_pmd() without prealloc_pte + - io_uring/af_unix: disable sending io_uring over sockets + - platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting + - docs/process/howto: Replace C89 with C11 + - tools headers UAPI: Sync linux/perf_event.h with the kernel sources + - arm64: dts: mediatek: align thermal zone node names with dtschema + - arm64: dts: mediatek: mt8183: Move thermal-zones to the root node + - arm64: dts: mediatek: add missing space before { + - arm64: dts: mt8183: kukui: Fix underscores in node names + - gpiolib: sysfs: Fix error handling on failed export + - drm/amd/amdgpu: Fix warnings in amdgpu/amdgpu_display.c + - drm/amdgpu: correct the amdgpu runtime dereference usage count + - usb: gadget: f_hid: fix report descriptor allocation + - parport: Add support for Brainboxes IX/UC/PX parallel cards + - usb: typec: class: fix typec_altmode_put_partner to put plugs + - ARM: PL011: Fix DMA support + - serial: sc16is7xx: address RX timeout interrupt errata + - serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit + - serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt + - serial: 8250_omap: Add earlycon support for the AM654 UART controller + - x86/CPU/AMD: Check vendor in the AMD microcode callback + - KVM: s390/mm: Properly reset no-dat + - KVM: SVM: Update EFER software model on CR0 trap for SEV-ES + - MIPS: Loongson64: Reserve vgabios memory on boot + - MIPS: Loongson64: Enable DMA noncoherent support + - cifs: Fix non-availability of dedup breaking generic/304 + - smb: client: fix potential NULL deref in parse_dfs_referrals() + - devcoredump : Serialize devcd_del work + - devcoredump: Send uevent once devcd is ready + - Linux 5.15.143 + * Intel E810-XXV - NETDEV WATCHDOG: (ice): transmit queue timed out + (LP: #2036239) + - ice: Add feature bitmap, helpers and a check for DSCP + - ice: Add driver support for firmware changes for LAG + - ice: alter feature support check for SRIOV and LAG + * Don't WARN_ON_ONCE() for a broken discovery table (LP: #2048404) + - perf/x86/uncore: Don't WARN_ON_ONCE() for a broken discovery table + * Reject connection when malformed L2CAP signal packet is received + (LP: #2047634) + - Bluetooth: L2CAP: Send reject on command corrupted request + * Jammy update: v5.15.142 upstream stable release (LP: #2050849) + - pinctrl: avoid reload of p state in list iteration + - firewire: core: fix possible memory leak in create_units() + - mmc: cqhci: Increase recovery halt timeout + - mmc: cqhci: Warn of halt or task clear failure + - mmc: cqhci: Fix task clearing in CQE error recovery + - mmc: block: Retry commands in CQE error recovery + - mmc: block: Do not lose cache flush during CQE error recovery + - mmc: block: Be sure to wait while busy in CQE error recovery + - ALSA: hda: Disable power-save on KONTRON SinglePC + - ALSA: hda/realtek: Headset Mic VREF to 100% + - ALSA: hda/realtek: Add supported ALC257 for ChromeOS + - dm-verity: align struct dm_verity_fec_io properly + - dm verity: don't perform FEC for failed readahead IO + - bcache: revert replacing IS_ERR_OR_NULL with IS_ERR + - iommu/vt-d: Add MTL to quirk list to skip TE disabling + - powerpc: Don't clobber f0/vs0 during fp|altivec register save + - parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes + - btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod() + - btrfs: fix off-by-one when checking chunk map includes logical address + - btrfs: send: ensure send_fd is writable + - btrfs: make error messages more clear when getting a chunk map + - Input: xpad - add HyperX Clutch Gladiate Support + - vlan: introduce vlan_dev_free_egress_priority + - vlan: move dev_put into vlan_dev_uninit + - rcu: Avoid tracing a few functions executed in stop machine + - hv_netvsc: fix race of netvsc and VF register_netdevice + - USB: core: Change configuration warnings to notices + - usb: config: fix iteration issue in 'usb_get_bos_descriptor()' + - dpaa2-eth: increase the needed headroom to account for alignment + - uapi: propagate __struct_group() attributes to the container union + - selftests/net: ipsec: fix constant out of range + - octeontx2-af: Fix possible buffer overflow + - net: stmmac: xgmac: Disable FPE MMC interrupts + - octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 + - Revert "workqueue: remove unused cancel_work()" + - r8169: prevent potential deadlock in rtl8169_close + - ravb: Fix races between ravb_tx_timeout_work() and net related ops + - net: ravb: Check return value of reset_control_deassert() + - net: ravb: Use pm_runtime_resume_and_get() + - net: ravb: Start TX queues after HW initialization succeeded + - net: ravb: Stop DMA in case of failures on ravb_open() + - perf intel-pt: Fix async branch flags + - selftests/resctrl: Add missing SPDX license to Makefile + - selftests/resctrl: Move _GNU_SOURCE define into Makefile + - smb3: fix touch -h of symlink + - ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header + - ASoC: SOF: sof-pci-dev: use community key on all Up boards + - ASoC: SOF: sof-pci-dev: add parameter to override topology filename + - ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks + - ASoC: SOF: sof-pci-dev: Fix community key quirk detection + - fbdev: stifb: Make the STI next font pointer a 32-bit signed offset + - fs: add ctime accessors infrastructure + - smb3: fix caching of ctime on setxattr + - cpufreq: imx6q: don't warn for disabling a non-existing frequency + - cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily + - iommu/vt-d: Omit devTLB invalidation requests when TES=0 + - iommu/vt-d: Make context clearing consistent with context mapping + - mmc: core: add helpers mmc_regulator_enable/disable_vqmmc + - mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled + - r8169: disable ASPM in case of tx timeout + - r8169: fix deadlock on RTL8125 in jumbo mtu mode + - iomap: update ki_pos a little later in iomap_dio_complete + - Linux 5.15.142 + * Jammy update: v5.15.141 upstream stable release (LP: #2050044) + - afs: Fix afs_server_list to be cleaned up with RCU + - afs: Make error on cell lookup failure consistent with OpenAFS + - drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence + - drm/panel: auo,b101uan08.3: Fine tune the panel power sequence + - drm/panel: simple: Fix Innolux G101ICE-L01 bus flags + - drm/panel: simple: Fix Innolux G101ICE-L01 timings + - wireguard: use DEV_STATS_INC() + - octeontx2-pf: Fix memory leak during interface down + - ata: pata_isapnp: Add missing error check for devm_ioport_map() + - drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full + - HID: core: store the unique system identifier in hid_device + - HID: fix HID device resource race between HID core and debugging support + - ipv4: Correct/silence an endian warning in __ip_do_redirect + - net: usb: ax88179_178a: fix failed operations during ax88179_reset + - net/smc: avoid data corruption caused by decline + - arm/xen: fix xen_vcpu_info allocation alignment + - octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx + queue than its PF + - amd-xgbe: handle corner-case during sfp hotplug + - amd-xgbe: handle the corner-case during tx completion + - amd-xgbe: propagate the correct speed and duplex status + - net: axienet: Fix check for partial TX checksum + - afs: Return ENOENT if no cell DNS record can be found + - afs: Fix file locking on R/O volumes to operate in local mode + - nvmet: nul-terminate the NQNs passed in the connect command + - USB: dwc3: qcom: fix resource leaks on probe deferral + - USB: dwc3: qcom: fix ACPI platform device leak + - lockdep: Fix block chain corruption + - MIPS: KVM: Fix a build warning about variable set but not used + - media: camss: Replace hard coded value with parameter + - media: camss: sm8250: Virtual channels for CSID + - media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3 + - media: qcom: camss: Fix csid-gen2 for test pattern generator + - ext4: add a new helper to check if es must be kept + - ext4: factor out __es_alloc_extent() and __es_free_extent() + - ext4: use pre-allocated es in __es_insert_extent() + - ext4: use pre-allocated es in __es_remove_extent() + - ext4: using nofail preallocation in ext4_es_remove_extent() + - ext4: using nofail preallocation in ext4_es_insert_delayed_block() + - ext4: using nofail preallocation in ext4_es_insert_extent() + - ext4: fix slab-use-after-free in ext4_es_insert_extent() + - ext4: make sure allocate pending entry not fail + - proc: sysctl: prevent aliased sysctls from getting passed to init + - ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA + - swiotlb-xen: provide the "max_mapping_size" method + - bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in + btree_gc_coalesce() + - md: fix bi_status reporting in md_end_clone_io + - bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race + - io_uring/fs: consider link->flags when getting path for LINKAT + - s390/dasd: protect device queue against concurrent access + - USB: serial: option: add Luat Air72*U series products + - hv_netvsc: Fix race of register_netdevice_notifier and VF register + - hv_netvsc: Mark VF as slave before exposing it to user-mode + - dm-delay: fix a race between delay_presuspend and delay_bio + - bcache: check return value from btree_node_alloc_replacement() + - bcache: prevent potential division by zero error + - bcache: fixup init dirty data errors + - bcache: fixup lock c->root error + - usb: cdnsp: Fix deadlock issue during using NCM gadget + - USB: serial: option: add Fibocom L7xx modules + - USB: serial: option: fix FM101R-GL defines + - USB: serial: option: don't claim interface 4 for ZTE MF290 + - usb: typec: tcpm: Skip hard reset when in error recovery + - USB: dwc2: write HCINT with INTMASK applied + - usb: dwc3: Fix default mode initialization + - usb: dwc3: set the dma max_seg_size + - USB: dwc3: qcom: fix software node leak on probe errors + - USB: dwc3: qcom: fix wakeup after probe deferral + - io_uring: fix off-by one bvec index + - Linux 5.15.141 + * Jammy update: v5.15.140 upstream stable release (LP: #2050038) + - locking/ww_mutex/test: Fix potential workqueue corruption + - perf/core: Bail out early if the request AUX area is out of bound + - clocksource/drivers/timer-imx-gpt: Fix potential memory leak + - clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware + - workqueue: Provide one lock class key per work_on_cpu() callsite + - x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size + - wifi: mac80211_hwsim: fix clang-specific fortify warning + - wifi: mac80211: don't return unset power in ieee80211_get_tx_power() + - atl1c: Work around the DMA RX overflow issue + - bpf: Detect IP == ksym.end as part of BPF program + - wifi: ath9k: fix clang-specific fortify warnings + - wifi: ath10k: fix clang-specific fortify warning + - net: annotate data-races around sk->sk_tx_queue_mapping + - net: annotate data-races around sk->sk_dst_pending_confirm + - wifi: ath10k: Don't touch the CE interrupt registers after power up + - Bluetooth: btusb: Add date->evt_skb is NULL check + - Bluetooth: Fix double free in hci_conn_cleanup + - platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e + - drm/komeda: drop all currently held locks if deadlock happens + - drm/amdkfd: Fix a race condition of vram buffer unref in svm code + - drm/amd/display: use full update for clip size increase of large plane + source + - string.h: add array-wrappers for (v)memdup_user() + - kernel: kexec: copy user-array safely + - kernel: watch_queue: copy user-array safely + - drm: vmwgfx_surface.c: copy user-array safely + - drm/msm/dp: skip validity check for DP CTS EDID checksum + - drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 + - drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga + - drm/amdgpu: Fix potential null pointer derefernce + - drm/panel: fix a possible null pointer dereference + - drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference + - drm/amdgpu/vkms: fix a possible null pointer dereference + - drm/panel: st7703: Pick different reset sequence + - drm/amdkfd: Fix shift out-of-bounds issue + - drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL + - arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size + - selftests/efivarfs: create-read: fix a resource leak + - ASoC: soc-card: Add storage for PCI SSID + - crypto: pcrypt - Fix hungtask for PADATA_RESET + - RDMA/hfi1: Use FIELD_GET() to extract Link Width + - scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs + - scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool + - fs/jfs: Add check for negative db_l2nbperpage + - fs/jfs: Add validity check for db_maxag and db_agpref + - jfs: fix array-index-out-of-bounds in dbFindLeaf + - jfs: fix array-index-out-of-bounds in diAlloc + - HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround + - ARM: 9320/1: fix stack depot IRQ stack filter + - ALSA: hda: Fix possible null-ptr-deref when assigning a stream + - PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields + - atm: iphase: Do PCI error checks on own line + - scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() + - PCI: Use FIELD_GET() to extract Link Width + - PCI: Extract ATS disabling to a helper function + - PCI: Disable ATS for specific Intel IPU E2000 devices + - misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller + - PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk + - HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W + - exfat: support handle zero-size directory + - tty: vcc: Add check for kstrdup() in vcc_probe() + - usb: gadget: f_ncm: Always set current gadget in ncm_bind() + - 9p/trans_fd: Annotate data-racy writes to file::f_flags + - 9p: v9fs_listxattr: fix %s null argument warning + - i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler + - i2c: sun6i-p2wi: Prevent potential division by zero + - virtio-blk: fix implicit overflow on virtio_max_dma_size + - i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data. + - media: gspca: cpia1: shift-out-of-bounds in set_flicker + - media: vivid: avoid integer overflow + - gfs2: ignore negated quota changes + - gfs2: fix an oops in gfs2_permission + - media: cobalt: Use FIELD_GET() to extract Link Width + - media: ccs: Fix driver quirk struct documentation + - media: imon: fix access to invalid resource for the second interface + - drm/amd/display: Avoid NULL dereference of timing generator + - kgdb: Flush console before entering kgdb on panic + - i2c: dev: copy userspace array safely + - ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings + - drm/qxl: prevent memory leak + - drm/amdgpu: fix software pci_unplug on some chips + - pwm: Fix double shift bug + - wifi: iwlwifi: Use FW rate for non-data frames + - tracing: Reuse logic from perf's get_recursion_context() + - tracing/perf: Add interrupt_context_level() helper + - sched/core: Optimize in_task() and in_interrupt() a bit + - media: cadence: csi2rx: Unregister v4l2 async notifier + - media: cec: meson: always include meson sub-directory in Makefile + - SUNRPC: ECONNRESET might require a rebind + - SUNRPC: Add an IS_ERR() check back to where it was + - NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO + - SUNRPC: Fix RPC client cleaned up the freed pipefs dentries + - gfs2: Silence "suspicious RCU usage in gfs2_permission" warning + - mptcp: diag: switch to context structure + - mptcp: listen diag dump support + - net: inet: Remove count from inet_listen_hashbucket + - net: inet: Open code inet_hash2 and inet_unhash2 + - net: inet: Retire port only listening_hash + - net: set SOCK_RCU_FREE before inserting socket into hashtable + - ipvlan: add ipvlan_route_v6_outbound() helper + - tty: Fix uninit-value access in ppp_sync_receive() + - net: hns3: fix add VLAN fail issue + - net: hns3: refine the definition for struct hclge_pf_to_vf_msg + - net: hns3: add byte order conversion for PF to VF mailbox message + - net: hns3: add barrier in vf mailbox reply process + - net: hns3: fix incorrect capability bit display for copper port + - net: hns3: fix variable may not initialized problem in hns3_init_mac_addr() + - net: hns3: fix VF reset fail issue + - net: hns3: fix VF wrong speed and duplex issue + - tipc: Fix kernel-infoleak due to uninitialized TLV value + - ppp: limit MRU to 64K + - xen/events: fix delayed eoi list handling + - ptp: annotate data-race around q->head and q->tail + - bonding: stop the device in bond_setup_by_slave() + - net: ethernet: cortina: Fix max RX frame define + - net: ethernet: cortina: Handle large frames + - net: ethernet: cortina: Fix MTU max setting + - af_unix: fix use-after-free in unix_stream_read_actor() + - netfilter: nf_conntrack_bridge: initialize err to 0 + - netfilter: nf_tables: use the correct get/put helpers + - netfilter: nf_tables: add and use BE register load-store helpers + - netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() + - net: stmmac: fix rx budget limit check + - net/mlx5e: Remove incorrect addition of action fwd flag + - net/mlx5e: Move mod hdr allocation to a single place + - net/mlx5e: Refactor mod header management API + - net/mlx5e: Fix pedit endianness + - net/mlx5e: Reduce the size of icosq_str + - net/mlx5e: Check return value of snprintf writing to fw_version buffer for + representors + - macvlan: Don't propagate promisc change to lower dev in passthru + - tools/power/turbostat: Fix a knl bug + - tools/power/turbostat: Enable the C-state Pre-wake printing + - cifs: spnego: add ';' in HOST_KEY_LEN + - cifs: fix check of rc in function generate_smb3signingkey + - xfs: refactor buffer cancellation table allocation + - xfs: don't leak xfs_buf_cancel structures when recovery fails + - xfs: convert buf_cancel_table allocation to kmalloc_array + - xfs: use invalidate_lock to check the state of mmap_lock + - xfs: prevent a UAF when log IO errors race with unmount + - xfs: flush inode gc workqueue before clearing agi bucket + - xfs: fix use-after-free in xattr node block inactivation + - xfs: don't leak memory when attr fork loading fails + - xfs: fix intermittent hang during quotacheck + - xfs: add missing cmap->br_state = XFS_EXT_NORM update + - xfs: Fix false ENOSPC when performing direct write on a delalloc extent in + cow fork + - xfs: fix inode reservation space for removing transaction + - xfs: avoid a UAF when log intent item recovery fails + - xfs: fix exception caused by unexpected illegal bestcount in leaf dir + - xfs: fix memory leak in xfs_errortag_init + - xfs: Fix unreferenced object reported by kmemleak in xfs_sysfs_init() + - i915/perf: Fix NULL deref bugs with drm_dbg() calls + - media: venus: hfi: add checks to perform sanity on queue pointers + - powerpc/perf: Fix disabling BHRB and instruction sampling + - randstruct: Fix gcc-plugin performance mode to stay in group + - bpf: Fix check_stack_write_fixed_off() to correctly spill imm + - bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END + - scsi: mpt3sas: Fix loop logic + - scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for + selected registers + - scsi: qla2xxx: Fix system crash due to bad pointer access + - crypto: x86/sha - load modules based on CPU features + - x86/cpu/hygon: Fix the CPU topology evaluation for real + - KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space + - KVM: x86: Ignore MSR_AMD64_TW_CFG access + - audit: don't take task_lock() in audit_exe_compare() code path + - audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare() + - tty/sysrq: replace smp_processor_id() with get_cpu() + - hvc/xen: fix console unplug + - hvc/xen: fix error path in xen_hvc_init() to always register frontend driver + - hvc/xen: fix event channel handling for secondary consoles + - PCI/sysfs: Protect driver's D3cold preference from user space + - watchdog: move softlockup_panic back to early_param + - ACPI: resource: Do IRQ override on TongFang GMxXGxx + - arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer + - parisc/pdc: Add width field to struct pdc_model + - clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data + - clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - mmc: vub300: fix an error code + - mmc: sdhci_am654: fix start loop index for TAP value parsing + - PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() + - PCI: exynos: Don't discard .remove() callback + - wifi: wilc1000: use vmm_table as array in wilc struct + - svcrdma: Drop connection after an RDMA Read error + - rcu/tree: Defer setting of jiffies during stall reset + - arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM + - PM: hibernate: Use __get_safe_page() rather than touching the list + - PM: hibernate: Clean up sync_read handling in snapshot_write_next() + - rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects + - btrfs: don't arbitrarily slow down delalloc if we're committing + - firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit + - ACPI: FPDT: properly handle invalid FPDT subtables + - ima: annotate iint mutex to avoid lockdep false positive warnings + - ima: detect changes to the backing overlay file + - wifi: ath11k: fix temperature event locking + - wifi: ath11k: fix dfs radar event locking + - wifi: ath11k: fix htt pktlog locking + - mmc: meson-gx: Remove setting of CMD_CFG_ERROR + - genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware + - KEYS: trusted: Rollback init_trusted() consistently + - PCI: keystone: Don't discard .remove() callback + - PCI: keystone: Don't discard .probe() callback + - netfilter: nf_tables: split async and sync catchall in two functions + - selftests/resctrl: Remove duplicate feature check from CMT test + - selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests + - ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix + - jbd2: fix potential data lost in recovering journal raced with synchronizing + fs bdev + - quota: explicitly forbid quota files from being encrypted + - kernel/reboot: emergency_restart: Set correct system_state + - i2c: core: Run atomic i2c xfer when !preemptible + - tracing: Have the user copy of synthetic event address use correct context + - mcb: fix error handling for different scenarios when parsing + - dmaengine: stm32-mdma: correct desc prep when channel running + - s390/cmma: fix detection of DAT pages + - mm/cma: use nth_page() in place of direct struct page manipulation + - mm/memory_hotplug: use pfn math in place of direct struct page manipulation + - mtd: cfi_cmdset_0001: Byte swap OTP info + - i3c: master: cdns: Fix reading status register + - i3c: master: svc: fix race condition in ibi work thread + - i3c: master: svc: fix wrong data return when IBI happen during start frame + - i3c: master: svc: fix ibi may not return mandatory data byte + - i3c: master: svc: fix check wrong status register in irq handler + - i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen + - parisc: Prevent booting 64-bit kernels on PA1.x machines + - parisc/pgtable: Do not drop upper 5 address bits of physical address + - xhci: Enable RPM on controllers that support low-power states + - ALSA: info: Fix potential deadlock at disconnection + - ALSA: hda/realtek - Add Dell ALC295 to pin fall back table + - ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC + - serial: meson: Use platform_get_irq() to get the interrupt + - tty: serial: meson: fix hard LOCKUP on crtscts mode + - regmap: Ensure range selector registers are updated after cache sync + - cpufreq: stats: Fix buffer overflow detection in trans_stats() + - Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 + - bluetooth: Add device 0bda:887b to device tables + - bluetooth: Add device 13d3:3571 to device tables + - Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables + - Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE + - ksmbd: fix slab out of bounds write in smb_inherit_dacl() + - arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO + - arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size + - powerpc/pseries/ddw: simplify enable_ddw() + - Revert ncsi: Propagate carrier gain/loss events to the NCSI controller + - Revert "i2c: pxa: move to generic GPIO recovery" + - lsm: fix default return value for vm_enough_memory + - lsm: fix default return value for inode_getsecctx + - sbsa_gwdt: Calculate timeout with 64-bit math + - i2c: designware: Disable TX_EMPTY irq while waiting for block length byte + - s390/ap: fix AP bus crash on early config change callback invocation + - net: ethtool: Fix documentation of ethtool_sprintf() + - net: dsa: lan9303: consequently nested-lock physical MDIO + - net: phylink: initialize carrier state at creation + - i2c: i801: fix potential race in i801_block_transaction_byte_by_byte + - f2fs: avoid format-overflow warning + - media: lirc: drop trailing space from scancode transmit + - media: sharp: fix sharp encoding + - media: venus: hfi_parser: Add check to keep the number of codecs within + range + - media: venus: hfi: fix the check to handle session buffer requirement + - media: venus: hfi: add checks to handle capabilities from firmware + - media: ccs: Correctly initialise try compose rectangle + - nfsd: fix file memleak on client_opens_release + - riscv: kprobes: allow writing to x0 + - mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2 + - mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors + - r8169: fix network lost after resume on DASH systems + - mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER + - media: qcom: camss: Fix pm_domain_on sequence in probe + - media: qcom: camss: Fix vfe_get() error jump + - media: qcom: camss: Fix VFE-17x vfe_disable_output() + - media: qcom: camss: Fix missing vfe_lite clocks check + - ext4: apply umask if ACL support is disabled + - ext4: correct offset of gdb backup in non meta_bg group to update_backups + - ext4: correct return value of ext4_convert_meta_bg + - ext4: correct the start block of counting reserved clusters + - ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks + - ext4: add missed brelse in update_backups + - drm/amd/pm: Handle non-terminated overdrive commands. + - drm/i915: Fix potential spectre vulnerability + - drm/amdgpu: don't use ATRM for external devices + - drm/amdgpu: fix error handling in amdgpu_bo_list_get() + - drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox + - powerpc/powernv: Fix fortify source warnings in opal-prd.c + - tracing: Have trace_event_file have ref counters + - Input: xpad - add VID for Turtle Beach controllers + - driver core: Release all resources during unbind before updating device + links + - Linux 5.15.140 + * CVE-2023-46862 + - io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid + * Jammy update: v5.15.139 upstream stable release (LP: #2049432) + - iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user() + - sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 + - sched: Fix stop_one_cpu_nowait() vs hotplug + - vfs: fix readahead(2) on block devices + - writeback, cgroup: switch inodes with dirty timestamps to release dying + cgwbs + - x86/srso: Fix SBPB enablement for (possible) future fixed HW + - futex: Don't include process MM in futex key on no-MMU + - x86: Share definition of __is_canonical_address() + - x86/sev-es: Allow copy_from_kernel_nofault() in earlier boot + - x86/boot: Fix incorrect startup_gdt_descr.size + - pstore/platform: Add check for kstrdup + - genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() + - i40e: fix potential memory leaks in i40e_remove() + - selftests/bpf: Test tail call counting with bpf2bpf and data on stack + - selftests/bpf: Correct map_fd to data_fd in tailcalls + - udp: add missing WRITE_ONCE() around up->encap_rcv + - tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed + - gve: Use size_add() in call to struct_size() + - mlxsw: Use size_mul() in call to struct_size() + - tipc: Use size_add() in calls to struct_size() + - net: spider_net: Use size_add() in call to struct_size() + - wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file() + - wifi: mt76: mt7603: rework/fix rx pse hang check + - mt76: dma: use kzalloc instead of devm_kzalloc for txwi + - mt76: add support for overriding the device used for DMA mapping + - mt76: pass original queue id from __mt76_tx_queue_skb to the driver + - wifi: mt76: mt7603: improve stuck beacon handling + - tcp_metrics: add missing barriers on delete + - tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics() + - tcp_metrics: do not create an entry from tcp_init_metrics() + - wifi: rtlwifi: fix EDCA limit set by BT coexistence + - can: dev: can_restart(): don't crash kernel if carrier is OK + - can: dev: can_restart(): fix race condition between controller restart and + netif_carrier_on() + - can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is + accessed out of bounds + - PM / devfreq: rockchip-dfi: Make pmu regmap mandatory + - netfilter: nf_tables: Drop pointless memset when dumping rules + - thermal: core: prevent potential string overflow + - r8169: use tp_to_dev instead of open code + - r8169: fix rare issue with broken rx after link-down on RTL8125 + - chtls: fix tp->rcv_tstamp initialization + - tcp: fix cookie_init_timestamp() overflows + - iwlwifi: pcie: adjust to Bz completion descriptor + - wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues + - wifi: iwlwifi: pcie: synchronize IRQs before NAPI + - wifi: iwlwifi: empty overflow queue during flush + - ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() + - ipv6: avoid atomic fragment on GSO packets + - net: add DEV_STATS_READ() helper + - ipvlan: properly track tx_errors + - regmap: debugfs: Fix a erroneous check after snprintf() + - spi: tegra: Fix missing IRQ check in tegra_slink_probe() + - clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies + - clk: qcom: mmcc-msm8998: Don't check halt bit on some branch clks + - clk: qcom: mmcc-msm8998: Fix the SMMU GDSC + - clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src + - clk: imx: Select MXC_CLK for CLK_IMX8QXP + - clk: imx: imx8mq: correct error handling path + - clk: imx: imx8qxp: Fix elcdif_pll clock + - clk: renesas: rzg2l: Simplify multiplication/shift logic + - clk: renesas: rzg2l: Use FIELD_GET() for PLL register fields + - clk: renesas: rzg2l: Fix computation formula + - spi: nxp-fspi: use the correct ioremap function + - clk: keystone: pll: fix a couple NULL vs IS_ERR() checks + - clk: ti: Add ti_dt_clk_name() helper to use clock-output-names + - clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() + - clk: ti: Update component clocks to use ti_dt_clk_name() + - clk: ti: change ti_clk_register[_omap_hw]() API + - clk: ti: fix double free in of_ti_divider_clk_setup() + - clk: npcm7xx: Fix incorrect kfree + - clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data + - clk: qcom: config IPQ_APSS_6018 should depend on QCOM_SMEM + - platform/x86: wmi: Fix probe failure when failing to register WMI devices + - platform/x86: wmi: remove unnecessary initializations + - platform/x86: wmi: Fix opening of char device + - hwmon: (axi-fan-control) Fix possible NULL pointer dereference + - hwmon: (coretemp) Fix potentially truncated sysfs attribute name + - drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs + - drm/rockchip: vop: Fix call to crtc reset helper + - drm/radeon: possible buffer overflow + - drm/mipi-dsi: Create devm device registration + - drm/mipi-dsi: Create devm device attachment + - drm/bridge: lt8912b: Switch to devm MIPI-DSI helpers + - drm/bridge: lt8912b: Register and attach our DSI device at probe + - drm/bridge: lt8912b: Add hot plug detection + - drm/bridge: lt8912b: Fix bridge_detach + - drm/bridge: lt8912b: Fix crash on bridge detach + - drm/bridge: lt8912b: Manually disable HPD only if it was enabled + - drm/bridge: lt8912b: Add missing drm_bridge_attach call + - drm/bridge: tc358768: Fix use of uninitialized variable + - drm/bridge: tc358768: Disable non-continuous clock mode + - drm/bridge: tc358768: Fix bit updates + - drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code + - drm/mediatek: Fix iommu fault by swapping FBs after updating plane state + - drm/mediatek: Fix iommu fault during crtc enabling + - drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe() + - arm64/arm: xen: enlighten: Fix KPTI checks + - drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map() + - xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled + - drm/msm/dsi: use msm_gem_kernel_put to free TX buffer + - drm: mediatek: mtk_dsi: Fix NO_EOT_PACKET settings/handling + - perf: hisi: Fix use-after-free when register pmu fails + - ARM: dts: renesas: blanche: Fix typo in GP_11_2 pin name + - arm64: dts: qcom: msm8916: Fix iommu local address range + - arm64: dts: qcom: msm8992-libra: drop duplicated reserved memory + - arm64: dts: qcom: sc7280: Add missing LMH interrupts + - arm64: dts: qcom: sdm845-mtp: fix WiFi configuration + - ARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins + - arm64: dts: qcom: apq8016-sbc: Add missing ADV7533 regulators + - ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator + - soc: qcom: llcc: Handle a second device without data corruption + - firmware: ti_sci: Mark driver as non removable + - firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device + - clk: scmi: Free scmi_clk allocated when the clocks with invalid info are + skipped + - arm64: dts: imx8qm-ss-img: Fix jpegenc compatible entry + - arm64: dts: imx8mm: Add sound-dai-cells to micfil node + - arm64: dts: imx8mn: Add sound-dai-cells to micfil node + - selftests/pidfd: Fix ksft print formats + - selftests/resctrl: Ensure the benchmark commands fits to its array + - crypto: hisilicon/hpre - Fix a erroneous check after snprintf() + - hwrng: geode - fix accessing registers + - RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() + - scsi: ibmvfc: Fix erroneous use of rtas_busy_delay with hcall return code + - libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return + value + - nd_btt: Make BTT lanes preemptible + - crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure + - crypto: caam/jr - fix Chacha20 + Poly1305 self test failure + - crypto: qat - increase size of buffers + - hid: cp2112: Fix duplicate workqueue initialization + - ARM: 9321/1: memset: cast the constant byte to unsigned char + - ext4: move 'ix' sanity check to corrent position + - ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not + described + - IB/mlx5: Fix rdma counter binding for RAW QP + - RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common() + - RDMA/hns: Fix signed-unsigned mixed comparisons + - RDMA/hns: The UD mode can only be configured with DCQCN + - ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe + - scsi: ufs: core: Leave space for '\0' in utf8 desc string + - RDMA/hfi1: Workaround truncation compilation error + - hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip + - sh: bios: Revive earlyprintk support + - Revert "HID: logitech-hidpp: add a module parameter to keep firmware + gestures" + - HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk + - HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only + - HID: logitech-hidpp: Revert "Don't restart communication if not necessary" + - HID: logitech-hidpp: Move get_wireless_feature_index() check to + hidpp_connect_event() + - ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails + - padata: Fix refcnt handling in padata_free_shell() + - crypto: qat - fix deadlock in backlog processing + - ASoC: ams-delta.c: use component after check + - mfd: core: Un-constify mfd_cell.of_reg + - mfd: core: Ensure disabled devices are skipped without aborting + - mfd: dln2: Fix double put in dln2_probe + - mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs + - leds: turris-omnia: Drop unnecessary mutex locking + - leds: turris-omnia: Do not use SMBUS calls + - leds: pwm: Don't disable the PWM when the LED should be off + - leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu' + - f2fs: compress: fix to avoid use-after-free on dic + - f2fs: compress: fix to avoid redundant compress extension + - tty: tty_jobctrl: fix pid memleak in disassociate_ctty() + - livepatch: Fix missing newline character in klp_resolve_symbols() + - dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers + - usb: dwc2: fix possible NULL pointer dereference caused by driver + concurrency + - usb: chipidea: Fix DMA overwrite for Tegra + - usb: chipidea: Simplify Tegra DMA alignment code + - dmaengine: ti: edma: handle irq_of_parse_and_map() errors + - misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() + - tools: iio: iio_generic_buffer ensure alignment + - USB: usbip: fix stub_dev hub disconnect + - dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() + - f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() + - powerpc: Only define __parse_fpscr() when required + - modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host + - powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro + - powerpc/xive: Fix endian conversion size + - powerpc/imc-pmu: Use the correct spinlock initializer. + - powerpc/pseries: fix potential memory leak in init_cpu_associativity() + - usb: host: xhci-plat: fix possible kernel oops while resuming + - perf machine: Avoid out of bounds LBR memory read + - perf hist: Add missing puts to hist__account_cycles + - 9p/net: fix possible memory leak in p9_check_errors() + - i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs + - cxl/mem: Fix shutdown order + - rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call + - pcmcia: cs: fix possible hung task and memory leak pccardd() + - pcmcia: ds: fix refcount leak in pcmcia_device_add() + - pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() + - media: i2c: max9286: Fix some redundant of_node_put() calls + - media: bttv: fix use after free error due to btv->timeout timer + - media: s3c-camif: Avoid inappropriate kfree() + - media: vidtv: psi: Add check for kstrdup + - media: vidtv: mux: Add check and kfree for kstrdup + - media: cedrus: Fix clock/reset sequence + - media: dvb-usb-v2: af9035: fix missing unlock + - regmap: prevent noinc writes from clobbering cache + - pwm: sti: Reduce number of allocations and drop usage of chip_data + - pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume + - Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() + - llc: verify mac len before reading mac header + - hsr: Prevent use after free in prp_create_tagged_frame() + - tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING + - bpf: Check map->usercnt after timer->timer is assigned + - inet: shrink struct flowi_common + - octeontx2-pf: Fix error codes + - octeontx2-pf: Fix holes in error code + - dccp: Call security_inet_conn_request() after setting IPv4 addresses. + - dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses. + - Fix termination state for idr_for_each_entry_ul() + - net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs + - selftests: pmtu.sh: fix result checking + - net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT + - net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc + - net/smc: put sk reference if close work was canceled + - tg3: power down device only on SYSTEM_POWER_OFF + - block: remove unneeded return value of bio_check_ro() + - blk-core: use pr_warn_ratelimited() in bio_check_ro() + - r8169: respect userspace disabling IFF_MULTICAST + - i2c: iproc: handle invalid slave state + - netfilter: xt_recent: fix (increase) ipv6 literal buffer length + - netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate + eval call-backs + - netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses + - drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE + - ASoC: hdmi-codec: register hpd callback on component probe + - spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies + - fbdev: imsttfb: Fix error path of imsttfb_probe() + - fbdev: imsttfb: fix a resource leak in probe + - fbdev: fsl-diu-fb: mark wr_reg_wa() static + - tracing/kprobes: Fix the order of argument descriptions + - btrfs: use u64 for buffer sizes in the tree search ioctls + - Linux 5.15.139 + * Jammy update: v5.15.138 upstream stable release (LP: #2049417) + - ASoC: codecs: wcd938x: fix resource leaks on bind errors + - ASoC: codecs: wcd938x: fix runtime PM imbalance on remove + - pinctrl: qcom: lpass-lpi: fix concurrent register updates + - tcp: remove dead code from tcp_sendmsg_locked() + - tcp: cleanup tcp_remove_empty_skb() use + - mptcp: more conservative check for zero probes + - mcb: Return actual parsed size when reading chameleon table + - mcb-lpc: Reallocate memory region to avoid memory overlapping + - virtio_balloon: Fix endless deflation and inflation on arm64 + - virtio-mmio: fix memory leak of vm_dev + - vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE + - mm/page_alloc: correct start page when guard page debug is enabled + - mm/migrate: fix do_pages_move for compat pointers + - nfsd: lock_rename() needs both directories to live on the same fs + - drm/i915/pmu: Check if pmu is closed before stopping event + - vsock/virtio: factor our the code to initialize and delete VQs + - vsock/virtio: add support for device suspend/resume + - vsock/virtio: initialize the_virtio_vsock before using VQs + - drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() + - firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels() + - r8169: fix the KCSAN reported data-race in rtl_tx() while reading tp->cur_tx + - r8169: fix the KCSAN reported data-race in rtl_tx while reading + TxDescArray[entry].opts1 + - r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1 + - i40e: Fix I40E_FLAG_VF_VLAN_PRUNING value + - treewide: Spelling fix in comment + - igb: Fix potential memory leak in igb_add_ethtool_nfc_entry + - neighbour: fix various data-races + - igc: Fix ambiguity in the ethtool advertising + - net: ieee802154: adf7242: Fix some potential buffer overflow in + adf7242_stats_show() + - net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg + - r8152: Increase USB control msg timeout to 5000ms as per spec + - r8152: Run the unload routine if we have errors during probe + - r8152: Cancel hw_phy_work if we have an error in probe + - r8152: Release firmware if we have an error in probe + - tcp: fix wrong RTO timeout when received SACK reneging + - gtp: uapi: fix GTPA_MAX + - gtp: fix fragmentation needed check with gso + - i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR + - kasan: print the original fault addr when access invalid shadow + - iio: exynos-adc: request second interupt only when touchscreen mode is used + - iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds + - iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale + - i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: stm32f7: Fix PEC handling in case of SMBUS transfers + - i2c: aspeed: Fix i2c bus hang in slave read + - tracing/kprobes: Fix the description of variable length arguments + - misc: fastrpc: Clean buffers on remote invocation failures + - nvmem: imx: correct nregs for i.MX6ULL + - nvmem: imx: correct nregs for i.MX6SLL + - nvmem: imx: correct nregs for i.MX6UL + - perf/core: Fix potential NULL deref + - sparc32: fix a braino in fault handling in csum_and_copy_..._user() + - clk: Sanitize possible_parent_show to Handle Return Value of + of_clk_get_parent_name + - iio: afe: rescale: reorder includes + - iio: afe: rescale: expose scale processing function + - iio: afe: rescale: add offset support + - iio: afe: rescale: Accept only offset channels + - gve: Fix GFP flags when allocing pages + - x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility + - x86/mm: Simplify RESERVE_BRK() + - x86/mm: Fix RESERVE_BRK() for older binutils + - ext4: add two helper functions extent_logical_end() and pa_logical_end() + - ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow + - ext4: avoid overlapping preallocations due to overflow + - objtool/x86: add missing embedded_insn check + - driver: platform: Add helper for safer setting of driver_override + - rpmsg: Constify local variable in field store macro + - rpmsg: Fix kfree() of static memory on setting driver_override + - rpmsg: Fix calling device_lock() on non-initialized device + - rpmsg: glink: Release driver_override + - rpmsg: Fix possible refcount leak in rpmsg_register_device_override() + - x86: Fix .brk attribute in linker script + - ASoC: simple-card: fixup asoc_simple_probe() error handling + - net: sched: cls_u32: Fix allocation size in u32_init() + - irqchip/riscv-intc: Mark all INTC nodes as initialized + - irqchip/stm32-exti: add missing DT IRQ flag translation + - dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe + - powerpc/85xx: Fix math emulation exception + - Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport + - fbdev: atyfb: only use ioremap_uc() on i386 and ia64 + - fs/ntfs3: Add ckeck in ni_update_parent() + - fs/ntfs3: Write immediately updated ntfs state + - fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) + - fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() + - fs/ntfs3: Fix NULL pointer dereference on error in attr_allocate_frame() + - fs/ntfs3: Fix directory element type detection + - fs/ntfs3: Avoid possible memory leak + - spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 + - netfilter: nfnetlink_log: silence bogus compiler warning + - ASoC: rt5650: fix the wrong result of key button + - drm/ttm: Reorder sys manager cleanup step + - fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit() + - scsi: mpt3sas: Fix in error path + - platform/mellanox: mlxbf-tmfifo: Fix a warning message + - net: chelsio: cxgb4: add an error code check in t4_load_phy_fw + - r8152: Check for unplug in rtl_phy_patch_request() + - r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() + - powerpc/mm: Fix boot crash with FLATMEM + - can: isotp: set max PDU size to 64 kByte + - can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting + - can: isotp: check CAN address family in isotp_bind() + - can: isotp: handle wait_event_interruptible() return values + - can: isotp: add local echo tx processing and tx without FC + - can: isotp: isotp_bind(): do not validate unused address information + - can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior + - drm/amd: Move helper for dynamic speed switch check out of smu13 + - drm/amd: Disable ASPM for VI w/ all Intel systems + - PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device + - usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" + compatibility + - usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() + - usb: raw-gadget: properly handle interrupted requests + - tty: n_gsm: fix race condition in status line change on dead connections + - tty: 8250: Remove UC-257 and UC-431 + - tty: 8250: Add support for additional Brainboxes UC cards + - tty: 8250: Add support for Brainboxes UP cards + - tty: 8250: Add support for Intashield IS-100 + - tty: 8250: Fix port count of PX-257 + - tty: 8250: Fix up PX-803/PX-857 + - tty: 8250: Add support for additional Brainboxes PX cards + - tty: 8250: Add support for Intashield IX cards + - tty: 8250: Add Brainboxes Oxford Semiconductor-based quirks + - misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support + - ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection + - Linux 5.15.138 + * Jammy update: v5.15.137 upstream stable release (LP: #2049350) + - lib/Kconfig.debug: do not enable DEBUG_PREEMPT by default + - Documentation: sysctl: align cells in second content column + - xfs: don't expose internal symlink metadata buffers to the vfs + - Bluetooth: hci_event: Ignore NULL link key + - Bluetooth: Reject connection with the device which has same BD_ADDR + - Bluetooth: Fix a refcnt underflow problem for hci_conn + - Bluetooth: vhci: Fix race when opening vhci device + - Bluetooth: hci_event: Fix coding style + - Bluetooth: avoid memcmp() out of bounds warning + - ice: fix over-shifted variable + - ice: reset first in crash dump kernels + - nfc: nci: fix possible NULL pointer dereference in send_acknowledge() + - regmap: fix NULL deref on lookup + - KVM: x86: Mask LVTPC when handling a PMI + - tcp: check mptcp-level constraints for backlog coalescing + - fs/ntfs3: Fix possible null-pointer dereference in hdr_find_e() + - fs/ntfs3: fix panic about slab-out-of-bounds caused by ntfs_list_ea() + - fs/ntfs3: fix deadlock in mark_as_free_ex + - netfilter: nft_payload: fix wrong mac header matching + - drm/i915: Retry gtt fault when out of fence registers + - ASoC: codecs: wcd938x-sdw: fix use after free on driver unbind + - ASoC: codecs: wcd938x-sdw: fix runtime PM imbalance on probe errors + - ASoC: codecs: wcd938x: drop bogus bind error handling + - ASoC: codecs: wcd938x: fix unbind tear down order + - qed: fix LL2 RX buffer allocation + - xfrm: fix a data-race in xfrm_gen_index() + - xfrm: interface: use DEV_STATS_INC() + - net: ipv4: fix return value check in esp_remove_trailer + - net: ipv6: fix return value check in esp_remove_trailer + - net: rfkill: gpio: prevent value glitch during probe + - tcp: fix excessive TLP and RACK timeouts from HZ rounding + - tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb + - tun: prevent negative ifindex + - ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr + - net: usb: smsc95xx: Fix an error code in smsc95xx_reset() + - i40e: prevent crash on probe if hw registers have invalid values + - net: dsa: bcm_sf2: Fix possible memory leak in bcm_sf2_mdio_register() + - bonding: Return pointer to data after pull on skb + - net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve + - neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section + - netfilter: nft_set_rbtree: .deactivate fails if element has expired + - netfilter: nf_tables: do not remove elements if set backend implements + .abort + - netfilter: nf_tables: revert do not remove elements if set backend + implements .abort + - net: pktgen: Fix interface flags printing + - selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and + hugetlb_reparenting_test.sh that may cause error + - serial: 8250: omap: Fix imprecise external abort for omap_8250_pm() + - serial: 8250_omap: Fix errors with no_console_suspend + - iio: Un-inline iio_buffer_enabled() + - iio: core: Hide read accesses to iio_dev->currentmode + - iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs + - iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data() + - iio: adc: ad7192: Correct reference voltage + - perf: Add irq and exception return branch types + - perf/x86: Move branch classifier + - perf/x86/lbr: Filter vsyscall addresses + - drm/atomic-helper: relax unregistered connector check + - powerpc/32s: Remove capability to disable KUEP at boottime + - powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly + - powerpc/47x: Fix 47x syscall return crash + - mctp: Allow local delivery to the null EID + - mctp: perform route lookups under a RCU read-side lock + - nfp: flower: avoid rmmod nfp crash issues + - ksmbd: not allow to open file if delelete on close bit is set + - ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone + - fs-writeback: do not requeue a clean inode having skipped pages + - btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 + - btrfs: initialize start_slot in btrfs_log_prealloc_extents + - i2c: mux: Avoid potential false error message in i2c_mux_add_adapter + - overlayfs: set ctime when setting mtime and atime + - gpio: timberdale: Fix potential deadlock on &tgpio->lock + - ata: libata-core: Fix compilation warning in ata_dev_config_ncq() + - ata: libata-eh: Fix compilation warning in ata_eh_link_report() + - tracing: relax trace_event_eval_update() execution with cond_resched() + - wifi: mwifiex: Sanity check tlv_len and tlv_bitmap_len + - wifi: iwlwifi: Ensure ack flag is properly cleared. + - HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event + - Bluetooth: btusb: add shutdown function for QCA6174 + - Bluetooth: Avoid redundant authentication + - Bluetooth: hci_core: Fix build warnings + - wifi: cfg80211: Fix 6GHz scan configuration + - wifi: mac80211: allow transmitting EAPOL frames with tainted key + - wifi: cfg80211: avoid leaking stack data into trace + - regulator/core: Revert "fix kobject release warning and memory leak in + regulator_register()" + - sky2: Make sure there is at least one frag_addr available + - ipv4/fib: send notify when delete source address routes + - drm: panel-orientation-quirks: Add quirk for One Mix 2S + - btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c + - btrfs: error out when COWing block using a stale transaction + - btrfs: error when COWing block from a root that is being deleted + - btrfs: error out when reallocating block for defrag using a stale + transaction + - HID: multitouch: Add required quirk for Synaptics 0xcd7e device + - platform/x86: touchscreen_dmi: Add info for the Positivo C4128B + - net/mlx5: Handle fw tracer change ownership event based on MTRC + - Bluetooth: hci_event: Fix using memcmp when comparing keys + - net: introduce a function to check if a netdev name is in use + - net: move from strlcpy with unused retval to strscpy + - net: fix ifname in netlink ntf during netns move + - mtd: rawnand: qcom: Unmap the right resource upon probe failure + - mtd: rawnand: pl353: Ensure program page operations are successful + - mtd: rawnand: marvell: Ensure program page operations are successful + - mtd: rawnand: arasan: Ensure program page operations are successful + - mtd: spinand: micron: correct bitmask for ecc status + - mtd: physmap-core: Restore map_rom fallback + - mmc: mtk-sd: Use readl_poll_timeout_atomic in msdc_reset_hw + - mmc: core: sdio: hold retuning if sdio in 1-bit mode + - pNFS: Fix a hang in nfs4_evict_inode() + - NFSv4.1: fixup use EXCHGID4_FLAG_USE_PNFS_DS for DS server + - ACPI: irq: Fix incorrect return value in acpi_register_gsi() + - nvme-pci: add BOGUS_NID for Intel 0a54 device + - nvme-rdma: do not try to stop unallocated queues + - USB: serial: option: add Telit LE910C4-WWX 0x1035 composition + - USB: serial: option: add entry for Sierra EM9191 with new firmware + - USB: serial: option: add Fibocom to DELL custom modem FM101R-GL + - s390/pci: fix iommu bitmap allocation + - selftests/ftrace: Add new test case which checks non unique symbol + - s390/cio: fix a memleak in css_alloc_subchannel + - platform/surface: platform_profile: Propagate error if profile registration + fails + - platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e + - platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events + - gpio: vf610: set value before the direction to avoid a glitch + - ASoC: pxa: fix a memory leak in probe() + - serial: 8250: omap: Move uart_write() inside PM section + - phy: mapphone-mdm6600: Fix runtime disable on probe + - phy: mapphone-mdm6600: Fix runtime PM for remove + - phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins + - Bluetooth: hci_sock: fix slab oob read in create_monitor_event + - Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name + - xfrm6: fix inet6_dev refcount underflow problem + - Linux 5.15.137 + * CVE-2023-51782 + - net/rose: Fix Use-After-Free in rose_ioctl + * CVE-2023-51779 + - Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg + * CVE-2023-22995 + - usb: dwc3: dwc3-qcom: Add missing platform_device_put() in + dwc3_qcom_acpi_register_core + * CVE-2023-4134 + - Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync() + * Packaging resync (LP: #1786013) + - [Packaging] update annotations scripts + + -- Stefan Bader Mon, 12 Feb 2024 14:52:30 +0100 + linux-lowlatency (5.15.0-97.107) jammy; urgency=medium * jammy/linux-lowlatency: 5.15.0-97.107 -proposed tracker (LP: #2052256) diff -u linux-lowlatency-5.15.0/debian.lowlatency/tracking-bug linux-lowlatency-5.15.0/debian.lowlatency/tracking-bug --- linux-lowlatency-5.15.0/debian.lowlatency/tracking-bug +++ linux-lowlatency-5.15.0/debian.lowlatency/tracking-bug @@ -1 +1 @@ -2052256 s2024.01.08-1 +2052079 2024.02.05-1 diff -u linux-lowlatency-5.15.0/debian.master/changelog linux-lowlatency-5.15.0/debian.master/changelog --- linux-lowlatency-5.15.0/debian.master/changelog +++ linux-lowlatency-5.15.0/debian.master/changelog @@ -1,15 +1,18 @@ -linux (5.15.0-97.107) jammy; urgency=medium +linux (5.15.0-100.110) jammy; urgency=medium - * jammy/linux: 5.15.0-97.107 -proposed tracker (LP: #2052600) + * jammy/linux: 5.15.0-100.110 -proposed tracker (LP: #2052616) - * Packaging resync (LP: #1786013) - - [Packaging] update annotations scripts + * i915 regression introduced with 5.5 kernel (LP: #2044131) + - drm/i915: Skip some timing checks on BXT/GLK DSI transcoders + + * Audio balancing setting doesn't work with the cirrus codec (LP: #2051050) + - ALSA: hda/cs8409: Suppress vmaster control for Dolphin models * partproke is broken on empty loopback device (LP: #2049689) - block: Move checking GENHD_FL_NO_PART to bdev_add_partition() - * CVE-2023-51781 - - appletalk: Fix Use-After-Free in atalk_ioctl + * CVE-2023-0340 + - vhost: use kzalloc() instead of kmalloc() followed by memset() * CVE-2023-51780 - atm: Fix Use-After-Free in do_vcc_ioctl @@ -17,13 +20,1135 @@ * CVE-2023-6915 - ida: Fix crash in ida_free when the bitmap is empty + * CVE-2024-0646 + - net: tls, update curr on splice as well + * CVE-2024-0565 - smb: client: fix OOB in receive_encrypted_standard() - * CVE-2024-0646 - - net: tls, update curr on splice as well + * CVE-2023-51781 + - appletalk: Fix Use-After-Free in atalk_ioctl + + * Jammy update: v5.15.143 upstream stable release (LP: #2050858) + - vdpa/mlx5: preserve CVQ vringh index + - hrtimers: Push pending hrtimers away from outgoing CPU earlier + - i2c: designware: Fix corrupted memory seen in the ISR + - netfilter: ipset: fix race condition between swap/destroy and kernel side + add/del/test + - tg3: Move the [rt]x_dropped counters to tg3_napi + - tg3: Increment tx_dropped in tg3_tso_bug() + - kconfig: fix memory leak from range properties + - drm/amdgpu: correct chunk_ptr to a pointer to chunk. + - platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum + - platform/x86: asus-wmi: Add support for ROG X13 tablet mode + - platform/x86: asus-wmi: Simplify tablet-mode-switch probing + - platform/x86: asus-wmi: Simplify tablet-mode-switch handling + - platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code + - of: dynamic: Fix of_reconfig_get_state_change() return value documentation + - platform/x86: wmi: Allow duplicate GUIDs for drivers that use struct + wmi_driver + - platform/x86: wmi: Skip blocks with zero instances + - ipv6: fix potential NULL deref in fib6_add() + - octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam + - octeontx2-af: Check return value of nix_get_nixlf before using nixlf + - hv_netvsc: rndis_filter needs to select NLS + - r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE + - r8152: Add RTL8152_INACCESSIBLE checks to more loops + - r8152: Add RTL8152_INACCESSIBLE to r8156b_wait_loading_flash() + - r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() + - r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() + - mlxbf-bootctl: correctly identify secure boot with development keys + - platform/mellanox: Add null pointer checks for devm_kasprintf() + - platform/mellanox: Check devm_hwmon_device_register_with_groups() return + value + - arcnet: restoring support for multiple Sohard Arcnet cards + - net: stmmac: fix FPE events losing + - octeontx2-af: fix a use-after-free in rvu_npa_register_reporters + - i40e: Fix unexpected MFS warning message + - net: bnxt: fix a potential use-after-free in bnxt_init_tc + - ionic: fix snprintf format length warning + - ionic: Fix dim work handling in split interrupt mode + - ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() + - net: hns: fix fake link up on xge port + - octeontx2-af: Update Tx link register range + - netfilter: nf_tables: validate family when identifying table via handle + - netfilter: xt_owner: Fix for unsafe access of sk->sk_socket + - tcp: do not accept ACK of bytes we never sent + - bpf: sockmap, updating the sg structure should also update curr + - psample: Require 'CAP_NET_ADMIN' when joining "packets" group + - net: add missing kdoc for struct genl_multicast_group::flags + - drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group + - tee: optee: Fix supplicant based device enumeration + - RDMA/hns: Fix unnecessary err return when using invalid congest control + algorithm + - RDMA/irdma: Do not modify to SQD on error + - RDMA/irdma: Add wait for suspend on SQD + - arm64: dts: rockchip: Expand reg size of vdec node for RK3399 + - RDMA/rtrs-srv: Do not unconditionally enable irq + - RDMA/rtrs-clt: Start hb after path_up + - RDMA/rtrs-srv: Check return values while processing info request + - RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true + - RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight + - RDMA/rtrs-clt: Fix the max_send_wr setting + - RDMA/rtrs-clt: Remove the warnings for req in_use check + - RDMA/bnxt_re: Correct module description string + - hwmon: (acpi_power_meter) Fix 4.29 MW bug + - hwmon: (nzxt-kraken2) Fix error handling path in kraken2_probe() + - ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate + - RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz + - RDMA/irdma: Avoid free the non-cqp_request scratch + - arm64: dts: imx8mq: drop usb3-resume-missing-cas from usb + - arm64: dts: imx8mp: imx8mq: Add parkmode-disable-ss-quirk on DWC3 + - ARM: dts: imx6ul-pico: Describe the Ethernet PHY clock + - tracing: Fix a warning when allocating buffered events fails + - scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() + - ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init + - ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt + - ARM: dts: imx28-xea: Pass the 'model' property + - riscv: fix misaligned access handling of C.SWSP and C.SDSP + - md: introduce md_ro_state + - md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly() + - kprobes: consistent rcu api usage for kretprobe holder + - nvme-pci: Add sleep quirk for Kingston drives + - io_uring: fix mutex_unlock with unreferenced ctx + - ALSA: usb-audio: Add Pioneer DJM-450 mixer controls + - ALSA: pcm: fix out-of-bounds in snd_pcm_state_names + - nilfs2: fix missing error check for sb_set_blocksize call + - nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() + - checkstack: fix printed address + - tracing: Always update snapshot buffer size + - tracing: Disable snapshot buffer when stopping instance tracers + - tracing: Fix incomplete locking when disabling buffered events + - tracing: Fix a possible race when disabling buffered events + - packet: Move reference count in packet_sock to atomic_long_t + - regmap: fix bogus error on regcache_sync success + - platform/surface: aggregator: fix recv_buf() return value + - arm64: dts: mediatek: mt7622: fix memory node warning check + - arm64: dts: mediatek: mt8183-kukui-jacuzzi: fix dsi unnecessary cells + properties + - arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names + - arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory + - binder: fix memory leaks of spam and pending work + - kallsyms: Make kallsyms_on_each_symbol generally available + - coresight: etm4x: Make etm4_remove_dev() return void + - coresight: etm4x: Remove bogous __exit annotation for some functions + - misc: mei: client.c: return negative error code in mei_cl_write + - misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write + - ring-buffer: Force absolute timestamp on discard of event + - tracing: Set actual size after ring buffer resize + - tracing: Stop current tracer when resizing buffer + - r8169: fix rtl8125b PAUSE frames blasting when suspended + - mm: fix oops when filemap_map_pmd() without prealloc_pte + - io_uring/af_unix: disable sending io_uring over sockets + - platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting + - docs/process/howto: Replace C89 with C11 + - tools headers UAPI: Sync linux/perf_event.h with the kernel sources + - arm64: dts: mediatek: align thermal zone node names with dtschema + - arm64: dts: mediatek: mt8183: Move thermal-zones to the root node + - arm64: dts: mediatek: add missing space before { + - arm64: dts: mt8183: kukui: Fix underscores in node names + - gpiolib: sysfs: Fix error handling on failed export + - drm/amd/amdgpu: Fix warnings in amdgpu/amdgpu_display.c + - drm/amdgpu: correct the amdgpu runtime dereference usage count + - usb: gadget: f_hid: fix report descriptor allocation + - parport: Add support for Brainboxes IX/UC/PX parallel cards + - usb: typec: class: fix typec_altmode_put_partner to put plugs + - ARM: PL011: Fix DMA support + - serial: sc16is7xx: address RX timeout interrupt errata + - serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit + - serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt + - serial: 8250_omap: Add earlycon support for the AM654 UART controller + - x86/CPU/AMD: Check vendor in the AMD microcode callback + - KVM: s390/mm: Properly reset no-dat + - KVM: SVM: Update EFER software model on CR0 trap for SEV-ES + - MIPS: Loongson64: Reserve vgabios memory on boot + - MIPS: Loongson64: Enable DMA noncoherent support + - cifs: Fix non-availability of dedup breaking generic/304 + - smb: client: fix potential NULL deref in parse_dfs_referrals() + - devcoredump : Serialize devcd_del work + - devcoredump: Send uevent once devcd is ready + - Linux 5.15.143 + + * Intel E810-XXV - NETDEV WATCHDOG: (ice): transmit queue timed out + (LP: #2036239) + - ice: Add feature bitmap, helpers and a check for DSCP + - ice: Add driver support for firmware changes for LAG + - ice: alter feature support check for SRIOV and LAG + + * Don't WARN_ON_ONCE() for a broken discovery table (LP: #2048404) + - perf/x86/uncore: Don't WARN_ON_ONCE() for a broken discovery table + + * Reject connection when malformed L2CAP signal packet is received + (LP: #2047634) + - Bluetooth: L2CAP: Send reject on command corrupted request + + * Jammy update: v5.15.142 upstream stable release (LP: #2050849) + - pinctrl: avoid reload of p state in list iteration + - firewire: core: fix possible memory leak in create_units() + - mmc: cqhci: Increase recovery halt timeout + - mmc: cqhci: Warn of halt or task clear failure + - mmc: cqhci: Fix task clearing in CQE error recovery + - mmc: block: Retry commands in CQE error recovery + - mmc: block: Do not lose cache flush during CQE error recovery + - mmc: block: Be sure to wait while busy in CQE error recovery + - ALSA: hda: Disable power-save on KONTRON SinglePC + - ALSA: hda/realtek: Headset Mic VREF to 100% + - ALSA: hda/realtek: Add supported ALC257 for ChromeOS + - dm-verity: align struct dm_verity_fec_io properly + - dm verity: don't perform FEC for failed readahead IO + - bcache: revert replacing IS_ERR_OR_NULL with IS_ERR + - iommu/vt-d: Add MTL to quirk list to skip TE disabling + - powerpc: Don't clobber f0/vs0 during fp|altivec register save + - parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes + - btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod() + - btrfs: fix off-by-one when checking chunk map includes logical address + - btrfs: send: ensure send_fd is writable + - btrfs: make error messages more clear when getting a chunk map + - Input: xpad - add HyperX Clutch Gladiate Support + - vlan: introduce vlan_dev_free_egress_priority + - vlan: move dev_put into vlan_dev_uninit + - rcu: Avoid tracing a few functions executed in stop machine + - hv_netvsc: fix race of netvsc and VF register_netdevice + - USB: core: Change configuration warnings to notices + - usb: config: fix iteration issue in 'usb_get_bos_descriptor()' + - dpaa2-eth: increase the needed headroom to account for alignment + - uapi: propagate __struct_group() attributes to the container union + - selftests/net: ipsec: fix constant out of range + - octeontx2-af: Fix possible buffer overflow + - net: stmmac: xgmac: Disable FPE MMC interrupts + - octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 + - Revert "workqueue: remove unused cancel_work()" + - r8169: prevent potential deadlock in rtl8169_close + - ravb: Fix races between ravb_tx_timeout_work() and net related ops + - net: ravb: Check return value of reset_control_deassert() + - net: ravb: Use pm_runtime_resume_and_get() + - net: ravb: Start TX queues after HW initialization succeeded + - net: ravb: Stop DMA in case of failures on ravb_open() + - perf intel-pt: Fix async branch flags + - selftests/resctrl: Add missing SPDX license to Makefile + - selftests/resctrl: Move _GNU_SOURCE define into Makefile + - smb3: fix touch -h of symlink + - ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header + - ASoC: SOF: sof-pci-dev: use community key on all Up boards + - ASoC: SOF: sof-pci-dev: add parameter to override topology filename + - ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks + - ASoC: SOF: sof-pci-dev: Fix community key quirk detection + - fbdev: stifb: Make the STI next font pointer a 32-bit signed offset + - fs: add ctime accessors infrastructure + - smb3: fix caching of ctime on setxattr + - cpufreq: imx6q: don't warn for disabling a non-existing frequency + - cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily + - iommu/vt-d: Omit devTLB invalidation requests when TES=0 + - iommu/vt-d: Make context clearing consistent with context mapping + - mmc: core: add helpers mmc_regulator_enable/disable_vqmmc + - mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled + - r8169: disable ASPM in case of tx timeout + - r8169: fix deadlock on RTL8125 in jumbo mtu mode + - iomap: update ki_pos a little later in iomap_dio_complete + - Linux 5.15.142 + + * Jammy update: v5.15.141 upstream stable release (LP: #2050044) + - afs: Fix afs_server_list to be cleaned up with RCU + - afs: Make error on cell lookup failure consistent with OpenAFS + - drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence + - drm/panel: auo,b101uan08.3: Fine tune the panel power sequence + - drm/panel: simple: Fix Innolux G101ICE-L01 bus flags + - drm/panel: simple: Fix Innolux G101ICE-L01 timings + - wireguard: use DEV_STATS_INC() + - octeontx2-pf: Fix memory leak during interface down + - ata: pata_isapnp: Add missing error check for devm_ioport_map() + - drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full + - HID: core: store the unique system identifier in hid_device + - HID: fix HID device resource race between HID core and debugging support + - ipv4: Correct/silence an endian warning in __ip_do_redirect + - net: usb: ax88179_178a: fix failed operations during ax88179_reset + - net/smc: avoid data corruption caused by decline + - arm/xen: fix xen_vcpu_info allocation alignment + - octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx + queue than its PF + - amd-xgbe: handle corner-case during sfp hotplug + - amd-xgbe: handle the corner-case during tx completion + - amd-xgbe: propagate the correct speed and duplex status + - net: axienet: Fix check for partial TX checksum + - afs: Return ENOENT if no cell DNS record can be found + - afs: Fix file locking on R/O volumes to operate in local mode + - nvmet: nul-terminate the NQNs passed in the connect command + - USB: dwc3: qcom: fix resource leaks on probe deferral + - USB: dwc3: qcom: fix ACPI platform device leak + - lockdep: Fix block chain corruption + - MIPS: KVM: Fix a build warning about variable set but not used + - media: camss: Replace hard coded value with parameter + - media: camss: sm8250: Virtual channels for CSID + - media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3 + - media: qcom: camss: Fix csid-gen2 for test pattern generator + - ext4: add a new helper to check if es must be kept + - ext4: factor out __es_alloc_extent() and __es_free_extent() + - ext4: use pre-allocated es in __es_insert_extent() + - ext4: use pre-allocated es in __es_remove_extent() + - ext4: using nofail preallocation in ext4_es_remove_extent() + - ext4: using nofail preallocation in ext4_es_insert_delayed_block() + - ext4: using nofail preallocation in ext4_es_insert_extent() + - ext4: fix slab-use-after-free in ext4_es_insert_extent() + - ext4: make sure allocate pending entry not fail + - proc: sysctl: prevent aliased sysctls from getting passed to init + - ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA + - swiotlb-xen: provide the "max_mapping_size" method + - bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in + btree_gc_coalesce() + - md: fix bi_status reporting in md_end_clone_io + - bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race + - io_uring/fs: consider link->flags when getting path for LINKAT + - s390/dasd: protect device queue against concurrent access + - USB: serial: option: add Luat Air72*U series products + - hv_netvsc: Fix race of register_netdevice_notifier and VF register + - hv_netvsc: Mark VF as slave before exposing it to user-mode + - dm-delay: fix a race between delay_presuspend and delay_bio + - bcache: check return value from btree_node_alloc_replacement() + - bcache: prevent potential division by zero error + - bcache: fixup init dirty data errors + - bcache: fixup lock c->root error + - usb: cdnsp: Fix deadlock issue during using NCM gadget + - USB: serial: option: add Fibocom L7xx modules + - USB: serial: option: fix FM101R-GL defines + - USB: serial: option: don't claim interface 4 for ZTE MF290 + - usb: typec: tcpm: Skip hard reset when in error recovery + - USB: dwc2: write HCINT with INTMASK applied + - usb: dwc3: Fix default mode initialization + - usb: dwc3: set the dma max_seg_size + - USB: dwc3: qcom: fix software node leak on probe errors + - USB: dwc3: qcom: fix wakeup after probe deferral + - io_uring: fix off-by one bvec index + - Linux 5.15.141 + + * Jammy update: v5.15.140 upstream stable release (LP: #2050038) + - locking/ww_mutex/test: Fix potential workqueue corruption + - perf/core: Bail out early if the request AUX area is out of bound + - clocksource/drivers/timer-imx-gpt: Fix potential memory leak + - clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware + - workqueue: Provide one lock class key per work_on_cpu() callsite + - x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size + - wifi: mac80211_hwsim: fix clang-specific fortify warning + - wifi: mac80211: don't return unset power in ieee80211_get_tx_power() + - atl1c: Work around the DMA RX overflow issue + - bpf: Detect IP == ksym.end as part of BPF program + - wifi: ath9k: fix clang-specific fortify warnings + - wifi: ath10k: fix clang-specific fortify warning + - net: annotate data-races around sk->sk_tx_queue_mapping + - net: annotate data-races around sk->sk_dst_pending_confirm + - wifi: ath10k: Don't touch the CE interrupt registers after power up + - Bluetooth: btusb: Add date->evt_skb is NULL check + - Bluetooth: Fix double free in hci_conn_cleanup + - platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e + - drm/komeda: drop all currently held locks if deadlock happens + - drm/amdkfd: Fix a race condition of vram buffer unref in svm code + - drm/amd/display: use full update for clip size increase of large plane + source + - string.h: add array-wrappers for (v)memdup_user() + - kernel: kexec: copy user-array safely + - kernel: watch_queue: copy user-array safely + - drm: vmwgfx_surface.c: copy user-array safely + - drm/msm/dp: skip validity check for DP CTS EDID checksum + - drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 + - drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga + - drm/amdgpu: Fix potential null pointer derefernce + - drm/panel: fix a possible null pointer dereference + - drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference + - drm/amdgpu/vkms: fix a possible null pointer dereference + - drm/panel: st7703: Pick different reset sequence + - drm/amdkfd: Fix shift out-of-bounds issue + - drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL + - arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size + - selftests/efivarfs: create-read: fix a resource leak + - ASoC: soc-card: Add storage for PCI SSID + - crypto: pcrypt - Fix hungtask for PADATA_RESET + - RDMA/hfi1: Use FIELD_GET() to extract Link Width + - scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs + - scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool + - fs/jfs: Add check for negative db_l2nbperpage + - fs/jfs: Add validity check for db_maxag and db_agpref + - jfs: fix array-index-out-of-bounds in dbFindLeaf + - jfs: fix array-index-out-of-bounds in diAlloc + - HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround + - ARM: 9320/1: fix stack depot IRQ stack filter + - ALSA: hda: Fix possible null-ptr-deref when assigning a stream + - PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields + - atm: iphase: Do PCI error checks on own line + - scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() + - PCI: Use FIELD_GET() to extract Link Width + - PCI: Extract ATS disabling to a helper function + - PCI: Disable ATS for specific Intel IPU E2000 devices + - misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller + - PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk + - HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W + - exfat: support handle zero-size directory + - tty: vcc: Add check for kstrdup() in vcc_probe() + - usb: gadget: f_ncm: Always set current gadget in ncm_bind() + - 9p/trans_fd: Annotate data-racy writes to file::f_flags + - 9p: v9fs_listxattr: fix %s null argument warning + - i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler + - i2c: sun6i-p2wi: Prevent potential division by zero + - virtio-blk: fix implicit overflow on virtio_max_dma_size + - i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data. + - media: gspca: cpia1: shift-out-of-bounds in set_flicker + - media: vivid: avoid integer overflow + - gfs2: ignore negated quota changes + - gfs2: fix an oops in gfs2_permission + - media: cobalt: Use FIELD_GET() to extract Link Width + - media: ccs: Fix driver quirk struct documentation + - media: imon: fix access to invalid resource for the second interface + - drm/amd/display: Avoid NULL dereference of timing generator + - kgdb: Flush console before entering kgdb on panic + - i2c: dev: copy userspace array safely + - ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings + - drm/qxl: prevent memory leak + - drm/amdgpu: fix software pci_unplug on some chips + - pwm: Fix double shift bug + - wifi: iwlwifi: Use FW rate for non-data frames + - tracing: Reuse logic from perf's get_recursion_context() + - tracing/perf: Add interrupt_context_level() helper + - sched/core: Optimize in_task() and in_interrupt() a bit + - media: cadence: csi2rx: Unregister v4l2 async notifier + - media: cec: meson: always include meson sub-directory in Makefile + - SUNRPC: ECONNRESET might require a rebind + - SUNRPC: Add an IS_ERR() check back to where it was + - NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO + - SUNRPC: Fix RPC client cleaned up the freed pipefs dentries + - gfs2: Silence "suspicious RCU usage in gfs2_permission" warning + - mptcp: diag: switch to context structure + - mptcp: listen diag dump support + - net: inet: Remove count from inet_listen_hashbucket + - net: inet: Open code inet_hash2 and inet_unhash2 + - net: inet: Retire port only listening_hash + - net: set SOCK_RCU_FREE before inserting socket into hashtable + - ipvlan: add ipvlan_route_v6_outbound() helper + - tty: Fix uninit-value access in ppp_sync_receive() + - net: hns3: fix add VLAN fail issue + - net: hns3: refine the definition for struct hclge_pf_to_vf_msg + - net: hns3: add byte order conversion for PF to VF mailbox message + - net: hns3: add barrier in vf mailbox reply process + - net: hns3: fix incorrect capability bit display for copper port + - net: hns3: fix variable may not initialized problem in hns3_init_mac_addr() + - net: hns3: fix VF reset fail issue + - net: hns3: fix VF wrong speed and duplex issue + - tipc: Fix kernel-infoleak due to uninitialized TLV value + - ppp: limit MRU to 64K + - xen/events: fix delayed eoi list handling + - ptp: annotate data-race around q->head and q->tail + - bonding: stop the device in bond_setup_by_slave() + - net: ethernet: cortina: Fix max RX frame define + - net: ethernet: cortina: Handle large frames + - net: ethernet: cortina: Fix MTU max setting + - af_unix: fix use-after-free in unix_stream_read_actor() + - netfilter: nf_conntrack_bridge: initialize err to 0 + - netfilter: nf_tables: use the correct get/put helpers + - netfilter: nf_tables: add and use BE register load-store helpers + - netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() + - net: stmmac: fix rx budget limit check + - net/mlx5e: Remove incorrect addition of action fwd flag + - net/mlx5e: Move mod hdr allocation to a single place + - net/mlx5e: Refactor mod header management API + - net/mlx5e: Fix pedit endianness + - net/mlx5e: Reduce the size of icosq_str + - net/mlx5e: Check return value of snprintf writing to fw_version buffer for + representors + - macvlan: Don't propagate promisc change to lower dev in passthru + - tools/power/turbostat: Fix a knl bug + - tools/power/turbostat: Enable the C-state Pre-wake printing + - cifs: spnego: add ';' in HOST_KEY_LEN + - cifs: fix check of rc in function generate_smb3signingkey + - xfs: refactor buffer cancellation table allocation + - xfs: don't leak xfs_buf_cancel structures when recovery fails + - xfs: convert buf_cancel_table allocation to kmalloc_array + - xfs: use invalidate_lock to check the state of mmap_lock + - xfs: prevent a UAF when log IO errors race with unmount + - xfs: flush inode gc workqueue before clearing agi bucket + - xfs: fix use-after-free in xattr node block inactivation + - xfs: don't leak memory when attr fork loading fails + - xfs: fix intermittent hang during quotacheck + - xfs: add missing cmap->br_state = XFS_EXT_NORM update + - xfs: Fix false ENOSPC when performing direct write on a delalloc extent in + cow fork + - xfs: fix inode reservation space for removing transaction + - xfs: avoid a UAF when log intent item recovery fails + - xfs: fix exception caused by unexpected illegal bestcount in leaf dir + - xfs: fix memory leak in xfs_errortag_init + - xfs: Fix unreferenced object reported by kmemleak in xfs_sysfs_init() + - i915/perf: Fix NULL deref bugs with drm_dbg() calls + - media: venus: hfi: add checks to perform sanity on queue pointers + - powerpc/perf: Fix disabling BHRB and instruction sampling + - randstruct: Fix gcc-plugin performance mode to stay in group + - bpf: Fix check_stack_write_fixed_off() to correctly spill imm + - bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END + - scsi: mpt3sas: Fix loop logic + - scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for + selected registers + - scsi: qla2xxx: Fix system crash due to bad pointer access + - crypto: x86/sha - load modules based on CPU features + - x86/cpu/hygon: Fix the CPU topology evaluation for real + - KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space + - KVM: x86: Ignore MSR_AMD64_TW_CFG access + - audit: don't take task_lock() in audit_exe_compare() code path + - audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare() + - tty/sysrq: replace smp_processor_id() with get_cpu() + - hvc/xen: fix console unplug + - hvc/xen: fix error path in xen_hvc_init() to always register frontend driver + - hvc/xen: fix event channel handling for secondary consoles + - PCI/sysfs: Protect driver's D3cold preference from user space + - watchdog: move softlockup_panic back to early_param + - ACPI: resource: Do IRQ override on TongFang GMxXGxx + - arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer + - parisc/pdc: Add width field to struct pdc_model + - clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data + - clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - mmc: vub300: fix an error code + - mmc: sdhci_am654: fix start loop index for TAP value parsing + - PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() + - PCI: exynos: Don't discard .remove() callback + - wifi: wilc1000: use vmm_table as array in wilc struct + - svcrdma: Drop connection after an RDMA Read error + - rcu/tree: Defer setting of jiffies during stall reset + - arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM + - PM: hibernate: Use __get_safe_page() rather than touching the list + - PM: hibernate: Clean up sync_read handling in snapshot_write_next() + - rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects + - btrfs: don't arbitrarily slow down delalloc if we're committing + - firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit + - ACPI: FPDT: properly handle invalid FPDT subtables + - ima: annotate iint mutex to avoid lockdep false positive warnings + - ima: detect changes to the backing overlay file + - wifi: ath11k: fix temperature event locking + - wifi: ath11k: fix dfs radar event locking + - wifi: ath11k: fix htt pktlog locking + - mmc: meson-gx: Remove setting of CMD_CFG_ERROR + - genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware + - KEYS: trusted: Rollback init_trusted() consistently + - PCI: keystone: Don't discard .remove() callback + - PCI: keystone: Don't discard .probe() callback + - netfilter: nf_tables: split async and sync catchall in two functions + - selftests/resctrl: Remove duplicate feature check from CMT test + - selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests + - ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix + - jbd2: fix potential data lost in recovering journal raced with synchronizing + fs bdev + - quota: explicitly forbid quota files from being encrypted + - kernel/reboot: emergency_restart: Set correct system_state + - i2c: core: Run atomic i2c xfer when !preemptible + - tracing: Have the user copy of synthetic event address use correct context + - mcb: fix error handling for different scenarios when parsing + - dmaengine: stm32-mdma: correct desc prep when channel running + - s390/cmma: fix detection of DAT pages + - mm/cma: use nth_page() in place of direct struct page manipulation + - mm/memory_hotplug: use pfn math in place of direct struct page manipulation + - mtd: cfi_cmdset_0001: Byte swap OTP info + - i3c: master: cdns: Fix reading status register + - i3c: master: svc: fix race condition in ibi work thread + - i3c: master: svc: fix wrong data return when IBI happen during start frame + - i3c: master: svc: fix ibi may not return mandatory data byte + - i3c: master: svc: fix check wrong status register in irq handler + - i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen + - parisc: Prevent booting 64-bit kernels on PA1.x machines + - parisc/pgtable: Do not drop upper 5 address bits of physical address + - xhci: Enable RPM on controllers that support low-power states + - ALSA: info: Fix potential deadlock at disconnection + - ALSA: hda/realtek - Add Dell ALC295 to pin fall back table + - ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC + - serial: meson: Use platform_get_irq() to get the interrupt + - tty: serial: meson: fix hard LOCKUP on crtscts mode + - regmap: Ensure range selector registers are updated after cache sync + - cpufreq: stats: Fix buffer overflow detection in trans_stats() + - Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 + - bluetooth: Add device 0bda:887b to device tables + - bluetooth: Add device 13d3:3571 to device tables + - Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables + - Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE + - ksmbd: fix slab out of bounds write in smb_inherit_dacl() + - arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO + - arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size + - powerpc/pseries/ddw: simplify enable_ddw() + - Revert ncsi: Propagate carrier gain/loss events to the NCSI controller + - Revert "i2c: pxa: move to generic GPIO recovery" + - lsm: fix default return value for vm_enough_memory + - lsm: fix default return value for inode_getsecctx + - sbsa_gwdt: Calculate timeout with 64-bit math + - i2c: designware: Disable TX_EMPTY irq while waiting for block length byte + - s390/ap: fix AP bus crash on early config change callback invocation + - net: ethtool: Fix documentation of ethtool_sprintf() + - net: dsa: lan9303: consequently nested-lock physical MDIO + - net: phylink: initialize carrier state at creation + - i2c: i801: fix potential race in i801_block_transaction_byte_by_byte + - f2fs: avoid format-overflow warning + - media: lirc: drop trailing space from scancode transmit + - media: sharp: fix sharp encoding + - media: venus: hfi_parser: Add check to keep the number of codecs within + range + - media: venus: hfi: fix the check to handle session buffer requirement + - media: venus: hfi: add checks to handle capabilities from firmware + - media: ccs: Correctly initialise try compose rectangle + - nfsd: fix file memleak on client_opens_release + - riscv: kprobes: allow writing to x0 + - mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2 + - mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors + - r8169: fix network lost after resume on DASH systems + - mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER + - media: qcom: camss: Fix pm_domain_on sequence in probe + - media: qcom: camss: Fix vfe_get() error jump + - media: qcom: camss: Fix VFE-17x vfe_disable_output() + - media: qcom: camss: Fix missing vfe_lite clocks check + - ext4: apply umask if ACL support is disabled + - ext4: correct offset of gdb backup in non meta_bg group to update_backups + - ext4: correct return value of ext4_convert_meta_bg + - ext4: correct the start block of counting reserved clusters + - ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks + - ext4: add missed brelse in update_backups + - drm/amd/pm: Handle non-terminated overdrive commands. + - drm/i915: Fix potential spectre vulnerability + - drm/amdgpu: don't use ATRM for external devices + - drm/amdgpu: fix error handling in amdgpu_bo_list_get() + - drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox + - powerpc/powernv: Fix fortify source warnings in opal-prd.c + - tracing: Have trace_event_file have ref counters + - Input: xpad - add VID for Turtle Beach controllers + - driver core: Release all resources during unbind before updating device + links + - Linux 5.15.140 + + * CVE-2023-46862 + - io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid + + * Jammy update: v5.15.139 upstream stable release (LP: #2049432) + - iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user() + - sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 + - sched: Fix stop_one_cpu_nowait() vs hotplug + - vfs: fix readahead(2) on block devices + - writeback, cgroup: switch inodes with dirty timestamps to release dying + cgwbs + - x86/srso: Fix SBPB enablement for (possible) future fixed HW + - futex: Don't include process MM in futex key on no-MMU + - x86: Share definition of __is_canonical_address() + - x86/sev-es: Allow copy_from_kernel_nofault() in earlier boot + - x86/boot: Fix incorrect startup_gdt_descr.size + - pstore/platform: Add check for kstrdup + - genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() + - i40e: fix potential memory leaks in i40e_remove() + - selftests/bpf: Test tail call counting with bpf2bpf and data on stack + - selftests/bpf: Correct map_fd to data_fd in tailcalls + - udp: add missing WRITE_ONCE() around up->encap_rcv + - tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed + - gve: Use size_add() in call to struct_size() + - mlxsw: Use size_mul() in call to struct_size() + - tipc: Use size_add() in calls to struct_size() + - net: spider_net: Use size_add() in call to struct_size() + - wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file() + - wifi: mt76: mt7603: rework/fix rx pse hang check + - mt76: dma: use kzalloc instead of devm_kzalloc for txwi + - mt76: add support for overriding the device used for DMA mapping + - mt76: pass original queue id from __mt76_tx_queue_skb to the driver + - wifi: mt76: mt7603: improve stuck beacon handling + - tcp_metrics: add missing barriers on delete + - tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics() + - tcp_metrics: do not create an entry from tcp_init_metrics() + - wifi: rtlwifi: fix EDCA limit set by BT coexistence + - can: dev: can_restart(): don't crash kernel if carrier is OK + - can: dev: can_restart(): fix race condition between controller restart and + netif_carrier_on() + - can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is + accessed out of bounds + - PM / devfreq: rockchip-dfi: Make pmu regmap mandatory + - netfilter: nf_tables: Drop pointless memset when dumping rules + - thermal: core: prevent potential string overflow + - r8169: use tp_to_dev instead of open code + - r8169: fix rare issue with broken rx after link-down on RTL8125 + - chtls: fix tp->rcv_tstamp initialization + - tcp: fix cookie_init_timestamp() overflows + - iwlwifi: pcie: adjust to Bz completion descriptor + - wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues + - wifi: iwlwifi: pcie: synchronize IRQs before NAPI + - wifi: iwlwifi: empty overflow queue during flush + - ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() + - ipv6: avoid atomic fragment on GSO packets + - net: add DEV_STATS_READ() helper + - ipvlan: properly track tx_errors + - regmap: debugfs: Fix a erroneous check after snprintf() + - spi: tegra: Fix missing IRQ check in tegra_slink_probe() + - clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies + - clk: qcom: mmcc-msm8998: Don't check halt bit on some branch clks + - clk: qcom: mmcc-msm8998: Fix the SMMU GDSC + - clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src + - clk: imx: Select MXC_CLK for CLK_IMX8QXP + - clk: imx: imx8mq: correct error handling path + - clk: imx: imx8qxp: Fix elcdif_pll clock + - clk: renesas: rzg2l: Simplify multiplication/shift logic + - clk: renesas: rzg2l: Use FIELD_GET() for PLL register fields + - clk: renesas: rzg2l: Fix computation formula + - spi: nxp-fspi: use the correct ioremap function + - clk: keystone: pll: fix a couple NULL vs IS_ERR() checks + - clk: ti: Add ti_dt_clk_name() helper to use clock-output-names + - clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() + - clk: ti: Update component clocks to use ti_dt_clk_name() + - clk: ti: change ti_clk_register[_omap_hw]() API + - clk: ti: fix double free in of_ti_divider_clk_setup() + - clk: npcm7xx: Fix incorrect kfree + - clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data + - clk: qcom: config IPQ_APSS_6018 should depend on QCOM_SMEM + - platform/x86: wmi: Fix probe failure when failing to register WMI devices + - platform/x86: wmi: remove unnecessary initializations + - platform/x86: wmi: Fix opening of char device + - hwmon: (axi-fan-control) Fix possible NULL pointer dereference + - hwmon: (coretemp) Fix potentially truncated sysfs attribute name + - drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs + - drm/rockchip: vop: Fix call to crtc reset helper + - drm/radeon: possible buffer overflow + - drm/mipi-dsi: Create devm device registration + - drm/mipi-dsi: Create devm device attachment + - drm/bridge: lt8912b: Switch to devm MIPI-DSI helpers + - drm/bridge: lt8912b: Register and attach our DSI device at probe + - drm/bridge: lt8912b: Add hot plug detection + - drm/bridge: lt8912b: Fix bridge_detach + - drm/bridge: lt8912b: Fix crash on bridge detach + - drm/bridge: lt8912b: Manually disable HPD only if it was enabled + - drm/bridge: lt8912b: Add missing drm_bridge_attach call + - drm/bridge: tc358768: Fix use of uninitialized variable + - drm/bridge: tc358768: Disable non-continuous clock mode + - drm/bridge: tc358768: Fix bit updates + - drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code + - drm/mediatek: Fix iommu fault by swapping FBs after updating plane state + - drm/mediatek: Fix iommu fault during crtc enabling + - drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe() + - arm64/arm: xen: enlighten: Fix KPTI checks + - drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map() + - xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled + - drm/msm/dsi: use msm_gem_kernel_put to free TX buffer + - drm: mediatek: mtk_dsi: Fix NO_EOT_PACKET settings/handling + - perf: hisi: Fix use-after-free when register pmu fails + - ARM: dts: renesas: blanche: Fix typo in GP_11_2 pin name + - arm64: dts: qcom: msm8916: Fix iommu local address range + - arm64: dts: qcom: msm8992-libra: drop duplicated reserved memory + - arm64: dts: qcom: sc7280: Add missing LMH interrupts + - arm64: dts: qcom: sdm845-mtp: fix WiFi configuration + - ARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins + - arm64: dts: qcom: apq8016-sbc: Add missing ADV7533 regulators + - ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator + - soc: qcom: llcc: Handle a second device without data corruption + - firmware: ti_sci: Mark driver as non removable + - firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device + - clk: scmi: Free scmi_clk allocated when the clocks with invalid info are + skipped + - arm64: dts: imx8qm-ss-img: Fix jpegenc compatible entry + - arm64: dts: imx8mm: Add sound-dai-cells to micfil node + - arm64: dts: imx8mn: Add sound-dai-cells to micfil node + - selftests/pidfd: Fix ksft print formats + - selftests/resctrl: Ensure the benchmark commands fits to its array + - crypto: hisilicon/hpre - Fix a erroneous check after snprintf() + - hwrng: geode - fix accessing registers + - RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() + - scsi: ibmvfc: Fix erroneous use of rtas_busy_delay with hcall return code + - libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return + value + - nd_btt: Make BTT lanes preemptible + - crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure + - crypto: caam/jr - fix Chacha20 + Poly1305 self test failure + - crypto: qat - increase size of buffers + - hid: cp2112: Fix duplicate workqueue initialization + - ARM: 9321/1: memset: cast the constant byte to unsigned char + - ext4: move 'ix' sanity check to corrent position + - ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not + described + - IB/mlx5: Fix rdma counter binding for RAW QP + - RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common() + - RDMA/hns: Fix signed-unsigned mixed comparisons + - RDMA/hns: The UD mode can only be configured with DCQCN + - ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe + - scsi: ufs: core: Leave space for '\0' in utf8 desc string + - RDMA/hfi1: Workaround truncation compilation error + - hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip + - sh: bios: Revive earlyprintk support + - Revert "HID: logitech-hidpp: add a module parameter to keep firmware + gestures" + - HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk + - HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only + - HID: logitech-hidpp: Revert "Don't restart communication if not necessary" + - HID: logitech-hidpp: Move get_wireless_feature_index() check to + hidpp_connect_event() + - ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails + - padata: Fix refcnt handling in padata_free_shell() + - crypto: qat - fix deadlock in backlog processing + - ASoC: ams-delta.c: use component after check + - mfd: core: Un-constify mfd_cell.of_reg + - mfd: core: Ensure disabled devices are skipped without aborting + - mfd: dln2: Fix double put in dln2_probe + - mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs + - leds: turris-omnia: Drop unnecessary mutex locking + - leds: turris-omnia: Do not use SMBUS calls + - leds: pwm: Don't disable the PWM when the LED should be off + - leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu' + - f2fs: compress: fix to avoid use-after-free on dic + - f2fs: compress: fix to avoid redundant compress extension + - tty: tty_jobctrl: fix pid memleak in disassociate_ctty() + - livepatch: Fix missing newline character in klp_resolve_symbols() + - dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers + - usb: dwc2: fix possible NULL pointer dereference caused by driver + concurrency + - usb: chipidea: Fix DMA overwrite for Tegra + - usb: chipidea: Simplify Tegra DMA alignment code + - dmaengine: ti: edma: handle irq_of_parse_and_map() errors + - misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() + - tools: iio: iio_generic_buffer ensure alignment + - USB: usbip: fix stub_dev hub disconnect + - dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() + - f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() + - powerpc: Only define __parse_fpscr() when required + - modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host + - powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro + - powerpc/xive: Fix endian conversion size + - powerpc/imc-pmu: Use the correct spinlock initializer. + - powerpc/pseries: fix potential memory leak in init_cpu_associativity() + - usb: host: xhci-plat: fix possible kernel oops while resuming + - perf machine: Avoid out of bounds LBR memory read + - perf hist: Add missing puts to hist__account_cycles + - 9p/net: fix possible memory leak in p9_check_errors() + - i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs + - cxl/mem: Fix shutdown order + - rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call + - pcmcia: cs: fix possible hung task and memory leak pccardd() + - pcmcia: ds: fix refcount leak in pcmcia_device_add() + - pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() + - media: i2c: max9286: Fix some redundant of_node_put() calls + - media: bttv: fix use after free error due to btv->timeout timer + - media: s3c-camif: Avoid inappropriate kfree() + - media: vidtv: psi: Add check for kstrdup + - media: vidtv: mux: Add check and kfree for kstrdup + - media: cedrus: Fix clock/reset sequence + - media: dvb-usb-v2: af9035: fix missing unlock + - regmap: prevent noinc writes from clobbering cache + - pwm: sti: Reduce number of allocations and drop usage of chip_data + - pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume + - Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() + - llc: verify mac len before reading mac header + - hsr: Prevent use after free in prp_create_tagged_frame() + - tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING + - bpf: Check map->usercnt after timer->timer is assigned + - inet: shrink struct flowi_common + - octeontx2-pf: Fix error codes + - octeontx2-pf: Fix holes in error code + - dccp: Call security_inet_conn_request() after setting IPv4 addresses. + - dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses. + - Fix termination state for idr_for_each_entry_ul() + - net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs + - selftests: pmtu.sh: fix result checking + - net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT + - net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc + - net/smc: put sk reference if close work was canceled + - tg3: power down device only on SYSTEM_POWER_OFF + - block: remove unneeded return value of bio_check_ro() + - blk-core: use pr_warn_ratelimited() in bio_check_ro() + - r8169: respect userspace disabling IFF_MULTICAST + - i2c: iproc: handle invalid slave state + - netfilter: xt_recent: fix (increase) ipv6 literal buffer length + - netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate + eval call-backs + - netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses + - drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE + - ASoC: hdmi-codec: register hpd callback on component probe + - spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies + - fbdev: imsttfb: Fix error path of imsttfb_probe() + - fbdev: imsttfb: fix a resource leak in probe + - fbdev: fsl-diu-fb: mark wr_reg_wa() static + - tracing/kprobes: Fix the order of argument descriptions + - btrfs: use u64 for buffer sizes in the tree search ioctls + - Linux 5.15.139 + + * Jammy update: v5.15.138 upstream stable release (LP: #2049417) + - ASoC: codecs: wcd938x: fix resource leaks on bind errors + - ASoC: codecs: wcd938x: fix runtime PM imbalance on remove + - pinctrl: qcom: lpass-lpi: fix concurrent register updates + - tcp: remove dead code from tcp_sendmsg_locked() + - tcp: cleanup tcp_remove_empty_skb() use + - mptcp: more conservative check for zero probes + - mcb: Return actual parsed size when reading chameleon table + - mcb-lpc: Reallocate memory region to avoid memory overlapping + - virtio_balloon: Fix endless deflation and inflation on arm64 + - virtio-mmio: fix memory leak of vm_dev + - vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE + - mm/page_alloc: correct start page when guard page debug is enabled + - mm/migrate: fix do_pages_move for compat pointers + - nfsd: lock_rename() needs both directories to live on the same fs + - drm/i915/pmu: Check if pmu is closed before stopping event + - vsock/virtio: factor our the code to initialize and delete VQs + - vsock/virtio: add support for device suspend/resume + - vsock/virtio: initialize the_virtio_vsock before using VQs + - drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() + - firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels() + - r8169: fix the KCSAN reported data-race in rtl_tx() while reading tp->cur_tx + - r8169: fix the KCSAN reported data-race in rtl_tx while reading + TxDescArray[entry].opts1 + - r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1 + - i40e: Fix I40E_FLAG_VF_VLAN_PRUNING value + - treewide: Spelling fix in comment + - igb: Fix potential memory leak in igb_add_ethtool_nfc_entry + - neighbour: fix various data-races + - igc: Fix ambiguity in the ethtool advertising + - net: ieee802154: adf7242: Fix some potential buffer overflow in + adf7242_stats_show() + - net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg + - r8152: Increase USB control msg timeout to 5000ms as per spec + - r8152: Run the unload routine if we have errors during probe + - r8152: Cancel hw_phy_work if we have an error in probe + - r8152: Release firmware if we have an error in probe + - tcp: fix wrong RTO timeout when received SACK reneging + - gtp: uapi: fix GTPA_MAX + - gtp: fix fragmentation needed check with gso + - i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR + - kasan: print the original fault addr when access invalid shadow + - iio: exynos-adc: request second interupt only when touchscreen mode is used + - iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds + - iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale + - i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: stm32f7: Fix PEC handling in case of SMBUS transfers + - i2c: aspeed: Fix i2c bus hang in slave read + - tracing/kprobes: Fix the description of variable length arguments + - misc: fastrpc: Clean buffers on remote invocation failures + - nvmem: imx: correct nregs for i.MX6ULL + - nvmem: imx: correct nregs for i.MX6SLL + - nvmem: imx: correct nregs for i.MX6UL + - perf/core: Fix potential NULL deref + - sparc32: fix a braino in fault handling in csum_and_copy_..._user() + - clk: Sanitize possible_parent_show to Handle Return Value of + of_clk_get_parent_name + - iio: afe: rescale: reorder includes + - iio: afe: rescale: expose scale processing function + - iio: afe: rescale: add offset support + - iio: afe: rescale: Accept only offset channels + - gve: Fix GFP flags when allocing pages + - x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility + - x86/mm: Simplify RESERVE_BRK() + - x86/mm: Fix RESERVE_BRK() for older binutils + - ext4: add two helper functions extent_logical_end() and pa_logical_end() + - ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow + - ext4: avoid overlapping preallocations due to overflow + - objtool/x86: add missing embedded_insn check + - driver: platform: Add helper for safer setting of driver_override + - rpmsg: Constify local variable in field store macro + - rpmsg: Fix kfree() of static memory on setting driver_override + - rpmsg: Fix calling device_lock() on non-initialized device + - rpmsg: glink: Release driver_override + - rpmsg: Fix possible refcount leak in rpmsg_register_device_override() + - x86: Fix .brk attribute in linker script + - ASoC: simple-card: fixup asoc_simple_probe() error handling + - net: sched: cls_u32: Fix allocation size in u32_init() + - irqchip/riscv-intc: Mark all INTC nodes as initialized + - irqchip/stm32-exti: add missing DT IRQ flag translation + - dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe + - powerpc/85xx: Fix math emulation exception + - Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport + - fbdev: atyfb: only use ioremap_uc() on i386 and ia64 + - fs/ntfs3: Add ckeck in ni_update_parent() + - fs/ntfs3: Write immediately updated ntfs state + - fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) + - fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() + - fs/ntfs3: Fix NULL pointer dereference on error in attr_allocate_frame() + - fs/ntfs3: Fix directory element type detection + - fs/ntfs3: Avoid possible memory leak + - spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 + - netfilter: nfnetlink_log: silence bogus compiler warning + - ASoC: rt5650: fix the wrong result of key button + - drm/ttm: Reorder sys manager cleanup step + - fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit() + - scsi: mpt3sas: Fix in error path + - platform/mellanox: mlxbf-tmfifo: Fix a warning message + - net: chelsio: cxgb4: add an error code check in t4_load_phy_fw + - r8152: Check for unplug in rtl_phy_patch_request() + - r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() + - powerpc/mm: Fix boot crash with FLATMEM + - can: isotp: set max PDU size to 64 kByte + - can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting + - can: isotp: check CAN address family in isotp_bind() + - can: isotp: handle wait_event_interruptible() return values + - can: isotp: add local echo tx processing and tx without FC + - can: isotp: isotp_bind(): do not validate unused address information + - can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior + - drm/amd: Move helper for dynamic speed switch check out of smu13 + - drm/amd: Disable ASPM for VI w/ all Intel systems + - PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device + - usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" + compatibility + - usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() + - usb: raw-gadget: properly handle interrupted requests + - tty: n_gsm: fix race condition in status line change on dead connections + - tty: 8250: Remove UC-257 and UC-431 + - tty: 8250: Add support for additional Brainboxes UC cards + - tty: 8250: Add support for Brainboxes UP cards + - tty: 8250: Add support for Intashield IS-100 + - tty: 8250: Fix port count of PX-257 + - tty: 8250: Fix up PX-803/PX-857 + - tty: 8250: Add support for additional Brainboxes PX cards + - tty: 8250: Add support for Intashield IX cards + - tty: 8250: Add Brainboxes Oxford Semiconductor-based quirks + - misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support + - ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection + - Linux 5.15.138 + + * Jammy update: v5.15.137 upstream stable release (LP: #2049350) + - lib/Kconfig.debug: do not enable DEBUG_PREEMPT by default + - Documentation: sysctl: align cells in second content column + - xfs: don't expose internal symlink metadata buffers to the vfs + - Bluetooth: hci_event: Ignore NULL link key + - Bluetooth: Reject connection with the device which has same BD_ADDR + - Bluetooth: Fix a refcnt underflow problem for hci_conn + - Bluetooth: vhci: Fix race when opening vhci device + - Bluetooth: hci_event: Fix coding style + - Bluetooth: avoid memcmp() out of bounds warning + - ice: fix over-shifted variable + - ice: reset first in crash dump kernels + - nfc: nci: fix possible NULL pointer dereference in send_acknowledge() + - regmap: fix NULL deref on lookup + - KVM: x86: Mask LVTPC when handling a PMI + - tcp: check mptcp-level constraints for backlog coalescing + - fs/ntfs3: Fix possible null-pointer dereference in hdr_find_e() + - fs/ntfs3: fix panic about slab-out-of-bounds caused by ntfs_list_ea() + - fs/ntfs3: fix deadlock in mark_as_free_ex + - netfilter: nft_payload: fix wrong mac header matching + - drm/i915: Retry gtt fault when out of fence registers + - ASoC: codecs: wcd938x-sdw: fix use after free on driver unbind + - ASoC: codecs: wcd938x-sdw: fix runtime PM imbalance on probe errors + - ASoC: codecs: wcd938x: drop bogus bind error handling + - ASoC: codecs: wcd938x: fix unbind tear down order + - qed: fix LL2 RX buffer allocation + - xfrm: fix a data-race in xfrm_gen_index() + - xfrm: interface: use DEV_STATS_INC() + - net: ipv4: fix return value check in esp_remove_trailer + - net: ipv6: fix return value check in esp_remove_trailer + - net: rfkill: gpio: prevent value glitch during probe + - tcp: fix excessive TLP and RACK timeouts from HZ rounding + - tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb + - tun: prevent negative ifindex + - ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr + - net: usb: smsc95xx: Fix an error code in smsc95xx_reset() + - i40e: prevent crash on probe if hw registers have invalid values + - net: dsa: bcm_sf2: Fix possible memory leak in bcm_sf2_mdio_register() + - bonding: Return pointer to data after pull on skb + - net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve + - neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section + - netfilter: nft_set_rbtree: .deactivate fails if element has expired + - netfilter: nf_tables: do not remove elements if set backend implements + .abort + - netfilter: nf_tables: revert do not remove elements if set backend + implements .abort + - net: pktgen: Fix interface flags printing + - selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and + hugetlb_reparenting_test.sh that may cause error + - serial: 8250: omap: Fix imprecise external abort for omap_8250_pm() + - serial: 8250_omap: Fix errors with no_console_suspend + - iio: Un-inline iio_buffer_enabled() + - iio: core: Hide read accesses to iio_dev->currentmode + - iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs + - iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data() + - iio: adc: ad7192: Correct reference voltage + - perf: Add irq and exception return branch types + - perf/x86: Move branch classifier + - perf/x86/lbr: Filter vsyscall addresses + - drm/atomic-helper: relax unregistered connector check + - powerpc/32s: Remove capability to disable KUEP at boottime + - powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly + - powerpc/47x: Fix 47x syscall return crash + - mctp: Allow local delivery to the null EID + - mctp: perform route lookups under a RCU read-side lock + - nfp: flower: avoid rmmod nfp crash issues + - ksmbd: not allow to open file if delelete on close bit is set + - ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone + - fs-writeback: do not requeue a clean inode having skipped pages + - btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 + - btrfs: initialize start_slot in btrfs_log_prealloc_extents + - i2c: mux: Avoid potential false error message in i2c_mux_add_adapter + - overlayfs: set ctime when setting mtime and atime + - gpio: timberdale: Fix potential deadlock on &tgpio->lock + - ata: libata-core: Fix compilation warning in ata_dev_config_ncq() + - ata: libata-eh: Fix compilation warning in ata_eh_link_report() + - tracing: relax trace_event_eval_update() execution with cond_resched() + - wifi: mwifiex: Sanity check tlv_len and tlv_bitmap_len + - wifi: iwlwifi: Ensure ack flag is properly cleared. + - HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event + - Bluetooth: btusb: add shutdown function for QCA6174 + - Bluetooth: Avoid redundant authentication + - Bluetooth: hci_core: Fix build warnings + - wifi: cfg80211: Fix 6GHz scan configuration + - wifi: mac80211: allow transmitting EAPOL frames with tainted key + - wifi: cfg80211: avoid leaking stack data into trace + - regulator/core: Revert "fix kobject release warning and memory leak in + regulator_register()" + - sky2: Make sure there is at least one frag_addr available + - ipv4/fib: send notify when delete source address routes + - drm: panel-orientation-quirks: Add quirk for One Mix 2S + - btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c + - btrfs: error out when COWing block using a stale transaction + - btrfs: error when COWing block from a root that is being deleted + - btrfs: error out when reallocating block for defrag using a stale + transaction + - HID: multitouch: Add required quirk for Synaptics 0xcd7e device + - platform/x86: touchscreen_dmi: Add info for the Positivo C4128B + - net/mlx5: Handle fw tracer change ownership event based on MTRC + - Bluetooth: hci_event: Fix using memcmp when comparing keys + - net: introduce a function to check if a netdev name is in use + - net: move from strlcpy with unused retval to strscpy + - net: fix ifname in netlink ntf during netns move + - mtd: rawnand: qcom: Unmap the right resource upon probe failure + - mtd: rawnand: pl353: Ensure program page operations are successful + - mtd: rawnand: marvell: Ensure program page operations are successful + - mtd: rawnand: arasan: Ensure program page operations are successful + - mtd: spinand: micron: correct bitmask for ecc status + - mtd: physmap-core: Restore map_rom fallback + - mmc: mtk-sd: Use readl_poll_timeout_atomic in msdc_reset_hw + - mmc: core: sdio: hold retuning if sdio in 1-bit mode + - pNFS: Fix a hang in nfs4_evict_inode() + - NFSv4.1: fixup use EXCHGID4_FLAG_USE_PNFS_DS for DS server + - ACPI: irq: Fix incorrect return value in acpi_register_gsi() + - nvme-pci: add BOGUS_NID for Intel 0a54 device + - nvme-rdma: do not try to stop unallocated queues + - USB: serial: option: add Telit LE910C4-WWX 0x1035 composition + - USB: serial: option: add entry for Sierra EM9191 with new firmware + - USB: serial: option: add Fibocom to DELL custom modem FM101R-GL + - s390/pci: fix iommu bitmap allocation + - selftests/ftrace: Add new test case which checks non unique symbol + - s390/cio: fix a memleak in css_alloc_subchannel + - platform/surface: platform_profile: Propagate error if profile registration + fails + - platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e + - platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events + - gpio: vf610: set value before the direction to avoid a glitch + - ASoC: pxa: fix a memory leak in probe() + - serial: 8250: omap: Move uart_write() inside PM section + - phy: mapphone-mdm6600: Fix runtime disable on probe + - phy: mapphone-mdm6600: Fix runtime PM for remove + - phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins + - Bluetooth: hci_sock: fix slab oob read in create_monitor_event + - Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name + - xfrm6: fix inet6_dev refcount underflow problem + - Linux 5.15.137 + + * CVE-2023-51782 + - net/rose: Fix Use-After-Free in rose_ioctl + + * CVE-2023-51779 + - Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg + + * CVE-2023-22995 + - usb: dwc3: dwc3-qcom: Add missing platform_device_put() in + dwc3_qcom_acpi_register_core + + * CVE-2023-4134 + - Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync() + + * Packaging resync (LP: #1786013) + - [Packaging] update annotations scripts - -- Manuel Diewald Wed, 07 Feb 2024 11:17:02 +0100 + -- Stefan Bader Fri, 02 Feb 2024 14:05:20 +0100 linux (5.15.0-94.104) jammy; urgency=medium diff -u linux-lowlatency-5.15.0/debian.master/tracking-bug linux-lowlatency-5.15.0/debian.master/tracking-bug --- linux-lowlatency-5.15.0/debian.master/tracking-bug +++ linux-lowlatency-5.15.0/debian.master/tracking-bug @@ -1 +1 @@ -2052600 s2024.01.08-2 +2052616 2024.02.05-2 diff -u linux-lowlatency-5.15.0/debian.master/upstream-stable linux-lowlatency-5.15.0/debian.master/upstream-stable --- linux-lowlatency-5.15.0/debian.master/upstream-stable +++ linux-lowlatency-5.15.0/debian.master/upstream-stable @@ -3 +3 @@ - linux-5.15.y = v5.15.136 + linux-5.15.y = v5.15.143 diff -u linux-lowlatency-5.15.0/debian/changelog linux-lowlatency-5.15.0/debian/changelog --- linux-lowlatency-5.15.0/debian/changelog +++ linux-lowlatency-5.15.0/debian/changelog @@ -1,3 +1,1134 @@ +linux-lowlatency (5.15.0-100.110) jammy; urgency=medium + + * jammy/linux-lowlatency: 5.15.0-100.110 -proposed tracker (LP: #2052079) + + [ Ubuntu: 5.15.0-100.110 ] + + * jammy/linux: 5.15.0-100.110 -proposed tracker (LP: #2052616) + * i915 regression introduced with 5.5 kernel (LP: #2044131) + - drm/i915: Skip some timing checks on BXT/GLK DSI transcoders + * Audio balancing setting doesn't work with the cirrus codec (LP: #2051050) + - ALSA: hda/cs8409: Suppress vmaster control for Dolphin models + * partproke is broken on empty loopback device (LP: #2049689) + - block: Move checking GENHD_FL_NO_PART to bdev_add_partition() + * CVE-2023-0340 + - vhost: use kzalloc() instead of kmalloc() followed by memset() + * CVE-2023-51780 + - atm: Fix Use-After-Free in do_vcc_ioctl + * CVE-2023-6915 + - ida: Fix crash in ida_free when the bitmap is empty + * CVE-2024-0646 + - net: tls, update curr on splice as well + * CVE-2024-0565 + - smb: client: fix OOB in receive_encrypted_standard() + * CVE-2023-51781 + - appletalk: Fix Use-After-Free in atalk_ioctl + * Jammy update: v5.15.143 upstream stable release (LP: #2050858) + - vdpa/mlx5: preserve CVQ vringh index + - hrtimers: Push pending hrtimers away from outgoing CPU earlier + - i2c: designware: Fix corrupted memory seen in the ISR + - netfilter: ipset: fix race condition between swap/destroy and kernel side + add/del/test + - tg3: Move the [rt]x_dropped counters to tg3_napi + - tg3: Increment tx_dropped in tg3_tso_bug() + - kconfig: fix memory leak from range properties + - drm/amdgpu: correct chunk_ptr to a pointer to chunk. + - platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum + - platform/x86: asus-wmi: Add support for ROG X13 tablet mode + - platform/x86: asus-wmi: Simplify tablet-mode-switch probing + - platform/x86: asus-wmi: Simplify tablet-mode-switch handling + - platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code + - of: dynamic: Fix of_reconfig_get_state_change() return value documentation + - platform/x86: wmi: Allow duplicate GUIDs for drivers that use struct + wmi_driver + - platform/x86: wmi: Skip blocks with zero instances + - ipv6: fix potential NULL deref in fib6_add() + - octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam + - octeontx2-af: Check return value of nix_get_nixlf before using nixlf + - hv_netvsc: rndis_filter needs to select NLS + - r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE + - r8152: Add RTL8152_INACCESSIBLE checks to more loops + - r8152: Add RTL8152_INACCESSIBLE to r8156b_wait_loading_flash() + - r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() + - r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() + - mlxbf-bootctl: correctly identify secure boot with development keys + - platform/mellanox: Add null pointer checks for devm_kasprintf() + - platform/mellanox: Check devm_hwmon_device_register_with_groups() return + value + - arcnet: restoring support for multiple Sohard Arcnet cards + - net: stmmac: fix FPE events losing + - octeontx2-af: fix a use-after-free in rvu_npa_register_reporters + - i40e: Fix unexpected MFS warning message + - net: bnxt: fix a potential use-after-free in bnxt_init_tc + - ionic: fix snprintf format length warning + - ionic: Fix dim work handling in split interrupt mode + - ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() + - net: hns: fix fake link up on xge port + - octeontx2-af: Update Tx link register range + - netfilter: nf_tables: validate family when identifying table via handle + - netfilter: xt_owner: Fix for unsafe access of sk->sk_socket + - tcp: do not accept ACK of bytes we never sent + - bpf: sockmap, updating the sg structure should also update curr + - psample: Require 'CAP_NET_ADMIN' when joining "packets" group + - net: add missing kdoc for struct genl_multicast_group::flags + - drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group + - tee: optee: Fix supplicant based device enumeration + - RDMA/hns: Fix unnecessary err return when using invalid congest control + algorithm + - RDMA/irdma: Do not modify to SQD on error + - RDMA/irdma: Add wait for suspend on SQD + - arm64: dts: rockchip: Expand reg size of vdec node for RK3399 + - RDMA/rtrs-srv: Do not unconditionally enable irq + - RDMA/rtrs-clt: Start hb after path_up + - RDMA/rtrs-srv: Check return values while processing info request + - RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true + - RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight + - RDMA/rtrs-clt: Fix the max_send_wr setting + - RDMA/rtrs-clt: Remove the warnings for req in_use check + - RDMA/bnxt_re: Correct module description string + - hwmon: (acpi_power_meter) Fix 4.29 MW bug + - hwmon: (nzxt-kraken2) Fix error handling path in kraken2_probe() + - ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate + - RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz + - RDMA/irdma: Avoid free the non-cqp_request scratch + - arm64: dts: imx8mq: drop usb3-resume-missing-cas from usb + - arm64: dts: imx8mp: imx8mq: Add parkmode-disable-ss-quirk on DWC3 + - ARM: dts: imx6ul-pico: Describe the Ethernet PHY clock + - tracing: Fix a warning when allocating buffered events fails + - scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle() + - ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init + - ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt + - ARM: dts: imx28-xea: Pass the 'model' property + - riscv: fix misaligned access handling of C.SWSP and C.SDSP + - md: introduce md_ro_state + - md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly() + - kprobes: consistent rcu api usage for kretprobe holder + - nvme-pci: Add sleep quirk for Kingston drives + - io_uring: fix mutex_unlock with unreferenced ctx + - ALSA: usb-audio: Add Pioneer DJM-450 mixer controls + - ALSA: pcm: fix out-of-bounds in snd_pcm_state_names + - nilfs2: fix missing error check for sb_set_blocksize call + - nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage() + - checkstack: fix printed address + - tracing: Always update snapshot buffer size + - tracing: Disable snapshot buffer when stopping instance tracers + - tracing: Fix incomplete locking when disabling buffered events + - tracing: Fix a possible race when disabling buffered events + - packet: Move reference count in packet_sock to atomic_long_t + - regmap: fix bogus error on regcache_sync success + - platform/surface: aggregator: fix recv_buf() return value + - arm64: dts: mediatek: mt7622: fix memory node warning check + - arm64: dts: mediatek: mt8183-kukui-jacuzzi: fix dsi unnecessary cells + properties + - arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names + - arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory + - binder: fix memory leaks of spam and pending work + - kallsyms: Make kallsyms_on_each_symbol generally available + - coresight: etm4x: Make etm4_remove_dev() return void + - coresight: etm4x: Remove bogous __exit annotation for some functions + - misc: mei: client.c: return negative error code in mei_cl_write + - misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write + - ring-buffer: Force absolute timestamp on discard of event + - tracing: Set actual size after ring buffer resize + - tracing: Stop current tracer when resizing buffer + - r8169: fix rtl8125b PAUSE frames blasting when suspended + - mm: fix oops when filemap_map_pmd() without prealloc_pte + - io_uring/af_unix: disable sending io_uring over sockets + - platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting + - docs/process/howto: Replace C89 with C11 + - tools headers UAPI: Sync linux/perf_event.h with the kernel sources + - arm64: dts: mediatek: align thermal zone node names with dtschema + - arm64: dts: mediatek: mt8183: Move thermal-zones to the root node + - arm64: dts: mediatek: add missing space before { + - arm64: dts: mt8183: kukui: Fix underscores in node names + - gpiolib: sysfs: Fix error handling on failed export + - drm/amd/amdgpu: Fix warnings in amdgpu/amdgpu_display.c + - drm/amdgpu: correct the amdgpu runtime dereference usage count + - usb: gadget: f_hid: fix report descriptor allocation + - parport: Add support for Brainboxes IX/UC/PX parallel cards + - usb: typec: class: fix typec_altmode_put_partner to put plugs + - ARM: PL011: Fix DMA support + - serial: sc16is7xx: address RX timeout interrupt errata + - serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit + - serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt + - serial: 8250_omap: Add earlycon support for the AM654 UART controller + - x86/CPU/AMD: Check vendor in the AMD microcode callback + - KVM: s390/mm: Properly reset no-dat + - KVM: SVM: Update EFER software model on CR0 trap for SEV-ES + - MIPS: Loongson64: Reserve vgabios memory on boot + - MIPS: Loongson64: Enable DMA noncoherent support + - cifs: Fix non-availability of dedup breaking generic/304 + - smb: client: fix potential NULL deref in parse_dfs_referrals() + - devcoredump : Serialize devcd_del work + - devcoredump: Send uevent once devcd is ready + - Linux 5.15.143 + * Intel E810-XXV - NETDEV WATCHDOG: (ice): transmit queue timed out + (LP: #2036239) + - ice: Add feature bitmap, helpers and a check for DSCP + - ice: Add driver support for firmware changes for LAG + - ice: alter feature support check for SRIOV and LAG + * Don't WARN_ON_ONCE() for a broken discovery table (LP: #2048404) + - perf/x86/uncore: Don't WARN_ON_ONCE() for a broken discovery table + * Reject connection when malformed L2CAP signal packet is received + (LP: #2047634) + - Bluetooth: L2CAP: Send reject on command corrupted request + * Jammy update: v5.15.142 upstream stable release (LP: #2050849) + - pinctrl: avoid reload of p state in list iteration + - firewire: core: fix possible memory leak in create_units() + - mmc: cqhci: Increase recovery halt timeout + - mmc: cqhci: Warn of halt or task clear failure + - mmc: cqhci: Fix task clearing in CQE error recovery + - mmc: block: Retry commands in CQE error recovery + - mmc: block: Do not lose cache flush during CQE error recovery + - mmc: block: Be sure to wait while busy in CQE error recovery + - ALSA: hda: Disable power-save on KONTRON SinglePC + - ALSA: hda/realtek: Headset Mic VREF to 100% + - ALSA: hda/realtek: Add supported ALC257 for ChromeOS + - dm-verity: align struct dm_verity_fec_io properly + - dm verity: don't perform FEC for failed readahead IO + - bcache: revert replacing IS_ERR_OR_NULL with IS_ERR + - iommu/vt-d: Add MTL to quirk list to skip TE disabling + - powerpc: Don't clobber f0/vs0 during fp|altivec register save + - parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes + - btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod() + - btrfs: fix off-by-one when checking chunk map includes logical address + - btrfs: send: ensure send_fd is writable + - btrfs: make error messages more clear when getting a chunk map + - Input: xpad - add HyperX Clutch Gladiate Support + - vlan: introduce vlan_dev_free_egress_priority + - vlan: move dev_put into vlan_dev_uninit + - rcu: Avoid tracing a few functions executed in stop machine + - hv_netvsc: fix race of netvsc and VF register_netdevice + - USB: core: Change configuration warnings to notices + - usb: config: fix iteration issue in 'usb_get_bos_descriptor()' + - dpaa2-eth: increase the needed headroom to account for alignment + - uapi: propagate __struct_group() attributes to the container union + - selftests/net: ipsec: fix constant out of range + - octeontx2-af: Fix possible buffer overflow + - net: stmmac: xgmac: Disable FPE MMC interrupts + - octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64 + - Revert "workqueue: remove unused cancel_work()" + - r8169: prevent potential deadlock in rtl8169_close + - ravb: Fix races between ravb_tx_timeout_work() and net related ops + - net: ravb: Check return value of reset_control_deassert() + - net: ravb: Use pm_runtime_resume_and_get() + - net: ravb: Start TX queues after HW initialization succeeded + - net: ravb: Stop DMA in case of failures on ravb_open() + - perf intel-pt: Fix async branch flags + - selftests/resctrl: Add missing SPDX license to Makefile + - selftests/resctrl: Move _GNU_SOURCE define into Makefile + - smb3: fix touch -h of symlink + - ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header + - ASoC: SOF: sof-pci-dev: use community key on all Up boards + - ASoC: SOF: sof-pci-dev: add parameter to override topology filename + - ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks + - ASoC: SOF: sof-pci-dev: Fix community key quirk detection + - fbdev: stifb: Make the STI next font pointer a 32-bit signed offset + - fs: add ctime accessors infrastructure + - smb3: fix caching of ctime on setxattr + - cpufreq: imx6q: don't warn for disabling a non-existing frequency + - cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily + - iommu/vt-d: Omit devTLB invalidation requests when TES=0 + - iommu/vt-d: Make context clearing consistent with context mapping + - mmc: core: add helpers mmc_regulator_enable/disable_vqmmc + - mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled + - r8169: disable ASPM in case of tx timeout + - r8169: fix deadlock on RTL8125 in jumbo mtu mode + - iomap: update ki_pos a little later in iomap_dio_complete + - Linux 5.15.142 + * Jammy update: v5.15.141 upstream stable release (LP: #2050044) + - afs: Fix afs_server_list to be cleaned up with RCU + - afs: Make error on cell lookup failure consistent with OpenAFS + - drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence + - drm/panel: auo,b101uan08.3: Fine tune the panel power sequence + - drm/panel: simple: Fix Innolux G101ICE-L01 bus flags + - drm/panel: simple: Fix Innolux G101ICE-L01 timings + - wireguard: use DEV_STATS_INC() + - octeontx2-pf: Fix memory leak during interface down + - ata: pata_isapnp: Add missing error check for devm_ioport_map() + - drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full + - HID: core: store the unique system identifier in hid_device + - HID: fix HID device resource race between HID core and debugging support + - ipv4: Correct/silence an endian warning in __ip_do_redirect + - net: usb: ax88179_178a: fix failed operations during ax88179_reset + - net/smc: avoid data corruption caused by decline + - arm/xen: fix xen_vcpu_info allocation alignment + - octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx + queue than its PF + - amd-xgbe: handle corner-case during sfp hotplug + - amd-xgbe: handle the corner-case during tx completion + - amd-xgbe: propagate the correct speed and duplex status + - net: axienet: Fix check for partial TX checksum + - afs: Return ENOENT if no cell DNS record can be found + - afs: Fix file locking on R/O volumes to operate in local mode + - nvmet: nul-terminate the NQNs passed in the connect command + - USB: dwc3: qcom: fix resource leaks on probe deferral + - USB: dwc3: qcom: fix ACPI platform device leak + - lockdep: Fix block chain corruption + - MIPS: KVM: Fix a build warning about variable set but not used + - media: camss: Replace hard coded value with parameter + - media: camss: sm8250: Virtual channels for CSID + - media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3 + - media: qcom: camss: Fix csid-gen2 for test pattern generator + - ext4: add a new helper to check if es must be kept + - ext4: factor out __es_alloc_extent() and __es_free_extent() + - ext4: use pre-allocated es in __es_insert_extent() + - ext4: use pre-allocated es in __es_remove_extent() + - ext4: using nofail preallocation in ext4_es_remove_extent() + - ext4: using nofail preallocation in ext4_es_insert_delayed_block() + - ext4: using nofail preallocation in ext4_es_insert_extent() + - ext4: fix slab-use-after-free in ext4_es_insert_extent() + - ext4: make sure allocate pending entry not fail + - proc: sysctl: prevent aliased sysctls from getting passed to init + - ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA + - swiotlb-xen: provide the "max_mapping_size" method + - bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in + btree_gc_coalesce() + - md: fix bi_status reporting in md_end_clone_io + - bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race + - io_uring/fs: consider link->flags when getting path for LINKAT + - s390/dasd: protect device queue against concurrent access + - USB: serial: option: add Luat Air72*U series products + - hv_netvsc: Fix race of register_netdevice_notifier and VF register + - hv_netvsc: Mark VF as slave before exposing it to user-mode + - dm-delay: fix a race between delay_presuspend and delay_bio + - bcache: check return value from btree_node_alloc_replacement() + - bcache: prevent potential division by zero error + - bcache: fixup init dirty data errors + - bcache: fixup lock c->root error + - usb: cdnsp: Fix deadlock issue during using NCM gadget + - USB: serial: option: add Fibocom L7xx modules + - USB: serial: option: fix FM101R-GL defines + - USB: serial: option: don't claim interface 4 for ZTE MF290 + - usb: typec: tcpm: Skip hard reset when in error recovery + - USB: dwc2: write HCINT with INTMASK applied + - usb: dwc3: Fix default mode initialization + - usb: dwc3: set the dma max_seg_size + - USB: dwc3: qcom: fix software node leak on probe errors + - USB: dwc3: qcom: fix wakeup after probe deferral + - io_uring: fix off-by one bvec index + - Linux 5.15.141 + * Jammy update: v5.15.140 upstream stable release (LP: #2050038) + - locking/ww_mutex/test: Fix potential workqueue corruption + - perf/core: Bail out early if the request AUX area is out of bound + - clocksource/drivers/timer-imx-gpt: Fix potential memory leak + - clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware + - workqueue: Provide one lock class key per work_on_cpu() callsite + - x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size + - wifi: mac80211_hwsim: fix clang-specific fortify warning + - wifi: mac80211: don't return unset power in ieee80211_get_tx_power() + - atl1c: Work around the DMA RX overflow issue + - bpf: Detect IP == ksym.end as part of BPF program + - wifi: ath9k: fix clang-specific fortify warnings + - wifi: ath10k: fix clang-specific fortify warning + - net: annotate data-races around sk->sk_tx_queue_mapping + - net: annotate data-races around sk->sk_dst_pending_confirm + - wifi: ath10k: Don't touch the CE interrupt registers after power up + - Bluetooth: btusb: Add date->evt_skb is NULL check + - Bluetooth: Fix double free in hci_conn_cleanup + - platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e + - drm/komeda: drop all currently held locks if deadlock happens + - drm/amdkfd: Fix a race condition of vram buffer unref in svm code + - drm/amd/display: use full update for clip size increase of large plane + source + - string.h: add array-wrappers for (v)memdup_user() + - kernel: kexec: copy user-array safely + - kernel: watch_queue: copy user-array safely + - drm: vmwgfx_surface.c: copy user-array safely + - drm/msm/dp: skip validity check for DP CTS EDID checksum + - drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 + - drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga + - drm/amdgpu: Fix potential null pointer derefernce + - drm/panel: fix a possible null pointer dereference + - drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference + - drm/amdgpu/vkms: fix a possible null pointer dereference + - drm/panel: st7703: Pick different reset sequence + - drm/amdkfd: Fix shift out-of-bounds issue + - drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL + - arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size + - selftests/efivarfs: create-read: fix a resource leak + - ASoC: soc-card: Add storage for PCI SSID + - crypto: pcrypt - Fix hungtask for PADATA_RESET + - RDMA/hfi1: Use FIELD_GET() to extract Link Width + - scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs + - scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool + - fs/jfs: Add check for negative db_l2nbperpage + - fs/jfs: Add validity check for db_maxag and db_agpref + - jfs: fix array-index-out-of-bounds in dbFindLeaf + - jfs: fix array-index-out-of-bounds in diAlloc + - HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround + - ARM: 9320/1: fix stack depot IRQ stack filter + - ALSA: hda: Fix possible null-ptr-deref when assigning a stream + - PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields + - atm: iphase: Do PCI error checks on own line + - scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() + - PCI: Use FIELD_GET() to extract Link Width + - PCI: Extract ATS disabling to a helper function + - PCI: Disable ATS for specific Intel IPU E2000 devices + - misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller + - PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk + - HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W + - exfat: support handle zero-size directory + - tty: vcc: Add check for kstrdup() in vcc_probe() + - usb: gadget: f_ncm: Always set current gadget in ncm_bind() + - 9p/trans_fd: Annotate data-racy writes to file::f_flags + - 9p: v9fs_listxattr: fix %s null argument warning + - i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler + - i2c: sun6i-p2wi: Prevent potential division by zero + - virtio-blk: fix implicit overflow on virtio_max_dma_size + - i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data. + - media: gspca: cpia1: shift-out-of-bounds in set_flicker + - media: vivid: avoid integer overflow + - gfs2: ignore negated quota changes + - gfs2: fix an oops in gfs2_permission + - media: cobalt: Use FIELD_GET() to extract Link Width + - media: ccs: Fix driver quirk struct documentation + - media: imon: fix access to invalid resource for the second interface + - drm/amd/display: Avoid NULL dereference of timing generator + - kgdb: Flush console before entering kgdb on panic + - i2c: dev: copy userspace array safely + - ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings + - drm/qxl: prevent memory leak + - drm/amdgpu: fix software pci_unplug on some chips + - pwm: Fix double shift bug + - wifi: iwlwifi: Use FW rate for non-data frames + - tracing: Reuse logic from perf's get_recursion_context() + - tracing/perf: Add interrupt_context_level() helper + - sched/core: Optimize in_task() and in_interrupt() a bit + - media: cadence: csi2rx: Unregister v4l2 async notifier + - media: cec: meson: always include meson sub-directory in Makefile + - SUNRPC: ECONNRESET might require a rebind + - SUNRPC: Add an IS_ERR() check back to where it was + - NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO + - SUNRPC: Fix RPC client cleaned up the freed pipefs dentries + - gfs2: Silence "suspicious RCU usage in gfs2_permission" warning + - mptcp: diag: switch to context structure + - mptcp: listen diag dump support + - net: inet: Remove count from inet_listen_hashbucket + - net: inet: Open code inet_hash2 and inet_unhash2 + - net: inet: Retire port only listening_hash + - net: set SOCK_RCU_FREE before inserting socket into hashtable + - ipvlan: add ipvlan_route_v6_outbound() helper + - tty: Fix uninit-value access in ppp_sync_receive() + - net: hns3: fix add VLAN fail issue + - net: hns3: refine the definition for struct hclge_pf_to_vf_msg + - net: hns3: add byte order conversion for PF to VF mailbox message + - net: hns3: add barrier in vf mailbox reply process + - net: hns3: fix incorrect capability bit display for copper port + - net: hns3: fix variable may not initialized problem in hns3_init_mac_addr() + - net: hns3: fix VF reset fail issue + - net: hns3: fix VF wrong speed and duplex issue + - tipc: Fix kernel-infoleak due to uninitialized TLV value + - ppp: limit MRU to 64K + - xen/events: fix delayed eoi list handling + - ptp: annotate data-race around q->head and q->tail + - bonding: stop the device in bond_setup_by_slave() + - net: ethernet: cortina: Fix max RX frame define + - net: ethernet: cortina: Handle large frames + - net: ethernet: cortina: Fix MTU max setting + - af_unix: fix use-after-free in unix_stream_read_actor() + - netfilter: nf_conntrack_bridge: initialize err to 0 + - netfilter: nf_tables: use the correct get/put helpers + - netfilter: nf_tables: add and use BE register load-store helpers + - netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() + - net: stmmac: fix rx budget limit check + - net/mlx5e: Remove incorrect addition of action fwd flag + - net/mlx5e: Move mod hdr allocation to a single place + - net/mlx5e: Refactor mod header management API + - net/mlx5e: Fix pedit endianness + - net/mlx5e: Reduce the size of icosq_str + - net/mlx5e: Check return value of snprintf writing to fw_version buffer for + representors + - macvlan: Don't propagate promisc change to lower dev in passthru + - tools/power/turbostat: Fix a knl bug + - tools/power/turbostat: Enable the C-state Pre-wake printing + - cifs: spnego: add ';' in HOST_KEY_LEN + - cifs: fix check of rc in function generate_smb3signingkey + - xfs: refactor buffer cancellation table allocation + - xfs: don't leak xfs_buf_cancel structures when recovery fails + - xfs: convert buf_cancel_table allocation to kmalloc_array + - xfs: use invalidate_lock to check the state of mmap_lock + - xfs: prevent a UAF when log IO errors race with unmount + - xfs: flush inode gc workqueue before clearing agi bucket + - xfs: fix use-after-free in xattr node block inactivation + - xfs: don't leak memory when attr fork loading fails + - xfs: fix intermittent hang during quotacheck + - xfs: add missing cmap->br_state = XFS_EXT_NORM update + - xfs: Fix false ENOSPC when performing direct write on a delalloc extent in + cow fork + - xfs: fix inode reservation space for removing transaction + - xfs: avoid a UAF when log intent item recovery fails + - xfs: fix exception caused by unexpected illegal bestcount in leaf dir + - xfs: fix memory leak in xfs_errortag_init + - xfs: Fix unreferenced object reported by kmemleak in xfs_sysfs_init() + - i915/perf: Fix NULL deref bugs with drm_dbg() calls + - media: venus: hfi: add checks to perform sanity on queue pointers + - powerpc/perf: Fix disabling BHRB and instruction sampling + - randstruct: Fix gcc-plugin performance mode to stay in group + - bpf: Fix check_stack_write_fixed_off() to correctly spill imm + - bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END + - scsi: mpt3sas: Fix loop logic + - scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for + selected registers + - scsi: qla2xxx: Fix system crash due to bad pointer access + - crypto: x86/sha - load modules based on CPU features + - x86/cpu/hygon: Fix the CPU topology evaluation for real + - KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space + - KVM: x86: Ignore MSR_AMD64_TW_CFG access + - audit: don't take task_lock() in audit_exe_compare() code path + - audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare() + - tty/sysrq: replace smp_processor_id() with get_cpu() + - hvc/xen: fix console unplug + - hvc/xen: fix error path in xen_hvc_init() to always register frontend driver + - hvc/xen: fix event channel handling for secondary consoles + - PCI/sysfs: Protect driver's D3cold preference from user space + - watchdog: move softlockup_panic back to early_param + - ACPI: resource: Do IRQ override on TongFang GMxXGxx + - arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer + - parisc/pdc: Add width field to struct pdc_model + - clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data + - clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks + - mmc: vub300: fix an error code + - mmc: sdhci_am654: fix start loop index for TAP value parsing + - PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() + - PCI: exynos: Don't discard .remove() callback + - wifi: wilc1000: use vmm_table as array in wilc struct + - svcrdma: Drop connection after an RDMA Read error + - rcu/tree: Defer setting of jiffies during stall reset + - arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM + - PM: hibernate: Use __get_safe_page() rather than touching the list + - PM: hibernate: Clean up sync_read handling in snapshot_write_next() + - rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects + - btrfs: don't arbitrarily slow down delalloc if we're committing + - firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit + - ACPI: FPDT: properly handle invalid FPDT subtables + - ima: annotate iint mutex to avoid lockdep false positive warnings + - ima: detect changes to the backing overlay file + - wifi: ath11k: fix temperature event locking + - wifi: ath11k: fix dfs radar event locking + - wifi: ath11k: fix htt pktlog locking + - mmc: meson-gx: Remove setting of CMD_CFG_ERROR + - genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware + - KEYS: trusted: Rollback init_trusted() consistently + - PCI: keystone: Don't discard .remove() callback + - PCI: keystone: Don't discard .probe() callback + - netfilter: nf_tables: split async and sync catchall in two functions + - selftests/resctrl: Remove duplicate feature check from CMT test + - selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests + - ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix + - jbd2: fix potential data lost in recovering journal raced with synchronizing + fs bdev + - quota: explicitly forbid quota files from being encrypted + - kernel/reboot: emergency_restart: Set correct system_state + - i2c: core: Run atomic i2c xfer when !preemptible + - tracing: Have the user copy of synthetic event address use correct context + - mcb: fix error handling for different scenarios when parsing + - dmaengine: stm32-mdma: correct desc prep when channel running + - s390/cmma: fix detection of DAT pages + - mm/cma: use nth_page() in place of direct struct page manipulation + - mm/memory_hotplug: use pfn math in place of direct struct page manipulation + - mtd: cfi_cmdset_0001: Byte swap OTP info + - i3c: master: cdns: Fix reading status register + - i3c: master: svc: fix race condition in ibi work thread + - i3c: master: svc: fix wrong data return when IBI happen during start frame + - i3c: master: svc: fix ibi may not return mandatory data byte + - i3c: master: svc: fix check wrong status register in irq handler + - i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen + - parisc: Prevent booting 64-bit kernels on PA1.x machines + - parisc/pgtable: Do not drop upper 5 address bits of physical address + - xhci: Enable RPM on controllers that support low-power states + - ALSA: info: Fix potential deadlock at disconnection + - ALSA: hda/realtek - Add Dell ALC295 to pin fall back table + - ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC + - serial: meson: Use platform_get_irq() to get the interrupt + - tty: serial: meson: fix hard LOCKUP on crtscts mode + - regmap: Ensure range selector registers are updated after cache sync + - cpufreq: stats: Fix buffer overflow detection in trans_stats() + - Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 + - bluetooth: Add device 0bda:887b to device tables + - bluetooth: Add device 13d3:3571 to device tables + - Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables + - Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE + - ksmbd: fix slab out of bounds write in smb_inherit_dacl() + - arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO + - arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size + - powerpc/pseries/ddw: simplify enable_ddw() + - Revert ncsi: Propagate carrier gain/loss events to the NCSI controller + - Revert "i2c: pxa: move to generic GPIO recovery" + - lsm: fix default return value for vm_enough_memory + - lsm: fix default return value for inode_getsecctx + - sbsa_gwdt: Calculate timeout with 64-bit math + - i2c: designware: Disable TX_EMPTY irq while waiting for block length byte + - s390/ap: fix AP bus crash on early config change callback invocation + - net: ethtool: Fix documentation of ethtool_sprintf() + - net: dsa: lan9303: consequently nested-lock physical MDIO + - net: phylink: initialize carrier state at creation + - i2c: i801: fix potential race in i801_block_transaction_byte_by_byte + - f2fs: avoid format-overflow warning + - media: lirc: drop trailing space from scancode transmit + - media: sharp: fix sharp encoding + - media: venus: hfi_parser: Add check to keep the number of codecs within + range + - media: venus: hfi: fix the check to handle session buffer requirement + - media: venus: hfi: add checks to handle capabilities from firmware + - media: ccs: Correctly initialise try compose rectangle + - nfsd: fix file memleak on client_opens_release + - riscv: kprobes: allow writing to x0 + - mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2 + - mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors + - r8169: fix network lost after resume on DASH systems + - mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER + - media: qcom: camss: Fix pm_domain_on sequence in probe + - media: qcom: camss: Fix vfe_get() error jump + - media: qcom: camss: Fix VFE-17x vfe_disable_output() + - media: qcom: camss: Fix missing vfe_lite clocks check + - ext4: apply umask if ACL support is disabled + - ext4: correct offset of gdb backup in non meta_bg group to update_backups + - ext4: correct return value of ext4_convert_meta_bg + - ext4: correct the start block of counting reserved clusters + - ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks + - ext4: add missed brelse in update_backups + - drm/amd/pm: Handle non-terminated overdrive commands. + - drm/i915: Fix potential spectre vulnerability + - drm/amdgpu: don't use ATRM for external devices + - drm/amdgpu: fix error handling in amdgpu_bo_list_get() + - drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox + - powerpc/powernv: Fix fortify source warnings in opal-prd.c + - tracing: Have trace_event_file have ref counters + - Input: xpad - add VID for Turtle Beach controllers + - driver core: Release all resources during unbind before updating device + links + - Linux 5.15.140 + * CVE-2023-46862 + - io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid + * Jammy update: v5.15.139 upstream stable release (LP: #2049432) + - iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user() + - sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 + - sched: Fix stop_one_cpu_nowait() vs hotplug + - vfs: fix readahead(2) on block devices + - writeback, cgroup: switch inodes with dirty timestamps to release dying + cgwbs + - x86/srso: Fix SBPB enablement for (possible) future fixed HW + - futex: Don't include process MM in futex key on no-MMU + - x86: Share definition of __is_canonical_address() + - x86/sev-es: Allow copy_from_kernel_nofault() in earlier boot + - x86/boot: Fix incorrect startup_gdt_descr.size + - pstore/platform: Add check for kstrdup + - genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() + - i40e: fix potential memory leaks in i40e_remove() + - selftests/bpf: Test tail call counting with bpf2bpf and data on stack + - selftests/bpf: Correct map_fd to data_fd in tailcalls + - udp: add missing WRITE_ONCE() around up->encap_rcv + - tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed + - gve: Use size_add() in call to struct_size() + - mlxsw: Use size_mul() in call to struct_size() + - tipc: Use size_add() in calls to struct_size() + - net: spider_net: Use size_add() in call to struct_size() + - wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file() + - wifi: mt76: mt7603: rework/fix rx pse hang check + - mt76: dma: use kzalloc instead of devm_kzalloc for txwi + - mt76: add support for overriding the device used for DMA mapping + - mt76: pass original queue id from __mt76_tx_queue_skb to the driver + - wifi: mt76: mt7603: improve stuck beacon handling + - tcp_metrics: add missing barriers on delete + - tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics() + - tcp_metrics: do not create an entry from tcp_init_metrics() + - wifi: rtlwifi: fix EDCA limit set by BT coexistence + - can: dev: can_restart(): don't crash kernel if carrier is OK + - can: dev: can_restart(): fix race condition between controller restart and + netif_carrier_on() + - can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is + accessed out of bounds + - PM / devfreq: rockchip-dfi: Make pmu regmap mandatory + - netfilter: nf_tables: Drop pointless memset when dumping rules + - thermal: core: prevent potential string overflow + - r8169: use tp_to_dev instead of open code + - r8169: fix rare issue with broken rx after link-down on RTL8125 + - chtls: fix tp->rcv_tstamp initialization + - tcp: fix cookie_init_timestamp() overflows + - iwlwifi: pcie: adjust to Bz completion descriptor + - wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues + - wifi: iwlwifi: pcie: synchronize IRQs before NAPI + - wifi: iwlwifi: empty overflow queue during flush + - ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() + - ipv6: avoid atomic fragment on GSO packets + - net: add DEV_STATS_READ() helper + - ipvlan: properly track tx_errors + - regmap: debugfs: Fix a erroneous check after snprintf() + - spi: tegra: Fix missing IRQ check in tegra_slink_probe() + - clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies + - clk: qcom: mmcc-msm8998: Don't check halt bit on some branch clks + - clk: qcom: mmcc-msm8998: Fix the SMMU GDSC + - clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src + - clk: imx: Select MXC_CLK for CLK_IMX8QXP + - clk: imx: imx8mq: correct error handling path + - clk: imx: imx8qxp: Fix elcdif_pll clock + - clk: renesas: rzg2l: Simplify multiplication/shift logic + - clk: renesas: rzg2l: Use FIELD_GET() for PLL register fields + - clk: renesas: rzg2l: Fix computation formula + - spi: nxp-fspi: use the correct ioremap function + - clk: keystone: pll: fix a couple NULL vs IS_ERR() checks + - clk: ti: Add ti_dt_clk_name() helper to use clock-output-names + - clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() + - clk: ti: Update component clocks to use ti_dt_clk_name() + - clk: ti: change ti_clk_register[_omap_hw]() API + - clk: ti: fix double free in of_ti_divider_clk_setup() + - clk: npcm7xx: Fix incorrect kfree + - clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data + - clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data + - clk: qcom: config IPQ_APSS_6018 should depend on QCOM_SMEM + - platform/x86: wmi: Fix probe failure when failing to register WMI devices + - platform/x86: wmi: remove unnecessary initializations + - platform/x86: wmi: Fix opening of char device + - hwmon: (axi-fan-control) Fix possible NULL pointer dereference + - hwmon: (coretemp) Fix potentially truncated sysfs attribute name + - drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs + - drm/rockchip: vop: Fix call to crtc reset helper + - drm/radeon: possible buffer overflow + - drm/mipi-dsi: Create devm device registration + - drm/mipi-dsi: Create devm device attachment + - drm/bridge: lt8912b: Switch to devm MIPI-DSI helpers + - drm/bridge: lt8912b: Register and attach our DSI device at probe + - drm/bridge: lt8912b: Add hot plug detection + - drm/bridge: lt8912b: Fix bridge_detach + - drm/bridge: lt8912b: Fix crash on bridge detach + - drm/bridge: lt8912b: Manually disable HPD only if it was enabled + - drm/bridge: lt8912b: Add missing drm_bridge_attach call + - drm/bridge: tc358768: Fix use of uninitialized variable + - drm/bridge: tc358768: Disable non-continuous clock mode + - drm/bridge: tc358768: Fix bit updates + - drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code + - drm/mediatek: Fix iommu fault by swapping FBs after updating plane state + - drm/mediatek: Fix iommu fault during crtc enabling + - drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe() + - arm64/arm: xen: enlighten: Fix KPTI checks + - drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map() + - xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled + - drm/msm/dsi: use msm_gem_kernel_put to free TX buffer + - drm: mediatek: mtk_dsi: Fix NO_EOT_PACKET settings/handling + - perf: hisi: Fix use-after-free when register pmu fails + - ARM: dts: renesas: blanche: Fix typo in GP_11_2 pin name + - arm64: dts: qcom: msm8916: Fix iommu local address range + - arm64: dts: qcom: msm8992-libra: drop duplicated reserved memory + - arm64: dts: qcom: sc7280: Add missing LMH interrupts + - arm64: dts: qcom: sdm845-mtp: fix WiFi configuration + - ARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins + - arm64: dts: qcom: apq8016-sbc: Add missing ADV7533 regulators + - ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator + - soc: qcom: llcc: Handle a second device without data corruption + - firmware: ti_sci: Mark driver as non removable + - firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device + - clk: scmi: Free scmi_clk allocated when the clocks with invalid info are + skipped + - arm64: dts: imx8qm-ss-img: Fix jpegenc compatible entry + - arm64: dts: imx8mm: Add sound-dai-cells to micfil node + - arm64: dts: imx8mn: Add sound-dai-cells to micfil node + - selftests/pidfd: Fix ksft print formats + - selftests/resctrl: Ensure the benchmark commands fits to its array + - crypto: hisilicon/hpre - Fix a erroneous check after snprintf() + - hwrng: geode - fix accessing registers + - RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() + - scsi: ibmvfc: Fix erroneous use of rtas_busy_delay with hcall return code + - libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return + value + - nd_btt: Make BTT lanes preemptible + - crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure + - crypto: caam/jr - fix Chacha20 + Poly1305 self test failure + - crypto: qat - increase size of buffers + - hid: cp2112: Fix duplicate workqueue initialization + - ARM: 9321/1: memset: cast the constant byte to unsigned char + - ext4: move 'ix' sanity check to corrent position + - ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not + described + - IB/mlx5: Fix rdma counter binding for RAW QP + - RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common() + - RDMA/hns: Fix signed-unsigned mixed comparisons + - RDMA/hns: The UD mode can only be configured with DCQCN + - ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe + - scsi: ufs: core: Leave space for '\0' in utf8 desc string + - RDMA/hfi1: Workaround truncation compilation error + - hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip + - sh: bios: Revive earlyprintk support + - Revert "HID: logitech-hidpp: add a module parameter to keep firmware + gestures" + - HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk + - HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only + - HID: logitech-hidpp: Revert "Don't restart communication if not necessary" + - HID: logitech-hidpp: Move get_wireless_feature_index() check to + hidpp_connect_event() + - ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails + - padata: Fix refcnt handling in padata_free_shell() + - crypto: qat - fix deadlock in backlog processing + - ASoC: ams-delta.c: use component after check + - mfd: core: Un-constify mfd_cell.of_reg + - mfd: core: Ensure disabled devices are skipped without aborting + - mfd: dln2: Fix double put in dln2_probe + - mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs + - leds: turris-omnia: Drop unnecessary mutex locking + - leds: turris-omnia: Do not use SMBUS calls + - leds: pwm: Don't disable the PWM when the LED should be off + - leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu' + - f2fs: compress: fix to avoid use-after-free on dic + - f2fs: compress: fix to avoid redundant compress extension + - tty: tty_jobctrl: fix pid memleak in disassociate_ctty() + - livepatch: Fix missing newline character in klp_resolve_symbols() + - dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers + - usb: dwc2: fix possible NULL pointer dereference caused by driver + concurrency + - usb: chipidea: Fix DMA overwrite for Tegra + - usb: chipidea: Simplify Tegra DMA alignment code + - dmaengine: ti: edma: handle irq_of_parse_and_map() errors + - misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() + - tools: iio: iio_generic_buffer ensure alignment + - USB: usbip: fix stub_dev hub disconnect + - dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() + - f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() + - powerpc: Only define __parse_fpscr() when required + - modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host + - powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro + - powerpc/xive: Fix endian conversion size + - powerpc/imc-pmu: Use the correct spinlock initializer. + - powerpc/pseries: fix potential memory leak in init_cpu_associativity() + - usb: host: xhci-plat: fix possible kernel oops while resuming + - perf machine: Avoid out of bounds LBR memory read + - perf hist: Add missing puts to hist__account_cycles + - 9p/net: fix possible memory leak in p9_check_errors() + - i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs + - cxl/mem: Fix shutdown order + - rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call + - pcmcia: cs: fix possible hung task and memory leak pccardd() + - pcmcia: ds: fix refcount leak in pcmcia_device_add() + - pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() + - media: i2c: max9286: Fix some redundant of_node_put() calls + - media: bttv: fix use after free error due to btv->timeout timer + - media: s3c-camif: Avoid inappropriate kfree() + - media: vidtv: psi: Add check for kstrdup + - media: vidtv: mux: Add check and kfree for kstrdup + - media: cedrus: Fix clock/reset sequence + - media: dvb-usb-v2: af9035: fix missing unlock + - regmap: prevent noinc writes from clobbering cache + - pwm: sti: Reduce number of allocations and drop usage of chip_data + - pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume + - Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() + - llc: verify mac len before reading mac header + - hsr: Prevent use after free in prp_create_tagged_frame() + - tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING + - bpf: Check map->usercnt after timer->timer is assigned + - inet: shrink struct flowi_common + - octeontx2-pf: Fix error codes + - octeontx2-pf: Fix holes in error code + - dccp: Call security_inet_conn_request() after setting IPv4 addresses. + - dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses. + - Fix termination state for idr_for_each_entry_ul() + - net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs + - selftests: pmtu.sh: fix result checking + - net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT + - net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc + - net/smc: put sk reference if close work was canceled + - tg3: power down device only on SYSTEM_POWER_OFF + - block: remove unneeded return value of bio_check_ro() + - blk-core: use pr_warn_ratelimited() in bio_check_ro() + - r8169: respect userspace disabling IFF_MULTICAST + - i2c: iproc: handle invalid slave state + - netfilter: xt_recent: fix (increase) ipv6 literal buffer length + - netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate + eval call-backs + - netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses + - drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE + - ASoC: hdmi-codec: register hpd callback on component probe + - spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies + - fbdev: imsttfb: Fix error path of imsttfb_probe() + - fbdev: imsttfb: fix a resource leak in probe + - fbdev: fsl-diu-fb: mark wr_reg_wa() static + - tracing/kprobes: Fix the order of argument descriptions + - btrfs: use u64 for buffer sizes in the tree search ioctls + - Linux 5.15.139 + * Jammy update: v5.15.138 upstream stable release (LP: #2049417) + - ASoC: codecs: wcd938x: fix resource leaks on bind errors + - ASoC: codecs: wcd938x: fix runtime PM imbalance on remove + - pinctrl: qcom: lpass-lpi: fix concurrent register updates + - tcp: remove dead code from tcp_sendmsg_locked() + - tcp: cleanup tcp_remove_empty_skb() use + - mptcp: more conservative check for zero probes + - mcb: Return actual parsed size when reading chameleon table + - mcb-lpc: Reallocate memory region to avoid memory overlapping + - virtio_balloon: Fix endless deflation and inflation on arm64 + - virtio-mmio: fix memory leak of vm_dev + - vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE + - mm/page_alloc: correct start page when guard page debug is enabled + - mm/migrate: fix do_pages_move for compat pointers + - nfsd: lock_rename() needs both directories to live on the same fs + - drm/i915/pmu: Check if pmu is closed before stopping event + - vsock/virtio: factor our the code to initialize and delete VQs + - vsock/virtio: add support for device suspend/resume + - vsock/virtio: initialize the_virtio_vsock before using VQs + - drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() + - firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels() + - r8169: fix the KCSAN reported data-race in rtl_tx() while reading tp->cur_tx + - r8169: fix the KCSAN reported data-race in rtl_tx while reading + TxDescArray[entry].opts1 + - r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1 + - i40e: Fix I40E_FLAG_VF_VLAN_PRUNING value + - treewide: Spelling fix in comment + - igb: Fix potential memory leak in igb_add_ethtool_nfc_entry + - neighbour: fix various data-races + - igc: Fix ambiguity in the ethtool advertising + - net: ieee802154: adf7242: Fix some potential buffer overflow in + adf7242_stats_show() + - net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg + - r8152: Increase USB control msg timeout to 5000ms as per spec + - r8152: Run the unload routine if we have errors during probe + - r8152: Cancel hw_phy_work if we have an error in probe + - r8152: Release firmware if we have an error in probe + - tcp: fix wrong RTO timeout when received SACK reneging + - gtp: uapi: fix GTPA_MAX + - gtp: fix fragmentation needed check with gso + - i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR + - kasan: print the original fault addr when access invalid shadow + - iio: exynos-adc: request second interupt only when touchscreen mode is used + - iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds + - iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale + - i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() + - i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() + - i2c: stm32f7: Fix PEC handling in case of SMBUS transfers + - i2c: aspeed: Fix i2c bus hang in slave read + - tracing/kprobes: Fix the description of variable length arguments + - misc: fastrpc: Clean buffers on remote invocation failures + - nvmem: imx: correct nregs for i.MX6ULL + - nvmem: imx: correct nregs for i.MX6SLL + - nvmem: imx: correct nregs for i.MX6UL + - perf/core: Fix potential NULL deref + - sparc32: fix a braino in fault handling in csum_and_copy_..._user() + - clk: Sanitize possible_parent_show to Handle Return Value of + of_clk_get_parent_name + - iio: afe: rescale: reorder includes + - iio: afe: rescale: expose scale processing function + - iio: afe: rescale: add offset support + - iio: afe: rescale: Accept only offset channels + - gve: Fix GFP flags when allocing pages + - x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility + - x86/mm: Simplify RESERVE_BRK() + - x86/mm: Fix RESERVE_BRK() for older binutils + - ext4: add two helper functions extent_logical_end() and pa_logical_end() + - ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow + - ext4: avoid overlapping preallocations due to overflow + - objtool/x86: add missing embedded_insn check + - driver: platform: Add helper for safer setting of driver_override + - rpmsg: Constify local variable in field store macro + - rpmsg: Fix kfree() of static memory on setting driver_override + - rpmsg: Fix calling device_lock() on non-initialized device + - rpmsg: glink: Release driver_override + - rpmsg: Fix possible refcount leak in rpmsg_register_device_override() + - x86: Fix .brk attribute in linker script + - ASoC: simple-card: fixup asoc_simple_probe() error handling + - net: sched: cls_u32: Fix allocation size in u32_init() + - irqchip/riscv-intc: Mark all INTC nodes as initialized + - irqchip/stm32-exti: add missing DT IRQ flag translation + - dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe + - powerpc/85xx: Fix math emulation exception + - Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport + - fbdev: atyfb: only use ioremap_uc() on i386 and ia64 + - fs/ntfs3: Add ckeck in ni_update_parent() + - fs/ntfs3: Write immediately updated ntfs state + - fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) + - fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() + - fs/ntfs3: Fix NULL pointer dereference on error in attr_allocate_frame() + - fs/ntfs3: Fix directory element type detection + - fs/ntfs3: Avoid possible memory leak + - spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 + - netfilter: nfnetlink_log: silence bogus compiler warning + - ASoC: rt5650: fix the wrong result of key button + - drm/ttm: Reorder sys manager cleanup step + - fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit() + - scsi: mpt3sas: Fix in error path + - platform/mellanox: mlxbf-tmfifo: Fix a warning message + - net: chelsio: cxgb4: add an error code check in t4_load_phy_fw + - r8152: Check for unplug in rtl_phy_patch_request() + - r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() + - powerpc/mm: Fix boot crash with FLATMEM + - can: isotp: set max PDU size to 64 kByte + - can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting + - can: isotp: check CAN address family in isotp_bind() + - can: isotp: handle wait_event_interruptible() return values + - can: isotp: add local echo tx processing and tx without FC + - can: isotp: isotp_bind(): do not validate unused address information + - can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior + - drm/amd: Move helper for dynamic speed switch check out of smu13 + - drm/amd: Disable ASPM for VI w/ all Intel systems + - PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device + - usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" + compatibility + - usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() + - usb: raw-gadget: properly handle interrupted requests + - tty: n_gsm: fix race condition in status line change on dead connections + - tty: 8250: Remove UC-257 and UC-431 + - tty: 8250: Add support for additional Brainboxes UC cards + - tty: 8250: Add support for Brainboxes UP cards + - tty: 8250: Add support for Intashield IS-100 + - tty: 8250: Fix port count of PX-257 + - tty: 8250: Fix up PX-803/PX-857 + - tty: 8250: Add support for additional Brainboxes PX cards + - tty: 8250: Add support for Intashield IX cards + - tty: 8250: Add Brainboxes Oxford Semiconductor-based quirks + - misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support + - ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection + - Linux 5.15.138 + * Jammy update: v5.15.137 upstream stable release (LP: #2049350) + - lib/Kconfig.debug: do not enable DEBUG_PREEMPT by default + - Documentation: sysctl: align cells in second content column + - xfs: don't expose internal symlink metadata buffers to the vfs + - Bluetooth: hci_event: Ignore NULL link key + - Bluetooth: Reject connection with the device which has same BD_ADDR + - Bluetooth: Fix a refcnt underflow problem for hci_conn + - Bluetooth: vhci: Fix race when opening vhci device + - Bluetooth: hci_event: Fix coding style + - Bluetooth: avoid memcmp() out of bounds warning + - ice: fix over-shifted variable + - ice: reset first in crash dump kernels + - nfc: nci: fix possible NULL pointer dereference in send_acknowledge() + - regmap: fix NULL deref on lookup + - KVM: x86: Mask LVTPC when handling a PMI + - tcp: check mptcp-level constraints for backlog coalescing + - fs/ntfs3: Fix possible null-pointer dereference in hdr_find_e() + - fs/ntfs3: fix panic about slab-out-of-bounds caused by ntfs_list_ea() + - fs/ntfs3: fix deadlock in mark_as_free_ex + - netfilter: nft_payload: fix wrong mac header matching + - drm/i915: Retry gtt fault when out of fence registers + - ASoC: codecs: wcd938x-sdw: fix use after free on driver unbind + - ASoC: codecs: wcd938x-sdw: fix runtime PM imbalance on probe errors + - ASoC: codecs: wcd938x: drop bogus bind error handling + - ASoC: codecs: wcd938x: fix unbind tear down order + - qed: fix LL2 RX buffer allocation + - xfrm: fix a data-race in xfrm_gen_index() + - xfrm: interface: use DEV_STATS_INC() + - net: ipv4: fix return value check in esp_remove_trailer + - net: ipv6: fix return value check in esp_remove_trailer + - net: rfkill: gpio: prevent value glitch during probe + - tcp: fix excessive TLP and RACK timeouts from HZ rounding + - tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb + - tun: prevent negative ifindex + - ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr + - net: usb: smsc95xx: Fix an error code in smsc95xx_reset() + - i40e: prevent crash on probe if hw registers have invalid values + - net: dsa: bcm_sf2: Fix possible memory leak in bcm_sf2_mdio_register() + - bonding: Return pointer to data after pull on skb + - net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve + - neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section + - netfilter: nft_set_rbtree: .deactivate fails if element has expired + - netfilter: nf_tables: do not remove elements if set backend implements + .abort + - netfilter: nf_tables: revert do not remove elements if set backend + implements .abort + - net: pktgen: Fix interface flags printing + - selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and + hugetlb_reparenting_test.sh that may cause error + - serial: 8250: omap: Fix imprecise external abort for omap_8250_pm() + - serial: 8250_omap: Fix errors with no_console_suspend + - iio: Un-inline iio_buffer_enabled() + - iio: core: Hide read accesses to iio_dev->currentmode + - iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs + - iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data() + - iio: adc: ad7192: Correct reference voltage + - perf: Add irq and exception return branch types + - perf/x86: Move branch classifier + - perf/x86/lbr: Filter vsyscall addresses + - drm/atomic-helper: relax unregistered connector check + - powerpc/32s: Remove capability to disable KUEP at boottime + - powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly + - powerpc/47x: Fix 47x syscall return crash + - mctp: Allow local delivery to the null EID + - mctp: perform route lookups under a RCU read-side lock + - nfp: flower: avoid rmmod nfp crash issues + - ksmbd: not allow to open file if delelete on close bit is set + - ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone + - fs-writeback: do not requeue a clean inode having skipped pages + - btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 + - btrfs: initialize start_slot in btrfs_log_prealloc_extents + - i2c: mux: Avoid potential false error message in i2c_mux_add_adapter + - overlayfs: set ctime when setting mtime and atime + - gpio: timberdale: Fix potential deadlock on &tgpio->lock + - ata: libata-core: Fix compilation warning in ata_dev_config_ncq() + - ata: libata-eh: Fix compilation warning in ata_eh_link_report() + - tracing: relax trace_event_eval_update() execution with cond_resched() + - wifi: mwifiex: Sanity check tlv_len and tlv_bitmap_len + - wifi: iwlwifi: Ensure ack flag is properly cleared. + - HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event + - Bluetooth: btusb: add shutdown function for QCA6174 + - Bluetooth: Avoid redundant authentication + - Bluetooth: hci_core: Fix build warnings + - wifi: cfg80211: Fix 6GHz scan configuration + - wifi: mac80211: allow transmitting EAPOL frames with tainted key + - wifi: cfg80211: avoid leaking stack data into trace + - regulator/core: Revert "fix kobject release warning and memory leak in + regulator_register()" + - sky2: Make sure there is at least one frag_addr available + - ipv4/fib: send notify when delete source address routes + - drm: panel-orientation-quirks: Add quirk for One Mix 2S + - btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c + - btrfs: error out when COWing block using a stale transaction + - btrfs: error when COWing block from a root that is being deleted + - btrfs: error out when reallocating block for defrag using a stale + transaction + - HID: multitouch: Add required quirk for Synaptics 0xcd7e device + - platform/x86: touchscreen_dmi: Add info for the Positivo C4128B + - net/mlx5: Handle fw tracer change ownership event based on MTRC + - Bluetooth: hci_event: Fix using memcmp when comparing keys + - net: introduce a function to check if a netdev name is in use + - net: move from strlcpy with unused retval to strscpy + - net: fix ifname in netlink ntf during netns move + - mtd: rawnand: qcom: Unmap the right resource upon probe failure + - mtd: rawnand: pl353: Ensure program page operations are successful + - mtd: rawnand: marvell: Ensure program page operations are successful + - mtd: rawnand: arasan: Ensure program page operations are successful + - mtd: spinand: micron: correct bitmask for ecc status + - mtd: physmap-core: Restore map_rom fallback + - mmc: mtk-sd: Use readl_poll_timeout_atomic in msdc_reset_hw + - mmc: core: sdio: hold retuning if sdio in 1-bit mode + - pNFS: Fix a hang in nfs4_evict_inode() + - NFSv4.1: fixup use EXCHGID4_FLAG_USE_PNFS_DS for DS server + - ACPI: irq: Fix incorrect return value in acpi_register_gsi() + - nvme-pci: add BOGUS_NID for Intel 0a54 device + - nvme-rdma: do not try to stop unallocated queues + - USB: serial: option: add Telit LE910C4-WWX 0x1035 composition + - USB: serial: option: add entry for Sierra EM9191 with new firmware + - USB: serial: option: add Fibocom to DELL custom modem FM101R-GL + - s390/pci: fix iommu bitmap allocation + - selftests/ftrace: Add new test case which checks non unique symbol + - s390/cio: fix a memleak in css_alloc_subchannel + - platform/surface: platform_profile: Propagate error if profile registration + fails + - platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e + - platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events + - gpio: vf610: set value before the direction to avoid a glitch + - ASoC: pxa: fix a memory leak in probe() + - serial: 8250: omap: Move uart_write() inside PM section + - phy: mapphone-mdm6600: Fix runtime disable on probe + - phy: mapphone-mdm6600: Fix runtime PM for remove + - phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins + - Bluetooth: hci_sock: fix slab oob read in create_monitor_event + - Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name + - xfrm6: fix inet6_dev refcount underflow problem + - Linux 5.15.137 + * CVE-2023-51782 + - net/rose: Fix Use-After-Free in rose_ioctl + * CVE-2023-51779 + - Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg + * CVE-2023-22995 + - usb: dwc3: dwc3-qcom: Add missing platform_device_put() in + dwc3_qcom_acpi_register_core + * CVE-2023-4134 + - Input: cyttsp4_core - change del_timer_sync() to timer_shutdown_sync() + * Packaging resync (LP: #1786013) + - [Packaging] update annotations scripts + + -- Stefan Bader Mon, 12 Feb 2024 14:52:30 +0100 + linux-lowlatency (5.15.0-97.107) jammy; urgency=medium * jammy/linux-lowlatency: 5.15.0-97.107 -proposed tracker (LP: #2052256) diff -u linux-lowlatency-5.15.0/debian/control linux-lowlatency-5.15.0/debian/control --- linux-lowlatency-5.15.0/debian/control +++ linux-lowlatency-5.15.0/debian/control @@ -61,7 +61,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-lowlatency-headers-5.15.0-97 +Package: linux-lowlatency-headers-5.15.0-100 Build-Profiles: Architecture: all Multi-Arch: foreign @@ -71,7 +71,7 @@ Description: Header files related to Linux kernel version 5.15.0 This package provides kernel header files for version 5.15.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-lowlatency-headers-5.15.0-97/debian.README.gz for details + /usr/share/doc/linux-lowlatency-headers-5.15.0-100/debian.README.gz for details Package: linux-lowlatency-tools-common Build-Profiles: @@ -85,18 +85,18 @@ version locked tools (such as perf and x86_energy_perf_policy) for version 5.15.0. -Package: linux-lowlatency-tools-5.15.0-97 +Package: linux-lowlatency-tools-5.15.0-100 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.15.0-97 +Description: Linux kernel version specific tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.15.0-97 on + version 5.15.0-100 on 64 bit x86. - You probably want to install linux-tools-5.15.0-97-. + You probably want to install linux-tools-5.15.0-100-. Package: linux-lowlatency-cloud-tools-common Build-Profiles: @@ -109,17 +109,17 @@ This package provides the architecture independent parts for kernel version locked tools for cloud tools for version 5.15.0. -Package: linux-lowlatency-cloud-tools-5.15.0-97 +Package: linux-lowlatency-cloud-tools-5.15.0-100 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.15.0-97 +Description: Linux kernel version specific cloud tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel - version locked tools for cloud tools for version 5.15.0-97 on + version locked tools for cloud tools for version 5.15.0-100 on 64 bit x86. - You probably want to install linux-cloud-tools-5.15.0-97-. + You probably want to install linux-cloud-tools-5.15.0-100-. Package: linux-lowlatency-tools-host Build-Profiles: @@ -133,17 +133,17 @@ -Package: linux-image-unsigned-5.15.0-97-lowlatency +Package: linux-image-unsigned-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional Provides: linux-image, fuse-module, kvm-api-4, redhat-cluster-modules, ivtv-modules, virtualbox-guest-modules [amd64], ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.15.0-97-lowlatency +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.15.0-100-lowlatency Recommends: grub-pc [amd64] | grub-efi-amd64 [amd64] | grub-efi-ia32 [amd64] | grub [amd64] | lilo [amd64] | flash-kernel [armhf arm64] | grub-efi-arm64 [arm64] | grub-efi-arm [armhf], initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.15.0-97-lowlatency -Suggests: fdutils, linux-doc | linux-lowlatency-source-5.15.0, linux-lowlatency-tools, linux-headers-5.15.0-97-lowlatency, linux-modules-extra-5.15.0-97-lowlatency +Conflicts: linux-image-5.15.0-100-lowlatency +Suggests: fdutils, linux-doc | linux-lowlatency-source-5.15.0, linux-lowlatency-tools, linux-headers-5.15.0-100-lowlatency, linux-modules-extra-5.15.0-100-lowlatency Description: Linux kernel image for version 5.15.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.15.0 on 64 bit x86 SMP. @@ -156,12 +156,12 @@ the linux-lowlatency meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.15.0-97-lowlatency +Package: linux-modules-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-97-lowlatency | linux-image-unsigned-5.15.0-97-lowlatency +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-100-lowlatency | linux-image-unsigned-5.15.0-100-lowlatency Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -176,12 +176,12 @@ the linux-lowlatency meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.15.0-97-lowlatency +Package: linux-modules-extra-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-97-lowlatency | linux-image-unsigned-5.15.0-97-lowlatency, wireless-regdb +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-100-lowlatency | linux-image-unsigned-5.15.0-100-lowlatency, wireless-regdb Description: Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP. @@ -198,21 +198,21 @@ the linux-lowlatency meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.15.0-97-lowlatency +Package: linux-headers-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-headers-5.15.0-97, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-lowlatency-headers-5.15.0-100, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.15.0 on 64 bit x86 SMP This package provides kernel header files for version 5.15.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.15.0-97/debian.README.gz for details. + /usr/share/doc/linux-headers-5.15.0-100/debian.README.gz for details. -Package: linux-image-unsigned-5.15.0-97-lowlatency-dbgsym +Package: linux-image-unsigned-5.15.0-100-lowlatency-dbgsym Build-Profiles: Architecture: amd64 arm64 Section: devel @@ -229,31 +229,31 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.15.0-97-lowlatency +Package: linux-tools-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-tools-5.15.0-97 -Description: Linux kernel version specific tools for version 5.15.0-97 +Depends: ${misc:Depends}, linux-lowlatency-tools-5.15.0-100 +Description: Linux kernel version specific tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.15.0-97 on + version 5.15.0-100 on 64 bit x86. -Package: linux-cloud-tools-5.15.0-97-lowlatency +Package: linux-cloud-tools-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-cloud-tools-5.15.0-97 -Description: Linux kernel version specific cloud tools for version 5.15.0-97 +Depends: ${misc:Depends}, linux-lowlatency-cloud-tools-5.15.0-100 +Description: Linux kernel version specific cloud tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.15.0-97 on + version locked tools for cloud for version 5.15.0-100 on 64 bit x86. -Package: linux-buildinfo-5.15.0-97-lowlatency +Package: linux-buildinfo-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: kernel @@ -267,18 +267,18 @@ You likely do not want to install this package. -Package: linux-modules-iwlwifi-5.15.0-97-lowlatency +Package: linux-modules-iwlwifi-5.15.0-100-lowlatency Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional Depends: ${misc:Depends}, - linux-image-5.15.0-97-lowlatency | linux-image-unsigned-5.15.0-97-lowlatency, + linux-image-5.15.0-100-lowlatency | linux-image-unsigned-5.15.0-100-lowlatency, Built-Using: ${linux:BuiltUsing} -Description: Linux kernel iwlwifi modules for version 5.15.0-97 +Description: Linux kernel iwlwifi modules for version 5.15.0-100 This package provides the Linux kernel iwlwifi modules for version - 5.15.0-97. + 5.15.0-100. . You likely do not want to install this package directly. Instead, install the one of the linux-modules-iwlwifi-lowlatency* meta-packages, @@ -286,17 +286,17 @@ also installed. -Package: linux-image-unsigned-5.15.0-97-lowlatency-64k +Package: linux-image-unsigned-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: kernel Priority: optional Provides: linux-image, fuse-module, kvm-api-4, redhat-cluster-modules, ivtv-modules, ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.15.0-97-lowlatency-64k +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.15.0-100-lowlatency-64k Recommends: grub-efi-arm64 [arm64] | flash-kernel [arm64], initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.15.0-97-lowlatency-64k -Suggests: fdutils, linux-doc | linux-lowlatency-source-5.15.0, linux-lowlatency-tools, linux-headers-5.15.0-97-lowlatency-64k, linux-modules-extra-5.15.0-97-lowlatency-64k +Conflicts: linux-image-5.15.0-100-lowlatency-64k +Suggests: fdutils, linux-doc | linux-lowlatency-source-5.15.0, linux-lowlatency-tools, linux-headers-5.15.0-100-lowlatency-64k, linux-modules-extra-5.15.0-100-lowlatency-64k Description: Linux kernel image for version 5.15.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.15.0 on 64 bit x86 SMP. @@ -309,12 +309,12 @@ the linux-lowlatency-64k meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.15.0-97-lowlatency-64k +Package: linux-modules-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-97-lowlatency-64k | linux-image-unsigned-5.15.0-97-lowlatency-64k +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-100-lowlatency-64k | linux-image-unsigned-5.15.0-100-lowlatency-64k Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -329,12 +329,12 @@ the linux-lowlatency-64k meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.15.0-97-lowlatency-64k +Package: linux-modules-extra-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-97-lowlatency-64k | linux-image-unsigned-5.15.0-97-lowlatency-64k, wireless-regdb +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.15.0-100-lowlatency-64k | linux-image-unsigned-5.15.0-100-lowlatency-64k, wireless-regdb Description: Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP. @@ -351,21 +351,21 @@ the linux-lowlatency-64k meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.15.0-97-lowlatency-64k +Package: linux-headers-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-headers-5.15.0-97, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-lowlatency-headers-5.15.0-100, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.15.0 on 64 bit x86 SMP This package provides kernel header files for version 5.15.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.15.0-97/debian.README.gz for details. + /usr/share/doc/linux-headers-5.15.0-100/debian.README.gz for details. -Package: linux-image-unsigned-5.15.0-97-lowlatency-64k-dbgsym +Package: linux-image-unsigned-5.15.0-100-lowlatency-64k-dbgsym Build-Profiles: Architecture: arm64 Section: devel @@ -382,31 +382,31 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.15.0-97-lowlatency-64k +Package: linux-tools-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-tools-5.15.0-97 -Description: Linux kernel version specific tools for version 5.15.0-97 +Depends: ${misc:Depends}, linux-lowlatency-tools-5.15.0-100 +Description: Linux kernel version specific tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.15.0-97 on + version 5.15.0-100 on 64 bit x86. -Package: linux-cloud-tools-5.15.0-97-lowlatency-64k +Package: linux-cloud-tools-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-lowlatency-cloud-tools-5.15.0-97 -Description: Linux kernel version specific cloud tools for version 5.15.0-97 +Depends: ${misc:Depends}, linux-lowlatency-cloud-tools-5.15.0-100 +Description: Linux kernel version specific cloud tools for version 5.15.0-100 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.15.0-97 on + version locked tools for cloud for version 5.15.0-100 on 64 bit x86. -Package: linux-buildinfo-5.15.0-97-lowlatency-64k +Package: linux-buildinfo-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: kernel @@ -420,18 +420,18 @@ You likely do not want to install this package. -Package: linux-modules-iwlwifi-5.15.0-97-lowlatency-64k +Package: linux-modules-iwlwifi-5.15.0-100-lowlatency-64k Build-Profiles: Architecture: arm64 Section: kernel Priority: optional Depends: ${misc:Depends}, - linux-image-5.15.0-97-lowlatency-64k | linux-image-unsigned-5.15.0-97-lowlatency-64k, + linux-image-5.15.0-100-lowlatency-64k | linux-image-unsigned-5.15.0-100-lowlatency-64k, Built-Using: ${linux:BuiltUsing} -Description: Linux kernel iwlwifi modules for version 5.15.0-97 +Description: Linux kernel iwlwifi modules for version 5.15.0-100 This package provides the Linux kernel iwlwifi modules for version - 5.15.0-97. + 5.15.0-100. . You likely do not want to install this package directly. Instead, install the one of the linux-modules-iwlwifi-lowlatency-64k* meta-packages, diff -u linux-lowlatency-5.15.0/drivers/acpi/acpi_fpdt.c linux-lowlatency-5.15.0/drivers/acpi/acpi_fpdt.c --- linux-lowlatency-5.15.0/drivers/acpi/acpi_fpdt.c +++ linux-lowlatency-5.15.0/drivers/acpi/acpi_fpdt.c @@ -194,12 +194,19 @@ record_header = (void *)subtable_header + offset; offset += record_header->length; + if (!record_header->length) { + pr_err(FW_BUG "Zero-length record found in FPTD.\n"); + result = -EINVAL; + goto err; + } + switch (record_header->type) { case RECORD_S3_RESUME: if (subtable_type != SUBTABLE_S3PT) { pr_err(FW_BUG "Invalid record %d for subtable %s\n", record_header->type, signature); - return -EINVAL; + result = -EINVAL; + goto err; } if (record_resume) { pr_err("Duplicate resume performance record found.\n"); @@ -208,7 +215,7 @@ record_resume = (struct resume_performance_record *)record_header; result = sysfs_create_group(fpdt_kobj, &resume_attr_group); if (result) - return result; + goto err; break; case RECORD_S3_SUSPEND: if (subtable_type != SUBTABLE_S3PT) { @@ -223,13 +230,14 @@ record_suspend = (struct suspend_performance_record *)record_header; result = sysfs_create_group(fpdt_kobj, &suspend_attr_group); if (result) - return result; + goto err; break; case RECORD_BOOT: if (subtable_type != SUBTABLE_FBPT) { pr_err(FW_BUG "Invalid %d for subtable %s\n", record_header->type, signature); - return -EINVAL; + result = -EINVAL; + goto err; } if (record_boot) { pr_err("Duplicate boot performance record found.\n"); @@ -238,7 +246,7 @@ record_boot = (struct boot_performance_record *)record_header; result = sysfs_create_group(fpdt_kobj, &boot_attr_group); if (result) - return result; + goto err; break; default: @@ -247,6 +255,18 @@ } } return 0; + +err: + if (record_boot) + sysfs_remove_group(fpdt_kobj, &boot_attr_group); + + if (record_suspend) + sysfs_remove_group(fpdt_kobj, &suspend_attr_group); + + if (record_resume) + sysfs_remove_group(fpdt_kobj, &resume_attr_group); + + return result; } static int __init acpi_init_fpdt(void) @@ -255,6 +275,7 @@ struct acpi_table_header *header; struct fpdt_subtable_entry *subtable; u32 offset = sizeof(*header); + int result; status = acpi_get_table(ACPI_SIG_FPDT, 0, &header); @@ -263,8 +284,8 @@ fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj); if (!fpdt_kobj) { - acpi_put_table(header); - return -ENOMEM; + result = -ENOMEM; + goto err_nomem; } while (offset < header->length) { @@ -272,8 +293,10 @@ switch (subtable->type) { case SUBTABLE_FBPT: case SUBTABLE_S3PT: - fpdt_process_subtable(subtable->address, + result = fpdt_process_subtable(subtable->address, subtable->type); + if (result) + goto err_subtable; break; default: /* Other types are reserved in ACPI 6.4 spec. */ @@ -282,6 +305,12 @@ offset += sizeof(*subtable); } return 0; +err_subtable: + kobject_put(fpdt_kobj); + +err_nomem: + acpi_put_table(header); + return result; } fs_initcall(acpi_init_fpdt); diff -u linux-lowlatency-5.15.0/drivers/acpi/resource.c linux-lowlatency-5.15.0/drivers/acpi/resource.c --- linux-lowlatency-5.15.0/drivers/acpi/resource.c +++ linux-lowlatency-5.15.0/drivers/acpi/resource.c @@ -447,6 +447,13 @@ }, }, { + /* Asus ExpertBook B1402CVA */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BOARD_NAME, "B1402CVA"), + }, + }, + { .ident = "LENOVO IdeaPad Flex 5 16ALC7", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), @@ -475,6 +482,18 @@ } }, { + /* TongFang GMxXGxx/TUXEDO Polaris 15 Gen5 AMD */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GMxXGxx"), + }, + }, + { + /* TongFang GM6XGxX/TUXEDO Stellaris 16 Gen5 AMD */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GM6XGxX"), + }, + }, + { .ident = "MAINGEAR Vector Pro 2 17", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"), diff -u linux-lowlatency-5.15.0/drivers/android/binder.c linux-lowlatency-5.15.0/drivers/android/binder.c --- linux-lowlatency-5.15.0/drivers/android/binder.c +++ linux-lowlatency-5.15.0/drivers/android/binder.c @@ -4627,6 +4627,7 @@ "undelivered TRANSACTION_ERROR: %u\n", e->cmd); } break; + case BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT: case BINDER_WORK_TRANSACTION_COMPLETE: { binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, "undelivered TRANSACTION_COMPLETE\n"); diff -u linux-lowlatency-5.15.0/drivers/ata/libata-core.c linux-lowlatency-5.15.0/drivers/ata/libata-core.c --- linux-lowlatency-5.15.0/drivers/ata/libata-core.c +++ linux-lowlatency-5.15.0/drivers/ata/libata-core.c @@ -2382,7 +2382,7 @@ struct ata_port *ap = dev->link->ap; const u16 *id = dev->id; const char *lba_desc; - char ncq_desc[24]; + char ncq_desc[32]; int ret; dev->flags |= ATA_DFLAG_LBA; diff -u linux-lowlatency-5.15.0/drivers/ata/libata-eh.c linux-lowlatency-5.15.0/drivers/ata/libata-eh.c --- linux-lowlatency-5.15.0/drivers/ata/libata-eh.c +++ linux-lowlatency-5.15.0/drivers/ata/libata-eh.c @@ -2223,7 +2223,7 @@ struct ata_eh_context *ehc = &link->eh_context; struct ata_queued_cmd *qc; const char *frozen, *desc; - char tries_buf[6] = ""; + char tries_buf[16] = ""; int tag, nr_failed = 0; if (ehc->i.flags & ATA_EHI_QUIET) diff -u linux-lowlatency-5.15.0/drivers/base/dd.c linux-lowlatency-5.15.0/drivers/base/dd.c --- linux-lowlatency-5.15.0/drivers/base/dd.c +++ linux-lowlatency-5.15.0/drivers/base/dd.c @@ -1228,8 +1228,6 @@ else if (drv->remove) drv->remove(dev); - device_links_driver_cleanup(dev); - devres_release_all(dev); arch_teardown_dma_ops(dev); kfree(dev->dma_range_map); @@ -1241,6 +1239,8 @@ pm_runtime_reinit(dev); dev_pm_set_driver_flags(dev, 0); + device_links_driver_cleanup(dev); + klist_remove(&dev->p->knode_driver); device_pm_check_callbacks(dev); if (dev->bus) diff -u linux-lowlatency-5.15.0/drivers/base/platform.c linux-lowlatency-5.15.0/drivers/base/platform.c --- linux-lowlatency-5.15.0/drivers/base/platform.c +++ linux-lowlatency-5.15.0/drivers/base/platform.c @@ -1270,31 +1270,11 @@ const char *buf, size_t count) { struct platform_device *pdev = to_platform_device(dev); - char *driver_override, *old, *cp; + int ret; - /* We need to keep extra room for a newline */ - if (count >= (PAGE_SIZE - 1)) - return -EINVAL; - - driver_override = kstrndup(buf, count, GFP_KERNEL); - if (!driver_override) - return -ENOMEM; - - cp = strchr(driver_override, '\n'); - if (cp) - *cp = '\0'; - - device_lock(dev); - old = pdev->driver_override; - if (strlen(driver_override)) { - pdev->driver_override = driver_override; - } else { - kfree(driver_override); - pdev->driver_override = NULL; - } - device_unlock(dev); - - kfree(old); + ret = driver_set_override(dev, &pdev->driver_override, buf, count); + if (ret) + return ret; return count; } diff -u linux-lowlatency-5.15.0/drivers/base/regmap/regcache.c linux-lowlatency-5.15.0/drivers/base/regmap/regcache.c --- linux-lowlatency-5.15.0/drivers/base/regmap/regcache.c +++ linux-lowlatency-5.15.0/drivers/base/regmap/regcache.c @@ -325,6 +325,11 @@ return 0; } +static int rbtree_all(const void *key, const struct rb_node *node) +{ + return 0; +} + /** * regcache_sync - Sync the register cache with the hardware. * @@ -342,6 +347,7 @@ unsigned int i; const char *name; bool bypass; + struct rb_node *node; if (WARN_ON(map->cache_type == REGCACHE_NONE)) return -EINVAL; @@ -386,6 +392,29 @@ map->async = false; map->cache_bypass = bypass; map->no_sync_defaults = false; + + /* + * If we did any paging with cache bypassed and a cached + * paging register then the register and cache state might + * have gone out of sync, force writes of all the paging + * registers. + */ + rb_for_each(node, 0, &map->range_tree, rbtree_all) { + struct regmap_range_node *this = + rb_entry(node, struct regmap_range_node, node); + + /* If there's nothing in the cache there's nothing to sync */ + if (regcache_read(map, this->selector_reg, &i) != 0) + continue; + + ret = _regmap_write(map, this->selector_reg, i); + if (ret != 0) { + dev_err(map->dev, "Failed to write %x = %x: %d\n", + this->selector_reg, i, ret); + break; + } + } + map->unlock(map->lock_arg); regmap_async_complete(map); diff -u linux-lowlatency-5.15.0/drivers/base/regmap/regmap.c linux-lowlatency-5.15.0/drivers/base/regmap/regmap.c --- linux-lowlatency-5.15.0/drivers/base/regmap/regmap.c +++ linux-lowlatency-5.15.0/drivers/base/regmap/regmap.c @@ -1551,7 +1551,7 @@ /* If the user didn't specify a name match any */ if (data) - return !strcmp((*r)->name, data); + return (*r)->name && !strcmp((*r)->name, data); else return 1; } @@ -1683,17 +1683,19 @@ } if (!map->cache_bypass && map->format.parse_val) { - unsigned int ival; + unsigned int ival, offset; int val_bytes = map->format.val_bytes; - for (i = 0; i < val_len / val_bytes; i++) { - ival = map->format.parse_val(val + (i * val_bytes)); - ret = regcache_write(map, - reg + regmap_get_offset(map, i), - ival); + + /* Cache the last written value for noinc writes */ + i = noinc ? val_len - val_bytes : 0; + for (; i < val_len; i += val_bytes) { + ival = map->format.parse_val(val + i); + offset = noinc ? 0 : regmap_get_offset(map, i / val_bytes); + ret = regcache_write(map, reg + offset, ival); if (ret) { dev_err(map->dev, "Error in caching of register: %x ret: %d\n", - reg + regmap_get_offset(map, i), ret); + reg + offset, ret); return ret; } } diff -u linux-lowlatency-5.15.0/drivers/block/virtio_blk.c linux-lowlatency-5.15.0/drivers/block/virtio_blk.c --- linux-lowlatency-5.15.0/drivers/block/virtio_blk.c +++ linux-lowlatency-5.15.0/drivers/block/virtio_blk.c @@ -743,6 +743,7 @@ u16 min_io_size; u8 physical_block_exp, alignment_offset; unsigned int queue_depth; + size_t max_dma_size; if (!vdev->config->get) { dev_err(&vdev->dev, "%s failure: config access disabled\n", @@ -844,7 +845,8 @@ /* No real sector limit. */ blk_queue_max_hw_sectors(q, -1U); - max_size = virtio_max_dma_size(vdev); + max_dma_size = virtio_max_dma_size(vdev); + max_size = max_dma_size > U32_MAX ? U32_MAX : max_dma_size; /* Host can optionally specify maximum segment size and number of * segments. */ diff -u linux-lowlatency-5.15.0/drivers/bluetooth/btusb.c linux-lowlatency-5.15.0/drivers/bluetooth/btusb.c --- linux-lowlatency-5.15.0/drivers/bluetooth/btusb.c +++ linux-lowlatency-5.15.0/drivers/bluetooth/btusb.c @@ -438,4 +438,16 @@ BTUSB_WIDEBAND_SPEECH }, + /* Realtek 8852BE Bluetooth devices */ + { USB_DEVICE(0x0cb8, 0xc559), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0bda, 0xb85b), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3570), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3571), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, + /* Realtek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01), @@ -2507,6 +2519,9 @@ goto err_free_wc; } + if (data->evt_skb == NULL) + goto err_free_wc; + /* Parse and handle the return WMT event */ wmt_evt = (struct btmtk_hci_wmt_evt *)data->evt_skb->data; if (wmt_evt->whdr.op != hdr->op) { @@ -4042,6 +4057,7 @@ if (id->driver_info & BTUSB_QCA_ROME) { data->setup_on_usb = btusb_setup_qca; + hdev->shutdown = btusb_shutdown_qca; hdev->set_bdaddr = btusb_set_bdaddr_ath3012; hdev->cmd_timeout = btusb_qca_cmd_timeout; set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); diff -u linux-lowlatency-5.15.0/drivers/bluetooth/hci_vhci.c linux-lowlatency-5.15.0/drivers/bluetooth/hci_vhci.c --- linux-lowlatency-5.15.0/drivers/bluetooth/hci_vhci.c +++ linux-lowlatency-5.15.0/drivers/bluetooth/hci_vhci.c @@ -67,7 +67,10 @@ struct vhci_data *data = hci_get_drvdata(hdev); memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); + + mutex_lock(&data->open_mutex); skb_queue_tail(&data->readq, skb); + mutex_unlock(&data->open_mutex); wake_up_interruptible(&data->read_wait); return 0; diff -u linux-lowlatency-5.15.0/drivers/char/hw_random/geode-rng.c linux-lowlatency-5.15.0/drivers/char/hw_random/geode-rng.c --- linux-lowlatency-5.15.0/drivers/char/hw_random/geode-rng.c +++ linux-lowlatency-5.15.0/drivers/char/hw_random/geode-rng.c @@ -58,7 +58,8 @@ static int geode_rng_data_read(struct hwrng *rng, u32 *data) { - void __iomem *mem = (void __iomem *)rng->priv; + struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; + void __iomem *mem = priv->membase; *data = readl(mem + GEODE_RNG_DATA_REG); @@ -67,7 +68,8 @@ static int geode_rng_data_present(struct hwrng *rng, int wait) { - void __iomem *mem = (void __iomem *)rng->priv; + struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; + void __iomem *mem = priv->membase; int data, i; for (i = 0; i < 20; i++) { diff -u linux-lowlatency-5.15.0/drivers/clk/clk.c linux-lowlatency-5.15.0/drivers/clk/clk.c --- linux-lowlatency-5.15.0/drivers/clk/clk.c +++ linux-lowlatency-5.15.0/drivers/clk/clk.c @@ -3182,6 +3182,7 @@ unsigned int i, char terminator) { struct clk_core *parent; + const char *name = NULL; /* * Go through the following options to fetch a parent's name. @@ -3196,18 +3197,20 @@ * registered (yet). */ parent = clk_core_get_parent_by_index(core, i); - if (parent) + if (parent) { seq_puts(s, parent->name); - else if (core->parents[i].name) + } else if (core->parents[i].name) { seq_puts(s, core->parents[i].name); - else if (core->parents[i].fw_name) + } else if (core->parents[i].fw_name) { seq_printf(s, "<%s>(fw)", core->parents[i].fw_name); - else if (core->parents[i].index >= 0) - seq_puts(s, - of_clk_get_parent_name(core->of_node, - core->parents[i].index)); - else - seq_puts(s, "(missing)"); + } else { + if (core->parents[i].index >= 0) + name = of_clk_get_parent_name(core->of_node, core->parents[i].index); + if (!name) + name = "(missing)"; + + seq_puts(s, name); + } seq_putc(s, terminator); } diff -u linux-lowlatency-5.15.0/drivers/clk/imx/clk-imx8qxp.c linux-lowlatency-5.15.0/drivers/clk/imx/clk-imx8qxp.c --- linux-lowlatency-5.15.0/drivers/clk/imx/clk-imx8qxp.c +++ linux-lowlatency-5.15.0/drivers/clk/imx/clk-imx8qxp.c @@ -148,10 +148,10 @@ imx_clk_scu("adc0_clk", IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER); imx_clk_scu("adc1_clk", IMX_SC_R_ADC_1, IMX_SC_PM_CLK_PER); imx_clk_scu("pwm_clk", IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER); + imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL); imx_clk_scu2("lcd_clk", lcd_sels, ARRAY_SIZE(lcd_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER); imx_clk_scu2("lcd_pxl_clk", lcd_pxl_sels, ARRAY_SIZE(lcd_pxl_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_MISC0); imx_clk_scu("lcd_pxl_bypass_div_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_BYPASS); - imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL); /* Audio SS */ imx_clk_scu("audio_pll0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_PLL); diff -u linux-lowlatency-5.15.0/drivers/clk/keystone/pll.c linux-lowlatency-5.15.0/drivers/clk/keystone/pll.c --- linux-lowlatency-5.15.0/drivers/clk/keystone/pll.c +++ linux-lowlatency-5.15.0/drivers/clk/keystone/pll.c @@ -281,12 +281,13 @@ clk = clk_register_divider(NULL, clk_name, parent_name, 0, reg, shift, mask, 0, NULL); - if (clk) { - of_clk_add_provider(node, of_clk_src_simple_get, clk); - } else { + if (IS_ERR(clk)) { pr_err("%s: error registering divider %s\n", __func__, clk_name); iounmap(reg); + return; } + + of_clk_add_provider(node, of_clk_src_simple_get, clk); } CLK_OF_DECLARE(pll_divider_clock, "ti,keystone,pll-divider-clock", of_pll_div_clk_init); @@ -328,10 +329,12 @@ clk = clk_register_mux(NULL, clk_name, (const char **)&parents, ARRAY_SIZE(parents) , 0, reg, shift, mask, 0, NULL); - if (clk) - of_clk_add_provider(node, of_clk_src_simple_get, clk); - else + if (IS_ERR(clk)) { pr_err("%s: error registering mux %s\n", __func__, clk_name); + return; + } + + of_clk_add_provider(node, of_clk_src_simple_get, clk); } CLK_OF_DECLARE(pll_mux_clock, "ti,keystone,pll-mux-clock", of_pll_mux_clk_init); diff -u linux-lowlatency-5.15.0/drivers/clk/qcom/Kconfig linux-lowlatency-5.15.0/drivers/clk/qcom/Kconfig --- linux-lowlatency-5.15.0/drivers/clk/qcom/Kconfig +++ linux-lowlatency-5.15.0/drivers/clk/qcom/Kconfig @@ -127,6 +127,7 @@ tristate "IPQ APSS Clock Controller" select IPQ_APSS_PLL depends on QCOM_APCS_IPC || COMPILE_TEST + depends on QCOM_SMEM help Support for APSS clock controller on IPQ platforms. The APSS clock controller manages the Mux and enable block that feeds the diff -u linux-lowlatency-5.15.0/drivers/clk/qcom/clk-rcg2.c linux-lowlatency-5.15.0/drivers/clk/qcom/clk-rcg2.c --- linux-lowlatency-5.15.0/drivers/clk/qcom/clk-rcg2.c +++ linux-lowlatency-5.15.0/drivers/clk/qcom/clk-rcg2.c @@ -148,17 +148,11 @@ static unsigned long calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div) { - if (hid_div) { - rate *= 2; - rate /= hid_div + 1; - } + if (hid_div) + rate = mult_frac(rate, 2, hid_div + 1); - if (mode) { - u64 tmp = rate; - tmp *= m; - do_div(tmp, n); - rate = tmp; - } + if (mode) + rate = mult_frac(rate, m, n); return rate; } diff -u linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq6018.c linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq6018.c --- linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq6018.c +++ linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq6018.c @@ -75,7 +75,6 @@ &gpll0_main.clkr.hw }, .num_parents = 1, .ops = &clk_fixed_factor_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -89,7 +88,6 @@ &gpll0_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -164,7 +162,6 @@ &gpll6_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -195,7 +192,6 @@ &gpll4_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -246,7 +242,6 @@ &gpll2_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -277,7 +272,6 @@ &nss_crypto_pll_main.clkr.hw }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; diff -u linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq8074.c linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq8074.c --- linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq8074.c +++ linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-ipq8074.c @@ -418,7 +418,6 @@ }, .num_parents = 1, .ops = &clk_fixed_factor_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -465,7 +464,6 @@ }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -498,7 +496,6 @@ }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -532,7 +529,6 @@ }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -546,7 +542,6 @@ }, .num_parents = 1, .ops = &clk_fixed_factor_ops, - .flags = CLK_SET_RATE_PARENT, }, }; @@ -611,7 +606,6 @@ }, .num_parents = 1, .ops = &clk_alpha_pll_postdiv_ro_ops, - .flags = CLK_SET_RATE_PARENT, }, }; diff -u linux-lowlatency-5.15.0/drivers/clk/renesas/rzg2l-cpg.c linux-lowlatency-5.15.0/drivers/clk/renesas/rzg2l-cpg.c --- linux-lowlatency-5.15.0/drivers/clk/renesas/rzg2l-cpg.c +++ linux-lowlatency-5.15.0/drivers/clk/renesas/rzg2l-cpg.c @@ -11,6 +11,7 @@ * Copyright (C) 2015 Renesas Electronics Corp. */ +#include #include #include #include @@ -37,14 +38,13 @@ #define WARN_DEBUG(x) do { } while (0) #endif -#define DIV_RSMASK(v, s, m) ((v >> s) & m) #define GET_SHIFT(val) ((val >> 12) & 0xff) #define GET_WIDTH(val) ((val >> 8) & 0xf) -#define KDIV(val) DIV_RSMASK(val, 16, 0xffff) -#define MDIV(val) DIV_RSMASK(val, 6, 0x3ff) -#define PDIV(val) DIV_RSMASK(val, 0, 0x3f) -#define SDIV(val) DIV_RSMASK(val, 0, 0x7) +#define KDIV(val) ((s16)FIELD_GET(GENMASK(31, 16), val)) +#define MDIV(val) FIELD_GET(GENMASK(15, 6), val) +#define PDIV(val) FIELD_GET(GENMASK(5, 0), val) +#define SDIV(val) FIELD_GET(GENMASK(2, 0), val) #define CLK_ON_R(reg) (reg) #define CLK_MON_R(reg) (0x180 + (reg)) @@ -146,18 +146,18 @@ struct pll_clk *pll_clk = to_pll(hw); struct rzg2l_cpg_priv *priv = pll_clk->priv; unsigned int val1, val2; - unsigned int mult = 1; - unsigned int div = 1; + u64 rate; if (pll_clk->type != CLK_TYPE_SAM_PLL) return parent_rate; val1 = readl(priv->base + GET_REG_SAMPLL_CLK1(pll_clk->conf)); val2 = readl(priv->base + GET_REG_SAMPLL_CLK2(pll_clk->conf)); - mult = MDIV(val1) + KDIV(val1) / 65536; - div = PDIV(val1) * (1 << SDIV(val2)); - return DIV_ROUND_CLOSEST_ULL((u64)parent_rate * mult, div); + rate = mul_u64_u32_shr(parent_rate, (MDIV(val1) << 16) + KDIV(val1), + 16 + SDIV(val2)); + + return DIV_ROUND_CLOSEST_ULL(rate, PDIV(val1)); } static const struct clk_ops rzg2l_cpg_pll_ops = { diff -u linux-lowlatency-5.15.0/drivers/clk/ti/clk-dra7-atl.c linux-lowlatency-5.15.0/drivers/clk/ti/clk-dra7-atl.c --- linux-lowlatency-5.15.0/drivers/clk/ti/clk-dra7-atl.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/clk-dra7-atl.c @@ -173,6 +173,7 @@ struct dra7_atl_desc *clk_hw = NULL; struct clk_init_data init = { NULL }; const char **parent_names = NULL; + const char *name; struct clk *clk; clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); @@ -183,7 +184,8 @@ clk_hw->hw.init = &init; clk_hw->divider = 1; - init.name = node->name; + name = ti_dt_clk_name(node); + init.name = name; init.ops = &atl_clk_ops; init.flags = CLK_IGNORE_UNUSED; init.num_parents = of_clk_get_parent_count(node); @@ -203,7 +205,7 @@ init.parent_names = parent_names; - clk = ti_clk_register(NULL, &clk_hw->hw, node->name); + clk = of_ti_clk_register(node, &clk_hw->hw, name); if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); diff -u linux-lowlatency-5.15.0/drivers/clk/ti/clk.c linux-lowlatency-5.15.0/drivers/clk/ti/clk.c --- linux-lowlatency-5.15.0/drivers/clk/ti/clk.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/clk.c @@ -403,6 +403,24 @@ }; /** + * ti_dt_clk_name - init clock name from first output name or node name + * @np: device node + * + * Use the first clock-output-name for the clock name if found. Fall back + * to legacy naming based on node name. + */ +const char *ti_dt_clk_name(struct device_node *np) +{ + const char *name; + + if (!of_property_read_string_index(np, "clock-output-names", 0, + &name)) + return name; + + return np->name; +} + +/** * ti_clk_add_aliases - setup clock aliases * * Sets up any missing clock aliases. No return value. @@ -418,7 +436,7 @@ clkspec.np = np; clk = of_clk_get_from_provider(&clkspec); - ti_clk_add_alias(NULL, clk, np->name); + ti_clk_add_alias(clk, ti_dt_clk_name(np)); } } @@ -471,7 +489,6 @@ /** * ti_clk_add_alias - add a clock alias for a TI clock - * @dev: device alias for this clock * @clk: clock handle to create alias for * @con: connection ID for this clock * @@ -479,7 +496,7 @@ * and assigns the data to it. Returns 0 if successful, negative error * value otherwise. */ -int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con) +int ti_clk_add_alias(struct clk *clk, const char *con) { struct clk_lookup *cl; @@ -493,8 +510,6 @@ if (!cl) return -ENOMEM; - if (dev) - cl->dev_id = dev_name(dev); cl->con_id = con; cl->clk = clk; @@ -504,8 +519,8 @@ } /** - * ti_clk_register - register a TI clock to the common clock framework - * @dev: device for this clock + * of_ti_clk_register - register a TI clock to the common clock framework + * @node: device node for this clock * @hw: hardware clock handle * @con: connection ID for this clock * @@ -513,17 +528,18 @@ * alias for it. Returns a handle to the registered clock if successful, * ERR_PTR value in failure. */ -struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, - const char *con) +struct clk *of_ti_clk_register(struct device_node *node, struct clk_hw *hw, + const char *con) { struct clk *clk; int ret; - clk = clk_register(dev, hw); - if (IS_ERR(clk)) - return clk; + ret = of_clk_hw_register(node, hw); + if (ret) + return ERR_PTR(ret); - ret = ti_clk_add_alias(dev, clk, con); + clk = hw->clk; + ret = ti_clk_add_alias(clk, con); if (ret) { clk_unregister(clk); return ERR_PTR(ret); @@ -533,8 +549,8 @@ } /** - * ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework - * @dev: device for this clock + * of_ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework + * @node: device node for this clock * @hw: hardware clock handle * @con: connection ID for this clock * @@ -543,13 +559,13 @@ * Returns a handle to the registered clock if successful, ERR_PTR value * in failure. */ -struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw, - const char *con) +struct clk *of_ti_clk_register_omap_hw(struct device_node *node, + struct clk_hw *hw, const char *con) { struct clk *clk; struct clk_hw_omap *oclk; - clk = ti_clk_register(dev, hw, con); + clk = of_ti_clk_register(node, hw, con); if (IS_ERR(clk)) return clk; diff -u linux-lowlatency-5.15.0/drivers/clk/ti/clkctrl.c linux-lowlatency-5.15.0/drivers/clk/ti/clkctrl.c --- linux-lowlatency-5.15.0/drivers/clk/ti/clkctrl.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/clkctrl.c @@ -317,7 +317,7 @@ init.ops = ops; init.flags = 0; - clk = ti_clk_register(NULL, clk_hw, init.name); + clk = of_ti_clk_register(node, clk_hw, init.name); if (IS_ERR_OR_NULL(clk)) { ret = -EINVAL; goto cleanup; @@ -701,7 +701,7 @@ init.ops = &omap4_clkctrl_clk_ops; hw->hw.init = &init; - clk = ti_clk_register_omap_hw(NULL, &hw->hw, init.name); + clk = of_ti_clk_register_omap_hw(node, &hw->hw, init.name); if (IS_ERR_OR_NULL(clk)) goto cleanup; diff -u linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg.c linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg.c --- linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg.c +++ linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg.c @@ -566,7 +566,8 @@ if (keylen != CHACHA_KEY_SIZE + saltlen) return -EINVAL; - ctx->cdata.key_virt = key; + memcpy(ctx->key, key, keylen); + ctx->cdata.key_virt = ctx->key; ctx->cdata.keylen = keylen - saltlen; return chachapoly_set_sh_desc(aead); diff -u linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg_qi2.c linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg_qi2.c --- linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg_qi2.c +++ linux-lowlatency-5.15.0/drivers/crypto/caam/caamalg_qi2.c @@ -639,7 +639,8 @@ if (keylen != CHACHA_KEY_SIZE + saltlen) return -EINVAL; - ctx->cdata.key_virt = key; + memcpy(ctx->key, key, keylen); + ctx->cdata.key_virt = ctx->key; ctx->cdata.keylen = keylen - saltlen; return chachapoly_set_sh_desc(aead); diff -u linux-lowlatency-5.15.0/drivers/crypto/hisilicon/hpre/hpre_main.c linux-lowlatency-5.15.0/drivers/crypto/hisilicon/hpre/hpre_main.c --- linux-lowlatency-5.15.0/drivers/crypto/hisilicon/hpre/hpre_main.c +++ linux-lowlatency-5.15.0/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -854,7 +854,7 @@ for (i = 0; i < clusters_num; i++) { ret = snprintf(buf, HPRE_DBGFS_VAL_MAX_LEN, "cluster%d", i); - if (ret < 0) + if (ret >= HPRE_DBGFS_VAL_MAX_LEN) return -EINVAL; tmp_d = debugfs_create_dir(buf, qm->debug.debug_root); diff -u linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/adf_accel_devices.h linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/adf_accel_devices.h --- linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/adf_accel_devices.h @@ -24,7 +24,7 @@ #define ADF_PCI_MAX_BARS 3 #define ADF_DEVICE_NAME_LENGTH 32 #define ADF_ETR_MAX_RINGS_PER_BANK 16 -#define ADF_MAX_MSIX_VECTOR_NAME 16 +#define ADF_MAX_MSIX_VECTOR_NAME 48 #define ADF_DEVICE_NAME_PREFIX "qat_" enum adf_accel_capabilities { diff -u linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/qat_algs_send.c linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/qat_algs_send.c --- linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/qat_algs_send.c +++ linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/qat_algs_send.c @@ -39,40 +39,44 @@ spin_unlock_bh(&backlog->lock); } -static void qat_alg_backlog_req(struct qat_alg_req *req, - struct qat_instance_backlog *backlog) -{ - INIT_LIST_HEAD(&req->list); - - spin_lock_bh(&backlog->lock); - list_add_tail(&req->list, &backlog->list); - spin_unlock_bh(&backlog->lock); -} - -static int qat_alg_send_message_maybacklog(struct qat_alg_req *req) +static bool qat_alg_try_enqueue(struct qat_alg_req *req) { struct qat_instance_backlog *backlog = req->backlog; struct adf_etr_ring_data *tx_ring = req->tx_ring; u32 *fw_req = req->fw_req; - /* If any request is already backlogged, then add to backlog list */ + /* Check if any request is already backlogged */ if (!list_empty(&backlog->list)) - goto enqueue; + return false; - /* If ring is nearly full, then add to backlog list */ + /* Check if ring is nearly full */ if (adf_ring_nearly_full(tx_ring)) - goto enqueue; + return false; - /* If adding request to HW ring fails, then add to backlog list */ + /* Try to enqueue to HW ring */ if (adf_send_message(tx_ring, fw_req)) - goto enqueue; + return false; + + return true; +} + + +static int qat_alg_send_message_maybacklog(struct qat_alg_req *req) +{ + struct qat_instance_backlog *backlog = req->backlog; + int ret = -EINPROGRESS; - return -EINPROGRESS; + if (qat_alg_try_enqueue(req)) + return ret; -enqueue: - qat_alg_backlog_req(req, backlog); + spin_lock_bh(&backlog->lock); + if (!qat_alg_try_enqueue(req)) { + list_add_tail(&req->list, &backlog->list); + ret = -EBUSY; + } + spin_unlock_bh(&backlog->lock); - return -EBUSY; + return ret; } int qat_alg_send_message(struct qat_alg_req *req) diff -u linux-lowlatency-5.15.0/drivers/dma/pxa_dma.c linux-lowlatency-5.15.0/drivers/dma/pxa_dma.c --- linux-lowlatency-5.15.0/drivers/dma/pxa_dma.c +++ linux-lowlatency-5.15.0/drivers/dma/pxa_dma.c @@ -722,7 +722,6 @@ dma_addr_t dma; struct pxad_desc_sw *sw_desc = to_pxad_sw_desc(vd); - BUG_ON(sw_desc->nb_desc == 0); for (i = sw_desc->nb_desc - 1; i >= 0; i--) { if (i > 0) dma = sw_desc->hw_desc[i - 1]->ddadr; diff -u linux-lowlatency-5.15.0/drivers/dma/ste_dma40.c linux-lowlatency-5.15.0/drivers/dma/ste_dma40.c --- linux-lowlatency-5.15.0/drivers/dma/ste_dma40.c +++ linux-lowlatency-5.15.0/drivers/dma/ste_dma40.c @@ -3697,6 +3697,7 @@ regulator_disable(base->lcpa_regulator); regulator_put(base->lcpa_regulator); } + pm_runtime_disable(base->dev); kfree(base->lcla_pool.alloc_map); kfree(base->lookup_log_chans); diff -u linux-lowlatency-5.15.0/drivers/dma/stm32-mdma.c linux-lowlatency-5.15.0/drivers/dma/stm32-mdma.c --- linux-lowlatency-5.15.0/drivers/dma/stm32-mdma.c +++ linux-lowlatency-5.15.0/drivers/dma/stm32-mdma.c @@ -509,7 +509,7 @@ src_maxburst = chan->dma_config.src_maxburst; dst_maxburst = chan->dma_config.dst_maxburst; - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)); + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN; ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id)); ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id)); @@ -937,7 +937,7 @@ if (!desc) return NULL; - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)); + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN; ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id)); ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id)); cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id)); diff -u linux-lowlatency-5.15.0/drivers/firmware/arm_ffa/bus.c linux-lowlatency-5.15.0/drivers/firmware/arm_ffa/bus.c --- linux-lowlatency-5.15.0/drivers/firmware/arm_ffa/bus.c +++ linux-lowlatency-5.15.0/drivers/firmware/arm_ffa/bus.c @@ -192,6 +192,7 @@ dev->release = ffa_release_device; dev_set_name(&ffa_dev->dev, "arm-ffa-%d", id); + ffa_dev->id = id; ffa_dev->vm_id = vm_id; uuid_copy(&ffa_dev->uuid, uuid); diff -u linux-lowlatency-5.15.0/drivers/firmware/imx/imx-dsp.c linux-lowlatency-5.15.0/drivers/firmware/imx/imx-dsp.c --- linux-lowlatency-5.15.0/drivers/firmware/imx/imx-dsp.c +++ linux-lowlatency-5.15.0/drivers/firmware/imx/imx-dsp.c @@ -115,11 +115,11 @@ dsp_chan->idx = i % 2; dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); if (IS_ERR(dsp_chan->ch)) { - kfree(dsp_chan->name); ret = PTR_ERR(dsp_chan->ch); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to request mbox chan %s ret %d\n", chan_name, ret); + kfree(dsp_chan->name); goto out; } diff -u linux-lowlatency-5.15.0/drivers/firmware/qcom_scm.c linux-lowlatency-5.15.0/drivers/firmware/qcom_scm.c --- linux-lowlatency-5.15.0/drivers/firmware/qcom_scm.c +++ linux-lowlatency-5.15.0/drivers/firmware/qcom_scm.c @@ -137,6 +137,12 @@ return qcom_scm_convention; /* + * Per the "SMC calling convention specification", the 64-bit calling + * convention can only be used when the client is 64-bit, otherwise + * system will encounter the undefined behaviour. + */ +#if IS_ENABLED(CONFIG_ARM64) + /* * Device isn't required as there is only one argument - no device * needed to dma_map_single to secure world */ @@ -156,6 +162,7 @@ forced = true; goto found; } +#endif probed_convention = SMC_CONVENTION_ARM_32; ret = __scm_smc_call(NULL, &desc, probed_convention, &res, true); diff -u linux-lowlatency-5.15.0/drivers/gpio/gpio-vf610.c linux-lowlatency-5.15.0/drivers/gpio/gpio-vf610.c --- linux-lowlatency-5.15.0/drivers/gpio/gpio-vf610.c +++ linux-lowlatency-5.15.0/drivers/gpio/gpio-vf610.c @@ -127,14 +127,14 @@ unsigned long mask = BIT(gpio); u32 val; + vf610_gpio_set(chip, gpio, value); + if (port->sdata && port->sdata->have_paddr) { val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR); val |= mask; vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR); } - vf610_gpio_set(chip, gpio, value); - return pinctrl_gpio_direction_output(chip->base + gpio); } diff -u linux-lowlatency-5.15.0/drivers/gpio/gpiolib-sysfs.c linux-lowlatency-5.15.0/drivers/gpio/gpiolib-sysfs.c --- linux-lowlatency-5.15.0/drivers/gpio/gpiolib-sysfs.c +++ linux-lowlatency-5.15.0/drivers/gpio/gpiolib-sysfs.c @@ -480,14 +480,17 @@ goto done; status = gpiod_set_transitory(desc, false); - if (!status) { - status = gpiod_export(desc, true); - if (status < 0) - gpiod_free(desc); - else - set_bit(FLAG_SYSFS, &desc->flags); + if (status) { + gpiod_free(desc); + goto done; } + status = gpiod_export(desc, true); + if (status < 0) + gpiod_free(desc); + else + set_bit(FLAG_SYSFS, &desc->flags); + done: if (status) pr_debug("%s: status %d\n", __func__, status); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu.h linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu.h --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1285,6 +1285,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev); int amdgpu_device_pci_reset(struct amdgpu_device *adev); bool amdgpu_device_need_post(struct amdgpu_device *adev); +bool amdgpu_device_pcie_dynamic_switching_supported(void); bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev); bool amdgpu_device_aspm_support_quirk(void); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c @@ -29,6 +29,7 @@ #include "amdgpu.h" #include "atom.h" +#include #include #include #include @@ -289,6 +290,10 @@ if (adev->flags & AMD_IS_APU) return false; + /* ATRM is for on-platform devices only */ + if (dev_is_removable(&adev->pdev->dev)) + return false; + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { dhandle = ACPI_HANDLE(&pdev->dev); if (!dhandle) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c @@ -178,6 +178,7 @@ } rcu_read_unlock(); + *result = NULL; return -ENOENT; } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -142,7 +142,7 @@ } for (i = 0; i < p->nchunks; i++) { - struct drm_amdgpu_cs_chunk __user **chunk_ptr = NULL; + struct drm_amdgpu_cs_chunk __user *chunk_ptr = NULL; struct drm_amdgpu_cs_chunk user_chunk; uint32_t __user *cdata; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -458,6 +458,9 @@ ssize_t result = 0; int r; + if (!adev->smc_rreg) + return -EPERM; + if (size & 0x3 || *pos & 0x3) return -EINVAL; @@ -517,6 +520,9 @@ ssize_t result = 0; int r; + if (!adev->smc_wreg) + return -EPERM; + if (size & 0x3 || *pos & 0x3) return -EINVAL; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1319,6 +1319,25 @@ return true; } +/* + * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic + * speed switching. Until we have confirmation from Intel that a specific host + * supports it, it's safer that we keep it disabled for all. + * + * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/ + * https://gitlab.freedesktop.org/drm/amd/-/issues/2663 + */ +bool amdgpu_device_pcie_dynamic_switching_supported(void) +{ +#if IS_ENABLED(CONFIG_X86) + struct cpuinfo_x86 *c = &cpu_data(0); + + if (c->x86_vendor == X86_VENDOR_INTEL) + return false; +#endif + return true; +} + /** * amdgpu_device_should_use_aspm - check if the device should program ASPM * @@ -5097,7 +5116,8 @@ * Flush RAM to disk so that after reboot * the user can read log and see why the system rebooted. */ - if (need_emergency_restart && amdgpu_ras_get_context(adev)->reboot) { + if (need_emergency_restart && amdgpu_ras_get_context(adev) && + amdgpu_ras_get_context(adev)->reboot) { DRM_WARN("Emergency reboot."); ksys_sync_helper(); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -80,7 +80,7 @@ struct drm_crtc *crtc = &amdgpu_crtc->base; unsigned long flags; - unsigned i; + unsigned int i; int vpos, hpos; if (amdgpu_display_flip_handle_fence(work, &work->excl)) @@ -159,7 +159,7 @@ u64 tiling_flags; int i, r; - work = kzalloc(sizeof *work, GFP_KERNEL); + work = kzalloc(sizeof(*work), GFP_KERNEL); if (work == NULL) return -ENOMEM; @@ -290,18 +290,17 @@ adev = drm_to_adev(dev); /* if we have active crtcs and we don't have a power ref, - take the current one */ + * take the current one + */ if (active && !adev->have_disp_power_ref) { adev->have_disp_power_ref = true; return ret; } - /* if we have no active crtcs, then drop the power ref - we got before */ - if (!active && adev->have_disp_power_ref) { - pm_runtime_put_autosuspend(dev->dev); + /* if we have no active crtcs, then go to + * drop the power ref we got before + */ + if (!active && adev->have_disp_power_ref) adev->have_disp_power_ref = false; - } - out: /* drop the power reference we got coming in here */ pm_runtime_put_autosuspend(dev->dev); @@ -465,11 +464,10 @@ if (amdgpu_connector->router.ddc_valid) amdgpu_i2c_router_select_ddc_port(amdgpu_connector); - if (use_aux) { + if (use_aux) ret = i2c_transfer(&amdgpu_connector->ddc_bus->aux.ddc, msgs, 2); - } else { + else ret = i2c_transfer(&amdgpu_connector->ddc_bus->adapter, msgs, 2); - } if (ret != 2) /* Couldn't find an accessible DDC on this connector */ @@ -478,10 +476,12 @@ * EDID header starts with: * 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00. * Only the first 6 bytes must be valid as - * drm_edid_block_valid() can fix the last 2 bytes */ + * drm_edid_block_valid() can fix the last 2 bytes + */ if (drm_edid_header_is_valid(buf) < 6) { /* Couldn't find an accessible EDID on this - * connector */ + * connector + */ return false; } return true; @@ -1189,8 +1189,10 @@ obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); if (obj == NULL) { - drm_dbg_kms(dev, "No GEM object associated to handle 0x%08X, " - "can't create framebuffer\n", mode_cmd->handles[0]); + drm_dbg_kms(dev, + "No GEM object associated to handle 0x%08X, can't create framebuffer\n", + mode_cmd->handles[0]); + return ERR_PTR(-ENOENT); } @@ -1384,6 +1386,7 @@ } if (amdgpu_crtc->rmx_type != RMX_OFF) { fixed20_12 a, b; + a.full = dfixed_const(src_v); b.full = dfixed_const(dst_v); amdgpu_crtc->vsc.full = dfixed_div(a, b); @@ -1403,7 +1406,7 @@ * * \param dev Device to query. * \param pipe Crtc to query. - * \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0). + * \param flags from caller (DRM_CALLED_FROM_VBLIRQ or 0). * For driver internal use only also supports these flags: * * USE_REAL_VBLANKSTART to use the real start of vblank instead @@ -1479,8 +1482,8 @@ /* Called from driver internal vblank counter query code? */ if (flags & GET_DISTANCE_TO_VBLANKSTART) { - /* Caller wants distance from real vbl_start in *hpos */ - *hpos = *vpos - vbl_start; + /* Caller wants distance from real vbl_start in *hpos */ + *hpos = *vpos - vbl_start; } /* Fudge vblank to start a few scanlines earlier to handle the @@ -1502,7 +1505,7 @@ /* In vblank? */ if (in_vbl) - ret |= DRM_SCANOUTPOS_IN_VBLANK; + ret |= DRM_SCANOUTPOS_IN_VBLANK; /* Called from driver internal vblank counter query code? */ if (flags & GET_DISTANCE_TO_VBLANKSTART) { @@ -1593,6 +1596,7 @@ if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); + r = amdgpu_bo_reserve(aobj, true); if (r == 0) { amdgpu_bo_unpin(aobj); @@ -1600,9 +1604,9 @@ } } - if (fb == NULL || fb->obj[0] == NULL) { + if (!fb || !fb->obj[0]) continue; - } + robj = gem_to_amdgpu_bo(fb->obj[0]); /* don't unpin kernel fb objects */ if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { @@ -1630,6 +1634,7 @@ if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); + r = amdgpu_bo_reserve(aobj, true); if (r == 0) { r = amdgpu_bo_pin(aobj, AMDGPU_GEM_DOMAIN_VRAM); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -238,6 +238,8 @@ for (i = 0; i < ARRAY_SIZE(common_modes); i++) { mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false); + if (!mode) + continue; drm_mode_probed_add(connector, mode); } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/vi.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/vi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/vi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/vi.c @@ -1147,7 +1147,7 @@ bool bL1SS = false; bool bClkReqSupport = true; - if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk()) + if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported()) return; if (adev->flags & AMD_IS_APU || diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdkfd/kfd_svm.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdkfd/kfd_svm.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -433,11 +433,11 @@ /* We need a new svm_bo. Spin-loop to wait for concurrent * svm_range_bo_release to finish removing this range from - * its range list. After this, it is safe to reuse the - * svm_bo pointer and svm_bo_list head. + * its range list and set prange->svm_bo to null. After this, + * it is safe to reuse the svm_bo pointer and svm_bo_list head. */ - while (!list_empty_careful(&prange->svm_bo_list)) - ; + while (!list_empty_careful(&prange->svm_bo_list) || prange->svm_bo) + cond_resched(); return false; } @@ -550,8 +550,15 @@ void svm_range_vram_node_free(struct svm_range *prange) { - svm_range_bo_unref(prange->svm_bo); - prange->ttm_res = NULL; + /* serialize prange->svm_bo unref */ + mutex_lock(&prange->lock); + /* prange->svm_bo has not been unref */ + if (prange->ttm_res) { + prange->ttm_res = NULL; + mutex_unlock(&prange->lock); + svm_range_bo_unref(prange->svm_bo); + } else + mutex_unlock(&prange->lock); } struct amdgpu_device * @@ -691,7 +698,7 @@ prange->flags &= ~attrs[i].value; break; case KFD_IOCTL_SVM_ATTR_GRANULARITY: - prange->granularity = attrs[i].value; + prange->granularity = min_t(uint32_t, attrs[i].value, 0x3F); break; default: WARN_ONCE(1, "svm_range_check_attrs wasn't called?"); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1962,7 +1962,7 @@ struct dmub_srv_create_params create_params; struct dmub_srv_region_params region_params; struct dmub_srv_region_info region_info; - struct dmub_srv_fb_params fb_params; + struct dmub_srv_memory_params memory_params; struct dmub_srv_fb_info *fb_info; struct dmub_srv *dmub_srv; const struct dmcub_firmware_header_v1_0 *hdr; @@ -2072,6 +2072,7 @@ adev->dm.dmub_fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes) + PSP_HEADER_BYTES; + region_params.is_mailbox_in_inbox = false; status = dmub_srv_calc_region_info(dmub_srv, ®ion_params, ®ion_info); @@ -2093,10 +2094,10 @@ return r; /* Rebase the regions on the framebuffer address. */ - memset(&fb_params, 0, sizeof(fb_params)); - fb_params.cpu_addr = adev->dm.dmub_bo_cpu_addr; - fb_params.gpu_addr = adev->dm.dmub_bo_gpu_addr; - fb_params.region_info = ®ion_info; + memset(&memory_params, 0, sizeof(memory_params)); + memory_params.cpu_fb_addr = adev->dm.dmub_bo_cpu_addr; + memory_params.gpu_fb_addr = adev->dm.dmub_bo_gpu_addr; + memory_params.region_info = ®ion_info; adev->dm.dmub_fb_info = kzalloc(sizeof(*adev->dm.dmub_fb_info), GFP_KERNEL); @@ -2108,7 +2109,7 @@ return -ENOMEM; } - status = dmub_srv_calc_fb_info(dmub_srv, &fb_params, fb_info); + status = dmub_srv_calc_mem_info(dmub_srv, &memory_params, fb_info); if (status != DMUB_STATUS_OK) { DRM_ERROR("Error calculating DMUB FB info: %d\n", status); return -EINVAL; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/core/dc.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/core/dc.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/core/dc.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -978,7 +978,8 @@ /* set i2c speed if not done by the respective dcnxxx__resource.c */ if (dc->caps.i2c_speed_in_khz_hdcp == 0) dc->caps.i2c_speed_in_khz_hdcp = dc->caps.i2c_speed_in_khz; - + if (dc->caps.max_optimizable_video_width == 0) + dc->caps.max_optimizable_video_width = 5120; dc->clk_mgr = dc_clk_mgr_create(dc->ctx, dc->res_pool->pp_smu, dc->res_pool->dccg); if (!dc->clk_mgr) goto fail; @@ -2148,6 +2149,7 @@ } static enum surface_update_type get_scaling_info_update_type( + const struct dc *dc, const struct dc_surface_update *u) { union surface_update_flags *update_flags = &u->surface->update_flags; @@ -2182,6 +2184,12 @@ update_flags->bits.clock_change = 1; } + if (u->scaling_info->src_rect.width > dc->caps.max_optimizable_video_width && + (u->scaling_info->clip_rect.width > u->surface->clip_rect.width || + u->scaling_info->clip_rect.height > u->surface->clip_rect.height)) + /* Changing clip size of a large surface may result in MPC slice count change */ + update_flags->bits.bandwidth_change = 1; + if (u->scaling_info->src_rect.x != u->surface->src_rect.x || u->scaling_info->src_rect.y != u->surface->src_rect.y || u->scaling_info->clip_rect.x != u->surface->clip_rect.x @@ -2219,7 +2227,7 @@ type = get_plane_info_update_type(u); elevate_update_type(&overall_type, type); - type = get_scaling_info_update_type(u); + type = get_scaling_info_update_type(dc, u); elevate_update_type(&overall_type, type); if (u->flip_addr) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/dc.h linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/dc.h --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/dc.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/dc.h @@ -166,6 +166,11 @@ uint32_t dmdata_alloc_size; unsigned int max_cursor_size; unsigned int max_video_width; + /* + * max video plane width that can be safely assumed to be always + * supported by single DPP pipe. + */ + unsigned int max_optimizable_video_width; unsigned int min_horizontal_blanking_period; int linear_pitch_alignment; bool dcc_const_color; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/dmub_srv.h linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/dmub_srv.h --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/dmub_srv.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/dmub_srv.h @@ -168,6 +168,7 @@ uint32_t vbios_size; const uint8_t *fw_inst_const; const uint8_t *fw_bss_data; + bool is_mailbox_in_inbox; }; /** @@ -187,20 +188,25 @@ */ struct dmub_srv_region_info { uint32_t fb_size; + uint32_t inbox_size; uint8_t num_regions; struct dmub_region regions[DMUB_WINDOW_TOTAL]; }; /** - * struct dmub_srv_fb_params - parameters used for driver fb setup + * struct dmub_srv_memory_params - parameters used for driver fb setup * @region_info: region info calculated by dmub service - * @cpu_addr: base cpu address for the framebuffer - * @gpu_addr: base gpu virtual address for the framebuffer + * @cpu_fb_addr: base cpu address for the framebuffer + * @cpu_inbox_addr: base cpu address for the gart + * @gpu_fb_addr: base gpu virtual address for the framebuffer + * @gpu_inbox_addr: base gpu virtual address for the gart */ -struct dmub_srv_fb_params { +struct dmub_srv_memory_params { const struct dmub_srv_region_info *region_info; - void *cpu_addr; - uint64_t gpu_addr; + void *cpu_fb_addr; + void *cpu_inbox_addr; + uint64_t gpu_fb_addr; + uint64_t gpu_inbox_addr; }; /** @@ -501,8 +507,8 @@ * DMUB_STATUS_OK - success * DMUB_STATUS_INVALID - unspecified error */ -enum dmub_status dmub_srv_calc_fb_info(struct dmub_srv *dmub, - const struct dmub_srv_fb_params *params, +enum dmub_status dmub_srv_calc_mem_info(struct dmub_srv *dmub, + const struct dmub_srv_memory_params *params, struct dmub_srv_fb_info *out); /** diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c @@ -319,7 +319,7 @@ uint32_t fw_state_size = DMUB_FW_STATE_SIZE; uint32_t trace_buffer_size = DMUB_TRACE_BUFFER_SIZE; uint32_t scratch_mem_size = DMUB_SCRATCH_MEM_SIZE; - + uint32_t previous_top = 0; if (!dmub->sw_init) return DMUB_STATUS_INVALID; @@ -344,8 +344,15 @@ bios->base = dmub_align(stack->top, 256); bios->top = bios->base + params->vbios_size; - mail->base = dmub_align(bios->top, 256); - mail->top = mail->base + DMUB_MAILBOX_SIZE; + if (params->is_mailbox_in_inbox) { + mail->base = 0; + mail->top = mail->base + DMUB_MAILBOX_SIZE; + previous_top = bios->top; + } else { + mail->base = dmub_align(bios->top, 256); + mail->top = mail->base + DMUB_MAILBOX_SIZE; + previous_top = mail->top; + } fw_info = dmub_get_fw_meta_info(params); @@ -364,7 +371,7 @@ dmub->fw_version = fw_info->fw_version; } - trace_buff->base = dmub_align(mail->top, 256); + trace_buff->base = dmub_align(previous_top, 256); trace_buff->top = trace_buff->base + dmub_align(trace_buffer_size, 64); fw_state->base = dmub_align(trace_buff->top, 256); @@ -375,11 +382,14 @@ out->fb_size = dmub_align(scratch_mem->top, 4096); + if (params->is_mailbox_in_inbox) + out->inbox_size = dmub_align(mail->top, 4096); + return DMUB_STATUS_OK; } -enum dmub_status dmub_srv_calc_fb_info(struct dmub_srv *dmub, - const struct dmub_srv_fb_params *params, +enum dmub_status dmub_srv_calc_mem_info(struct dmub_srv *dmub, + const struct dmub_srv_memory_params *params, struct dmub_srv_fb_info *out) { uint8_t *cpu_base; @@ -394,8 +404,8 @@ if (params->region_info->num_regions != DMUB_NUM_WINDOWS) return DMUB_STATUS_INVALID; - cpu_base = (uint8_t *)params->cpu_addr; - gpu_base = params->gpu_addr; + cpu_base = (uint8_t *)params->cpu_fb_addr; + gpu_base = params->gpu_fb_addr; for (i = 0; i < DMUB_NUM_WINDOWS; ++i) { const struct dmub_region *reg = @@ -403,6 +413,12 @@ out->fb[i].cpu_addr = cpu_base + reg->base; out->fb[i].gpu_addr = gpu_base + reg->base; + + if (i == DMUB_WINDOW_4_MAILBOX && params->cpu_inbox_addr != 0) { + out->fb[i].cpu_addr = (uint8_t *)params->cpu_inbox_addr + reg->base; + out->fb[i].gpu_addr = params->gpu_inbox_addr + reg->base; + } + out->fb[i].size = reg->top - reg->base; } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/amd/pm/amdgpu_pm.c linux-lowlatency-5.15.0/drivers/gpu/drm/amd/pm/amdgpu_pm.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -807,7 +807,7 @@ if (adev->in_suspend && !adev->in_runpm) return -EPERM; - if (count > 127) + if (count > 127 || count == 0) return -EINVAL; if (*buf == 's') @@ -827,7 +827,8 @@ else return -EINVAL; - memcpy(buf_cpy, buf, count+1); + memcpy(buf_cpy, buf, count); + buf_cpy[count] = 0; tmp_str = buf_cpy; @@ -844,6 +845,9 @@ return -EINVAL; parameter_size++; + if (!tmp_str) + break; + while (isspace(*tmp_str)) tmp_str++; } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/lontium-lt8912b.c linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/lontium-lt8912b.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -43,7 +43,6 @@ u8 data_lanes; bool is_power_on; - bool is_attached; }; static int lt8912_write_init_config(struct lt8912 *lt) @@ -481,11 +480,11 @@ return -EPROBE_DEFER; } - dsi = mipi_dsi_device_register_full(host, &info); + dsi = devm_mipi_dsi_device_register_full(dev, host, &info); if (IS_ERR(dsi)) { ret = PTR_ERR(dsi); dev_err(dev, "failed to create dsi device (%d)\n", ret); - goto err_dsi_device; + return ret; } lt->dsi = dsi; @@ -497,24 +496,21 @@ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "failed to attach dsi to host\n"); - goto err_dsi_attach; + return ret; } return 0; - -err_dsi_attach: - mipi_dsi_device_unregister(dsi); -err_dsi_device: - return ret; } -static void lt8912_detach_dsi(struct lt8912 *lt) +static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status status) { - mipi_dsi_detach(lt->dsi); - mipi_dsi_device_unregister(lt->dsi); + struct lt8912 *lt = data; + + if (lt->bridge.dev) + drm_helper_hpd_irq_event(lt->bridge.dev); } static int lt8912_bridge_connector_init(struct drm_bridge *bridge) @@ -523,8 +519,13 @@ struct lt8912 *lt = bridge_to_lt8912(bridge); struct drm_connector *connector = <->connector; - connector->polled = DRM_CONNECTOR_POLL_CONNECT | - DRM_CONNECTOR_POLL_DISCONNECT; + if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) { + drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, lt); + connector->polled = DRM_CONNECTOR_POLL_HPD; + } else { + connector->polled = DRM_CONNECTOR_POLL_CONNECT | + DRM_CONNECTOR_POLL_DISCONNECT; + } ret = drm_connector_init(bridge->dev, connector, <8912_connector_funcs, @@ -547,6 +548,13 @@ struct lt8912 *lt = bridge_to_lt8912(bridge); int ret; + ret = drm_bridge_attach(bridge->encoder, lt->hdmi_port, bridge, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret < 0) { + dev_err(lt->dev, "Failed to attach next bridge (%d)\n", ret); + return ret; + } + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { ret = lt8912_bridge_connector_init(bridge); if (ret) { @@ -563,12 +571,6 @@ if (ret) goto error; - ret = lt8912_attach_dsi(lt); - if (ret) - goto error; - - lt->is_attached = true; - return 0; error: @@ -580,12 +582,10 @@ { struct lt8912 *lt = bridge_to_lt8912(bridge); - if (lt->is_attached) { - lt8912_detach_dsi(lt); - lt8912_hard_power_off(lt); - drm_connector_unregister(<->connector); - drm_connector_cleanup(<->connector); - } + lt8912_hard_power_off(lt); + + if (lt->connector.dev && lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) + drm_bridge_hpd_disable(lt->hdmi_port); } static enum drm_connector_status @@ -726,8 +726,15 @@ drm_bridge_add(<->bridge); + ret = lt8912_attach_dsi(lt); + if (ret) + goto err_attach; + return 0; +err_attach: + drm_bridge_remove(<->bridge); + lt8912_free_i2c(lt); err_i2c: lt8912_put_dt(lt); err_dt_parse: @@ -738,7 +745,6 @@ { struct lt8912 *lt = i2c_get_clientdata(client); - lt8912_bridge_detach(<->bridge); drm_bridge_remove(<->bridge); lt8912_free_i2c(lt); lt8912_put_dt(lt); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/tc358768.c linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/tc358768.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/tc358768.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/bridge/tc358768.c @@ -217,6 +217,10 @@ u32 tmp, orig; tc358768_read(priv, reg, &orig); + + if (priv->error) + return; + tmp = orig & ~mask; tmp |= val & mask; if (tmp != orig) @@ -633,6 +637,7 @@ { struct tc358768_priv *priv = bridge_to_tc358768(bridge); struct mipi_dsi_device *dsi_dev = priv->output.dev; + unsigned long mode_flags = dsi_dev->mode_flags; u32 val, val2, lptxcnt, hact, data_type; s32 raw_val; const struct drm_display_mode *mode; @@ -640,6 +645,11 @@ u32 dsiclk, dsibclk; int ret, i; + if (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { + dev_warn_once(priv->dev, "Non-continuous mode unimplemented, falling back to continuous\n"); + mode_flags &= ~MIPI_DSI_CLOCK_NON_CONTINUOUS; + } + tc358768_hw_enable(priv); ret = tc358768_sw_reset(priv); @@ -775,8 +785,8 @@ val |= BIT(i + 1); tc358768_write(priv, TC358768_HSTXVREGEN, val); - if (!(dsi_dev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) - tc358768_write(priv, TC358768_TXOPTIONCNTRL, 0x1); + tc358768_write(priv, TC358768_TXOPTIONCNTRL, + (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) ? 0 : BIT(0)); /* TXTAGOCNT[26:16] RXTASURECNT[10:0] */ val = tc358768_to_ns((lptxcnt + 1) * dsibclk_nsk * 4); @@ -812,11 +822,12 @@ tc358768_write(priv, TC358768_DSI_HACT, hact); /* VSYNC polarity */ - if (!(mode->flags & DRM_MODE_FLAG_NVSYNC)) - tc358768_update_bits(priv, TC358768_CONFCTL, BIT(5), BIT(5)); + tc358768_update_bits(priv, TC358768_CONFCTL, BIT(5), + (mode->flags & DRM_MODE_FLAG_PVSYNC) ? BIT(5) : 0); + /* HSYNC polarity */ - if (mode->flags & DRM_MODE_FLAG_PHSYNC) - tc358768_update_bits(priv, TC358768_PP_MISC, BIT(0), BIT(0)); + tc358768_update_bits(priv, TC358768_PP_MISC, BIT(0), + (mode->flags & DRM_MODE_FLAG_PHSYNC) ? BIT(0) : 0); /* Start DSI Tx */ tc358768_write(priv, TC358768_DSI_START, 0x1); @@ -832,7 +843,7 @@ val |= TC358768_DSI_CONTROL_TXMD; - if (!(dsi_dev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) + if (!(mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) val |= TC358768_DSI_CONTROL_HSCKMD; if (dsi_dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/drm_atomic_helper.c linux-lowlatency-5.15.0/drivers/gpu/drm/drm_atomic_helper.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/drm_atomic_helper.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/drm_atomic_helper.c @@ -285,7 +285,8 @@ update_connector_routing(struct drm_atomic_state *state, struct drm_connector *connector, struct drm_connector_state *old_connector_state, - struct drm_connector_state *new_connector_state) + struct drm_connector_state *new_connector_state, + bool added_by_user) { const struct drm_connector_helper_funcs *funcs; struct drm_encoder *new_encoder; @@ -336,9 +337,13 @@ * there's a chance the connector may have been destroyed during the * process, but it's better to ignore that then cause * drm_atomic_helper_resume() to fail. + * + * Last, we want to ignore connector registration when the connector + * was not pulled in the atomic state by user-space (ie, was pulled + * in by the driver, e.g. when updating a DP-MST stream). */ if (!state->duplicated && drm_connector_is_unregistered(connector) && - crtc_state->active) { + added_by_user && crtc_state->active) { DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n", connector->base.id, connector->name); return -EINVAL; @@ -610,7 +615,10 @@ struct drm_connector *connector; struct drm_connector_state *old_connector_state, *new_connector_state; int i, ret; - unsigned int connectors_mask = 0; + unsigned int connectors_mask = 0, user_connectors_mask = 0; + + for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) + user_connectors_mask |= BIT(i); for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { bool has_connectors = @@ -675,7 +683,8 @@ */ ret = update_connector_routing(state, connector, old_connector_state, - new_connector_state); + new_connector_state, + BIT(i) & user_connectors_mask); if (ret) return ret; if (old_connector_state->crtc) { diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/drm_dp_mst_topology.c linux-lowlatency-5.15.0/drivers/gpu/drm/drm_dp_mst_topology.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/drm_dp_mst_topology.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/drm_dp_mst_topology.c @@ -2615,14 +2615,14 @@ struct drm_dp_mst_branch *found_mstb; struct drm_dp_mst_port *port; + if (!mstb) + return NULL; + if (memcmp(mstb->guid, guid, 16) == 0) return mstb; list_for_each_entry(port, &mstb->ports, next) { - if (!port->mstb) - continue; - found_mstb = get_mst_branch_device_by_guid_helper(port->mstb, guid); if (found_mstb) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/drm_mipi_dsi.c linux-lowlatency-5.15.0/drivers/gpu/drm/drm_mipi_dsi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/drm_mipi_dsi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/drm_mipi_dsi.c @@ -246,6 +246,52 @@ } EXPORT_SYMBOL(mipi_dsi_device_unregister); +static void devm_mipi_dsi_device_unregister(void *arg) +{ + struct mipi_dsi_device *dsi = arg; + + mipi_dsi_device_unregister(dsi); +} + +/** + * devm_mipi_dsi_device_register_full - create a managed MIPI DSI device + * @dev: device to tie the MIPI-DSI device lifetime to + * @host: DSI host to which this device is connected + * @info: pointer to template containing DSI device information + * + * Create a MIPI DSI device by using the device information provided by + * mipi_dsi_device_info template + * + * This is the managed version of mipi_dsi_device_register_full() which + * automatically calls mipi_dsi_device_unregister() when @dev is + * unbound. + * + * Returns: + * A pointer to the newly created MIPI DSI device, or, a pointer encoded + * with an error + */ +struct mipi_dsi_device * +devm_mipi_dsi_device_register_full(struct device *dev, + struct mipi_dsi_host *host, + const struct mipi_dsi_device_info *info) +{ + struct mipi_dsi_device *dsi; + int ret; + + dsi = mipi_dsi_device_register_full(host, info); + if (IS_ERR(dsi)) + return dsi; + + ret = devm_add_action_or_reset(dev, + devm_mipi_dsi_device_unregister, + dsi); + if (ret) + return ERR_PTR(ret); + + return dsi; +} +EXPORT_SYMBOL_GPL(devm_mipi_dsi_device_register_full); + static DEFINE_MUTEX(host_lock); static LIST_HEAD(host_list); @@ -346,6 +392,41 @@ } EXPORT_SYMBOL(mipi_dsi_detach); +static void devm_mipi_dsi_detach(void *arg) +{ + struct mipi_dsi_device *dsi = arg; + + mipi_dsi_detach(dsi); +} + +/** + * devm_mipi_dsi_attach - Attach a MIPI-DSI device to its DSI Host + * @dev: device to tie the MIPI-DSI device attachment lifetime to + * @dsi: DSI peripheral + * + * This is the managed version of mipi_dsi_attach() which automatically + * calls mipi_dsi_detach() when @dev is unbound. + * + * Returns: + * 0 on success, a negative error code on failure. + */ +int devm_mipi_dsi_attach(struct device *dev, + struct mipi_dsi_device *dsi) +{ + int ret; + + ret = mipi_dsi_attach(dsi); + if (ret) + return ret; + + ret = devm_add_action_or_reset(dev, devm_mipi_dsi_detach, dsi); + if (ret) + return ret; + + return 0; +} +EXPORT_SYMBOL_GPL(devm_mipi_dsi_attach); + static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi, struct mipi_dsi_msg *msg) { diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/drm_panel_orientation_quirks.c linux-lowlatency-5.15.0/drivers/gpu/drm/drm_panel_orientation_quirks.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -44,6 +44,14 @@ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data gpd_onemix2s = { + .width = 1200, + .height = 1920, + .bios_dates = (const char * const []){ "05/21/2018", "10/26/2018", + "03/04/2019", NULL }, + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, +}; + static const struct drm_dmi_panel_orientation_data gpd_pocket = { .width = 1200, .height = 1920, @@ -329,6 +337,14 @@ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* One Mix 2S (generic strings, also match on bios date) */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), + }, + .driver_data = (void *)&gpd_onemix2s, }, {} }; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/drm_syncobj.c linux-lowlatency-5.15.0/drivers/gpu/drm/drm_syncobj.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/drm_syncobj.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/drm_syncobj.c @@ -1056,7 +1056,8 @@ fence = drm_syncobj_fence_get(syncobjs[i]); if (!fence || dma_fence_chain_find_seqno(&fence, points[i])) { dma_fence_put(fence); - if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { + if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT | + DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) { continue; } else { timeout = -EINVAL; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/icl_dsi.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/icl_dsi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/icl_dsi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/icl_dsi.c @@ -1485,6 +1485,13 @@ static enum drm_mode_status gen11_dsi_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + struct drm_i915_private *i915 = to_i915(connector->dev); + enum drm_mode_status status; + + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; + /* FIXME: DSC? */ return intel_dsi_mode_valid(connector, mode); } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.c @@ -11778,6 +11778,16 @@ mode->vtotal > vtotal_max) return MODE_V_ILLEGAL; + return MODE_OK; +} + +enum drm_mode_status intel_cpu_transcoder_mode_valid(struct drm_i915_private *dev_priv, + const struct drm_display_mode *mode) +{ + /* + * Additional transcoder timing limits, + * excluding BXT/GLK DSI transcoders. + */ if (DISPLAY_VER(dev_priv) >= 5) { if (mode->hdisplay < 64 || mode->htotal - mode->hdisplay < 32) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.h linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.h --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_display.h @@ -528,6 +528,9 @@ intel_mode_valid_max_plane_size(struct drm_i915_private *dev_priv, const struct drm_display_mode *mode, bool bigjoiner); +enum drm_mode_status +intel_cpu_transcoder_mode_valid(struct drm_i915_private *i915, + const struct drm_display_mode *mode); enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); bool is_trans_port_sync_mode(const struct intel_crtc_state *state); diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp.c @@ -731,6 +731,10 @@ enum drm_mode_status status; bool dsc = false, bigjoiner = false; + status = intel_cpu_transcoder_mode_valid(dev_priv, mode); + if (status != MODE_OK) + return status; + if (mode->flags & DRM_MODE_FLAG_DBLCLK) return MODE_H_ILLEGAL; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp_mst.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp_mst.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -697,6 +697,10 @@ return 0; } + *status = intel_cpu_transcoder_mode_valid(dev_priv, mode); + if (*status != MODE_OK) + return 0; + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) { *status = MODE_NO_DBLESCAN; return 0; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_hdmi.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_hdmi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_hdmi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -1962,6 +1962,10 @@ bool has_hdmi_sink = intel_has_hdmi_sink(hdmi, connector->state); bool ycbcr_420_only; + status = intel_cpu_transcoder_mode_valid(dev_priv, mode); + if (status != MODE_OK) + return status; + if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) clock *= 2; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_lvds.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_lvds.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_lvds.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_lvds.c @@ -387,8 +387,14 @@ struct drm_display_mode *mode) { struct intel_connector *intel_connector = to_intel_connector(connector); + struct drm_i915_private *i915 = to_i915(intel_connector->base.dev); struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode; - int max_pixclk = to_i915(connector->dev)->max_dotclk_freq; + int max_pixclk = i915->max_dotclk_freq; + enum drm_mode_status status; + + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; if (mode->flags & DRM_MODE_FLAG_DBLSCAN) return MODE_NO_DBLESCAN; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_sdvo.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_sdvo.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_sdvo.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -1863,13 +1863,19 @@ intel_sdvo_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + struct drm_i915_private *i915 = to_i915(connector->dev); struct intel_sdvo *intel_sdvo = intel_attached_sdvo(to_intel_connector(connector)); struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); - int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; + int max_dotclk = i915->max_dotclk_freq; bool has_hdmi_sink = intel_has_hdmi_sink(intel_sdvo, connector->state); + enum drm_mode_status status; int clock = mode->clock; + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) return MODE_NO_DBLESCAN; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/vlv_dsi.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/vlv_dsi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/vlv_dsi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1613,9 +1613,25 @@ .destroy = intel_dsi_encoder_destroy, }; +static enum drm_mode_status vlv_dsi_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct drm_i915_private *i915 = to_i915(connector->dev); + + if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) { + enum drm_mode_status status; + + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; + } + + return intel_dsi_mode_valid(connector, mode); +} + static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = { .get_modes = intel_dsi_get_modes, - .mode_valid = intel_dsi_mode_valid, + .mode_valid = vlv_dsi_mode_valid, .atomic_check = intel_digital_connector_atomic_check, }; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_context.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_context.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -642,6 +642,7 @@ if (idx >= pc->num_user_engines) return -EINVAL; + idx = array_index_nospec(idx, pc->num_user_engines); pe = &pc->user_engines[idx]; /* Only render engine supports RPCS configuration. */ diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c @@ -231,6 +231,7 @@ case 0: case -EAGAIN: case -ENOSPC: /* transient failure to evict? */ + case -ENOBUFS: /* temporarily out of fences? */ case -ERESTARTSYS: case -EINTR: case -EBUSY: diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/i915/i915_perf.c linux-lowlatency-5.15.0/drivers/gpu/drm/i915/i915_perf.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/i915/i915_perf.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/i915_perf.c @@ -3795,11 +3795,8 @@ u32 known_open_flags; int ret; - if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + if (!perf->i915) return -ENOTSUPP; - } known_open_flags = I915_PERF_FLAG_FD_CLOEXEC | I915_PERF_FLAG_FD_NONBLOCK | @@ -4090,11 +4087,8 @@ struct i915_oa_reg *regs; int err, id; - if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + if (!perf->i915) return -ENOTSUPP; - } if (!perf->metrics_kobj) { drm_dbg(&perf->i915->drm, @@ -4256,11 +4250,8 @@ struct i915_oa_config *oa_config; int ret; - if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + if (!perf->i915) return -ENOTSUPP; - } if (i915_perf_stream_paranoid && !perfmon_capable()) { drm_dbg(&perf->i915->drm, diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_drm_crtc.c linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_drm_crtc.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -362,6 +362,9 @@ unsigned int local_layer; plane_state = to_mtk_plane_state(plane->state); + + /* should not enable layer before crtc enabled */ + plane_state->pending.enable = false; comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer); if (comp) mtk_ddp_comp_layer_config(comp, local_layer, diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_dsi.c linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_dsi.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_dsi.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -406,7 +406,7 @@ if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) tmp_reg |= HSTX_CKLP_EN; - if (!(dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) + if (dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET) tmp_reg |= DIS_EOT; writel(tmp_reg, dsi->regs + DSI_TXRX_CTRL); @@ -483,7 +483,7 @@ timing->da_hs_zero + timing->da_hs_exit + 3; delta = dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : 12; - delta += dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET ? 2 : 0; + delta += dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET ? 0 : 2; horizontal_frontporch_byte = vm->hfront_porch * dsi_tmp_buf_bpp; horizontal_front_back_byte = horizontal_frontporch_byte + horizontal_backporch_byte; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dp/dp_panel.c linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dp/dp_panel.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dp/dp_panel.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dp/dp_panel.c @@ -263,26 +263,9 @@ static u8 dp_panel_get_edid_checksum(struct edid *edid) { - struct edid *last_block; - u8 *raw_edid; - bool is_edid_corrupt = false; + edid += edid->extensions; - if (!edid) { - DRM_ERROR("invalid edid input\n"); - return 0; - } - - raw_edid = (u8 *)edid; - raw_edid += (edid->extensions * EDID_LENGTH); - last_block = (struct edid *)raw_edid; - - /* block type extension */ - drm_edid_block_valid(raw_edid, 1, false, &is_edid_corrupt); - if (!is_edid_corrupt) - return last_block->checksum; - - DRM_ERROR("Invalid block, no checksum\n"); - return 0; + return edid->checksum; } void dp_panel_handle_sink_request(struct dp_panel *dp_panel) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dsi/dsi_host.c linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dsi/dsi_host.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dsi/dsi_host.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1154,8 +1154,7 @@ priv = dev->dev_private; if (msm_host->tx_gem_obj) { - msm_gem_unpin_iova(msm_host->tx_gem_obj, priv->kms->aspace); - drm_gem_object_put(msm_host->tx_gem_obj); + msm_gem_kernel_put(msm_host->tx_gem_obj, priv->kms->aspace); msm_host->tx_gem_obj = NULL; } diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-simple.c linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-simple.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-simple.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-simple.c @@ -2532,13 +2532,13 @@ static const struct display_timing innolux_g101ice_l01_timing = { .pixelclock = { 60400000, 71100000, 74700000 }, .hactive = { 1280, 1280, 1280 }, - .hfront_porch = { 41, 80, 100 }, - .hback_porch = { 40, 79, 99 }, - .hsync_len = { 1, 1, 1 }, + .hfront_porch = { 30, 60, 70 }, + .hback_porch = { 30, 60, 70 }, + .hsync_len = { 22, 40, 60 }, .vactive = { 800, 800, 800 }, - .vfront_porch = { 5, 11, 14 }, - .vback_porch = { 4, 11, 14 }, - .vsync_len = { 1, 1, 1 }, + .vfront_porch = { 3, 8, 14 }, + .vback_porch = { 3, 8, 14 }, + .vsync_len = { 4, 7, 12 }, .flags = DISPLAY_FLAGS_DE_HIGH, }; @@ -2555,6 +2555,7 @@ .disable = 200, }, .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + .bus_flags = DRM_BUS_FLAG_DE_HIGH, .connector_type = DRM_MODE_CONNECTOR_LVDS, }; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/cdn-dp-core.c linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/cdn-dp-core.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -1146,6 +1146,7 @@ struct cdn_dp_device *dp; struct extcon_dev *extcon; struct phy *phy; + int ret; int i; dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); @@ -1186,9 +1187,19 @@ mutex_init(&dp->lock); dev_set_drvdata(dev, dp); - cdn_dp_audio_codec_init(dp, dev); + ret = cdn_dp_audio_codec_init(dp, dev); + if (ret) + return ret; - return component_add(dev, &cdn_dp_component_ops); + ret = component_add(dev, &cdn_dp_component_ops); + if (ret) + goto err_audio_deinit; + + return 0; + +err_audio_deinit: + platform_device_unregister(dp->audio_pdev); + return ret; } static int cdn_dp_remove(struct platform_device *pdev) diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_gem.c linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_gem.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -39,7 +39,7 @@ ret = iommu_map_sgtable(private->domain, rk_obj->dma_addr, rk_obj->sgt, prot); - if (ret < rk_obj->base.size) { + if (ret < (ssize_t)rk_obj->base.size) { DRM_ERROR("failed to map buffer: size=%zd request_size=%zd\n", ret, rk_obj->base.size); ret = -ENOMEM; diff -u linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_vop.c linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_vop.c --- linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -249,14 +249,22 @@ VOP_REG_SET(vop, common, cfg_done, 1); } -static bool has_rb_swapped(uint32_t format) +static bool has_rb_swapped(uint32_t version, uint32_t format) { switch (format) { case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ABGR8888: - case DRM_FORMAT_BGR888: case DRM_FORMAT_BGR565: return true; + /* + * full framework (IP version 3.x) only need rb swapped for RGB888 and + * little framework (IP version 2.x) only need rb swapped for BGR888, + * check for 3.x to also only rb swap BGR888 for unknown vop version + */ + case DRM_FORMAT_RGB888: + return VOP_MAJOR(version) == 3; + case DRM_FORMAT_BGR888: + return VOP_MAJOR(version) != 3; default: return false; } @@ -998,7 +1006,7 @@ VOP_WIN_SET(vop, win, dsp_info, dsp_info); VOP_WIN_SET(vop, win, dsp_st, dsp_st); - rb_swap = has_rb_swapped(fb->format->format); + rb_swap = has_rb_swapped(vop->data->version, fb->format->format); VOP_WIN_SET(vop, win, rb_swap, rb_swap); /* @@ -1554,7 +1562,8 @@ if (WARN_ON(!crtc->state)) return NULL; - rockchip_state = kzalloc(sizeof(*rockchip_state), GFP_KERNEL); + rockchip_state = kmemdup(to_rockchip_crtc_state(crtc->state), + sizeof(*rockchip_state), GFP_KERNEL); if (!rockchip_state) return NULL; @@ -1579,7 +1588,10 @@ if (crtc->state) vop_crtc_destroy_state(crtc, crtc->state); - __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); + if (crtc_state) + __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); + else + __drm_atomic_helper_crtc_reset(crtc, NULL); } #ifdef CONFIG_DRM_ANALOGIX_DP diff -u linux-lowlatency-5.15.0/drivers/hid/hid-core.c linux-lowlatency-5.15.0/drivers/hid/hid-core.c --- linux-lowlatency-5.15.0/drivers/hid/hid-core.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-core.c @@ -702,15 +702,22 @@ * Free a device structure, all reports, and all fields. */ -static void hid_device_release(struct device *dev) +void hiddev_free(struct kref *ref) { - struct hid_device *hid = to_hid_device(dev); + struct hid_device *hid = container_of(ref, struct hid_device, ref); hid_close_report(hid); kfree(hid->dev_rdesc); kfree(hid); } +static void hid_device_release(struct device *dev) +{ + struct hid_device *hid = to_hid_device(dev); + + kref_put(&hid->ref, hiddev_free); +} + /* * Fetch a report description item from the data stream. We support long * items, though they are not used yet. @@ -2442,10 +2449,12 @@ hid_warn(hdev, "bad device descriptor (%d)\n", ret); } + hdev->id = atomic_inc_return(&id); + /* XXX hack, any other cleaner solution after the driver core * is converted to allow more than 20 bytes as the device name? */ dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, - hdev->vendor, hdev->product, atomic_inc_return(&id)); + hdev->vendor, hdev->product, hdev->id); hid_debug_register(hdev, dev_name(&hdev->dev)); ret = device_add(&hdev->dev); @@ -2488,6 +2497,7 @@ spin_lock_init(&hdev->debug_list_lock); sema_init(&hdev->driver_input_lock, 1); mutex_init(&hdev->ll_open_lock); + kref_init(&hdev->ref); return hdev; } diff -u linux-lowlatency-5.15.0/drivers/hid/hid-cp2112.c linux-lowlatency-5.15.0/drivers/hid/hid-cp2112.c --- linux-lowlatency-5.15.0/drivers/hid/hid-cp2112.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-cp2112.c @@ -1157,8 +1157,6 @@ struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct cp2112_device *dev = gpiochip_get_data(gc); - INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback); - if (!dev->gpio_poll) { dev->gpio_poll = true; schedule_delayed_work(&dev->gpio_poll_worker, 0); @@ -1173,7 +1171,10 @@ struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct cp2112_device *dev = gpiochip_get_data(gc); - cancel_delayed_work_sync(&dev->gpio_poll_worker); + if (!dev->irq_mask) { + dev->gpio_poll = false; + cancel_delayed_work_sync(&dev->gpio_poll_worker); + } } static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type) @@ -1355,4 +1356,6 @@ girq->threaded = true; + INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback); + ret = gpiochip_add_data(&dev->gc, dev); if (ret < 0) { diff -u linux-lowlatency-5.15.0/drivers/hid/hid-debug.c linux-lowlatency-5.15.0/drivers/hid/hid-debug.c --- linux-lowlatency-5.15.0/drivers/hid/hid-debug.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-debug.c @@ -1096,6 +1096,7 @@ goto out; } list->hdev = (struct hid_device *) inode->i_private; + kref_get(&list->hdev->ref); file->private_data = list; mutex_init(&list->read_mutex); @@ -1188,6 +1189,8 @@ list_del(&list->node); spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); kfifo_free(&list->hid_debug_fifo); + + kref_put(&list->hdev->ref, hiddev_free); kfree(list); return 0; diff -u linux-lowlatency-5.15.0/drivers/hid/hid-holtek-kbd.c linux-lowlatency-5.15.0/drivers/hid/hid-holtek-kbd.c --- linux-lowlatency-5.15.0/drivers/hid/hid-holtek-kbd.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-holtek-kbd.c @@ -130,6 +130,10 @@ return -ENODEV; boot_hid = usb_get_intfdata(boot_interface); + if (list_empty(&boot_hid->inputs)) { + hid_err(hid, "no inputs found\n"); + return -ENODEV; + } boot_hid_input = list_first_entry(&boot_hid->inputs, struct hid_input, list); diff -u linux-lowlatency-5.15.0/drivers/hid/hid-ids.h linux-lowlatency-5.15.0/drivers/hid/hid-ids.h --- linux-lowlatency-5.15.0/drivers/hid/hid-ids.h +++ linux-lowlatency-5.15.0/drivers/hid/hid-ids.h @@ -349,6 +349,7 @@ #define USB_VENDOR_ID_DELL 0x413c #define USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE 0x301a +#define USB_DEVICE_ID_DELL_PRO_WIRELESS_KM5221W 0x4503 #define USB_VENDOR_ID_DELORME 0x1163 #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 diff -u linux-lowlatency-5.15.0/drivers/hid/hid-logitech-hidpp.c linux-lowlatency-5.15.0/drivers/hid/hid-logitech-hidpp.c --- linux-lowlatency-5.15.0/drivers/hid/hid-logitech-hidpp.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-logitech-hidpp.c @@ -31,11 +31,6 @@ MODULE_AUTHOR("Benjamin Tissoires "); MODULE_AUTHOR("Nestor Lopez Casado "); -static bool disable_raw_mode; -module_param(disable_raw_mode, bool, 0644); -MODULE_PARM_DESC(disable_raw_mode, - "Disable Raw mode reporting for touchpads and keep firmware gestures."); - static bool disable_tap_to_click; module_param(disable_tap_to_click, bool, 0644); MODULE_PARM_DESC(disable_tap_to_click, @@ -68,7 +63,7 @@ /* bits 2..20 are reserved for classes */ /* #define HIDPP_QUIRK_CONNECT_EVENTS BIT(21) disabled */ #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) -#define HIDPP_QUIRK_NO_HIDINPUT BIT(23) +#define HIDPP_QUIRK_DELAYED_INIT BIT(23) #define HIDPP_QUIRK_FORCE_OUTPUT_REPORTS BIT(24) #define HIDPP_QUIRK_UNIFYING BIT(25) #define HIDPP_QUIRK_HI_RES_SCROLL_1P0 BIT(26) @@ -87,8 +82,6 @@ HIDPP_QUIRK_HI_RES_SCROLL_X2120 | \ HIDPP_QUIRK_HI_RES_SCROLL_X2121) -#define HIDPP_QUIRK_DELAYED_INIT HIDPP_QUIRK_NO_HIDINPUT - #define HIDPP_CAPABILITY_HIDPP10_BATTERY BIT(0) #define HIDPP_CAPABILITY_HIDPP20_BATTERY BIT(1) #define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2) @@ -1760,15 +1753,14 @@ /* -------------------------------------------------------------------------- */ #define HIDPP_PAGE_WIRELESS_DEVICE_STATUS 0x1d4b -static int hidpp_set_wireless_feature_index(struct hidpp_device *hidpp) +static int hidpp_get_wireless_feature_index(struct hidpp_device *hidpp, u8 *feature_index) { u8 feature_type; int ret; ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_WIRELESS_DEVICE_STATUS, - &hidpp->wireless_feature_index, - &feature_type); + feature_index, &feature_type); return ret; } @@ -3957,6 +3949,13 @@ } } + if (hidpp->protocol_major >= 2) { + u8 feature_index; + + if (!hidpp_get_wireless_feature_index(hidpp, &feature_index)) + hidpp->wireless_feature_index = feature_index; + } + if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) { name = hidpp_get_device_name(hidpp); if (name) { @@ -3993,7 +3992,7 @@ if (hidpp->quirks & HIDPP_QUIRK_HI_RES_SCROLL) hi_res_scroll_enable(hidpp); - if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) + if (!(hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) || hidpp->delayed_input) /* if the input nodes are already created, we can stop now */ return; @@ -4096,7 +4095,6 @@ bool connected; unsigned int connect_mask = HID_CONNECT_DEFAULT; struct hidpp_ff_private_data data; - bool will_restart = false; /* report_fixup needs drvdata to be set before we call hid_parse */ hidpp = devm_kzalloc(&hdev->dev, sizeof(*hidpp), GFP_KERNEL); @@ -4137,11 +4135,6 @@ hidpp_application_equals(hdev, HID_GD_KEYBOARD)) hidpp->quirks |= HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS; - if (disable_raw_mode) { - hidpp->quirks &= ~HIDPP_QUIRK_CLASS_WTP; - hidpp->quirks &= ~HIDPP_QUIRK_NO_HIDINPUT; - } - if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { ret = wtp_allocate(hdev, id); if (ret) @@ -4152,10 +4145,6 @@ return ret; } - if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT || - hidpp->quirks & HIDPP_QUIRK_UNIFYING) - will_restart = true; - INIT_WORK(&hidpp->work, delayed_work_cb); mutex_init(&hidpp->send_mutex); init_waitqueue_head(&hidpp->wait); @@ -4167,10 +4156,12 @@ hdev->name); /* - * Plain USB connections need to actually call start and open - * on the transport driver to allow incoming data. + * First call hid_hw_start(hdev, 0) to allow IO without connecting any + * hid subdrivers (hid-input, hidraw). This allows retrieving the dev's + * name and serial number and store these in hdev->name and hdev->uniq, + * before the hid-input and hidraw drivers expose these to userspace. */ - ret = hid_hw_start(hdev, will_restart ? 0 : connect_mask); + ret = hid_hw_start(hdev, 0); if (ret) { hid_err(hdev, "hw start failed\n"); goto hid_hw_start_fail; @@ -4203,15 +4194,6 @@ hidpp_overwrite_name(hdev); } - if (connected && hidpp->protocol_major >= 2) { - ret = hidpp_set_wireless_feature_index(hidpp); - if (ret == -ENOENT) - hidpp->wireless_feature_index = 0; - else if (ret) - goto hid_hw_init_fail; - ret = 0; - } - if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) { ret = wtp_get_config(hidpp); if (ret) @@ -4225,21 +4207,14 @@ schedule_work(&hidpp->work); flush_work(&hidpp->work); - if (will_restart) { - /* Reset the HID node state */ - hid_device_io_stop(hdev); - hid_hw_close(hdev); - hid_hw_stop(hdev); - - if (hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) - connect_mask &= ~HID_CONNECT_HIDINPUT; + if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) + connect_mask &= ~HID_CONNECT_HIDINPUT; - /* Now export the actual inputs and hidraw nodes to the world */ - ret = hid_hw_start(hdev, connect_mask); - if (ret) { - hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); - goto hid_hw_start_fail; - } + /* Now export the actual inputs and hidraw nodes to the world */ + ret = hid_connect(hdev, connect_mask); + if (ret) { + hid_err(hdev, "%s:hid_connect returned error %d\n", __func__, ret); + goto hid_hw_init_fail; } if (hidpp->quirks & HIDPP_QUIRK_CLASS_G920) { @@ -4250,6 +4225,11 @@ ret); } + /* + * This relies on logi_dj_ll_close() being a no-op so that DJ connection + * events will still be received. + */ + hid_hw_close(hdev); return ret; hid_hw_init_fail: diff -u linux-lowlatency-5.15.0/drivers/hid/hid-multitouch.c linux-lowlatency-5.15.0/drivers/hid/hid-multitouch.c --- linux-lowlatency-5.15.0/drivers/hid/hid-multitouch.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-multitouch.c @@ -2144,6 +2144,10 @@ /* Synaptics devices */ { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, + USB_VENDOR_ID_SYNAPTICS, 0xcd7e) }, + + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, USB_VENDOR_ID_SYNAPTICS, 0xce08) }, { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, diff -u linux-lowlatency-5.15.0/drivers/hid/hid-quirks.c linux-lowlatency-5.15.0/drivers/hid/hid-quirks.c --- linux-lowlatency-5.15.0/drivers/hid/hid-quirks.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-quirks.c @@ -66,6 +66,7 @@ { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_STRAFE), HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, + { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_PRO_WIRELESS_KM5221W), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_2NES2SNES), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_4NES4SNES), HID_QUIRK_MULTI_INPUT }, diff -u linux-lowlatency-5.15.0/drivers/hwmon/coretemp.c linux-lowlatency-5.15.0/drivers/hwmon/coretemp.c --- linux-lowlatency-5.15.0/drivers/hwmon/coretemp.c +++ linux-lowlatency-5.15.0/drivers/hwmon/coretemp.c @@ -41,7 +41,7 @@ #define PKG_SYSFS_ATTR_NO 1 /* Sysfs attribute for package temp */ #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ #define NUM_REAL_CORES 128 /* Number of Real cores per cpu */ -#define CORETEMP_NAME_LENGTH 19 /* String Length of attrs */ +#define CORETEMP_NAME_LENGTH 28 /* String Length of attrs */ #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) diff -u linux-lowlatency-5.15.0/drivers/hwtracing/coresight/coresight-etm4x-core.c linux-lowlatency-5.15.0/drivers/hwtracing/coresight/coresight-etm4x-core.c --- linux-lowlatency-5.15.0/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ linux-lowlatency-5.15.0/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2041,7 +2041,7 @@ etmdrvdata[cpu] = NULL; } -static int __exit etm4_remove_dev(struct etmv4_drvdata *drvdata) +static void etm4_remove_dev(struct etmv4_drvdata *drvdata) { etm_perf_symlink(drvdata->csdev, false); /* @@ -2062,11 +2062,9 @@ cscfg_unregister_csdev(drvdata->csdev); coresight_unregister(drvdata->csdev); - - return 0; } -static void __exit etm4_remove_amba(struct amba_device *adev) +static void etm4_remove_amba(struct amba_device *adev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); @@ -2074,15 +2072,14 @@ etm4_remove_dev(drvdata); } -static int __exit etm4_remove_platform_dev(struct platform_device *pdev) +static int etm4_remove_platform_dev(struct platform_device *pdev) { - int ret = 0; struct etmv4_drvdata *drvdata = dev_get_drvdata(&pdev->dev); if (drvdata) - ret = etm4_remove_dev(drvdata); + etm4_remove_dev(drvdata); pm_runtime_disable(&pdev->dev); - return ret; + return 0; } static const struct amba_id etm4_ids[] = { diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-aspeed.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-aspeed.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-aspeed.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-aspeed.c @@ -744,6 +744,8 @@ func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG); func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN; writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG); + + bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; } static int aspeed_i2c_reg_slave(struct i2c_client *client) @@ -760,7 +762,6 @@ __aspeed_i2c_reg_slave(bus, client->addr); bus->slave = client; - bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; spin_unlock_irqrestore(&bus->lock, flags); return 0; diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-bcm-iproc.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-bcm-iproc.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-bcm-iproc.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-bcm-iproc.c @@ -326,26 +326,44 @@ iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); } -static void bcm_iproc_i2c_check_slave_status( - struct bcm_iproc_i2c_dev *iproc_i2c) +static bool bcm_iproc_i2c_check_slave_status + (struct bcm_iproc_i2c_dev *iproc_i2c, u32 status) { u32 val; + bool recover = false; - val = iproc_i2c_rd_reg(iproc_i2c, S_CMD_OFFSET); - /* status is valid only when START_BUSY is cleared after it was set */ - if (val & BIT(S_CMD_START_BUSY_SHIFT)) - return; - - val = (val >> S_CMD_STATUS_SHIFT) & S_CMD_STATUS_MASK; - if (val == S_CMD_STATUS_TIMEOUT || val == S_CMD_STATUS_MASTER_ABORT) { - dev_err(iproc_i2c->device, (val == S_CMD_STATUS_TIMEOUT) ? - "slave random stretch time timeout\n" : - "Master aborted read transaction\n"); + /* check slave transmit status only if slave is transmitting */ + if (!iproc_i2c->slave_rx_only) { + val = iproc_i2c_rd_reg(iproc_i2c, S_CMD_OFFSET); + /* status is valid only when START_BUSY is cleared */ + if (!(val & BIT(S_CMD_START_BUSY_SHIFT))) { + val = (val >> S_CMD_STATUS_SHIFT) & S_CMD_STATUS_MASK; + if (val == S_CMD_STATUS_TIMEOUT || + val == S_CMD_STATUS_MASTER_ABORT) { + dev_warn(iproc_i2c->device, + (val == S_CMD_STATUS_TIMEOUT) ? + "slave random stretch time timeout\n" : + "Master aborted read transaction\n"); + recover = true; + } + } + } + + /* RX_EVENT is not valid when START_BUSY is set */ + if ((status & BIT(IS_S_RX_EVENT_SHIFT)) && + (status & BIT(IS_S_START_BUSY_SHIFT))) { + dev_warn(iproc_i2c->device, "Slave aborted read transaction\n"); + recover = true; + } + + if (recover) { /* re-initialize i2c for recovery */ bcm_iproc_i2c_enable_disable(iproc_i2c, false); bcm_iproc_i2c_slave_init(iproc_i2c, true); bcm_iproc_i2c_enable_disable(iproc_i2c, true); } + + return recover; } static void bcm_iproc_i2c_slave_read(struct bcm_iproc_i2c_dev *iproc_i2c) @@ -430,48 +448,6 @@ u32 val; u8 value; - /* - * Slave events in case of master-write, master-write-read and, - * master-read - * - * Master-write : only IS_S_RX_EVENT_SHIFT event - * Master-write-read: both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT - * events - * Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT - * events or only IS_S_RD_EVENT_SHIFT - * - * iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt - * (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes - * full. This can happen if Master issues write requests of more than - * 64 bytes. - */ - if (status & BIT(IS_S_RX_EVENT_SHIFT) || - status & BIT(IS_S_RD_EVENT_SHIFT) || - status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) { - /* disable slave interrupts */ - val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); - val &= ~iproc_i2c->slave_int_mask; - iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); - - if (status & BIT(IS_S_RD_EVENT_SHIFT)) - /* Master-write-read request */ - iproc_i2c->slave_rx_only = false; - else - /* Master-write request only */ - iproc_i2c->slave_rx_only = true; - - /* schedule tasklet to read data later */ - tasklet_schedule(&iproc_i2c->slave_rx_tasklet); - - /* - * clear only IS_S_RX_EVENT_SHIFT and - * IS_S_RX_FIFO_FULL_SHIFT interrupt. - */ - val = BIT(IS_S_RX_EVENT_SHIFT); - if (status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) - val |= BIT(IS_S_RX_FIFO_FULL_SHIFT); - iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, val); - } if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) { iproc_i2c->tx_underrun++; @@ -503,8 +479,9 @@ * less than PKT_LENGTH bytes were output on the SMBUS */ iproc_i2c->slave_int_mask &= ~BIT(IE_S_TX_UNDERRUN_SHIFT); - iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, - iproc_i2c->slave_int_mask); + val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); + val &= ~BIT(IE_S_TX_UNDERRUN_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); /* End of SMBUS for Master Read */ val = BIT(S_TX_WR_STATUS_SHIFT); @@ -525,9 +502,49 @@ BIT(IS_S_START_BUSY_SHIFT)); } - /* check slave transmit status only if slave is transmitting */ - if (!iproc_i2c->slave_rx_only) - bcm_iproc_i2c_check_slave_status(iproc_i2c); + /* if the controller has been reset, immediately return from the ISR */ + if (bcm_iproc_i2c_check_slave_status(iproc_i2c, status)) + return true; + + /* + * Slave events in case of master-write, master-write-read and, + * master-read + * + * Master-write : only IS_S_RX_EVENT_SHIFT event + * Master-write-read: both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT + * events + * Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT + * events or only IS_S_RD_EVENT_SHIFT + * + * iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt + * (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes + * full. This can happen if Master issues write requests of more than + * 64 bytes. + */ + if (status & BIT(IS_S_RX_EVENT_SHIFT) || + status & BIT(IS_S_RD_EVENT_SHIFT) || + status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) { + /* disable slave interrupts */ + val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); + val &= ~iproc_i2c->slave_int_mask; + iproc_i2c_wr_reg(iproc_i2c, IE_OFFSET, val); + + if (status & BIT(IS_S_RD_EVENT_SHIFT)) + /* Master-write-read request */ + iproc_i2c->slave_rx_only = false; + else + /* Master-write request only */ + iproc_i2c->slave_rx_only = true; + + /* schedule tasklet to read data later */ + tasklet_schedule(&iproc_i2c->slave_rx_tasklet); + + /* clear IS_S_RX_FIFO_FULL_SHIFT interrupt */ + if (status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) { + val = BIT(IS_S_RX_FIFO_FULL_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, val); + } + } return true; } diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-common.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-common.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-common.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-common.c @@ -63,7 +63,7 @@ { struct dw_i2c_dev *dev = context; - *val = readl_relaxed(dev->base + reg); + *val = readl(dev->base + reg); return 0; } @@ -72,7 +72,7 @@ { struct dw_i2c_dev *dev = context; - writel_relaxed(val, dev->base + reg); + writel(val, dev->base + reg); return 0; } @@ -81,7 +81,7 @@ { struct dw_i2c_dev *dev = context; - *val = swab32(readl_relaxed(dev->base + reg)); + *val = swab32(readl(dev->base + reg)); return 0; } @@ -90,7 +90,7 @@ { struct dw_i2c_dev *dev = context; - writel_relaxed(swab32(val), dev->base + reg); + writel(swab32(val), dev->base + reg); return 0; } @@ -99,8 +99,8 @@ { struct dw_i2c_dev *dev = context; - *val = readw_relaxed(dev->base + reg) | - (readw_relaxed(dev->base + reg + 2) << 16); + *val = readw(dev->base + reg) | + (readw(dev->base + reg + 2) << 16); return 0; } @@ -109,8 +109,8 @@ { struct dw_i2c_dev *dev = context; - writew_relaxed(val, dev->base + reg); - writew_relaxed(val >> 16, dev->base + reg + 2); + writew(val, dev->base + reg); + writew(val >> 16, dev->base + reg + 2); return 0; } diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-master.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-master.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-master.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-designware-master.c @@ -456,10 +456,16 @@ /* * Because we don't know the buffer length in the - * I2C_FUNC_SMBUS_BLOCK_DATA case, we can't stop - * the transaction here. + * I2C_FUNC_SMBUS_BLOCK_DATA case, we can't stop the + * transaction here. Also disable the TX_EMPTY IRQ + * while waiting for the data length byte to avoid the + * bogus interrupts flood. */ - if (buf_len > 0 || flags & I2C_M_RECV_LEN) { + if (flags & I2C_M_RECV_LEN) { + dev->status |= STATUS_WRITE_IN_PROGRESS; + intr_mask &= ~DW_IC_INTR_TX_EMPTY; + break; + } else if (buf_len > 0) { /* more bytes to be written */ dev->status |= STATUS_WRITE_IN_PROGRESS; break; @@ -495,6 +501,13 @@ msgs[dev->msg_read_idx].len = len; msgs[dev->msg_read_idx].flags &= ~I2C_M_RECV_LEN; + /* + * Received buffer length, re-enable TX_EMPTY interrupt + * to resume the SMBUS transaction. + */ + regmap_update_bits(dev->map, DW_IC_INTR_MASK, DW_IC_INTR_TX_EMPTY, + DW_IC_INTR_TX_EMPTY); + return len; } diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-i801.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-i801.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-i801.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-i801.c @@ -702,15 +702,11 @@ return i801_check_post(priv, result ? priv->status : -ETIMEDOUT); } - for (i = 1; i <= len; i++) { - if (i == len && read_write == I2C_SMBUS_READ) - smbcmd |= SMBHSTCNT_LAST_BYTE; - outb_p(smbcmd, SMBHSTCNT(priv)); - - if (i == 1) - outb_p(inb(SMBHSTCNT(priv)) | SMBHSTCNT_START, - SMBHSTCNT(priv)); + if (len == 1 && read_write == I2C_SMBUS_READ) + smbcmd |= SMBHSTCNT_LAST_BYTE; + outb_p(smbcmd | SMBHSTCNT_START, SMBHSTCNT(priv)); + for (i = 1; i <= len; i++) { status = i801_wait_byte_done(priv); if (status) goto exit; @@ -733,9 +729,12 @@ data->block[0] = len; } - /* Retrieve/store value in SMBBLKDAT */ - if (read_write == I2C_SMBUS_READ) + if (read_write == I2C_SMBUS_READ) { data->block[i] = inb_p(SMBBLKDAT(priv)); + if (i == len - 1) + outb_p(smbcmd | SMBHSTCNT_LAST_BYTE, SMBHSTCNT(priv)); + } + if (read_write == I2C_SMBUS_WRITE && i+1 <= len) outb_p(data->block[i+1], SMBBLKDAT(priv)); diff -u linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-stm32f7.c linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-stm32f7.c --- linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-stm32f7.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-stm32f7.c @@ -1063,9 +1063,10 @@ /* Configure PEC */ if ((flags & I2C_CLIENT_PEC) && f7_msg->size != I2C_SMBUS_QUICK) { cr1 |= STM32F7_I2C_CR1_PECEN; - cr2 |= STM32F7_I2C_CR2_PECBYTE; - if (!f7_msg->read_write) + if (!f7_msg->read_write) { + cr2 |= STM32F7_I2C_CR2_PECBYTE; f7_msg->count++; + } } else { cr1 &= ~STM32F7_I2C_CR1_PECEN; cr2 &= ~STM32F7_I2C_CR2_PECBYTE; @@ -1153,8 +1154,10 @@ f7_msg->stop = true; /* Add one byte for PEC if needed */ - if (cr1 & STM32F7_I2C_CR1_PECEN) + if (cr1 & STM32F7_I2C_CR1_PECEN) { + cr2 |= STM32F7_I2C_CR2_PECBYTE; f7_msg->count++; + } /* Set number of bytes to be transferred */ cr2 &= ~(STM32F7_I2C_CR2_NBYTES_MASK); diff -u linux-lowlatency-5.15.0/drivers/i2c/i2c-dev.c linux-lowlatency-5.15.0/drivers/i2c/i2c-dev.c --- linux-lowlatency-5.15.0/drivers/i2c/i2c-dev.c +++ linux-lowlatency-5.15.0/drivers/i2c/i2c-dev.c @@ -450,8 +450,8 @@ if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS) return -EINVAL; - rdwr_pa = memdup_user(rdwr_arg.msgs, - rdwr_arg.nmsgs * sizeof(struct i2c_msg)); + rdwr_pa = memdup_array_user(rdwr_arg.msgs, + rdwr_arg.nmsgs, sizeof(struct i2c_msg)); if (IS_ERR(rdwr_pa)) return PTR_ERR(rdwr_pa); diff -u linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-demux-pinctrl.c linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-demux-pinctrl.c --- linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-demux-pinctrl.c @@ -61,7 +61,7 @@ if (ret) goto err; - adap = of_find_i2c_adapter_by_node(priv->chan[new_chan].parent_np); + adap = of_get_i2c_adapter_by_node(priv->chan[new_chan].parent_np); if (!adap) { ret = -ENODEV; goto err_with_revert; diff -u linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-mux-gpmux.c linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-mux-gpmux.c --- linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-mux-gpmux.c +++ linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -52,7 +52,7 @@ dev_err(dev, "Cannot parse i2c-parent\n"); return ERR_PTR(-ENODEV); } - parent = of_find_i2c_adapter_by_node(parent_np); + parent = of_get_i2c_adapter_by_node(parent_np); of_node_put(parent_np); if (!parent) return ERR_PTR(-EPROBE_DEFER); diff -u linux-lowlatency-5.15.0/drivers/i3c/master.c linux-lowlatency-5.15.0/drivers/i3c/master.c --- linux-lowlatency-5.15.0/drivers/i3c/master.c +++ linux-lowlatency-5.15.0/drivers/i3c/master.c @@ -1506,9 +1506,11 @@ desc->dev->dev.of_node = desc->boardinfo->of_node; ret = device_register(&desc->dev->dev); - if (ret) + if (ret) { dev_err(&master->dev, "Failed to add I3C device (err = %d)\n", ret); + put_device(&desc->dev->dev); + } } } diff -u linux-lowlatency-5.15.0/drivers/i3c/master/mipi-i3c-hci/dat_v1.c linux-lowlatency-5.15.0/drivers/i3c/master/mipi-i3c-hci/dat_v1.c --- linux-lowlatency-5.15.0/drivers/i3c/master/mipi-i3c-hci/dat_v1.c +++ linux-lowlatency-5.15.0/drivers/i3c/master/mipi-i3c-hci/dat_v1.c @@ -64,15 +64,17 @@ return -EOPNOTSUPP; } - /* use a bitmap for faster free slot search */ - hci->DAT_data = bitmap_zalloc(hci->DAT_entries, GFP_KERNEL); - if (!hci->DAT_data) - return -ENOMEM; + if (!hci->DAT_data) { + /* use a bitmap for faster free slot search */ + hci->DAT_data = bitmap_zalloc(hci->DAT_entries, GFP_KERNEL); + if (!hci->DAT_data) + return -ENOMEM; - /* clear them */ - for (dat_idx = 0; dat_idx < hci->DAT_entries; dat_idx++) { - dat_w0_write(dat_idx, 0); - dat_w1_write(dat_idx, 0); + /* clear them */ + for (dat_idx = 0; dat_idx < hci->DAT_entries; dat_idx++) { + dat_w0_write(dat_idx, 0); + dat_w1_write(dat_idx, 0); + } } return 0; @@ -87,7 +89,13 @@ static int hci_dat_v1_alloc_entry(struct i3c_hci *hci) { unsigned int dat_idx; + int ret; + if (!hci->DAT_data) { + ret = hci_dat_v1_init(hci); + if (ret) + return ret; + } dat_idx = find_first_zero_bit(hci->DAT_data, hci->DAT_entries); if (dat_idx >= hci->DAT_entries) return -ENOENT; @@ -103,7 +111,8 @@ { dat_w0_write(dat_idx, 0); dat_w1_write(dat_idx, 0); - __clear_bit(dat_idx, hci->DAT_data); + if (hci->DAT_data) + __clear_bit(dat_idx, hci->DAT_data); } static void hci_dat_v1_set_dynamic_addr(struct i3c_hci *hci, diff -u linux-lowlatency-5.15.0/drivers/i3c/master/svc-i3c-master.c linux-lowlatency-5.15.0/drivers/i3c/master/svc-i3c-master.c --- linux-lowlatency-5.15.0/drivers/i3c/master/svc-i3c-master.c +++ linux-lowlatency-5.15.0/drivers/i3c/master/svc-i3c-master.c @@ -165,6 +165,7 @@ * @ibi.slots: Available IBI slots * @ibi.tbq_slot: To be queued IBI slot * @ibi.lock: IBI lock + * @lock: Transfer lock, protect between IBI work thread and callbacks from master */ struct svc_i3c_master { struct i3c_master_controller base; @@ -192,6 +193,7 @@ /* Prevent races within IBI handlers */ spinlock_t lock; } ibi; + struct mutex lock; }; /** @@ -292,6 +294,7 @@ struct i3c_ibi_slot *slot; unsigned int count; u32 mdatactrl; + int ret, val; u8 *buf; slot = i3c_generic_ibi_get_free_slot(data->ibi_pool); @@ -301,6 +304,13 @@ slot->len = 0; buf = slot->data; + ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, + SVC_I3C_MSTATUS_COMPLETE(val), 0, 1000); + if (ret) { + dev_err(master->dev, "Timeout when polling for COMPLETE\n"); + return ret; + } + while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS)) && slot->len < SVC_I3C_FIFO_SIZE) { mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL); @@ -345,6 +355,7 @@ u32 status, val; int ret; + mutex_lock(&master->lock); /* Acknowledge the incoming interrupt with the AUTOIBI mechanism */ writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | SVC_I3C_MCTRL_IBIRESP_AUTO, @@ -355,6 +366,7 @@ SVC_I3C_MSTATUS_IBIWON(val), 0, 1000); if (ret) { dev_err(master->dev, "Timeout when polling for IBIWON\n"); + svc_i3c_master_emit_stop(master); goto reenable_ibis; } @@ -421,12 +433,13 @@ reenable_ibis: svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); + mutex_unlock(&master->lock); } static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id) { struct svc_i3c_master *master = (struct svc_i3c_master *)dev_id; - u32 active = readl(master->regs + SVC_I3C_MINTMASKED); + u32 active = readl(master->regs + SVC_I3C_MSTATUS); if (!SVC_I3C_MSTATUS_SLVSTART(active)) return IRQ_NONE; @@ -926,6 +939,9 @@ u32 reg; int ret; + /* clean SVC_I3C_MINT_IBIWON w1c bits */ + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + writel(SVC_I3C_MCTRL_REQUEST_START_ADDR | xfer_type | SVC_I3C_MCTRL_IBIRESP_NACK | @@ -939,6 +955,23 @@ if (ret) goto emit_stop; + /* + * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a Frame + * with I3C Target Address. + * + * The I3C Controller normally should start a Frame, the Address may be arbitrated, and so + * the Controller shall monitor to see whether an In-Band Interrupt request, a Controller + * Role Request (i.e., Secondary Controller requests to become the Active Controller), or + * a Hot-Join Request has been made. + * + * If missed IBIWON check, the wrong data will be return. When IBIWON happen, return failure + * and yield the above events handler. + */ + if (SVC_I3C_MSTATUS_IBIWON(reg)) { + ret = -ENXIO; + goto emit_stop; + } + if (rnw) ret = svc_i3c_master_read(master, in, xfer_len); else @@ -1095,9 +1128,11 @@ cmd->read_len = 0; cmd->continued = false; + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; kfree(buf); @@ -1141,9 +1176,11 @@ cmd->read_len = read_len; cmd->continued = false; + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1197,9 +1234,11 @@ cmd->continued = (i + 1) < nxfers; } + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1235,9 +1274,11 @@ cmd->continued = (i + 1 < nxfers); } + mutex_lock(&master->lock); svc_i3c_master_enqueue_xfer(master, xfer); if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + mutex_unlock(&master->lock); ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1407,6 +1448,8 @@ INIT_WORK(&master->hj_work, svc_i3c_master_hj_work); INIT_WORK(&master->ibi_work, svc_i3c_master_ibi_work); + mutex_init(&master->lock); + ret = devm_request_irq(dev, master->irq, svc_i3c_master_irq_handler, IRQF_NO_SUSPEND, "svc-i3c-irq", master); if (ret) diff -u linux-lowlatency-5.15.0/drivers/iio/accel/bmc150-accel-core.c linux-lowlatency-5.15.0/drivers/iio/accel/bmc150-accel-core.c --- linux-lowlatency-5.15.0/drivers/iio/accel/bmc150-accel-core.c +++ linux-lowlatency-5.15.0/drivers/iio/accel/bmc150-accel-core.c @@ -1525,7 +1525,7 @@ struct bmc150_accel_data *data = iio_priv(indio_dev); int ret = 0; - if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) + if (iio_device_get_current_mode(indio_dev) == INDIO_BUFFER_TRIGGERED) return 0; mutex_lock(&data->mutex); @@ -1557,7 +1557,7 @@ { struct bmc150_accel_data *data = iio_priv(indio_dev); - if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) + if (iio_device_get_current_mode(indio_dev) == INDIO_BUFFER_TRIGGERED) return 0; mutex_lock(&data->mutex); diff -u linux-lowlatency-5.15.0/drivers/iio/adc/ad7192.c linux-lowlatency-5.15.0/drivers/iio/adc/ad7192.c --- linux-lowlatency-5.15.0/drivers/iio/adc/ad7192.c +++ linux-lowlatency-5.15.0/drivers/iio/adc/ad7192.c @@ -177,6 +177,7 @@ const struct ad7192_chip_info *chip_info; struct regulator *avdd; struct regulator *dvdd; + struct regulator *vref; struct clk *mclk; u16 int_vref_mv; u32 fclk; @@ -962,10 +963,30 @@ if (ret) return ret; - ret = regulator_get_voltage(st->avdd); - if (ret < 0) { - dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); - return ret; + st->vref = devm_regulator_get_optional(&spi->dev, "vref"); + if (IS_ERR(st->vref)) { + if (PTR_ERR(st->vref) != -ENODEV) + return PTR_ERR(st->vref); + + ret = regulator_get_voltage(st->avdd); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "Device tree error, AVdd voltage undefined\n"); + } else { + ret = regulator_enable(st->vref); + if (ret) { + dev_err(&spi->dev, "Failed to enable specified Vref supply\n"); + return ret; + } + + ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref); + if (ret) + return ret; + + ret = regulator_get_voltage(st->vref); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "Device tree error, Vref voltage undefined\n"); } st->int_vref_mv = ret / 1000; diff -u linux-lowlatency-5.15.0/drivers/iio/adc/at91-sama5d2_adc.c linux-lowlatency-5.15.0/drivers/iio/adc/at91-sama5d2_adc.c --- linux-lowlatency-5.15.0/drivers/iio/adc/at91-sama5d2_adc.c +++ linux-lowlatency-5.15.0/drivers/iio/adc/at91-sama5d2_adc.c @@ -894,7 +894,7 @@ return at91_adc_configure_touch(st, true); /* if we are not in triggered mode, we cannot enable the buffer. */ - if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) + if (!(iio_device_get_current_mode(indio_dev) & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; /* we continue with the triggered buffer */ @@ -947,7 +947,7 @@ return at91_adc_configure_touch(st, false); /* if we are not in triggered mode, nothing to do here */ - if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) + if (!(iio_device_get_current_mode(indio_dev) & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; /* diff -u linux-lowlatency-5.15.0/drivers/iio/afe/iio-rescale.c linux-lowlatency-5.15.0/drivers/iio/afe/iio-rescale.c --- linux-lowlatency-5.15.0/drivers/iio/afe/iio-rescale.c +++ linux-lowlatency-5.15.0/drivers/iio/afe/iio-rescale.c @@ -3,43 +3,91 @@ * IIO rescale driver * * Copyright (C) 2018 Axentia Technologies AB + * Copyright (C) 2022 Liam Beguin * * Author: Peter Rosin */ #include #include -#include -#include #include #include #include #include #include -struct rescale; +#include +#include +#include -struct rescale_cfg { - enum iio_chan_type type; - int (*props)(struct device *dev, struct rescale *rescale); -}; - -struct rescale { - const struct rescale_cfg *cfg; - struct iio_channel *source; - struct iio_chan_spec chan; - struct iio_chan_spec_ext_info *ext_info; - bool chan_processed; - s32 numerator; - s32 denominator; -}; +int rescale_process_scale(struct rescale *rescale, int scale_type, + int *val, int *val2) +{ + s64 tmp; + + switch (scale_type) { + case IIO_VAL_FRACTIONAL: + *val *= rescale->numerator; + *val2 *= rescale->denominator; + return scale_type; + case IIO_VAL_INT: + *val *= rescale->numerator; + if (rescale->denominator == 1) + return scale_type; + *val2 = rescale->denominator; + return IIO_VAL_FRACTIONAL; + case IIO_VAL_FRACTIONAL_LOG2: + tmp = (s64)*val * 1000000000LL; + tmp = div_s64(tmp, rescale->denominator); + tmp *= rescale->numerator; + tmp = div_s64(tmp, 1000000000LL); + *val = tmp; + return scale_type; + default: + return -EOPNOTSUPP; + } +} + +int rescale_process_offset(struct rescale *rescale, int scale_type, + int scale, int scale2, int schan_off, + int *val, int *val2) +{ + s64 tmp, tmp2; + + switch (scale_type) { + case IIO_VAL_FRACTIONAL: + tmp = (s64)rescale->offset * scale2; + *val = div_s64(tmp, scale) + schan_off; + return IIO_VAL_INT; + case IIO_VAL_INT: + *val = div_s64(rescale->offset, scale) + schan_off; + return IIO_VAL_INT; + case IIO_VAL_FRACTIONAL_LOG2: + tmp = (s64)rescale->offset * (1 << scale2); + *val = div_s64(tmp, scale) + schan_off; + return IIO_VAL_INT; + case IIO_VAL_INT_PLUS_NANO: + tmp = (s64)rescale->offset * 1000000000LL; + tmp2 = ((s64)scale * 1000000000LL) + scale2; + *val = div64_s64(tmp, tmp2) + schan_off; + return IIO_VAL_INT; + case IIO_VAL_INT_PLUS_MICRO: + tmp = (s64)rescale->offset * 1000000LL; + tmp2 = ((s64)scale * 1000000LL) + scale2; + *val = div64_s64(tmp, tmp2) + schan_off; + return IIO_VAL_INT; + default: + return -EOPNOTSUPP; + } +} static int rescale_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { struct rescale *rescale = iio_priv(indio_dev); - s64 tmp; + int scale, scale2; + int schan_off = 0; int ret; switch (mask) { @@ -65,27 +113,58 @@ } else { ret = iio_read_channel_scale(rescale->source, val, val2); } - switch (ret) { - case IIO_VAL_FRACTIONAL: - *val *= rescale->numerator; - *val2 *= rescale->denominator; - return ret; - case IIO_VAL_INT: - *val *= rescale->numerator; - if (rescale->denominator == 1) - return ret; - *val2 = rescale->denominator; - return IIO_VAL_FRACTIONAL; - case IIO_VAL_FRACTIONAL_LOG2: - tmp = (s64)*val * 1000000000LL; - tmp = div_s64(tmp, rescale->denominator); - tmp *= rescale->numerator; - tmp = div_s64(tmp, 1000000000LL); - *val = tmp; - return ret; - default: - return -EOPNOTSUPP; + return rescale_process_scale(rescale, ret, val, val2); + case IIO_CHAN_INFO_OFFSET: + /* + * Processed channels are scaled 1-to-1 and source offset is + * already taken into account. + * + * In other cases, real world measurement are expressed as: + * + * schan_scale * (raw + schan_offset) + * + * Given that the rescaler parameters are applied recursively: + * + * rescaler_scale * (schan_scale * (raw + schan_offset) + + * rescaler_offset) + * + * Or, + * + * (rescaler_scale * schan_scale) * (raw + + * (schan_offset + rescaler_offset / schan_scale) + * + * Thus, reusing the original expression the parameters exposed + * to userspace are: + * + * scale = schan_scale * rescaler_scale + * offset = schan_offset + rescaler_offset / schan_scale + */ + if (rescale->chan_processed) { + *val = rescale->offset; + return IIO_VAL_INT; + } + + if (iio_channel_has_info(rescale->source->channel, + IIO_CHAN_INFO_OFFSET)) { + ret = iio_read_channel_offset(rescale->source, + &schan_off, NULL); + if (ret != IIO_VAL_INT) + return ret < 0 ? ret : -EOPNOTSUPP; + } + + if (iio_channel_has_info(rescale->source->channel, + IIO_CHAN_INFO_SCALE)) { + ret = iio_read_channel_scale(rescale->source, &scale, &scale2); + return rescale_process_offset(rescale, ret, scale, scale2, + schan_off, val, val2); } + + /* + * If we get here we have no scale so scale 1:1 but apply + * rescaler and offset, if any. + */ + return rescale_process_offset(rescale, IIO_VAL_FRACTIONAL, 1, 1, + schan_off, val, val2); default: return -EINVAL; } @@ -149,8 +228,9 @@ chan->type = rescale->cfg->type; if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) && - iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE)) { - dev_info(dev, "using raw+scale source channel\n"); + (iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE) || + iio_channel_has_info(schan, IIO_CHAN_INFO_OFFSET))) { + dev_info(dev, "using raw+scale/offset source channel\n"); } else if (iio_channel_has_info(schan, IIO_CHAN_INFO_PROCESSED)) { dev_info(dev, "using processed channel\n"); rescale->chan_processed = true; @@ -162,6 +242,9 @@ chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE); + if (rescale->offset) + chan->info_mask_separate |= BIT(IIO_CHAN_INFO_OFFSET); + /* * Using .read_avail() is fringe to begin with and makes no sense * whatsoever for processed channels, so we make sure that this cannot @@ -326,6 +409,7 @@ rescale->cfg = of_device_get_match_data(dev); rescale->numerator = 1; rescale->denominator = 1; + rescale->offset = 0; ret = rescale->cfg->props(dev, rescale); if (ret) diff -u linux-lowlatency-5.15.0/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c linux-lowlatency-5.15.0/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c --- linux-lowlatency-5.15.0/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ linux-lowlatency-5.15.0/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -196,8 +196,11 @@ /* * Ignore samples if the buffer is not set: it is needed if the ODR is * set but the buffer is not enabled yet. + * + * Note: iio_device_claim_buffer_mode() returns -EBUSY if the buffer + * is not enabled. */ - if (!iio_buffer_enabled(indio_dev)) + if (iio_device_claim_buffer_mode(indio_dev) < 0) return 0; out = (s16 *)st->samples; @@ -216,6 +219,7 @@ iio_push_to_buffers_with_timestamp(indio_dev, st->samples, timestamp + delta); + iio_device_release_buffer_mode(indio_dev); return 0; } EXPORT_SYMBOL_GPL(cros_ec_sensors_push_data); diff -u linux-lowlatency-5.15.0/drivers/iio/industrialio-core.c linux-lowlatency-5.15.0/drivers/iio/industrialio-core.c --- linux-lowlatency-5.15.0/drivers/iio/industrialio-core.c +++ linux-lowlatency-5.15.0/drivers/iio/industrialio-core.c @@ -185,6 +185,18 @@ EXPORT_SYMBOL_GPL(iio_device_id); /** + * iio_buffer_enabled() - helper function to test if the buffer is enabled + * @indio_dev: IIO device structure for device + */ +bool iio_buffer_enabled(struct iio_dev *indio_dev) +{ + return indio_dev->currentmode + & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | + INDIO_BUFFER_SOFTWARE); +} +EXPORT_SYMBOL_GPL(iio_buffer_enabled); + +/** * iio_sysfs_match_string_with_gaps - matches given string in an array with gaps * @array: array of strings * @n: number of strings in the array @@ -2072,6 +2084,55 @@ } EXPORT_SYMBOL_GPL(iio_device_release_direct_mode); +/** + * iio_device_claim_buffer_mode - Keep device in buffer mode + * @indio_dev: the iio_dev associated with the device + * + * If the device is in buffer mode it is guaranteed to stay + * that way until iio_device_release_buffer_mode() is called. + * + * Use with iio_device_release_buffer_mode(). + * + * Returns: 0 on success, -EBUSY on failure. + */ +int iio_device_claim_buffer_mode(struct iio_dev *indio_dev) +{ + mutex_lock(&indio_dev->mlock); + + if (iio_buffer_enabled(indio_dev)) + return 0; + + mutex_unlock(&indio_dev->mlock); + return -EBUSY; +} +EXPORT_SYMBOL_GPL(iio_device_claim_buffer_mode); + +/** + * iio_device_release_buffer_mode - releases claim on buffer mode + * @indio_dev: the iio_dev associated with the device + * + * Release the claim. Device is no longer guaranteed to stay + * in buffer mode. + * + * Use with iio_device_claim_buffer_mode(). + */ +void iio_device_release_buffer_mode(struct iio_dev *indio_dev) +{ + mutex_unlock(&indio_dev->mlock); +} +EXPORT_SYMBOL_GPL(iio_device_release_buffer_mode); + +/** + * iio_device_get_current_mode() - helper function providing read-only access to + * the @currentmode variable + * @indio_dev: IIO device structure for device + */ +int iio_device_get_current_mode(struct iio_dev *indio_dev) +{ + return indio_dev->currentmode; +} +EXPORT_SYMBOL_GPL(iio_device_get_current_mode); + subsys_initcall(iio_init); module_exit(iio_exit); diff -u linux-lowlatency-5.15.0/drivers/infiniband/core/device.c linux-lowlatency-5.15.0/drivers/infiniband/core/device.c --- linux-lowlatency-5.15.0/drivers/infiniband/core/device.c +++ linux-lowlatency-5.15.0/drivers/infiniband/core/device.c @@ -803,7 +803,7 @@ * empty slots at the beginning. */ pdata_rcu = kzalloc(struct_size(pdata_rcu, pdata, - rdma_end_port(device) + 1), + size_add(rdma_end_port(device), 1)), GFP_KERNEL); if (!pdata_rcu) return -ENOMEM; diff -u linux-lowlatency-5.15.0/drivers/infiniband/core/sysfs.c linux-lowlatency-5.15.0/drivers/infiniband/core/sysfs.c --- linux-lowlatency-5.15.0/drivers/infiniband/core/sysfs.c +++ linux-lowlatency-5.15.0/drivers/infiniband/core/sysfs.c @@ -902,7 +902,7 @@ * Two extra attribue elements here, one for the lifespan entry and * one to NULL terminate the list for the sysfs core code */ - data = kzalloc(struct_size(data, attrs, stats->num_counters + 1), + data = kzalloc(struct_size(data, attrs, size_add(stats->num_counters, 1)), GFP_KERNEL); if (!data) goto err_free_stats; @@ -1001,7 +1001,7 @@ * Two extra attribue elements here, one for the lifespan entry and * one to NULL terminate the list for the sysfs core code */ - data = kzalloc(struct_size(data, attrs, stats->num_counters + 1), + data = kzalloc(struct_size(data, attrs, size_add(stats->num_counters, 1)), GFP_KERNEL); if (!data) goto err_free_stats; @@ -1125,7 +1125,7 @@ int ret; gid_attr_group = kzalloc(struct_size(gid_attr_group, attrs_list, - attr->gid_tbl_len * 2), + size_mul(attr->gid_tbl_len, 2)), GFP_KERNEL); if (!gid_attr_group) return -ENOMEM; @@ -1190,8 +1190,8 @@ int ret; p = kvzalloc(struct_size(p, attrs_list, - attr->gid_tbl_len + attr->pkey_tbl_len), - GFP_KERNEL); + size_add(attr->gid_tbl_len, attr->pkey_tbl_len)), + GFP_KERNEL); if (!p) return ERR_PTR(-ENOMEM); p->ibdev = device; diff -u linux-lowlatency-5.15.0/drivers/infiniband/core/umem.c linux-lowlatency-5.15.0/drivers/infiniband/core/umem.c --- linux-lowlatency-5.15.0/drivers/infiniband/core/umem.c +++ linux-lowlatency-5.15.0/drivers/infiniband/core/umem.c @@ -98,12 +98,6 @@ return page_size; } - /* rdma_for_each_block() has a bug if the page size is smaller than the - * page size used to build the umem. For now prevent smaller page sizes - * from being returned. - */ - pgsz_bitmap &= GENMASK(BITS_PER_LONG - 1, PAGE_SHIFT); - /* The best result is the smallest page size that results in the minimum * number of required pages. Compute the largest page size that could * work based on VA address bits that don't change. diff -u linux-lowlatency-5.15.0/drivers/infiniband/core/user_mad.c linux-lowlatency-5.15.0/drivers/infiniband/core/user_mad.c --- linux-lowlatency-5.15.0/drivers/infiniband/core/user_mad.c +++ linux-lowlatency-5.15.0/drivers/infiniband/core/user_mad.c @@ -1378,7 +1378,9 @@ s = rdma_start_port(device); e = rdma_end_port(device); - umad_dev = kzalloc(struct_size(umad_dev, ports, e - s + 1), GFP_KERNEL); + umad_dev = kzalloc(struct_size(umad_dev, ports, + size_add(size_sub(e, s), 1)), + GFP_KERNEL); if (!umad_dev) return -ENOMEM; diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/bnxt_re/main.c linux-lowlatency-5.15.0/drivers/infiniband/hw/bnxt_re/main.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/bnxt_re/main.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/bnxt_re/main.c @@ -70,7 +70,7 @@ BNXT_RE_DESC "\n"; MODULE_AUTHOR("Eddie Wai "); -MODULE_DESCRIPTION(BNXT_RE_DESC " Driver"); +MODULE_DESCRIPTION(BNXT_RE_DESC); MODULE_LICENSE("Dual BSD/GPL"); /* globals */ diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -244,7 +244,7 @@ struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); int mtu = ib_mtu_enum_to_int(qp->path_mtu); - if (len > qp->max_inline_data || len > mtu) { + if (mtu < 0 || len > qp->max_inline_data || len > mtu) { ibdev_err(&hr_dev->ib_dev, "invalid length of data, data len = %u, max inline len = %u, path mtu = %d.\n", len, qp->max_inline_data, mtu); @@ -4556,6 +4556,9 @@ { struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); + if (ibqp->qp_type == IB_QPT_UD) + hr_dev->caps.cong_type = CONG_TYPE_DCQCN; + /* different congestion types match different configurations */ switch (hr_dev->caps.cong_type) { case CONG_TYPE_DCQCN: @@ -4583,10 +4586,15 @@ cong_alg->wnd_mode_sel = WND_LIMIT; break; default: - ibdev_err(&hr_dev->ib_dev, - "error type(%u) for congestion selection.\n", - hr_dev->caps.cong_type); - return -EINVAL; + ibdev_warn(&hr_dev->ib_dev, + "invalid type(%u) for congestion selection.\n", + hr_dev->caps.cong_type); + hr_dev->caps.cong_type = CONG_TYPE_DCQCN; + cong_alg->alg_sel = CONG_DCQCN; + cong_alg->alg_sub_sel = UNSUPPORT_CONG_LEVEL; + cong_alg->dip_vld = DIP_INVALID; + cong_alg->wnd_mode_sel = WND_LIMIT; + break; } return 0; diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_qp.c linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_qp.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_qp.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -1049,7 +1049,7 @@ { struct hns_roce_ib_create_qp_resp resp = {}; struct ib_device *ibdev = &hr_dev->ib_dev; - struct hns_roce_ib_create_qp ucmd; + struct hns_roce_ib_create_qp ucmd = {}; int ret; mutex_init(&hr_qp->mutex); diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/hw.c linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/hw.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/hw.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/hw.c @@ -322,7 +322,11 @@ break; case IRDMA_AE_QP_SUSPEND_COMPLETE: if (iwqp->iwdev->vsi.tc_change_pending) { - atomic_dec(&iwqp->sc_qp.vsi->qp_suspend_reqs); + if (!atomic_dec_return(&qp->vsi->qp_suspend_reqs)) + wake_up(&iwqp->iwdev->suspend_wq); + } + if (iwqp->suspend_pending) { + iwqp->suspend_pending = false; wake_up(&iwqp->iwdev->suspend_wq); } break; @@ -1159,7 +1163,6 @@ int status; struct irdma_ceq_init_info info = {}; struct irdma_sc_dev *dev = &rf->sc_dev; - u64 scratch; u32 ceq_size; info.ceq_id = ceq_id; @@ -1180,14 +1183,13 @@ iwceq->sc_ceq.ceq_id = ceq_id; info.dev = dev; info.vsi = vsi; - scratch = (uintptr_t)&rf->cqp.sc_cqp; status = irdma_sc_ceq_init(&iwceq->sc_ceq, &info); if (!status) { if (dev->ceq_valid) status = irdma_cqp_ceq_cmd(&rf->sc_dev, &iwceq->sc_ceq, IRDMA_OP_CEQ_CREATE); else - status = irdma_sc_cceq_create(&iwceq->sc_ceq, scratch); + status = irdma_sc_cceq_create(&iwceq->sc_ceq, 0); } if (status) { diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.c linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.c @@ -48,7 +48,7 @@ /* Wait for all qp's to suspend */ wait_event_timeout(iwdev->suspend_wq, !atomic_read(&iwdev->vsi.qp_suspend_reqs), - IRDMA_EVENT_TIMEOUT); + msecs_to_jiffies(IRDMA_EVENT_TIMEOUT_MS)); irdma_ws_reset(&iwdev->vsi); } diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.h linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.h --- linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.h +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/main.h @@ -78,7 +78,7 @@ #define MAX_DPC_ITERATIONS 128 -#define IRDMA_EVENT_TIMEOUT 50000 +#define IRDMA_EVENT_TIMEOUT_MS 5000 #define IRDMA_VCHNL_EVENT_TIMEOUT 100000 #define IRDMA_RST_TIMEOUT_HZ 4 diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.c linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.c @@ -1080,6 +1080,21 @@ return 0; } +static int irdma_wait_for_suspend(struct irdma_qp *iwqp) +{ + if (!wait_event_timeout(iwqp->iwdev->suspend_wq, + !iwqp->suspend_pending, + msecs_to_jiffies(IRDMA_EVENT_TIMEOUT_MS))) { + iwqp->suspend_pending = false; + ibdev_warn(&iwqp->iwdev->ibdev, + "modify_qp timed out waiting for suspend. qp_id = %d, last_ae = 0x%x\n", + iwqp->ibqp.qp_num, iwqp->last_aeq); + return -EBUSY; + } + + return 0; +} + /** * irdma_modify_qp_roce - modify qp request * @ibqp: qp's pointer for modify @@ -1328,17 +1343,11 @@ info.next_iwarp_state = IRDMA_QP_STATE_SQD; issue_modify_qp = 1; + iwqp->suspend_pending = true; break; case IB_QPS_SQE: case IB_QPS_ERR: case IB_QPS_RESET: - if (iwqp->iwarp_state == IRDMA_QP_STATE_RTS) { - spin_unlock_irqrestore(&iwqp->lock, flags); - info.next_iwarp_state = IRDMA_QP_STATE_SQD; - irdma_hw_modify_qp(iwdev, iwqp, &info, true); - spin_lock_irqsave(&iwqp->lock, flags); - } - if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); if (udata) { @@ -1375,6 +1384,11 @@ ctx_info->rem_endpoint_idx = udp_info->arp_idx; if (irdma_hw_modify_qp(iwdev, iwqp, &info, true)) return -EINVAL; + if (info.next_iwarp_state == IRDMA_QP_STATE_SQD) { + ret = irdma_wait_for_suspend(iwqp); + if (ret) + return ret; + } spin_lock_irqsave(&iwqp->lock, flags); if (iwqp->iwarp_state == info.curr_iwarp_state) { iwqp->iwarp_state = info.next_iwarp_state; diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.h linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.h --- linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.h +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/irdma/verbs.h @@ -188,6 +188,7 @@ u8 flush_issued : 1; u8 sig_all : 1; u8 pau_mode : 1; + u8 suspend_pending : 1; u8 rsvd : 1; u8 iwarp_state; u16 term_sq_flush_code; diff -u linux-lowlatency-5.15.0/drivers/infiniband/hw/mlx5/qp.c linux-lowlatency-5.15.0/drivers/infiniband/hw/mlx5/qp.c --- linux-lowlatency-5.15.0/drivers/infiniband/hw/mlx5/qp.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/mlx5/qp.c @@ -3956,6 +3956,30 @@ return tx_affinity; } +static int __mlx5_ib_qp_set_raw_qp_counter(struct mlx5_ib_qp *qp, u32 set_id, + struct mlx5_core_dev *mdev) +{ + struct mlx5_ib_raw_packet_qp *raw_packet_qp = &qp->raw_packet_qp; + struct mlx5_ib_rq *rq = &raw_packet_qp->rq; + u32 in[MLX5_ST_SZ_DW(modify_rq_in)] = {}; + void *rqc; + + if (!qp->rq.wqe_cnt) + return 0; + + MLX5_SET(modify_rq_in, in, rq_state, rq->state); + MLX5_SET(modify_rq_in, in, uid, to_mpd(qp->ibqp.pd)->uid); + + rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx); + MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RDY); + + MLX5_SET64(modify_rq_in, in, modify_bitmask, + MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID); + MLX5_SET(rqc, rqc, counter_set_id, set_id); + + return mlx5_core_modify_rq(mdev, rq->base.mqp.qpn, in); +} + static int __mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter) { @@ -3971,6 +3995,9 @@ else set_id = mlx5_ib_get_counters_id(dev, mqp->port - 1); + if (mqp->type == IB_QPT_RAW_PACKET) + return __mlx5_ib_qp_set_raw_qp_counter(mqp, set_id, dev->mdev); + base = &mqp->trans_qp.base; MLX5_SET(rts2rts_qp_in, in, opcode, MLX5_CMD_OP_RTS2RTS_QP); MLX5_SET(rts2rts_qp_in, in, qpn, base->mqp.qpn); diff -u linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c --- linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -383,7 +383,7 @@ struct rtrs_clt_path *clt_path; int err; - if (WARN_ON(!req->in_use)) + if (!req->in_use) return; if (WARN_ON(!req->con)) return; @@ -1682,7 +1682,7 @@ clt_path->s.dev_ref++; max_send_wr = min_t(int, wr_limit, /* QD * (REQ + RSP + FR REGS or INVS) + drain */ - clt_path->queue_depth * 3 + 1); + clt_path->queue_depth * 4 + 1); max_recv_wr = min_t(int, wr_limit, clt_path->queue_depth * 3 + 1); max_send_sge = 2; @@ -2341,8 +2341,6 @@ if (err) goto destroy; - rtrs_start_hb(&clt_path->s); - return 0; destroy: @@ -2616,6 +2614,7 @@ goto out; } rtrs_clt_path_up(clt_path); + rtrs_start_hb(&clt_path->s); out: mutex_unlock(&clt_path->init_mutex); diff -u linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c --- linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ linux-lowlatency-5.15.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -72,8 +72,9 @@ { enum rtrs_srv_state old_state; bool changed = false; + unsigned long flags; - spin_lock_irq(&srv_path->state_lock); + spin_lock_irqsave(&srv_path->state_lock, flags); old_state = srv_path->state; switch (new_state) { case RTRS_SRV_CONNECTED: @@ -94,7 +95,7 @@ } if (changed) srv_path->state = new_state; - spin_unlock_irq(&srv_path->state_lock); + spin_unlock_irqrestore(&srv_path->state_lock, flags); return changed; } @@ -555,7 +556,10 @@ struct rtrs_srv_mr *srv_mr; srv_mr = &srv_path->mrs[i]; - rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); + + if (always_invalidate) + rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); + ib_dereg_mr(srv_mr->mr); ib_dma_unmap_sg(srv_path->s.dev->ib_dev, srv_mr->sgt.sgl, srv_mr->sgt.nents, DMA_BIDIRECTIONAL); @@ -721,20 +725,23 @@ WARN_ON(wc->opcode != IB_WC_SEND); } -static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path) +static int rtrs_srv_path_up(struct rtrs_srv_path *srv_path) { struct rtrs_srv *srv = srv_path->srv; struct rtrs_srv_ctx *ctx = srv->ctx; - int up; + int up, ret = 0; mutex_lock(&srv->paths_ev_mutex); up = ++srv->paths_up; if (up == 1) - ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL); + ret = ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL); mutex_unlock(&srv->paths_ev_mutex); /* Mark session as established */ - srv_path->established = true; + if (!ret) + srv_path->established = true; + + return ret; } static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path) @@ -863,7 +870,12 @@ goto iu_free; kobject_get(&srv_path->kobj); get_device(&srv_path->srv->dev); - rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED); + err = rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED); + if (!err) { + rtrs_err(s, "rtrs_srv_change_state(), err: %d\n", err); + goto iu_free; + } + rtrs_srv_start_hb(srv_path); /* @@ -872,7 +884,11 @@ * all connections are successfully established. Thus, simply notify * listener with a proper event if we are the first path. */ - rtrs_srv_path_up(srv_path); + err = rtrs_srv_path_up(srv_path); + if (err) { + rtrs_err(s, "rtrs_srv_path_up(), err: %d\n", err); + goto iu_free; + } ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, tx_iu->dma_addr, @@ -1525,7 +1541,6 @@ srv_path = container_of(work, typeof(*srv_path), close_work); - rtrs_srv_destroy_path_files(srv_path); rtrs_srv_stop_hb(srv_path); for (i = 0; i < srv_path->s.con_num; i++) { @@ -1545,6 +1560,8 @@ /* Wait for all completion */ wait_for_completion(&srv_path->complete_done); + rtrs_srv_destroy_path_files(srv_path); + /* Notify upper layer if we are the last path */ rtrs_srv_path_down(srv_path); diff -u linux-lowlatency-5.15.0/drivers/input/joystick/xpad.c linux-lowlatency-5.15.0/drivers/input/joystick/xpad.c --- linux-lowlatency-5.15.0/drivers/input/joystick/xpad.c +++ linux-lowlatency-5.15.0/drivers/input/joystick/xpad.c @@ -120,6 +120,7 @@ { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, { 0x044f, 0x0f10, "Thrustmaster Modena GT Wheel", 0, XTYPE_XBOX }, { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, + { 0x03f0, 0x0495, "HyperX Clutch Gladiate", 0, XTYPE_XBOXONE }, { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, @@ -434,6 +435,7 @@ XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */ XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */ XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ + XPAD_XBOXONE_VENDOR(0x03f0), /* HP HyperX Xbox One Controllers */ XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ @@ -449,6 +451,7 @@ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ + XPAD_XBOXONE_VENDOR(0x10f5), /* Turtle Beach Controllers */ XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ XPAD_XBOX360_VENDOR(0x11ff), /* PXN V900 */ XPAD_XBOX360_VENDOR(0x1209), /* Ardwiino Controllers */ diff -u linux-lowlatency-5.15.0/drivers/input/mouse/synaptics.c linux-lowlatency-5.15.0/drivers/input/mouse/synaptics.c --- linux-lowlatency-5.15.0/drivers/input/mouse/synaptics.c +++ linux-lowlatency-5.15.0/drivers/input/mouse/synaptics.c @@ -1752,6 +1752,7 @@ psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) && !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10); const struct rmi_device_platform_data pdata = { + .reset_delay_ms = 30, .sensor_pdata = { .sensor_type = rmi_sensor_touchpad, .axis_align.flip_y = true, diff -u linux-lowlatency-5.15.0/drivers/iommu/intel/dmar.c linux-lowlatency-5.15.0/drivers/iommu/intel/dmar.c --- linux-lowlatency-5.15.0/drivers/iommu/intel/dmar.c +++ linux-lowlatency-5.15.0/drivers/iommu/intel/dmar.c @@ -1518,6 +1518,15 @@ { struct qi_desc desc; + /* + * VT-d spec, section 4.3: + * + * Software is recommended to not submit any Device-TLB invalidation + * requests while address remapping hardware is disabled. + */ + if (!(iommu->gcmd & DMA_GCMD_TE)) + return; + if (mask) { addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1; desc.qw1 = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE; @@ -1583,6 +1592,15 @@ unsigned long mask = 1UL << (VTD_PAGE_SHIFT + size_order - 1); struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0}; + /* + * VT-d spec, section 4.3: + * + * Software is recommended to not submit any Device-TLB invalidation + * requests while address remapping hardware is disabled. + */ + if (!(iommu->gcmd & DMA_GCMD_TE)) + return; + desc.qw0 = QI_DEV_EIOTLB_PASID(pasid) | QI_DEV_EIOTLB_SID(sid) | QI_DEV_EIOTLB_QDEP(qdep) | QI_DEIOTLB_TYPE | QI_DEV_IOTLB_PFSID(pfsid); diff -u linux-lowlatency-5.15.0/drivers/iommu/intel/iommu.c linux-lowlatency-5.15.0/drivers/iommu/intel/iommu.c --- linux-lowlatency-5.15.0/drivers/iommu/intel/iommu.c +++ linux-lowlatency-5.15.0/drivers/iommu/intel/iommu.c @@ -4455,8 +4455,8 @@ */ static void domain_context_clear(struct device_domain_info *info) { - if (!info->iommu || !info->dev || !dev_is_pci(info->dev)) - return; + if (!dev_is_pci(info->dev)) + domain_context_clear_one(info, info->bus, info->devfn); pci_for_each_dma_alias(to_pci_dev(info->dev), &domain_context_clear_one_cb, info); @@ -5754,7 +5754,7 @@ ver = (dev->device >> 8) & 0xff; if (ver != 0x45 && ver != 0x46 && ver != 0x4c && ver != 0x4e && ver != 0x8a && ver != 0x98 && - ver != 0x9a && ver != 0xa7) + ver != 0x9a && ver != 0xa7 && ver != 0x7d) return; if (risky_device(dev)) diff -u linux-lowlatency-5.15.0/drivers/leds/leds-pwm.c linux-lowlatency-5.15.0/drivers/leds/leds-pwm.c --- linux-lowlatency-5.15.0/drivers/leds/leds-pwm.c +++ linux-lowlatency-5.15.0/drivers/leds/leds-pwm.c @@ -53,7 +53,7 @@ duty = led_dat->pwmstate.period - duty; led_dat->pwmstate.duty_cycle = duty; - led_dat->pwmstate.enabled = duty > 0; + led_dat->pwmstate.enabled = true; return pwm_apply_state(led_dat->pwm, &led_dat->pwmstate); } diff -u linux-lowlatency-5.15.0/drivers/mcb/mcb-core.c linux-lowlatency-5.15.0/drivers/mcb/mcb-core.c --- linux-lowlatency-5.15.0/drivers/mcb/mcb-core.c +++ linux-lowlatency-5.15.0/drivers/mcb/mcb-core.c @@ -246,6 +246,7 @@ return 0; out: + put_device(&dev->dev); return ret; } diff -u linux-lowlatency-5.15.0/drivers/mcb/mcb-parse.c linux-lowlatency-5.15.0/drivers/mcb/mcb-parse.c --- linux-lowlatency-5.15.0/drivers/mcb/mcb-parse.c +++ linux-lowlatency-5.15.0/drivers/mcb/mcb-parse.c @@ -106,7 +106,7 @@ return 0; err: - put_device(&mdev->dev); + mcb_free_dev(mdev); return ret; } @@ -128,7 +128,7 @@ } } -static int chameleon_get_bar(char __iomem **base, phys_addr_t mapbase, +static int chameleon_get_bar(void __iomem **base, phys_addr_t mapbase, struct chameleon_bar **cb) { struct chameleon_bar *c; @@ -177,12 +177,13 @@ { struct chameleon_fpga_header *header; struct chameleon_bar *cb; - char __iomem *p = base; + void __iomem *p = base; int num_cells = 0; uint32_t dtype; int bar_count; int ret; u32 hsize; + u32 table_size; hsize = sizeof(struct chameleon_fpga_header); @@ -237,12 +238,16 @@ num_cells++; } - if (num_cells == 0) - num_cells = -EINVAL; + if (num_cells == 0) { + ret = -EINVAL; + goto free_bar; + } + table_size = p - base; + pr_debug("%d cell(s) found. Chameleon table size: 0x%04x bytes\n", num_cells, table_size); kfree(cb); kfree(header); - return num_cells; + return table_size; free_bar: kfree(cb); diff -u linux-lowlatency-5.15.0/drivers/md/bcache/btree.c linux-lowlatency-5.15.0/drivers/md/bcache/btree.c --- linux-lowlatency-5.15.0/drivers/md/bcache/btree.c +++ linux-lowlatency-5.15.0/drivers/md/bcache/btree.c @@ -1342,7 +1342,7 @@ memset(new_nodes, 0, sizeof(new_nodes)); closure_init_stack(&cl); - while (nodes < GC_MERGE_NODES && !IS_ERR(r[nodes].b)) + while (nodes < GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b)) keys += r[nodes++].keys; blocks = btree_default_blocks(b->c) * 2 / 3; @@ -1489,7 +1489,7 @@ bch_keylist_free(&keylist); for (i = 0; i < nodes; i++) - if (!IS_ERR(new_nodes[i])) { + if (!IS_ERR_OR_NULL(new_nodes[i])) { btree_node_free(new_nodes[i]); rw_unlock(true, new_nodes[i]); } @@ -1506,6 +1506,8 @@ return 0; n = btree_node_alloc_replacement(replace, NULL); + if (IS_ERR(n)) + return 0; /* recheck reserve after allocating replacement node */ if (btree_check_reserve(b, NULL)) { diff -u linux-lowlatency-5.15.0/drivers/md/bcache/writeback.c linux-lowlatency-5.15.0/drivers/md/bcache/writeback.c --- linux-lowlatency-5.15.0/drivers/md/bcache/writeback.c +++ linux-lowlatency-5.15.0/drivers/md/bcache/writeback.c @@ -967,24 +967,35 @@ void bch_sectors_dirty_init(struct bcache_device *d) { int i; + struct btree *b = NULL; struct bkey *k = NULL; struct btree_iter iter; struct sectors_dirty_init op; struct cache_set *c = d->c; struct bch_dirty_init_state state; +retry_lock: + b = c->root; + rw_lock(0, b, b->level); + if (b != c->root) { + rw_unlock(0, b); + goto retry_lock; + } + /* Just count root keys if no leaf node */ - rw_lock(0, c->root, c->root->level); if (c->root->level == 0) { bch_btree_op_init(&op.op, -1); op.inode = d->id; op.count = 0; for_each_key_filter(&c->root->keys, - k, &iter, bch_ptr_invalid) + k, &iter, bch_ptr_invalid) { + if (KEY_INODE(k) != op.inode) + continue; sectors_dirty_init_fn(&op.op, c->root, k); + } - rw_unlock(0, c->root); + rw_unlock(0, b); return; } @@ -1004,23 +1015,24 @@ if (atomic_read(&state.enough)) break; + atomic_inc(&state.started); state.infos[i].state = &state; state.infos[i].thread = kthread_run(bch_dirty_init_thread, &state.infos[i], "bch_dirtcnt[%d]", i); if (IS_ERR(state.infos[i].thread)) { pr_err("fails to run thread bch_dirty_init[%d]\n", i); + atomic_dec(&state.started); for (--i; i >= 0; i--) kthread_stop(state.infos[i].thread); goto out; } - atomic_inc(&state.started); } out: /* Must wait for all threads to stop. */ wait_event(state.wait, atomic_read(&state.started) == 0); - rw_unlock(0, c->root); + rw_unlock(0, b); } void bch_cached_dev_writeback_init(struct cached_dev *dc) diff -u linux-lowlatency-5.15.0/drivers/md/dm-verity-target.c linux-lowlatency-5.15.0/drivers/md/dm-verity-target.c --- linux-lowlatency-5.15.0/drivers/md/dm-verity-target.c +++ linux-lowlatency-5.15.0/drivers/md/dm-verity-target.c @@ -583,7 +583,9 @@ struct dm_verity_io *io = bio->bi_private; if (bio->bi_status && - (!verity_fec_is_enabled(io->v) || verity_is_system_shutting_down())) { + (!verity_fec_is_enabled(io->v) || + verity_is_system_shutting_down() || + (bio->bi_opf & REQ_RAHEAD))) { verity_finish_io(io, bio->bi_status); return; } diff -u linux-lowlatency-5.15.0/drivers/md/md.c linux-lowlatency-5.15.0/drivers/md/md.c --- linux-lowlatency-5.15.0/drivers/md/md.c +++ linux-lowlatency-5.15.0/drivers/md/md.c @@ -92,6 +92,18 @@ struct md_rdev *this); static void mddev_detach(struct mddev *mddev); +enum md_ro_state { + MD_RDWR, + MD_RDONLY, + MD_AUTO_READ, + MD_MAX_STATE +}; + +static bool md_is_rdwr(struct mddev *mddev) +{ + return (mddev->ro == MD_RDWR); +} + /* * Default number of read corrections we'll attempt on an rdev * before ejecting it from the array. We divide the read error @@ -461,7 +473,7 @@ if (!bio) return BLK_QC_T_NONE; - if (mddev->ro == 1 && unlikely(rw == WRITE)) { + if (mddev->ro == MD_RDONLY && unlikely(rw == WRITE)) { if (bio_sectors(bio) != 0) bio->bi_status = BLK_STS_IOERR; bio_endio(bio); @@ -2680,7 +2692,7 @@ int any_badblocks_changed = 0; int ret = -1; - if (mddev->ro) { + if (!md_is_rdwr(mddev)) { if (force_change) set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags); return; @@ -3953,7 +3965,7 @@ goto out_unlock; } rv = -EROFS; - if (mddev->ro) + if (!md_is_rdwr(mddev)) goto out_unlock; /* request to change the personality. Need to ensure: @@ -4159,7 +4171,7 @@ if (mddev->pers) { if (mddev->pers->check_reshape == NULL) err = -EBUSY; - else if (mddev->ro) + else if (!md_is_rdwr(mddev)) err = -EROFS; else { mddev->new_layout = n; @@ -4268,7 +4280,7 @@ if (mddev->pers) { if (mddev->pers->check_reshape == NULL) err = -EBUSY; - else if (mddev->ro) + else if (!md_is_rdwr(mddev)) err = -EROFS; else { mddev->new_chunk_sectors = n >> 9; @@ -4391,13 +4403,13 @@ if (mddev->pers && !test_bit(MD_NOT_READY, &mddev->flags)) { switch(mddev->ro) { - case 1: + case MD_RDONLY: st = readonly; break; - case 2: + case MD_AUTO_READ: st = read_auto; break; - case 0: + case MD_RDWR: spin_lock(&mddev->lock); if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) st = write_pending; @@ -4433,7 +4445,8 @@ int err = 0; enum array_state st = match_word(buf, array_states); - if (mddev->pers && (st == active || st == clean) && mddev->ro != 1) { + if (mddev->pers && (st == active || st == clean) && + mddev->ro != MD_RDONLY) { /* don't take reconfig_mutex when toggling between * clean and active */ @@ -4477,23 +4490,23 @@ if (mddev->pers) err = md_set_readonly(mddev, NULL); else { - mddev->ro = 1; + mddev->ro = MD_RDONLY; set_disk_ro(mddev->gendisk, 1); err = do_md_run(mddev); } break; case read_auto: if (mddev->pers) { - if (mddev->ro == 0) + if (md_is_rdwr(mddev)) err = md_set_readonly(mddev, NULL); - else if (mddev->ro == 1) + else if (mddev->ro == MD_RDONLY) err = restart_array(mddev); if (err == 0) { - mddev->ro = 2; + mddev->ro = MD_AUTO_READ; set_disk_ro(mddev->gendisk, 0); } } else { - mddev->ro = 2; + mddev->ro = MD_AUTO_READ; err = do_md_run(mddev); } break; @@ -4518,7 +4531,7 @@ wake_up(&mddev->sb_wait); err = 0; } else { - mddev->ro = 0; + mddev->ro = MD_RDWR; set_disk_ro(mddev->gendisk, 0); err = do_md_run(mddev); } @@ -4819,7 +4832,7 @@ if (test_bit(MD_RECOVERY_FROZEN, &recovery)) type = "frozen"; else if (test_bit(MD_RECOVERY_RUNNING, &recovery) || - (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &recovery))) { + (md_is_rdwr(mddev) && test_bit(MD_RECOVERY_NEEDED, &recovery))) { if (test_bit(MD_RECOVERY_RESHAPE, &recovery)) type = "reshape"; else if (test_bit(MD_RECOVERY_SYNC, &recovery)) { @@ -4892,11 +4905,11 @@ set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); set_bit(MD_RECOVERY_SYNC, &mddev->recovery); } - if (mddev->ro == 2) { + if (mddev->ro == MD_AUTO_READ) { /* A write to sync_action is enough to justify * canceling read-auto mode */ - mddev->ro = 0; + mddev->ro = MD_RDWR; md_wakeup_thread(mddev->sync_thread); } set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); @@ -5124,8 +5137,7 @@ goto out_unlock; err = -EBUSY; - if (max < mddev->resync_max && - mddev->ro == 0 && + if (max < mddev->resync_max && md_is_rdwr(mddev) && test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) goto out_unlock; @@ -5841,8 +5853,8 @@ continue; sync_blockdev(rdev->bdev); invalidate_bdev(rdev->bdev); - if (mddev->ro != 1 && rdev_read_only(rdev)) { - mddev->ro = 1; + if (mddev->ro != MD_RDONLY && rdev_read_only(rdev)) { + mddev->ro = MD_RDONLY; if (mddev->gendisk) set_disk_ro(mddev->gendisk, 1); } @@ -5945,8 +5957,8 @@ mddev->ok_start_degraded = start_dirty_degraded; - if (start_readonly && mddev->ro == 0) - mddev->ro = 2; /* read-only, but switch on first write */ + if (start_readonly && md_is_rdwr(mddev)) + mddev->ro = MD_AUTO_READ; /* read-only, but switch on first write */ err = pers->run(mddev); if (err) @@ -6021,8 +6033,8 @@ mddev->sysfs_action = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_action"); mddev->sysfs_completed = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_completed"); mddev->sysfs_degraded = sysfs_get_dirent_safe(mddev->kobj.sd, "degraded"); - } else if (mddev->ro == 2) /* auto-readonly not meaningful */ - mddev->ro = 0; + } else if (mddev->ro == MD_AUTO_READ) + mddev->ro = MD_RDWR; atomic_set(&mddev->max_corr_read_errors, MD_DEFAULT_MAX_CORRECTED_READ_ERRORS); @@ -6040,7 +6052,7 @@ if (rdev->raid_disk >= 0) sysfs_link_rdev(mddev, rdev); /* failure here is OK */ - if (mddev->degraded && !mddev->ro) + if (mddev->degraded && md_is_rdwr(mddev)) /* This ensures that recovering status is reported immediately * via sysfs - until a lack of spares is confirmed. */ @@ -6130,7 +6142,7 @@ return -ENXIO; if (!mddev->pers) return -EINVAL; - if (!mddev->ro) + if (md_is_rdwr(mddev)) return -EBUSY; rcu_read_lock(); @@ -6149,7 +6161,7 @@ return -EROFS; mddev->safemode = 0; - mddev->ro = 0; + mddev->ro = MD_RDWR; set_disk_ro(disk, 0); pr_debug("md: %s switched to read-write mode.\n", mdname(mddev)); /* Kick recovery or resync if necessary */ @@ -6176,7 +6188,7 @@ mddev->clevel[0] = 0; mddev->flags = 0; mddev->sb_flags = 0; - mddev->ro = 0; + mddev->ro = MD_RDWR; mddev->metadata_type[0] = 0; mddev->chunk_sectors = 0; mddev->ctime = mddev->utime = 0; @@ -6227,7 +6239,7 @@ } md_bitmap_flush(mddev); - if (mddev->ro == 0 && + if (md_is_rdwr(mddev) && ((!mddev->in_sync && !mddev_is_clustered(mddev)) || mddev->sb_flags)) { /* mark array as shutdown cleanly */ @@ -6299,6 +6311,9 @@ int err = 0; int did_freeze = 0; + if (mddev->external && test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) + return -EBUSY; + if (!test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) { did_freeze = 1; set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); @@ -6311,8 +6326,6 @@ * which will now never happen */ wake_up_process(mddev->sync_thread->tsk); - if (mddev->external && test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) - return -EBUSY; mddev_unlock(mddev); wait_event(resync_wait, !test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)); @@ -6325,29 +6338,30 @@ mddev->sync_thread || test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) { pr_warn("md: %s still in use.\n",mdname(mddev)); - if (did_freeze) { - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); - set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); - md_wakeup_thread(mddev->thread); - } err = -EBUSY; goto out; } + if (mddev->pers) { __md_stop_writes(mddev); - err = -ENXIO; - if (mddev->ro==1) + if (mddev->ro == MD_RDONLY) { + err = -ENXIO; goto out; - mddev->ro = 1; + } + + mddev->ro = MD_RDONLY; set_disk_ro(mddev->gendisk, 1); + } + +out: + if ((mddev->pers && !err) || did_freeze) { clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); sysfs_notify_dirent_safe(mddev->sysfs_state); - err = 0; } -out: + mutex_unlock(&mddev->open_mutex); return err; } @@ -6396,7 +6410,7 @@ return -EBUSY; } if (mddev->pers) { - if (mddev->ro) + if (!md_is_rdwr(mddev)) set_disk_ro(disk, 0); __md_stop_writes(mddev); @@ -6413,8 +6427,8 @@ mutex_unlock(&mddev->open_mutex); mddev->changed = 1; - if (mddev->ro) - mddev->ro = 0; + if (!md_is_rdwr(mddev)) + mddev->ro = MD_RDWR; } else mutex_unlock(&mddev->open_mutex); /* @@ -7226,7 +7240,7 @@ if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || mddev->sync_thread) return -EBUSY; - if (mddev->ro) + if (!md_is_rdwr(mddev)) return -EROFS; rdev_for_each(rdev, mddev) { @@ -7256,7 +7270,7 @@ /* change the number of raid disks */ if (mddev->pers->check_reshape == NULL) return -EINVAL; - if (mddev->ro) + if (!md_is_rdwr(mddev)) return -EROFS; if (raid_disks <= 0 || (mddev->max_disks && raid_disks >= mddev->max_disks)) @@ -7680,26 +7694,25 @@ * The remaining ioctls are changing the state of the * superblock, so we do not allow them on read-only arrays. */ - if (mddev->ro && mddev->pers) { - if (mddev->ro == 2) { - mddev->ro = 0; - sysfs_notify_dirent_safe(mddev->sysfs_state); - set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); - /* mddev_unlock will wake thread */ - /* If a device failed while we were read-only, we - * need to make sure the metadata is updated now. - */ - if (test_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags)) { - mddev_unlock(mddev); - wait_event(mddev->sb_wait, - !test_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags) && - !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)); - mddev_lock_nointr(mddev); - } - } else { + if (!md_is_rdwr(mddev) && mddev->pers) { + if (mddev->ro != MD_AUTO_READ) { err = -EROFS; goto unlock; } + mddev->ro = MD_RDWR; + sysfs_notify_dirent_safe(mddev->sysfs_state); + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + /* mddev_unlock will wake thread */ + /* If a device failed while we were read-only, we + * need to make sure the metadata is updated now. + */ + if (test_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags)) { + mddev_unlock(mddev); + wait_event(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags) && + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)); + mddev_lock_nointr(mddev); + } } switch (cmd) { @@ -7785,11 +7798,11 @@ * Transitioning to read-auto need only happen for arrays that call * md_write_start and which are not ready for writes yet. */ - if (!ro && mddev->ro == 1 && mddev->pers) { + if (!ro && mddev->ro == MD_RDONLY && mddev->pers) { err = restart_array(mddev); if (err) goto out_unlock; - mddev->ro = 2; + mddev->ro = MD_AUTO_READ; } out_unlock: @@ -8247,9 +8260,9 @@ seq_printf(seq, "%s : %sactive", mdname(mddev), mddev->pers ? "" : "in"); if (mddev->pers) { - if (mddev->ro==1) + if (mddev->ro == MD_RDONLY) seq_printf(seq, " (read-only)"); - if (mddev->ro==2) + if (mddev->ro == MD_AUTO_READ) seq_printf(seq, " (auto-read-only)"); seq_printf(seq, " %s", mddev->pers->name); } @@ -8509,10 +8522,10 @@ if (bio_data_dir(bi) != WRITE) return true; - BUG_ON(mddev->ro == 1); - if (mddev->ro == 2) { + BUG_ON(mddev->ro == MD_RDONLY); + if (mddev->ro == MD_AUTO_READ) { /* need to switch to read/write */ - mddev->ro = 0; + mddev->ro = MD_RDWR; set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->sync_thread); @@ -8563,7 +8576,7 @@ { if (bio_data_dir(bi) != WRITE) return; - WARN_ON_ONCE(mddev->in_sync || mddev->ro); + WARN_ON_ONCE(mddev->in_sync || !md_is_rdwr(mddev)); percpu_ref_get(&mddev->writes_pending); } EXPORT_SYMBOL(md_write_inc); @@ -8627,7 +8640,8 @@ struct md_io_acct *md_io_acct = bio->bi_private; struct bio *orig_bio = md_io_acct->orig_bio; - orig_bio->bi_status = bio->bi_status; + if (bio->bi_status && !orig_bio->bi_status) + orig_bio->bi_status = bio->bi_status; bio_end_io_acct(orig_bio, md_io_acct->start_time); bio_put(bio); @@ -8667,7 +8681,7 @@ { if (!mddev->pers) return; - if (mddev->ro) + if (!md_is_rdwr(mddev)) return; if (!mddev->pers->sync_request) return; @@ -8716,7 +8730,7 @@ if (test_bit(MD_RECOVERY_DONE, &mddev->recovery) || test_bit(MD_RECOVERY_WAIT, &mddev->recovery)) return; - if (mddev->ro) {/* never try to sync a read-only array */ + if (!md_is_rdwr(mddev)) {/* never try to sync a read-only array */ set_bit(MD_RECOVERY_INTR, &mddev->recovery); return; } @@ -9184,9 +9198,9 @@ if (test_bit(Faulty, &rdev->flags)) continue; if (!test_bit(Journal, &rdev->flags)) { - if (mddev->ro && - ! (rdev->saved_raid_disk >= 0 && - !test_bit(Bitmap_sync, &rdev->flags))) + if (!md_is_rdwr(mddev) && + !(rdev->saved_raid_disk >= 0 && + !test_bit(Bitmap_sync, &rdev->flags))) continue; rdev->recovery_offset = 0; @@ -9284,7 +9298,8 @@ flush_signals(current); } - if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) + if (!md_is_rdwr(mddev) && + !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) return; if ( ! ( (mddev->sb_flags & ~ (1<external && mddev->safemode == 1) mddev->safemode = 0; - if (mddev->ro) { + if (!md_is_rdwr(mddev)) { struct md_rdev *rdev; if (!mddev->external && mddev->in_sync) /* 'Blocked' flag not needed as failed devices diff -u linux-lowlatency-5.15.0/drivers/media/i2c/ccs/ccs-core.c linux-lowlatency-5.15.0/drivers/media/i2c/ccs/ccs-core.c --- linux-lowlatency-5.15.0/drivers/media/i2c/ccs/ccs-core.c +++ linux-lowlatency-5.15.0/drivers/media/i2c/ccs/ccs-core.c @@ -3089,7 +3089,7 @@ try_fmt->code = sensor->internal_csi_format->code; try_fmt->field = V4L2_FIELD_NONE; - if (ssd != sensor->pixel_array) + if (ssd == sensor->pixel_array) continue; try_comp = v4l2_subdev_get_try_compose(sd, fh->state, i); diff -u linux-lowlatency-5.15.0/drivers/media/i2c/max9286.c linux-lowlatency-5.15.0/drivers/media/i2c/max9286.c --- linux-lowlatency-5.15.0/drivers/media/i2c/max9286.c +++ linux-lowlatency-5.15.0/drivers/media/i2c/max9286.c @@ -1231,7 +1231,6 @@ i2c_mux_mask |= BIT(id); } - of_node_put(node); of_node_put(i2c_mux); /* Parse the endpoints */ @@ -1295,7 +1294,6 @@ priv->source_mask |= BIT(ep.port); priv->nsources++; } - of_node_put(node); /* * Parse the initial value of the reverse channel amplitude from diff -u linux-lowlatency-5.15.0/drivers/media/pci/bt8xx/bttv-driver.c linux-lowlatency-5.15.0/drivers/media/pci/bt8xx/bttv-driver.c --- linux-lowlatency-5.15.0/drivers/media/pci/bt8xx/bttv-driver.c +++ linux-lowlatency-5.15.0/drivers/media/pci/bt8xx/bttv-driver.c @@ -4250,6 +4250,7 @@ /* free resources */ free_irq(btv->c.pci->irq,btv); + del_timer_sync(&btv->timeout); iounmap(btv->bt848_mmio); release_mem_region(pci_resource_start(btv->c.pci,0), pci_resource_len(btv->c.pci,0)); diff -u linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid-170.c linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid-170.c --- linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid-170.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -327,13 +327,14 @@ }, }; -static void csid_configure_stream(struct csid_device *csid, u8 enable) +static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) { struct csid_testgen_config *tg = &csid->testgen; u32 val; u32 phy_sel = 0; u8 lane_cnt = csid->phy.lane_cnt; - struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_SRC]; + /* Source pads matching RDI channels on hardware. Pad 1 -> RDI0, Pad 2 -> RDI1, etc. */ + struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + vc]; const struct csid_format *format = csid_get_fmt_entry(csid->formats, csid->nformats, input_format->code); @@ -344,13 +345,9 @@ phy_sel = csid->phy.csiphy_id; if (enable) { - u8 vc = 0; /* Virtual Channel 0 */ - u8 dt_id = vc * 4; + u8 dt_id = vc; if (tg->enabled) { - /* Config Test Generator */ - vc = 0xa; - /* configure one DT, infinite frames */ val = vc << TPG_VC_CFG0_VC_NUM; val |= INTELEAVING_MODE_ONE_SHOT << TPG_VC_CFG0_LINE_INTERLEAVING_MODE; @@ -363,14 +360,14 @@ writel_relaxed(0x12345678, csid->base + CSID_TPG_LFSR_SEED); - val = input_format->height & 0x1fff << TPG_DT_n_CFG_0_FRAME_HEIGHT; - val |= input_format->width & 0x1fff << TPG_DT_n_CFG_0_FRAME_WIDTH; + val = (input_format->height & 0x1fff) << TPG_DT_n_CFG_0_FRAME_HEIGHT; + val |= (input_format->width & 0x1fff) << TPG_DT_n_CFG_0_FRAME_WIDTH; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_0(0)); val = format->data_type << TPG_DT_n_CFG_1_DATA_TYPE; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_1(0)); - val = tg->mode << TPG_DT_n_CFG_2_PAYLOAD_MODE; + val = (tg->mode - 1) << TPG_DT_n_CFG_2_PAYLOAD_MODE; val |= 0xBE << TPG_DT_n_CFG_2_USER_SPECIFIED_PAYLOAD; val |= format->decode_format << TPG_DT_n_CFG_2_ENCODE_FORMAT; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_2(0)); @@ -388,42 +385,42 @@ val |= format->data_type << RDI_CFG0_DATA_TYPE; val |= vc << RDI_CFG0_VIRTUAL_CHANNEL; val |= dt_id << RDI_CFG0_DT_ID; - writel_relaxed(val, csid->base + CSID_RDI_CFG0(0)); + writel_relaxed(val, csid->base + CSID_RDI_CFG0(vc)); /* CSID_TIMESTAMP_STB_POST_IRQ */ val = 2 << RDI_CFG1_TIMESTAMP_STB_SEL; - writel_relaxed(val, csid->base + CSID_RDI_CFG1(0)); + writel_relaxed(val, csid->base + CSID_RDI_CFG1(vc)); val = 1; - writel_relaxed(val, csid->base + CSID_RDI_FRM_DROP_PERIOD(0)); + writel_relaxed(val, csid->base + CSID_RDI_FRM_DROP_PERIOD(vc)); val = 0; - writel_relaxed(0, csid->base + CSID_RDI_FRM_DROP_PATTERN(0)); + writel_relaxed(val, csid->base + CSID_RDI_FRM_DROP_PATTERN(vc)); val = 1; - writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PERIOD(0)); + writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PERIOD(vc)); val = 0; - writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PATTERN(0)); + writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PATTERN(vc)); val = 1; - writel_relaxed(val, csid->base + CSID_RDI_RPP_PIX_DROP_PERIOD(0)); + writel_relaxed(val, csid->base + CSID_RDI_RPP_PIX_DROP_PERIOD(vc)); val = 0; - writel_relaxed(val, csid->base + CSID_RDI_RPP_PIX_DROP_PATTERN(0)); + writel_relaxed(val, csid->base + CSID_RDI_RPP_PIX_DROP_PATTERN(vc)); val = 1; - writel_relaxed(val, csid->base + CSID_RDI_RPP_LINE_DROP_PERIOD(0)); + writel_relaxed(val, csid->base + CSID_RDI_RPP_LINE_DROP_PERIOD(vc)); val = 0; - writel_relaxed(val, csid->base + CSID_RDI_RPP_LINE_DROP_PATTERN(0)); + writel_relaxed(val, csid->base + CSID_RDI_RPP_LINE_DROP_PATTERN(vc)); val = 0; - writel_relaxed(val, csid->base + CSID_RDI_CTRL(0)); + writel_relaxed(val, csid->base + CSID_RDI_CTRL(vc)); - val = readl_relaxed(csid->base + CSID_RDI_CFG0(0)); + val = readl_relaxed(csid->base + CSID_RDI_CFG0(vc)); val |= 1 << RDI_CFG0_ENABLE; - writel_relaxed(val, csid->base + CSID_RDI_CFG0(0)); + writel_relaxed(val, csid->base + CSID_RDI_CFG0(vc)); } if (tg->enabled) { @@ -442,6 +439,8 @@ writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG0); val = 1 << CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN; + if (vc > 3) + val |= 1 << CSI2_RX_CFG1_VC_MODE; val |= 1 << CSI2_RX_CFG1_MISR_EN; writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); // csi2_vc_mode_shift_val ? @@ -449,7 +448,16 @@ val = HALT_CMD_RESUME_AT_FRAME_BOUNDARY << RDI_CTRL_HALT_CMD; else val = HALT_CMD_HALT_AT_FRAME_BOUNDARY << RDI_CTRL_HALT_CMD; - writel_relaxed(val, csid->base + CSID_RDI_CTRL(0)); + writel_relaxed(val, csid->base + CSID_RDI_CTRL(vc)); +} + +static void csid_configure_stream(struct csid_device *csid, u8 enable) +{ + u8 i; + /* Loop through all enabled VCs and configure stream for each */ + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++) + if (csid->phy.en_vc & BIT(i)) + __csid_configure_stream(csid, enable, i); } static int csid_configure_testgen_pattern(struct csid_device *csid, s32 val) @@ -495,6 +503,7 @@ struct csid_device *csid = dev; u32 val; u8 reset_done; + int i; val = readl_relaxed(csid->base + CSID_TOP_IRQ_STATUS); writel_relaxed(val, csid->base + CSID_TOP_IRQ_CLEAR); @@ -503,8 +512,12 @@ val = readl_relaxed(csid->base + CSID_CSI2_RX_IRQ_STATUS); writel_relaxed(val, csid->base + CSID_CSI2_RX_IRQ_CLEAR); - val = readl_relaxed(csid->base + CSID_CSI2_RDIN_IRQ_STATUS(0)); - writel_relaxed(val, csid->base + CSID_CSI2_RDIN_IRQ_CLEAR(0)); + /* Read and clear IRQ status for each enabled RDI channel */ + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++) + if (csid->phy.en_vc & BIT(i)) { + val = readl_relaxed(csid->base + CSID_CSI2_RDIN_IRQ_STATUS(i)); + writel_relaxed(val, csid->base + CSID_CSI2_RDIN_IRQ_CLEAR(i)); + } val = 1 << IRQ_CMD_CLEAR; writel_relaxed(val, csid->base + CSID_IRQ_CMD); diff -u linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-vfe-170.c linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-vfe-170.c --- linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -7,7 +7,6 @@ * Copyright (C) 2020-2021 Linaro Ltd. */ -#include #include #include #include @@ -498,35 +497,20 @@ return 0; } -static int vfe_disable_output(struct vfe_line *line) +static void vfe_disable_output(struct vfe_line *line) { struct vfe_device *vfe = to_vfe(line); struct vfe_output *output = &line->output; unsigned long flags; unsigned int i; - bool done; - int timeout = 0; - - do { - spin_lock_irqsave(&vfe->output_lock, flags); - done = !output->gen2.active_num; - spin_unlock_irqrestore(&vfe->output_lock, flags); - usleep_range(10000, 20000); - - if (timeout++ == 100) { - dev_err(vfe->camss->dev, "VFE idle timeout - resetting\n"); - vfe_reset(vfe); - output->gen2.active_num = 0; - return 0; - } - } while (!done); spin_lock_irqsave(&vfe->output_lock, flags); for (i = 0; i < output->wm_num; i++) vfe_wm_stop(vfe, output->wm_idx[i]); + output->gen2.active_num = 0; spin_unlock_irqrestore(&vfe->output_lock, flags); - return 0; + vfe_reset(vfe); } /* diff -u linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_venus.c linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_venus.c --- linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_venus.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_venus.c @@ -205,6 +205,11 @@ new_wr_idx = wr_idx + dwords; wr_ptr = (u32 *)(queue->qmem.kva + (wr_idx << 2)); + + if (wr_ptr < (u32 *)queue->qmem.kva || + wr_ptr > (u32 *)(queue->qmem.kva + queue->qmem.size - sizeof(*wr_ptr))) + return -EINVAL; + if (new_wr_idx < qsize) { memcpy(wr_ptr, packet, dwords << 2); } else { @@ -272,6 +277,11 @@ } rd_ptr = (u32 *)(queue->qmem.kva + (rd_idx << 2)); + + if (rd_ptr < (u32 *)queue->qmem.kva || + rd_ptr > (u32 *)(queue->qmem.kva + queue->qmem.size - sizeof(*rd_ptr))) + return -EINVAL; + dwords = *rd_ptr >> 2; if (!dwords) return -EINVAL; diff -u linux-lowlatency-5.15.0/drivers/media/rc/imon.c linux-lowlatency-5.15.0/drivers/media/rc/imon.c --- linux-lowlatency-5.15.0/drivers/media/rc/imon.c +++ linux-lowlatency-5.15.0/drivers/media/rc/imon.c @@ -2427,6 +2427,12 @@ goto fail; } + if (first_if->dev.driver != interface->dev.driver) { + dev_err(&interface->dev, "inconsistent driver matching\n"); + ret = -EINVAL; + goto fail; + } + if (ifnum == 0) { ictx = imon_init_intf0(interface, id); if (!ictx) { diff -u linux-lowlatency-5.15.0/drivers/media/usb/dvb-usb-v2/af9035.c linux-lowlatency-5.15.0/drivers/media/usb/dvb-usb-v2/af9035.c --- linux-lowlatency-5.15.0/drivers/media/usb/dvb-usb-v2/af9035.c +++ linux-lowlatency-5.15.0/drivers/media/usb/dvb-usb-v2/af9035.c @@ -323,8 +323,10 @@ ret = -EOPNOTSUPP; } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || (msg[0].addr == state->af9033_i2c_addr[1])) { - if (msg[0].len < 3 || msg[1].len < 1) - return -EOPNOTSUPP; + if (msg[0].len < 3 || msg[1].len < 1) { + ret = -EOPNOTSUPP; + goto unlock; + } /* demod access via firmware interface */ reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | msg[0].buf[2]; @@ -384,8 +386,10 @@ ret = -EOPNOTSUPP; } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || (msg[0].addr == state->af9033_i2c_addr[1])) { - if (msg[0].len < 3) - return -EOPNOTSUPP; + if (msg[0].len < 3) { + ret = -EOPNOTSUPP; + goto unlock; + } /* demod access via firmware interface */ reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | msg[0].buf[2]; @@ -460,6 +464,7 @@ ret = -EOPNOTSUPP; } +unlock: mutex_unlock(&d->i2c_mutex); if (ret < 0) diff -u linux-lowlatency-5.15.0/drivers/mfd/dln2.c linux-lowlatency-5.15.0/drivers/mfd/dln2.c --- linux-lowlatency-5.15.0/drivers/mfd/dln2.c +++ linux-lowlatency-5.15.0/drivers/mfd/dln2.c @@ -836,7 +836,6 @@ dln2_stop_rx_urbs(dln2); out_free: - usb_put_dev(dln2->usb_dev); dln2_free(dln2); return ret; diff -u linux-lowlatency-5.15.0/drivers/mfd/mfd-core.c linux-lowlatency-5.15.0/drivers/mfd/mfd-core.c --- linux-lowlatency-5.15.0/drivers/mfd/mfd-core.c +++ linux-lowlatency-5.15.0/drivers/mfd/mfd-core.c @@ -159,6 +159,7 @@ struct platform_device *pdev; struct device_node *np = NULL; struct mfd_of_node_entry *of_entry, *tmp; + bool disabled = false; int ret = -ENOMEM; int platform_id; int r; @@ -196,11 +197,10 @@ if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { - /* Ignore 'disabled' devices error free */ + /* Skip 'disabled' devices */ if (!of_device_is_available(np)) { - of_node_put(np); - ret = 0; - goto fail_alias; + disabled = true; + continue; } ret = mfd_match_of_node_to_dev(pdev, np, cell); @@ -210,10 +210,17 @@ if (ret) goto fail_alias; - break; + goto match; } } + if (disabled) { + /* Ignore 'disabled' devices error free */ + ret = 0; + goto fail_alias; + } + +match: if (!pdev->dev.of_node) pr_warn("%s: Failed to locate of_node [id: %d]\n", cell->name, platform_id); diff -u linux-lowlatency-5.15.0/drivers/misc/fastrpc.c linux-lowlatency-5.15.0/drivers/misc/fastrpc.c --- linux-lowlatency-5.15.0/drivers/misc/fastrpc.c +++ linux-lowlatency-5.15.0/drivers/misc/fastrpc.c @@ -995,11 +995,6 @@ if (err) goto bail; - /* Check the response from remote dsp */ - err = ctx->retval; - if (err) - goto bail; - if (ctx->nscalars) { /* make sure that all memory writes by DSP are seen by CPU */ dma_rmb(); @@ -1009,6 +1004,11 @@ goto bail; } + /* Check the response from remote dsp */ + err = ctx->retval; + if (err) + goto bail; + bail: if (err != -ERESTARTSYS && err != -ETIMEDOUT) { /* We are done with this compute context */ diff -u linux-lowlatency-5.15.0/drivers/misc/pci_endpoint_test.c linux-lowlatency-5.15.0/drivers/misc/pci_endpoint_test.c --- linux-lowlatency-5.15.0/drivers/misc/pci_endpoint_test.c +++ linux-lowlatency-5.15.0/drivers/misc/pci_endpoint_test.c @@ -71,6 +71,7 @@ #define PCI_DEVICE_ID_TI_AM654 0xb00c #define PCI_DEVICE_ID_TI_J7200 0xb00f #define PCI_DEVICE_ID_TI_AM64 0xb010 +#define PCI_DEVICE_ID_TI_J721S2 0xb013 #define PCI_DEVICE_ID_LS1088A 0x80c0 #define is_am654_pci_dev(pdev) \ @@ -80,6 +81,7 @@ #define PCI_DEVICE_ID_RENESAS_R8A774B1 0x002b #define PCI_DEVICE_ID_RENESAS_R8A774C0 0x002d #define PCI_DEVICE_ID_RENESAS_R8A774E1 0x0025 +#define PCI_DEVICE_ID_RENESAS_R8A779F0 0x0031 static DEFINE_IDA(pci_endpoint_test_ida); @@ -995,6 +997,9 @@ { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774B1),}, { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774C0),}, { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A774E1),}, + { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_R8A779F0), + .driver_data = (kernel_ulong_t)&default_data, + }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J721E), .driver_data = (kernel_ulong_t)&j721e_data, }, @@ -1004,6 +1009,9 @@ { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_AM64), .driver_data = (kernel_ulong_t)&j721e_data, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_J721S2), + .driver_data = (kernel_ulong_t)&j721e_data, + }, { } }; MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl); diff -u linux-lowlatency-5.15.0/drivers/mmc/core/block.c linux-lowlatency-5.15.0/drivers/mmc/core/block.c --- linux-lowlatency-5.15.0/drivers/mmc/core/block.c +++ linux-lowlatency-5.15.0/drivers/mmc/core/block.c @@ -1465,6 +1465,8 @@ blk_mq_requeue_request(req, true); else __blk_mq_end_request(req, BLK_STS_OK); + } else if (mq->in_recovery) { + blk_mq_requeue_request(req, true); } else { blk_mq_end_request(req, BLK_STS_OK); } diff -u linux-lowlatency-5.15.0/drivers/mmc/core/core.c linux-lowlatency-5.15.0/drivers/mmc/core/core.c --- linux-lowlatency-5.15.0/drivers/mmc/core/core.c +++ linux-lowlatency-5.15.0/drivers/mmc/core/core.c @@ -552,7 +552,9 @@ cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */ cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT; - mmc_wait_for_cmd(host, &cmd, 0); + mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); + + mmc_poll_for_busy(host->card, MMC_CQE_RECOVERY_TIMEOUT, true, MMC_BUSY_IO); memset(&cmd, 0, sizeof(cmd)); cmd.opcode = MMC_CMDQ_TASK_MGMT; @@ -560,10 +562,13 @@ cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */ cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT; - err = mmc_wait_for_cmd(host, &cmd, 0); + err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); host->cqe_ops->cqe_recovery_finish(host); + if (err) + err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); + mmc_retune_release(host); return err; diff -u linux-lowlatency-5.15.0/drivers/mmc/core/sdio.c linux-lowlatency-5.15.0/drivers/mmc/core/sdio.c --- linux-lowlatency-5.15.0/drivers/mmc/core/sdio.c +++ linux-lowlatency-5.15.0/drivers/mmc/core/sdio.c @@ -1073,8 +1073,14 @@ } err = mmc_sdio_reinit_card(host); } else if (mmc_card_wake_sdio_irq(host)) { - /* We may have switched to 1-bit mode during suspend */ + /* + * We may have switched to 1-bit mode during suspend, + * need to hold retuning, because tuning only supprt + * 4-bit mode or 8 bit mode. + */ + mmc_retune_hold_now(host); err = sdio_enable_4bit_bus(host->card); + mmc_retune_release(host); } if (err) diff -u linux-lowlatency-5.15.0/drivers/mmc/host/meson-gx-mmc.c linux-lowlatency-5.15.0/drivers/mmc/host/meson-gx-mmc.c --- linux-lowlatency-5.15.0/drivers/mmc/host/meson-gx-mmc.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/meson-gx-mmc.c @@ -811,7 +811,6 @@ cmd_cfg |= FIELD_PREP(CMD_CFG_CMD_INDEX_MASK, cmd->opcode); cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */ - cmd_cfg |= CMD_CFG_ERROR; /* stop in case of error */ meson_mmc_set_response_bits(cmd, &cmd_cfg); diff -u linux-lowlatency-5.15.0/drivers/mmc/host/mtk-sd.c linux-lowlatency-5.15.0/drivers/mmc/host/mtk-sd.c --- linux-lowlatency-5.15.0/drivers/mmc/host/mtk-sd.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/mtk-sd.c @@ -628,11 +628,11 @@ 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); + readl_poll_timeout_atomic(host->base + MSDC_CFG, val, !(val & MSDC_CFG_RST), 0, 0); sdr_set_bits(host->base + MSDC_FIFOCS, MSDC_FIFOCS_CLR); - readl_poll_timeout(host->base + MSDC_FIFOCS, val, - !(val & MSDC_FIFOCS_CLR), 0, 0); + readl_poll_timeout_atomic(host->base + MSDC_FIFOCS, val, + !(val & MSDC_FIFOCS_CLR), 0, 0); val = readl(host->base + MSDC_INT); writel(val, host->base + MSDC_INT); diff -u linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-pci-gli.c linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-pci-gli.c --- linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-pci-gli.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-pci-gli.c @@ -23,6 +23,12 @@ #define GLI_9750_WT_EN_ON 0x1 #define GLI_9750_WT_EN_OFF 0x0 +#define PCI_GLI_9750_PM_CTRL 0xFC +#define PCI_GLI_9750_PM_STATE GENMASK(1, 0) + +#define PCI_GLI_9750_CORRERR_MASK 0x214 +#define PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT BIT(12) + #define SDHCI_GLI_9750_CFG2 0x848 #define SDHCI_GLI_9750_CFG2_L1DLY GENMASK(28, 24) #define GLI_9750_CFG2_L1DLY_VALUE 0x1F @@ -421,8 +427,12 @@ static void gl9750_hw_setting(struct sdhci_host *host) { + struct sdhci_pci_slot *slot = sdhci_priv(host); + struct pci_dev *pdev; u32 value; + pdev = slot->chip->pdev; + gl9750_wt_on(host); value = sdhci_readl(host, SDHCI_GLI_9750_CFG2); @@ -432,6 +442,18 @@ GLI_9750_CFG2_L1DLY_VALUE); sdhci_writel(host, value, SDHCI_GLI_9750_CFG2); + /* toggle PM state to allow GL9750 to enter ASPM L1.2 */ + pci_read_config_dword(pdev, PCI_GLI_9750_PM_CTRL, &value); + value |= PCI_GLI_9750_PM_STATE; + pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value); + value &= ~PCI_GLI_9750_PM_STATE; + pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value); + + /* mask the replay timer timeout of AER */ + pci_read_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, &value); + value |= PCI_GLI_9750_CORRERR_MASK_REPLAY_TIMER_TIMEOUT; + pci_write_config_dword(pdev, PCI_GLI_9750_CORRERR_MASK, value); + gl9750_wt_off(host); } diff -u linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-sprd.c linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-sprd.c --- linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-sprd.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/sdhci-sprd.c @@ -392,12 +392,33 @@ mmc_request_done(host->mmc, mrq); } +static void sdhci_sprd_set_power(struct sdhci_host *host, unsigned char mode, + unsigned short vdd) +{ + struct mmc_host *mmc = host->mmc; + + switch (mode) { + case MMC_POWER_OFF: + mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, 0); + + mmc_regulator_disable_vqmmc(mmc); + break; + case MMC_POWER_ON: + mmc_regulator_enable_vqmmc(mmc); + break; + case MMC_POWER_UP: + mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, vdd); + break; + } +} + static struct sdhci_ops sdhci_sprd_ops = { .read_l = sdhci_sprd_readl, .write_l = sdhci_sprd_writel, .write_w = sdhci_sprd_writew, .write_b = sdhci_sprd_writeb, .set_clock = sdhci_sprd_set_clock, + .set_power = sdhci_sprd_set_power, .get_max_clock = sdhci_sprd_get_max_clock, .get_min_clock = sdhci_sprd_get_min_clock, .set_bus_width = sdhci_set_bus_width, @@ -663,6 +684,10 @@ host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_DDR50); + ret = mmc_regulator_get_supply(host->mmc); + if (ret) + goto pm_runtime_disable; + ret = sdhci_setup_host(host); if (ret) goto pm_runtime_disable; diff -u linux-lowlatency-5.15.0/drivers/mmc/host/sdhci_am654.c linux-lowlatency-5.15.0/drivers/mmc/host/sdhci_am654.c --- linux-lowlatency-5.15.0/drivers/mmc/host/sdhci_am654.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/sdhci_am654.c @@ -600,7 +600,7 @@ return 0; } - for (i = MMC_TIMING_MMC_HS; i <= MMC_TIMING_MMC_HS400; i++) { + for (i = MMC_TIMING_LEGACY; i <= MMC_TIMING_MMC_HS400; i++) { ret = device_property_read_u32(dev, td[i].otap_binding, &sdhci_am654->otap_del_sel[i]); diff -u linux-lowlatency-5.15.0/drivers/mmc/host/vub300.c linux-lowlatency-5.15.0/drivers/mmc/host/vub300.c --- linux-lowlatency-5.15.0/drivers/mmc/host/vub300.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/vub300.c @@ -2311,6 +2311,7 @@ vub300->read_only = (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0; } else { + retval = -EINVAL; goto error5; } usb_set_intfdata(interface, vub300); diff -u linux-lowlatency-5.15.0/drivers/mtd/nand/raw/arasan-nand-controller.c linux-lowlatency-5.15.0/drivers/mtd/nand/raw/arasan-nand-controller.c --- linux-lowlatency-5.15.0/drivers/mtd/nand/raw/arasan-nand-controller.c +++ linux-lowlatency-5.15.0/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -515,6 +515,7 @@ struct mtd_info *mtd = nand_to_mtd(chip); unsigned int len = mtd->writesize + (oob_required ? mtd->oobsize : 0); dma_addr_t dma_addr; + u8 status; int ret; struct anfc_op nfc_op = { .pkt_reg = @@ -561,10 +562,21 @@ } /* Spare data is not protected */ - if (oob_required) + if (oob_required) { ret = nand_write_oob_std(chip, page); + if (ret) + return ret; + } + + /* Check write status on the chip side */ + ret = nand_status_op(chip, &status); + if (ret) + return ret; + + if (status & NAND_STATUS_FAIL) + return -EIO; - return ret; + return 0; } static int anfc_sel_write_page_hw_ecc(struct nand_chip *chip, const u8 *buf, diff -u linux-lowlatency-5.15.0/drivers/mtd/nand/raw/marvell_nand.c linux-lowlatency-5.15.0/drivers/mtd/nand/raw/marvell_nand.c --- linux-lowlatency-5.15.0/drivers/mtd/nand/raw/marvell_nand.c +++ linux-lowlatency-5.15.0/drivers/mtd/nand/raw/marvell_nand.c @@ -1148,6 +1148,7 @@ .ndcb[2] = NDCB2_ADDR5_PAGE(page), }; unsigned int oob_bytes = lt->spare_bytes + (raw ? lt->ecc_bytes : 0); + u8 status; int ret; /* NFCv2 needs more information about the operation being executed */ @@ -1181,7 +1182,18 @@ ret = marvell_nfc_wait_op(chip, PSEC_TO_MSEC(sdr->tPROG_max)); - return ret; + if (ret) + return ret; + + /* Check write status on the chip side */ + ret = nand_status_op(chip, &status); + if (ret) + return ret; + + if (status & NAND_STATUS_FAIL) + return -EIO; + + return 0; } static int marvell_nfc_hw_ecc_hmg_write_page_raw(struct nand_chip *chip, @@ -1610,6 +1622,7 @@ int data_len = lt->data_bytes; int spare_len = lt->spare_bytes; int chunk, ret; + u8 status; marvell_nfc_select_target(chip, chip->cur_cs); @@ -1646,6 +1659,14 @@ if (ret) return ret; + /* Check write status on the chip side */ + ret = nand_status_op(chip, &status); + if (ret) + return ret; + + if (status & NAND_STATUS_FAIL) + return -EIO; + return 0; } diff -u linux-lowlatency-5.15.0/drivers/mtd/nand/raw/pl35x-nand-controller.c linux-lowlatency-5.15.0/drivers/mtd/nand/raw/pl35x-nand-controller.c --- linux-lowlatency-5.15.0/drivers/mtd/nand/raw/pl35x-nand-controller.c +++ linux-lowlatency-5.15.0/drivers/mtd/nand/raw/pl35x-nand-controller.c @@ -513,6 +513,7 @@ u32 addr1 = 0, addr2 = 0, row; u32 cmd_addr; int i, ret; + u8 status; ret = pl35x_smc_set_ecc_mode(nfc, chip, PL35X_SMC_ECC_CFG_MODE_APB); if (ret) @@ -565,6 +566,14 @@ if (ret) goto disable_ecc_engine; + /* Check write status on the chip side */ + ret = nand_status_op(chip, &status); + if (ret) + goto disable_ecc_engine; + + if (status & NAND_STATUS_FAIL) + ret = -EIO; + disable_ecc_engine: pl35x_smc_set_ecc_mode(nfc, chip, PL35X_SMC_ECC_CFG_MODE_BYPASS); diff -u linux-lowlatency-5.15.0/drivers/mtd/nand/raw/qcom_nandc.c linux-lowlatency-5.15.0/drivers/mtd/nand/raw/qcom_nandc.c --- linux-lowlatency-5.15.0/drivers/mtd/nand/raw/qcom_nandc.c +++ linux-lowlatency-5.15.0/drivers/mtd/nand/raw/qcom_nandc.c @@ -3093,7 +3093,7 @@ err_aon_clk: clk_disable_unprepare(nandc->core_clk); err_core_clk: - dma_unmap_resource(dev, res->start, resource_size(res), + dma_unmap_resource(dev, nandc->base_dma, resource_size(res), DMA_BIDIRECTIONAL, 0); return ret; } diff -u linux-lowlatency-5.15.0/drivers/net/arcnet/com20020-pci.c linux-lowlatency-5.15.0/drivers/net/arcnet/com20020-pci.c --- linux-lowlatency-5.15.0/drivers/net/arcnet/com20020-pci.c +++ linux-lowlatency-5.15.0/drivers/net/arcnet/com20020-pci.c @@ -213,12 +213,13 @@ if (!strncmp(ci->name, "EAE PLX-PCI FB2", 15)) lp->backplane = 1; - /* Get the dev_id from the PLX rotary coder */ - if (!strncmp(ci->name, "EAE PLX-PCI MA1", 15)) - dev_id_mask = 0x3; - dev->dev_id = (inb(priv->misc + ci->rotary) >> 4) & dev_id_mask; - - snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i); + if (ci->flags & ARC_HAS_ROTARY) { + /* Get the dev_id from the PLX rotary coder */ + if (!strncmp(ci->name, "EAE PLX-PCI MA1", 15)) + dev_id_mask = 0x3; + dev->dev_id = (inb(priv->misc + ci->rotary) >> 4) & dev_id_mask; + snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i); + } if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { pr_err("IO address %Xh is empty!\n", ioaddr); @@ -230,6 +231,10 @@ goto err_free_arcdev; } + ret = com20020_found(dev, IRQF_SHARED); + if (ret) + goto err_free_arcdev; + card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), GFP_KERNEL); if (!card) { @@ -239,41 +244,39 @@ card->index = i; card->pci_priv = priv; - card->tx_led.brightness_set = led_tx_set; - card->tx_led.default_trigger = devm_kasprintf(&pdev->dev, - GFP_KERNEL, "arc%d-%d-tx", - dev->dev_id, i); - card->tx_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, - "pci:green:tx:%d-%d", - dev->dev_id, i); - - card->tx_led.dev = &dev->dev; - card->recon_led.brightness_set = led_recon_set; - card->recon_led.default_trigger = devm_kasprintf(&pdev->dev, - GFP_KERNEL, "arc%d-%d-recon", - dev->dev_id, i); - card->recon_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, - "pci:red:recon:%d-%d", - dev->dev_id, i); - card->recon_led.dev = &dev->dev; - card->dev = dev; - ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); - if (ret) - goto err_free_arcdev; + if (ci->flags & ARC_HAS_LED) { + card->tx_led.brightness_set = led_tx_set; + card->tx_led.default_trigger = devm_kasprintf(&pdev->dev, + GFP_KERNEL, "arc%d-%d-tx", + dev->dev_id, i); + card->tx_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "pci:green:tx:%d-%d", + dev->dev_id, i); + + card->tx_led.dev = &dev->dev; + card->recon_led.brightness_set = led_recon_set; + card->recon_led.default_trigger = devm_kasprintf(&pdev->dev, + GFP_KERNEL, "arc%d-%d-recon", + dev->dev_id, i); + card->recon_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "pci:red:recon:%d-%d", + dev->dev_id, i); + card->recon_led.dev = &dev->dev; + + ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); + if (ret) + goto err_free_arcdev; + + ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); + if (ret) + goto err_free_arcdev; - ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); - if (ret) - goto err_free_arcdev; - - dev_set_drvdata(&dev->dev, card); - - ret = com20020_found(dev, IRQF_SHARED); - if (ret) - goto err_free_arcdev; - - devm_arcnet_led_init(dev, dev->dev_id, i); + dev_set_drvdata(&dev->dev, card); + devm_arcnet_led_init(dev, dev->dev_id, i); + } + card->dev = dev; list_add(&card->list, &priv->list_dev); continue; @@ -329,7 +332,7 @@ }; static struct com20020_pci_card_info card_info_sohard = { - .name = "PLX-PCI", + .name = "SOHARD SH ARC-PCI", .devcount = 1, /* SOHARD needs PCI base addr 4 */ .chan_map_tbl = { @@ -364,7 +367,7 @@ }, }, .rotary = 0x0, - .flags = ARC_CAN_10MBIT, + .flags = ARC_HAS_ROTARY | ARC_HAS_LED | ARC_CAN_10MBIT, }; static struct com20020_pci_card_info card_info_eae_ma1 = { @@ -396,7 +399,7 @@ }, }, .rotary = 0x0, - .flags = ARC_CAN_10MBIT, + .flags = ARC_HAS_ROTARY | ARC_HAS_LED | ARC_CAN_10MBIT, }; static struct com20020_pci_card_info card_info_eae_fb2 = { @@ -421,7 +424,7 @@ }, }, .rotary = 0x0, - .flags = ARC_CAN_10MBIT, + .flags = ARC_HAS_ROTARY | ARC_HAS_LED | ARC_CAN_10MBIT, }; static const struct pci_device_id com20020pci_id_table[] = { diff -u linux-lowlatency-5.15.0/drivers/net/bonding/bond_main.c linux-lowlatency-5.15.0/drivers/net/bonding/bond_main.c --- linux-lowlatency-5.15.0/drivers/net/bonding/bond_main.c +++ linux-lowlatency-5.15.0/drivers/net/bonding/bond_main.c @@ -1473,6 +1473,10 @@ static void bond_setup_by_slave(struct net_device *bond_dev, struct net_device *slave_dev) { + bool was_up = !!(bond_dev->flags & IFF_UP); + + dev_close(bond_dev); + bond_dev->header_ops = slave_dev->header_ops; bond_dev->type = slave_dev->type; @@ -1487,6 +1491,8 @@ bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); } + if (was_up) + dev_open(bond_dev, NULL); } /* On bonding slaves other than the currently active slave, suppress @@ -3722,7 +3728,7 @@ if (likely(n <= hlen)) return data; else if (skb && likely(pskb_may_pull(skb, n))) - return skb->head; + return skb->data; return NULL; } diff -u linux-lowlatency-5.15.0/drivers/net/dsa/bcm_sf2.c linux-lowlatency-5.15.0/drivers/net/dsa/bcm_sf2.c --- linux-lowlatency-5.15.0/drivers/net/dsa/bcm_sf2.c +++ linux-lowlatency-5.15.0/drivers/net/dsa/bcm_sf2.c @@ -577,17 +577,16 @@ dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio"); priv->master_mii_bus = of_mdio_find_bus(dn); if (!priv->master_mii_bus) { - of_node_put(dn); - return -EPROBE_DEFER; + err = -EPROBE_DEFER; + goto err_of_node_put; } - get_device(&priv->master_mii_bus->dev); priv->master_mii_dn = dn; priv->slave_mii_bus = mdiobus_alloc(); if (!priv->slave_mii_bus) { - of_node_put(dn); - return -ENOMEM; + err = -ENOMEM; + goto err_put_master_mii_bus_dev; } priv->slave_mii_bus->priv = priv; @@ -644,11 +643,17 @@ } err = mdiobus_register(priv->slave_mii_bus); - if (err && dn) { - mdiobus_free(priv->slave_mii_bus); - of_node_put(dn); - } + if (err && dn) + goto err_free_slave_mii_bus; + + return 0; +err_free_slave_mii_bus: + mdiobus_free(priv->slave_mii_bus); +err_put_master_mii_bus_dev: + put_device(&priv->master_mii_bus->dev); +err_of_node_put: + of_node_put(dn); return err; } @@ -656,6 +661,7 @@ { mdiobus_unregister(priv->slave_mii_bus); mdiobus_free(priv->slave_mii_bus); + put_device(&priv->master_mii_bus->dev); of_node_put(priv->master_mii_dn); } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-drv.c linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-drv.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -682,10 +682,24 @@ static void xgbe_service_timer(struct timer_list *t) { struct xgbe_prv_data *pdata = from_timer(pdata, t, service_timer); + struct xgbe_channel *channel; + unsigned int i; queue_work(pdata->dev_workqueue, &pdata->service_work); mod_timer(&pdata->service_timer, jiffies + HZ); + + if (!pdata->tx_usecs) + return; + + for (i = 0; i < pdata->channel_count; i++) { + channel = pdata->channel[i]; + if (!channel->tx_ring || channel->tx_timer_active) + break; + channel->tx_timer_active = 1; + mod_timer(&channel->tx_timer, + jiffies + usecs_to_jiffies(pdata->tx_usecs)); + } } static void xgbe_init_timers(struct xgbe_prv_data *pdata) diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -1178,7 +1178,19 @@ if (pdata->phy.duplex != DUPLEX_FULL) return -EINVAL; - xgbe_set_mode(pdata, mode); + /* Force the mode change for SFI in Fixed PHY config. + * Fixed PHY configs needs PLL to be enabled while doing mode set. + * When the SFP module isn't connected during boot, driver assumes + * AN is ON and attempts autonegotiation. However, if the connected + * SFP comes up in Fixed PHY config, the link will not come up as + * PLL isn't enabled while the initial mode set command is issued. + * So, force the mode change for SFI in Fixed PHY configuration to + * fix link issues. + */ + if (mode == XGBE_MODE_SFI) + xgbe_change_mode(pdata, mode); + else + xgbe_set_mode(pdata, mode); return 0; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/atheros/atl1c/atl1c_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/atheros/atl1c/atl1c_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -493,15 +493,10 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, struct net_device *dev) { - unsigned int head_size; int mtu = dev->mtu; adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; - - head_size = SKB_DATA_ALIGN(adapter->rx_buffer_len + NET_SKB_PAD + NET_IP_ALIGN) + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); - adapter->rx_frag_size = roundup_pow_of_two(head_size); } static netdev_features_t atl1c_fix_features(struct net_device *netdev, @@ -974,7 +969,6 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter) { struct pci_dev *pdev = adapter->pdev; - int i; dma_free_coherent(&pdev->dev, adapter->ring_header.size, adapter->ring_header.desc, adapter->ring_header.dma); @@ -987,12 +981,6 @@ kfree(adapter->tpd_ring[0].buffer_info); adapter->tpd_ring[0].buffer_info = NULL; } - for (i = 0; i < adapter->rx_queue_count; ++i) { - if (adapter->rrd_ring[i].rx_page) { - put_page(adapter->rrd_ring[i].rx_page); - adapter->rrd_ring[i].rx_page = NULL; - } - } } /** @@ -1764,48 +1752,11 @@ skb_checksum_none_assert(skb); } -static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter, - u32 queue, bool napi_mode) -{ - struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring[queue]; - struct sk_buff *skb; - struct page *page; - - if (adapter->rx_frag_size > PAGE_SIZE) { - if (likely(napi_mode)) - return napi_alloc_skb(&rrd_ring->napi, - adapter->rx_buffer_len); - else - return netdev_alloc_skb_ip_align(adapter->netdev, - adapter->rx_buffer_len); - } - - page = rrd_ring->rx_page; - if (!page) { - page = alloc_page(GFP_ATOMIC); - if (unlikely(!page)) - return NULL; - rrd_ring->rx_page = page; - rrd_ring->rx_page_offset = 0; - } - - skb = build_skb(page_address(page) + rrd_ring->rx_page_offset, - adapter->rx_frag_size); - if (likely(skb)) { - skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN); - rrd_ring->rx_page_offset += adapter->rx_frag_size; - if (rrd_ring->rx_page_offset >= PAGE_SIZE) - rrd_ring->rx_page = NULL; - else - get_page(page); - } - return skb; -} - static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter, u32 queue, bool napi_mode) { struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring[queue]; + struct atl1c_rrd_ring *rrd_ring = &adapter->rrd_ring[queue]; struct pci_dev *pdev = adapter->pdev; struct atl1c_buffer *buffer_info, *next_info; struct sk_buff *skb; @@ -1824,13 +1775,27 @@ while (next_info->flags & ATL1C_BUFFER_FREE) { rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); - skb = atl1c_alloc_skb(adapter, queue, napi_mode); + /* When DMA RX address is set to something like + * 0x....fc0, it will be very likely to cause DMA + * RFD overflow issue. + * + * To work around it, we apply rx skb with 64 bytes + * longer space, and offset the address whenever + * 0x....fc0 is detected. + */ + if (likely(napi_mode)) + skb = napi_alloc_skb(&rrd_ring->napi, adapter->rx_buffer_len + 64); + else + skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len + 64); if (unlikely(!skb)) { if (netif_msg_rx_err(adapter)) dev_warn(&pdev->dev, "alloc rx buffer failed\n"); break; } + if (((unsigned long)skb->data & 0xfff) == 0xfc0) + skb_reserve(skb, 64); + /* * Make buffer alignment 2 beyond a 16 byte boundary * this will result in a 16 byte aligned IP header after diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -2075,6 +2075,7 @@ rhashtable_destroy(&tc_info->flow_table); free_tc_info: kfree(tc_info); + bp->tc_info = NULL; return rc; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/tg3.c linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/tg3.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/tg3.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/tg3.c @@ -6854,7 +6854,7 @@ desc_idx, *post_ptr); drop_it_no_recycle: /* Other statistics kept track of by card. */ - tp->rx_dropped++; + tnapi->rx_dropped++; goto next_pkt; } @@ -7880,8 +7880,10 @@ segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6)); - if (IS_ERR(segs) || !segs) + if (IS_ERR(segs) || !segs) { + tnapi->tx_dropped++; goto tg3_tso_bug_end; + } skb_list_walk_safe(segs, seg, next) { skb_mark_not_on_list(seg); @@ -8152,7 +8154,7 @@ drop: dev_kfree_skb_any(skb); drop_nofree: - tp->tx_dropped++; + tnapi->tx_dropped++; return NETDEV_TX_OK; } @@ -9331,7 +9333,7 @@ /* tp->lock is held. */ static int tg3_halt(struct tg3 *tp, int kind, bool silent) { - int err; + int err, i; tg3_stop_fw(tp); @@ -9352,6 +9354,13 @@ /* And make sure the next sample is new data */ memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); + + for (i = 0; i < TG3_IRQ_MAX_VECS; ++i) { + struct tg3_napi *tnapi = &tp->napi[i]; + + tnapi->rx_dropped = 0; + tnapi->tx_dropped = 0; + } } return err; @@ -11906,6 +11915,9 @@ { struct rtnl_link_stats64 *old_stats = &tp->net_stats_prev; struct tg3_hw_stats *hw_stats = tp->hw_stats; + unsigned long rx_dropped; + unsigned long tx_dropped; + int i; stats->rx_packets = old_stats->rx_packets + get_stat64(&hw_stats->rx_ucast_packets) + @@ -11952,8 +11964,26 @@ stats->rx_missed_errors = old_stats->rx_missed_errors + get_stat64(&hw_stats->rx_discards); - stats->rx_dropped = tp->rx_dropped; - stats->tx_dropped = tp->tx_dropped; + /* Aggregate per-queue counters. The per-queue counters are updated + * by a single writer, race-free. The result computed by this loop + * might not be 100% accurate (counters can be updated in the middle of + * the loop) but the next tg3_get_nstats() will recompute the current + * value so it is acceptable. + * + * Note that these counters wrap around at 4G on 32bit machines. + */ + rx_dropped = (unsigned long)(old_stats->rx_dropped); + tx_dropped = (unsigned long)(old_stats->tx_dropped); + + for (i = 0; i < tp->irq_cnt; i++) { + struct tg3_napi *tnapi = &tp->napi[i]; + + rx_dropped += tnapi->rx_dropped; + tx_dropped += tnapi->tx_dropped; + } + + stats->rx_dropped = rx_dropped; + stats->tx_dropped = tx_dropped; } static int tg3_get_regs_len(struct net_device *dev) @@ -18088,7 +18118,8 @@ if (netif_running(dev)) dev_close(dev); - tg3_power_down(tp); + if (system_state == SYSTEM_POWER_OFF) + tg3_power_down(tp); rtnl_unlock(); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c @@ -3816,6 +3816,8 @@ FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_DOWNLOAD)); ret = t4_set_params_timeout(adap, adap->mbox, adap->pf, 0, 1, ¶m, &val, 30000); + if (ret) + return ret; /* If we have version number support, then check to see that the new * firmware got loaded properly. diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c @@ -2260,7 +2260,7 @@ if (tp->snd_una != snd_una) { tp->snd_una = snd_una; - tp->rcv_tstamp = tcp_time_stamp(tp); + tp->rcv_tstamp = tcp_jiffies32; if (tp->snd_una == tp->snd_nxt && !csk_flag_nochk(csk, CSK_TX_FAILOVER)) csk_reset_flag(csk, CSK_TX_WAIT_IDLE); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/cortina/gemini.c linux-lowlatency-5.15.0/drivers/net/ethernet/cortina/gemini.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/cortina/gemini.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/cortina/gemini.c @@ -432,8 +432,8 @@ .val = CONFIG0_MAXLEN_1536, }, { - .max_l3_len = 1542, - .val = CONFIG0_MAXLEN_1542, + .max_l3_len = 1548, + .val = CONFIG0_MAXLEN_1548, }, { .max_l3_len = 9212, @@ -1145,6 +1145,7 @@ dma_addr_t mapping; unsigned short mtu; void *buffer; + int ret; mtu = ETH_HLEN; mtu += netdev->mtu; @@ -1159,9 +1160,30 @@ word3 |= mtu; } - if (skb->ip_summed != CHECKSUM_NONE) { + if (skb->len >= ETH_FRAME_LEN) { + /* Hardware offloaded checksumming isn't working on frames + * bigger than 1514 bytes. A hypothesis about this is that the + * checksum buffer is only 1518 bytes, so when the frames get + * bigger they get truncated, or the last few bytes get + * overwritten by the FCS. + * + * Just use software checksumming and bypass on bigger frames. + */ + if (skb->ip_summed == CHECKSUM_PARTIAL) { + ret = skb_checksum_help(skb); + if (ret) + return ret; + } + word1 |= TSS_BYPASS_BIT; + } else if (skb->ip_summed == CHECKSUM_PARTIAL) { int tcp = 0; + /* We do not switch off the checksumming on non TCP/UDP + * frames: as is shown from tests, the checksumming engine + * is smart enough to see that a frame is not actually TCP + * or UDP and then just pass it through without any changes + * to the frame. + */ if (skb->protocol == htons(ETH_P_IP)) { word1 |= TSS_IP_CHKSUM_BIT; tcp = ip_hdr(skb)->protocol == IPPROTO_TCP; @@ -1978,15 +2000,6 @@ return 0; } -static netdev_features_t gmac_fix_features(struct net_device *netdev, - netdev_features_t features) -{ - if (netdev->mtu + ETH_HLEN + VLAN_HLEN > MTU_SIZE_BIT_MASK) - features &= ~GMAC_OFFLOAD_FEATURES; - - return features; -} - static int gmac_set_features(struct net_device *netdev, netdev_features_t features) { @@ -2208,7 +2221,6 @@ .ndo_set_mac_address = gmac_set_mac_address, .ndo_get_stats64 = gmac_get_stats64, .ndo_change_mtu = gmac_change_mtu, - .ndo_fix_features = gmac_fix_features, .ndo_set_features = gmac_set_features, }; @@ -2458,11 +2470,12 @@ netdev->hw_features = GMAC_OFFLOAD_FEATURES; netdev->features |= GMAC_OFFLOAD_FEATURES | NETIF_F_GRO; - /* We can handle jumbo frames up to 10236 bytes so, let's accept - * payloads of 10236 bytes minus VLAN and ethernet header + /* We can receive jumbo frames up to 10236 bytes but only + * transmit 2047 bytes so, let's accept payloads of 2047 + * bytes minus VLAN and ethernet header */ netdev->min_mtu = ETH_MIN_MTU; - netdev->max_mtu = 10236 - VLAN_ETH_HLEN; + netdev->max_mtu = MTU_SIZE_BIT_MASK - VLAN_ETH_HLEN; port->freeq_refill = 0; netif_napi_add(netdev, &port->napi, gmac_napi_poll, NAPI_POLL_WEIGHT); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c linux-lowlatency-5.15.0/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -952,14 +952,12 @@ dma_addr_t addr; buffer_start = skb->data - dpaa2_eth_needed_headroom(skb); - - /* If there's enough room to align the FD address, do it. - * It will help hardware optimize accesses. - */ aligned_start = PTR_ALIGN(buffer_start - DPAA2_ETH_TX_BUF_ALIGN, DPAA2_ETH_TX_BUF_ALIGN); if (aligned_start >= skb->head) buffer_start = aligned_start; + else + return -ENOMEM; /* Store a backpointer to the skb at the beginning of the buffer * (in the private data area) such that we can release it @@ -4446,6 +4444,8 @@ if (err) goto err_dl_port_add; + net_dev->needed_headroom = DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; + err = register_netdev(net_dev); if (err < 0) { dev_err(dev, "register_netdev() failed\n"); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_main.c @@ -139,7 +139,7 @@ rx_stats_num = (GVE_RX_STATS_REPORT_NUM + NIC_RX_STATS_REPORT_NUM) * priv->rx_cfg.num_queues; priv->stats_report_len = struct_size(priv->stats_report, stats, - tx_stats_num + rx_stats_num); + size_add(tx_stats_num, rx_stats_num)); priv->stats_report = dma_alloc_coherent(&priv->pdev->dev, priv->stats_report_len, &priv->stats_report_bus, GFP_KERNEL); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -157,7 +157,7 @@ int err; err = gve_alloc_page(priv, &priv->pdev->dev, &buf_state->page_info.page, - &buf_state->addr, DMA_FROM_DEVICE, GFP_KERNEL); + &buf_state->addr, DMA_FROM_DEVICE, GFP_ATOMIC); if (err) return err; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -4915,7 +4915,7 @@ struct hns3_nic_priv *priv = netdev_priv(netdev); char format_mac_addr[HNAE3_FORMAT_MAC_ADDR_LEN]; struct hnae3_handle *h = priv->ae_handle; - u8 mac_addr_temp[ETH_ALEN]; + u8 mac_addr_temp[ETH_ALEN] = {0}; int ret = 0; if (h->ae_algo->ops->get_mac_addr) diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -72,6 +72,7 @@ static void hclge_sync_fd_table(struct hclge_dev *hdev); static int hclge_mac_link_status_wait(struct hclge_dev *hdev, int link_ret, int wait_cnt); +static int hclge_update_port_info(struct hclge_dev *hdev); static struct hnae3_ae_algo ae_algo; @@ -2950,6 +2951,9 @@ if (state != hdev->hw.mac.link) { hdev->hw.mac.link = state; + if (state == HCLGE_LINK_STATUS_UP) + hclge_update_port_info(hdev); + client->ops->link_status_change(handle, state); hclge_config_mac_tnl_int(hdev, state); if (rclient && rclient->ops->link_status_change) @@ -10196,8 +10200,6 @@ struct hclge_vport_vlan_cfg *vlan, *tmp; struct hclge_dev *hdev = vport->back; - mutex_lock(&hdev->vport_lock); - list_for_each_entry_safe(vlan, tmp, &vport->vlan_list, node) { if (vlan->vlan_id == vlan_id) { if (is_write_tbl && vlan->hd_tbl_status) @@ -10212,8 +10214,6 @@ break; } } - - mutex_unlock(&hdev->vport_lock); } void hclge_rm_vport_all_vlan_table(struct hclge_vport *vport, bool is_del_list) @@ -10618,11 +10618,16 @@ * handle mailbox. Just record the vlan id, and remove it after * reset finished. */ + mutex_lock(&hdev->vport_lock); if ((test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) || test_bit(HCLGE_STATE_RST_FAIL, &hdev->state)) && is_kill) { set_bit(vlan_id, vport->vlan_del_fail_bmap); + mutex_unlock(&hdev->vport_lock); return -EBUSY; + } else if (!is_kill && test_bit(vlan_id, vport->vlan_del_fail_bmap)) { + clear_bit(vlan_id, vport->vlan_del_fail_bmap); } + mutex_unlock(&hdev->vport_lock); /* when port base vlan enabled, we use port base vlan as the vlan * filter entry. In this case, we don't update vlan filter table @@ -10637,17 +10642,22 @@ } if (!ret) { - if (!is_kill) + if (!is_kill) { hclge_add_vport_vlan_table(vport, vlan_id, writen_to_tbl); - else if (is_kill && vlan_id != 0) + } else if (is_kill && vlan_id != 0) { + mutex_lock(&hdev->vport_lock); hclge_rm_vport_vlan_table(vport, vlan_id, false); + mutex_unlock(&hdev->vport_lock); + } } else if (is_kill) { /* when remove hw vlan filter failed, record the vlan id, * and try to remove it from hw later, to be consistence * with stack */ + mutex_lock(&hdev->vport_lock); set_bit(vlan_id, vport->vlan_del_fail_bmap); + mutex_unlock(&hdev->vport_lock); } hclge_set_vport_vlan_fltr_change(vport); @@ -10687,6 +10697,7 @@ int i, ret, sync_cnt = 0; u16 vlan_id; + mutex_lock(&hdev->vport_lock); /* start from vport 1 for PF is always alive */ for (i = 0; i < hdev->num_alloc_vport; i++) { struct hclge_vport *vport = &hdev->vport[i]; @@ -10697,21 +10708,26 @@ ret = hclge_set_vlan_filter_hw(hdev, htons(ETH_P_8021Q), vport->vport_id, vlan_id, true); - if (ret && ret != -EINVAL) + if (ret && ret != -EINVAL) { + mutex_unlock(&hdev->vport_lock); return; + } clear_bit(vlan_id, vport->vlan_del_fail_bmap); hclge_rm_vport_vlan_table(vport, vlan_id, false); hclge_set_vport_vlan_fltr_change(vport); sync_cnt++; - if (sync_cnt >= HCLGE_MAX_SYNC_COUNT) + if (sync_cnt >= HCLGE_MAX_SYNC_COUNT) { + mutex_unlock(&hdev->vport_lock); return; + } vlan_id = find_first_bit(vport->vlan_del_fail_bmap, VLAN_N_VID); } } + mutex_unlock(&hdev->vport_lock); hclge_sync_vlan_fltr_state(hdev); } @@ -11701,6 +11717,7 @@ goto err_msi_irq_uninit; if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER) { + clear_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps); if (hnae3_dev_phy_imp_supported(hdev)) ret = hclge_update_tp_port_info(hdev); else diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -56,17 +56,19 @@ resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len; resp_pf_to_vf->match_id = vf_to_pf_req->match_id; - resp_pf_to_vf->msg.code = HCLGE_MBX_PF_VF_RESP; - resp_pf_to_vf->msg.vf_mbx_msg_code = vf_to_pf_req->msg.code; - resp_pf_to_vf->msg.vf_mbx_msg_subcode = vf_to_pf_req->msg.subcode; + resp_pf_to_vf->msg.code = cpu_to_le16(HCLGE_MBX_PF_VF_RESP); + resp_pf_to_vf->msg.vf_mbx_msg_code = + cpu_to_le16(vf_to_pf_req->msg.code); + resp_pf_to_vf->msg.vf_mbx_msg_subcode = + cpu_to_le16(vf_to_pf_req->msg.subcode); resp = hclge_errno_to_resp(resp_msg->status); if (resp < SHRT_MAX) { - resp_pf_to_vf->msg.resp_status = resp; + resp_pf_to_vf->msg.resp_status = cpu_to_le16(resp); } else { dev_warn(&hdev->pdev->dev, "failed to send response to VF, response status %u is out-of-bound\n", resp); - resp_pf_to_vf->msg.resp_status = EIO; + resp_pf_to_vf->msg.resp_status = cpu_to_le16(EIO); } if (resp_msg->len > 0) @@ -106,9 +108,9 @@ resp_pf_to_vf->dest_vfid = dest_vfid; resp_pf_to_vf->msg_len = msg_len; - resp_pf_to_vf->msg.code = mbx_opcode; + resp_pf_to_vf->msg.code = cpu_to_le16(mbx_opcode); - memcpy(&resp_pf_to_vf->msg.vf_mbx_msg_code, msg, msg_len); + memcpy(resp_pf_to_vf->msg.msg_data, msg, msg_len); trace_hclge_pf_mbx_send(hdev, resp_pf_to_vf); @@ -124,8 +126,8 @@ int hclge_inform_reset_assert_to_vf(struct hclge_vport *vport) { struct hclge_dev *hdev = vport->back; + __le16 msg_data; u16 reset_type; - u8 msg_data[2]; u8 dest_vfid; BUILD_BUG_ON(HNAE3_MAX_RESET > U16_MAX); @@ -139,10 +141,10 @@ else reset_type = HNAE3_VF_FUNC_RESET; - memcpy(&msg_data[0], &reset_type, sizeof(u16)); + msg_data = cpu_to_le16(reset_type); /* send this requested info to VF */ - return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data), + return hclge_send_mbx_msg(vport, (u8 *)&msg_data, sizeof(msg_data), HCLGE_MBX_ASSERTING_RESET, dest_vfid); } @@ -338,16 +340,14 @@ u16 state, struct hclge_vlan_info *vlan_info) { -#define MSG_DATA_SIZE 8 + struct hclge_mbx_port_base_vlan base_vlan; - u8 msg_data[MSG_DATA_SIZE]; + base_vlan.state = cpu_to_le16(state); + base_vlan.vlan_proto = cpu_to_le16(vlan_info->vlan_proto); + base_vlan.qos = cpu_to_le16(vlan_info->qos); + base_vlan.vlan_tag = cpu_to_le16(vlan_info->vlan_tag); - memcpy(&msg_data[0], &state, sizeof(u16)); - memcpy(&msg_data[2], &vlan_info->vlan_proto, sizeof(u16)); - memcpy(&msg_data[4], &vlan_info->qos, sizeof(u16)); - memcpy(&msg_data[6], &vlan_info->vlan_tag, sizeof(u16)); - - return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data), + return hclge_send_mbx_msg(vport, (u8 *)&base_vlan, sizeof(base_vlan), HCLGE_MBX_PUSH_VLAN_INFO, vfid); } @@ -487,10 +487,9 @@ #define HCLGE_VF_LINK_STATE_UP 1U #define HCLGE_VF_LINK_STATE_DOWN 0U + struct hclge_mbx_link_status link_info; struct hclge_dev *hdev = vport->back; u16 link_status; - u8 msg_data[9]; - u16 duplex; /* mac.link can only be 0 or 1 */ switch (vport->vf_info.link_state) { @@ -506,14 +505,13 @@ break; } - duplex = hdev->hw.mac.duplex; - memcpy(&msg_data[0], &link_status, sizeof(u16)); - memcpy(&msg_data[2], &hdev->hw.mac.speed, sizeof(u32)); - memcpy(&msg_data[6], &duplex, sizeof(u16)); - msg_data[8] = HCLGE_MBX_PUSH_LINK_STATUS_EN; + link_info.link_status = cpu_to_le16(link_status); + link_info.speed = cpu_to_le32(hdev->hw.mac.speed); + link_info.duplex = cpu_to_le16(hdev->hw.mac.duplex); + link_info.flag = HCLGE_MBX_PUSH_LINK_STATUS_EN; /* send this requested info to VF */ - return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data), + return hclge_send_mbx_msg(vport, (u8 *)&link_info, sizeof(link_info), HCLGE_MBX_LINK_STAT_CHANGE, vport->vport_id); } @@ -521,22 +519,22 @@ struct hclge_mbx_vf_to_pf_cmd *mbx_req) { #define HCLGE_SUPPORTED 1 + struct hclge_mbx_link_mode link_mode; struct hclge_dev *hdev = vport->back; unsigned long advertising; unsigned long supported; unsigned long send_data; - u8 msg_data[10] = {}; u8 dest_vfid; advertising = hdev->hw.mac.advertising[0]; supported = hdev->hw.mac.supported[0]; dest_vfid = mbx_req->mbx_src_vfid; - msg_data[0] = mbx_req->msg.data[0]; - - send_data = msg_data[0] == HCLGE_SUPPORTED ? supported : advertising; + send_data = mbx_req->msg.data[0] == HCLGE_SUPPORTED ? supported : + advertising; + link_mode.idx = cpu_to_le16((u16)mbx_req->msg.data[0]); + link_mode.link_mode = cpu_to_le64(send_data); - memcpy(&msg_data[2], &send_data, sizeof(unsigned long)); - hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data), + hclge_send_mbx_msg(vport, (u8 *)&link_mode, sizeof(link_mode), HCLGE_MBX_LINK_STAT_MODE, dest_vfid); } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1710,6 +1710,8 @@ test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state)) && is_kill) { set_bit(vlan_id, hdev->vlan_del_fail_bmap); return -EBUSY; + } else if (!is_kill && test_bit(vlan_id, hdev->vlan_del_fail_bmap)) { + clear_bit(vlan_id, hdev->vlan_del_fail_bmap); } hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN, @@ -1737,20 +1739,25 @@ int ret, sync_cnt = 0; u16 vlan_id; + if (bitmap_empty(hdev->vlan_del_fail_bmap, VLAN_N_VID)) + return; + + rtnl_lock(); vlan_id = find_first_bit(hdev->vlan_del_fail_bmap, VLAN_N_VID); while (vlan_id != VLAN_N_VID) { ret = hclgevf_set_vlan_filter(handle, htons(ETH_P_8021Q), vlan_id, true); if (ret) - return; + break; clear_bit(vlan_id, hdev->vlan_del_fail_bmap); sync_cnt++; if (sync_cnt >= HCLGEVF_MAX_SYNC_COUNT) - return; + break; vlan_id = find_first_bit(hdev->vlan_del_fail_bmap, VLAN_N_VID); } + rtnl_unlock(); } static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable) @@ -2480,8 +2487,18 @@ return HCLGEVF_VECTOR0_EVENT_OTHER; } +static void hclgevf_reset_timer(struct timer_list *t) +{ + struct hclgevf_dev *hdev = from_timer(hdev, t, reset_timer); + + hclgevf_clear_event_cause(hdev, HCLGEVF_VECTOR0_EVENT_RST); + hclgevf_reset_task_schedule(hdev); +} + static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) { +#define HCLGEVF_RESET_DELAY 5 + enum hclgevf_evt_cause event_cause; struct hclgevf_dev *hdev = data; u32 clearval; @@ -2493,7 +2510,8 @@ switch (event_cause) { case HCLGEVF_VECTOR0_EVENT_RST: - hclgevf_reset_task_schedule(hdev); + mod_timer(&hdev->reset_timer, + jiffies + msecs_to_jiffies(HCLGEVF_RESET_DELAY)); break; case HCLGEVF_VECTOR0_EVENT_MBX: hclgevf_mbx_handler(hdev); @@ -3470,6 +3488,7 @@ HCLGEVF_DRIVER_NAME); hclgevf_task_schedule(hdev, round_jiffies_relative(HZ)); + timer_setup(&hdev->reset_timer, hclgevf_reset_timer, 0); return 0; @@ -3809,7 +3828,7 @@ } void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state, - u8 *port_base_vlan_info, u8 data_size) + struct hclge_mbx_port_base_vlan *port_base_vlan) { struct hnae3_handle *nic = &hdev->nic; struct hclge_vf_to_pf_msg send_msg; @@ -3834,7 +3853,7 @@ /* send msg to PF and wait update port based vlan info */ hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN, HCLGE_MBX_PORT_BASE_VLAN_CFG); - memcpy(send_msg.data, port_base_vlan_info, data_size); + memcpy(send_msg.data, port_base_vlan, sizeof(*port_base_vlan)); ret = hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0); if (!ret) { if (state == HNAE3_PORT_BASE_VLAN_DISABLE) diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -281,6 +281,7 @@ enum hnae3_reset_type reset_level; unsigned long reset_pending; enum hnae3_reset_type reset_type; + struct timer_list reset_timer; #define HCLGEVF_RESET_REQUESTED 0 #define HCLGEVF_RESET_PENDING 1 @@ -357,3 +358,3 @@ void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state, - u8 *port_base_vlan_info, u8 data_size); + struct hclge_mbx_port_base_vlan *port_base_vlan); #endif diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -60,6 +60,9 @@ i++; } + /* ensure additional_info will be seen after received_resp */ + smp_rmb(); + if (i >= HCLGEVF_MAX_TRY_TIMES) { dev_err(&hdev->pdev->dev, "VF could not get mbx(%u,%u) resp(=%d) from PF in %d tries\n", @@ -121,7 +124,7 @@ if (need_resp) { mutex_lock(&hdev->mbx_resp.mbx_mutex); hclgevf_reset_mbx_resp_status(hdev); - req->match_id = hdev->mbx_resp.match_id; + req->match_id = cpu_to_le16(hdev->mbx_resp.match_id); status = hclgevf_cmd_send(&hdev->hw, &desc, 1); if (status) { dev_err(&hdev->pdev->dev, @@ -159,27 +162,33 @@ static void hclgevf_handle_mbx_response(struct hclgevf_dev *hdev, struct hclge_mbx_pf_to_vf_cmd *req) { + u16 vf_mbx_msg_subcode = le16_to_cpu(req->msg.vf_mbx_msg_subcode); + u16 vf_mbx_msg_code = le16_to_cpu(req->msg.vf_mbx_msg_code); struct hclgevf_mbx_resp_status *resp = &hdev->mbx_resp; + u16 resp_status = le16_to_cpu(req->msg.resp_status); + u16 match_id = le16_to_cpu(req->match_id); if (resp->received_resp) dev_warn(&hdev->pdev->dev, - "VF mbx resp flag not clear(%u)\n", - req->msg.vf_mbx_msg_code); + "VF mbx resp flag not clear(%u)\n", + vf_mbx_msg_code); - resp->origin_mbx_msg = - (req->msg.vf_mbx_msg_code << 16); - resp->origin_mbx_msg |= req->msg.vf_mbx_msg_subcode; - resp->resp_status = - hclgevf_resp_to_errno(req->msg.resp_status); + resp->origin_mbx_msg = (vf_mbx_msg_code << 16); + resp->origin_mbx_msg |= vf_mbx_msg_subcode; + resp->resp_status = hclgevf_resp_to_errno(resp_status); memcpy(resp->additional_info, req->msg.resp_data, HCLGE_MBX_MAX_RESP_DATA_SIZE * sizeof(u8)); - if (req->match_id) { + + /* ensure additional_info will be seen before setting received_resp */ + smp_wmb(); + + if (match_id) { /* If match_id is not zero, it means PF support match_id. * if the match_id is right, VF get the right response, or * ignore the response. and driver will clear hdev->mbx_resp * when send next message which need response. */ - if (req->match_id == resp->match_id) + if (match_id == resp->match_id) resp->received_resp = true; } else { resp->received_resp = true; @@ -196,7 +205,7 @@ HCLGE_MBX_MAX_ARQ_MSG_NUM) { dev_warn(&hdev->pdev->dev, "Async Q full, dropping msg(%u)\n", - req->msg.code); + le16_to_cpu(req->msg.code)); return; } @@ -215,6 +224,7 @@ struct hclgevf_cmq_ring *crq; struct hclgevf_desc *desc; u16 flag; + u16 code; crq = &hdev->hw.cmq.crq; @@ -228,10 +238,11 @@ req = (struct hclge_mbx_pf_to_vf_cmd *)desc->data; flag = le16_to_cpu(crq->desc[crq->next_to_use].flag); + code = le16_to_cpu(req->msg.code); if (unlikely(!hnae3_get_bit(flag, HCLGEVF_CMDQ_RX_OUTVLD_B))) { dev_warn(&hdev->pdev->dev, "dropped invalid mailbox message, code = %u\n", - req->msg.code); + code); /* dropping/not processing this invalid message */ crq->desc[crq->next_to_use].flag = 0; @@ -247,7 +258,7 @@ * timeout and simultaneously queue the async messages for later * prcessing in context of mailbox task i.e. the slow path. */ - switch (req->msg.code) { + switch (code) { case HCLGE_MBX_PF_VF_RESP: hclgevf_handle_mbx_response(hdev, req); break; @@ -261,7 +272,7 @@ default: dev_err(&hdev->pdev->dev, "VF received unsupported(%u) mbx msg from PF\n", - req->msg.code); + code); break; } crq->desc[crq->next_to_use].flag = 0; @@ -283,14 +294,18 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) { + struct hclge_mbx_port_base_vlan *vlan_info; + struct hclge_mbx_link_status *link_info; + struct hclge_mbx_link_mode *link_mode; enum hnae3_reset_type reset_type; u16 link_status, state; - u16 *msg_q, *vlan_info; + __le16 *msg_q; + u16 opcode; u8 duplex; u32 speed; u32 tail; u8 flag; - u8 idx; + u16 idx; tail = hdev->arq.tail; @@ -303,13 +318,14 @@ } msg_q = hdev->arq.msg_q[hdev->arq.head]; - - switch (msg_q[0]) { + opcode = le16_to_cpu(msg_q[0]); + switch (opcode) { case HCLGE_MBX_LINK_STAT_CHANGE: - link_status = msg_q[1]; - memcpy(&speed, &msg_q[2], sizeof(speed)); - duplex = (u8)msg_q[4]; - flag = (u8)msg_q[5]; + link_info = (struct hclge_mbx_link_status *)(msg_q + 1); + link_status = le16_to_cpu(link_info->link_status); + speed = le32_to_cpu(link_info->speed); + duplex = (u8)le16_to_cpu(link_info->duplex); + flag = link_info->flag; /* update upper layer with new link link status */ hclgevf_update_speed_duplex(hdev, speed, duplex); @@ -321,13 +337,14 @@ break; case HCLGE_MBX_LINK_STAT_MODE: - idx = (u8)msg_q[1]; + link_mode = (struct hclge_mbx_link_mode *)(msg_q + 1); + idx = le16_to_cpu(link_mode->idx); if (idx) - memcpy(&hdev->hw.mac.supported, &msg_q[2], - sizeof(unsigned long)); + hdev->hw.mac.supported = + le64_to_cpu(link_mode->link_mode); else - memcpy(&hdev->hw.mac.advertising, &msg_q[2], - sizeof(unsigned long)); + hdev->hw.mac.advertising = + le64_to_cpu(link_mode->link_mode); break; case HCLGE_MBX_ASSERTING_RESET: /* PF has asserted reset hence VF should go in pending @@ -335,25 +352,27 @@ * has been completely reset. After this stack should * eventually be re-initialized. */ - reset_type = (enum hnae3_reset_type)msg_q[1]; + reset_type = + (enum hnae3_reset_type)le16_to_cpu(msg_q[1]); set_bit(reset_type, &hdev->reset_pending); set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state); hclgevf_reset_task_schedule(hdev); break; case HCLGE_MBX_PUSH_VLAN_INFO: - state = msg_q[1]; - vlan_info = &msg_q[1]; + vlan_info = + (struct hclge_mbx_port_base_vlan *)(msg_q + 1); + state = le16_to_cpu(vlan_info->state); hclgevf_update_port_base_vlan_info(hdev, state, - (u8 *)vlan_info, 8); + vlan_info); break; case HCLGE_MBX_PUSH_PROMISC_INFO: - hclgevf_parse_promisc_info(hdev, msg_q[1]); + hclgevf_parse_promisc_info(hdev, le16_to_cpu(msg_q[1])); break; default: dev_err(&hdev->pdev->dev, "fetched unsupported(%u) message from arq\n", - msg_q[0]); + opcode); break; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e.h linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e.h @@ -566,7 +566,6 @@ #define I40E_FLAG_DISABLE_FW_LLDP BIT(24) #define I40E_FLAG_RS_FEC BIT(25) #define I40E_FLAG_BASE_R_FEC BIT(26) -#define I40E_FLAG_VF_VLAN_PRUNING BIT(27) /* TOTAL_PORT_SHUTDOWN * Allows to physically disable the link on the NIC's port. * If enabled, (after link down request from the OS) @@ -589,6 +588,7 @@ * in abilities field of i40e_aq_set_phy_config structure */ #define I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENABLED BIT(27) +#define I40E_FLAG_VF_VLAN_PRUNING BIT(28) struct i40e_client_instance *cinst; bool stat_offsets_loaded; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_common.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_common.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_common.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_common.c @@ -1080,7 +1080,7 @@ I40E_PFLAN_QALLOC_FIRSTQ_SHIFT; j = (val & I40E_PFLAN_QALLOC_LASTQ_MASK) >> I40E_PFLAN_QALLOC_LASTQ_SHIFT; - if (val & I40E_PFLAN_QALLOC_VALID_MASK) + if (val & I40E_PFLAN_QALLOC_VALID_MASK && j >= base_queue) num_queues = (j - base_queue) + 1; else num_queues = 0; @@ -1090,7 +1090,7 @@ I40E_PF_VT_PFALLOC_FIRSTVF_SHIFT; j = (val & I40E_PF_VT_PFALLOC_LASTVF_MASK) >> I40E_PF_VT_PFALLOC_LASTVF_SHIFT; - if (val & I40E_PF_VT_PFALLOC_VALID_MASK) + if (val & I40E_PF_VT_PFALLOC_VALID_MASK && j >= i) num_vfs = (j - i) + 1; else num_vfs = 0; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -16132,7 +16132,7 @@ I40E_PRTGL_SAH_MFS_MASK) >> I40E_PRTGL_SAH_MFS_SHIFT; if (val < MAX_FRAME_SIZE_DEFAULT) dev_warn(&pdev->dev, "MFS for port %x has been set below the default: %x\n", - i, val); + pf->hw.port, val); /* Add a filter to drop all Flow control frames from any VSI from being * transmitted. By doing so we stop a malicious VF from sending out @@ -16258,11 +16258,15 @@ i40e_switch_branch_release(pf->veb[i]); } - /* Now we can shutdown the PF's VSI, just before we kill + /* Now we can shutdown the PF's VSIs, just before we kill * adminq and hmc. */ - if (pf->vsi[pf->lan_vsi]) - i40e_vsi_release(pf->vsi[pf->lan_vsi]); + for (i = pf->num_alloc_vsi; i--;) + if (pf->vsi[i]) { + i40e_vsi_close(pf->vsi[i]); + i40e_vsi_release(pf->vsi[i]); + pf->vsi[i] = NULL; + } i40e_cloud_filter_exit(pf); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2759,7 +2759,7 @@ return budget; } - if (vsi->back->flags & I40E_TXR_FLAGS_WB_ON_ITR) + if (q_vector->tx.ring[0].flags & I40E_TXR_FLAGS_WB_ON_ITR) q_vector->arm_wb_state = false; /* Exit the polling mode, but don't re-enable interrupts if stack might diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice.h linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice.h @@ -155,6 +155,13 @@ #define ice_pf_to_dev(pf) (&((pf)->pdev->dev)) +enum ice_feature { + ICE_F_DSCP, + ICE_F_ROCE_LAG, + ICE_F_SRIOV_LAG, + ICE_F_MAX +}; + struct ice_txq_meta { u32 q_teid; /* Tx-scheduler element identifier */ u16 q_id; /* Entry in VSI's txq_map bitmap */ @@ -442,6 +449,7 @@ /* used to ratelimit the MDD event logging */ unsigned long last_printed_mdd_jiffies; DECLARE_BITMAP(malvfs, ICE_MAX_VF_COUNT); + DECLARE_BITMAP(features, ICE_F_MAX); DECLARE_BITMAP(state, ICE_STATE_NBITS); DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS); unsigned long *avail_txqs; /* bitmap to track PF Tx queue usage */ diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_common.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_common.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_common.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_common.c @@ -2022,6 +2022,14 @@ ice_debug(hw, ICE_DBG_INIT, "%s: max_mtu = %d\n", prefix, caps->max_mtu); break; + case ICE_AQC_CAPS_FW_LAG_SUPPORT: + caps->roce_lag = !!(number & ICE_AQC_BIT_ROCEV2_LAG); + ice_debug(hw, ICE_DBG_INIT, "%s: roce_lag = %u\n", + prefix, caps->roce_lag); + caps->sriov_lag = !!(number & ICE_AQC_BIT_SRIOV_LAG); + ice_debug(hw, ICE_DBG_INIT, "%s: sriov_lag = %u\n", + prefix, caps->sriov_lag); + break; default: /* Not one of the recognized common capabilities */ found = false; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lag.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lag.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lag.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lag.c @@ -4,6 +4,7 @@ /* Link Aggregation code */ #include "ice.h" +#include "ice_lib.h" #include "ice_lag.h" /** @@ -238,6 +239,26 @@ } /** + * ice_lag_init_feature_support_flag - Check for NVM support for LAG + * @pf: PF struct + */ +static void ice_lag_init_feature_support_flag(struct ice_pf *pf) +{ + struct ice_hw_common_caps *caps; + + caps = &pf->hw.dev_caps.common_cap; + if (caps->roce_lag) + ice_set_feature_support(pf, ICE_F_ROCE_LAG); + else + clear_bit(ICE_F_ROCE_LAG, pf->features); + + if (caps->sriov_lag) + ice_set_feature_support(pf, ICE_F_SRIOV_LAG); + else + clear_bit(ICE_F_SRIOV_LAG, pf->features); +} + +/** * ice_lag_changeupper_event - handle LAG changeupper event * @lag: LAG info struct * @ptr: opaque pointer data @@ -277,26 +298,6 @@ } /** - * ice_lag_changelower_event - handle LAG changelower event - * @lag: LAG info struct - * @ptr: opaque data pointer - * - * ptr to be cast to netdev_notifier_changelowerstate_info - */ -static void ice_lag_changelower_event(struct ice_lag *lag, void *ptr) -{ - struct net_device *netdev = netdev_notifier_info_to_dev(ptr); - - if (netdev != lag->netdev) - return; - - netdev_dbg(netdev, "bonding info\n"); - - if (!netif_is_lag_port(netdev)) - netdev_dbg(netdev, "CHANGELOWER rcvd, but netdev not in LAG. Bail\n"); -} - -/** * ice_lag_event_handler - handle LAG events from netdev * @notif_blk: notifier block registered by this netdev * @event: event type @@ -322,9 +323,6 @@ case NETDEV_CHANGEUPPER: ice_lag_changeupper_event(lag, ptr); break; - case NETDEV_CHANGELOWERSTATE: - ice_lag_changelower_event(lag, ptr); - break; case NETDEV_BONDING_INFO: ice_lag_info_event(lag, ptr); break; @@ -391,6 +389,10 @@ struct ice_vsi *vsi; int err; + ice_lag_init_feature_support_flag(pf); + if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) + return 0; + pf->lag = kzalloc(sizeof(*lag), GFP_KERNEL); if (!pf->lag) return -ENOMEM; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lib.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lib.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lib.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lib.c @@ -954,8 +954,7 @@ ctxt->info.q_opt_rss = ((lut_type << ICE_AQ_VSI_Q_OPT_RSS_LUT_S) & ICE_AQ_VSI_Q_OPT_RSS_LUT_M) | - ((hash_type << ICE_AQ_VSI_Q_OPT_RSS_HASH_S) & - ICE_AQ_VSI_Q_OPT_RSS_HASH_M); + (hash_type & ICE_AQ_VSI_Q_OPT_RSS_HASH_M); } /** @@ -3599,0 +3599,47 @@ + +/** + * ice_is_feature_supported + * @pf: pointer to the struct ice_pf instance + * @f: feature enum to be checked + * + * returns true if feature is supported, false otherwise + */ +bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f) +{ + if (f < 0 || f >= ICE_F_MAX) + return false; + + return test_bit(f, pf->features); +} + +/** + * ice_set_feature_support + * @pf: pointer to the struct ice_pf instance + * @f: feature enum to set + */ +void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f) +{ + if (f < 0 || f >= ICE_F_MAX) + return; + + set_bit(f, pf->features); +} + +/** + * ice_init_feature_support + * @pf: pointer to the struct ice_pf instance + * + * called during init to setup supported feature + */ +void ice_init_feature_support(struct ice_pf *pf) +{ + switch (pf->hw.device_id) { + case ICE_DEV_ID_E810C_BACKPLANE: + case ICE_DEV_ID_E810C_QSFP: + case ICE_DEV_ID_E810C_SFP: + ice_set_feature_support(pf, ICE_F_DSCP); + break; + default: + break; + } +} diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_main.c @@ -6,6 +6,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include "ice.h" #include "ice_base.h" #include "ice_lib.h" @@ -4274,6 +4275,20 @@ return -EINVAL; } + /* when under a kdump kernel initiate a reset before enabling the + * device in order to clear out any pending DMA transactions. These + * transactions can cause some systems to machine check when doing + * the pcim_enable_device() below. + */ + if (is_kdump_kernel()) { + pci_save_state(pdev); + pci_clear_master(pdev); + err = pcie_flr(pdev); + if (err) + return err; + pci_restore_state(pdev); + } + /* this driver uses devres, see * Documentation/driver-api/driver-model/devres.rst */ @@ -4346,6 +4361,8 @@ goto err_exit_unroll; } + ice_init_feature_support(pf); + ice_request_fw(pf); /* if ice_request_fw fails, ICE_FLAG_ADV_FEATURES bit won't be diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igb/igb_ethtool.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igb/igb_ethtool.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -2974,11 +2974,15 @@ if (err) goto err_out_w_lock; - igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx); + err = igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx); + if (err) + goto err_out_input_filter; spin_unlock(&adapter->nfc_lock); return 0; +err_out_input_filter: + igb_erase_filter(adapter, input); err_out_w_lock: spin_unlock(&adapter->nfc_lock); err_out: diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igc/igc_ethtool.c linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igc/igc_ethtool.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1810,7 +1810,7 @@ struct igc_adapter *adapter = netdev_priv(netdev); struct net_device *dev = adapter->netdev; struct igc_hw *hw = &adapter->hw; - u32 advertising; + u16 advertised = 0; /* When adapter in resetting mode, autoneg/speed/duplex * cannot be changed @@ -1835,18 +1835,33 @@ while (test_and_set_bit(__IGC_RESETTING, &adapter->state)) usleep_range(1000, 2000); - ethtool_convert_link_mode_to_legacy_u32(&advertising, - cmd->link_modes.advertising); - /* Converting to legacy u32 drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT. - * We have to check this and convert it to ADVERTISE_2500_FULL - * (aka ETHTOOL_LINK_MODE_2500baseX_Full_BIT) explicitly. - */ - if (ethtool_link_ksettings_test_link_mode(cmd, advertising, 2500baseT_Full)) - advertising |= ADVERTISE_2500_FULL; + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 2500baseT_Full)) + advertised |= ADVERTISE_2500_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 1000baseT_Full)) + advertised |= ADVERTISE_1000_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 100baseT_Full)) + advertised |= ADVERTISE_100_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 100baseT_Half)) + advertised |= ADVERTISE_100_HALF; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 10baseT_Full)) + advertised |= ADVERTISE_10_FULL; + + if (ethtool_link_ksettings_test_link_mode(cmd, advertising, + 10baseT_Half)) + advertised |= ADVERTISE_10_HALF; if (cmd->base.autoneg == AUTONEG_ENABLE) { hw->mac.autoneg = 1; - hw->phy.autoneg_advertised = advertising; + hw->phy.autoneg_advertised = advertised; if (adapter->fc_autoneg) hw->fc.requested_mode = igc_fc_default; } else { diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -5045,6 +5045,8 @@ ipolicer = &nix_hw->ipolicer[layer]; for (idx = 0; idx < req->prof_count[layer]; idx++) { + if (idx == MAX_BANDPROF_PER_PFFUNC) + break; prof_idx = req->prof_idx[layer][idx]; if (prof_idx >= ipolicer->band_prof.max || ipolicer->pfvf_map[prof_idx] != pcifunc) @@ -5058,8 +5060,6 @@ ipolicer->pfvf_map[prof_idx] = 0x00; ipolicer->match_id[prof_idx] = 0; rvu_free_rsrc(&ipolicer->band_prof, prof_idx); - if (idx == MAX_BANDPROF_PER_PFFUNC) - break; } } mutex_unlock(&rvu->rsrc_lock); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -388,7 +388,13 @@ int bank, nixlf, index; /* get ucast entry rule entry index */ - nix_get_nixlf(rvu, pf_func, &nixlf, NULL); + if (nix_get_nixlf(rvu, pf_func, &nixlf, NULL)) { + dev_err(rvu->dev, "%s: nixlf not attached to pcifunc:0x%x\n", + __func__, pf_func); + /* Action 0 is drop */ + return 0; + } + index = npc_get_nixlf_mcam_index(mcam, pf_func, nixlf, NIXLF_UCAST_ENTRY); bank = npc_get_bank(mcam, index); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -1002,6 +1002,7 @@ struct ethhdr *eth_hdr; bool new = false; int err = 0; + u64 vf_num; u32 ring; if (!flow_cfg->max_flows) { @@ -1014,7 +1015,21 @@ if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT)) return -ENOMEM; - if (ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC) + /* Number of queues on a VF can be greater or less than + * the PF's queue. Hence no need to check for the + * queue count. Hence no need to check queue count if PF + * is installing for its VF. Below is the expected vf_num value + * based on the ethtool commands. + * + * e.g. + * 1. ethtool -U ... action -1 ==> vf_num:255 + * 2. ethtool -U ... action ==> vf_num:0 + * 3. ethtool -U ... vf queue ==> + * vf_num:vf_idx+1 + */ + vf_num = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); + if (!is_otx2_vf(pfvf->pcifunc) && !vf_num && + ring >= pfvf->hw.rx_queues && fsp->ring_cookie != RX_CLS_FLOW_DISC) return -EINVAL; if (fsp->location >= otx2_get_maxflows(flow_cfg)) @@ -1096,6 +1111,9 @@ flow_cfg->nr_flows++; } + if (flow->is_vf) + netdev_info(pfvf->netdev, + "Make sure that VF's queue number is within its queue limit\n"); return 0; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -557,7 +557,9 @@ otx2_write64(pf, RVU_PF_VFPF_MBOX_INTX(1), intr); otx2_queue_work(mbox, pf->mbox_pfvf_wq, 64, vfs, intr, TYPE_PFVF); - vfs -= 64; + if (intr) + trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); + vfs = 64; } intr = otx2_read64(pf, RVU_PF_VFPF_MBOX_INTX(0)); @@ -565,7 +567,8 @@ otx2_queue_work(mbox, pf->mbox_pfvf_wq, 0, vfs, intr, TYPE_PFVF); - trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); + if (intr) + trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); return IRQ_HANDLED; } @@ -1180,31 +1183,32 @@ }; static char *nix_snd_status_e_str[NIX_SND_STATUS_MAX] = { - "NIX_SND_STATUS_GOOD", - "NIX_SND_STATUS_SQ_CTX_FAULT", - "NIX_SND_STATUS_SQ_CTX_POISON", - "NIX_SND_STATUS_SQB_FAULT", - "NIX_SND_STATUS_SQB_POISON", - "NIX_SND_STATUS_HDR_ERR", - "NIX_SND_STATUS_EXT_ERR", - "NIX_SND_STATUS_JUMP_FAULT", - "NIX_SND_STATUS_JUMP_POISON", - "NIX_SND_STATUS_CRC_ERR", - "NIX_SND_STATUS_IMM_ERR", - "NIX_SND_STATUS_SG_ERR", - "NIX_SND_STATUS_MEM_ERR", - "NIX_SND_STATUS_INVALID_SUBDC", - "NIX_SND_STATUS_SUBDC_ORDER_ERR", - "NIX_SND_STATUS_DATA_FAULT", - "NIX_SND_STATUS_DATA_POISON", - "NIX_SND_STATUS_NPC_DROP_ACTION", - "NIX_SND_STATUS_LOCK_VIOL", - "NIX_SND_STATUS_NPC_UCAST_CHAN_ERR", - "NIX_SND_STATUS_NPC_MCAST_CHAN_ERR", - "NIX_SND_STATUS_NPC_MCAST_ABORT", - "NIX_SND_STATUS_NPC_VTAG_PTR_ERR", - "NIX_SND_STATUS_NPC_VTAG_SIZE_ERR", - "NIX_SND_STATUS_SEND_STATS_ERR", + [NIX_SND_STATUS_GOOD] = "NIX_SND_STATUS_GOOD", + [NIX_SND_STATUS_SQ_CTX_FAULT] = "NIX_SND_STATUS_SQ_CTX_FAULT", + [NIX_SND_STATUS_SQ_CTX_POISON] = "NIX_SND_STATUS_SQ_CTX_POISON", + [NIX_SND_STATUS_SQB_FAULT] = "NIX_SND_STATUS_SQB_FAULT", + [NIX_SND_STATUS_SQB_POISON] = "NIX_SND_STATUS_SQB_POISON", + [NIX_SND_STATUS_HDR_ERR] = "NIX_SND_STATUS_HDR_ERR", + [NIX_SND_STATUS_EXT_ERR] = "NIX_SND_STATUS_EXT_ERR", + [NIX_SND_STATUS_JUMP_FAULT] = "NIX_SND_STATUS_JUMP_FAULT", + [NIX_SND_STATUS_JUMP_POISON] = "NIX_SND_STATUS_JUMP_POISON", + [NIX_SND_STATUS_CRC_ERR] = "NIX_SND_STATUS_CRC_ERR", + [NIX_SND_STATUS_IMM_ERR] = "NIX_SND_STATUS_IMM_ERR", + [NIX_SND_STATUS_SG_ERR] = "NIX_SND_STATUS_SG_ERR", + [NIX_SND_STATUS_MEM_ERR] = "NIX_SND_STATUS_MEM_ERR", + [NIX_SND_STATUS_INVALID_SUBDC] = "NIX_SND_STATUS_INVALID_SUBDC", + [NIX_SND_STATUS_SUBDC_ORDER_ERR] = "NIX_SND_STATUS_SUBDC_ORDER_ERR", + [NIX_SND_STATUS_DATA_FAULT] = "NIX_SND_STATUS_DATA_FAULT", + [NIX_SND_STATUS_DATA_POISON] = "NIX_SND_STATUS_DATA_POISON", + [NIX_SND_STATUS_NPC_DROP_ACTION] = "NIX_SND_STATUS_NPC_DROP_ACTION", + [NIX_SND_STATUS_LOCK_VIOL] = "NIX_SND_STATUS_LOCK_VIOL", + [NIX_SND_STATUS_NPC_UCAST_CHAN_ERR] = "NIX_SND_STAT_NPC_UCAST_CHAN_ERR", + [NIX_SND_STATUS_NPC_MCAST_CHAN_ERR] = "NIX_SND_STAT_NPC_MCAST_CHAN_ERR", + [NIX_SND_STATUS_NPC_MCAST_ABORT] = "NIX_SND_STATUS_NPC_MCAST_ABORT", + [NIX_SND_STATUS_NPC_VTAG_PTR_ERR] = "NIX_SND_STATUS_NPC_VTAG_PTR_ERR", + [NIX_SND_STATUS_NPC_VTAG_SIZE_ERR] = "NIX_SND_STATUS_NPC_VTAG_SIZE_ERR", + [NIX_SND_STATUS_SEND_MEM_FAULT] = "NIX_SND_STATUS_SEND_MEM_FAULT", + [NIX_SND_STATUS_SEND_STATS_ERR] = "NIX_SND_STATUS_SEND_STATS_ERR", }; static irqreturn_t otx2_q_intr_handler(int irq, void *data) @@ -1224,14 +1228,16 @@ continue; if (val & BIT_ULL(42)) { - netdev_err(pf->netdev, "CQ%lld: error reading NIX_LF_CQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n", + netdev_err(pf->netdev, + "CQ%lld: error reading NIX_LF_CQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n", qidx, otx2_read64(pf, NIX_LF_ERR_INT)); } else { if (val & BIT_ULL(NIX_CQERRINT_DOOR_ERR)) netdev_err(pf->netdev, "CQ%lld: Doorbell error", qidx); if (val & BIT_ULL(NIX_CQERRINT_CQE_FAULT)) - netdev_err(pf->netdev, "CQ%lld: Memory fault on CQE write to LLC/DRAM", + netdev_err(pf->netdev, + "CQ%lld: Memory fault on CQE write to LLC/DRAM", qidx); } @@ -1254,7 +1260,8 @@ (val & NIX_SQINT_BITS)); if (val & BIT_ULL(42)) { - netdev_err(pf->netdev, "SQ%lld: error reading NIX_LF_SQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n", + netdev_err(pf->netdev, + "SQ%lld: error reading NIX_LF_SQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n", qidx, otx2_read64(pf, NIX_LF_ERR_INT)); goto done; } @@ -1264,8 +1271,11 @@ goto chk_mnq_err_dbg; sq_op_err_code = FIELD_GET(GENMASK(7, 0), sq_op_err_dbg); - netdev_err(pf->netdev, "SQ%lld: NIX_LF_SQ_OP_ERR_DBG(%llx) err=%s\n", - qidx, sq_op_err_dbg, nix_sqoperr_e_str[sq_op_err_code]); + netdev_err(pf->netdev, + "SQ%lld: NIX_LF_SQ_OP_ERR_DBG(0x%llx) err=%s(%#x)\n", + qidx, sq_op_err_dbg, + nix_sqoperr_e_str[sq_op_err_code], + sq_op_err_code); otx2_write64(pf, NIX_LF_SQ_OP_ERR_DBG, BIT_ULL(44)); @@ -1282,16 +1292,21 @@ goto chk_snd_err_dbg; mnq_err_code = FIELD_GET(GENMASK(7, 0), mnq_err_dbg); - netdev_err(pf->netdev, "SQ%lld: NIX_LF_MNQ_ERR_DBG(%llx) err=%s\n", - qidx, mnq_err_dbg, nix_mnqerr_e_str[mnq_err_code]); + netdev_err(pf->netdev, + "SQ%lld: NIX_LF_MNQ_ERR_DBG(0x%llx) err=%s(%#x)\n", + qidx, mnq_err_dbg, nix_mnqerr_e_str[mnq_err_code], + mnq_err_code); otx2_write64(pf, NIX_LF_MNQ_ERR_DBG, BIT_ULL(44)); chk_snd_err_dbg: snd_err_dbg = otx2_read64(pf, NIX_LF_SEND_ERR_DBG); if (snd_err_dbg & BIT(44)) { snd_err_code = FIELD_GET(GENMASK(7, 0), snd_err_dbg); - netdev_err(pf->netdev, "SQ%lld: NIX_LF_SND_ERR_DBG:0x%llx err=%s\n", - qidx, snd_err_dbg, nix_snd_status_e_str[snd_err_code]); + netdev_err(pf->netdev, + "SQ%lld: NIX_LF_SND_ERR_DBG:0x%llx err=%s(%#x)\n", + qidx, snd_err_dbg, + nix_snd_status_e_str[snd_err_code], + snd_err_code); otx2_write64(pf, NIX_LF_SEND_ERR_DBG, BIT_ULL(44)); } @@ -1826,6 +1841,8 @@ /* Clear RSS enable flag */ rss = &pf->hw.rss_info; rss->enable = false; + if (!netif_is_rxfh_configured(netdev)) + kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]); /* Cleanup Queue IRQ */ vec = pci_irq_vector(pf->pdev, diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h @@ -311,23 +311,23 @@ NIX_SND_STATUS_EXT_ERR = 0x6, NIX_SND_STATUS_JUMP_FAULT = 0x7, NIX_SND_STATUS_JUMP_POISON = 0x8, - NIX_SND_STATUS_CRC_ERR = 0x9, - NIX_SND_STATUS_IMM_ERR = 0x10, - NIX_SND_STATUS_SG_ERR = 0x11, - NIX_SND_STATUS_MEM_ERR = 0x12, - NIX_SND_STATUS_INVALID_SUBDC = 0x13, - NIX_SND_STATUS_SUBDC_ORDER_ERR = 0x14, - NIX_SND_STATUS_DATA_FAULT = 0x15, - NIX_SND_STATUS_DATA_POISON = 0x16, - NIX_SND_STATUS_NPC_DROP_ACTION = 0x17, - NIX_SND_STATUS_LOCK_VIOL = 0x18, - NIX_SND_STATUS_NPC_UCAST_CHAN_ERR = 0x19, - NIX_SND_STATUS_NPC_MCAST_CHAN_ERR = 0x20, - NIX_SND_STATUS_NPC_MCAST_ABORT = 0x21, - NIX_SND_STATUS_NPC_VTAG_PTR_ERR = 0x22, - NIX_SND_STATUS_NPC_VTAG_SIZE_ERR = 0x23, - NIX_SND_STATUS_SEND_MEM_FAULT = 0x24, - NIX_SND_STATUS_SEND_STATS_ERR = 0x25, + NIX_SND_STATUS_CRC_ERR = 0x10, + NIX_SND_STATUS_IMM_ERR = 0x11, + NIX_SND_STATUS_SG_ERR = 0x12, + NIX_SND_STATUS_MEM_ERR = 0x13, + NIX_SND_STATUS_INVALID_SUBDC = 0x14, + NIX_SND_STATUS_SUBDC_ORDER_ERR = 0x15, + NIX_SND_STATUS_DATA_FAULT = 0x16, + NIX_SND_STATUS_DATA_POISON = 0x17, + NIX_SND_STATUS_NPC_DROP_ACTION = 0x20, + NIX_SND_STATUS_LOCK_VIOL = 0x21, + NIX_SND_STATUS_NPC_UCAST_CHAN_ERR = 0x22, + NIX_SND_STATUS_NPC_MCAST_CHAN_ERR = 0x23, + NIX_SND_STATUS_NPC_MCAST_ABORT = 0x24, + NIX_SND_STATUS_NPC_VTAG_PTR_ERR = 0x25, + NIX_SND_STATUS_NPC_VTAG_SIZE_ERR = 0x26, + NIX_SND_STATUS_SEND_MEM_FAULT = 0x27, + NIX_SND_STATUS_SEND_STATS_ERR = 0x28, NIX_SND_STATUS_MAX, }; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c @@ -821,7 +821,7 @@ mlx5_core_dbg(tracer->dev, "FWTracer: ownership changed, current=(%d)\n", tracer->owner); if (tracer->owner) { - tracer->owner = false; + mlx5_fw_tracer_ownership_acquire(tracer); return; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c @@ -655,11 +655,11 @@ void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq) { - char icosq_str[MLX5E_REPORTER_PER_Q_MAX_LEN] = {}; char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN]; struct mlx5e_icosq *icosq = rq->icosq; struct mlx5e_priv *priv = rq->priv; struct mlx5e_err_ctx err_ctx = {}; + char icosq_str[32] = {}; err_ctx.ctx = rq; err_ctx.recover = mlx5e_rx_reporter_timeout_recover; @@ -668,7 +668,7 @@ if (icosq) snprintf(icosq_str, sizeof(icosq_str), "ICOSQ: 0x%x, ", icosq->sqn); snprintf(err_str, sizeof(err_str), - "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x", + "RX timeout on channel: %d, %s RQ: 0x%x, CQ: 0x%x", rq->ix, icosq_str, rq->rqn, rq->cq.mcq.cqn); mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -609,22 +609,15 @@ struct flow_action *flow_action = &flow_rule->action; struct mlx5_core_dev *mdev = ct_priv->dev; struct flow_action_entry *act; - size_t action_size; char *modact; int err, i; - action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto); - flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_MANGLE: { - err = alloc_mod_hdr_actions(mdev, ct_priv->ns_type, - mod_acts); - if (err) - return err; - - modact = mod_acts->actions + - mod_acts->num_actions * action_size; + modact = mlx5e_mod_hdr_alloc(mdev, ct_priv->ns_type, mod_acts); + if (IS_ERR(modact)) + return PTR_ERR(modact); err = mlx5_tc_ct_parse_mangle_to_mod_act(act, modact); if (err) @@ -707,11 +700,11 @@ attr->modify_hdr = mlx5e_mod_hdr_get(*mh); } - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); return 0; err_mapping: - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); return err; } @@ -1463,7 +1456,7 @@ } pre_ct->miss_rule = rule; - dealloc_mod_hdr_actions(&pre_mod_acts); + mlx5e_mod_hdr_dealloc(&pre_mod_acts); kvfree(spec); return 0; @@ -1472,7 +1465,7 @@ err_flow_rule: mlx5_modify_header_dealloc(dev, pre_ct->modify_hdr); err_mapping: - dealloc_mod_hdr_actions(&pre_mod_acts); + mlx5e_mod_hdr_dealloc(&pre_mod_acts); kvfree(spec); return err; } @@ -1872,14 +1865,14 @@ } attr->ct_attr.ct_flow = ct_flow; - dealloc_mod_hdr_actions(&pre_mod_acts); + mlx5e_mod_hdr_dealloc(&pre_mod_acts); return ct_flow->pre_ct_rule; err_insert_orig: mlx5_modify_header_dealloc(priv->mdev, pre_ct_attr->modify_hdr); err_mapping: - dealloc_mod_hdr_actions(&pre_mod_acts); + mlx5e_mod_hdr_dealloc(&pre_mod_acts); mlx5_chains_put_chain_mapping(ct_priv->chains, ct_flow->chain_mapping); err_get_chain: kfree(ct_flow->pre_ct_attr); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -67,13 +67,17 @@ { struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5_core_dev *mdev = priv->mdev; + int count; strlcpy(drvinfo->driver, mlx5e_rep_driver_name, sizeof(drvinfo->driver)); - snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), - "%d.%d.%04d (%.16s)", - fw_rev_maj(mdev), fw_rev_min(mdev), - fw_rev_sub(mdev), mdev->board_id); + count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), + fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); + if (count == sizeof(drvinfo->fw_version)) + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "%d.%d.%04d", fw_rev_maj(mdev), + fw_rev_min(mdev), fw_rev_sub(mdev)); } static const struct counter_desc sw_rep_stats_desc[] = { diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -70,7 +70,6 @@ #include "lag_mp.h" #define nic_chains(priv) ((priv)->fs.tc.chains) -#define MLX5_MH_ACT_SZ MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto) #define MLX5E_TC_TABLE_NUM_GROUPS 4 #define MLX5E_TC_TABLE_MAX_GROUP_SIZE BIT(18) @@ -208,12 +207,9 @@ char *modact; int err; - err = alloc_mod_hdr_actions(mdev, ns, mod_hdr_acts); - if (err) - return err; - - modact = mod_hdr_acts->actions + - (mod_hdr_acts->num_actions * MLX5_MH_ACT_SZ); + modact = mlx5e_mod_hdr_alloc(mdev, ns, mod_hdr_acts); + if (IS_ERR(modact)) + return PTR_ERR(modact); /* Firmware has 5bit length field and 0 means 32bits */ if (mlen == 32) @@ -332,7 +328,7 @@ int mlen = mlx5e_tc_attr_to_reg_mappings[type].mlen; char *modact; - modact = mod_hdr_acts->actions + (act_id * MLX5_MH_ACT_SZ); + modact = mlx5e_mod_hdr_get_item(mod_hdr_acts, act_id); /* Firmware has 5bit length field and 0 means 32bits */ if (mlen == 32) @@ -1075,7 +1071,7 @@ if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); - dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); + mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts); if (err) return err; } @@ -1626,7 +1622,7 @@ mlx5_tc_ct_match_del(get_ct_priv(priv), &flow->attr->ct_attr); if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { - dealloc_mod_hdr_actions(&attr->parse_attr->mod_hdr_acts); + mlx5e_mod_hdr_dealloc(&attr->parse_attr->mod_hdr_acts); if (vf_tun && attr->modify_hdr) mlx5_modify_header_dealloc(priv->mdev, attr->modify_hdr); else @@ -2843,7 +2839,7 @@ OFFLOAD(DIPV6_31_0, 32, U32_MAX, ip6.daddr.s6_addr32[3], 0, dst_ipv4_dst_ipv6.ipv6_layout.ipv6[12]), OFFLOAD(IPV6_HOPLIMIT, 8, U8_MAX, ip6.hop_limit, 0, ttl_hoplimit), - OFFLOAD(IP_DSCP, 16, 0xc00f, ip6, 0, ip_dscp), + OFFLOAD(IP_DSCP, 16, 0x0fc0, ip6, 0, ip_dscp), OFFLOAD(TCP_SPORT, 16, U16_MAX, tcp.source, 0, tcp_sport), OFFLOAD(TCP_DPORT, 16, U16_MAX, tcp.dest, 0, tcp_dport), @@ -2854,21 +2850,31 @@ OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest, 0, udp_dport), }; -static unsigned long mask_to_le(unsigned long mask, int size) +static u32 mask_field_get(void *mask, struct mlx5_fields *f) { - __be32 mask_be32; - __be16 mask_be16; - - if (size == 32) { - mask_be32 = (__force __be32)(mask); - mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32)); - } else if (size == 16) { - mask_be32 = (__force __be32)(mask); - mask_be16 = *(__be16 *)&mask_be32; - mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16)); + switch (f->field_bsize) { + case 32: + return be32_to_cpu(*(__be32 *)mask) & f->field_mask; + case 16: + return be16_to_cpu(*(__be16 *)mask) & (u16)f->field_mask; + default: + return *(u8 *)mask & (u8)f->field_mask; } +} - return mask; +static void mask_field_clear(void *mask, struct mlx5_fields *f) +{ + switch (f->field_bsize) { + case 32: + *(__be32 *)mask &= ~cpu_to_be32(f->field_mask); + break; + case 16: + *(__be16 *)mask &= ~cpu_to_be16((u16)f->field_mask); + break; + default: + *(u8 *)mask &= ~(u8)f->field_mask; + break; + } } static int offload_pedit_fields(struct mlx5e_priv *priv, int namespace, @@ -2878,13 +2884,13 @@ struct netlink_ext_ack *extack) { struct pedit_headers *set_masks, *add_masks, *set_vals, *add_vals; - int i, action_size, first, last, next_z; void *headers_c, *headers_v, *action, *vals_p; - u32 *s_masks_p, *a_masks_p, s_mask, a_mask; struct mlx5e_tc_mod_hdr_acts *mod_acts; + void *s_masks_p, *a_masks_p; + int i, first, last, next_z; struct mlx5_fields *f; - unsigned long mask, field_mask; - int err; + unsigned long mask; + u32 s_mask, a_mask; u8 cmd; mod_acts = &parse_attr->mod_hdr_acts; @@ -2896,21 +2902,15 @@ set_vals = &hdrs[0].vals; add_vals = &hdrs[1].vals; - action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto); - for (i = 0; i < ARRAY_SIZE(fields); i++) { bool skip; f = &fields[i]; - /* avoid seeing bits set from previous iterations */ - s_mask = 0; - a_mask = 0; - s_masks_p = (void *)set_masks + f->offset; a_masks_p = (void *)add_masks + f->offset; - s_mask = *s_masks_p & f->field_mask; - a_mask = *a_masks_p & f->field_mask; + s_mask = mask_field_get(s_masks_p, f); + a_mask = mask_field_get(a_masks_p, f); if (!s_mask && !a_mask) /* nothing to offload here */ continue; @@ -2937,22 +2937,20 @@ match_mask, f->field_bsize)) skip = true; /* clear to denote we consumed this field */ - *s_masks_p &= ~f->field_mask; + mask_field_clear(s_masks_p, f); } else { cmd = MLX5_ACTION_TYPE_ADD; mask = a_mask; vals_p = (void *)add_vals + f->offset; /* add 0 is no change */ - if ((*(u32 *)vals_p & f->field_mask) == 0) + if (!mask_field_get(vals_p, f)) skip = true; /* clear to denote we consumed this field */ - *a_masks_p &= ~f->field_mask; + mask_field_clear(a_masks_p, f); } if (skip) continue; - mask = mask_to_le(mask, f->field_bsize); - first = find_first_bit(&mask, f->field_bsize); next_z = find_next_zero_bit(&mask, f->field_bsize, first); last = find_last_bit(&mask, f->field_bsize); @@ -2965,26 +2963,23 @@ return -EOPNOTSUPP; } - err = alloc_mod_hdr_actions(priv->mdev, namespace, mod_acts); - if (err) { + action = mlx5e_mod_hdr_alloc(priv->mdev, namespace, mod_acts); + if (IS_ERR(action)) { NL_SET_ERR_MSG_MOD(extack, "too many pedit actions, can't offload"); mlx5_core_warn(priv->mdev, "mlx5: parsed %d pedit actions, can't do more\n", mod_acts->num_actions); - return err; + return PTR_ERR(action); } - action = mod_acts->actions + - (mod_acts->num_actions * action_size); MLX5_SET(set_action_in, action, action_type, cmd); MLX5_SET(set_action_in, action, field, f->field); if (cmd == MLX5_ACTION_TYPE_SET) { + unsigned long field_mask = f->field_mask; int start; - field_mask = mask_to_le(f->field_mask, f->field_bsize); - /* if field is bit sized it can start not from first bit */ start = find_first_bit(&field_mask, f->field_bsize); @@ -3006,57 +3001,6 @@ return 0; } -static int mlx5e_flow_namespace_max_modify_action(struct mlx5_core_dev *mdev, - int namespace) -{ - if (namespace == MLX5_FLOW_NAMESPACE_FDB) /* FDB offloading */ - return MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, max_modify_header_actions); - else /* namespace is MLX5_FLOW_NAMESPACE_KERNEL - NIC offloading */ - return MLX5_CAP_FLOWTABLE_NIC_RX(mdev, max_modify_header_actions); -} - -int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev, - int namespace, - struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts) -{ - int action_size, new_num_actions, max_hw_actions; - size_t new_sz, old_sz; - void *ret; - - if (mod_hdr_acts->num_actions < mod_hdr_acts->max_actions) - return 0; - - action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto); - - max_hw_actions = mlx5e_flow_namespace_max_modify_action(mdev, - namespace); - new_num_actions = min(max_hw_actions, - mod_hdr_acts->actions ? - mod_hdr_acts->max_actions * 2 : 1); - if (mod_hdr_acts->max_actions == new_num_actions) - return -ENOSPC; - - new_sz = action_size * new_num_actions; - old_sz = mod_hdr_acts->max_actions * action_size; - ret = krealloc(mod_hdr_acts->actions, new_sz, GFP_KERNEL); - if (!ret) - return -ENOMEM; - - memset(ret + old_sz, 0, new_sz - old_sz); - mod_hdr_acts->actions = ret; - mod_hdr_acts->max_actions = new_num_actions; - - return 0; -} - -void dealloc_mod_hdr_actions(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts) -{ - kfree(mod_hdr_acts->actions); - mod_hdr_acts->actions = NULL; - mod_hdr_acts->num_actions = 0; - mod_hdr_acts->max_actions = 0; -} - static const struct pedit_headers zero_masks = {}; static int @@ -3079,7 +3023,7 @@ goto out_err; } - if (!mlx5e_flow_namespace_max_modify_action(priv->mdev, namespace)) { + if (!mlx5e_mod_hdr_max_actions(priv->mdev, namespace)) { NL_SET_ERR_MSG_MOD(extack, "The pedit offload action is not supported"); goto out_err; @@ -3171,7 +3115,7 @@ return 0; out_dealloc_parsed_actions: - dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); + mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts); return err; } @@ -3577,11 +3521,51 @@ return 0; } -static int parse_tc_nic_actions(struct mlx5e_priv *priv, - struct flow_action *flow_action, +static int +actions_prepare_mod_hdr_actions(struct mlx5e_priv *priv, struct mlx5e_tc_flow *flow, + struct mlx5_flow_attr *attr, + struct pedit_headers_action *hdrs, struct netlink_ext_ack *extack) { + struct mlx5e_tc_flow_parse_attr *parse_attr = attr->parse_attr; + enum mlx5_flow_namespace_type ns_type; + int err; + + if (!hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits && + !hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) + return 0; + + ns_type = get_flow_name_space(flow); + + err = alloc_tc_pedit_action(priv, ns_type, parse_attr, hdrs, + &attr->action, extack); + if (err) + return err; + + /* In case all pedit actions are skipped, remove the MOD_HDR flag. */ + if (parse_attr->mod_hdr_acts.num_actions > 0) + return 0; + + attr->action &= ~MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; + mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts); + + if (ns_type != MLX5_FLOW_NAMESPACE_FDB) + return 0; + + if (!((attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP) || + (attr->action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH))) + attr->esw_attr->split_count = 0; + + return 0; +} + +static int +parse_tc_nic_actions(struct mlx5e_priv *priv, + struct flow_action *flow_action, + struct mlx5e_tc_flow *flow, + struct netlink_ext_ack *extack) +{ struct mlx5e_tc_flow_parse_attr *parse_attr; struct mlx5_flow_attr *attr = flow->attr; struct pedit_headers_action hdrs[2] = {}; @@ -3692,21 +3676,6 @@ } } - if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || - hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { - err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, - parse_attr, hdrs, &action, extack); - if (err) - return err; - /* in case all pedit actions are skipped, remove the MOD_HDR - * flag. - */ - if (parse_attr->mod_hdr_acts.num_actions == 0) { - action &= ~MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; - dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); - } - } - attr->action = action; if (attr->dest_chain && parse_attr->mirred_ifindex[0]) { @@ -3714,8 +3683,9 @@ return -EOPNOTSUPP; } - if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) - attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; + err = actions_prepare_mod_hdr_actions(priv, flow, attr, hdrs, extack); + if (err) + return err; if (!actions_match_supported(priv, flow_action, parse_attr, flow, extack)) return -EOPNOTSUPP; @@ -4386,26 +4356,12 @@ return err; } - if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || - hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { - err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_FDB, - parse_attr, hdrs, &action, extack); - if (err) - return err; - /* in case all pedit actions are skipped, remove the MOD_HDR - * flag. we might have set split_count either by pedit or - * pop/push. if there is no pop/push either, reset it too. - */ - if (parse_attr->mod_hdr_acts.num_actions == 0) { - action &= ~MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; - dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); - if (!((action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP) || - (action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH))) - esw_attr->split_count = 0; - } - } - attr->action = action; + + err = actions_prepare_mod_hdr_actions(priv, flow, attr, hdrs, extack); + if (err) + return err; + if (!actions_match_supported(priv, flow_action, parse_attr, flow, extack)) return -EOPNOTSUPP; @@ -4792,7 +4748,7 @@ err_free: flow_flag_set(flow, FAILED); - dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); + mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts); mlx5e_flow_put(priv, flow); out: return err; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h @@ -248,9 +248,4 @@ struct mlx5_flow_attr *attr); -int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev, - int namespace, - struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts); -void dealloc_mod_hdr_actions(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts); - struct mlx5e_tc_flow; u32 mlx5e_tc_get_flow_tun_id(struct mlx5e_tc_flow *flow); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/conntrack.c linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/conntrack.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/conntrack.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/conntrack.c @@ -1665,8 +1665,6 @@ struct nfp_fl_ct_flow_entry *ct_entry; struct netlink_ext_ack *extack = NULL; - ASSERT_RTNL(); - extack = flow->common.extack; switch (flow->command) { case FLOW_CLS_REPLACE: @@ -1709,9 +1707,13 @@ switch (type) { case TC_SETUP_CLSFLOWER: - rtnl_lock(); + while (!mutex_trylock(&zt->priv->nfp_fl_lock)) { + if (!zt->nft) /* avoid deadlock */ + return err; + msleep(20); + } err = nfp_fl_ct_offload_nft_flow(zt, flow); - rtnl_unlock(); + mutex_unlock(&zt->priv->nfp_fl_lock); break; default: return -EOPNOTSUPP; @@ -1739,6 +1741,7 @@ struct nfp_fl_ct_flow_entry *ct_entry; struct nfp_fl_ct_zone_entry *zt; struct rhashtable *m_table; + struct nf_flowtable *nft; if (!ct_map_ent) return -ENOENT; @@ -1755,8 +1758,12 @@ nfp_fl_ct_clean_flow_entry(ct_entry); kfree(ct_map_ent); - if (!zt->pre_ct_count) { - zt->nft = NULL; + if (!zt->pre_ct_count && zt->nft) { + nft = zt->nft; + zt->nft = NULL; /* avoid deadlock */ + nf_flow_table_offload_del_cb(nft, + nfp_fl_ct_handle_nft_flow, + zt); nfp_fl_ct_clean_nft_entries(zt); } break; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_dev.h linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_dev.h --- linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -208,7 +208,7 @@ void *cb_arg; }; -#define IONIC_QUEUE_NAME_MAX_SZ 32 +#define IONIC_QUEUE_NAME_MAX_SZ 16 struct ionic_queue { struct device *dev; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -44,24 +44,24 @@ static void ionic_dim_work(struct work_struct *work) { struct dim *dim = container_of(work, struct dim, work); + struct ionic_intr_info *intr; struct dim_cq_moder cur_moder; struct ionic_qcq *qcq; + struct ionic_lif *lif; u32 new_coal; cur_moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix); qcq = container_of(dim, struct ionic_qcq, dim); - new_coal = ionic_coal_usec_to_hw(qcq->q.lif->ionic, cur_moder.usec); + lif = qcq->q.lif; + new_coal = ionic_coal_usec_to_hw(lif->ionic, cur_moder.usec); new_coal = new_coal ? new_coal : 1; - if (qcq->intr.dim_coal_hw != new_coal) { - unsigned int qi = qcq->cq.bound_q->index; - struct ionic_lif *lif = qcq->q.lif; - - qcq->intr.dim_coal_hw = new_coal; + intr = &qcq->intr; + if (intr->dim_coal_hw != new_coal) { + intr->dim_coal_hw = new_coal; ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, - lif->rxqcqs[qi]->intr.index, - qcq->intr.dim_coal_hw); + intr->index, intr->dim_coal_hw); } dim->state = DIM_START_MEASURE; diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/realtek/r8169_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/realtek/r8169_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/realtek/r8169_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/realtek/r8169_main.c @@ -205,6 +205,7 @@ /* No threshold before first PCI xfer */ #define RX_FIFO_THRESH (7 << RXCFG_FIFO_SHIFT) #define RX_EARLY_OFF (1 << 11) +#define RX_PAUSE_SLOT_ON (1 << 11) /* 8125b and later */ #define RXCFG_DMA_SHIFT 8 /* Unlimited maximum PCI burst. */ #define RX_DMA_BURST (7 << RXCFG_DMA_SHIFT) @@ -588,6 +589,8 @@ enum rtl_flag { RTL_FLAG_TASK_ENABLED = 0, RTL_FLAG_TASK_RESET_PENDING, + RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, + RTL_FLAG_TASK_TX_TIMEOUT, RTL_FLAG_MAX }; @@ -2272,9 +2275,13 @@ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53: RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); break; - case RTL_GIGA_MAC_VER_60 ... RTL_GIGA_MAC_VER_63: + case RTL_GIGA_MAC_VER_61: RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); break; + case RTL_GIGA_MAC_VER_63: + RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | + RX_PAUSE_SLOT_ON); + break; default: RTL_W32(tp, RxConfig, RX128_INT_EN | RX_DMA_BURST); break; @@ -2555,6 +2562,8 @@ if (dev->flags & IFF_PROMISC) { rx_mode |= AcceptAllPhys; + } else if (!(dev->flags & IFF_MULTICAST)) { + rx_mode &= ~AcceptMulticast; } else if (netdev_mc_count(dev) > MC_FILTER_LIMIT || dev->flags & IFF_ALLMULTI || tp->mac_version == RTL_GIGA_MAC_VER_35) { @@ -4041,7 +4050,7 @@ { struct rtl8169_private *tp = netdev_priv(dev); - rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); + rtl_schedule_task(tp, RTL_FLAG_TASK_TX_TIMEOUT); } static int rtl8169_tx_map(struct rtl8169_private *tp, const u32 *opts, u32 len, @@ -4458,7 +4467,7 @@ unsigned int entry = dirty_tx % NUM_TX_DESC; u32 status; - status = le32_to_cpu(tp->TxDescArray[entry].opts1); + status = le32_to_cpu(READ_ONCE(tp->TxDescArray[entry].opts1)); if (status & DescOwn) break; @@ -4495,7 +4504,7 @@ * If skb is NULL then we come here again once a tx irq is * triggered after the last fragment is marked transmitted. */ - if (tp->cur_tx != dirty_tx && skb) + if (READ_ONCE(tp->cur_tx) != dirty_tx && skb) rtl8169_doorbell(tp); } } @@ -4528,7 +4537,7 @@ dma_addr_t addr; u32 status; - status = le32_to_cpu(desc->opts1); + status = le32_to_cpu(READ_ONCE(desc->opts1)); if (status & DescOwn) break; @@ -4639,6 +4648,7 @@ { struct rtl8169_private *tp = container_of(work, struct rtl8169_private, wk.work); + int ret; rtnl_lock(); @@ -4646,9 +4656,21 @@ !test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) goto out_unlock; + if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) { + /* ASPM compatibility issues are a typical reason for tx timeouts */ + ret = pci_disable_link_state(tp->pci_dev, PCIE_LINK_STATE_L1 | + PCIE_LINK_STATE_L0S); + if (!ret) + netdev_warn_once(tp->dev, "ASPM disabled on Tx timeout\n"); + goto reset; + } + if (test_and_clear_bit(RTL_FLAG_TASK_RESET_PENDING, tp->wk.flags)) { +reset: rtl_reset_work(tp); netif_wake_queue(tp->dev); + } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) { + rtl_reset_work(tp); } out_unlock: rtnl_unlock(); @@ -4673,12 +4695,17 @@ static void r8169_phylink_handler(struct net_device *ndev) { struct rtl8169_private *tp = netdev_priv(ndev); + struct device *d = tp_to_dev(tp); if (netif_carrier_ok(ndev)) { rtl_link_chg_patch(tp); - pm_request_resume(&tp->pci_dev->dev); + pm_request_resume(d); + netif_wake_queue(tp->dev); } else { - pm_runtime_idle(&tp->pci_dev->dev); + /* In few cases rx is broken after link-down otherwise */ + if (rtl_is_8125(tp)) + rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE); + pm_runtime_idle(d); } if (net_ratelimit()) @@ -4753,10 +4780,16 @@ rtl8169_cleanup(tp, true); rtl_prepare_power_down(tp); + + if (tp->dash_type != RTL_DASH_NONE) + rtl8168_driver_stop(tp); } static void rtl8169_up(struct rtl8169_private *tp) { + if (tp->dash_type != RTL_DASH_NONE) + rtl8168_driver_start(tp); + pci_set_master(tp->pci_dev); phy_init_hw(tp->phydev); phy_resume(tp->phydev); @@ -4783,7 +4816,7 @@ rtl8169_down(tp); rtl8169_rx_clear(tp); - cancel_work_sync(&tp->wk.work); + cancel_work(&tp->wk.work); free_irq(pci_irq_vector(pdev, 0), tp); @@ -5039,6 +5072,8 @@ if (pci_dev_run_wake(pdev)) pm_runtime_get_noresume(&pdev->dev); + cancel_work_sync(&tp->wk.work); + unregister_netdev(tp->dev); if (tp->dash_type != RTL_DASH_NONE) diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/renesas/ravb_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/renesas/ravb_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/renesas/ravb_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/renesas/ravb_main.c @@ -1448,19 +1448,20 @@ if (info->gptp) ravb_ptp_init(ndev, priv->pdev); - netif_tx_start_all_queues(ndev); - /* PHY control start */ error = ravb_phy_start(ndev); if (error) goto out_ptp_stop; + netif_tx_start_all_queues(ndev); + return 0; out_ptp_stop: /* Stop PTP Clock driver */ if (info->gptp) ravb_ptp_stop(ndev); + ravb_stop_dma(ndev); out_free_irq_nc_tx: if (!info->multi_irqs) goto out_free_irq; @@ -1504,6 +1505,12 @@ struct net_device *ndev = priv->ndev; int error; + if (!rtnl_trylock()) { + usleep_range(1000, 2000); + schedule_work(&priv->work); + return; + } + netif_tx_stop_all_queues(ndev); /* Stop PTP Clock driver */ @@ -1536,7 +1543,7 @@ */ netdev_err(ndev, "%s: ravb_dmac_init() failed, error %d\n", __func__, error); - return; + goto out_unlock; } ravb_emac_init(ndev); @@ -1546,6 +1553,9 @@ ravb_ptp_init(ndev, priv->pdev); netif_tx_start_all_queues(ndev); + +out_unlock: + rtnl_unlock(); } /* Packet transmit function for Ethernet AVB */ @@ -2179,9 +2189,14 @@ ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; - reset_control_deassert(rstc); + error = reset_control_deassert(rstc); + if (error) + goto out_free_netdev; + pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); + error = pm_runtime_resume_and_get(&pdev->dev); + if (error < 0) + goto out_rpm_disable; if (info->multi_irqs) irq = platform_get_irq_byname(pdev, "ch22"); @@ -2364,11 +2379,12 @@ out_disable_refclk: clk_disable_unprepare(priv->refclk); out_release: - free_netdev(ndev); - pm_runtime_put(&pdev->dev); +out_rpm_disable: pm_runtime_disable(&pdev->dev); reset_control_assert(rstc); +out_free_netdev: + free_netdev(ndev); return error; } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwmac5.c linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwmac5.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -710,28 +710,22 @@ } } -void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, +void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable) { u32 value; - if (!enable) { - value = readl(ioaddr + MAC_FPE_CTRL_STS); - - value &= ~EFPE; - - writel(value, ioaddr + MAC_FPE_CTRL_STS); - return; + if (enable) { + cfg->fpe_csr = EFPE; + value = readl(ioaddr + GMAC_RXQ_CTRL1); + value &= ~GMAC_RXQCTRL_FPRQ; + value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; + writel(value, ioaddr + GMAC_RXQ_CTRL1); + } else { + cfg->fpe_csr = 0; } - - value = readl(ioaddr + GMAC_RXQ_CTRL1); - value &= ~GMAC_RXQCTRL_FPRQ; - value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; - writel(value, ioaddr + GMAC_RXQ_CTRL1); - - value = readl(ioaddr + MAC_FPE_CTRL_STS); - value |= EFPE; - writel(value, ioaddr + MAC_FPE_CTRL_STS); + writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); } int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) @@ -741,6 +735,9 @@ status = FPE_EVENT_UNKNOWN; + /* Reads from the MAC_FPE_CTRL_STS register should only be performed + * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" + */ value = readl(ioaddr + MAC_FPE_CTRL_STS); if (value & TRSP) { @@ -766,19 +763,15 @@ return status; } -void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, enum stmmac_mpacket_type type) +void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type) { - u32 value; - - value = readl(ioaddr + MAC_FPE_CTRL_STS); + u32 value = cfg->fpe_csr; - if (type == MPACKET_VERIFY) { - value &= ~SRSP; + if (type == MPACKET_VERIFY) value |= SVER; - } else { - value &= ~SVER; + else if (type == MPACKET_RESPONSE) value |= SRSP; - } writel(value, ioaddr + MAC_FPE_CTRL_STS); } diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1054,7 +1054,8 @@ bool *hs_enable = &fpe_cfg->hs_enable; if (is_up && *hs_enable) { - stmmac_fpe_send_mpacket(priv, priv->ioaddr, MPACKET_VERIFY); + stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, + MPACKET_VERIFY); } else { *lo_state = FPE_STATE_OFF; *lp_state = FPE_STATE_OFF; @@ -5165,10 +5166,10 @@ len = 0; } +read_again: if (count >= limit) break; -read_again: buf1_len = 0; buf2_len = 0; entry = next_entry; @@ -5621,6 +5622,7 @@ /* If user has requested FPE enable, quickly response */ if (*hs_enable) stmmac_fpe_send_mpacket(priv, priv->ioaddr, + fpe_cfg, MPACKET_RESPONSE); } @@ -6958,6 +6960,7 @@ if (*lo_state == FPE_STATE_ENTERING_ON && *lp_state == FPE_STATE_ENTERING_ON) { stmmac_fpe_configure(priv, priv->ioaddr, + fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, *enable); @@ -6976,6 +6979,7 @@ netdev_info(priv->dev, SEND_VERIFY_MPAKCET_FMT, *lo_state, *lp_state); stmmac_fpe_send_mpacket(priv, priv->ioaddr, + fpe_cfg, MPACKET_VERIFY); } /* Sleep then retry */ @@ -6990,6 +6994,7 @@ if (priv->plat->fpe_cfg->hs_enable != enable) { if (enable) { stmmac_fpe_send_mpacket(priv, priv->ioaddr, + priv->plat->fpe_cfg, MPACKET_VERIFY); } else { priv->plat->fpe_cfg->lo_fpe_state = FPE_STATE_OFF; @@ -7399,6 +7404,7 @@ if (priv->dma_cap.fpesel) { /* Disable FPE */ stmmac_fpe_configure(priv, priv->ioaddr, + priv->plat->fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, false); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -952,6 +952,7 @@ priv->plat->fpe_cfg->enable = false; stmmac_fpe_configure(priv, priv->ioaddr, + priv->plat->fpe_cfg, priv->plat->tx_queues_to_use, priv->plat->rx_queues_to_use, false); diff -u linux-lowlatency-5.15.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c linux-lowlatency-5.15.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c --- linux-lowlatency-5.15.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -763,7 +763,7 @@ if (lp->features & XAE_FEATURE_FULL_TX_CSUM) { /* Tx Full Checksum Offload Enabled */ cur_p->app0 |= 2; - } else if (lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) { + } else if (lp->features & XAE_FEATURE_PARTIAL_TX_CSUM) { csum_start_off = skb_transport_offset(skb); csum_index_off = csum_start_off + skb->csum_offset; /* Tx Partial Checksum Offload Enabled */ diff -u linux-lowlatency-5.15.0/drivers/net/gtp.c linux-lowlatency-5.15.0/drivers/net/gtp.c --- linux-lowlatency-5.15.0/drivers/net/gtp.c +++ linux-lowlatency-5.15.0/drivers/net/gtp.c @@ -543,8 +543,9 @@ rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false); - if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && - mtu < ntohs(iph->tot_len)) { + if (iph->frag_off & htons(IP_DF) && + ((!skb_is_gso(skb) && skb->len > mtu) || + (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)))) { netdev_dbg(dev, "packet too big, fragmentation needed\n"); icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); diff -u linux-lowlatency-5.15.0/drivers/net/hyperv/netvsc_drv.c linux-lowlatency-5.15.0/drivers/net/hyperv/netvsc_drv.c --- linux-lowlatency-5.15.0/drivers/net/hyperv/netvsc_drv.c +++ linux-lowlatency-5.15.0/drivers/net/hyperv/netvsc_drv.c @@ -2227,9 +2227,6 @@ goto upper_link_failed; } - /* set slave flag before open to prevent IPv6 addrconf */ - vf_netdev->flags |= IFF_SLAVE; - schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT); call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); @@ -2336,16 +2333,18 @@ } - /* Fallback path to check synthetic vf with - * help of mac addr + /* Fallback path to check synthetic vf with help of mac addr. + * Because this function can be called before vf_netdev is + * initialized (NETDEV_POST_INIT) when its perm_addr has not been copied + * from dev_addr, also try to match to its dev_addr. + * Note: On Hyper-V and Azure, it's not possible to set a MAC address + * on a VF that matches to the MAC of a unrelated NETVSC device. */ list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { ndev = hv_get_drvdata(ndev_ctx->device_ctx); - if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr)) { - netdev_notice(vf_netdev, - "falling back to mac addr based matching\n"); + if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr) || + ether_addr_equal(vf_netdev->dev_addr, ndev->perm_addr)) return ndev; - } } netdev_notice(vf_netdev, @@ -2353,6 +2352,19 @@ return NULL; } +static int netvsc_prepare_bonding(struct net_device *vf_netdev) +{ + struct net_device *ndev; + + ndev = get_netvsc_byslot(vf_netdev); + if (!ndev) + return NOTIFY_DONE; + + /* set slave flag before open to prevent IPv6 addrconf */ + vf_netdev->flags |= IFF_SLAVE; + return NOTIFY_DONE; +} + static int netvsc_register_vf(struct net_device *vf_netdev) { struct net_device_context *net_device_ctx; @@ -2551,15 +2563,6 @@ goto devinfo_failed; } - nvdev = rndis_filter_device_add(dev, device_info); - if (IS_ERR(nvdev)) { - ret = PTR_ERR(nvdev); - netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); - goto rndis_failed; - } - - memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); - /* We must get rtnl lock before scheduling nvdev->subchan_work, * otherwise netvsc_subchan_work() can get rtnl lock first and wait * all subchannels to show up, but that may not happen because @@ -2567,9 +2570,23 @@ * -> ... -> device_add() -> ... -> __device_attach() can't get * the device lock, so all the subchannels can't be processed -- * finally netvsc_subchan_work() hangs forever. + * + * The rtnl lock also needs to be held before rndis_filter_device_add() + * which advertises nvsp_2_vsc_capability / sriov bit, and triggers + * VF NIC offering and registering. If VF NIC finished register_netdev() + * earlier it may cause name based config failure. */ rtnl_lock(); + nvdev = rndis_filter_device_add(dev, device_info); + if (IS_ERR(nvdev)) { + ret = PTR_ERR(nvdev); + netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); + goto rndis_failed; + } + + memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); + if (nvdev->num_chn > 1) schedule_work(&nvdev->subchan_work); @@ -2603,9 +2620,9 @@ return 0; register_failed: - rtnl_unlock(); rndis_filter_device_remove(dev, nvdev); rndis_failed: + rtnl_unlock(); netvsc_devinfo_put(device_info); devinfo_failed: free_percpu(net_device_ctx->vf_stats); @@ -2772,6 +2789,8 @@ return NOTIFY_DONE; switch (event) { + case NETDEV_POST_INIT: + return netvsc_prepare_bonding(event_dev); case NETDEV_REGISTER: return netvsc_register_vf(event_dev); case NETDEV_UNREGISTER: @@ -2807,12 +2826,17 @@ } netvsc_ring_bytes = ring_size * PAGE_SIZE; + register_netdevice_notifier(&netvsc_netdev_notifier); + ret = vmbus_driver_register(&netvsc_drv); if (ret) - return ret; + goto err_vmbus_reg; - register_netdevice_notifier(&netvsc_netdev_notifier); return 0; + +err_vmbus_reg: + unregister_netdevice_notifier(&netvsc_netdev_notifier); + return ret; } MODULE_LICENSE("GPL"); diff -u linux-lowlatency-5.15.0/drivers/net/ieee802154/adf7242.c linux-lowlatency-5.15.0/drivers/net/ieee802154/adf7242.c --- linux-lowlatency-5.15.0/drivers/net/ieee802154/adf7242.c +++ linux-lowlatency-5.15.0/drivers/net/ieee802154/adf7242.c @@ -1162,9 +1162,10 @@ static void adf7242_debugfs_init(struct adf7242_local *lp) { - char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "adf7242-"; + char debugfs_dir_name[DNAME_INLINE_LEN + 1]; - strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN); + snprintf(debugfs_dir_name, sizeof(debugfs_dir_name), + "adf7242-%s", dev_name(&lp->spi->dev)); lp->debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL); diff -u linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_core.c linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_core.c --- linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_core.c +++ linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_core.c @@ -412,7 +412,7 @@ return addr; } -static int ipvlan_process_v4_outbound(struct sk_buff *skb) +static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb) { const struct iphdr *ip4h = ip_hdr(skb); struct net_device *dev = skb->dev; @@ -442,25 +442,23 @@ err = ip_local_out(net, skb->sk, skb); if (unlikely(net_xmit_eval(err))) - dev->stats.tx_errors++; + DEV_STATS_INC(dev, tx_errors); else ret = NET_XMIT_SUCCESS; goto out; err: - dev->stats.tx_errors++; + DEV_STATS_INC(dev, tx_errors); kfree_skb(skb); out: return ret; } #if IS_ENABLED(CONFIG_IPV6) -static int ipvlan_process_v6_outbound(struct sk_buff *skb) + +static noinline_for_stack int +ipvlan_route_v6_outbound(struct net_device *dev, struct sk_buff *skb) { const struct ipv6hdr *ip6h = ipv6_hdr(skb); - struct net_device *dev = skb->dev; - struct net *net = dev_net(dev); - struct dst_entry *dst; - int err, ret = NET_XMIT_DROP; struct flowi6 fl6 = { .flowi6_oif = dev->ifindex, .daddr = ip6h->daddr, @@ -470,27 +468,38 @@ .flowi6_mark = skb->mark, .flowi6_proto = ip6h->nexthdr, }; + struct dst_entry *dst; + int err; - dst = ip6_route_output(net, NULL, &fl6); - if (dst->error) { - ret = dst->error; + dst = ip6_route_output(dev_net(dev), NULL, &fl6); + err = dst->error; + if (err) { dst_release(dst); - goto err; + return err; } skb_dst_set(skb, dst); + return 0; +} + +static int ipvlan_process_v6_outbound(struct sk_buff *skb) +{ + struct net_device *dev = skb->dev; + int err, ret = NET_XMIT_DROP; + + err = ipvlan_route_v6_outbound(dev, skb); + if (unlikely(err)) { + DEV_STATS_INC(dev, tx_errors); + kfree_skb(skb); + return err; + } memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); - err = ip6_local_out(net, skb->sk, skb); + err = ip6_local_out(dev_net(dev), skb->sk, skb); if (unlikely(net_xmit_eval(err))) - dev->stats.tx_errors++; + DEV_STATS_INC(dev, tx_errors); else ret = NET_XMIT_SUCCESS; - goto out; -err: - dev->stats.tx_errors++; - kfree_skb(skb); -out: return ret; } #else diff -u linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_main.c linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_main.c --- linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_main.c +++ linux-lowlatency-5.15.0/drivers/net/ipvlan/ipvlan_main.c @@ -324,6 +324,7 @@ s->rx_dropped = rx_errs; s->tx_dropped = tx_drps; } + s->tx_errors = DEV_STATS_READ(dev, tx_errors); } static int ipvlan_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) diff -u linux-lowlatency-5.15.0/drivers/net/macsec.c linux-lowlatency-5.15.0/drivers/net/macsec.c --- linux-lowlatency-5.15.0/drivers/net/macsec.c +++ linux-lowlatency-5.15.0/drivers/net/macsec.c @@ -3681,9 +3681,9 @@ dev_fetch_sw_netstats(s, dev->tstats); - s->rx_dropped = atomic_long_read(&dev->stats.__rx_dropped); - s->tx_dropped = atomic_long_read(&dev->stats.__tx_dropped); - s->rx_errors = atomic_long_read(&dev->stats.__rx_errors); + s->rx_dropped = DEV_STATS_READ(dev, rx_dropped); + s->tx_dropped = DEV_STATS_READ(dev, tx_dropped); + s->rx_errors = DEV_STATS_READ(dev, rx_errors); } static int macsec_get_iflink(const struct net_device *dev) diff -u linux-lowlatency-5.15.0/drivers/net/macvlan.c linux-lowlatency-5.15.0/drivers/net/macvlan.c --- linux-lowlatency-5.15.0/drivers/net/macvlan.c +++ linux-lowlatency-5.15.0/drivers/net/macvlan.c @@ -770,7 +770,7 @@ if (dev->flags & IFF_UP) { if (change & IFF_ALLMULTI) dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1); - if (change & IFF_PROMISC) + if (!macvlan_passthru(vlan->port) && change & IFF_PROMISC) dev_set_promiscuity(lowerdev, dev->flags & IFF_PROMISC ? 1 : -1); diff -u linux-lowlatency-5.15.0/drivers/net/phy/phylink.c linux-lowlatency-5.15.0/drivers/net/phy/phylink.c --- linux-lowlatency-5.15.0/drivers/net/phy/phylink.c +++ linux-lowlatency-5.15.0/drivers/net/phy/phylink.c @@ -853,6 +853,7 @@ pl->config = config; if (config->type == PHYLINK_NETDEV) { pl->netdev = to_net_dev(config->dev); + netif_carrier_off(pl->netdev); } else if (config->type == PHYLINK_DEV) { pl->dev = config->dev; } else { diff -u linux-lowlatency-5.15.0/drivers/net/tun.c linux-lowlatency-5.15.0/drivers/net/tun.c --- linux-lowlatency-5.15.0/drivers/net/tun.c +++ linux-lowlatency-5.15.0/drivers/net/tun.c @@ -3010,10 +3010,11 @@ struct net *net = sock_net(&tfile->sk); struct tun_struct *tun; void __user* argp = (void __user*)arg; - unsigned int ifindex, carrier; + unsigned int carrier; struct ifreq ifr; kuid_t owner; kgid_t group; + int ifindex; int sndbuf; int vnet_hdr_sz; int le; @@ -3069,7 +3070,9 @@ ret = -EFAULT; if (copy_from_user(&ifindex, argp, sizeof(ifindex))) goto unlock; - + ret = -EINVAL; + if (ifindex < 0) + goto unlock; ret = 0; tfile->ifindex = ifindex; goto unlock; diff -u linux-lowlatency-5.15.0/drivers/net/usb/ax88179_178a.c linux-lowlatency-5.15.0/drivers/net/usb/ax88179_178a.c --- linux-lowlatency-5.15.0/drivers/net/usb/ax88179_178a.c +++ linux-lowlatency-5.15.0/drivers/net/usb/ax88179_178a.c @@ -1700,11 +1700,11 @@ *tmp16 = AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); - msleep(200); + msleep(500); *tmp = AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp); - msleep(100); + msleep(200); /* Ethernet PHY Auto Detach*/ ax88179_auto_detach(dev, 0); diff -u linux-lowlatency-5.15.0/drivers/net/usb/r8152.c linux-lowlatency-5.15.0/drivers/net/usb/r8152.c --- linux-lowlatency-5.15.0/drivers/net/usb/r8152.c +++ linux-lowlatency-5.15.0/drivers/net/usb/r8152.c @@ -763,7 +763,7 @@ /* rtl8152 flags */ enum rtl8152_flags { - RTL8152_UNPLUG = 0, + RTL8152_INACCESSIBLE = 0, RTL8152_SET_RX_MODE, WORK_ENABLE, RTL8152_LINK_CHG, @@ -1208,7 +1208,7 @@ ret = usb_control_msg(tp->udev, tp->pipe_ctrl_in, RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, - value, index, tmp, size, 500); + value, index, tmp, size, USB_CTRL_GET_TIMEOUT); if (ret < 0) memset(data, 0xff, size); else @@ -1231,7 +1231,7 @@ ret = usb_control_msg(tp->udev, tp->pipe_ctrl_out, RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, - value, index, tmp, size, 500); + value, index, tmp, size, USB_CTRL_SET_TIMEOUT); kfree(tmp); @@ -1241,7 +1241,7 @@ static void rtl_set_unplug(struct r8152 *tp) { if (tp->udev->state == USB_STATE_NOTATTACHED) { - set_bit(RTL8152_UNPLUG, &tp->flags); + set_bit(RTL8152_INACCESSIBLE, &tp->flags); smp_mb__after_atomic(); } } @@ -1252,7 +1252,7 @@ u16 limit = 64; int ret = 0; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; /* both size and indix must be 4 bytes align */ @@ -1296,7 +1296,7 @@ u16 byteen_start, byteen_end, byen; u16 limit = 512; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; /* both size and indix must be 4 bytes align */ @@ -1526,7 +1526,7 @@ struct r8152 *tp = netdev_priv(netdev); int ret; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; if (phy_id != R8152_PHY_ID) @@ -1542,7 +1542,7 @@ { struct r8152 *tp = netdev_priv(netdev); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (phy_id != R8152_PHY_ID) @@ -1747,7 +1747,7 @@ if (!tp) return; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (!test_bit(WORK_ENABLE, &tp->flags)) @@ -1839,7 +1839,7 @@ if (!test_bit(WORK_ENABLE, &tp->flags)) return; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (!skb_queue_empty(&tp->tx_queue)) @@ -1860,7 +1860,7 @@ if (!test_bit(WORK_ENABLE, &tp->flags)) return; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; switch (status) { @@ -2604,7 +2604,7 @@ { struct r8152 *tp = from_tasklet(tp, t, tx_tl); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (!test_bit(WORK_ENABLE, &tp->flags)) @@ -2647,7 +2647,7 @@ int ret; /* The rx would be stopped, so skip submitting */ - if (test_bit(RTL8152_UNPLUG, &tp->flags) || + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags) || !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev)) return 0; @@ -2850,6 +2850,8 @@ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, CR_RST); for (i = 0; i < 1000; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; if (!(ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR) & CR_RST)) break; usleep_range(100, 400); @@ -3043,7 +3045,7 @@ static int rtl8152_enable(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; set_tx_qlen(tp); @@ -3130,7 +3132,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; set_tx_qlen(tp); @@ -3162,7 +3164,7 @@ u32 ocp_data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); return; } @@ -3179,6 +3181,8 @@ rxdy_gated_en(tp, true); for (i = 0; i < 1000; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY) break; @@ -3186,6 +3190,8 @@ } for (i = 0; i < 1000; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY) break; usleep_range(1000, 2000); @@ -3616,7 +3622,7 @@ } msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) break; } @@ -3648,6 +3654,8 @@ int i; for (i = 0; i < 500; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return; if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & AUTOLOAD_DONE) break; @@ -3688,6 +3696,8 @@ int i; for (i = 0; i < 500; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return; if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & AUTOLOAD_DONE) break; @@ -4051,6 +4061,9 @@ for (i = 0; wait && i < 5000; i++) { u32 ocp_data; + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return -ENODEV; + usleep_range(1000, 2000); ocp_data = ocp_reg_read(tp, OCP_PHY_PATCH_STAT); if ((ocp_data & PATCH_READY) ^ check) @@ -5367,6 +5380,8 @@ int i; for (i = 0; i < 1000; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); if (ocp_data & LINK_LIST_READY) break; @@ -5381,6 +5396,8 @@ int i; for (i = 0; i < 100; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; if (ocp_read_word(tp, MCU_TYPE_USB, USB_GPHY_CTRL) & GPHY_PATCH_DONE) break; usleep_range(1000, 2000); @@ -5503,6 +5520,8 @@ for (i = 0; i < 104; i++) { u32 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_WDT1_CTRL); + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return -ENODEV; if (!(ocp_data & WTD1_EN)) break; usleep_range(1000, 2000); @@ -5659,6 +5678,8 @@ data &= ~EN_ALDPS; ocp_reg_write(tp, OCP_POWER_CFG, data); for (i = 0; i < 20; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return; usleep_range(1000, 2000); if (ocp_read_word(tp, MCU_TYPE_PLA, 0xe000) & 0x0100) break; @@ -6012,7 +6033,7 @@ u32 ocp_data; u16 speed; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; r8156_fc_parameter(tp); @@ -6070,7 +6091,7 @@ u32 ocp_data; u16 speed; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; set_tx_qlen(tp); @@ -6256,7 +6277,7 @@ static void rtl8152_up(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8152_aldps_en(tp, false); @@ -6266,7 +6287,7 @@ static void rtl8152_down(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); return; } @@ -6281,7 +6302,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153_u1u2en(tp, false); @@ -6321,7 +6342,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); return; } @@ -6342,7 +6363,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_u1u2en(tp, false); @@ -6366,7 +6387,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); return; } @@ -6403,7 +6424,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_u1u2en(tp, false); @@ -6484,7 +6505,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_u1u2en(tp, false); @@ -6557,7 +6578,7 @@ { u32 ocp_data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); return; } @@ -6695,7 +6716,7 @@ /* If the device is unplugged or !netif_running(), the workqueue * doesn't need to wake the device, and could return directly. */ - if (test_bit(RTL8152_UNPLUG, &tp->flags) || !netif_running(tp->netdev)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags) || !netif_running(tp->netdev)) return; if (usb_autopm_get_interface(tp->intf) < 0) @@ -6734,7 +6755,7 @@ { struct r8152 *tp = container_of(work, struct r8152, hw_phy_work.work); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (usb_autopm_get_interface(tp->intf) < 0) @@ -6861,7 +6882,7 @@ netif_stop_queue(netdev); res = usb_autopm_get_interface(tp->intf); - if (res < 0 || test_bit(RTL8152_UNPLUG, &tp->flags)) { + if (res < 0 || test_bit(RTL8152_INACCESSIBLE, &tp->flags)) { rtl_drop_queued_tx(tp); rtl_stop_rx(tp); } else { @@ -6894,7 +6915,7 @@ u32 ocp_data; u16 data; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; data = r8152_mdio_read(tp, MII_BMCR); @@ -6938,7 +6959,7 @@ u16 data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153_u1u2en(tp, false); @@ -6949,7 +6970,7 @@ break; msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) break; } @@ -7078,7 +7099,7 @@ u16 data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_u1u2en(tp, false); @@ -7089,7 +7110,7 @@ break; msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) break; } @@ -7160,7 +7181,7 @@ u16 data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_u1u2en(tp, false); @@ -7180,7 +7201,7 @@ break; msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; } @@ -8009,7 +8030,7 @@ u16 data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_ECM_OP); @@ -8030,7 +8051,7 @@ break; msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; } @@ -8105,7 +8126,7 @@ u16 data; int i; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_ECM_OP); @@ -8139,7 +8160,7 @@ break; msleep(20); - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; } @@ -9201,7 +9222,7 @@ struct mii_ioctl_data *data = if_mii(rq); int res; - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return -ENODEV; res = usb_autopm_get_interface(tp->intf); @@ -9303,7 +9324,7 @@ static void rtl8152_unload(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; if (tp->version != RTL_VER_01) @@ -9312,7 +9333,7 @@ static void rtl8153_unload(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153_power_cut_en(tp, false); @@ -9320,7 +9341,7 @@ static void rtl8153b_unload(struct r8152 *tp) { - if (test_bit(RTL8152_UNPLUG, &tp->flags)) + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) return; r8153b_power_cut_en(tp, false); @@ -9538,7 +9559,8 @@ ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, - PLA_TCR0, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); + PLA_TCR0, MCU_TYPE_PLA, tmp, sizeof(*tmp), + USB_CTRL_GET_TIMEOUT); if (ret > 0) ocp_data = (__le32_to_cpu(*tmp) >> 16) & VERSION_MASK; @@ -9801,6 +9823,10 @@ out1: tasklet_kill(&tp->tx_tl); + cancel_delayed_work_sync(&tp->hw_phy_work); + if (tp->rtl_ops.unload) + tp->rtl_ops.unload(tp); + rtl8152_release_firmware(tp); usb_set_intfdata(intf, NULL); out: free_netdev(netdev); diff -u linux-lowlatency-5.15.0/drivers/net/usb/smsc95xx.c linux-lowlatency-5.15.0/drivers/net/usb/smsc95xx.c --- linux-lowlatency-5.15.0/drivers/net/usb/smsc95xx.c +++ linux-lowlatency-5.15.0/drivers/net/usb/smsc95xx.c @@ -84,7 +84,9 @@ ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, index, &buf, 4); - if (ret < 0) { + if (ret < 4) { + ret = ret < 0 ? ret : -ENODATA; + if (ret != -ENODEV) netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n", index, ret); @@ -860,7 +862,7 @@ if (timeout >= 100) { netdev_warn(dev->net, "timeout waiting for completion of Lite Reset\n"); - return ret; + return -ETIMEDOUT; } ret = smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_); diff -u linux-lowlatency-5.15.0/drivers/net/wireguard/device.c linux-lowlatency-5.15.0/drivers/net/wireguard/device.c --- linux-lowlatency-5.15.0/drivers/net/wireguard/device.c +++ linux-lowlatency-5.15.0/drivers/net/wireguard/device.c @@ -193,7 +193,7 @@ */ while (skb_queue_len(&peer->staged_packet_queue) > MAX_STAGED_PACKETS) { dev_kfree_skb(__skb_dequeue(&peer->staged_packet_queue)); - ++dev->stats.tx_dropped; + DEV_STATS_INC(dev, tx_dropped); } skb_queue_splice_tail(&packets, &peer->staged_packet_queue); spin_unlock_bh(&peer->staged_packet_queue.lock); @@ -211,7 +211,7 @@ else if (skb->protocol == htons(ETH_P_IPV6)) icmpv6_ndo_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0); err: - ++dev->stats.tx_errors; + DEV_STATS_INC(dev, tx_errors); kfree_skb(skb); return ret; } diff -u linux-lowlatency-5.15.0/drivers/net/wireguard/receive.c linux-lowlatency-5.15.0/drivers/net/wireguard/receive.c --- linux-lowlatency-5.15.0/drivers/net/wireguard/receive.c +++ linux-lowlatency-5.15.0/drivers/net/wireguard/receive.c @@ -423,20 +423,20 @@ net_dbg_skb_ratelimited("%s: Packet has unallowed src IP (%pISc) from peer %llu (%pISpfsc)\n", dev->name, skb, peer->internal_id, &peer->endpoint.addr); - ++dev->stats.rx_errors; - ++dev->stats.rx_frame_errors; + DEV_STATS_INC(dev, rx_errors); + DEV_STATS_INC(dev, rx_frame_errors); goto packet_processed; dishonest_packet_type: net_dbg_ratelimited("%s: Packet is neither ipv4 nor ipv6 from peer %llu (%pISpfsc)\n", dev->name, peer->internal_id, &peer->endpoint.addr); - ++dev->stats.rx_errors; - ++dev->stats.rx_frame_errors; + DEV_STATS_INC(dev, rx_errors); + DEV_STATS_INC(dev, rx_frame_errors); goto packet_processed; dishonest_packet_size: net_dbg_ratelimited("%s: Packet has incorrect size from peer %llu (%pISpfsc)\n", dev->name, peer->internal_id, &peer->endpoint.addr); - ++dev->stats.rx_errors; - ++dev->stats.rx_length_errors; + DEV_STATS_INC(dev, rx_errors); + DEV_STATS_INC(dev, rx_length_errors); goto packet_processed; packet_processed: dev_kfree_skb(skb); diff -u linux-lowlatency-5.15.0/drivers/net/wireguard/send.c linux-lowlatency-5.15.0/drivers/net/wireguard/send.c --- linux-lowlatency-5.15.0/drivers/net/wireguard/send.c +++ linux-lowlatency-5.15.0/drivers/net/wireguard/send.c @@ -333,7 +333,8 @@ void wg_packet_purge_staged_packets(struct wg_peer *peer) { spin_lock_bh(&peer->staged_packet_queue.lock); - peer->device->dev->stats.tx_dropped += peer->staged_packet_queue.qlen; + DEV_STATS_ADD(peer->device->dev, tx_dropped, + peer->staged_packet_queue.qlen); __skb_queue_purge(&peer->staged_packet_queue); spin_unlock_bh(&peer->staged_packet_queue.lock); } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath10k/snoc.c linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath10k/snoc.c --- linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath10k/snoc.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath10k/snoc.c @@ -828,12 +828,20 @@ static inline void ath10k_snoc_irq_disable(struct ath10k *ar) { - ath10k_ce_disable_interrupts(ar); + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + int id; + + for (id = 0; id < CE_COUNT_MAX; id++) + disable_irq(ar_snoc->ce_irqs[id].irq_line); } static inline void ath10k_snoc_irq_enable(struct ath10k *ar) { - ath10k_ce_enable_interrupts(ar); + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); + int id; + + for (id = 0; id < CE_COUNT_MAX; id++) + enable_irq(ar_snoc->ce_irqs[id].irq_line); } static void ath10k_snoc_rx_pipe_cleanup(struct ath10k_snoc_pipe *snoc_pipe) @@ -1089,6 +1097,8 @@ goto err_free_rri; } + ath10k_ce_enable_interrupts(ar); + return 0; err_free_rri: @@ -1253,8 +1263,8 @@ for (id = 0; id < CE_COUNT_MAX; id++) { ret = request_irq(ar_snoc->ce_irqs[id].irq_line, - ath10k_snoc_per_engine_handler, 0, - ce_name[id], ar); + ath10k_snoc_per_engine_handler, + IRQF_NO_AUTOEN, ce_name[id], ar); if (ret) { ath10k_err(ar, "failed to register IRQ handler for CE %d: %d\n", diff -u linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/dp_rx.c linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/dp_rx.c --- linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/dp_rx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1603,14 +1603,20 @@ u8 pdev_id; pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_INFO_PDEV_ID, data->hdr); + + rcu_read_lock(); + ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id); if (!ar) { ath11k_warn(ab, "invalid pdev id %d on htt pktlog\n", pdev_id); - return; + goto out; } trace_ath11k_htt_pktlog(ar, data->payload, hdr->size, ar->ab->pktlog_defs_checksum); + +out: + rcu_read_unlock(); } static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab, diff -u linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/wmi.c linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/wmi.c --- linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/wmi.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath11k/wmi.c @@ -6809,6 +6809,8 @@ ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, ev->freq_offset, ev->sidx); + rcu_read_lock(); + ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); if (!ar) { @@ -6826,6 +6828,8 @@ ieee80211_radar_detected(ar->hw); exit: + rcu_read_unlock(); + kfree(tb); } @@ -6855,15 +6859,19 @@ ath11k_dbg(ab, ATH11K_DBG_WMI, "pdev temperature ev temp %d pdev_id %d\n", ev->temp, ev->pdev_id); + rcu_read_lock(); + ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); if (!ar) { ath11k_warn(ab, "invalid pdev id in pdev temperature ev %d", ev->pdev_id); - kfree(tb); - return; + goto exit; } ath11k_thermal_event_temperature(ar, ev->temp); +exit: + rcu_read_unlock(); + kfree(tb); } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath9k/htc_drv_debug.c linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath9k/htc_drv_debug.c --- linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath9k/htc_drv_debug.c @@ -428,7 +428,7 @@ u32 sset, u8 *data) { if (sset == ETH_SS_STATS) - memcpy(data, *ath9k_htc_gstrings_stats, + memcpy(data, ath9k_htc_gstrings_stats, sizeof(ath9k_htc_gstrings_stats)); } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/mvm/tx.c linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/mvm/tx.c --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -479,16 +479,20 @@ flags |= IWL_TX_FLAGS_ENCRYPT_DIS; /* - * For data packets rate info comes from the fw. Only - * set rate/antenna during connection establishment or in case - * no station is given. + * For data and mgmt packets rate info comes from the fw. Only + * set rate/antenna for injected frames with fixed rate, or + * when no sta is given. */ - if (!sta || !ieee80211_is_data(hdr->frame_control) || - mvmsta->sta_state < IEEE80211_STA_AUTHORIZED) { + if (unlikely(!sta || + info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)) { flags |= IWL_TX_FLAGS_CMD_RATE; rate_n_flags = iwl_mvm_get_tx_rate_n_flags(mvm, info, sta, hdr->frame_control); + } else if (!ieee80211_is_data(hdr->frame_control) || + mvmsta->sta_state < IEEE80211_STA_AUTHORIZED) { + /* These are important frames */ + flags |= IWL_TX_FLAGS_HIGH_PRI; } if (mvm->trans->trans_cfg->device_family >= @@ -1432,7 +1436,7 @@ seq_ctl = le16_to_cpu(tx_resp->seq_ctl); /* we can free until ssn % q.n_bd not inclusive */ - iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs); + iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs, false); while (!skb_queue_empty(&skbs)) { struct sk_buff *skb = __skb_dequeue(&skbs); @@ -1445,6 +1449,7 @@ iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); memset(&info->status, 0, sizeof(info->status)); + info->flags &= ~(IEEE80211_TX_STAT_ACK | IEEE80211_TX_STAT_TX_FILTERED); /* inform mac80211 about what happened with the frame */ switch (status & TX_STATUS_MSK) { @@ -1776,7 +1781,7 @@ * block-ack window (we assume that they've been successfully * transmitted ... if not, it's too late anyway). */ - iwl_trans_reclaim(mvm->trans, txq, index, &reclaimed_skbs); + iwl_trans_reclaim(mvm->trans, txq, index, &reclaimed_skbs, is_flush); skb_queue_walk(&reclaimed_skbs, skb) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); @@ -1790,6 +1795,8 @@ */ if (!is_flush) info->flags |= IEEE80211_TX_STAT_ACK; + else + info->flags &= ~IEEE80211_TX_STAT_ACK; } /* diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/internal.h linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/internal.h --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/internal.h +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/internal.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* - * Copyright (C) 2003-2015, 2018-2021 Intel Corporation + * Copyright (C) 2003-2015, 2018-2022 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -104,6 +104,18 @@ } __packed; /** + * struct iwl_rx_completion_desc_bz - Bz completion descriptor + * @rbid: unique tag of the received buffer + * @flags: flags (0: fragmented, all others: reserved) + * @reserved: reserved + */ +struct iwl_rx_completion_desc_bz { + __le16 rbid; + u8 flags; + u8 reserved[1]; +} __packed; + +/** * struct iwl_rxq - Rx queue * @id: queue index * @bd: driver's pointer to buffer of receive buffer descriptors (rbd). @@ -133,11 +145,7 @@ int id; void *bd; dma_addr_t bd_dma; - union { - void *used_bd; - __le32 *bd_32; - struct iwl_rx_completion_desc *cd; - }; + void *used_bd; dma_addr_t used_bd_dma; u32 read; u32 write; @@ -472,6 +480,7 @@ void iwl_pcie_rx_free(struct iwl_trans *trans); void iwl_pcie_free_rbs_pool(struct iwl_trans *trans); void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq); +void iwl_pcie_rx_napi_sync(struct iwl_trans *trans); void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority, struct iwl_rxq *rxq); diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2003-2014, 2018-2021 Intel Corporation + * Copyright (C) 2003-2014, 2018-2023 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -652,23 +652,30 @@ iwl_pcie_rx_allocator(trans_pcie->trans); } -static int iwl_pcie_free_bd_size(struct iwl_trans *trans, bool use_rx_td) +static int iwl_pcie_free_bd_size(struct iwl_trans *trans) { - struct iwl_rx_transfer_desc *rx_td; + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) + return sizeof(struct iwl_rx_transfer_desc); - if (use_rx_td) - return sizeof(*rx_td); - else - return trans->trans_cfg->mq_rx_supported ? sizeof(__le64) : - sizeof(__le32); + return trans->trans_cfg->mq_rx_supported ? + sizeof(__le64) : sizeof(__le32); +} + +static int iwl_pcie_used_bd_size(struct iwl_trans *trans) +{ + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) + return sizeof(struct iwl_rx_completion_desc_bz); + + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) + return sizeof(struct iwl_rx_completion_desc); + + return sizeof(__le32); } static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans, struct iwl_rxq *rxq) { - bool use_rx_td = (trans->trans_cfg->device_family >= - IWL_DEVICE_FAMILY_AX210); - int free_size = iwl_pcie_free_bd_size(trans, use_rx_td); + int free_size = iwl_pcie_free_bd_size(trans); if (rxq->bd) dma_free_coherent(trans->dev, @@ -682,8 +689,8 @@ if (rxq->used_bd) dma_free_coherent(trans->dev, - (use_rx_td ? sizeof(*rxq->cd) : - sizeof(__le32)) * rxq->queue_size, + iwl_pcie_used_bd_size(trans) * + rxq->queue_size, rxq->used_bd, rxq->used_bd_dma); rxq->used_bd_dma = 0; rxq->used_bd = NULL; @@ -707,7 +714,7 @@ else rxq->queue_size = RX_QUEUE_SIZE; - free_size = iwl_pcie_free_bd_size(trans, use_rx_td); + free_size = iwl_pcie_free_bd_size(trans); /* * Allocate the circular buffer of Read Buffer Descriptors @@ -720,7 +727,8 @@ if (trans->trans_cfg->mq_rx_supported) { rxq->used_bd = dma_alloc_coherent(dev, - (use_rx_td ? sizeof(*rxq->cd) : sizeof(__le32)) * rxq->queue_size, + iwl_pcie_used_bd_size(trans) * + rxq->queue_size, &rxq->used_bd_dma, GFP_KERNEL); if (!rxq->used_bd) @@ -1042,6 +1050,22 @@ return ret; } +void iwl_pcie_rx_napi_sync(struct iwl_trans *trans) +{ + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + int i; + + if (unlikely(!trans_pcie->rxq)) + return; + + for (i = 0; i < trans->num_rx_queues; i++) { + struct iwl_rxq *rxq = &trans_pcie->rxq[i]; + + if (rxq && rxq->napi.poll) + napi_synchronize(&rxq->napi); + } +} + static int _iwl_pcie_rx_init(struct iwl_trans *trans) { struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); @@ -1419,6 +1443,7 @@ u16 vid; BUILD_BUG_ON(sizeof(struct iwl_rx_completion_desc) != 32); + BUILD_BUG_ON(sizeof(struct iwl_rx_completion_desc_bz) != 4); if (!trans->trans_cfg->mq_rx_supported) { rxb = rxq->queue[i]; @@ -1426,11 +1451,20 @@ return rxb; } - if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) { - vid = le16_to_cpu(rxq->cd[i].rbid); - *join = rxq->cd[i].flags & IWL_RX_CD_FLAGS_FRAGMENTED; + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) { + struct iwl_rx_completion_desc_bz *cd = rxq->used_bd; + + vid = le16_to_cpu(cd[i].rbid); + *join = cd[i].flags & IWL_RX_CD_FLAGS_FRAGMENTED; + } else if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) { + struct iwl_rx_completion_desc *cd = rxq->used_bd; + + vid = le16_to_cpu(cd[i].rbid); + *join = cd[i].flags & IWL_RX_CD_FLAGS_FRAGMENTED; } else { - vid = le32_to_cpu(rxq->bd_32[i]) & 0x0FFF; /* 12-bit VID */ + __le32 *cd = rxq->used_bd; + + vid = le32_to_cpu(cd[i]) & 0x0FFF; /* 12-bit VID */ } if (!vid || vid > RX_POOL_SIZE(trans_pcie->num_rx_bufs)) diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c @@ -165,6 +165,8 @@ if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); + iwl_pcie_synchronize_irqs(trans); + iwl_pcie_rx_napi_sync(trans); iwl_txq_gen2_tx_free(trans); iwl_pcie_rx_stop(trans); } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans.c linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans.c --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -1197,6 +1197,8 @@ if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); + iwl_pcie_synchronize_irqs(trans); + iwl_pcie_rx_napi_sync(trans); iwl_pcie_tx_stop(trans); iwl_pcie_rx_stop(trans); diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.c linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.c --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1520,7 +1520,7 @@ /* Frees buffers until index _not_ inclusive */ void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn, - struct sk_buff_head *skbs) + struct sk_buff_head *skbs, bool is_flush) { struct iwl_txq *txq = trans->txqs.txq[txq_id]; int tfd_num = iwl_txq_get_cmd_index(txq, ssn); @@ -1591,9 +1591,11 @@ if (iwl_txq_space(trans, txq) > txq->low_mark && test_bit(txq_id, trans->txqs.queue_stopped)) { struct sk_buff_head overflow_skbs; + struct sk_buff *skb; __skb_queue_head_init(&overflow_skbs); - skb_queue_splice_init(&txq->overflow_q, &overflow_skbs); + skb_queue_splice_init(&txq->overflow_q, + is_flush ? skbs : &overflow_skbs); /* * We are going to transmit from the overflow queue. @@ -1613,8 +1615,7 @@ */ spin_unlock_bh(&txq->lock); - while (!skb_queue_empty(&overflow_skbs)) { - struct sk_buff *skb = __skb_dequeue(&overflow_skbs); + while ((skb = __skb_dequeue(&overflow_skbs))) { struct iwl_device_tx_cmd *dev_cmd_ptr; dev_cmd_ptr = *(void **)((u8 *)skb->cb + diff -u linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.h linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.h --- linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.h +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/queue/tx.h @@ -174,7 +174,7 @@ struct iwl_txq *txq, u16 byte_cnt, int num_tbs); void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn, - struct sk_buff_head *skbs); + struct sk_buff_head *skbs, bool is_flush); void iwl_txq_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr); void iwl_trans_txq_freeze_timer(struct iwl_trans *trans, unsigned long txqs, bool freeze); diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mac80211_hwsim.c linux-lowlatency-5.15.0/drivers/net/wireless/mac80211_hwsim.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mac80211_hwsim.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mac80211_hwsim.c @@ -2615,7 +2615,7 @@ u32 sset, u8 *data) { if (sset == ETH_SS_STATS) - memcpy(data, *mac80211_hwsim_gstrings_stats, + memcpy(data, mac80211_hwsim_gstrings_stats, sizeof(mac80211_hwsim_gstrings_stats)); } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c linux-lowlatency-5.15.0/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c --- linux-lowlatency-5.15.0/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c @@ -933,6 +933,14 @@ while (tlv_buf_left >= sizeof(*tlv_rxba)) { tlv_type = le16_to_cpu(tlv_rxba->header.type); tlv_len = le16_to_cpu(tlv_rxba->header.len); + if (size_add(sizeof(tlv_rxba->header), tlv_len) > tlv_buf_left) { + mwifiex_dbg(priv->adapter, WARN, + "TLV size (%zu) overflows event_buf buf_left=%d\n", + size_add(sizeof(tlv_rxba->header), tlv_len), + tlv_buf_left); + return; + } + if (tlv_type != TLV_TYPE_RXBA_SYNC) { mwifiex_dbg(priv->adapter, ERROR, "Wrong TLV id=0x%x\n", tlv_type); @@ -941,6 +949,14 @@ tlv_seq_num = le16_to_cpu(tlv_rxba->seq_num); tlv_bitmap_len = le16_to_cpu(tlv_rxba->bitmap_len); + if (size_add(sizeof(*tlv_rxba), tlv_bitmap_len) > tlv_buf_left) { + mwifiex_dbg(priv->adapter, WARN, + "TLV size (%zu) overflows event_buf buf_left=%d\n", + size_add(sizeof(*tlv_rxba), tlv_bitmap_len), + tlv_buf_left); + return; + } + mwifiex_dbg(priv->adapter, INFO, "%pM tid=%d seq_num=%d bitmap_len=%d\n", tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num, diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/dma.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/dma.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/dma.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/dma.c @@ -16,11 +16,11 @@ int size; size = L1_CACHE_ALIGN(dev->drv->txwi_size + sizeof(*t)); - txwi = devm_kzalloc(dev->dev, size, GFP_ATOMIC); + txwi = kzalloc(size, GFP_ATOMIC); if (!txwi) return NULL; - addr = dma_map_single(dev->dev, txwi, dev->drv->txwi_size, + addr = dma_map_single(dev->dma_dev, txwi, dev->drv->txwi_size, DMA_TO_DEVICE); t = (struct mt76_txwi_cache *)(txwi + dev->drv->txwi_size); t->dma_addr = addr; @@ -73,9 +73,11 @@ struct mt76_txwi_cache *t; local_bh_disable(); - while ((t = __mt76_get_txwi(dev)) != NULL) - dma_unmap_single(dev->dev, t->dma_addr, dev->drv->txwi_size, + while ((t = __mt76_get_txwi(dev)) != NULL) { + dma_unmap_single(dev->dma_dev, t->dma_addr, dev->drv->txwi_size, DMA_TO_DEVICE); + kfree(mt76_get_txwi_ptr(dev, t)); + } local_bh_enable(); } @@ -121,7 +123,7 @@ q->hw_idx = idx; size = q->ndesc * sizeof(struct mt76_desc); - q->desc = dmam_alloc_coherent(dev->dev, size, &q->desc_dma, GFP_KERNEL); + q->desc = dmam_alloc_coherent(dev->dma_dev, size, &q->desc_dma, GFP_KERNEL); if (!q->desc) return -ENOMEM; @@ -203,11 +205,11 @@ struct mt76_queue_entry *e = &q->entry[idx]; if (!e->skip_buf0) - dma_unmap_single(dev->dev, e->dma_addr[0], e->dma_len[0], + dma_unmap_single(dev->dma_dev, e->dma_addr[0], e->dma_len[0], DMA_TO_DEVICE); if (!e->skip_buf1) - dma_unmap_single(dev->dev, e->dma_addr[1], e->dma_len[1], + dma_unmap_single(dev->dma_dev, e->dma_addr[1], e->dma_len[1], DMA_TO_DEVICE); if (e->txwi == DMA_DUMMY_DATA) @@ -288,7 +290,7 @@ if (info) *info = le32_to_cpu(desc->info); - dma_unmap_single(dev->dev, buf_addr, buf_len, DMA_FROM_DEVICE); + dma_unmap_single(dev->dma_dev, buf_addr, buf_len, DMA_FROM_DEVICE); e->buf = NULL; return buf; @@ -325,9 +327,9 @@ if (q->queued + 1 >= q->ndesc - 1) goto error; - addr = dma_map_single(dev->dev, skb->data, skb->len, + addr = dma_map_single(dev->dma_dev, skb->data, skb->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev->dev, addr))) + if (unlikely(dma_mapping_error(dev->dma_dev, addr))) goto error; buf.addr = addr; @@ -347,8 +349,8 @@ static int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, - struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta) + enum mt76_txq_id qid, struct sk_buff *skb, + struct mt76_wcid *wcid, struct ieee80211_sta *sta) { struct ieee80211_tx_status status = { .sta = sta, @@ -374,8 +376,8 @@ mt76_insert_hdr_pad(skb); len = skb_headlen(skb); - addr = dma_map_single(dev->dev, skb->data, len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev->dev, addr))) + addr = dma_map_single(dev->dma_dev, skb->data, len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(dev->dma_dev, addr))) goto free; tx_info.buf[n].addr = t->dma_addr; @@ -387,9 +389,9 @@ if (n == ARRAY_SIZE(tx_info.buf)) goto unmap; - addr = dma_map_single(dev->dev, iter->data, iter->len, + addr = dma_map_single(dev->dma_dev, iter->data, iter->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev->dev, addr))) + if (unlikely(dma_mapping_error(dev->dma_dev, addr))) goto unmap; tx_info.buf[n].addr = addr; @@ -402,10 +404,10 @@ goto unmap; } - dma_sync_single_for_cpu(dev->dev, t->dma_addr, dev->drv->txwi_size, + dma_sync_single_for_cpu(dev->dma_dev, t->dma_addr, dev->drv->txwi_size, DMA_TO_DEVICE); - ret = dev->drv->tx_prepare_skb(dev, txwi, q->qid, wcid, sta, &tx_info); - dma_sync_single_for_device(dev->dev, t->dma_addr, dev->drv->txwi_size, + ret = dev->drv->tx_prepare_skb(dev, txwi, qid, wcid, sta, &tx_info); + dma_sync_single_for_device(dev->dma_dev, t->dma_addr, dev->drv->txwi_size, DMA_TO_DEVICE); if (ret < 0) goto unmap; @@ -415,7 +417,7 @@ unmap: for (n--; n > 0; n--) - dma_unmap_single(dev->dev, tx_info.buf[n].addr, + dma_unmap_single(dev->dma_dev, tx_info.buf[n].addr, tx_info.buf[n].len, DMA_TO_DEVICE); free: @@ -459,8 +461,8 @@ if (!buf) break; - addr = dma_map_single(dev->dev, buf, len, DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(dev->dev, addr))) { + addr = dma_map_single(dev->dma_dev, buf, len, DMA_FROM_DEVICE); + if (unlikely(dma_mapping_error(dev->dma_dev, addr))) { skb_free_frag(buf); break; } diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mac80211.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mac80211.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mac80211.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -449,6 +449,7 @@ dev->hw = hw; dev->dev = pdev; dev->drv = drv_ops; + dev->dma_dev = pdev; phy = &dev->phy; phy->dev = dev; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt76.h linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt76.h --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt76.h +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt76.h @@ -195,8 +195,8 @@ u32 ring_base); int (*tx_queue_skb)(struct mt76_dev *dev, struct mt76_queue *q, - struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta); + enum mt76_txq_id qid, struct sk_buff *skb, + struct mt76_wcid *wcid, struct ieee80211_sta *sta); int (*tx_queue_skb_raw)(struct mt76_dev *dev, struct mt76_queue *q, struct sk_buff *skb, u32 tx_info); @@ -667,6 +667,7 @@ const struct mt76_driver_ops *drv; const struct mt76_mcu_ops *mcu_ops; struct device *dev; + struct device *dma_dev; struct mt76_mcu mcu; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/mac.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/mac.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -1561,20 +1561,29 @@ { u32 addr, val; - if (mt76_rr(dev, MT_MCU_DEBUG_RESET) & MT_MCU_DEBUG_RESET_QUEUES) - return true; - if (mt7603_rx_fifo_busy(dev)) - return false; + goto out; addr = mt7603_reg_map(dev, MT_CLIENT_BASE_PHYS_ADDR + MT_CLIENT_STATUS); mt76_wr(dev, addr, 3); val = mt76_rr(dev, addr) >> 16; - if (is_mt7628(dev) && (val & 0x4001) == 0x4001) - return true; + if (!(val & BIT(0))) + return false; + + if (is_mt7628(dev)) + val &= 0xa000; + else + val &= 0x8000; + if (!val) + return false; + +out: + if (mt76_rr(dev, MT_INT_SOURCE_CSR) & + (MT_INT_RX_DONE(0) | MT_INT_RX_DONE(1))) + return false; - return (val & 0x8001) == 0x8001 || (val & 0xe001) == 0xe001; + return true; } static bool diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/sdio.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/sdio.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/sdio.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/sdio.c @@ -243,8 +243,8 @@ static int mt76s_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, - struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta) + enum mt76_txq_id qid, struct sk_buff *skb, + struct mt76_wcid *wcid, struct ieee80211_sta *sta) { struct mt76_tx_info tx_info = { .skb = skb, @@ -256,7 +256,7 @@ return -ENOSPC; skb->prev = skb->next = NULL; - err = dev->drv->tx_prepare_skb(dev, NULL, q->qid, wcid, sta, &tx_info); + err = dev->drv->tx_prepare_skb(dev, NULL, qid, wcid, sta, &tx_info); if (err < 0) return err; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/testmode.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/testmode.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/testmode.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/testmode.c @@ -49,8 +49,8 @@ q->queued < q->ndesc / 2) { int ret; - ret = dev->queue_ops->tx_queue_skb(dev, q, skb_get(skb), wcid, - NULL); + ret = dev->queue_ops->tx_queue_skb(dev, q, qid, skb_get(skb), + wcid, NULL); if (ret < 0) break; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/tx.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/tx.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/tx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/tx.c @@ -259,7 +259,7 @@ int idx; non_aql = !info->tx_time_est; - idx = dev->queue_ops->tx_queue_skb(dev, q, skb, wcid, sta); + idx = dev->queue_ops->tx_queue_skb(dev, q, qid, skb, wcid, sta); if (idx < 0 || !sta) return idx; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/usb.c linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/usb.c --- linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/usb.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/usb.c @@ -901,8 +901,8 @@ static int mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, - struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta) + enum mt76_txq_id qid, struct sk_buff *skb, + struct mt76_wcid *wcid, struct ieee80211_sta *sta) { struct mt76_tx_info tx_info = { .skb = skb, @@ -914,7 +914,7 @@ return -ENOSPC; skb->prev = skb->next = NULL; - err = dev->drv->tx_prepare_skb(dev, NULL, q->qid, wcid, sta, &tx_info); + err = dev->drv->tx_prepare_skb(dev, NULL, qid, wcid, sta, &tx_info); if (err < 0) return err; diff -u linux-lowlatency-5.15.0/drivers/net/wireless/microchip/wilc1000/wlan.c linux-lowlatency-5.15.0/drivers/net/wireless/microchip/wilc1000/wlan.c --- linux-lowlatency-5.15.0/drivers/net/wireless/microchip/wilc1000/wlan.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -1458,7 +1458,7 @@ } if (!wilc->vmm_table) - wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL); + wilc->vmm_table = kcalloc(WILC_VMM_TBL_SIZE, sizeof(u32), GFP_KERNEL); if (!wilc->vmm_table) { ret = -ENOBUFS; diff -u linux-lowlatency-5.15.0/drivers/nvdimm/region_devs.c linux-lowlatency-5.15.0/drivers/nvdimm/region_devs.c --- linux-lowlatency-5.15.0/drivers/nvdimm/region_devs.c +++ linux-lowlatency-5.15.0/drivers/nvdimm/region_devs.c @@ -966,7 +966,8 @@ { unsigned int cpu, lane; - cpu = get_cpu(); + migrate_disable(); + cpu = smp_processor_id(); if (nd_region->num_lanes < nr_cpu_ids) { struct nd_percpu_lane *ndl_lock, *ndl_count; @@ -985,16 +986,15 @@ void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane) { if (nd_region->num_lanes < nr_cpu_ids) { - unsigned int cpu = get_cpu(); + unsigned int cpu = smp_processor_id(); struct nd_percpu_lane *ndl_lock, *ndl_count; ndl_count = per_cpu_ptr(nd_region->lane, cpu); ndl_lock = per_cpu_ptr(nd_region->lane, lane); if (--ndl_count->count == 0) spin_unlock(&ndl_lock->lock); - put_cpu(); } - put_cpu(); + migrate_enable(); } EXPORT_SYMBOL(nd_region_release_lane); diff -u linux-lowlatency-5.15.0/drivers/nvme/host/nvme.h linux-lowlatency-5.15.0/drivers/nvme/host/nvme.h --- linux-lowlatency-5.15.0/drivers/nvme/host/nvme.h +++ linux-lowlatency-5.15.0/drivers/nvme/host/nvme.h @@ -154,6 +154,11 @@ * No temperature thresholds for channels other than 0 (Composite). */ NVME_QUIRK_NO_SECONDARY_TEMP_THRESH = (1 << 19), + + /* + * Disables simple suspend/resume path. + */ + NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND = (1 << 20), }; /* diff -u linux-lowlatency-5.15.0/drivers/nvme/host/pci.c linux-lowlatency-5.15.0/drivers/nvme/host/pci.c --- linux-lowlatency-5.15.0/drivers/nvme/host/pci.c +++ linux-lowlatency-5.15.0/drivers/nvme/host/pci.c @@ -2953,6 +2953,18 @@ if ((dmi_match(DMI_BOARD_VENDOR, "LENOVO")) && dmi_match(DMI_BOARD_NAME, "LNVNB161216")) return NVME_QUIRK_SIMPLE_SUSPEND; + } else if (pdev->vendor == 0x2646 && (pdev->device == 0x2263 || + pdev->device == 0x500f)) { + /* + * Exclude some Kingston NV1 and A2000 devices from + * NVME_QUIRK_SIMPLE_SUSPEND. Do a full suspend to save a + * lot fo energy with s2idle sleep on some TUXEDO platforms. + */ + if (dmi_match(DMI_BOARD_NAME, "NS5X_NS7XAU") || + dmi_match(DMI_BOARD_NAME, "NS5x_7xAU") || + dmi_match(DMI_BOARD_NAME, "NS5x_7xPU") || + dmi_match(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1")) + return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND; } return 0; @@ -2993,7 +3005,9 @@ dev->dev = get_device(&pdev->dev); quirks |= check_vendor_combination_bug(pdev); - if (!noacpi && acpi_storage_d3(&pdev->dev)) { + if (!noacpi && + !(quirks & NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND) && + acpi_storage_d3(&pdev->dev)) { /* * Some systems use a bios work around to ask for D3 on * platforms that support kernel managed suspend. @@ -3307,7 +3321,8 @@ { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ .driver_data = NVME_QUIRK_STRIPE_SIZE | NVME_QUIRK_DEALLOCATE_ZEROES | - NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + NVME_QUIRK_IGNORE_DEV_SUBNQN | + NVME_QUIRK_BOGUS_NID, }, { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ .driver_data = NVME_QUIRK_STRIPE_SIZE | NVME_QUIRK_DEALLOCATE_ZEROES, }, diff -u linux-lowlatency-5.15.0/drivers/nvme/host/rdma.c linux-lowlatency-5.15.0/drivers/nvme/host/rdma.c --- linux-lowlatency-5.15.0/drivers/nvme/host/rdma.c +++ linux-lowlatency-5.15.0/drivers/nvme/host/rdma.c @@ -645,6 +645,9 @@ static void nvme_rdma_stop_queue(struct nvme_rdma_queue *queue) { + if (!test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) + return; + mutex_lock(&queue->queue_lock); if (test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags)) __nvme_rdma_stop_queue(queue); diff -u linux-lowlatency-5.15.0/drivers/of/dynamic.c linux-lowlatency-5.15.0/drivers/of/dynamic.c --- linux-lowlatency-5.15.0/drivers/of/dynamic.c +++ linux-lowlatency-5.15.0/drivers/of/dynamic.c @@ -104,8 +104,9 @@ * * Returns the new state of a device based on the notifier used. * - * Return: 0 on device going from enabled to disabled, 1 on device - * going from disabled to enabled and -1 on no change. + * Return: OF_RECONFIG_CHANGE_REMOVE on device going from enabled to + * disabled, OF_RECONFIG_CHANGE_ADD on device going from disabled to + * enabled and OF_RECONFIG_NO_CHANGE on no change. */ int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr) { diff -u linux-lowlatency-5.15.0/drivers/parport/parport_pc.c linux-lowlatency-5.15.0/drivers/parport/parport_pc.c --- linux-lowlatency-5.15.0/drivers/parport/parport_pc.c +++ linux-lowlatency-5.15.0/drivers/parport/parport_pc.c @@ -2613,6 +2613,8 @@ netmos_9865, quatech_sppxp100, wch_ch382l, + brainboxes_uc146, + brainboxes_px203, }; @@ -2676,6 +2678,8 @@ /* netmos_9865 */ { 1, { { 0, -1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, /* wch_ch382l */ { 1, { { 2, -1 }, } }, + /* brainboxes_uc146 */ { 1, { { 3, -1 }, } }, + /* brainboxes_px203 */ { 1, { { 0, -1 }, } }, }; static const struct pci_device_id parport_pc_pci_tbl[] = { @@ -2767,6 +2771,23 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, /* WCH CH382L PCI-E single parallel port card */ { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l }, + /* Brainboxes IX-500/550 */ + { PCI_VENDOR_ID_INTASHIELD, 0x402a, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport }, + /* Brainboxes UC-146/UC-157 */ + { PCI_VENDOR_ID_INTASHIELD, 0x0be1, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_uc146 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0be2, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_uc146 }, + /* Brainboxes PX-146/PX-257 */ + { PCI_VENDOR_ID_INTASHIELD, 0x401c, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport }, + /* Brainboxes PX-203 */ + { PCI_VENDOR_ID_INTASHIELD, 0x4007, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_px203 }, + /* Brainboxes PX-475 */ + { PCI_VENDOR_ID_INTASHIELD, 0x401f, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport }, { 0, } /* terminate list */ }; MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl); diff -u linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pcie-tegra194.c linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pcie-tegra194.c --- linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pcie-tegra194.c +++ linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pcie-tegra194.c @@ -7,6 +7,7 @@ * Author: Vidya Sagar */ +#include #include #include #include @@ -328,8 +329,7 @@ */ val = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA); if (val & PCI_EXP_LNKSTA_LBMS) { - current_link_width = (val & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + current_link_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, val); if (pcie->init_link_width > current_link_width) { dev_warn(pci->dev, "PCIe link is bad, width reduced\n"); val = dw_pcie_readw_dbi(pci, pcie->pcie_cap_base + @@ -731,8 +731,7 @@ val_w = dw_pcie_readw_dbi(&pcie->pci, pcie->pcie_cap_base + PCI_EXP_LNKSTA); - pcie->init_link_width = (val_w & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + pcie->init_link_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, val_w); val_w = dw_pcie_readw_dbi(&pcie->pci, pcie->pcie_cap_base + PCI_EXP_LNKCTL); @@ -889,7 +888,7 @@ /* Configure Max lane width from DT */ val = dw_pcie_readl_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKCAP); val &= ~PCI_EXP_LNKCAP_MLW; - val |= (pcie->num_lanes << PCI_EXP_LNKSTA_NLW_SHIFT); + val |= FIELD_PREP(PCI_EXP_LNKCAP_MLW, pcie->num_lanes); dw_pcie_writel_dbi(pci, pcie->pcie_cap_base + PCI_EXP_LNKCAP, val); config_gen3_gen4_eq_presets(pcie); diff -u linux-lowlatency-5.15.0/drivers/pci/pci-acpi.c linux-lowlatency-5.15.0/drivers/pci/pci-acpi.c --- linux-lowlatency-5.15.0/drivers/pci/pci-acpi.c +++ linux-lowlatency-5.15.0/drivers/pci/pci-acpi.c @@ -910,7 +910,7 @@ { int acpi_state, d_max; - if (pdev->no_d3cold) + if (pdev->no_d3cold || !pdev->d3cold_allowed) d_max = ACPI_STATE_D3_HOT; else d_max = ACPI_STATE_D3_COLD; diff -u linux-lowlatency-5.15.0/drivers/pci/pci-sysfs.c linux-lowlatency-5.15.0/drivers/pci/pci-sysfs.c --- linux-lowlatency-5.15.0/drivers/pci/pci-sysfs.c +++ linux-lowlatency-5.15.0/drivers/pci/pci-sysfs.c @@ -12,7 +12,7 @@ * Modeled after usb's driverfs.c */ - +#include #include #include #include @@ -208,8 +208,7 @@ if (err) return -EINVAL; - return sysfs_emit(buf, "%u\n", - (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT); + return sysfs_emit(buf, "%u\n", FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat)); } static DEVICE_ATTR_RO(current_link_width); @@ -509,10 +508,7 @@ return -EINVAL; pdev->d3cold_allowed = !!val; - if (pdev->d3cold_allowed) - pci_d3cold_enable(pdev); - else - pci_d3cold_disable(pdev); + pci_bridge_d3_update(pdev); pm_runtime_resume(dev); diff -u linux-lowlatency-5.15.0/drivers/pci/pci.c linux-lowlatency-5.15.0/drivers/pci/pci.c --- linux-lowlatency-5.15.0/drivers/pci/pci.c +++ linux-lowlatency-5.15.0/drivers/pci/pci.c @@ -3679,14 +3679,14 @@ return 0; pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); - cap &= PCI_REBAR_CAP_SIZES; + cap = FIELD_GET(PCI_REBAR_CAP_SIZES, cap); /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && - bar == 0 && cap == 0x7000) - cap = 0x3f000; + bar == 0 && cap == 0x700) + return 0x3f00; - return cap >> 4; + return cap; } EXPORT_SYMBOL(pci_rebar_get_possible_sizes); @@ -6102,8 +6102,7 @@ pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta); next_speed = pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS]; - next_width = (lnksta & PCI_EXP_LNKSTA_NLW) >> - PCI_EXP_LNKSTA_NLW_SHIFT; + next_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, lnksta); next_bw = next_width * PCIE_SPEED2MBS_ENC(next_speed); @@ -6175,7 +6174,7 @@ pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); if (lnkcap) - return (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4; + return FIELD_GET(PCI_EXP_LNKCAP_MLW, lnkcap); return PCIE_LNK_WIDTH_UNKNOWN; } diff -u linux-lowlatency-5.15.0/drivers/pci/pcie/aspm.c linux-lowlatency-5.15.0/drivers/pci/pcie/aspm.c --- linux-lowlatency-5.15.0/drivers/pci/pcie/aspm.c +++ linux-lowlatency-5.15.0/drivers/pci/pcie/aspm.c @@ -1287,6 +1287,8 @@ link->aspm_disable &= ~ASPM_STATE_L1; } else { link->aspm_disable |= state; + if (state & ASPM_STATE_L1) + link->aspm_disable |= ASPM_STATE_L1SS; } pcie_config_aspm_link(link, policy_to_aspm_state(link)); diff -u linux-lowlatency-5.15.0/drivers/pci/quirks.c linux-lowlatency-5.15.0/drivers/pci/quirks.c --- linux-lowlatency-5.15.0/drivers/pci/quirks.c +++ linux-lowlatency-5.15.0/drivers/pci/quirks.c @@ -607,7 +607,7 @@ /* * In the AMD NL platform, this device ([1022:7912]) has a class code of * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will - * claim it. + * claim it. The same applies on the VanGogh platform device ([1022:163a]). * * But the dwc3 driver is a more specific driver for this device, and we'd * prefer to use it instead of xhci. To prevent xhci from claiming the @@ -615,7 +615,7 @@ * defines as "USB device (not host controller)". The dwc3 driver can then * claim it based on its Vendor and Device ID. */ -static void quirk_amd_nl_class(struct pci_dev *pdev) +static void quirk_amd_dwc_class(struct pci_dev *pdev) { u32 class = pdev->class; @@ -625,7 +625,9 @@ class, pdev->class); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, - quirk_amd_nl_class); + quirk_amd_dwc_class); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VANGOGH_USB, + quirk_amd_dwc_class); /* * Synopsys USB 3.x host HAPS platform has a class code of @@ -5392,6 +5394,12 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); #ifdef CONFIG_PCI_ATS +static void quirk_no_ats(struct pci_dev *pdev) +{ + pci_info(pdev, "disabling ATS\n"); + pdev->ats_cap = 0; +} + /* * Some devices require additional driver setup to enable ATS. Don't use * ATS for those devices as ATS will be enabled before the driver has had a @@ -5405,14 +5413,10 @@ (pdev->subsystem_device == 0xce19 || pdev->subsystem_device == 0xcc10 || pdev->subsystem_device == 0xcc08)) - goto no_ats; - else - return; + quirk_no_ats(pdev); + } else { + quirk_no_ats(pdev); } - -no_ats: - pci_info(pdev, "disabling ATS\n"); - pdev->ats_cap = 0; } /* AMD Stoney platform GPU */ @@ -5435,6 +5439,25 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x734f, quirk_amd_harvest_no_ats); /* AMD Raven platform iGPU */ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x15d8, quirk_amd_harvest_no_ats); + +/* + * Intel IPU E2000 revisions before C0 implement incorrect endianness + * in ATS Invalidate Request message body. Disable ATS for those devices. + */ +static void quirk_intel_e2000_no_ats(struct pci_dev *pdev) +{ + if (pdev->revision < 0x20) + quirk_no_ats(pdev); +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1451, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1452, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1453, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1454, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1455, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1457, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1459, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145a, quirk_intel_e2000_no_ats); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145c, quirk_intel_e2000_no_ats); #endif /* CONFIG_PCI_ATS */ /* Freescale PCIe doesn't support MSI in RC mode */ diff -u linux-lowlatency-5.15.0/drivers/pcmcia/cs.c linux-lowlatency-5.15.0/drivers/pcmcia/cs.c --- linux-lowlatency-5.15.0/drivers/pcmcia/cs.c +++ linux-lowlatency-5.15.0/drivers/pcmcia/cs.c @@ -605,6 +605,7 @@ dev_warn(&skt->dev, "PCMCIA: unable to register socket\n"); skt->thread = NULL; complete(&skt->thread_done); + put_device(&skt->dev); return 0; } ret = pccard_sysfs_add_socket(&skt->dev); diff -u linux-lowlatency-5.15.0/drivers/phy/motorola/phy-mapphone-mdm6600.c linux-lowlatency-5.15.0/drivers/phy/motorola/phy-mapphone-mdm6600.c --- linux-lowlatency-5.15.0/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ linux-lowlatency-5.15.0/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -122,16 +122,10 @@ { struct phy_mdm6600 *ddata = phy_get_drvdata(x); struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE]; - int error; if (!ddata->enabled) return -ENODEV; - error = pinctrl_pm_select_default_state(ddata->dev); - if (error) - dev_warn(ddata->dev, "%s: error with default_state: %i\n", - __func__, error); - gpiod_set_value_cansleep(enable_gpio, 1); /* Allow aggressive PM for USB, it's only needed for n_gsm port */ @@ -160,11 +154,6 @@ gpiod_set_value_cansleep(enable_gpio, 0); - error = pinctrl_pm_select_sleep_state(ddata->dev); - if (error) - dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", - __func__, error); - return 0; } @@ -456,6 +445,7 @@ { struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET]; + int error; ddata->enabled = false; phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_BP_SHUTDOWN_REQ); @@ -471,6 +461,17 @@ } else { dev_err(ddata->dev, "Timed out powering down\n"); } + + /* + * Keep reset gpio high with padconf internal pull-up resistor to + * prevent modem from waking up during deeper SoC idle states. The + * gpio bank lines can have glitches if not in the always-on wkup + * domain. + */ + error = pinctrl_pm_select_sleep_state(ddata->dev); + if (error) + dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", + __func__, error); } static void phy_mdm6600_deferred_power_on(struct work_struct *work) @@ -571,12 +572,6 @@ ddata->dev = &pdev->dev; platform_set_drvdata(pdev, ddata); - /* Active state selected in phy_mdm6600_power_on() */ - error = pinctrl_pm_select_sleep_state(ddata->dev); - if (error) - dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", - __func__, error); - error = phy_mdm6600_init_lines(ddata); if (error) return error; @@ -627,10 +622,12 @@ pm_runtime_put_autosuspend(ddata->dev); cleanup: - if (error < 0) + if (error < 0) { phy_mdm6600_device_power_off(ddata); - pm_runtime_disable(ddata->dev); - pm_runtime_dont_use_autosuspend(ddata->dev); + pm_runtime_disable(ddata->dev); + pm_runtime_dont_use_autosuspend(ddata->dev); + } + return error; } @@ -639,6 +636,7 @@ struct phy_mdm6600 *ddata = platform_get_drvdata(pdev); struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET]; + pm_runtime_get_noresume(ddata->dev); pm_runtime_dont_use_autosuspend(ddata->dev); pm_runtime_put_sync(ddata->dev); pm_runtime_disable(ddata->dev); diff -u linux-lowlatency-5.15.0/drivers/pinctrl/core.c linux-lowlatency-5.15.0/drivers/pinctrl/core.c --- linux-lowlatency-5.15.0/drivers/pinctrl/core.c +++ linux-lowlatency-5.15.0/drivers/pinctrl/core.c @@ -1239,17 +1239,17 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) { struct pinctrl_setting *setting, *setting2; - struct pinctrl_state *old_state = p->state; + struct pinctrl_state *old_state = READ_ONCE(p->state); int ret; - if (p->state) { + if (old_state) { /* * For each pinmux setting in the old state, forget SW's record * of mux owner for that pingroup. Any pingroups which are * still owned by the new state will be re-acquired by the call * to pinmux_enable_setting() in the loop below. */ - list_for_each_entry(setting, &p->state->settings, node) { + list_for_each_entry(setting, &old_state->settings, node) { if (setting->type != PIN_MAP_TYPE_MUX_GROUP) continue; pinmux_disable_setting(setting); diff -u linux-lowlatency-5.15.0/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c linux-lowlatency-5.15.0/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c --- linux-lowlatency-5.15.0/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ linux-lowlatency-5.15.0/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -102,7 +102,8 @@ char __iomem *tlmm_base; char __iomem *slew_base; struct clk_bulk_data clks[MAX_LPI_NUM_CLKS]; - struct mutex slew_access_lock; + /* Protects from concurrent register updates */ + struct mutex lock; const struct lpi_pinctrl_variant_data *data; }; @@ -330,9 +331,11 @@ if (WARN_ON(i == g->nfuncs)) return -EINVAL; + mutex_lock(&pctrl->lock); val = lpi_gpio_read(pctrl, pin, LPI_GPIO_CFG_REG); u32p_replace_bits(&val, i, LPI_GPIO_FUNCTION_MASK); lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val); + mutex_unlock(&pctrl->lock); return 0; } @@ -438,14 +441,14 @@ if (slew_offset == NO_SLEW) break; - mutex_lock(&pctrl->slew_access_lock); + mutex_lock(&pctrl->lock); sval = ioread32(pctrl->slew_base + LPI_SLEW_RATE_CTL_REG); sval &= ~(LPI_SLEW_RATE_MASK << slew_offset); sval |= arg << slew_offset; iowrite32(sval, pctrl->slew_base + LPI_SLEW_RATE_CTL_REG); - mutex_unlock(&pctrl->slew_access_lock); + mutex_unlock(&pctrl->lock); break; default: return -EINVAL; @@ -461,6 +464,7 @@ lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val); } + mutex_lock(&pctrl->lock); val = lpi_gpio_read(pctrl, group, LPI_GPIO_CFG_REG); u32p_replace_bits(&val, pullup, LPI_GPIO_PULL_MASK); @@ -469,6 +473,7 @@ u32p_replace_bits(&val, output_enabled, LPI_GPIO_OE_MASK); lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val); + mutex_unlock(&pctrl->lock); return 0; } @@ -642,7 +647,7 @@ pctrl->chip.of_gpio_n_cells = 2; pctrl->chip.can_sleep = false; - mutex_init(&pctrl->slew_access_lock); + mutex_init(&pctrl->lock); pctrl->ctrl = devm_pinctrl_register(dev, &pctrl->desc, pctrl); if (IS_ERR(pctrl->ctrl)) { @@ -660,7 +665,7 @@ return 0; err_pinctrl: - mutex_destroy(&pctrl->slew_access_lock); + mutex_destroy(&pctrl->lock); clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); return ret; @@ -670,7 +675,7 @@ { struct lpi_pinctrl *pctrl = platform_get_drvdata(pdev); - mutex_destroy(&pctrl->slew_access_lock); + mutex_destroy(&pctrl->lock); clk_bulk_disable_unprepare(MAX_LPI_NUM_CLKS, pctrl->clks); return 0; diff -u linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-pmc.c linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-pmc.c --- linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-pmc.c +++ linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-pmc.c @@ -1202,6 +1202,8 @@ attr->dev_attr.show = mlxbf_pmc_event_list_show; attr->nr = blk_num; attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, "event_list"); + if (!attr->dev_attr.attr.name) + return -ENOMEM; pmc->block[blk_num].block_attr[i] = &attr->dev_attr.attr; attr = NULL; @@ -1214,6 +1216,8 @@ attr->nr = blk_num; attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, "enable"); + if (!attr->dev_attr.attr.name) + return -ENOMEM; pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; attr = NULL; } @@ -1240,6 +1244,8 @@ attr->nr = blk_num; attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, "counter%d", j); + if (!attr->dev_attr.attr.name) + return -ENOMEM; pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; attr = NULL; @@ -1251,6 +1257,8 @@ attr->nr = blk_num; attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, "event%d", j); + if (!attr->dev_attr.attr.name) + return -ENOMEM; pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; attr = NULL; } @@ -1283,6 +1291,8 @@ attr->nr = blk_num; attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, events[j].evt_name); + if (!attr->dev_attr.attr.name) + return -ENOMEM; pmc->block[blk_num].block_attr[i] = &attr->dev_attr.attr; attr = NULL; i++; @@ -1311,6 +1321,8 @@ pmc->block[blk_num].block_attr_grp.attrs = pmc->block[blk_num].block_attr; pmc->block[blk_num].block_attr_grp.name = devm_kasprintf( dev, GFP_KERNEL, pmc->block_name[blk_num]); + if (!pmc->block[blk_num].block_attr_grp.name) + return -ENOMEM; pmc->groups[blk_num] = &pmc->block[blk_num].block_attr_grp; return 0; @@ -1442,6 +1454,8 @@ pmc->hwmon_dev = devm_hwmon_device_register_with_groups( dev, "bfperf", pmc, pmc->groups); + if (IS_ERR(pmc->hwmon_dev)) + return PTR_ERR(pmc->hwmon_dev); platform_set_drvdata(pdev, pmc); return 0; diff -u linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-tmfifo.c linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-tmfifo.c --- linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-tmfifo.c +++ linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -588,24 +588,25 @@ if (vring->cur_len + sizeof(u64) <= len) { /* The whole word. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, sizeof(u64)); - else - memcpy(&data, addr + vring->cur_len, - sizeof(u64)); + } else { + memcpy(&data, addr + vring->cur_len, + sizeof(u64)); } vring->cur_len += sizeof(u64); } else { /* Leftover bytes. */ - if (!IS_VRING_DROP(vring)) { - if (is_rx) + if (is_rx) { + if (!IS_VRING_DROP(vring)) memcpy(addr + vring->cur_len, &data, len - vring->cur_len); - else - memcpy(&data, addr + vring->cur_len, - len - vring->cur_len); + } else { + data = 0; + memcpy(&data, addr + vring->cur_len, + len - vring->cur_len); } vring->cur_len = len; } diff -u linux-lowlatency-5.15.0/drivers/platform/surface/aggregator/core.c linux-lowlatency-5.15.0/drivers/platform/surface/aggregator/core.c --- linux-lowlatency-5.15.0/drivers/platform/surface/aggregator/core.c +++ linux-lowlatency-5.15.0/drivers/platform/surface/aggregator/core.c @@ -230,9 +230,12 @@ size_t n) { struct ssam_controller *ctrl; + int ret; ctrl = serdev_device_get_drvdata(dev); - return ssam_controller_receive_buf(ctrl, buf, n); + ret = ssam_controller_receive_buf(ctrl, buf, n); + + return ret < 0 ? 0 : ret; } static void ssam_write_wakeup(struct serdev_device *dev) diff -u linux-lowlatency-5.15.0/drivers/platform/x86/Kconfig linux-lowlatency-5.15.0/drivers/platform/x86/Kconfig --- linux-lowlatency-5.15.0/drivers/platform/x86/Kconfig +++ linux-lowlatency-5.15.0/drivers/platform/x86/Kconfig @@ -272,6 +272,7 @@ depends on RFKILL || RFKILL = n depends on HOTPLUG_PCI depends on ACPI_VIDEO || ACPI_VIDEO = n + depends on SERIO_I8042 || SERIO_I8042 = n select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS @@ -286,7 +287,6 @@ config ASUS_NB_WMI tristate "Asus Notebook WMI Driver" depends on ASUS_WMI - depends on SERIO_I8042 || SERIO_I8042 = n help This is a driver for newer Asus notebooks. It adds extra features like wireless radio and bluetooth control, leds, hotkeys, backlight... diff -u linux-lowlatency-5.15.0/drivers/platform/x86/asus-nb-wmi.c linux-lowlatency-5.15.0/drivers/platform/x86/asus-nb-wmi.c --- linux-lowlatency-5.15.0/drivers/platform/x86/asus-nb-wmi.c +++ linux-lowlatency-5.15.0/drivers/platform/x86/asus-nb-wmi.c @@ -115,12 +115,17 @@ }; static struct quirk_entry quirk_asus_use_kbd_dock_devid = { - .use_kbd_dock_devid = true, + .tablet_switch_mode = asus_wmi_kbd_dock_devid, }; static struct quirk_entry quirk_asus_use_lid_flip_devid = { .wmi_backlight_set_devstate = true, - .use_lid_flip_devid = true, + .tablet_switch_mode = asus_wmi_lid_flip_devid, +}; + +static struct quirk_entry quirk_asus_tablet_mode = { + .wmi_backlight_set_devstate = true, + .tablet_switch_mode = asus_wmi_lid_flip_rog_devid, }; static int dmi_matched(const struct dmi_system_id *dmi) @@ -471,13 +476,20 @@ }, .driver_data = &quirk_asus_use_lid_flip_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS ROG FLOW X13", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GV301Q"), + }, + .driver_data = &quirk_asus_tablet_mode, + }, {}, }; static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver) { - int ret; - quirks = &quirk_asus_unknown; dmi_check_system(asus_quirks); @@ -490,34 +502,16 @@ else wapf = quirks->wapf; - switch (tablet_mode_sw) { - case 0: - quirks->use_kbd_dock_devid = false; - quirks->use_lid_flip_devid = false; - break; - case 1: - quirks->use_kbd_dock_devid = true; - quirks->use_lid_flip_devid = false; - break; - case 2: - quirks->use_kbd_dock_devid = false; - quirks->use_lid_flip_devid = true; - break; - } - - if (quirks->i8042_filter) { - ret = i8042_install_filter(quirks->i8042_filter); - if (ret) { - pr_warn("Unable to install key filter\n"); - return; - } - pr_info("Using i8042 filter function for receiving events\n"); - } + if (tablet_mode_sw != -1) + quirks->tablet_switch_mode = tablet_mode_sw; } static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, ASUS_WMI_BRN_DOWN, { KEY_BRIGHTNESSDOWN } }, { KE_KEY, ASUS_WMI_BRN_UP, { KEY_BRIGHTNESSUP } }, + { KE_KEY, 0x2a, { KEY_SELECTIVE_SCREENSHOT } }, + { KE_IGNORE, 0x2b, }, /* PrintScreen (also send via PS/2) on newer models */ + { KE_IGNORE, 0x2c, }, /* CapsLock (also send via PS/2) on newer models */ { KE_KEY, 0x30, { KEY_VOLUMEUP } }, { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, { KE_KEY, 0x32, { KEY_MUTE } }, @@ -581,6 +575,7 @@ { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ + { KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */ { KE_END, 0}, }; diff -u linux-lowlatency-5.15.0/drivers/platform/x86/asus-wmi.c linux-lowlatency-5.15.0/drivers/platform/x86/asus-wmi.c --- linux-lowlatency-5.15.0/drivers/platform/x86/asus-wmi.c +++ linux-lowlatency-5.15.0/drivers/platform/x86/asus-wmi.c @@ -68,6 +68,7 @@ #define NOTIFY_KBD_FBM 0x99 #define NOTIFY_KBD_TTP 0xae #define NOTIFY_LID_FLIP 0xfa +#define NOTIFY_LID_FLIP_ROG 0xbd #define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0) @@ -203,6 +204,10 @@ struct asus_rfkill gps; struct asus_rfkill uwb; + int tablet_switch_event_code; + u32 tablet_switch_dev_id; + bool tablet_switch_inverted; + enum fan_type fan_type; int fan_pwm_mode; int agfn_pwm; @@ -363,10 +368,35 @@ } /* Input **********************************************************************/ +static void asus_wmi_tablet_sw_report(struct asus_wmi *asus, bool value) +{ + input_report_switch(asus->inputdev, SW_TABLET_MODE, + asus->tablet_switch_inverted ? !value : value); + input_sync(asus->inputdev); +} + +static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event_code) +{ + struct device *dev = &asus->platform_device->dev; + int result; + + result = asus_wmi_get_devstate_simple(asus, dev_id); + if (result >= 0) { + input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); + asus_wmi_tablet_sw_report(asus, result); + asus->tablet_switch_dev_id = dev_id; + asus->tablet_switch_event_code = event_code; + } else if (result == -ENODEV) { + dev_err(dev, "This device has tablet-mode-switch quirk but got ENODEV checking it. This is a bug."); + } else { + dev_err(dev, "Error checking for tablet-mode-switch: %d\n", result); + } +} static int asus_wmi_input_init(struct asus_wmi *asus) { - int err, result; + struct device *dev = &asus->platform_device->dev; + int err; asus->inputdev = input_allocate_device(); if (!asus->inputdev) @@ -375,35 +405,26 @@ asus->inputdev->name = asus->driver->input_name; asus->inputdev->phys = asus->driver->input_phys; asus->inputdev->id.bustype = BUS_HOST; - asus->inputdev->dev.parent = &asus->platform_device->dev; + asus->inputdev->dev.parent = dev; set_bit(EV_REP, asus->inputdev->evbit); err = sparse_keymap_setup(asus->inputdev, asus->driver->keymap, NULL); if (err) goto err_free_dev; - if (asus->driver->quirks->use_kbd_dock_devid) { - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK); - if (result >= 0) { - input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); - input_report_switch(asus->inputdev, SW_TABLET_MODE, !result); - } else if (result != -ENODEV) { - pr_err("Error checking for keyboard-dock: %d\n", result); - } - } - - if (asus->driver->quirks->use_lid_flip_devid) { - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP); - if (result < 0) - asus->driver->quirks->use_lid_flip_devid = 0; - if (result >= 0) { - input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); - input_report_switch(asus->inputdev, SW_TABLET_MODE, result); - } else if (result == -ENODEV) { - pr_err("This device has lid_flip quirk but got ENODEV checking it. This is a bug."); - } else { - pr_err("Error checking for lid-flip: %d\n", result); - } + switch (asus->driver->quirks->tablet_switch_mode) { + case asus_wmi_no_tablet_switch: + break; + case asus_wmi_kbd_dock_devid: + asus->tablet_switch_inverted = true; + asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE); + break; + case asus_wmi_lid_flip_devid: + asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP, NOTIFY_LID_FLIP); + break; + case asus_wmi_lid_flip_rog_devid: + asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP_ROG, NOTIFY_LID_FLIP_ROG); + break; } err = input_register_device(asus->inputdev); @@ -427,14 +448,16 @@ /* Tablet mode ****************************************************************/ -static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus) +static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) { - int result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP); + int result; - if (result >= 0) { - input_report_switch(asus->inputdev, SW_TABLET_MODE, result); - input_sync(asus->inputdev); - } + if (!asus->tablet_switch_dev_id) + return; + + result = asus_wmi_get_devstate_simple(asus, asus->tablet_switch_dev_id); + if (result >= 0) + asus_wmi_tablet_sw_report(asus, result); } /* dGPU ********************************************************************/ @@ -2486,9 +2509,7 @@ { unsigned int key_value = 1; bool autorelease = 1; - int result, orig_code; - - orig_code = code; + int orig_code = code; if (asus->driver->key_filter) { asus->driver->key_filter(asus->driver, &code, &key_value, @@ -2531,19 +2552,8 @@ return; } - if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) { - result = asus_wmi_get_devstate_simple(asus, - ASUS_WMI_DEVID_KBD_DOCK); - if (result >= 0) { - input_report_switch(asus->inputdev, SW_TABLET_MODE, - !result); - input_sync(asus->inputdev); - } - return; - } - - if (asus->driver->quirks->use_lid_flip_devid && code == NOTIFY_LID_FLIP) { - lid_flip_tablet_mode_get_state(asus); + if (code == asus->tablet_switch_event_code) { + asus_wmi_tablet_mode_get_state(asus); return; } @@ -3089,6 +3099,12 @@ goto fail_wmi_handler; } + if (asus->driver->quirks->i8042_filter) { + err = i8042_install_filter(asus->driver->quirks->i8042_filter); + if (err) + pr_warn("Unable to install key filter - %d\n", err); + } + asus_wmi_battery_init(asus); asus_wmi_debugfs_init(asus); @@ -3125,6 +3141,8 @@ struct asus_wmi *asus; asus = platform_get_drvdata(device); + if (asus->driver->quirks->i8042_filter) + i8042_remove_filter(asus->driver->quirks->i8042_filter); wmi_remove_notify_handler(asus->driver->event_guid); asus_wmi_backlight_exit(asus); asus_wmi_input_exit(asus); @@ -3173,9 +3191,7 @@ if (asus_wmi_has_fnlock_key(asus)) asus_wmi_fnlock_update(asus); - if (asus->driver->quirks->use_lid_flip_devid) - lid_flip_tablet_mode_get_state(asus); - + asus_wmi_tablet_mode_get_state(asus); return 0; } @@ -3215,9 +3231,7 @@ if (asus_wmi_has_fnlock_key(asus)) asus_wmi_fnlock_update(asus); - if (asus->driver->quirks->use_lid_flip_devid) - lid_flip_tablet_mode_get_state(asus); - + asus_wmi_tablet_mode_get_state(asus); return 0; } diff -u linux-lowlatency-5.15.0/drivers/platform/x86/thinkpad_acpi.c linux-lowlatency-5.15.0/drivers/platform/x86/thinkpad_acpi.c --- linux-lowlatency-5.15.0/drivers/platform/x86/thinkpad_acpi.c +++ linux-lowlatency-5.15.0/drivers/platform/x86/thinkpad_acpi.c @@ -9766,6 +9766,7 @@ * Individual addressing is broken on models that expose the * primary battery as BAT1. */ + TPACPI_Q_LNV('8', 'F', true), /* Thinkpad X120e */ TPACPI_Q_LNV('J', '7', true), /* B5400 */ TPACPI_Q_LNV('J', 'I', true), /* Thinkpad 11e */ TPACPI_Q_LNV3('R', '0', 'B', true), /* Thinkpad 11e gen 3 */ diff -u linux-lowlatency-5.15.0/drivers/platform/x86/touchscreen_dmi.c linux-lowlatency-5.15.0/drivers/platform/x86/touchscreen_dmi.c --- linux-lowlatency-5.15.0/drivers/platform/x86/touchscreen_dmi.c +++ linux-lowlatency-5.15.0/drivers/platform/x86/touchscreen_dmi.c @@ -743,6 +743,21 @@ .properties = pipo_w11_props, }; +static const struct property_entry positivo_c4128b_props[] = { + PROPERTY_ENTRY_U32("touchscreen-min-x", 4), + PROPERTY_ENTRY_U32("touchscreen-min-y", 13), + PROPERTY_ENTRY_U32("touchscreen-size-x", 1915), + PROPERTY_ENTRY_U32("touchscreen-size-y", 1269), + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-positivo-c4128b.fw"), + PROPERTY_ENTRY_U32("silead,max-fingers", 10), + { } +}; + +static const struct ts_dmi_data positivo_c4128b_data = { + .acpi_name = "MSSL1680:00", + .properties = positivo_c4128b_props, +}; + static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = { PROPERTY_ENTRY_U32("touchscreen-min-x", 32), PROPERTY_ENTRY_U32("touchscreen-min-y", 16), @@ -1443,6 +1458,14 @@ }, }, { + /* Positivo C4128B */ + .driver_data = (void *)&positivo_c4128b_data, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), + DMI_MATCH(DMI_PRODUCT_NAME, "C4128B-1"), + }, + }, + { /* Point of View mobii wintab p800w (v2.0) */ .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data, .matches = { diff -u linux-lowlatency-5.15.0/drivers/platform/x86/wmi.c linux-lowlatency-5.15.0/drivers/platform/x86/wmi.c --- linux-lowlatency-5.15.0/drivers/platform/x86/wmi.c +++ linux-lowlatency-5.15.0/drivers/platform/x86/wmi.c @@ -99,6 +99,12 @@ }; MODULE_DEVICE_TABLE(acpi, wmi_device_ids); +/* allow duplicate GUIDs as these device drivers use struct wmi_driver */ +static const char * const allow_duplicates[] = { + "05901221-D566-11D1-B2F0-00A0C9062910", /* wmi-bmof */ + NULL +}; + static struct platform_driver acpi_wmi_driver = { .driver = { .name = "acpi-wmi", @@ -188,7 +194,7 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable) { - struct guid_block *block = NULL; + struct guid_block *block; char method[5]; acpi_status status; acpi_handle handle; @@ -262,8 +268,8 @@ acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance, u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) { - struct guid_block *block = NULL; - struct wmi_block *wblock = NULL; + struct guid_block *block; + struct wmi_block *wblock; acpi_handle handle; acpi_status status; struct acpi_object_list input; @@ -310,7 +316,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, struct acpi_buffer *out) { - struct guid_block *block = NULL; + struct guid_block *block; acpi_handle handle; acpi_status status, wc_status = AE_ERROR; struct acpi_object_list input; @@ -423,8 +429,8 @@ acpi_status wmi_set_block(const char *guid_string, u8 instance, const struct acpi_buffer *in) { - struct guid_block *block = NULL; struct wmi_block *wblock = NULL; + struct guid_block *block; acpi_handle handle; struct acpi_object_list input; union acpi_object params[2]; @@ -827,21 +833,13 @@ } static int wmi_char_open(struct inode *inode, struct file *filp) { - const char *driver_name = filp->f_path.dentry->d_iname; - struct wmi_block *wblock = NULL; - struct wmi_block *next = NULL; - - list_for_each_entry_safe(wblock, next, &wmi_block_list, list) { - if (!wblock->dev.dev.driver) - continue; - if (strcmp(driver_name, wblock->dev.dev.driver->name) == 0) { - filp->private_data = wblock; - break; - } - } + /* + * The miscdevice already stores a pointer to itself + * inside filp->private_data + */ + struct wmi_block *wblock = container_of(filp->private_data, struct wmi_block, char_dev); - if (!filp->private_data) - return -ENODEV; + filp->private_data = wblock; return nonseekable_open(inode, filp); } @@ -861,8 +859,8 @@ struct wmi_ioctl_buffer __user *input = (struct wmi_ioctl_buffer __user *) arg; struct wmi_block *wblock = filp->private_data; - struct wmi_ioctl_buffer *buf = NULL; - struct wmi_driver *wdriver = NULL; + struct wmi_ioctl_buffer *buf; + struct wmi_driver *wdriver; int ret; if (_IOC_TYPE(cmd) != WMI_IOC) @@ -1047,6 +1045,23 @@ .release = wmi_dev_release, }; +/* + * _WDG is a static list that is only parsed at startup, + * so it's safe to count entries without extra protection. + */ +static int guid_count(const guid_t *guid) +{ + struct wmi_block *wblock; + int count = 0; + + list_for_each_entry(wblock, &wmi_block_list, list) { + if (guid_equal(&wblock->gblock.guid, guid)) + count++; + } + + return count; +} + static int wmi_create_device(struct device *wmi_bus_dev, struct wmi_block *wblock, struct acpi_device *device) @@ -1054,6 +1069,7 @@ struct acpi_device_info *info; char method[5]; int result; + uint count; if (wblock->gblock.flags & ACPI_WMI_EVENT) { wblock->dev.dev.type = &wmi_type_event; @@ -1110,7 +1126,11 @@ wblock->dev.dev.bus = &wmi_bus_type; wblock->dev.dev.parent = wmi_bus_dev; - dev_set_name(&wblock->dev.dev, "%pUL", &wblock->gblock.guid); + count = guid_count(&wblock->gblock.guid); + if (count) + dev_set_name(&wblock->dev.dev, "%pUL-%d", &wblock->gblock.guid, count); + else + dev_set_name(&wblock->dev.dev, "%pUL", &wblock->gblock.guid); device_initialize(&wblock->dev.dev); @@ -1130,11 +1150,22 @@ } } -static bool guid_already_parsed(struct acpi_device *device, const guid_t *guid) +static bool guid_already_parsed_for_legacy(struct acpi_device *device, const guid_t *guid) { struct wmi_block *wblock; list_for_each_entry(wblock, &wmi_block_list, list) { + int i; + + /* skip warning and register if we know the driver will use struct wmi_driver */ + for (i = 0; allow_duplicates[i] != NULL; i++) { + guid_t tmp; + + if (guid_parse(allow_duplicates[i], &tmp)) + continue; + if (guid_equal(&tmp, guid)) + return false; + } if (guid_equal(&wblock->gblock.guid, guid)) { /* * Because we historically didn't track the relationship @@ -1161,8 +1192,8 @@ struct wmi_block *wblock, *next; union acpi_object *obj; acpi_status status; - int retval = 0; u32 i, total; + int retval; status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out); if (ACPI_FAILURE(status)) @@ -1173,8 +1204,8 @@ return -ENXIO; if (obj->type != ACPI_TYPE_BUFFER) { - retval = -ENXIO; - goto out_free_pointer; + kfree(obj); + return -ENXIO; } gblock = (const struct guid_block *)obj->buffer.pointer; @@ -1184,19 +1215,18 @@ if (debug_dump_wdg) wmi_dump_wdg(&gblock[i]); - /* - * Some WMI devices, like those for nVidia hooks, have a - * duplicate GUID. It's not clear what we should do in this - * case yet, so for now, we'll just ignore the duplicate - * for device creation. - */ - if (guid_already_parsed(device, &gblock[i].guid)) + if (!gblock[i].instance_count) { + dev_info(wmi_bus_dev, FW_INFO "%pUL has zero instances\n", &gblock[i].guid); + continue; + } + + if (guid_already_parsed_for_legacy(device, &gblock[i].guid)) continue; wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); if (!wblock) { - retval = -ENOMEM; - break; + dev_err(wmi_bus_dev, "Failed to allocate %pUL\n", &gblock[i].guid); + continue; } wblock->acpi_device = device; @@ -1235,9 +1265,9 @@ } } -out_free_pointer: - kfree(out.pointer); - return retval; + kfree(obj); + + return 0; } /* diff -u linux-lowlatency-5.15.0/drivers/ptp/ptp_clock.c linux-lowlatency-5.15.0/drivers/ptp/ptp_clock.c --- linux-lowlatency-5.15.0/drivers/ptp/ptp_clock.c +++ linux-lowlatency-5.15.0/drivers/ptp/ptp_clock.c @@ -56,10 +56,11 @@ dst->t.sec = seconds; dst->t.nsec = remainder; + /* Both WRITE_ONCE() are paired with READ_ONCE() in queue_cnt() */ if (!queue_free(queue)) - queue->head = (queue->head + 1) % PTP_MAX_TIMESTAMPS; + WRITE_ONCE(queue->head, (queue->head + 1) % PTP_MAX_TIMESTAMPS); - queue->tail = (queue->tail + 1) % PTP_MAX_TIMESTAMPS; + WRITE_ONCE(queue->tail, (queue->tail + 1) % PTP_MAX_TIMESTAMPS); spin_unlock_irqrestore(&queue->lock, flags); } diff -u linux-lowlatency-5.15.0/drivers/ptp/ptp_sysfs.c linux-lowlatency-5.15.0/drivers/ptp/ptp_sysfs.c --- linux-lowlatency-5.15.0/drivers/ptp/ptp_sysfs.c +++ linux-lowlatency-5.15.0/drivers/ptp/ptp_sysfs.c @@ -79,7 +79,8 @@ qcnt = queue_cnt(queue); if (qcnt) { event = queue->buf[queue->head]; - queue->head = (queue->head + 1) % PTP_MAX_TIMESTAMPS; + /* Paired with READ_ONCE() in queue_cnt() */ + WRITE_ONCE(queue->head, (queue->head + 1) % PTP_MAX_TIMESTAMPS); } spin_unlock_irqrestore(&queue->lock, flags); diff -u linux-lowlatency-5.15.0/drivers/regulator/core.c linux-lowlatency-5.15.0/drivers/regulator/core.c --- linux-lowlatency-5.15.0/drivers/regulator/core.c +++ linux-lowlatency-5.15.0/drivers/regulator/core.c @@ -5649,15 +5649,11 @@ mutex_lock(®ulator_list_mutex); regulator_ena_gpio_free(rdev); mutex_unlock(®ulator_list_mutex); - put_device(&rdev->dev); - rdev = NULL; clean: if (dangling_of_gpiod) gpiod_put(config->ena_gpiod); - if (rdev && rdev->dev.of_node) - of_node_put(rdev->dev.of_node); - kfree(rdev); kfree(config); + put_device(&rdev->dev); rinse: if (dangling_cfg_gpiod) gpiod_put(cfg->ena_gpiod); diff -u linux-lowlatency-5.15.0/drivers/rpmsg/qcom_glink_native.c linux-lowlatency-5.15.0/drivers/rpmsg/qcom_glink_native.c --- linux-lowlatency-5.15.0/drivers/rpmsg/qcom_glink_native.c +++ linux-lowlatency-5.15.0/drivers/rpmsg/qcom_glink_native.c @@ -1395,6 +1395,7 @@ struct glink_channel *channel = to_glink_channel(rpdev->ept); channel->rpdev = NULL; + kfree(rpdev->driver_override); kfree(rpdev); } @@ -1623,6 +1624,7 @@ /* Release qcom_glink_alloc_channel() reference */ kref_put(&channel->refcount, qcom_glink_channel_release); + kfree(rpdev->driver_override); kfree(rpdev); } diff -u linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_core.c linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_core.c --- linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_core.c +++ linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_core.c @@ -376,7 +376,8 @@ const char *buf, size_t sz) \ { \ struct rpmsg_device *rpdev = to_rpmsg_device(dev); \ - char *new, *old; \ + const char *old; \ + char *new; \ \ new = kstrndup(buf, sz, GFP_KERNEL); \ if (!new) \ @@ -568,24 +569,52 @@ .remove = rpmsg_dev_remove, }; -int rpmsg_register_device(struct rpmsg_device *rpdev) +/* + * A helper for registering rpmsg device with driver override and name. + * Drivers should not be using it, but instead rpmsg_register_device(). + */ +int rpmsg_register_device_override(struct rpmsg_device *rpdev, + const char *driver_override) { struct device *dev = &rpdev->dev; int ret; + if (driver_override) + strcpy(rpdev->id.name, driver_override); + dev_set_name(&rpdev->dev, "%s.%s.%d.%d", dev_name(dev->parent), rpdev->id.name, rpdev->src, rpdev->dst); rpdev->dev.bus = &rpmsg_bus; - ret = device_register(&rpdev->dev); + device_initialize(dev); + if (driver_override) { + ret = driver_set_override(dev, &rpdev->driver_override, + driver_override, + strlen(driver_override)); + if (ret) { + dev_err(dev, "device_set_override failed: %d\n", ret); + put_device(dev); + return ret; + } + } + + ret = device_add(dev); if (ret) { - dev_err(dev, "device_register failed: %d\n", ret); + dev_err(dev, "device_add failed: %d\n", ret); + kfree(rpdev->driver_override); + rpdev->driver_override = NULL; put_device(&rpdev->dev); } return ret; } +EXPORT_SYMBOL(rpmsg_register_device_override); + +int rpmsg_register_device(struct rpmsg_device *rpdev) +{ + return rpmsg_register_device_override(rpdev, NULL); +} EXPORT_SYMBOL(rpmsg_register_device); /* diff -u linux-lowlatency-5.15.0/drivers/s390/block/dasd.c linux-lowlatency-5.15.0/drivers/s390/block/dasd.c --- linux-lowlatency-5.15.0/drivers/s390/block/dasd.c +++ linux-lowlatency-5.15.0/drivers/s390/block/dasd.c @@ -697,18 +697,20 @@ * we count each request only once. */ device = cqr->startdev; - if (device->profile.data) { - counter = 1; /* request is not yet queued on the start device */ - list_for_each(l, &device->ccw_queue) - if (++counter >= 31) - break; - } + if (!device->profile.data) + return; + + spin_lock(get_ccwdev_lock(device->cdev)); + counter = 1; /* request is not yet queued on the start device */ + list_for_each(l, &device->ccw_queue) + if (++counter >= 31) + break; + spin_unlock(get_ccwdev_lock(device->cdev)); + spin_lock(&device->profile.lock); - if (device->profile.data) { - device->profile.data->dasd_io_nr_req[counter]++; - if (rq_data_dir(req) == READ) - device->profile.data->dasd_read_nr_req[counter]++; - } + device->profile.data->dasd_io_nr_req[counter]++; + if (rq_data_dir(req) == READ) + device->profile.data->dasd_read_nr_req[counter]++; spin_unlock(&device->profile.lock); } diff -u linux-lowlatency-5.15.0/drivers/s390/cio/css.c linux-lowlatency-5.15.0/drivers/s390/cio/css.c --- linux-lowlatency-5.15.0/drivers/s390/cio/css.c +++ linux-lowlatency-5.15.0/drivers/s390/cio/css.c @@ -233,17 +233,19 @@ */ ret = dma_set_coherent_mask(&sch->dev, DMA_BIT_MASK(31)); if (ret) - goto err; + goto err_lock; /* * But we don't have such restrictions imposed on the stuff that * is handled by the streaming API. */ ret = dma_set_mask(&sch->dev, DMA_BIT_MASK(64)); if (ret) - goto err; + goto err_lock; return sch; +err_lock: + kfree(sch->lock); err: kfree(sch); return ERR_PTR(ret); diff -u linux-lowlatency-5.15.0/drivers/s390/crypto/ap_bus.c linux-lowlatency-5.15.0/drivers/s390/crypto/ap_bus.c --- linux-lowlatency-5.15.0/drivers/s390/crypto/ap_bus.c +++ linux-lowlatency-5.15.0/drivers/s390/crypto/ap_bus.c @@ -959,6 +959,10 @@ void ap_bus_force_rescan(void) { + /* Only trigger AP bus scans after the initial scan is done */ + if (atomic64_read(&ap_scan_bus_count) <= 0) + return; + /* processing a asynchronous bus rescan */ del_timer(&ap_config_timer); queue_work(system_long_wq, &ap_scan_work); diff -u linux-lowlatency-5.15.0/drivers/scsi/be2iscsi/be_main.c linux-lowlatency-5.15.0/drivers/scsi/be2iscsi/be_main.c --- linux-lowlatency-5.15.0/drivers/scsi/be2iscsi/be_main.c +++ linux-lowlatency-5.15.0/drivers/scsi/be2iscsi/be_main.c @@ -2691,6 +2691,7 @@ kfree(pwrb_context->pwrb_handle_base); kfree(pwrb_context->pwrb_handle_basestd); } + kfree(phwi_ctxt->be_wrbq); return -ENOMEM; } diff -u linux-lowlatency-5.15.0/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c linux-lowlatency-5.15.0/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c --- linux-lowlatency-5.15.0/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ linux-lowlatency-5.15.0/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -4718,6 +4718,12 @@ hisi_hba->debugfs_bist_linkrate = SAS_LINK_RATE_1_5_GBPS; } +static void debugfs_exit_v3_hw(struct hisi_hba *hisi_hba) +{ + debugfs_remove_recursive(hisi_hba->debugfs_dir); + hisi_hba->debugfs_dir = NULL; +} + static void debugfs_init_v3_hw(struct hisi_hba *hisi_hba) { struct device *dev = hisi_hba->dev; @@ -4741,18 +4747,13 @@ for (i = 0; i < hisi_sas_debugfs_dump_count; i++) { if (debugfs_alloc_v3_hw(hisi_hba, i)) { - debugfs_remove_recursive(hisi_hba->debugfs_dir); + debugfs_exit_v3_hw(hisi_hba); dev_dbg(dev, "failed to init debugfs!\n"); break; } } } -static void debugfs_exit_v3_hw(struct hisi_hba *hisi_hba) -{ - debugfs_remove_recursive(hisi_hba->debugfs_dir); -} - static int hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) { diff -u linux-lowlatency-5.15.0/drivers/scsi/ibmvscsi/ibmvfc.c linux-lowlatency-5.15.0/drivers/scsi/ibmvscsi/ibmvfc.c --- linux-lowlatency-5.15.0/drivers/scsi/ibmvscsi/ibmvfc.c +++ linux-lowlatency-5.15.0/drivers/scsi/ibmvscsi/ibmvfc.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -1519,7 +1518,11 @@ unsigned long flags; spin_lock_irqsave(&queue->l_lock, flags); - BUG_ON(list_empty(&queue->free)); + if (list_empty(&queue->free)) { + ibmvfc_log(queue->vhost, 4, "empty event pool on queue:%ld\n", queue->hwq_id); + spin_unlock_irqrestore(&queue->l_lock, flags); + return NULL; + } evt = list_entry(queue->free.next, struct ibmvfc_event, queue_list); atomic_set(&evt->free, 0); list_del(&evt->queue_list); @@ -1948,9 +1951,15 @@ if (vhost->using_channels) { scsi_channel = hwq % vhost->scsi_scrqs.active_queues; evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[scsi_channel]); + if (!evt) + return SCSI_MLQUEUE_HOST_BUSY; + evt->hwq = hwq % vhost->scsi_scrqs.active_queues; - } else + } else { evt = ibmvfc_get_event(&vhost->crq); + if (!evt) + return SCSI_MLQUEUE_HOST_BUSY; + } ibmvfc_init_event(evt, ibmvfc_scsi_done, IBMVFC_CMD_FORMAT); evt->cmnd = cmnd; @@ -2038,6 +2047,11 @@ vhost->aborting_passthru = 1; evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return -ENOMEM; + } + ibmvfc_init_event(evt, ibmvfc_bsg_timeout_done, IBMVFC_MAD_FORMAT); tmf = &evt->iu.tmf; @@ -2096,6 +2110,10 @@ goto unlock_out; evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + rc = -ENOMEM; + goto unlock_out; + } ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); plogi = &evt->iu.plogi; memset(plogi, 0, sizeof(*plogi)); @@ -2214,6 +2232,11 @@ } evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + rc = -ENOMEM; + goto out; + } ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); mad = &evt->iu.passthru; @@ -2302,6 +2325,11 @@ else evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return -ENOMEM; + } + ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); tmf = ibmvfc_init_vfc_cmd(evt, sdev); iu = ibmvfc_get_fcp_iu(vhost, tmf); @@ -2505,6 +2533,8 @@ struct ibmvfc_tmf *tmf; evt = ibmvfc_get_event(queue); + if (!evt) + return NULL; ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); tmf = &evt->iu.tmf; @@ -2561,6 +2591,11 @@ if (found_evt && vhost->logged_in) { evt = ibmvfc_init_tmf(&queues[i], sdev, type); + if (!evt) { + spin_unlock(queues[i].q_lock); + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return -ENOMEM; + } evt->sync_iu = &queues[i].cancel_rsp; ibmvfc_send_event(evt, vhost, default_timeout); list_add_tail(&evt->cancel, &cancelq); @@ -2774,6 +2809,10 @@ if (vhost->state == IBMVFC_ACTIVE) { evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return -ENOMEM; + } ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); tmf = ibmvfc_init_vfc_cmd(evt, sdev); iu = ibmvfc_get_fcp_iu(vhost, tmf); @@ -4030,6 +4069,12 @@ kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } vhost->discovery_threads++; ibmvfc_init_event(evt, ibmvfc_tgt_prli_done, IBMVFC_MAD_FORMAT); evt->tgt = tgt; @@ -4137,6 +4182,12 @@ kref_get(&tgt->kref); tgt->logo_rcvd = 0; evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } vhost->discovery_threads++; ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); ibmvfc_init_event(evt, ibmvfc_tgt_plogi_done, IBMVFC_MAD_FORMAT); @@ -4213,6 +4264,8 @@ kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) + return NULL; ibmvfc_init_event(evt, done, IBMVFC_MAD_FORMAT); evt->tgt = tgt; mad = &evt->iu.implicit_logout; @@ -4240,6 +4293,13 @@ vhost->discovery_threads++; evt = __ibmvfc_tgt_get_implicit_logout_evt(tgt, ibmvfc_tgt_implicit_logout_done); + if (!evt) { + vhost->discovery_threads--; + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); if (ibmvfc_send_event(evt, vhost, default_timeout)) { @@ -4379,6 +4439,12 @@ kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } vhost->discovery_threads++; ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_INIT_WAIT); ibmvfc_init_event(evt, ibmvfc_tgt_move_login_done, IBMVFC_MAD_FORMAT); @@ -4545,6 +4611,14 @@ vhost->abort_threads++; kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + tgt_err(tgt, "Failed to get cancel event for ADISC.\n"); + vhost->abort_threads--; + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + spin_unlock_irqrestore(vhost->host->host_lock, flags); + return; + } ibmvfc_init_event(evt, ibmvfc_tgt_adisc_cancel_done, IBMVFC_MAD_FORMAT); evt->tgt = tgt; @@ -4595,6 +4669,12 @@ kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } vhost->discovery_threads++; ibmvfc_init_event(evt, ibmvfc_tgt_adisc_done, IBMVFC_MAD_FORMAT); evt->tgt = tgt; @@ -4698,6 +4778,12 @@ kref_get(&tgt->kref); evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); + kref_put(&tgt->kref, ibmvfc_release_tgt); + __ibmvfc_reset_host(vhost); + return; + } vhost->discovery_threads++; evt->tgt = tgt; ibmvfc_init_event(evt, ibmvfc_tgt_query_target_done, IBMVFC_MAD_FORMAT); @@ -4870,6 +4956,13 @@ { struct ibmvfc_discover_targets *mad; struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); + int level = IBMVFC_DEFAULT_LOG_LEVEL; + + if (!evt) { + ibmvfc_log(vhost, level, "Discover Targets failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); mad = &evt->iu.discover_targets; @@ -4947,8 +5040,15 @@ struct ibmvfc_scsi_channels *scrqs = &vhost->scsi_scrqs; unsigned int num_channels = min(vhost->client_scsi_channels, vhost->max_vios_scsi_channels); + int level = IBMVFC_DEFAULT_LOG_LEVEL; int i; + if (!evt) { + ibmvfc_log(vhost, level, "Channel Setup failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + memset(setup_buf, 0, sizeof(*setup_buf)); if (num_channels == 0) setup_buf->flags = cpu_to_be32(IBMVFC_CANCEL_CHANNELS); @@ -5010,6 +5110,13 @@ { struct ibmvfc_channel_enquiry *mad; struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); + int level = IBMVFC_DEFAULT_LOG_LEVEL; + + if (!evt) { + ibmvfc_log(vhost, level, "Channel Enquiry failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } ibmvfc_init_event(evt, ibmvfc_channel_enquiry_done, IBMVFC_MAD_FORMAT); mad = &evt->iu.channel_enquiry; @@ -5132,6 +5239,12 @@ struct ibmvfc_npiv_login_mad *mad; struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_dbg(vhost, "NPIV Login failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + ibmvfc_gather_partition_info(vhost); ibmvfc_set_login_info(vhost); ibmvfc_init_event(evt, ibmvfc_npiv_login_done, IBMVFC_MAD_FORMAT); @@ -5196,6 +5309,12 @@ struct ibmvfc_event *evt; evt = ibmvfc_get_event(&vhost->crq); + if (!evt) { + ibmvfc_dbg(vhost, "NPIV Logout failed: no available events\n"); + ibmvfc_hard_reset_host(vhost); + return; + } + ibmvfc_init_event(evt, ibmvfc_npiv_logout_done, IBMVFC_MAD_FORMAT); mad = &evt->iu.npiv_logout; @@ -5802,7 +5921,7 @@ irq_failed: do { rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie); - } while (rtas_busy_delay(rc)); + } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); reg_failed: LEAVE; return rc; diff -u linux-lowlatency-5.15.0/drivers/scsi/megaraid/megaraid_sas_base.c linux-lowlatency-5.15.0/drivers/scsi/megaraid/megaraid_sas_base.c --- linux-lowlatency-5.15.0/drivers/scsi/megaraid/megaraid_sas_base.c +++ linux-lowlatency-5.15.0/drivers/scsi/megaraid/megaraid_sas_base.c @@ -263,13 +263,13 @@ * Fusion registers could intermittently return all zeroes. * This behavior is transient in nature and subsequent reads will * return valid value. As a workaround in driver, retry readl for - * upto three times until a non-zero value is read. + * up to thirty times until a non-zero value is read. */ if (instance->adapter_type == AERO_SERIES) { do { ret_val = readl(addr); i++; - } while (ret_val == 0 && i < 3); + } while (ret_val == 0 && i < 30); return ret_val; } else { return readl(addr); diff -u linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_base.c linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_base.c --- linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_base.c +++ linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -224,8 +224,8 @@ for (i = 0 ; i < 30 ; i++) { ret_val = readl(addr); - if (ret_val == 0) - continue; + if (ret_val != 0) + break; } return ret_val; diff -u linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c --- linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ linux-lowlatency-5.15.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -12899,8 +12899,10 @@ mpt3sas_ctl_init(hbas_to_enumerate); error = pci_register_driver(&mpt3sas_driver); - if (error) + if (error) { + mpt3sas_ctl_exit(hbas_to_enumerate); scsih_exit(); + } return error; } diff -u linux-lowlatency-5.15.0/drivers/scsi/qla2xxx/qla_os.c linux-lowlatency-5.15.0/drivers/scsi/qla2xxx/qla_os.c --- linux-lowlatency-5.15.0/drivers/scsi/qla2xxx/qla_os.c +++ linux-lowlatency-5.15.0/drivers/scsi/qla2xxx/qla_os.c @@ -1823,8 +1823,16 @@ } spin_lock_irqsave(qp->qp_lock_ptr, *flags); - if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) - sp->done(sp, res); + switch (sp->type) { + case SRB_SCSI_CMD: + if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) + sp->done(sp, res); + break; + default: + if (ret_cmd) + sp->done(sp, res); + break; + } } else { sp->done(sp, res); } diff -u linux-lowlatency-5.15.0/drivers/scsi/ufs/ufshcd.c linux-lowlatency-5.15.0/drivers/scsi/ufs/ufshcd.c --- linux-lowlatency-5.15.0/drivers/scsi/ufs/ufshcd.c +++ linux-lowlatency-5.15.0/drivers/scsi/ufs/ufshcd.c @@ -3465,7 +3465,7 @@ */ ret = utf16s_to_utf8s(uc_str->uc, uc_str->len - QUERY_DESC_HDR_SIZE, - UTF16_BIG_ENDIAN, str, ascii_len); + UTF16_BIG_ENDIAN, str, ascii_len - 1); /* replace non-printable or non-ASCII characters with spaces */ for (i = 0; i < ret; i++) diff -u linux-lowlatency-5.15.0/drivers/soc/qcom/llcc-qcom.c linux-lowlatency-5.15.0/drivers/soc/qcom/llcc-qcom.c --- linux-lowlatency-5.15.0/drivers/soc/qcom/llcc-qcom.c +++ linux-lowlatency-5.15.0/drivers/soc/qcom/llcc-qcom.c @@ -537,6 +537,9 @@ u32 sz; u32 version; + if (!IS_ERR(drv_data)) + return -EBUSY; + drv_data = devm_kzalloc(dev, sizeof(*drv_data), GFP_KERNEL); if (!drv_data) { ret = -ENOMEM; diff -u linux-lowlatency-5.15.0/drivers/spi/Kconfig linux-lowlatency-5.15.0/drivers/spi/Kconfig --- linux-lowlatency-5.15.0/drivers/spi/Kconfig +++ linux-lowlatency-5.15.0/drivers/spi/Kconfig @@ -986,6 +986,7 @@ config SPI_ZYNQ_QSPI tristate "Xilinx Zynq QSPI controller" depends on ARCH_ZYNQ || COMPILE_TEST + depends on SPI_MEM help This enables support for the Zynq Quad SPI controller in master mode. diff -u linux-lowlatency-5.15.0/drivers/spi/spi-nxp-fspi.c linux-lowlatency-5.15.0/drivers/spi/spi-nxp-fspi.c --- linux-lowlatency-5.15.0/drivers/spi/spi-nxp-fspi.c +++ linux-lowlatency-5.15.0/drivers/spi/spi-nxp-fspi.c @@ -708,7 +708,7 @@ f->memmap_len = len > NXP_FSPI_MIN_IOMAP ? len : NXP_FSPI_MIN_IOMAP; - f->ahb_addr = ioremap_wc(f->memmap_phy + f->memmap_start, + f->ahb_addr = ioremap(f->memmap_phy + f->memmap_start, f->memmap_len); if (!f->ahb_addr) { diff -u linux-lowlatency-5.15.0/drivers/spi/spi-tegra20-slink.c linux-lowlatency-5.15.0/drivers/spi/spi-tegra20-slink.c --- linux-lowlatency-5.15.0/drivers/spi/spi-tegra20-slink.c +++ linux-lowlatency-5.15.0/drivers/spi/spi-tegra20-slink.c @@ -1087,6 +1087,8 @@ reset_control_deassert(tspi->rst); spi_irq = platform_get_irq(pdev, 0); + if (spi_irq < 0) + return spi_irq; tspi->irq = spi_irq; ret = request_threaded_irq(tspi->irq, tegra_slink_isr, tegra_slink_isr_thread, IRQF_ONESHOT, diff -u linux-lowlatency-5.15.0/drivers/tee/optee/device.c linux-lowlatency-5.15.0/drivers/tee/optee/device.c --- linux-lowlatency-5.15.0/drivers/tee/optee/device.c +++ linux-lowlatency-5.15.0/drivers/tee/optee/device.c @@ -60,7 +60,16 @@ kfree(optee_device); } -static int optee_register_device(const uuid_t *device_uuid) +static ssize_t need_supplicant_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return 0; +} + +static DEVICE_ATTR_RO(need_supplicant); + +static int optee_register_device(const uuid_t *device_uuid, u32 func) { struct tee_client_device *optee_device = NULL; int rc; @@ -83,6 +92,10 @@ put_device(&optee_device->dev); } + if (func == PTA_CMD_GET_DEVICES_SUPP) + device_create_file(&optee_device->dev, + &dev_attr_need_supplicant); + return rc; } @@ -143,7 +156,7 @@ num_devices = shm_size / sizeof(uuid_t); for (idx = 0; idx < num_devices; idx++) { - rc = optee_register_device(&device_uuid[idx]); + rc = optee_register_device(&device_uuid[idx], func); if (rc) goto out_shm; } diff -u linux-lowlatency-5.15.0/drivers/thermal/thermal_core.c linux-lowlatency-5.15.0/drivers/thermal/thermal_core.c --- linux-lowlatency-5.15.0/drivers/thermal/thermal_core.c +++ linux-lowlatency-5.15.0/drivers/thermal/thermal_core.c @@ -671,7 +671,8 @@ if (result) goto release_ida; - sprintf(dev->attr_name, "cdev%d_trip_point", dev->id); + snprintf(dev->attr_name, sizeof(dev->attr_name), "cdev%d_trip_point", + dev->id); sysfs_attr_init(&dev->attr.attr); dev->attr.attr.name = dev->attr_name; dev->attr.attr.mode = 0444; @@ -680,7 +681,8 @@ if (result) goto remove_symbol_link; - sprintf(dev->weight_attr_name, "cdev%d_weight", dev->id); + snprintf(dev->weight_attr_name, sizeof(dev->weight_attr_name), + "cdev%d_weight", dev->id); sysfs_attr_init(&dev->weight_attr.attr); dev->weight_attr.attr.name = dev->weight_attr_name; dev->weight_attr.attr.mode = S_IWUSR | S_IRUGO; diff -u linux-lowlatency-5.15.0/drivers/tty/hvc/hvc_xen.c linux-lowlatency-5.15.0/drivers/tty/hvc/hvc_xen.c --- linux-lowlatency-5.15.0/drivers/tty/hvc/hvc_xen.c +++ linux-lowlatency-5.15.0/drivers/tty/hvc/hvc_xen.c @@ -377,18 +377,21 @@ #ifdef CONFIG_HVC_XEN_FRONTEND static void xencons_disconnect_backend(struct xencons_info *info) { - if (info->irq > 0) - unbind_from_irqhandler(info->irq, NULL); - info->irq = 0; + if (info->hvc != NULL) + hvc_remove(info->hvc); + info->hvc = NULL; + if (info->irq > 0) { + evtchn_put(info->evtchn); + info->irq = 0; + info->evtchn = 0; + } + /* evtchn_put() will also close it so this is only an error path */ if (info->evtchn > 0) xenbus_free_evtchn(info->xbdev, info->evtchn); info->evtchn = 0; if (info->gntref > 0) gnttab_free_grant_references(info->gntref); info->gntref = 0; - if (info->hvc != NULL) - hvc_remove(info->hvc); - info->hvc = NULL; } static void xencons_free(struct xencons_info *info) @@ -433,7 +436,7 @@ if (ret) return ret; info->evtchn = evtchn; - irq = bind_interdomain_evtchn_to_irq_lateeoi(dev, evtchn); + irq = bind_evtchn_to_irq_lateeoi(evtchn); if (irq < 0) return irq; info->irq = irq; @@ -553,10 +556,23 @@ if (dev->state == XenbusStateClosed) break; fallthrough; /* Missed the backend's CLOSING state */ - case XenbusStateClosing: + case XenbusStateClosing: { + struct xencons_info *info = dev_get_drvdata(&dev->dev);; + + /* + * Don't tear down the evtchn and grant ref before the other + * end has disconnected, but do stop userspace from trying + * to use the device before we allow the backend to close. + */ + if (info->hvc) { + hvc_remove(info->hvc); + info->hvc = NULL; + } + xenbus_frontend_closed(dev); break; } + } } static const struct xenbus_device_id xencons_ids[] = { @@ -587,7 +603,7 @@ ops = &dom0_hvc_ops; r = xen_initial_domain_console_init(); if (r < 0) - return r; + goto register_fe; info = vtermno_to_xencons(HVC_COOKIE); } else { ops = &domU_hvc_ops; @@ -596,7 +612,7 @@ else r = xen_pv_console_init(); if (r < 0) - return r; + goto register_fe; info = vtermno_to_xencons(HVC_COOKIE); info->irq = bind_evtchn_to_irq_lateeoi(info->evtchn); @@ -615,12 +631,13 @@ list_del(&info->list); spin_unlock_irqrestore(&xencons_lock, flags); if (info->irq) - unbind_from_irqhandler(info->irq, NULL); + evtchn_put(info->evtchn); kfree(info); return r; } r = 0; + register_fe: #ifdef CONFIG_HVC_XEN_FRONTEND r = xenbus_register_frontend(&xencons_driver); #endif diff -u linux-lowlatency-5.15.0/drivers/tty/n_gsm.c linux-lowlatency-5.15.0/drivers/tty/n_gsm.c --- linux-lowlatency-5.15.0/drivers/tty/n_gsm.c +++ linux-lowlatency-5.15.0/drivers/tty/n_gsm.c @@ -3273,6 +3273,8 @@ static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk) { + if (dlci->gsm->dead) + return -EL2HLT; if (dlci->adaption == 2) { /* Send convergence layer type 2 empty data frame. */ gsm_modem_upd_via_data(dlci, brk); diff -u linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_omap.c linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_omap.c --- linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_omap.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_omap.c @@ -32,6 +32,7 @@ #include "8250.h" #define DEFAULT_CLK_SPEED 48000000 +#define OMAP_UART_REGSHIFT 2 #define UART_ERRATA_i202_MDR1_ACCESS (1 << 0) #define OMAP_UART_WER_HAS_TX_WAKEUP (1 << 1) @@ -109,6 +110,7 @@ #define UART_OMAP_RX_LVL 0x19 struct omap8250_priv { + void __iomem *membase; int line; u8 habit; u8 mdr1; @@ -152,9 +154,9 @@ static inline void omap_8250_rx_dma_flush(struct uart_8250_port *p) { } #endif -static u32 uart_read(struct uart_8250_port *up, u32 reg) +static u32 uart_read(struct omap8250_priv *priv, u32 reg) { - return readl(up->port.membase + (reg << up->port.regshift)); + return readl(priv->membase + (reg << OMAP_UART_REGSHIFT)); } /* @@ -552,7 +554,7 @@ u32 mvr, scheme; u16 revision, major, minor; - mvr = uart_read(up, UART_OMAP_MVER); + mvr = uart_read(priv, UART_OMAP_MVER); /* Check revision register scheme */ scheme = mvr >> OMAP_UART_MVR_SCHEME_SHIFT; @@ -837,7 +839,7 @@ if (priv->habit & UART_HAS_RHR_IT_DIS) { reg = serial_in(p, UART_OMAP_IER2); reg &= ~UART_OMAP_IER2_RHR_IT_DIS; - serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS); + serial_out(p, UART_OMAP_IER2, reg); } dmaengine_tx_status(rxchan, cookie, &state); @@ -979,7 +981,7 @@ if (priv->habit & UART_HAS_RHR_IT_DIS) { reg = serial_in(p, UART_OMAP_IER2); reg |= UART_OMAP_IER2_RHR_IT_DIS; - serial_out(p, UART_OMAP_IER2, UART_OMAP_IER2_RHR_IT_DIS); + serial_out(p, UART_OMAP_IER2, reg); } dma_async_issue_pending(dma->rxchan); @@ -1201,10 +1203,12 @@ status = serial_port_in(port, UART_LSR); - if (priv->habit & UART_HAS_EFR2) - am654_8250_handle_rx_dma(up, iir, status); - else - status = omap_8250_handle_rx_dma(up, iir, status); + if ((iir & 0x3f) != UART_IIR_THRI) { + if (priv->habit & UART_HAS_EFR2) + am654_8250_handle_rx_dma(up, iir, status); + else + status = omap_8250_handle_rx_dma(up, iir, status); + } serial8250_modem_status(up); if (status & UART_LSR_THRE && up->dma->tx_err) { @@ -1336,7 +1340,7 @@ UPF_HARD_FLOW; up.port.private_data = priv; - up.port.regshift = 2; + up.port.regshift = OMAP_UART_REGSHIFT; up.port.fifosize = 64; up.tx_loadsz = 64; up.capabilities = UART_CAP_FIFO; @@ -1397,6 +1401,8 @@ DEFAULT_CLK_SPEED); } + priv->membase = membase; + priv->line = -ENODEV; priv->latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE; priv->calc_latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE; cpu_latency_qos_add_request(&priv->pm_qos_request, priv->latency); @@ -1404,6 +1410,8 @@ spin_lock_init(&priv->rx_dma_lock); + platform_set_drvdata(pdev, priv); + device_init_wakeup(&pdev->dev, true); pm_runtime_enable(&pdev->dev); pm_runtime_use_autosuspend(&pdev->dev); @@ -1465,7 +1473,6 @@ goto err; } priv->line = ret; - platform_set_drvdata(pdev, priv); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); return 0; @@ -1487,11 +1494,12 @@ if (err) return err; + serial8250_unregister_port(priv->line); + priv->line = -ENODEV; pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); flush_work(&priv->qos_work); pm_runtime_disable(&pdev->dev); - serial8250_unregister_port(priv->line); cpu_latency_qos_remove_request(&priv->pm_qos_request); device_init_wakeup(&pdev->dev, false); return 0; @@ -1521,7 +1529,7 @@ { struct omap8250_priv *priv = dev_get_drvdata(dev); struct uart_8250_port *up = serial8250_get_port(priv->line); - int err; + int err = 0; serial8250_suspend_port(priv->line); @@ -1531,7 +1539,8 @@ if (!device_may_wakeup(dev)) priv->wer = 0; serial_out(up, UART_OMAP_WER, priv->wer); - err = pm_runtime_force_suspend(dev); + if (uart_console(&up->port) && console_suspend_enabled) + err = pm_runtime_force_suspend(dev); flush_work(&priv->qos_work); return err; @@ -1540,11 +1549,15 @@ static int omap8250_resume(struct device *dev) { struct omap8250_priv *priv = dev_get_drvdata(dev); + struct uart_8250_port *up = serial8250_get_port(priv->line); int err; - err = pm_runtime_force_resume(dev); - if (err) - return err; + if (uart_console(&up->port) && console_suspend_enabled) { + err = pm_runtime_force_resume(dev); + if (err) + return err; + } + serial8250_resume_port(priv->line); /* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */ pm_runtime_mark_last_busy(dev); @@ -1573,11 +1586,15 @@ return 0; } +static void uart_write(struct omap8250_priv *priv, u32 reg, u32 val) +{ + writel(val, priv->membase + (reg << OMAP_UART_REGSHIFT)); +} + /* TODO: in future, this should happen via API in drivers/reset/ */ static int omap8250_soft_reset(struct device *dev) { struct omap8250_priv *priv = dev_get_drvdata(dev); - struct uart_8250_port *up = serial8250_get_port(priv->line); int timeout = 100; int sysc; int syss; @@ -1591,20 +1608,20 @@ * needing omap8250_soft_reset() quirk. Do it in two writes as * recommended in the comment for omap8250_update_scr(). */ - serial_out(up, UART_OMAP_SCR, OMAP_UART_SCR_DMAMODE_1); - serial_out(up, UART_OMAP_SCR, + uart_write(priv, UART_OMAP_SCR, OMAP_UART_SCR_DMAMODE_1); + uart_write(priv, UART_OMAP_SCR, OMAP_UART_SCR_DMAMODE_1 | OMAP_UART_SCR_DMAMODE_CTL); - sysc = serial_in(up, UART_OMAP_SYSC); + sysc = uart_read(priv, UART_OMAP_SYSC); /* softreset the UART */ sysc |= OMAP_UART_SYSC_SOFTRESET; - serial_out(up, UART_OMAP_SYSC, sysc); + uart_write(priv, UART_OMAP_SYSC, sysc); /* By experiments, 1us enough for reset complete on AM335x */ do { udelay(1); - syss = serial_in(up, UART_OMAP_SYSS); + syss = uart_read(priv, UART_OMAP_SYSS); } while (--timeout && !(syss & OMAP_UART_SYSS_RESETDONE)); if (!timeout) { @@ -1618,23 +1635,10 @@ static int omap8250_runtime_suspend(struct device *dev) { struct omap8250_priv *priv = dev_get_drvdata(dev); - struct uart_8250_port *up; + struct uart_8250_port *up = NULL; - /* In case runtime-pm tries this before we are setup */ - if (!priv) - return 0; - - up = serial8250_get_port(priv->line); - /* - * When using 'no_console_suspend', the console UART must not be - * suspended. Since driver suspend is managed by runtime suspend, - * preventing runtime suspend (by returning error) will keep device - * active during suspend. - */ - if (priv->is_suspending && !console_suspend_enabled) { - if (uart_console(&up->port)) - return -EBUSY; - } + if (priv->line >= 0) + up = serial8250_get_port(priv->line); if (priv->habit & UART_ERRATA_CLOCK_DISABLE) { int ret; @@ -1643,13 +1647,15 @@ if (ret) return ret; - /* Restore to UART mode after reset (for wakeup) */ - omap8250_update_mdr1(up, priv); - /* Restore wakeup enable register */ - serial_out(up, UART_OMAP_WER, priv->wer); + if (up) { + /* Restore to UART mode after reset (for wakeup) */ + omap8250_update_mdr1(up, priv); + /* Restore wakeup enable register */ + serial_out(up, UART_OMAP_WER, priv->wer); + } } - if (up->dma && up->dma->rxchan) + if (up && up->dma && up->dma->rxchan) omap_8250_rx_dma_flush(up); priv->latency = PM_QOS_CPU_LATENCY_DEFAULT_VALUE; @@ -1661,18 +1667,15 @@ static int omap8250_runtime_resume(struct device *dev) { struct omap8250_priv *priv = dev_get_drvdata(dev); - struct uart_8250_port *up; - - /* In case runtime-pm tries this before we are setup */ - if (!priv) - return 0; + struct uart_8250_port *up = NULL; - up = serial8250_get_port(priv->line); + if (priv->line >= 0) + up = serial8250_get_port(priv->line); - if (omap8250_lost_context(up)) + if (up && omap8250_lost_context(up)) omap8250_restore_regs(up); - if (up->dma && up->dma->rxchan && !(priv->habit & UART_HAS_EFR2)) + if (up && up->dma && up->dma->rxchan && !(priv->habit & UART_HAS_EFR2)) omap_8250_rx_dma(up); priv->latency = priv->calc_latency; diff -u linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_pci.c linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_pci.c --- linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_pci.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_pci.c @@ -2720,4 +2720,151 @@ .setup = pci_oxsemi_tornado_setup, }, + /* + * Brainboxes devices - all Oxsemi based + */ + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4027, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4028, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4029, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4019, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4016, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4015, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x400A, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x400E, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x400C, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x400B, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x400F, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4010, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4011, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x401D, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x401E, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4013, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4017, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, + { + .vendor = PCI_VENDOR_ID_INTASHIELD, + .device = 0x4018, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_oxsemi_tornado_setup, + }, { .vendor = PCI_VENDOR_ID_INTEL, @@ -5341,6 +5488,12 @@ pbn_b1_bt_1_115200 }, /* + * IntaShield IS-100 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0D60, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_b2_1_115200 }, + /* * IntaShield IS-200 */ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, @@ -5352,6 +5505,27 @@ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ pbn_b2_4_115200 }, + /* + * IntaShield IX-100 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4027, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * IntaShield IX-200 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4028, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * IntaShield IX-400 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4029, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, /* Brainboxes Devices */ /* * Brainboxes UC-101 @@ -5367,10 +5541,14 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0AA2, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_1_115200 }, /* - * Brainboxes UC-257 + * Brainboxes UC-253/UC-734 */ - { PCI_VENDOR_ID_INTASHIELD, 0x0861, + { PCI_VENDOR_ID_INTASHIELD, 0x0CA1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_2_115200 }, @@ -5406,6 +5584,14 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x08E2, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x08E3, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, /* * Brainboxes UC-310 */ @@ -5416,6 +5602,14 @@ /* * Brainboxes UC-313 */ + { PCI_VENDOR_ID_INTASHIELD, 0x08A1, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x08A2, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, { PCI_VENDOR_ID_INTASHIELD, 0x08A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, @@ -5430,6 +5624,10 @@ /* * Brainboxes UC-346 */ + { PCI_VENDOR_ID_INTASHIELD, 0x0B01, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_4_115200 }, { PCI_VENDOR_ID_INTASHIELD, 0x0B02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, @@ -5441,6 +5639,10 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0A82, + 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, @@ -5453,13 +5655,95 @@ 0, 0, pbn_b2_4_115200 }, /* - * Brainboxes UC-420/431 + * Brainboxes UC-420 */ { PCI_VENDOR_ID_INTASHIELD, 0x0921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_4_115200 }, /* + * Brainboxes UC-607 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x09A1, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x09A2, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x09A3, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + /* + * Brainboxes UC-836 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0D41, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_4_115200 }, + /* + * Brainboxes UP-189 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0AC1, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0AC2, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0AC3, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + /* + * Brainboxes UP-200 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0B21, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0B22, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0B23, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + /* + * Brainboxes UP-869 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0C01, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0C02, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0C03, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + /* + * Brainboxes UP-880 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0C21, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0C22, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0C23, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_2_115200 }, + /* * Brainboxes PX-101 */ { PCI_VENDOR_ID_INTASHIELD, 0x4005, @@ -5491,7 +5775,7 @@ { PCI_VENDOR_ID_INTASHIELD, 0x4015, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_4_15625000 }, + pbn_oxsemi_2_15625000 }, /* * Brainboxes PX-260/PX-701 */ @@ -5500,6 +5784,13 @@ 0, 0, pbn_oxsemi_4_15625000 }, /* + * Brainboxes PX-275/279 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x0E41, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b2_8_115200 }, + /* * Brainboxes PX-310 */ { PCI_VENDOR_ID_INTASHIELD, 0x400E, @@ -5546,16 +5837,38 @@ 0, 0, pbn_oxsemi_4_15625000 }, /* - * Brainboxes PX-803 + * Brainboxes PX-475 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x401D, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-803/PX-857 */ { PCI_VENDOR_ID_INTASHIELD, 0x4009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_115200 }, + pbn_b0_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4018, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_INTASHIELD, 0x401E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_15625000 }, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-820 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4002, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_4_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4013, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, /* * Brainboxes PX-846 */ diff -u linux-lowlatency-5.15.0/drivers/tty/serial/amba-pl011.c linux-lowlatency-5.15.0/drivers/tty/serial/amba-pl011.c --- linux-lowlatency-5.15.0/drivers/tty/serial/amba-pl011.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/amba-pl011.c @@ -222,17 +222,18 @@ /* Deals with DMA transactions */ -struct pl011_sgbuf { - struct scatterlist sg; - char *buf; +struct pl011_dmabuf { + dma_addr_t dma; + size_t len; + char *buf; }; struct pl011_dmarx_data { struct dma_chan *chan; struct completion complete; bool use_buf_b; - struct pl011_sgbuf sgbuf_a; - struct pl011_sgbuf sgbuf_b; + struct pl011_dmabuf dbuf_a; + struct pl011_dmabuf dbuf_b; dma_cookie_t cookie; bool running; struct timer_list timer; @@ -245,7 +246,8 @@ struct pl011_dmatx_data { struct dma_chan *chan; - struct scatterlist sg; + dma_addr_t dma; + size_t len; char *buf; bool queued; }; @@ -370,32 +372,24 @@ #define PL011_DMA_BUFFER_SIZE PAGE_SIZE -static int pl011_sgbuf_init(struct dma_chan *chan, struct pl011_sgbuf *sg, +static int pl011_dmabuf_init(struct dma_chan *chan, struct pl011_dmabuf *db, enum dma_data_direction dir) { - dma_addr_t dma_addr; - - sg->buf = dma_alloc_coherent(chan->device->dev, - PL011_DMA_BUFFER_SIZE, &dma_addr, GFP_KERNEL); - if (!sg->buf) + db->buf = dma_alloc_coherent(chan->device->dev, PL011_DMA_BUFFER_SIZE, + &db->dma, GFP_KERNEL); + if (!db->buf) return -ENOMEM; - - sg_init_table(&sg->sg, 1); - sg_set_page(&sg->sg, phys_to_page(dma_addr), - PL011_DMA_BUFFER_SIZE, offset_in_page(dma_addr)); - sg_dma_address(&sg->sg) = dma_addr; - sg_dma_len(&sg->sg) = PL011_DMA_BUFFER_SIZE; + db->len = PL011_DMA_BUFFER_SIZE; return 0; } -static void pl011_sgbuf_free(struct dma_chan *chan, struct pl011_sgbuf *sg, +static void pl011_dmabuf_free(struct dma_chan *chan, struct pl011_dmabuf *db, enum dma_data_direction dir) { - if (sg->buf) { + if (db->buf) { dma_free_coherent(chan->device->dev, - PL011_DMA_BUFFER_SIZE, sg->buf, - sg_dma_address(&sg->sg)); + PL011_DMA_BUFFER_SIZE, db->buf, db->dma); } } @@ -556,8 +550,8 @@ spin_lock_irqsave(&uap->port.lock, flags); if (uap->dmatx.queued) - dma_unmap_sg(dmatx->chan->device->dev, &dmatx->sg, 1, - DMA_TO_DEVICE); + dma_unmap_single(dmatx->chan->device->dev, dmatx->dma, + dmatx->len, DMA_TO_DEVICE); dmacr = uap->dmacr; uap->dmacr = dmacr & ~UART011_TXDMAE; @@ -643,18 +637,19 @@ memcpy(&dmatx->buf[first], &xmit->buf[0], second); } - dmatx->sg.length = count; - - if (dma_map_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE) != 1) { + dmatx->len = count; + dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count, + DMA_TO_DEVICE); + if (dmatx->dma == DMA_MAPPING_ERROR) { uap->dmatx.queued = false; dev_dbg(uap->port.dev, "unable to map TX DMA\n"); return -EBUSY; } - desc = dmaengine_prep_slave_sg(chan, &dmatx->sg, 1, DMA_MEM_TO_DEV, + desc = dmaengine_prep_slave_single(chan, dmatx->dma, dmatx->len, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { - dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE); + dma_unmap_single(dma_dev->dev, dmatx->dma, dmatx->len, DMA_TO_DEVICE); uap->dmatx.queued = false; /* * If DMA cannot be used right now, we complete this @@ -818,8 +813,8 @@ dmaengine_terminate_async(uap->dmatx.chan); if (uap->dmatx.queued) { - dma_unmap_sg(uap->dmatx.chan->device->dev, &uap->dmatx.sg, 1, - DMA_TO_DEVICE); + dma_unmap_single(uap->dmatx.chan->device->dev, uap->dmatx.dma, + uap->dmatx.len, DMA_TO_DEVICE); uap->dmatx.queued = false; uap->dmacr &= ~UART011_TXDMAE; pl011_write(uap->dmacr, uap, REG_DMACR); @@ -833,15 +828,15 @@ struct dma_chan *rxchan = uap->dmarx.chan; struct pl011_dmarx_data *dmarx = &uap->dmarx; struct dma_async_tx_descriptor *desc; - struct pl011_sgbuf *sgbuf; + struct pl011_dmabuf *dbuf; if (!rxchan) return -EIO; /* Start the RX DMA job */ - sgbuf = uap->dmarx.use_buf_b ? - &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; - desc = dmaengine_prep_slave_sg(rxchan, &sgbuf->sg, 1, + dbuf = uap->dmarx.use_buf_b ? + &uap->dmarx.dbuf_b : &uap->dmarx.dbuf_a; + desc = dmaengine_prep_slave_single(rxchan, dbuf->dma, dbuf->len, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); /* @@ -881,8 +876,8 @@ bool readfifo) { struct tty_port *port = &uap->port.state->port; - struct pl011_sgbuf *sgbuf = use_buf_b ? - &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; + struct pl011_dmabuf *dbuf = use_buf_b ? + &uap->dmarx.dbuf_b : &uap->dmarx.dbuf_a; int dma_count = 0; u32 fifotaken = 0; /* only used for vdbg() */ @@ -891,7 +886,7 @@ if (uap->dmarx.poll_rate) { /* The data can be taken by polling */ - dmataken = sgbuf->sg.length - dmarx->last_residue; + dmataken = dbuf->len - dmarx->last_residue; /* Recalculate the pending size */ if (pending >= dmataken) pending -= dmataken; @@ -905,7 +900,7 @@ * Note that tty_insert_flip_buf() tries to take as many chars * as it can. */ - dma_count = tty_insert_flip_string(port, sgbuf->buf + dmataken, + dma_count = tty_insert_flip_string(port, dbuf->buf + dmataken, pending); uap->port.icount.rx += dma_count; @@ -916,7 +911,7 @@ /* Reset the last_residue for Rx DMA poll */ if (uap->dmarx.poll_rate) - dmarx->last_residue = sgbuf->sg.length; + dmarx->last_residue = dbuf->len; /* * Only continue with trying to read the FIFO if all DMA chars have @@ -951,8 +946,8 @@ { struct pl011_dmarx_data *dmarx = &uap->dmarx; struct dma_chan *rxchan = dmarx->chan; - struct pl011_sgbuf *sgbuf = dmarx->use_buf_b ? - &dmarx->sgbuf_b : &dmarx->sgbuf_a; + struct pl011_dmabuf *dbuf = dmarx->use_buf_b ? + &dmarx->dbuf_b : &dmarx->dbuf_a; size_t pending; struct dma_tx_state state; enum dma_status dmastat; @@ -974,7 +969,7 @@ pl011_write(uap->dmacr, uap, REG_DMACR); uap->dmarx.running = false; - pending = sgbuf->sg.length - state.residue; + pending = dbuf->len - state.residue; BUG_ON(pending > PL011_DMA_BUFFER_SIZE); /* Then we terminate the transfer - we now know our residue */ dmaengine_terminate_all(rxchan); @@ -1001,8 +996,8 @@ struct pl011_dmarx_data *dmarx = &uap->dmarx; struct dma_chan *rxchan = dmarx->chan; bool lastbuf = dmarx->use_buf_b; - struct pl011_sgbuf *sgbuf = dmarx->use_buf_b ? - &dmarx->sgbuf_b : &dmarx->sgbuf_a; + struct pl011_dmabuf *dbuf = dmarx->use_buf_b ? + &dmarx->dbuf_b : &dmarx->dbuf_a; size_t pending; struct dma_tx_state state; int ret; @@ -1020,7 +1015,7 @@ * the DMA irq handler. So we check the residue here. */ rxchan->device->device_tx_status(rxchan, dmarx->cookie, &state); - pending = sgbuf->sg.length - state.residue; + pending = dbuf->len - state.residue; BUG_ON(pending > PL011_DMA_BUFFER_SIZE); /* Then we terminate the transfer - we now know our residue */ dmaengine_terminate_all(rxchan); @@ -1072,16 +1067,16 @@ unsigned long flags; unsigned int dmataken = 0; unsigned int size = 0; - struct pl011_sgbuf *sgbuf; + struct pl011_dmabuf *dbuf; int dma_count; struct dma_tx_state state; - sgbuf = dmarx->use_buf_b ? &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; + dbuf = dmarx->use_buf_b ? &uap->dmarx.dbuf_b : &uap->dmarx.dbuf_a; rxchan->device->device_tx_status(rxchan, dmarx->cookie, &state); if (likely(state.residue < dmarx->last_residue)) { - dmataken = sgbuf->sg.length - dmarx->last_residue; + dmataken = dbuf->len - dmarx->last_residue; size = dmarx->last_residue - state.residue; - dma_count = tty_insert_flip_string(port, sgbuf->buf + dmataken, + dma_count = tty_insert_flip_string(port, dbuf->buf + dmataken, size); if (dma_count == size) dmarx->last_residue = state.residue; @@ -1128,7 +1123,7 @@ return; } - sg_init_one(&uap->dmatx.sg, uap->dmatx.buf, PL011_DMA_BUFFER_SIZE); + uap->dmatx.len = PL011_DMA_BUFFER_SIZE; /* The DMA buffer is now the FIFO the TTY subsystem can use */ uap->port.fifosize = PL011_DMA_BUFFER_SIZE; @@ -1138,7 +1133,7 @@ goto skip_rx; /* Allocate and map DMA RX buffers */ - ret = pl011_sgbuf_init(uap->dmarx.chan, &uap->dmarx.sgbuf_a, + ret = pl011_dmabuf_init(uap->dmarx.chan, &uap->dmarx.dbuf_a, DMA_FROM_DEVICE); if (ret) { dev_err(uap->port.dev, "failed to init DMA %s: %d\n", @@ -1146,12 +1141,12 @@ goto skip_rx; } - ret = pl011_sgbuf_init(uap->dmarx.chan, &uap->dmarx.sgbuf_b, + ret = pl011_dmabuf_init(uap->dmarx.chan, &uap->dmarx.dbuf_b, DMA_FROM_DEVICE); if (ret) { dev_err(uap->port.dev, "failed to init DMA %s: %d\n", "RX buffer B", ret); - pl011_sgbuf_free(uap->dmarx.chan, &uap->dmarx.sgbuf_a, + pl011_dmabuf_free(uap->dmarx.chan, &uap->dmarx.dbuf_a, DMA_FROM_DEVICE); goto skip_rx; } @@ -1205,8 +1200,9 @@ /* In theory, this should already be done by pl011_dma_flush_buffer */ dmaengine_terminate_all(uap->dmatx.chan); if (uap->dmatx.queued) { - dma_unmap_sg(uap->dmatx.chan->device->dev, &uap->dmatx.sg, 1, - DMA_TO_DEVICE); + dma_unmap_single(uap->dmatx.chan->device->dev, + uap->dmatx.dma, uap->dmatx.len, + DMA_TO_DEVICE); uap->dmatx.queued = false; } @@ -1217,8 +1213,8 @@ if (uap->using_rx_dma) { dmaengine_terminate_all(uap->dmarx.chan); /* Clean up the RX DMA */ - pl011_sgbuf_free(uap->dmarx.chan, &uap->dmarx.sgbuf_a, DMA_FROM_DEVICE); - pl011_sgbuf_free(uap->dmarx.chan, &uap->dmarx.sgbuf_b, DMA_FROM_DEVICE); + pl011_dmabuf_free(uap->dmarx.chan, &uap->dmarx.dbuf_a, DMA_FROM_DEVICE); + pl011_dmabuf_free(uap->dmarx.chan, &uap->dmarx.dbuf_b, DMA_FROM_DEVICE); if (uap->dmarx.poll_rate) del_timer_sync(&uap->dmarx.timer); uap->using_rx_dma = false; diff -u linux-lowlatency-5.15.0/drivers/tty/serial/meson_uart.c linux-lowlatency-5.15.0/drivers/tty/serial/meson_uart.c --- linux-lowlatency-5.15.0/drivers/tty/serial/meson_uart.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/meson_uart.c @@ -368,10 +368,14 @@ else val |= AML_UART_STOP_BIT_1SB; - if (cflags & CRTSCTS) - val &= ~AML_UART_TWO_WIRE_EN; - else + if (cflags & CRTSCTS) { + if (port->flags & UPF_HARD_FLOW) + val &= ~AML_UART_TWO_WIRE_EN; + else + termios->c_cflag &= ~CRTSCTS; + } else { val |= AML_UART_TWO_WIRE_EN; + } writel(val, port->membase + AML_UART_CONTROL); @@ -726,10 +730,12 @@ static int meson_uart_probe(struct platform_device *pdev) { - struct resource *res_mem, *res_irq; + struct resource *res_mem; struct uart_port *port; u32 fifosize = 64; /* Default is 64, 128 for EE UART_0 */ int ret = 0; + int irq; + bool has_rtscts; if (pdev->dev.of_node) pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); @@ -752,11 +758,12 @@ if (!res_mem) return -ENODEV; - res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res_irq) - return -ENODEV; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; of_property_read_u32(pdev->dev.of_node, "fifo-size", &fifosize); + has_rtscts = of_property_read_bool(pdev->dev.of_node, "uart-has-rtscts"); if (meson_ports[pdev->id]) { dev_err(&pdev->dev, "port %d already allocated\n", pdev->id); @@ -779,8 +786,10 @@ port->iotype = UPIO_MEM; port->mapbase = res_mem->start; port->mapsize = resource_size(res_mem); - port->irq = res_irq->start; + port->irq = irq; port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY; + if (has_rtscts) + port->flags |= UPF_HARD_FLOW; port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MESON_CONSOLE); port->dev = &pdev->dev; port->line = pdev->id; diff -u linux-lowlatency-5.15.0/drivers/tty/serial/sc16is7xx.c linux-lowlatency-5.15.0/drivers/tty/serial/sc16is7xx.c --- linux-lowlatency-5.15.0/drivers/tty/serial/sc16is7xx.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/sc16is7xx.c @@ -694,6 +694,18 @@ case SC16IS7XX_IIR_RTOI_SRC: case SC16IS7XX_IIR_XOFFI_SRC: rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); + + /* + * There is a silicon bug that makes the chip report a + * time-out interrupt but no data in the FIFO. This is + * described in errata section 18.1.4. + * + * When this happens, read one byte from the FIFO to + * clear the interrupt. + */ + if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen) + rxlen = 1; + if (rxlen) sc16is7xx_handle_rx(port, rxlen, iir); break; diff -u linux-lowlatency-5.15.0/drivers/tty/sysrq.c linux-lowlatency-5.15.0/drivers/tty/sysrq.c --- linux-lowlatency-5.15.0/drivers/tty/sysrq.c +++ linux-lowlatency-5.15.0/drivers/tty/sysrq.c @@ -263,13 +263,14 @@ if (in_hardirq()) regs = get_irq_regs(); - pr_info("CPU%d:\n", smp_processor_id()); + pr_info("CPU%d:\n", get_cpu()); if (regs) show_regs(regs); else show_stack(NULL, NULL, KERN_INFO); schedule_work(&sysrq_showallcpus); + put_cpu(); } } diff -u linux-lowlatency-5.15.0/drivers/usb/cdns3/cdnsp-ring.c linux-lowlatency-5.15.0/drivers/usb/cdns3/cdnsp-ring.c --- linux-lowlatency-5.15.0/drivers/usb/cdns3/cdnsp-ring.c +++ linux-lowlatency-5.15.0/drivers/usb/cdns3/cdnsp-ring.c @@ -1522,6 +1522,7 @@ unsigned long flags; int counter = 0; + local_bh_disable(); spin_lock_irqsave(&pdev->lock, flags); if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { @@ -1534,6 +1535,7 @@ cdnsp_died(pdev); spin_unlock_irqrestore(&pdev->lock, flags); + local_bh_enable(); return IRQ_HANDLED; } @@ -1550,6 +1552,7 @@ cdnsp_update_erst_dequeue(pdev, event_ring_deq, 1); spin_unlock_irqrestore(&pdev->lock, flags); + local_bh_enable(); return IRQ_HANDLED; } diff -u linux-lowlatency-5.15.0/drivers/usb/core/config.c linux-lowlatency-5.15.0/drivers/usb/core/config.c --- linux-lowlatency-5.15.0/drivers/usb/core/config.c +++ linux-lowlatency-5.15.0/drivers/usb/core/config.c @@ -61,7 +61,7 @@ desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { - dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" + dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" "for config %d interface %d altsetting %d ep %d.\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); return; @@ -83,7 +83,7 @@ if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || size < USB_DT_SS_EP_COMP_SIZE) { - dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " + dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " " interface %d altsetting %d ep %d: " "using minimum values\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); @@ -109,13 +109,13 @@ /* Check the various values */ if (usb_endpoint_xfer_control(&ep->desc) && desc->bMaxBurst != 0) { - dev_warn(ddev, "Control endpoint with bMaxBurst = %d in " + dev_notice(ddev, "Control endpoint with bMaxBurst = %d in " "config %d interface %d altsetting %d ep %d: " "setting to zero\n", desc->bMaxBurst, cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bMaxBurst = 0; } else if (desc->bMaxBurst > 15) { - dev_warn(ddev, "Endpoint with bMaxBurst = %d in " + dev_notice(ddev, "Endpoint with bMaxBurst = %d in " "config %d interface %d altsetting %d ep %d: " "setting to 15\n", desc->bMaxBurst, cfgno, inum, asnum, ep->desc.bEndpointAddress); @@ -125,7 +125,7 @@ if ((usb_endpoint_xfer_control(&ep->desc) || usb_endpoint_xfer_int(&ep->desc)) && desc->bmAttributes != 0) { - dev_warn(ddev, "%s endpoint with bmAttributes = %d in " + dev_notice(ddev, "%s endpoint with bmAttributes = %d in " "config %d interface %d altsetting %d ep %d: " "setting to zero\n", usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", @@ -134,7 +134,7 @@ ep->ss_ep_comp.bmAttributes = 0; } else if (usb_endpoint_xfer_bulk(&ep->desc) && desc->bmAttributes > 16) { - dev_warn(ddev, "Bulk endpoint with more than 65536 streams in " + dev_notice(ddev, "Bulk endpoint with more than 65536 streams in " "config %d interface %d altsetting %d ep %d: " "setting to max\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); @@ -142,7 +142,7 @@ } else if (usb_endpoint_xfer_isoc(&ep->desc) && !USB_SS_SSP_ISOC_COMP(desc->bmAttributes) && USB_SS_MULT(desc->bmAttributes) > 3) { - dev_warn(ddev, "Isoc endpoint has Mult of %d in " + dev_notice(ddev, "Isoc endpoint has Mult of %d in " "config %d interface %d altsetting %d ep %d: " "setting to 3\n", USB_SS_MULT(desc->bmAttributes), @@ -160,7 +160,7 @@ else max_tx = 999999; if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { - dev_warn(ddev, "%s endpoint with wBytesPerInterval of %d in " + dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in " "config %d interface %d altsetting %d ep %d: " "setting to %d\n", usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", @@ -273,7 +273,7 @@ else if (d->bLength >= USB_DT_ENDPOINT_SIZE) n = USB_DT_ENDPOINT_SIZE; else { - dev_warn(ddev, "config %d interface %d altsetting %d has an " + dev_notice(ddev, "config %d interface %d altsetting %d has an " "invalid endpoint descriptor of length %d, skipping\n", cfgno, inum, asnum, d->bLength); goto skip_to_next_endpoint_or_interface_descriptor; @@ -281,7 +281,7 @@ i = d->bEndpointAddress & ~USB_ENDPOINT_DIR_MASK; if (i >= 16 || i == 0) { - dev_warn(ddev, "config %d interface %d altsetting %d has an " + dev_notice(ddev, "config %d interface %d altsetting %d has an " "invalid endpoint with address 0x%X, skipping\n", cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; @@ -293,7 +293,7 @@ /* Check for duplicate endpoint addresses */ if (config_endpoint_is_duplicate(config, inum, asnum, d)) { - dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", + dev_notice(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; } @@ -301,7 +301,7 @@ /* Ignore some endpoints */ if (udev->quirks & USB_QUIRK_ENDPOINT_IGNORE) { if (usb_endpoint_is_ignored(udev, ifp, d)) { - dev_warn(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", + dev_notice(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; @@ -378,7 +378,7 @@ } } if (d->bInterval < i || d->bInterval > j) { - dev_warn(ddev, "config %d interface %d altsetting %d " + dev_notice(ddev, "config %d interface %d altsetting %d " "endpoint 0x%X has an invalid bInterval %d, " "changing to %d\n", cfgno, inum, asnum, @@ -391,7 +391,7 @@ * them usable, we will try treating them as Interrupt endpoints. */ if (udev->speed == USB_SPEED_LOW && usb_endpoint_xfer_bulk(d)) { - dev_warn(ddev, "config %d interface %d altsetting %d " + dev_notice(ddev, "config %d interface %d altsetting %d " "endpoint 0x%X is Bulk; changing to Interrupt\n", cfgno, inum, asnum, d->bEndpointAddress); endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT; @@ -408,7 +408,7 @@ */ maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize); if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", + dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", cfgno, inum, asnum, d->bEndpointAddress); } @@ -439,7 +439,7 @@ j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)]; if (maxp > j) { - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", + dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", cfgno, inum, asnum, d->bEndpointAddress, maxp, j); maxp = j; endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp); @@ -452,7 +452,7 @@ */ if (udev->speed == USB_SPEED_HIGH && usb_endpoint_xfer_bulk(d)) { if (maxp != 512) - dev_warn(ddev, "config %d interface %d altsetting %d " + dev_notice(ddev, "config %d interface %d altsetting %d " "bulk endpoint 0x%X has invalid maxpacket %d\n", cfgno, inum, asnum, d->bEndpointAddress, maxp); @@ -533,7 +533,7 @@ i < intfc->num_altsetting; (++i, ++alt)) { if (alt->desc.bAlternateSetting == asnum) { - dev_warn(ddev, "Duplicate descriptor for config %d " + dev_notice(ddev, "Duplicate descriptor for config %d " "interface %d altsetting %d, skipping\n", cfgno, inum, asnum); goto skip_to_next_interface_descriptor; @@ -559,7 +559,7 @@ num_ep = num_ep_orig = alt->desc.bNumEndpoints; alt->desc.bNumEndpoints = 0; /* Use as a counter */ if (num_ep > USB_MAXENDPOINTS) { - dev_warn(ddev, "too many endpoints for config %d interface %d " + dev_notice(ddev, "too many endpoints for config %d interface %d " "altsetting %d: %d, using maximum allowed: %d\n", cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS); num_ep = USB_MAXENDPOINTS; @@ -590,7 +590,7 @@ } if (n != num_ep_orig) - dev_warn(ddev, "config %d interface %d altsetting %d has %d " + dev_notice(ddev, "config %d interface %d altsetting %d has %d " "endpoint descriptor%s, different from the interface " "descriptor's value: %d\n", cfgno, inum, asnum, n, plural(n), num_ep_orig); @@ -625,7 +625,7 @@ if (config->desc.bDescriptorType != USB_DT_CONFIG || config->desc.bLength < USB_DT_CONFIG_SIZE || config->desc.bLength > size) { - dev_err(ddev, "invalid descriptor for config index %d: " + dev_notice(ddev, "invalid descriptor for config index %d: " "type = 0x%X, length = %d\n", cfgidx, config->desc.bDescriptorType, config->desc.bLength); return -EINVAL; @@ -636,7 +636,7 @@ size -= config->desc.bLength; if (nintf > USB_MAXINTERFACES) { - dev_warn(ddev, "config %d has too many interfaces: %d, " + dev_notice(ddev, "config %d has too many interfaces: %d, " "using maximum allowed: %d\n", cfgno, nintf, USB_MAXINTERFACES); nintf = USB_MAXINTERFACES; @@ -650,7 +650,7 @@ (buffer2 += header->bLength, size2 -= header->bLength)) { if (size2 < sizeof(struct usb_descriptor_header)) { - dev_warn(ddev, "config %d descriptor has %d excess " + dev_notice(ddev, "config %d descriptor has %d excess " "byte%s, ignoring\n", cfgno, size2, plural(size2)); break; @@ -658,7 +658,7 @@ header = (struct usb_descriptor_header *) buffer2; if ((header->bLength > size2) || (header->bLength < 2)) { - dev_warn(ddev, "config %d has an invalid descriptor " + dev_notice(ddev, "config %d has an invalid descriptor " "of length %d, skipping remainder of the config\n", cfgno, header->bLength); break; @@ -670,7 +670,7 @@ d = (struct usb_interface_descriptor *) header; if (d->bLength < USB_DT_INTERFACE_SIZE) { - dev_warn(ddev, "config %d has an invalid " + dev_notice(ddev, "config %d has an invalid " "interface descriptor of length %d, " "skipping\n", cfgno, d->bLength); continue; @@ -680,7 +680,7 @@ if ((dev->quirks & USB_QUIRK_HONOR_BNUMINTERFACES) && n >= nintf_orig) { - dev_warn(ddev, "config %d has more interface " + dev_notice(ddev, "config %d has more interface " "descriptors, than it declares in " "bNumInterfaces, ignoring interface " "number: %d\n", cfgno, inum); @@ -688,7 +688,7 @@ } if (inum >= nintf_orig) - dev_warn(ddev, "config %d has an invalid " + dev_notice(ddev, "config %d has an invalid " "interface number: %d but max is %d\n", cfgno, inum, nintf_orig - 1); @@ -713,14 +713,14 @@ d = (struct usb_interface_assoc_descriptor *)header; if (d->bLength < USB_DT_INTERFACE_ASSOCIATION_SIZE) { - dev_warn(ddev, + dev_notice(ddev, "config %d has an invalid interface association descriptor of length %d, skipping\n", cfgno, d->bLength); continue; } if (iad_num == USB_MAXIADS) { - dev_warn(ddev, "found more Interface " + dev_notice(ddev, "found more Interface " "Association Descriptors " "than allocated for in " "configuration %d\n", cfgno); @@ -731,7 +731,7 @@ } else if (header->bDescriptorType == USB_DT_DEVICE || header->bDescriptorType == USB_DT_CONFIG) - dev_warn(ddev, "config %d contains an unexpected " + dev_notice(ddev, "config %d contains an unexpected " "descriptor of type 0x%X, skipping\n", cfgno, header->bDescriptorType); @@ -740,11 +740,11 @@ config->desc.wTotalLength = cpu_to_le16(buffer2 - buffer0); if (n != nintf) - dev_warn(ddev, "config %d has %d interface%s, different from " + dev_notice(ddev, "config %d has %d interface%s, different from " "the descriptor's value: %d\n", cfgno, n, plural(n), nintf_orig); else if (n == 0) - dev_warn(ddev, "config %d has no interfaces?\n", cfgno); + dev_notice(ddev, "config %d has no interfaces?\n", cfgno); config->desc.bNumInterfaces = nintf = n; /* Check for missing interface numbers */ @@ -754,7 +754,7 @@ break; } if (j >= nintf) - dev_warn(ddev, "config %d has no interface number " + dev_notice(ddev, "config %d has no interface number " "%d\n", cfgno, i); } @@ -762,7 +762,7 @@ for (i = 0; i < nintf; ++i) { j = nalts[i]; if (j > USB_MAXALTSETTING) { - dev_warn(ddev, "too many alternate settings for " + dev_notice(ddev, "too many alternate settings for " "config %d interface %d: %d, " "using maximum allowed: %d\n", cfgno, inums[i], j, USB_MAXALTSETTING); @@ -811,7 +811,7 @@ break; } if (n >= intfc->num_altsetting) - dev_warn(ddev, "config %d interface %d has no " + dev_notice(ddev, "config %d interface %d has no " "altsetting %d\n", cfgno, inums[i], j); } } @@ -868,7 +868,7 @@ int result; if (ncfg > USB_MAXCONFIG) { - dev_warn(ddev, "too many configurations: %d, " + dev_notice(ddev, "too many configurations: %d, " "using maximum allowed: %d\n", ncfg, USB_MAXCONFIG); dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; } @@ -902,7 +902,7 @@ "descriptor/%s: %d\n", cfgno, "start", result); if (result != -EPIPE) goto err; - dev_err(ddev, "chopping to %d config(s)\n", cfgno); + dev_notice(ddev, "chopping to %d config(s)\n", cfgno); dev->descriptor.bNumConfigurations = cfgno; break; } else if (result < 4) { @@ -934,7 +934,7 @@ goto err; } if (result < length) { - dev_warn(ddev, "config index %d descriptor too short " + dev_notice(ddev, "config index %d descriptor too short " "(expected %i, got %i)\n", cfgno, length, result); length = result; } @@ -993,7 +993,7 @@ /* Get BOS descriptor */ ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE); if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) { - dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n"); + dev_notice(ddev, "unable to get BOS descriptor or descriptor too short\n"); if (ret >= 0) ret = -ENOMSG; kfree(bos); @@ -1021,7 +1021,7 @@ ret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len); if (ret < total_len) { - dev_err(ddev, "unable to get BOS descriptor set\n"); + dev_notice(ddev, "unable to get BOS descriptor set\n"); if (ret >= 0) ret = -ENOMSG; goto err; @@ -1046,8 +1046,8 @@ } if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { - dev_warn(ddev, "descriptor type invalid, skip\n"); - continue; + dev_notice(ddev, "descriptor type invalid, skip\n"); + goto skip_to_next_descriptor; } switch (cap_type) { @@ -1081,6 +1081,7 @@ break; } +skip_to_next_descriptor: total_len -= length; buffer += length; } diff -u linux-lowlatency-5.15.0/drivers/usb/dwc2/hcd.c linux-lowlatency-5.15.0/drivers/usb/dwc2/hcd.c --- linux-lowlatency-5.15.0/drivers/usb/dwc2/hcd.c +++ linux-lowlatency-5.15.0/drivers/usb/dwc2/hcd.c @@ -4802,8 +4802,8 @@ if (qh_allocated && qh->channel && qh->channel->qh == qh) qh->channel->qh = NULL; fail2: - spin_unlock_irqrestore(&hsotg->lock, flags); urb->hcpriv = NULL; + spin_unlock_irqrestore(&hsotg->lock, flags); kfree(qtd); fail1: if (qh_allocated) { diff -u linux-lowlatency-5.15.0/drivers/usb/dwc3/core.c linux-lowlatency-5.15.0/drivers/usb/dwc3/core.c --- linux-lowlatency-5.15.0/drivers/usb/dwc3/core.c +++ linux-lowlatency-5.15.0/drivers/usb/dwc3/core.c @@ -1701,6 +1701,8 @@ pm_runtime_put(dev); + dma_set_max_seg_size(dev, UINT_MAX); + return 0; err5: diff -u linux-lowlatency-5.15.0/drivers/usb/dwc3/drd.c linux-lowlatency-5.15.0/drivers/usb/dwc3/drd.c --- linux-lowlatency-5.15.0/drivers/usb/dwc3/drd.c +++ linux-lowlatency-5.15.0/drivers/usb/dwc3/drd.c @@ -545,6 +545,7 @@ dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL; mode = DWC3_GCTL_PRTCAP_DEVICE; } + dwc3_set_mode(dwc, mode); dwc3_role_switch.fwnode = dev_fwnode(dwc->dev); dwc3_role_switch.set = dwc3_usb_role_switch_set; @@ -554,7 +555,6 @@ if (IS_ERR(dwc->role_sw)) return PTR_ERR(dwc->role_sw); - dwc3_set_mode(dwc, mode); return 0; } #else diff -u linux-lowlatency-5.15.0/drivers/usb/dwc3/dwc3-qcom.c linux-lowlatency-5.15.0/drivers/usb/dwc3/dwc3-qcom.c --- linux-lowlatency-5.15.0/drivers/usb/dwc3/dwc3-qcom.c +++ linux-lowlatency-5.15.0/drivers/usb/dwc3/dwc3-qcom.c @@ -492,7 +492,7 @@ irq_set_status_flags(irq, IRQ_NOAUTOEN); ret = devm_request_threaded_irq(qcom->dev, irq, NULL, qcom_dwc3_resume_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + IRQF_ONESHOT, "qcom_dwc3 HS", qcom); if (ret) { dev_err(qcom->dev, "hs_phy_irq failed: %d\n", ret); @@ -507,7 +507,7 @@ irq_set_status_flags(irq, IRQ_NOAUTOEN); ret = devm_request_threaded_irq(qcom->dev, irq, NULL, qcom_dwc3_resume_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + IRQF_ONESHOT, "qcom_dwc3 DP_HS", qcom); if (ret) { dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); @@ -522,7 +522,7 @@ irq_set_status_flags(irq, IRQ_NOAUTOEN); ret = devm_request_threaded_irq(qcom->dev, irq, NULL, qcom_dwc3_resume_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + IRQF_ONESHOT, "qcom_dwc3 DM_HS", qcom); if (ret) { dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); @@ -537,7 +537,7 @@ irq_set_status_flags(irq, IRQ_NOAUTOEN); ret = devm_request_threaded_irq(qcom->dev, irq, NULL, qcom_dwc3_resume_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + IRQF_ONESHOT, "qcom_dwc3 SS", qcom); if (ret) { dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); @@ -626,8 +626,10 @@ qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); - if (!child_res) + if (!child_res) { + platform_device_put(qcom->dwc3); return -ENOMEM; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -665,9 +667,13 @@ if (ret) { dev_err(&pdev->dev, "failed to add device\n"); device_remove_software_node(&qcom->dwc3->dev); + goto out; } + kfree(child_res); + return 0; out: + platform_device_put(qcom->dwc3); kfree(child_res); return ret; } @@ -695,6 +701,7 @@ if (!qcom->dwc3) { ret = -ENODEV; dev_err(dev, "failed to get dwc3 platform device\n"); + of_platform_depopulate(dev); } node_put: @@ -703,9 +710,9 @@ return ret; } -static struct platform_device * -dwc3_qcom_create_urs_usb_platdev(struct device *dev) +static struct platform_device *dwc3_qcom_create_urs_usb_platdev(struct device *dev) { + struct platform_device *urs_usb = NULL; struct fwnode_handle *fwh; struct acpi_device *adev; char name[8]; @@ -725,9 +732,26 @@ adev = to_acpi_device_node(fwh); if (!adev) - return NULL; + goto err_put_handle; + + urs_usb = acpi_create_platform_device(adev, NULL); + if (IS_ERR_OR_NULL(urs_usb)) + goto err_put_handle; + + return urs_usb; + +err_put_handle: + fwnode_handle_put(fwh); + + return urs_usb; +} + +static void dwc3_qcom_destroy_urs_usb_platdev(struct platform_device *urs_usb) +{ + struct fwnode_handle *fwh = urs_usb->dev.fwnode; - return acpi_create_platform_device(adev, NULL); + platform_device_unregister(urs_usb); + fwnode_handle_put(fwh); } static int dwc3_qcom_probe(struct platform_device *pdev) @@ -811,13 +835,13 @@ qcom->qscratch_base = devm_ioremap_resource(dev, parent_res); if (IS_ERR(qcom->qscratch_base)) { ret = PTR_ERR(qcom->qscratch_base); - goto clk_disable; + goto free_urs; } ret = dwc3_qcom_setup_irq(pdev); if (ret) { dev_err(dev, "failed to setup IRQs, err=%d\n", ret); - goto clk_disable; + goto free_urs; } /* @@ -836,7 +860,7 @@ if (ret) { dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret); - goto depopulate; + goto free_urs; } ret = dwc3_qcom_interconnect_init(qcom); @@ -865,10 +889,16 @@ interconnect_exit: dwc3_qcom_interconnect_exit(qcom); depopulate: - if (np) + if (np) { of_platform_depopulate(&pdev->dev); - else - platform_device_put(pdev); + } else { + device_remove_software_node(&qcom->dwc3->dev); + platform_device_del(qcom->dwc3); + } + platform_device_put(qcom->dwc3); +free_urs: + if (qcom->urs_usb) + dwc3_qcom_destroy_urs_usb_platdev(qcom->urs_usb); clk_disable: for (i = qcom->num_clocks - 1; i >= 0; i--) { clk_disable_unprepare(qcom->clks[i]); @@ -887,11 +917,16 @@ struct device *dev = &pdev->dev; int i; - device_remove_software_node(&qcom->dwc3->dev); - if (np) + if (np) { of_platform_depopulate(&pdev->dev); - else - platform_device_put(pdev); + } else { + device_remove_software_node(&qcom->dwc3->dev); + platform_device_del(qcom->dwc3); + } + platform_device_put(qcom->dwc3); + + if (qcom->urs_usb) + dwc3_qcom_destroy_urs_usb_platdev(qcom->urs_usb); for (i = qcom->num_clocks - 1; i >= 0; i--) { clk_disable_unprepare(qcom->clks[i]); diff -u linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_hid.c linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_hid.c --- linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_hid.c +++ linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_hid.c @@ -88,6 +88,7 @@ { struct f_hidg *hidg = container_of(dev, struct f_hidg, dev); + kfree(hidg->report_desc); kfree(hidg->set_report_buf); kfree(hidg); } @@ -1287,9 +1288,9 @@ hidg->report_length = opts->report_length; hidg->report_desc_length = opts->report_desc_length; if (opts->report_desc) { - hidg->report_desc = devm_kmemdup(&hidg->dev, opts->report_desc, - opts->report_desc_length, - GFP_KERNEL); + hidg->report_desc = kmemdup(opts->report_desc, + opts->report_desc_length, + GFP_KERNEL); if (!hidg->report_desc) { put_device(&hidg->dev); --opts->refcnt; diff -u linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_ncm.c linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_ncm.c --- linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_ncm.c +++ linux-lowlatency-5.15.0/drivers/usb/gadget/function/f_ncm.c @@ -1429,7 +1429,7 @@ struct usb_composite_dev *cdev = c->cdev; struct f_ncm *ncm = func_to_ncm(f); struct usb_string *us; - int status; + int status = 0; struct usb_ep *ep; struct f_ncm_opts *ncm_opts; @@ -1447,22 +1447,17 @@ f->os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc; } - /* - * in drivers/usb/gadget/configfs.c:configfs_composite_bind() - * configurations are bound in sequence with list_for_each_entry, - * in each configuration its functions are bound in sequence - * with list_for_each_entry, so we assume no race condition - * with regard to ncm_opts->bound access - */ - if (!ncm_opts->bound) { - mutex_lock(&ncm_opts->lock); - gether_set_gadget(ncm_opts->net, cdev->gadget); + mutex_lock(&ncm_opts->lock); + gether_set_gadget(ncm_opts->net, cdev->gadget); + if (!ncm_opts->bound) status = gether_register_netdev(ncm_opts->net); - mutex_unlock(&ncm_opts->lock); - if (status) - goto fail; - ncm_opts->bound = true; - } + mutex_unlock(&ncm_opts->lock); + + if (status) + goto fail; + + ncm_opts->bound = true; + us = usb_gstrings_attach(cdev, ncm_strings, ARRAY_SIZE(ncm_string_defs)); if (IS_ERR(us)) { diff -u linux-lowlatency-5.15.0/drivers/usb/gadget/legacy/raw_gadget.c linux-lowlatency-5.15.0/drivers/usb/gadget/legacy/raw_gadget.c --- linux-lowlatency-5.15.0/drivers/usb/gadget/legacy/raw_gadget.c +++ linux-lowlatency-5.15.0/drivers/usb/gadget/legacy/raw_gadget.c @@ -663,12 +663,12 @@ if (WARN_ON(in && dev->ep0_out_pending)) { ret = -ENODEV; dev->state = STATE_DEV_FAILED; - goto out_done; + goto out_unlock; } if (WARN_ON(!in && dev->ep0_in_pending)) { ret = -ENODEV; dev->state = STATE_DEV_FAILED; - goto out_done; + goto out_unlock; } dev->req->buf = data; @@ -683,7 +683,7 @@ "fail, usb_ep_queue returned %d\n", ret); spin_lock_irqsave(&dev->lock, flags); dev->state = STATE_DEV_FAILED; - goto out_done; + goto out_queue_failed; } ret = wait_for_completion_interruptible(&dev->ep0_done); @@ -692,13 +692,16 @@ usb_ep_dequeue(dev->gadget->ep0, dev->req); wait_for_completion(&dev->ep0_done); spin_lock_irqsave(&dev->lock, flags); - goto out_done; + if (dev->ep0_status == -ECONNRESET) + dev->ep0_status = -EINTR; + goto out_interrupted; } spin_lock_irqsave(&dev->lock, flags); - ret = dev->ep0_status; -out_done: +out_interrupted: + ret = dev->ep0_status; +out_queue_failed: dev->ep0_urb_queued = false; out_unlock: spin_unlock_irqrestore(&dev->lock, flags); @@ -1060,7 +1063,7 @@ "fail, usb_ep_queue returned %d\n", ret); spin_lock_irqsave(&dev->lock, flags); dev->state = STATE_DEV_FAILED; - goto out_done; + goto out_queue_failed; } ret = wait_for_completion_interruptible(&done); @@ -1069,13 +1072,16 @@ usb_ep_dequeue(ep->ep, ep->req); wait_for_completion(&done); spin_lock_irqsave(&dev->lock, flags); - goto out_done; + if (ep->status == -ECONNRESET) + ep->status = -EINTR; + goto out_interrupted; } spin_lock_irqsave(&dev->lock, flags); - ret = ep->status; -out_done: +out_interrupted: + ret = ep->status; +out_queue_failed: ep->urb_queued = false; out_unlock: spin_unlock_irqrestore(&dev->lock, flags); diff -u linux-lowlatency-5.15.0/drivers/usb/host/xhci-pci.c linux-lowlatency-5.15.0/drivers/usb/host/xhci-pci.c --- linux-lowlatency-5.15.0/drivers/usb/host/xhci-pci.c +++ linux-lowlatency-5.15.0/drivers/usb/host/xhci-pci.c @@ -516,7 +516,9 @@ /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ pm_runtime_put_noidle(&dev->dev); - if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) + if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) + pm_runtime_forbid(&dev->dev); + else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) pm_runtime_allow(&dev->dev); dma_set_max_seg_size(&dev->dev, UINT_MAX); diff -u linux-lowlatency-5.15.0/drivers/usb/host/xhci-plat.c linux-lowlatency-5.15.0/drivers/usb/host/xhci-plat.c --- linux-lowlatency-5.15.0/drivers/usb/host/xhci-plat.c +++ linux-lowlatency-5.15.0/drivers/usb/host/xhci-plat.c @@ -466,23 +466,38 @@ int ret; if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { - clk_prepare_enable(xhci->clk); - clk_prepare_enable(xhci->reg_clk); + ret = clk_prepare_enable(xhci->clk); + if (ret) + return ret; + + ret = clk_prepare_enable(xhci->reg_clk); + if (ret) { + clk_disable_unprepare(xhci->clk); + return ret; + } } ret = xhci_priv_resume_quirk(hcd); if (ret) - return ret; + goto disable_clks; ret = xhci_resume(xhci, 0); if (ret) - return ret; + goto disable_clks; pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); return 0; + +disable_clks: + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_disable_unprepare(xhci->clk); + clk_disable_unprepare(xhci->reg_clk); + } + + return ret; } static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) diff -u linux-lowlatency-5.15.0/drivers/usb/serial/option.c linux-lowlatency-5.15.0/drivers/usb/serial/option.c --- linux-lowlatency-5.15.0/drivers/usb/serial/option.c +++ linux-lowlatency-5.15.0/drivers/usb/serial/option.c @@ -204,4 +204,7 @@ #define DELL_PRODUCT_5829E 0x81e6 +#define DELL_PRODUCT_FM101R_ESIM 0x8213 +#define DELL_PRODUCT_FM101R 0x8215 + #define KYOCERA_VENDOR_ID 0x0c88 #define KYOCERA_PRODUCT_KPC650 0x17da @@ -606,6 +609,8 @@ #define UNISOC_VENDOR_ID 0x1782 /* TOZED LT70-C based on UNISOC SL8563 uses UNISOC's vendor ID */ #define TOZED_PRODUCT_LT70C 0x4055 +/* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */ +#define LUAT_PRODUCT_AIR720U 0x4e00 /* Device flags */ @@ -1108,6 +1113,8 @@ .driver_info = RSVD(0) | RSVD(6) }, { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM), .driver_info = RSVD(0) | RSVD(6) }, + { USB_DEVICE_INTERFACE_CLASS(DELL_VENDOR_ID, DELL_PRODUCT_FM101R, 0xff) }, + { USB_DEVICE_INTERFACE_CLASS(DELL_VENDOR_ID, DELL_PRODUCT_FM101R_ESIM, 0xff) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, @@ -1290,6 +1297,7 @@ .driver_info = NCTRL(0) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1033, 0xff), /* Telit LE910C1-EUX (ECM) */ .driver_info = NCTRL(0) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1035, 0xff) }, /* Telit LE910C4-WWX (ECM) */ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1), @@ -1540,7 +1548,8 @@ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), .driver_info = RSVD(4) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0189, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0189, 0xff, 0xff, 0xff), + .driver_info = RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0191, 0xff, 0xff, 0xff), /* ZTE EuFi890 */ .driver_info = RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0196, 0xff, 0xff, 0xff) }, @@ -2243,6 +2252,7 @@ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, { USB_DEVICE(0x1782, 0x4d10) }, /* Fibocom L610 (AT mode) */ { USB_DEVICE_INTERFACE_CLASS(0x1782, 0x4d11, 0xff) }, /* Fibocom L610 (ECM/RNDIS mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x0001, 0xff, 0xff, 0xff) }, /* Fibocom L716-EU (ECM/RNDIS mode) */ { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ .driver_info = RSVD(4) | RSVD(5) }, { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ @@ -2262,8 +2272,10 @@ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); diff -u linux-lowlatency-5.15.0/drivers/usb/typec/class.c linux-lowlatency-5.15.0/drivers/usb/typec/class.c --- linux-lowlatency-5.15.0/drivers/usb/typec/class.c +++ linux-lowlatency-5.15.0/drivers/usb/typec/class.c @@ -265,7 +265,7 @@ if (!partner) return; - adev = &partner->adev; + adev = &altmode->adev; if (is_typec_plug(adev->dev.parent)) { struct typec_plug *plug = to_typec_plug(adev->dev.parent); @@ -495,7 +495,8 @@ { struct altmode *alt = to_altmode(to_typec_altmode(dev)); - typec_altmode_put_partner(alt); + if (!is_typec_port(dev->parent)) + typec_altmode_put_partner(alt); altmode_id_remove(alt->adev.dev.parent, alt->id); kfree(alt); diff -u linux-lowlatency-5.15.0/drivers/usb/typec/tcpm/tcpm.c linux-lowlatency-5.15.0/drivers/usb/typec/tcpm/tcpm.c --- linux-lowlatency-5.15.0/drivers/usb/typec/tcpm/tcpm.c +++ linux-lowlatency-5.15.0/drivers/usb/typec/tcpm/tcpm.c @@ -1608,6 +1608,9 @@ if (PD_VDO_VID(p[0]) != USB_SID_PD) break; + if (IS_ERR_OR_NULL(port->partner)) + break; + if (PD_VDO_SVDM_VER(p[0]) < svdm_version) { typec_partner_set_svdm_version(port->partner, PD_VDO_SVDM_VER(p[0])); @@ -5347,6 +5350,15 @@ if (port->bist_request == BDO_MODE_TESTDATA && port->tcpc->set_bist_data) port->tcpc->set_bist_data(port->tcpc, false); + switch (port->state) { + case ERROR_RECOVERY: + case PORT_RESET: + case PORT_RESET_WAIT_OFF: + return; + default: + break; + } + if (port->ams != NONE_AMS) port->ams = NONE_AMS; if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) diff -u linux-lowlatency-5.15.0/drivers/usb/usbip/stub_dev.c linux-lowlatency-5.15.0/drivers/usb/usbip/stub_dev.c --- linux-lowlatency-5.15.0/drivers/usb/usbip/stub_dev.c +++ linux-lowlatency-5.15.0/drivers/usb/usbip/stub_dev.c @@ -462,8 +462,13 @@ /* release port */ rc = usb_hub_release_port(udev->parent, udev->portnum, (struct usb_dev_state *) udev); - if (rc) { - dev_dbg(&udev->dev, "unable to release port\n"); + /* + * NOTE: If a HUB disconnect triggered disconnect of the down stream + * device usb_hub_release_port will return -ENODEV so we can safely ignore + * that error here. + */ + if (rc && (rc != -ENODEV)) { + dev_dbg(&udev->dev, "unable to release port (%i)\n", rc); return; } diff -u linux-lowlatency-5.15.0/drivers/vdpa/mlx5/net/mlx5_vnet.c linux-lowlatency-5.15.0/drivers/vdpa/mlx5/net/mlx5_vnet.c --- linux-lowlatency-5.15.0/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ linux-lowlatency-5.15.0/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2178,13 +2178,18 @@ struct mlx5_control_vq *cvq = &mvdev->cvq; int err = 0; - if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) + if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) { + u16 idx = cvq->vring.last_avail_idx; + err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features, MLX5_CVQ_MAX_ENT, false, (struct vring_desc *)(uintptr_t)cvq->desc_addr, (struct vring_avail *)(uintptr_t)cvq->driver_addr, (struct vring_used *)(uintptr_t)cvq->device_addr); + if (!err) + cvq->vring.last_avail_idx = cvq->vring.last_used_idx = idx; + } return err; } diff -u linux-lowlatency-5.15.0/drivers/vhost/vhost.c linux-lowlatency-5.15.0/drivers/vhost/vhost.c --- linux-lowlatency-5.15.0/drivers/vhost/vhost.c +++ linux-lowlatency-5.15.0/drivers/vhost/vhost.c @@ -1171,9 +1171,7 @@ goto done; } - if ((msg.type == VHOST_IOTLB_UPDATE || - msg.type == VHOST_IOTLB_INVALIDATE) && - msg.size == 0) { + if (msg.type == VHOST_IOTLB_UPDATE && msg.size == 0) { ret = -EINVAL; goto done; } @@ -2584,12 +2582,11 @@ /* Create a new message. */ struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type) { - struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL); + /* Make sure all padding within the structure is initialized. */ + struct vhost_msg_node *node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return NULL; - /* Make sure all padding within the structure is initialized. */ - memset(&node->msg, 0, sizeof node->msg); node->vq = vq; node->msg.type = type; return node; diff -u linux-lowlatency-5.15.0/drivers/video/fbdev/imsttfb.c linux-lowlatency-5.15.0/drivers/video/fbdev/imsttfb.c --- linux-lowlatency-5.15.0/drivers/video/fbdev/imsttfb.c +++ linux-lowlatency-5.15.0/drivers/video/fbdev/imsttfb.c @@ -1489,8 +1489,8 @@ if (!request_mem_region(addr, size, "imsttfb")) { printk(KERN_ERR "imsttfb: Can't reserve memory region\n"); - framebuffer_release(info); - return -ENODEV; + ret = -ENODEV; + goto release_info; } switch (pdev->device) { @@ -1507,34 +1507,39 @@ printk(KERN_INFO "imsttfb: Device 0x%x unknown, " "contact maintainer.\n", pdev->device); ret = -ENODEV; - goto error; + goto release_mem_region; } info->fix.smem_start = addr; info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 0x400000 : 0x800000); if (!info->screen_base) - goto error; + goto release_mem_region; info->fix.mmio_start = addr + 0x800000; par->dc_regs = ioremap(addr + 0x800000, 0x1000); if (!par->dc_regs) - goto error; + goto unmap_screen_base; par->cmap_regs_phys = addr + 0x840000; par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); if (!par->cmap_regs) - goto error; + goto unmap_dc_regs; info->pseudo_palette = par->palette; ret = init_imstt(info); - if (!ret) - pci_set_drvdata(pdev, info); - return ret; + if (ret) + goto unmap_cmap_regs; + + pci_set_drvdata(pdev, info); + return 0; -error: - if (par->dc_regs) - iounmap(par->dc_regs); - if (info->screen_base) - iounmap(info->screen_base); +unmap_cmap_regs: + iounmap(par->cmap_regs); +unmap_dc_regs: + iounmap(par->dc_regs); +unmap_screen_base: + iounmap(info->screen_base); +release_mem_region: release_mem_region(addr, size); +release_info: framebuffer_release(info); return ret; } diff -u linux-lowlatency-5.15.0/drivers/video/fbdev/sticore.h linux-lowlatency-5.15.0/drivers/video/fbdev/sticore.h --- linux-lowlatency-5.15.0/drivers/video/fbdev/sticore.h +++ linux-lowlatency-5.15.0/drivers/video/fbdev/sticore.h @@ -231,7 +231,7 @@ u8 height; u8 font_type; /* language type */ u8 bytes_per_char; - u32 next_font; + s32 next_font; /* note: signed int */ u8 underline_height; u8 underline_pos; u8 res008[2]; diff -u linux-lowlatency-5.15.0/drivers/video/fbdev/uvesafb.c linux-lowlatency-5.15.0/drivers/video/fbdev/uvesafb.c --- linux-lowlatency-5.15.0/drivers/video/fbdev/uvesafb.c +++ linux-lowlatency-5.15.0/drivers/video/fbdev/uvesafb.c @@ -1935,10 +1935,10 @@ } } - cn_del_callback(&uvesafb_cn_id); driver_remove_file(&uvesafb_driver.driver, &driver_attr_v86d); platform_device_unregister(uvesafb_device); platform_driver_unregister(&uvesafb_driver); + cn_del_callback(&uvesafb_cn_id); } module_exit(uvesafb_exit); diff -u linux-lowlatency-5.15.0/drivers/virtio/virtio_mmio.c linux-lowlatency-5.15.0/drivers/virtio/virtio_mmio.c --- linux-lowlatency-5.15.0/drivers/virtio/virtio_mmio.c +++ linux-lowlatency-5.15.0/drivers/virtio/virtio_mmio.c @@ -596,14 +596,17 @@ spin_lock_init(&vm_dev->lock); vm_dev->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(vm_dev->base)) - return PTR_ERR(vm_dev->base); + if (IS_ERR(vm_dev->base)) { + rc = PTR_ERR(vm_dev->base); + goto free_vm_dev; + } /* Check magic value */ magic = readl(vm_dev->base + VIRTIO_MMIO_MAGIC_VALUE); if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) { dev_warn(&pdev->dev, "Wrong magic value 0x%08lx!\n", magic); - return -ENODEV; + rc = -ENODEV; + goto free_vm_dev; } /* Check device version */ @@ -611,7 +614,8 @@ if (vm_dev->version < 1 || vm_dev->version > 2) { dev_err(&pdev->dev, "Version %ld not supported!\n", vm_dev->version); - return -ENXIO; + rc = -ENXIO; + goto free_vm_dev; } vm_dev->vdev.id.device = readl(vm_dev->base + VIRTIO_MMIO_DEVICE_ID); @@ -620,7 +624,8 @@ * virtio-mmio device with an ID 0 is a (dummy) placeholder * with no function. End probing now with no error reported. */ - return -ENODEV; + rc = -ENODEV; + goto free_vm_dev; } vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID); @@ -650,6 +655,10 @@ put_device(&vm_dev->vdev.dev); return rc; + +free_vm_dev: + kfree(vm_dev); + return rc; } static int virtio_mmio_remove(struct platform_device *pdev) diff -u linux-lowlatency-5.15.0/drivers/watchdog/sbsa_gwdt.c linux-lowlatency-5.15.0/drivers/watchdog/sbsa_gwdt.c --- linux-lowlatency-5.15.0/drivers/watchdog/sbsa_gwdt.c +++ linux-lowlatency-5.15.0/drivers/watchdog/sbsa_gwdt.c @@ -153,14 +153,14 @@ timeout = clamp_t(unsigned int, timeout, 1, wdd->max_hw_heartbeat_ms / 1000); if (action) - sbsa_gwdt_reg_write(gwdt->clk * timeout, gwdt); + sbsa_gwdt_reg_write((u64)gwdt->clk * timeout, gwdt); else /* * In the single stage mode, The first signal (WS0) is ignored, * the timeout is (WOR * 2), so the WOR should be configured * to half value of timeout. */ - sbsa_gwdt_reg_write(gwdt->clk / 2 * timeout, gwdt); + sbsa_gwdt_reg_write(((u64)gwdt->clk / 2) * timeout, gwdt); return 0; } diff -u linux-lowlatency-5.15.0/drivers/xen/events/events_base.c linux-lowlatency-5.15.0/drivers/xen/events/events_base.c --- linux-lowlatency-5.15.0/drivers/xen/events/events_base.c +++ linux-lowlatency-5.15.0/drivers/xen/events/events_base.c @@ -599,7 +599,9 @@ spin_lock_irqsave(&eoi->eoi_list_lock, flags); - if (list_empty(&eoi->eoi_list)) { + elem = list_first_entry_or_null(&eoi->eoi_list, struct irq_info, + eoi_list); + if (!elem || info->eoi_time < elem->eoi_time) { list_add(&info->eoi_list, &eoi->eoi_list); mod_delayed_work_on(info->eoi_cpu, system_wq, &eoi->delayed, delay); diff -u linux-lowlatency-5.15.0/drivers/xen/swiotlb-xen.c linux-lowlatency-5.15.0/drivers/xen/swiotlb-xen.c --- linux-lowlatency-5.15.0/drivers/xen/swiotlb-xen.c +++ linux-lowlatency-5.15.0/drivers/xen/swiotlb-xen.c @@ -566,2 +566,3 @@ .free_pages = dma_common_free_pages, + .max_mapping_size = swiotlb_max_mapping_size, }; diff -u linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space_capability.c linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space_capability.c --- linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space_capability.c +++ linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space_capability.c @@ -236,10 +236,16 @@ return PCIBIOS_SET_FAILED; if (new_value & field_config->enable_bit) { - /* don't allow enabling together with other interrupt types */ + /* + * Don't allow enabling together with other interrupt type, but do + * allow enabling MSI(-X) while INTx is still active to please Linuxes + * MSI(-X) startup sequence. It is safe to do, as according to PCI + * spec, device with enabled MSI(-X) shouldn't use INTx. + */ int int_type = xen_pcibk_get_interrupt_type(dev); if (int_type == INTERRUPT_TYPE_NONE || + int_type == INTERRUPT_TYPE_INTX || int_type == field_config->int_type) goto write; return PCIBIOS_SET_FAILED; diff -u linux-lowlatency-5.15.0/fs/afs/internal.h linux-lowlatency-5.15.0/fs/afs/internal.h --- linux-lowlatency-5.15.0/fs/afs/internal.h +++ linux-lowlatency-5.15.0/fs/afs/internal.h @@ -556,6 +556,7 @@ }; struct afs_server_list { + struct rcu_head rcu; afs_volid_t vids[AFS_MAXTYPES]; /* Volume IDs */ refcount_t usage; unsigned char nr_servers; diff -u linux-lowlatency-5.15.0/fs/afs/super.c linux-lowlatency-5.15.0/fs/afs/super.c --- linux-lowlatency-5.15.0/fs/afs/super.c +++ linux-lowlatency-5.15.0/fs/afs/super.c @@ -406,6 +406,8 @@ return PTR_ERR(volume); ctx->volume = volume; + if (volume->type != AFSVL_RWVOL) + ctx->flock_mode = afs_flock_mode_local; } return 0; diff -u linux-lowlatency-5.15.0/fs/btrfs/ctree.c linux-lowlatency-5.15.0/fs/btrfs/ctree.c --- linux-lowlatency-5.15.0/fs/btrfs/ctree.c +++ linux-lowlatency-5.15.0/fs/btrfs/ctree.c @@ -545,18 +545,30 @@ u64 search_start; int ret; - if (test_bit(BTRFS_ROOT_DELETING, &root->state)) - btrfs_err(fs_info, - "COW'ing blocks on a fs root that's being dropped"); - - if (trans->transaction != fs_info->running_transaction) - WARN(1, KERN_CRIT "trans %llu running %llu\n", - trans->transid, - fs_info->running_transaction->transid); - - if (trans->transid != fs_info->generation) - WARN(1, KERN_CRIT "trans %llu running %llu\n", - trans->transid, fs_info->generation); + if (unlikely(test_bit(BTRFS_ROOT_DELETING, &root->state))) { + btrfs_abort_transaction(trans, -EUCLEAN); + btrfs_crit(fs_info, + "attempt to COW block %llu on root %llu that is being deleted", + buf->start, btrfs_root_id(root)); + return -EUCLEAN; + } + + /* + * COWing must happen through a running transaction, which always + * matches the current fs generation (it's a transaction with a state + * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs + * into error state to prevent the commit of any transaction. + */ + if (unlikely(trans->transaction != fs_info->running_transaction || + trans->transid != fs_info->generation)) { + btrfs_abort_transaction(trans, -EUCLEAN); + btrfs_crit(fs_info, +"unexpected transaction when attempting to COW block %llu on root %llu, transaction %llu running transaction %llu fs generation %llu", + buf->start, btrfs_root_id(root), trans->transid, + fs_info->running_transaction->transid, + fs_info->generation); + return -EUCLEAN; + } if (!should_cow_block(trans, root, buf)) { *cow_ret = buf; @@ -668,8 +680,22 @@ int progress_passed = 0; struct btrfs_disk_key disk_key; - WARN_ON(trans->transaction != fs_info->running_transaction); - WARN_ON(trans->transid != fs_info->generation); + /* + * COWing must happen through a running transaction, which always + * matches the current fs generation (it's a transaction with a state + * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs + * into error state to prevent the commit of any transaction. + */ + if (unlikely(trans->transaction != fs_info->running_transaction || + trans->transid != fs_info->generation)) { + btrfs_abort_transaction(trans, -EUCLEAN); + btrfs_crit(fs_info, +"unexpected transaction when attempting to reallocate parent %llu for root %llu, transaction %llu running transaction %llu fs generation %llu", + parent->start, btrfs_root_id(root), trans->transid, + fs_info->running_transaction->transid, + fs_info->generation); + return -EUCLEAN; + } parent_nritems = btrfs_header_nritems(parent); blocksize = fs_info->nodesize; diff -u linux-lowlatency-5.15.0/fs/btrfs/delalloc-space.c linux-lowlatency-5.15.0/fs/btrfs/delalloc-space.c --- linux-lowlatency-5.15.0/fs/btrfs/delalloc-space.c +++ linux-lowlatency-5.15.0/fs/btrfs/delalloc-space.c @@ -312,9 +312,6 @@ } else { if (current->journal_info) flush = BTRFS_RESERVE_FLUSH_LIMIT; - - if (btrfs_transaction_in_commit(fs_info)) - schedule_timeout(1); } num_bytes = ALIGN(num_bytes, fs_info->sectorsize); diff -u linux-lowlatency-5.15.0/fs/btrfs/extent-tree.c linux-lowlatency-5.15.0/fs/btrfs/extent-tree.c --- linux-lowlatency-5.15.0/fs/btrfs/extent-tree.c +++ linux-lowlatency-5.15.0/fs/btrfs/extent-tree.c @@ -1674,12 +1674,12 @@ parent = ref->parent; ref_root = ref->root; - if (node->ref_mod != 1) { + if (unlikely(node->ref_mod != 1)) { btrfs_err(trans->fs_info, - "btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu", + "btree block %llu has %d references rather than 1: action %d ref_root %llu parent %llu", node->bytenr, node->ref_mod, node->action, ref_root, parent); - return -EIO; + return -EUCLEAN; } if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) { BUG_ON(!extent_op || !extent_op->update_flags); diff -u linux-lowlatency-5.15.0/fs/btrfs/ioctl.c linux-lowlatency-5.15.0/fs/btrfs/ioctl.c --- linux-lowlatency-5.15.0/fs/btrfs/ioctl.c +++ linux-lowlatency-5.15.0/fs/btrfs/ioctl.c @@ -2094,7 +2094,7 @@ static noinline int copy_to_sk(struct btrfs_path *path, struct btrfs_key *key, struct btrfs_ioctl_search_key *sk, - size_t *buf_size, + u64 *buf_size, char __user *ubuf, unsigned long *sk_offset, int *num_found) @@ -2226,7 +2226,7 @@ static noinline int search_ioctl(struct inode *inode, struct btrfs_ioctl_search_key *sk, - size_t *buf_size, + u64 *buf_size, char __user *ubuf) { struct btrfs_fs_info *info = btrfs_sb(inode->i_sb); @@ -2295,7 +2295,7 @@ struct btrfs_ioctl_search_key sk; struct inode *inode; int ret; - size_t buf_size; + u64 buf_size; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -2329,8 +2329,8 @@ struct btrfs_ioctl_search_args_v2 args; struct inode *inode; int ret; - size_t buf_size; - const size_t buf_limit = SZ_16M; + u64 buf_size; + const u64 buf_limit = SZ_16M; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -3531,7 +3531,7 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info, void __user *arg) { - struct btrfs_ioctl_space_args space_args; + struct btrfs_ioctl_space_args space_args = { 0 }; struct btrfs_ioctl_space_info space; struct btrfs_ioctl_space_info *dest; struct btrfs_ioctl_space_info *dest_orig; @@ -4867,7 +4867,7 @@ if (compat) { #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT) - struct btrfs_ioctl_send_args_32 args32; + struct btrfs_ioctl_send_args_32 args32 = { 0 }; ret = copy_from_user(&args32, argp, sizeof(args32)); if (ret) diff -u linux-lowlatency-5.15.0/fs/btrfs/send.c linux-lowlatency-5.15.0/fs/btrfs/send.c --- linux-lowlatency-5.15.0/fs/btrfs/send.c +++ linux-lowlatency-5.15.0/fs/btrfs/send.c @@ -7576,7 +7576,7 @@ sctx->flags = arg->flags; sctx->send_filp = fget(arg->send_fd); - if (!sctx->send_filp) { + if (!sctx->send_filp || !(sctx->send_filp->f_mode & FMODE_WRITE)) { ret = -EBADF; goto out; } diff -u linux-lowlatency-5.15.0/fs/btrfs/tree-log.c linux-lowlatency-5.15.0/fs/btrfs/tree-log.c --- linux-lowlatency-5.15.0/fs/btrfs/tree-log.c +++ linux-lowlatency-5.15.0/fs/btrfs/tree-log.c @@ -4446,7 +4446,7 @@ struct extent_buffer *leaf; int slot; int ins_nr = 0; - int start_slot; + int start_slot = 0; int ret; if (!(inode->flags & BTRFS_INODE_PREALLOC)) diff -u linux-lowlatency-5.15.0/fs/btrfs/volumes.c linux-lowlatency-5.15.0/fs/btrfs/volumes.c --- linux-lowlatency-5.15.0/fs/btrfs/volumes.c +++ linux-lowlatency-5.15.0/fs/btrfs/volumes.c @@ -3064,15 +3064,16 @@ read_unlock(&em_tree->lock); if (!em) { - btrfs_crit(fs_info, "unable to find logical %llu length %llu", + btrfs_crit(fs_info, + "unable to find chunk map for logical %llu length %llu", logical, length); return ERR_PTR(-EINVAL); } - if (em->start > logical || em->start + em->len < logical) { + if (em->start > logical || em->start + em->len <= logical) { btrfs_crit(fs_info, - "found a bad mapping, wanted %llu-%llu, found %llu-%llu", - logical, length, em->start, em->start + em->len); + "found a bad chunk map, wanted %llu-%llu, found %llu-%llu", + logical, logical + length, em->start, em->start + em->len); free_extent_map(em); return ERR_PTR(-EINVAL); } diff -u linux-lowlatency-5.15.0/fs/cifs/cifsfs.c linux-lowlatency-5.15.0/fs/cifs/cifsfs.c --- linux-lowlatency-5.15.0/fs/cifs/cifsfs.c +++ linux-lowlatency-5.15.0/fs/cifs/cifsfs.c @@ -1127,6 +1127,7 @@ const struct inode_operations cifs_symlink_inode_ops = { .get_link = cifs_get_link, + .setattr = cifs_setattr, .permission = cifs_permission, .listxattr = cifs_listxattr, }; @@ -1143,7 +1144,9 @@ unsigned int xid; int rc; - if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) + if (remap_flags & REMAP_FILE_DEDUP) + return -EOPNOTSUPP; + if (remap_flags & ~REMAP_FILE_ADVISORY) return -EINVAL; cifs_dbg(FYI, "clone range\n"); diff -u linux-lowlatency-5.15.0/fs/cifs/smb2ops.c linux-lowlatency-5.15.0/fs/cifs/smb2ops.c --- linux-lowlatency-5.15.0/fs/cifs/smb2ops.c +++ linux-lowlatency-5.15.0/fs/cifs/smb2ops.c @@ -2926,6 +2926,8 @@ usleep_range(512, 2048); } while (++retry_count < 5); + if (!rc && !dfs_rsp) + rc = -EIO; if (rc) { if (!is_retryable_error(rc) && rc != -ENOENT && rc != -EOPNOTSUPP) cifs_tcon_dbg(VFS, "%s: ioctl error: rc=%d\n", __func__, rc); diff -u linux-lowlatency-5.15.0/fs/cifs/smb2transport.c linux-lowlatency-5.15.0/fs/cifs/smb2transport.c --- linux-lowlatency-5.15.0/fs/cifs/smb2transport.c +++ linux-lowlatency-5.15.0/fs/cifs/smb2transport.c @@ -430,6 +430,8 @@ ptriplet->encryption.context, ses->smb3encryptionkey, SMB3_ENC_DEC_KEY_SIZE); + if (rc) + return rc; rc = generate_key(ses, ptriplet->decryption.label, ptriplet->decryption.context, ses->smb3decryptionkey, @@ -438,9 +440,6 @@ return rc; } - if (rc) - return rc; - #ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__); /* diff -u linux-lowlatency-5.15.0/fs/cifs/xattr.c linux-lowlatency-5.15.0/fs/cifs/xattr.c --- linux-lowlatency-5.15.0/fs/cifs/xattr.c +++ linux-lowlatency-5.15.0/fs/cifs/xattr.c @@ -150,10 +150,13 @@ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) goto out; - if (pTcon->ses->server->ops->set_EA) + if (pTcon->ses->server->ops->set_EA) { rc = pTcon->ses->server->ops->set_EA(xid, pTcon, full_path, name, value, (__u16)size, cifs_sb->local_nls, cifs_sb); + if (rc == 0) + inode_set_ctime_current(inode); + } break; case XATTR_CIFS_ACL: diff -u linux-lowlatency-5.15.0/fs/exfat/namei.c linux-lowlatency-5.15.0/fs/exfat/namei.c --- linux-lowlatency-5.15.0/fs/exfat/namei.c +++ linux-lowlatency-5.15.0/fs/exfat/namei.c @@ -330,14 +330,20 @@ if (exfat_check_max_dentries(inode)) return -ENOSPC; - /* we trust p_dir->size regardless of FAT type */ - if (exfat_find_last_cluster(sb, p_dir, &last_clu)) - return -EIO; - /* * Allocate new cluster to this directory */ - exfat_chain_set(&clu, last_clu + 1, 0, p_dir->flags); + if (ei->start_clu != EXFAT_EOF_CLUSTER) { + /* we trust p_dir->size regardless of FAT type */ + if (exfat_find_last_cluster(sb, p_dir, &last_clu)) + return -EIO; + + exfat_chain_set(&clu, last_clu + 1, 0, p_dir->flags); + } else { + /* This directory is empty */ + exfat_chain_set(&clu, EXFAT_EOF_CLUSTER, 0, + ALLOC_NO_FAT_CHAIN); + } /* allocate a cluster */ ret = exfat_alloc_cluster(inode, 1, &clu, IS_DIRSYNC(inode)); @@ -347,6 +353,11 @@ if (exfat_zeroed_cluster(inode, clu.dir)) return -EIO; + if (ei->start_clu == EXFAT_EOF_CLUSTER) { + ei->start_clu = clu.dir; + p_dir->dir = clu.dir; + } + /* append to the FAT chain */ if (clu.flags != p_dir->flags) { /* no-fat-chain bit is disabled, @@ -644,7 +655,7 @@ info->type = exfat_get_entry_type(ep); info->attr = le16_to_cpu(ep->dentry.file.attr); info->size = le64_to_cpu(ep2->dentry.stream.valid_size); - if ((info->type == TYPE_FILE) && (info->size == 0)) { + if (info->size == 0) { info->flags = ALLOC_NO_FAT_CHAIN; info->start_clu = EXFAT_EOF_CLUSTER; } else { @@ -891,6 +902,9 @@ dentries_per_clu = sbi->dentries_per_clu; + if (p_dir->dir == EXFAT_EOF_CLUSTER) + return 0; + exfat_chain_dup(&clu, p_dir); while (clu.dir != EXFAT_EOF_CLUSTER) { @@ -1274,7 +1288,8 @@ } /* Free the clusters if new_inode is a dir(as if exfat_rmdir) */ - if (new_entry_type == TYPE_DIR) { + if (new_entry_type == TYPE_DIR && + new_ei->start_clu != EXFAT_EOF_CLUSTER) { /* new_ei, new_clu_to_free */ struct exfat_chain new_clu_to_free; diff -u linux-lowlatency-5.15.0/fs/ext4/extents.c linux-lowlatency-5.15.0/fs/ext4/extents.c --- linux-lowlatency-5.15.0/fs/ext4/extents.c +++ linux-lowlatency-5.15.0/fs/ext4/extents.c @@ -1004,6 +1004,11 @@ ix = curp->p_idx; } + if (unlikely(ix > EXT_MAX_INDEX(curp->p_hdr))) { + EXT4_ERROR_INODE(inode, "ix > EXT_MAX_INDEX!"); + return -EFSCORRUPTED; + } + len = EXT_LAST_INDEX(curp->p_hdr) - ix + 1; BUG_ON(len < 0); if (len > 0) { @@ -1013,11 +1018,6 @@ memmove(ix + 1, ix, len * sizeof(struct ext4_extent_idx)); } - if (unlikely(ix > EXT_MAX_INDEX(curp->p_hdr))) { - EXT4_ERROR_INODE(inode, "ix > EXT_MAX_INDEX!"); - return -EFSCORRUPTED; - } - ix->ei_block = cpu_to_le32(logical); ext4_idx_store_pblock(ix, ptr); le16_add_cpu(&curp->p_hdr->eh_entries, 1); diff -u linux-lowlatency-5.15.0/fs/ext4/extents_status.c linux-lowlatency-5.15.0/fs/ext4/extents_status.c --- linux-lowlatency-5.15.0/fs/ext4/extents_status.c +++ linux-lowlatency-5.15.0/fs/ext4/extents_status.c @@ -144,14 +144,17 @@ static struct kmem_cache *ext4_es_cachep; static struct kmem_cache *ext4_pending_cachep; -static int __es_insert_extent(struct inode *inode, struct extent_status *newes); +static int __es_insert_extent(struct inode *inode, struct extent_status *newes, + struct extent_status *prealloc); static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, - ext4_lblk_t end, int *reserved); + ext4_lblk_t end, int *reserved, + struct extent_status *prealloc); static int es_reclaim_extents(struct ext4_inode_info *ei, int *nr_to_scan); static int __es_shrink(struct ext4_sb_info *sbi, int nr_to_scan, struct ext4_inode_info *locked_ei); -static void __revise_pending(struct inode *inode, ext4_lblk_t lblk, - ext4_lblk_t len); +static int __revise_pending(struct inode *inode, ext4_lblk_t lblk, + ext4_lblk_t len, + struct pending_reservation **prealloc); int __init ext4_init_es(void) { @@ -448,22 +451,49 @@ spin_unlock(&sbi->s_es_lock); } -static struct extent_status * -ext4_es_alloc_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len, - ext4_fsblk_t pblk) +static inline struct pending_reservation *__alloc_pending(bool nofail) +{ + if (!nofail) + return kmem_cache_alloc(ext4_pending_cachep, GFP_ATOMIC); + + return kmem_cache_zalloc(ext4_pending_cachep, GFP_KERNEL | __GFP_NOFAIL); +} + +static inline void __free_pending(struct pending_reservation *pr) +{ + kmem_cache_free(ext4_pending_cachep, pr); +} + +/* + * Returns true if we cannot fail to allocate memory for this extent_status + * entry and cannot reclaim it until its status changes. + */ +static inline bool ext4_es_must_keep(struct extent_status *es) +{ + /* fiemap, bigalloc, and seek_data/hole need to use it. */ + if (ext4_es_is_delayed(es)) + return true; + + return false; +} + +static inline struct extent_status *__es_alloc_extent(bool nofail) +{ + if (!nofail) + return kmem_cache_alloc(ext4_es_cachep, GFP_ATOMIC); + + return kmem_cache_zalloc(ext4_es_cachep, GFP_KERNEL | __GFP_NOFAIL); +} + +static void ext4_es_init_extent(struct inode *inode, struct extent_status *es, + ext4_lblk_t lblk, ext4_lblk_t len, ext4_fsblk_t pblk) { - struct extent_status *es; - es = kmem_cache_alloc(ext4_es_cachep, GFP_ATOMIC); - if (es == NULL) - return NULL; es->es_lblk = lblk; es->es_len = len; es->es_pblk = pblk; - /* - * We don't count delayed extent because we never try to reclaim them - */ - if (!ext4_es_is_delayed(es)) { + /* We never try to reclaim a must kept extent, so we don't count it. */ + if (!ext4_es_must_keep(es)) { if (!EXT4_I(inode)->i_es_shk_nr++) ext4_es_list_add(inode); percpu_counter_inc(&EXT4_SB(inode->i_sb)-> @@ -472,8 +502,11 @@ EXT4_I(inode)->i_es_all_nr++; percpu_counter_inc(&EXT4_SB(inode->i_sb)->s_es_stats.es_stats_all_cnt); +} - return es; +static inline void __es_free_extent(struct extent_status *es) +{ + kmem_cache_free(ext4_es_cachep, es); } static void ext4_es_free_extent(struct inode *inode, struct extent_status *es) @@ -481,8 +514,8 @@ EXT4_I(inode)->i_es_all_nr--; percpu_counter_dec(&EXT4_SB(inode->i_sb)->s_es_stats.es_stats_all_cnt); - /* Decrease the shrink counter when this es is not delayed */ - if (!ext4_es_is_delayed(es)) { + /* Decrease the shrink counter when we can reclaim the extent. */ + if (!ext4_es_must_keep(es)) { BUG_ON(EXT4_I(inode)->i_es_shk_nr == 0); if (!--EXT4_I(inode)->i_es_shk_nr) ext4_es_list_del(inode); @@ -490,7 +523,7 @@ s_es_stats.es_stats_shk_cnt); } - kmem_cache_free(ext4_es_cachep, es); + __es_free_extent(es); } /* @@ -752,7 +785,8 @@ } #endif -static int __es_insert_extent(struct inode *inode, struct extent_status *newes) +static int __es_insert_extent(struct inode *inode, struct extent_status *newes, + struct extent_status *prealloc) { struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; struct rb_node **p = &tree->root.rb_node; @@ -792,10 +826,15 @@ } } - es = ext4_es_alloc_extent(inode, newes->es_lblk, newes->es_len, - newes->es_pblk); + if (prealloc) + es = prealloc; + else + es = __es_alloc_extent(false); if (!es) return -ENOMEM; + ext4_es_init_extent(inode, es, newes->es_lblk, newes->es_len, + newes->es_pblk); + rb_link_node(&es->rb_node, parent, p); rb_insert_color(&es->rb_node, &tree->root); @@ -816,8 +855,12 @@ { struct extent_status newes; ext4_lblk_t end = lblk + len - 1; - int err = 0; + int err1 = 0, err2 = 0, err3 = 0; struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + struct extent_status *es1 = NULL; + struct extent_status *es2 = NULL; + struct pending_reservation *pr = NULL; + bool revise_pending = false; if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) return 0; @@ -845,29 +888,57 @@ ext4_es_insert_extent_check(inode, &newes); + revise_pending = sbi->s_cluster_ratio > 1 && + test_opt(inode->i_sb, DELALLOC) && + (status & (EXTENT_STATUS_WRITTEN | + EXTENT_STATUS_UNWRITTEN)); +retry: + if (err1 && !es1) + es1 = __es_alloc_extent(true); + if ((err1 || err2) && !es2) + es2 = __es_alloc_extent(true); + if ((err1 || err2 || err3) && revise_pending && !pr) + pr = __alloc_pending(true); write_lock(&EXT4_I(inode)->i_es_lock); - err = __es_remove_extent(inode, lblk, end, NULL); - if (err != 0) + + err1 = __es_remove_extent(inode, lblk, end, NULL, es1); + if (err1 != 0) goto error; -retry: - err = __es_insert_extent(inode, &newes); - if (err == -ENOMEM && __es_shrink(EXT4_SB(inode->i_sb), - 128, EXT4_I(inode))) - goto retry; - if (err == -ENOMEM && !ext4_es_is_delayed(&newes)) - err = 0; + /* Free preallocated extent if it didn't get used. */ + if (es1) { + if (!es1->es_len) + __es_free_extent(es1); + es1 = NULL; + } - if (sbi->s_cluster_ratio > 1 && test_opt(inode->i_sb, DELALLOC) && - (status & EXTENT_STATUS_WRITTEN || - status & EXTENT_STATUS_UNWRITTEN)) - __revise_pending(inode, lblk, len); + err2 = __es_insert_extent(inode, &newes, es2); + if (err2 == -ENOMEM && !ext4_es_must_keep(&newes)) + err2 = 0; + if (err2 != 0) + goto error; + /* Free preallocated extent if it didn't get used. */ + if (es2) { + if (!es2->es_len) + __es_free_extent(es2); + es2 = NULL; + } + if (revise_pending) { + err3 = __revise_pending(inode, lblk, len, &pr); + if (err3 != 0) + goto error; + if (pr) { + __free_pending(pr); + pr = NULL; + } + } error: write_unlock(&EXT4_I(inode)->i_es_lock); + if (err1 || err2 || err3) + goto retry; ext4_es_print_tree(inode); - - return err; + return 0; } /* @@ -900,7 +971,7 @@ es = __es_tree_search(&EXT4_I(inode)->i_es_tree.root, lblk); if (!es || es->es_lblk > end) - __es_insert_extent(inode, &newes); + __es_insert_extent(inode, &newes, NULL); write_unlock(&EXT4_I(inode)->i_es_lock); } @@ -1271,7 +1342,7 @@ rc->ndelonly--; node = rb_next(&pr->rb_node); rb_erase(&pr->rb_node, &tree->root); - kmem_cache_free(ext4_pending_cachep, pr); + __free_pending(pr); if (!node) break; pr = rb_entry(node, struct pending_reservation, @@ -1290,6 +1361,7 @@ * @lblk - first block in range * @end - last block in range * @reserved - number of cluster reservations released + * @prealloc - pre-allocated es to avoid memory allocation failures * * If @reserved is not NULL and delayed allocation is enabled, counts * block/cluster reservations freed by removing range and if bigalloc @@ -1297,7 +1369,8 @@ * error code on failure. */ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, - ext4_lblk_t end, int *reserved) + ext4_lblk_t end, int *reserved, + struct extent_status *prealloc) { struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; struct rb_node *node; @@ -1305,14 +1378,12 @@ struct extent_status orig_es; ext4_lblk_t len1, len2; ext4_fsblk_t block; - int err; + int err = 0; bool count_reserved = true; struct rsvd_count rc; if (reserved == NULL || !test_opt(inode->i_sb, DELALLOC)) count_reserved = false; -retry: - err = 0; es = __es_tree_search(&tree->root, lblk); if (!es) @@ -1346,14 +1417,13 @@ orig_es.es_len - len2; ext4_es_store_pblock_status(&newes, block, ext4_es_status(&orig_es)); - err = __es_insert_extent(inode, &newes); + err = __es_insert_extent(inode, &newes, prealloc); if (err) { + if (!ext4_es_must_keep(&newes)) + return 0; + es->es_lblk = orig_es.es_lblk; es->es_len = orig_es.es_len; - if ((err == -ENOMEM) && - __es_shrink(EXT4_SB(inode->i_sb), - 128, EXT4_I(inode))) - goto retry; goto out; } } else { @@ -1366,8 +1436,8 @@ } } if (count_reserved) - count_rsvd(inode, lblk, orig_es.es_len - len1 - len2, - &orig_es, &rc); + count_rsvd(inode, orig_es.es_lblk + len1, + orig_es.es_len - len1 - len2, &orig_es, &rc); goto out_get_reserved; } @@ -1433,6 +1503,7 @@ ext4_lblk_t end; int err = 0; int reserved = 0; + struct extent_status *es = NULL; if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) return 0; @@ -1447,17 +1518,29 @@ end = lblk + len - 1; BUG_ON(end < lblk); +retry: + if (err && !es) + es = __es_alloc_extent(true); /* * ext4_clear_inode() depends on us taking i_es_lock unconditionally * so that we are sure __es_shrink() is done with the inode before it * is reclaimed. */ write_lock(&EXT4_I(inode)->i_es_lock); - err = __es_remove_extent(inode, lblk, end, &reserved); + err = __es_remove_extent(inode, lblk, end, &reserved, es); + /* Free preallocated extent if it didn't get used. */ + if (es) { + if (!es->es_len) + __es_free_extent(es); + es = NULL; + } write_unlock(&EXT4_I(inode)->i_es_lock); + if (err) + goto retry; + ext4_es_print_tree(inode); ext4_da_release_space(inode, reserved); - return err; + return 0; } static int __es_shrink(struct ext4_sb_info *sbi, int nr_to_scan, @@ -1704,11 +1787,8 @@ (*nr_to_scan)--; node = rb_next(&es->rb_node); - /* - * We can't reclaim delayed extent from status tree because - * fiemap, bigallic, and seek_data/hole need to use it. - */ - if (ext4_es_is_delayed(es)) + + if (ext4_es_must_keep(es)) goto next; if (ext4_es_is_referenced(es)) { ext4_es_clear_referenced(es); @@ -1772,7 +1852,7 @@ while (node) { es = rb_entry(node, struct extent_status, rb_node); node = rb_next(node); - if (!ext4_es_is_delayed(es)) { + if (!ext4_es_must_keep(es)) { rb_erase(&es->rb_node, &tree->root); ext4_es_free_extent(inode, es); } @@ -1859,11 +1939,13 @@ * * @inode - file containing the cluster * @lblk - logical block in the cluster to be added + * @prealloc - preallocated pending entry * * Returns 0 on successful insertion and -ENOMEM on failure. If the * pending reservation is already in the set, returns successfully. */ -static int __insert_pending(struct inode *inode, ext4_lblk_t lblk) +static int __insert_pending(struct inode *inode, ext4_lblk_t lblk, + struct pending_reservation **prealloc) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_pending_tree *tree = &EXT4_I(inode)->i_pending_tree; @@ -1889,10 +1971,15 @@ } } - pr = kmem_cache_alloc(ext4_pending_cachep, GFP_ATOMIC); - if (pr == NULL) { - ret = -ENOMEM; - goto out; + if (likely(*prealloc == NULL)) { + pr = __alloc_pending(false); + if (!pr) { + ret = -ENOMEM; + goto out; + } + } else { + pr = *prealloc; + *prealloc = NULL; } pr->lclu = lclu; @@ -1922,7 +2009,7 @@ if (pr != NULL) { tree = &EXT4_I(inode)->i_pending_tree; rb_erase(&pr->rb_node, &tree->root); - kmem_cache_free(ext4_pending_cachep, pr); + __free_pending(pr); } } @@ -1983,7 +2070,10 @@ bool allocated) { struct extent_status newes; - int err = 0; + int err1 = 0, err2 = 0, err3 = 0; + struct extent_status *es1 = NULL; + struct extent_status *es2 = NULL; + struct pending_reservation *pr = NULL; if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY) return 0; @@ -1998,29 +2088,52 @@ ext4_es_insert_extent_check(inode, &newes); +retry: + if (err1 && !es1) + es1 = __es_alloc_extent(true); + if ((err1 || err2) && !es2) + es2 = __es_alloc_extent(true); + if ((err1 || err2 || err3) && allocated && !pr) + pr = __alloc_pending(true); write_lock(&EXT4_I(inode)->i_es_lock); - err = __es_remove_extent(inode, lblk, lblk, NULL); - if (err != 0) - goto error; -retry: - err = __es_insert_extent(inode, &newes); - if (err == -ENOMEM && __es_shrink(EXT4_SB(inode->i_sb), - 128, EXT4_I(inode))) - goto retry; - if (err != 0) + err1 = __es_remove_extent(inode, lblk, lblk, NULL, es1); + if (err1 != 0) goto error; + /* Free preallocated extent if it didn't get used. */ + if (es1) { + if (!es1->es_len) + __es_free_extent(es1); + es1 = NULL; + } - if (allocated) - __insert_pending(inode, lblk); + err2 = __es_insert_extent(inode, &newes, es2); + if (err2 != 0) + goto error; + /* Free preallocated extent if it didn't get used. */ + if (es2) { + if (!es2->es_len) + __es_free_extent(es2); + es2 = NULL; + } + if (allocated) { + err3 = __insert_pending(inode, lblk, &pr); + if (err3 != 0) + goto error; + if (pr) { + __free_pending(pr); + pr = NULL; + } + } error: write_unlock(&EXT4_I(inode)->i_es_lock); + if (err1 || err2 || err3) + goto retry; ext4_es_print_tree(inode); ext4_print_pending_tree(inode); - - return err; + return 0; } /* @@ -2121,21 +2234,24 @@ * @inode - file containing the range * @lblk - logical block defining the start of range * @len - length of range in blocks + * @prealloc - preallocated pending entry * * Used after a newly allocated extent is added to the extents status tree. * Requires that the extents in the range have either written or unwritten * status. Must be called while holding i_es_lock. */ -static void __revise_pending(struct inode *inode, ext4_lblk_t lblk, - ext4_lblk_t len) +static int __revise_pending(struct inode *inode, ext4_lblk_t lblk, + ext4_lblk_t len, + struct pending_reservation **prealloc) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); ext4_lblk_t end = lblk + len - 1; ext4_lblk_t first, last; bool f_del = false, l_del = false; + int ret = 0; if (len == 0) - return; + return 0; /* * Two cases - block range within single cluster and block range @@ -2156,7 +2272,9 @@ f_del = __es_scan_range(inode, &ext4_es_is_delonly, first, lblk - 1); if (f_del) { - __insert_pending(inode, first); + ret = __insert_pending(inode, first, prealloc); + if (ret < 0) + goto out; } else { last = EXT4_LBLK_CMASK(sbi, end) + sbi->s_cluster_ratio - 1; @@ -2164,9 +2282,11 @@ l_del = __es_scan_range(inode, &ext4_es_is_delonly, end + 1, last); - if (l_del) - __insert_pending(inode, last); - else + if (l_del) { + ret = __insert_pending(inode, last, prealloc); + if (ret < 0) + goto out; + } else __remove_pending(inode, last); } } else { @@ -2176,16 +2296,22 @@ first, lblk - 1); - if (f_del) - __insert_pending(inode, first); - else + if (f_del) { + ret = __insert_pending(inode, first, prealloc); + if (ret < 0) + goto out; + } else __remove_pending(inode, first); last = EXT4_LBLK_CMASK(sbi, end) + sbi->s_cluster_ratio - 1; if (last != end) l_del = __es_scan_range(inode, &ext4_es_is_delonly, end + 1, last); - if (l_del) - __insert_pending(inode, last); - else + if (l_del) { + ret = __insert_pending(inode, last, prealloc); + if (ret < 0) + goto out; + } else __remove_pending(inode, last); } +out: + return ret; } diff -u linux-lowlatency-5.15.0/fs/ext4/mballoc.c linux-lowlatency-5.15.0/fs/ext4/mballoc.c --- linux-lowlatency-5.15.0/fs/ext4/mballoc.c +++ linux-lowlatency-5.15.0/fs/ext4/mballoc.c @@ -4049,8 +4049,7 @@ struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); struct ext4_super_block *es = sbi->s_es; int bsbits, max; - ext4_lblk_t end; - loff_t size, start_off; + loff_t size, start_off, end; loff_t orig_size __maybe_unused; ext4_lblk_t start; struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); @@ -4079,7 +4078,7 @@ /* first, let's learn actual file size * given current request is allocated */ - size = ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); + size = extent_logical_end(sbi, &ac->ac_o_ex); size = size << bsbits; if (size < i_size_read(ac->ac_inode)) size = i_size_read(ac->ac_inode); @@ -4158,7 +4157,7 @@ /* check we don't cross already preallocated blocks */ rcu_read_lock(); list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { - ext4_lblk_t pa_end; + loff_t pa_end; if (pa->pa_deleted) continue; @@ -4168,8 +4167,7 @@ continue; } - pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb), - pa->pa_len); + pa_end = pa_logical_end(EXT4_SB(ac->ac_sb), pa); /* PA must not overlap original request */ BUG_ON(!(ac->ac_o_ex.fe_logical >= pa_end || @@ -4198,12 +4196,11 @@ /* XXX: extra loop to check we really don't overlap preallocations */ rcu_read_lock(); list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { - ext4_lblk_t pa_end; + loff_t pa_end; spin_lock(&pa->pa_lock); if (pa->pa_deleted == 0) { - pa_end = pa->pa_lstart + EXT4_C2B(EXT4_SB(ac->ac_sb), - pa->pa_len); + pa_end = pa_logical_end(EXT4_SB(ac->ac_sb), pa); BUG_ON(!(start >= pa_end || end <= pa->pa_lstart)); } spin_unlock(&pa->pa_lock); @@ -4419,8 +4416,7 @@ /* all fields in this condition don't change, * so we can skip locking for them */ if (ac->ac_o_ex.fe_logical < pa->pa_lstart || - ac->ac_o_ex.fe_logical >= (pa->pa_lstart + - EXT4_C2B(sbi, pa->pa_len))) + ac->ac_o_ex.fe_logical >= pa_logical_end(sbi, pa)) continue; /* non-extent files can't have physical blocks past 2^32 */ @@ -4665,8 +4661,11 @@ pa = ac->ac_pa; if (ac->ac_b_ex.fe_len < ac->ac_g_ex.fe_len) { - int new_bex_start; - int new_bex_end; + struct ext4_free_extent ex = { + .fe_logical = ac->ac_g_ex.fe_logical, + .fe_len = ac->ac_g_ex.fe_len, + }; + loff_t orig_goal_end = extent_logical_end(sbi, &ex); /* we can't allocate as much as normalizer wants. * so, found space must get proper lstart @@ -4685,29 +4684,23 @@ * still cover original start * 3. Else, keep the best ex at start of original request. */ - new_bex_end = ac->ac_g_ex.fe_logical + - EXT4_C2B(sbi, ac->ac_g_ex.fe_len); - new_bex_start = new_bex_end - EXT4_C2B(sbi, ac->ac_b_ex.fe_len); - if (ac->ac_o_ex.fe_logical >= new_bex_start) - goto adjust_bex; + ex.fe_len = ac->ac_b_ex.fe_len; - new_bex_start = ac->ac_g_ex.fe_logical; - new_bex_end = - new_bex_start + EXT4_C2B(sbi, ac->ac_b_ex.fe_len); - if (ac->ac_o_ex.fe_logical < new_bex_end) + ex.fe_logical = orig_goal_end - EXT4_C2B(sbi, ex.fe_len); + if (ac->ac_o_ex.fe_logical >= ex.fe_logical) goto adjust_bex; - new_bex_start = ac->ac_o_ex.fe_logical; - new_bex_end = - new_bex_start + EXT4_C2B(sbi, ac->ac_b_ex.fe_len); + ex.fe_logical = ac->ac_g_ex.fe_logical; + if (ac->ac_o_ex.fe_logical < extent_logical_end(sbi, &ex)) + goto adjust_bex; + ex.fe_logical = ac->ac_o_ex.fe_logical; adjust_bex: - ac->ac_b_ex.fe_logical = new_bex_start; + ac->ac_b_ex.fe_logical = ex.fe_logical; BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); - BUG_ON(new_bex_end > (ac->ac_g_ex.fe_logical + - EXT4_C2B(sbi, ac->ac_g_ex.fe_len))); + BUG_ON(extent_logical_end(sbi, &ex) > orig_goal_end); } /* preallocation can change ac_b_ex, thus we store actually @@ -5241,7 +5234,7 @@ group_pa_eligible = sbi->s_mb_group_prealloc > 0; inode_pa_eligible = true; - size = ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); + size = extent_logical_end(sbi, &ac->ac_o_ex); isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) >> bsbits; diff -u linux-lowlatency-5.15.0/fs/ext4/resize.c linux-lowlatency-5.15.0/fs/ext4/resize.c --- linux-lowlatency-5.15.0/fs/ext4/resize.c +++ linux-lowlatency-5.15.0/fs/ext4/resize.c @@ -556,13 +556,8 @@ if (meta_bg == 0 && !ext4_bg_has_super(sb, group)) goto handle_itb; - if (meta_bg == 1) { - ext4_group_t first_group; - first_group = ext4_meta_bg_first_group(sb, group); - if (first_group != group + 1 && - first_group != group + EXT4_DESC_PER_BLOCK(sb) - 1) - goto handle_itb; - } + if (meta_bg == 1) + goto handle_itb; block = start + ext4_bg_has_super(sb, group); /* Copy all of the GDT blocks into the backup in this group */ @@ -1176,8 +1171,10 @@ ext4_group_first_block_no(sb, group)); BUFFER_TRACE(bh, "get_write_access"); if ((err = ext4_journal_get_write_access(handle, sb, bh, - EXT4_JTR_NONE))) + EXT4_JTR_NONE))) { + brelse(bh); break; + } lock_buffer(bh); memcpy(bh->b_data, data, size); if (rest) @@ -1568,6 +1565,8 @@ int gdb_num_end = ((group + flex_gd->count - 1) / EXT4_DESC_PER_BLOCK(sb)); int meta_bg = ext4_has_feature_meta_bg(sb); + sector_t padding_blocks = meta_bg ? 0 : sbi->s_sbh->b_blocknr - + ext4_group_first_block_no(sb, 0); sector_t old_gdb = 0; update_backups(sb, ext4_group_first_block_no(sb, 0), @@ -1579,8 +1578,8 @@ gdb_num); if (old_gdb == gdb_bh->b_blocknr) continue; - update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data, - gdb_bh->b_size, meta_bg); + update_backups(sb, gdb_bh->b_blocknr - padding_blocks, + gdb_bh->b_data, gdb_bh->b_size, meta_bg); old_gdb = gdb_bh->b_blocknr; } } @@ -1949,9 +1948,7 @@ errout: ret = ext4_journal_stop(handle); - if (!err) - err = ret; - return ret; + return err ? err : ret; invalid_resize_inode: ext4_error(sb, "corrupted/inconsistent resize inode"); diff -u linux-lowlatency-5.15.0/fs/f2fs/compress.c linux-lowlatency-5.15.0/fs/f2fs/compress.c --- linux-lowlatency-5.15.0/fs/f2fs/compress.c +++ linux-lowlatency-5.15.0/fs/f2fs/compress.c @@ -1906,7 +1906,7 @@ int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi) { dev_t dev = sbi->sb->s_bdev->bd_dev; - char slab_name[32]; + char slab_name[35]; sprintf(slab_name, "f2fs_page_array_entry-%u:%u", MAJOR(dev), MINOR(dev)); diff -u linux-lowlatency-5.15.0/fs/f2fs/data.c linux-lowlatency-5.15.0/fs/f2fs/data.c --- linux-lowlatency-5.15.0/fs/f2fs/data.c +++ linux-lowlatency-5.15.0/fs/f2fs/data.c @@ -2253,8 +2253,10 @@ f2fs_wait_on_block_writeback(inode, blkaddr); if (f2fs_load_compressed_page(sbi, page, blkaddr)) { - if (atomic_dec_and_test(&dic->remaining_pages)) + if (atomic_dec_and_test(&dic->remaining_pages)) { f2fs_decompress_cluster(dic); + break; + } continue; } diff -u linux-lowlatency-5.15.0/fs/f2fs/file.c linux-lowlatency-5.15.0/fs/f2fs/file.c --- linux-lowlatency-5.15.0/fs/f2fs/file.c +++ linux-lowlatency-5.15.0/fs/f2fs/file.c @@ -3210,6 +3210,7 @@ return -EOPNOTSUPP; map.m_lblk = 0; + map.m_pblk = 0; map.m_next_pgofs = NULL; map.m_next_extent = &m_next_extent; map.m_seg_type = NO_CHECK_TYPE; diff -u linux-lowlatency-5.15.0/fs/f2fs/super.c linux-lowlatency-5.15.0/fs/f2fs/super.c --- linux-lowlatency-5.15.0/fs/f2fs/super.c +++ linux-lowlatency-5.15.0/fs/f2fs/super.c @@ -540,6 +540,29 @@ } #ifdef CONFIG_F2FS_FS_COMPRESSION +static bool is_compress_extension_exist(struct f2fs_sb_info *sbi, + const char *new_ext, bool is_ext) +{ + unsigned char (*ext)[F2FS_EXTENSION_LEN]; + int ext_cnt; + int i; + + if (is_ext) { + ext = F2FS_OPTION(sbi).extensions; + ext_cnt = F2FS_OPTION(sbi).compress_ext_cnt; + } else { + ext = F2FS_OPTION(sbi).noextensions; + ext_cnt = F2FS_OPTION(sbi).nocompress_ext_cnt; + } + + for (i = 0; i < ext_cnt; i++) { + if (!strcasecmp(new_ext, ext[i])) + return true; + } + + return false; +} + /* * 1. The same extension name cannot not appear in both compress and non-compress extension * at the same time. @@ -1154,6 +1177,11 @@ return -EINVAL; } + if (is_compress_extension_exist(sbi, name, true)) { + kfree(name); + break; + } + strcpy(ext[ext_cnt], name); F2FS_OPTION(sbi).compress_ext_cnt++; kfree(name); @@ -1178,6 +1206,11 @@ return -EINVAL; } + if (is_compress_extension_exist(sbi, name, false)) { + kfree(name); + break; + } + strcpy(noext[noext_cnt], name); F2FS_OPTION(sbi).nocompress_ext_cnt++; kfree(name); diff -u linux-lowlatency-5.15.0/fs/fs-writeback.c linux-lowlatency-5.15.0/fs/fs-writeback.c --- linux-lowlatency-5.15.0/fs/fs-writeback.c +++ linux-lowlatency-5.15.0/fs/fs-writeback.c @@ -609,6 +609,24 @@ kfree(isw); } +static bool isw_prepare_wbs_switch(struct inode_switch_wbs_context *isw, + struct list_head *list, int *nr) +{ + struct inode *inode; + + list_for_each_entry(inode, list, i_io_list) { + if (!inode_prepare_wbs_switch(inode, isw->new_wb)) + continue; + + isw->inodes[*nr] = inode; + (*nr)++; + + if (*nr >= WB_MAX_INODES_PER_ISW - 1) + return true; + } + return false; +} + /** * cleanup_offline_cgwb - detach associated inodes * @wb: target wb @@ -621,7 +639,6 @@ { struct cgroup_subsys_state *memcg_css; struct inode_switch_wbs_context *isw; - struct inode *inode; int nr; bool restart = false; @@ -643,17 +660,17 @@ nr = 0; spin_lock(&wb->list_lock); - list_for_each_entry(inode, &wb->b_attached, i_io_list) { - if (!inode_prepare_wbs_switch(inode, isw->new_wb)) - continue; - - isw->inodes[nr++] = inode; - - if (nr >= WB_MAX_INODES_PER_ISW - 1) { - restart = true; - break; - } - } + /* + * In addition to the inodes that have completed writeback, also switch + * cgwbs for those inodes only with dirty timestamps. Otherwise, those + * inodes won't be written back for a long time when lazytime is + * enabled, and thus pinning the dying cgwbs. It won't break the + * bandwidth restrictions, as writeback of inode metadata is not + * accounted for. + */ + restart = isw_prepare_wbs_switch(isw, &wb->b_attached, &nr); + if (!restart) + restart = isw_prepare_wbs_switch(isw, &wb->b_dirty_time, &nr); spin_unlock(&wb->list_lock); /* no attached inodes? bail out */ @@ -1557,10 +1574,15 @@ if (wbc->pages_skipped) { /* - * writeback is not making progress due to locked - * buffers. Skip this inode for now. + * Writeback is not making progress due to locked buffers. + * Skip this inode for now. Although having skipped pages + * is odd for clean inodes, it can happen for some + * filesystems so handle that gracefully. */ - redirty_tail_locked(inode, wb); + if (inode->i_state & I_DIRTY_ALL) + redirty_tail_locked(inode, wb); + else + inode_cgwb_move_to_attached(inode, wb); return; } diff -u linux-lowlatency-5.15.0/fs/gfs2/inode.c linux-lowlatency-5.15.0/fs/gfs2/inode.c --- linux-lowlatency-5.15.0/fs/gfs2/inode.c +++ linux-lowlatency-5.15.0/fs/gfs2/inode.c @@ -1848,16 +1848,24 @@ int gfs2_permission(struct user_namespace *mnt_userns, struct inode *inode, int mask) { + int may_not_block = mask & MAY_NOT_BLOCK; struct gfs2_inode *ip; struct gfs2_holder i_gh; + struct gfs2_glock *gl; int error; gfs2_holder_mark_uninitialized(&i_gh); ip = GFS2_I(inode); - if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) { - if (mask & MAY_NOT_BLOCK) + gl = rcu_dereference_check(ip->i_gl, !may_not_block); + if (unlikely(!gl)) { + /* inode is getting torn down, must be RCU mode */ + WARN_ON_ONCE(!may_not_block); + return -ECHILD; + } + if (gfs2_glock_is_locked_by_me(gl) == NULL) { + if (may_not_block) return -ECHILD; - error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); + error = gfs2_glock_nq_init(gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return error; } diff -u linux-lowlatency-5.15.0/fs/gfs2/quota.c linux-lowlatency-5.15.0/fs/gfs2/quota.c --- linux-lowlatency-5.15.0/fs/gfs2/quota.c +++ linux-lowlatency-5.15.0/fs/gfs2/quota.c @@ -431,6 +431,17 @@ (sync_gen && (qd->qd_sync_gen >= *sync_gen))) return 0; + /* + * If qd_change is 0 it means a pending quota change was negated. + * We should not sync it, but we still have a qd reference and slot + * reference taken by gfs2_quota_change -> do_qc that need to be put. + */ + if (!qd->qd_change && test_and_clear_bit(QDF_CHANGE, &qd->qd_flags)) { + slot_put(qd); + qd_put(qd); + return 0; + } + if (!lockref_get_not_dead(&qd->qd_lockref)) return 0; diff -u linux-lowlatency-5.15.0/fs/gfs2/super.c linux-lowlatency-5.15.0/fs/gfs2/super.c --- linux-lowlatency-5.15.0/fs/gfs2/super.c +++ linux-lowlatency-5.15.0/fs/gfs2/super.c @@ -1436,7 +1436,7 @@ wait_on_bit_io(&ip->i_flags, GIF_GLOP_PENDING, TASK_UNINTERRUPTIBLE); gfs2_glock_add_to_lru(ip->i_gl); gfs2_glock_put_eventually(ip->i_gl); - ip->i_gl = NULL; + rcu_assign_pointer(ip->i_gl, NULL); } } diff -u linux-lowlatency-5.15.0/fs/inode.c linux-lowlatency-5.15.0/fs/inode.c --- linux-lowlatency-5.15.0/fs/inode.c +++ linux-lowlatency-5.15.0/fs/inode.c @@ -2336,6 +2336,22 @@ EXPORT_SYMBOL(current_time); /** + * inode_set_ctime_current - set the ctime to current_time + * @inode: inode + * + * Set the inode->i_ctime to the current value for the inode. Returns + * the current value that was assigned to i_ctime. + */ +struct timespec64 inode_set_ctime_current(struct inode *inode) +{ + struct timespec64 now = current_time(inode); + + inode_set_ctime(inode, now.tv_sec, now.tv_nsec); + return now; +} +EXPORT_SYMBOL(inode_set_ctime_current); + +/** * in_group_or_capable - check whether caller is CAP_FSETID privileged * @mnt_userns: user namespace of the mount @inode was found from * @inode: inode to check diff -u linux-lowlatency-5.15.0/fs/iomap/direct-io.c linux-lowlatency-5.15.0/fs/iomap/direct-io.c --- linux-lowlatency-5.15.0/fs/iomap/direct-io.c +++ linux-lowlatency-5.15.0/fs/iomap/direct-io.c @@ -92,7 +92,6 @@ if (offset + ret > dio->i_size && !(dio->flags & IOMAP_DIO_WRITE)) ret = dio->i_size - offset; - iocb->ki_pos += ret; } /* @@ -118,18 +117,19 @@ } inode_dio_end(file_inode(iocb->ki_filp)); - /* - * If this is a DSYNC write, make sure we push it to stable storage now - * that we've written data. - */ - if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) - ret = generic_write_sync(iocb, ret); - - if (ret > 0) - ret += dio->done_before; + if (ret > 0) { + iocb->ki_pos += ret; + /* + * If this is a DSYNC write, make sure we push it to stable + * storage now that we've written data. + */ + if (dio->flags & IOMAP_DIO_NEED_SYNC) + ret = generic_write_sync(iocb, ret); + if (ret > 0) + ret += dio->done_before; + } kfree(dio); - return ret; } EXPORT_SYMBOL_GPL(iomap_dio_complete); diff -u linux-lowlatency-5.15.0/fs/jbd2/recovery.c linux-lowlatency-5.15.0/fs/jbd2/recovery.c --- linux-lowlatency-5.15.0/fs/jbd2/recovery.c +++ linux-lowlatency-5.15.0/fs/jbd2/recovery.c @@ -283,6 +283,8 @@ journal_superblock_t * sb; struct recovery_info info; + errseq_t wb_err; + struct address_space *mapping; memset(&info, 0, sizeof(info)); sb = journal->j_superblock; @@ -300,6 +302,9 @@ return 0; } + wb_err = 0; + mapping = journal->j_fs_dev->bd_inode->i_mapping; + errseq_check_and_advance(&mapping->wb_err, &wb_err); err = do_one_pass(journal, &info, PASS_SCAN); if (!err) err = do_one_pass(journal, &info, PASS_REVOKE); @@ -320,6 +325,9 @@ err2 = sync_blockdev(journal->j_fs_dev); if (!err) err = err2; + err2 = errseq_check_and_advance(&mapping->wb_err, &wb_err); + if (!err) + err = err2; /* Make sure all replayed data is on permanent storage */ if (journal->j_flags & JBD2_BARRIER) { err2 = blkdev_issue_flush(journal->j_fs_dev); diff -u linux-lowlatency-5.15.0/fs/jfs/jfs_dmap.c linux-lowlatency-5.15.0/fs/jfs/jfs_dmap.c --- linux-lowlatency-5.15.0/fs/jfs/jfs_dmap.c +++ linux-lowlatency-5.15.0/fs/jfs/jfs_dmap.c @@ -87,7 +87,7 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks); static int dbFindBits(u32 word, int l2nb); static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno); -static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx); +static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl); static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, int nblocks); static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, @@ -180,7 +180,8 @@ bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); - if (bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE) { + if (bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE || + bmp->db_l2nbperpage < 0) { err = -EINVAL; goto err_release_metapage; } @@ -194,6 +195,12 @@ bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); + if (bmp->db_maxag >= MAXAG || bmp->db_maxag < 0 || + bmp->db_agpref >= MAXAG || bmp->db_agpref < 0) { + err = -EINVAL; + goto err_release_metapage; + } + bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel); bmp->db_agheight = le32_to_cpu(dbmp_le->dn_agheight); bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); @@ -1778,7 +1785,7 @@ * dbFindLeaf() returns the index of the leaf at which * free space was found. */ - rc = dbFindLeaf((dmtree_t *) dcp, l2nb, &leafidx); + rc = dbFindLeaf((dmtree_t *) dcp, l2nb, &leafidx, true); /* release the buffer. */ @@ -2025,7 +2032,7 @@ * free space. if sufficient free space is found, dbFindLeaf() * returns the index of the leaf at which free space was found. */ - if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx)) + if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false)) return -ENOSPC; if (leafidx < 0) @@ -2989,14 +2996,18 @@ * leafidx - return pointer to be set to the index of the leaf * describing at least l2nb free blocks if sufficient * free blocks are found. + * is_ctl - determines if the tree is of type ctl * * RETURN VALUES: * 0 - success * -ENOSPC - insufficient free blocks. */ -static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) +static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl) { int ti, n = 0, k, x = 0; + int max_size; + + max_size = is_ctl ? CTLTREESIZE : TREESIZE; /* first check the root of the tree to see if there is * sufficient free space. @@ -3017,6 +3028,8 @@ /* sufficient free space found. move to the next * level (or quit if this is the last level). */ + if (x + n > max_size) + return -ENOSPC; if (l2nb <= tp->dmt_stree[x + n]) break; } diff -u linux-lowlatency-5.15.0/fs/jfs/jfs_imap.c linux-lowlatency-5.15.0/fs/jfs/jfs_imap.c --- linux-lowlatency-5.15.0/fs/jfs/jfs_imap.c +++ linux-lowlatency-5.15.0/fs/jfs/jfs_imap.c @@ -1320,7 +1320,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) { int rc, ino, iagno, addext, extno, bitno, sword; - int nwords, rem, i, agno; + int nwords, rem, i, agno, dn_numag; u32 mask, inosmap, extsmap; struct inode *ipimap; struct metapage *mp; @@ -1356,6 +1356,9 @@ /* get the ag number of this iag */ agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb)); + dn_numag = JFS_SBI(pip->i_sb)->bmap->db_numag; + if (agno < 0 || agno > dn_numag) + return -EIO; if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { /* diff -u linux-lowlatency-5.15.0/fs/ksmbd/smbacl.c linux-lowlatency-5.15.0/fs/ksmbd/smbacl.c --- linux-lowlatency-5.15.0/fs/ksmbd/smbacl.c +++ linux-lowlatency-5.15.0/fs/ksmbd/smbacl.c @@ -1105,6 +1105,7 @@ struct smb_acl *pdacl; struct smb_sid *powner_sid = NULL, *pgroup_sid = NULL; int powner_sid_size = 0, pgroup_sid_size = 0, pntsd_size; + int pntsd_alloc_size; if (parent_pntsd->osidoffset) { powner_sid = (struct smb_sid *)((char *)parent_pntsd + @@ -1117,9 +1118,10 @@ pgroup_sid_size = 1 + 1 + 6 + (pgroup_sid->num_subauth * 4); } - pntsd = kzalloc(sizeof(struct smb_ntsd) + powner_sid_size + - pgroup_sid_size + sizeof(struct smb_acl) + - nt_size, GFP_KERNEL); + pntsd_alloc_size = sizeof(struct smb_ntsd) + powner_sid_size + + pgroup_sid_size + sizeof(struct smb_acl) + nt_size; + + pntsd = kzalloc(pntsd_alloc_size, GFP_KERNEL); if (!pntsd) { rc = -ENOMEM; goto free_aces_base; @@ -1134,6 +1136,27 @@ pntsd->gsidoffset = parent_pntsd->gsidoffset; pntsd->dacloffset = parent_pntsd->dacloffset; + if ((u64)le32_to_cpu(pntsd->osidoffset) + powner_sid_size > + pntsd_alloc_size) { + rc = -EINVAL; + kfree(pntsd); + goto free_aces_base; + } + + if ((u64)le32_to_cpu(pntsd->gsidoffset) + pgroup_sid_size > + pntsd_alloc_size) { + rc = -EINVAL; + kfree(pntsd); + goto free_aces_base; + } + + if ((u64)le32_to_cpu(pntsd->dacloffset) + sizeof(struct smb_acl) + nt_size > + pntsd_alloc_size) { + rc = -EINVAL; + kfree(pntsd); + goto free_aces_base; + } + if (pntsd->osidoffset) { struct smb_sid *owner_sid = (struct smb_sid *)((char *)pntsd + le32_to_cpu(pntsd->osidoffset)); diff -u linux-lowlatency-5.15.0/fs/ksmbd/vfs_cache.c linux-lowlatency-5.15.0/fs/ksmbd/vfs_cache.c --- linux-lowlatency-5.15.0/fs/ksmbd/vfs_cache.c +++ linux-lowlatency-5.15.0/fs/ksmbd/vfs_cache.c @@ -105,7 +105,7 @@ ci = __ksmbd_inode_lookup(inode); if (ci) { ret = KSMBD_INODE_STATUS_OK; - if (ci->m_flags & S_DEL_PENDING) + if (ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS)) ret = KSMBD_INODE_STATUS_PENDING_DELETE; atomic_dec(&ci->m_count); } @@ -115,7 +115,7 @@ bool ksmbd_inode_pending_delete(struct ksmbd_file *fp) { - return (fp->f_ci->m_flags & S_DEL_PENDING); + return (fp->f_ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS)); } void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp) diff -u linux-lowlatency-5.15.0/fs/nfs/nfs4proc.c linux-lowlatency-5.15.0/fs/nfs/nfs4proc.c --- linux-lowlatency-5.15.0/fs/nfs/nfs4proc.c +++ linux-lowlatency-5.15.0/fs/nfs/nfs4proc.c @@ -5612,7 +5612,7 @@ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE]; nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 0, 0); - nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr); + nfs4_state_protect_write(hdr->ds_clp ? hdr->ds_clp : server->nfs_client, clnt, msg, hdr); } static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data) @@ -5653,7 +5653,8 @@ data->res.server = server; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0); - nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_COMMIT, clnt, msg); + nfs4_state_protect(data->ds_clp ? data->ds_clp : server->nfs_client, + NFS_SP4_MACH_CRED_COMMIT, clnt, msg); } static int _nfs4_proc_commit(struct file *dst, struct nfs_commitargs *args, @@ -8798,8 +8799,6 @@ /* Save the EXCHANGE_ID verifier session trunk tests */ memcpy(clp->cl_confirm.data, argp->verifier.data, sizeof(clp->cl_confirm.data)); - if (resp->flags & EXCHGID4_FLAG_USE_PNFS_DS) - set_bit(NFS_CS_DS, &clp->cl_flags); out: trace_nfs4_exchange_id(clp, status); rpc_put_task(task); diff -u linux-lowlatency-5.15.0/fs/nfs/pnfs.c linux-lowlatency-5.15.0/fs/nfs/pnfs.c --- linux-lowlatency-5.15.0/fs/nfs/pnfs.c +++ linux-lowlatency-5.15.0/fs/nfs/pnfs.c @@ -2629,31 +2629,44 @@ return mode == 0; } -static int -pnfs_layout_return_unused_byserver(struct nfs_server *server, void *data) +static int pnfs_layout_return_unused_byserver(struct nfs_server *server, + void *data) { const struct pnfs_layout_range *range = data; + const struct cred *cred; struct pnfs_layout_hdr *lo; struct inode *inode; + nfs4_stateid stateid; + enum pnfs_iomode iomode; + restart: rcu_read_lock(); list_for_each_entry_rcu(lo, &server->layouts, plh_layouts) { - if (!pnfs_layout_can_be_returned(lo) || + inode = lo->plh_inode; + if (!inode || !pnfs_layout_can_be_returned(lo) || test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) continue; - inode = lo->plh_inode; spin_lock(&inode->i_lock); - if (!pnfs_should_return_unused_layout(lo, range)) { + if (!lo->plh_inode || + !pnfs_should_return_unused_layout(lo, range)) { spin_unlock(&inode->i_lock); continue; } + pnfs_get_layout_hdr(lo); + pnfs_set_plh_return_info(lo, range->iomode, 0); + if (pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, + range, 0) != 0 || + !pnfs_prepare_layoutreturn(lo, &stateid, &cred, &iomode)) { + spin_unlock(&inode->i_lock); + rcu_read_unlock(); + pnfs_put_layout_hdr(lo); + cond_resched(); + goto restart; + } spin_unlock(&inode->i_lock); - inode = pnfs_grab_inode_layout_hdr(lo); - if (!inode) - continue; rcu_read_unlock(); - pnfs_mark_layout_for_return(inode, range); - iput(inode); + pnfs_send_layoutreturn(lo, &stateid, &cred, iomode, false); + pnfs_put_layout_hdr(lo); cond_resched(); goto restart; } diff -u linux-lowlatency-5.15.0/fs/nfsd/nfs4state.c linux-lowlatency-5.15.0/fs/nfsd/nfs4state.c --- linux-lowlatency-5.15.0/fs/nfsd/nfs4state.c +++ linux-lowlatency-5.15.0/fs/nfsd/nfs4state.c @@ -2686,7 +2686,7 @@ /* XXX: alternatively, we could get/drop in seq start/stop */ drop_client(clp); - return 0; + return seq_release(inode, file); } static const struct file_operations client_states_fops = { diff -u linux-lowlatency-5.15.0/fs/nfsd/vfs.c linux-lowlatency-5.15.0/fs/nfsd/vfs.c --- linux-lowlatency-5.15.0/fs/nfsd/vfs.c +++ linux-lowlatency-5.15.0/fs/nfsd/vfs.c @@ -1762,6 +1762,12 @@ if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen)) goto out; + err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; + if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) + goto out; + if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) + goto out; + retry: host_err = fh_want_write(ffhp); if (host_err) { @@ -1796,12 +1802,6 @@ if (ndentry == trap) goto out_dput_new; - host_err = -EXDEV; - if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt) - goto out_dput_new; - if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) - goto out_dput_new; - if ((ndentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK) && nfsd_has_cached_files(ndentry)) { close_cached = true; diff -u linux-lowlatency-5.15.0/fs/nilfs2/sufile.c linux-lowlatency-5.15.0/fs/nilfs2/sufile.c --- linux-lowlatency-5.15.0/fs/nilfs2/sufile.c +++ linux-lowlatency-5.15.0/fs/nilfs2/sufile.c @@ -501,15 +501,38 @@ down_write(&NILFS_MDT(sufile)->mi_sem); ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh); - if (!ret) { - mark_buffer_dirty(bh); - nilfs_mdt_mark_dirty(sufile); - kaddr = kmap_atomic(bh->b_page); - su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr); + if (ret) + goto out_sem; + + kaddr = kmap_atomic(bh->b_page); + su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr); + if (unlikely(nilfs_segment_usage_error(su))) { + struct the_nilfs *nilfs = sufile->i_sb->s_fs_info; + + kunmap_atomic(kaddr); + brelse(bh); + if (nilfs_segment_is_active(nilfs, segnum)) { + nilfs_error(sufile->i_sb, + "active segment %llu is erroneous", + (unsigned long long)segnum); + } else { + /* + * Segments marked erroneous are never allocated by + * nilfs_sufile_alloc(); only active segments, ie, + * the segments indexed by ns_segnum or ns_nextnum, + * can be erroneous here. + */ + WARN_ON_ONCE(1); + } + ret = -EIO; + } else { nilfs_segment_usage_set_dirty(su); kunmap_atomic(kaddr); + mark_buffer_dirty(bh); + nilfs_mdt_mark_dirty(sufile); brelse(bh); } +out_sem: up_write(&NILFS_MDT(sufile)->mi_sem); return ret; } @@ -536,9 +559,14 @@ kaddr = kmap_atomic(bh->b_page); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr); - WARN_ON(nilfs_segment_usage_error(su)); - if (modtime) + if (modtime) { + /* + * Check segusage error and set su_lastmod only when updating + * this entry with a valid timestamp, not for cancellation. + */ + WARN_ON_ONCE(nilfs_segment_usage_error(su)); su->su_lastmod = cpu_to_le64(modtime); + } su->su_nblocks = cpu_to_le32(nblocks); kunmap_atomic(kaddr); diff -u linux-lowlatency-5.15.0/fs/nilfs2/the_nilfs.c linux-lowlatency-5.15.0/fs/nilfs2/the_nilfs.c --- linux-lowlatency-5.15.0/fs/nilfs2/the_nilfs.c +++ linux-lowlatency-5.15.0/fs/nilfs2/the_nilfs.c @@ -717,7 +717,11 @@ goto failed_sbh; } nilfs_release_super_block(nilfs); - sb_set_blocksize(sb, blocksize); + if (!sb_set_blocksize(sb, blocksize)) { + nilfs_err(sb, "bad blocksize %d", blocksize); + err = -EINVAL; + goto out; + } err = nilfs_load_super_block(nilfs, sb, blocksize, &sbp); if (err) diff -u linux-lowlatency-5.15.0/fs/ntfs3/attrib.c linux-lowlatency-5.15.0/fs/ntfs3/attrib.c --- linux-lowlatency-5.15.0/fs/ntfs3/attrib.c +++ linux-lowlatency-5.15.0/fs/ntfs3/attrib.c @@ -1583,10 +1583,8 @@ le_b = NULL; attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b); - if (!attr_b) { - err = -ENOENT; - goto out; - } + if (!attr_b) + return -ENOENT; attr = attr_b; le = le_b; diff -u linux-lowlatency-5.15.0/fs/ntfs3/attrlist.c linux-lowlatency-5.15.0/fs/ntfs3/attrlist.c --- linux-lowlatency-5.15.0/fs/ntfs3/attrlist.c +++ linux-lowlatency-5.15.0/fs/ntfs3/attrlist.c @@ -52,7 +52,8 @@ if (!attr->non_res) { lsize = le32_to_cpu(attr->res.data_size); - le = kmalloc(al_aligned(lsize), GFP_NOFS | __GFP_NOWARN); + /* attr is resident: lsize < record_size (1K or 4K) */ + le = kvmalloc(al_aligned(lsize), GFP_KERNEL); if (!le) { err = -ENOMEM; goto out; @@ -80,7 +81,17 @@ if (err < 0) goto out; - le = kmalloc(al_aligned(lsize), GFP_NOFS | __GFP_NOWARN); + /* attr is nonresident. + * The worst case: + * 1T (2^40) extremely fragmented file. + * cluster = 4K (2^12) => 2^28 fragments + * 2^9 fragments per one record => 2^19 records + * 2^5 bytes of ATTR_LIST_ENTRY per one record => 2^24 bytes. + * + * the result is 16M bytes per attribute list. + * Use kvmalloc to allocate in range [several Kbytes - dozen Mbytes] + */ + le = kvmalloc(al_aligned(lsize), GFP_KERNEL); if (!le) { err = -ENOMEM; goto out; diff -u linux-lowlatency-5.15.0/fs/ntfs3/bitmap.c linux-lowlatency-5.15.0/fs/ntfs3/bitmap.c --- linux-lowlatency-5.15.0/fs/ntfs3/bitmap.c +++ linux-lowlatency-5.15.0/fs/ntfs3/bitmap.c @@ -667,7 +667,8 @@ wnd->bits_last = wbits; wnd->free_bits = - kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS | __GFP_NOWARN); + kvmalloc_array(wnd->nwnd, sizeof(u16), GFP_KERNEL | __GFP_ZERO); + if (!wnd->free_bits) return -ENOMEM; diff -u linux-lowlatency-5.15.0/fs/ntfs3/frecord.c linux-lowlatency-5.15.0/fs/ntfs3/frecord.c --- linux-lowlatency-5.15.0/fs/ntfs3/frecord.c +++ linux-lowlatency-5.15.0/fs/ntfs3/frecord.c @@ -2100,7 +2100,7 @@ for (i = 0; i < pages_per_frame; i++) { pg = pages[i]; - if (i == idx) + if (i == idx || !pg) continue; unlock_page(pg); put_page(pg); @@ -3144,6 +3144,12 @@ if (!fname || !memcmp(&fname->dup, dup, sizeof(fname->dup))) continue; + /* Check simple case when parent inode equals current inode. */ + if (ino_get(&fname->home) == ni->vfs_inode.i_ino) { + ntfs_set_state(sbi, NTFS_DIRTY_ERROR); + continue; + } + /* ntfs_iget5 may sleep. */ dir = ntfs_iget5(sb, &fname->home, NULL); if (IS_ERR(dir)) { diff -u linux-lowlatency-5.15.0/fs/ntfs3/fslog.c linux-lowlatency-5.15.0/fs/ntfs3/fslog.c --- linux-lowlatency-5.15.0/fs/ntfs3/fslog.c +++ linux-lowlatency-5.15.0/fs/ntfs3/fslog.c @@ -2169,8 +2169,10 @@ if (!page) { page = kmalloc(log->page_size, GFP_NOFS); - if (!page) - return -ENOMEM; + if (!page) { + err = -ENOMEM; + goto out; + } } /* diff -u linux-lowlatency-5.15.0/fs/ntfs3/fsntfs.c linux-lowlatency-5.15.0/fs/ntfs3/fsntfs.c --- linux-lowlatency-5.15.0/fs/ntfs3/fsntfs.c +++ linux-lowlatency-5.15.0/fs/ntfs3/fsntfs.c @@ -958,18 +958,11 @@ if (err) return err; - mark_inode_dirty(&ni->vfs_inode); + mark_inode_dirty_sync(&ni->vfs_inode); /* verify(!ntfs_update_mftmirr()); */ - /* - * If we used wait=1, sync_inode_metadata waits for the io for the - * inode to finish. It hangs when media is removed. - * So wait=0 is sent down to sync_inode_metadata - * and filemap_fdatawrite is used for the data blocks. - */ - err = sync_inode_metadata(&ni->vfs_inode, 0); - if (!err) - err = filemap_fdatawrite(ni->vfs_inode.i_mapping); + /* write mft record on disk. */ + err = _ni_write_inode(&ni->vfs_inode, 1); return err; } @@ -2458,10 +2451,12 @@ { CLST end, i; struct wnd_bitmap *wnd = &sbi->used.bitmap; + bool dirty = false; down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS); if (!wnd_is_used(wnd, lcn, len)) { - ntfs_set_state(sbi, NTFS_DIRTY_ERROR); + /* mark volume as dirty out of wnd->rw_lock */ + dirty = true; end = lcn + len; len = 0; @@ -2493,6 +2488,8 @@ out: up_write(&wnd->rw_lock); + if (dirty) + ntfs_set_state(sbi, NTFS_DIRTY_ERROR); } /* diff -u linux-lowlatency-5.15.0/fs/ntfs3/index.c linux-lowlatency-5.15.0/fs/ntfs3/index.c --- linux-lowlatency-5.15.0/fs/ntfs3/index.c +++ linux-lowlatency-5.15.0/fs/ntfs3/index.c @@ -729,6 +729,9 @@ u32 total = le32_to_cpu(hdr->total); u16 offs[128]; + if (unlikely(!cmp)) + return NULL; + fill_table: if (end > total) return NULL; diff -u linux-lowlatency-5.15.0/fs/ntfs3/super.c linux-lowlatency-5.15.0/fs/ntfs3/super.c --- linux-lowlatency-5.15.0/fs/ntfs3/super.c +++ linux-lowlatency-5.15.0/fs/ntfs3/super.c @@ -1136,7 +1136,7 @@ goto put_inode_out; } bytes = inode->i_size; - sbi->def_table = t = kmalloc(bytes, GFP_NOFS | __GFP_NOWARN); + sbi->def_table = t = kvmalloc(bytes, GFP_KERNEL); if (!t) { err = -ENOMEM; goto put_inode_out; diff -u linux-lowlatency-5.15.0/fs/ntfs3/xattr.c linux-lowlatency-5.15.0/fs/ntfs3/xattr.c --- linux-lowlatency-5.15.0/fs/ntfs3/xattr.c +++ linux-lowlatency-5.15.0/fs/ntfs3/xattr.c @@ -209,7 +209,8 @@ size = le32_to_cpu(info->size); /* Enumerate all xattrs. */ - for (ret = 0, off = 0; off < size; off += ea_size) { + ret = 0; + for (off = 0; off + sizeof(struct EA_FULL) < size; off += ea_size) { ea = Add2Ptr(ea_all, off); ea_size = unpacked_ea_size(ea); @@ -217,6 +218,10 @@ break; if (buffer) { + /* Check if we can use field ea->name */ + if (off + ea_size > size) + break; + if (ret + ea->name_len + 1 > bytes_per_buffer) { err = -ERANGE; goto out; diff -u linux-lowlatency-5.15.0/fs/overlayfs/copy_up.c linux-lowlatency-5.15.0/fs/overlayfs/copy_up.c --- linux-lowlatency-5.15.0/fs/overlayfs/copy_up.c +++ linux-lowlatency-5.15.0/fs/overlayfs/copy_up.c @@ -306,7 +306,7 @@ { struct iattr attr = { .ia_valid = - ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, + ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME, .ia_atime = stat->atime, .ia_mtime = stat->mtime, }; diff -u linux-lowlatency-5.15.0/fs/overlayfs/super.c linux-lowlatency-5.15.0/fs/overlayfs/super.c --- linux-lowlatency-5.15.0/fs/overlayfs/super.c +++ linux-lowlatency-5.15.0/fs/overlayfs/super.c @@ -2141,7 +2141,7 @@ ovl_trusted_xattr_handlers; sb->s_fs_info = ofs; sb->s_flags |= SB_POSIXACL; - sb->s_iflags |= SB_I_SKIP_SYNC | SB_I_IMA_UNVERIFIABLE_SIGNATURE; + sb->s_iflags |= SB_I_SKIP_SYNC; err = -ENOMEM; root_dentry = ovl_get_root(sb, upperpath.dentry, oe); diff -u linux-lowlatency-5.15.0/fs/proc/proc_sysctl.c linux-lowlatency-5.15.0/fs/proc/proc_sysctl.c --- linux-lowlatency-5.15.0/fs/proc/proc_sysctl.c +++ linux-lowlatency-5.15.0/fs/proc/proc_sysctl.c @@ -1765,7 +1765,6 @@ {"hung_task_panic", "kernel.hung_task_panic" }, {"numa_zonelist_order", "vm.numa_zonelist_order" }, {"softlockup_all_cpu_backtrace", "kernel.softlockup_all_cpu_backtrace" }, - {"softlockup_panic", "kernel.softlockup_panic" }, { } }; @@ -1781,6 +1780,13 @@ return NULL; } +bool sysctl_is_alias(char *param) +{ + const char *alias = sysctl_find_alias(param); + + return alias != NULL; +} + /* Set sysctl value passed on kernel command line. */ static int process_sysctl_arg(char *param, char *val, const char *unused, void *arg) diff -u linux-lowlatency-5.15.0/fs/pstore/platform.c linux-lowlatency-5.15.0/fs/pstore/platform.c --- linux-lowlatency-5.15.0/fs/pstore/platform.c +++ linux-lowlatency-5.15.0/fs/pstore/platform.c @@ -561,6 +561,8 @@ */ int pstore_register(struct pstore_info *psi) { + char *new_backend; + if (backend && strcmp(backend, psi->name)) { pr_warn("ignoring unexpected backend '%s'\n", psi->name); return -EPERM; @@ -580,11 +582,16 @@ return -EINVAL; } + new_backend = kstrdup(psi->name, GFP_KERNEL); + if (!new_backend) + return -ENOMEM; + mutex_lock(&psinfo_lock); if (psinfo) { pr_warn("backend '%s' already loaded: ignoring '%s'\n", psinfo->name, psi->name); mutex_unlock(&psinfo_lock); + kfree(new_backend); return -EBUSY; } @@ -617,7 +624,7 @@ * Update the module parameter backend, so it is visible * through /sys/module/pstore/parameters/backend */ - backend = kstrdup(psi->name, GFP_KERNEL); + backend = new_backend; pr_info("Registered %s as persistent store backend\n", psi->name); diff -u linux-lowlatency-5.15.0/fs/quota/dquot.c linux-lowlatency-5.15.0/fs/quota/dquot.c --- linux-lowlatency-5.15.0/fs/quota/dquot.c +++ linux-lowlatency-5.15.0/fs/quota/dquot.c @@ -2396,6 +2396,20 @@ if (sb_has_quota_loaded(sb, type)) return -EBUSY; + /* + * Quota files should never be encrypted. They should be thought of as + * filesystem metadata, not user data. New-style internal quota files + * cannot be encrypted by users anyway, but old-style external quota + * files could potentially be incorrectly created in an encrypted + * directory, hence this explicit check. Some reasons why encrypted + * quota files don't work include: (1) some filesystems that support + * encryption don't handle it in their quota_read and quota_write, and + * (2) cleaning up encrypted quota files at unmount would need special + * consideration, as quota files are cleaned up later than user files. + */ + if (IS_ENCRYPTED(inode)) + return -EINVAL; + dqopt->files[type] = igrab(inode); if (!dqopt->files[type]) return -EIO; diff -u linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_inode_fork.c linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_inode_fork.c --- linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_inode_fork.c +++ linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_inode_fork.c @@ -330,6 +330,7 @@ } if (error) { + xfs_idestroy_fork(ip->i_afp); kmem_cache_free(xfs_ifork_zone, ip->i_afp); ip->i_afp = NULL; } diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_buf_item_recover.c linux-lowlatency-5.15.0/fs/xfs/xfs_buf_item_recover.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_buf_item_recover.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_buf_item_recover.c @@ -24,6 +24,15 @@ #include "xfs_quota.h" /* + * This is the number of entries in the l_buf_cancel_table used during + * recovery. + */ +#define XLOG_BC_TABLE_SIZE 64 + +#define XLOG_BUF_CANCEL_BUCKET(log, blkno) \ + ((log)->l_buf_cancel_table + ((uint64_t)blkno % XLOG_BC_TABLE_SIZE)) + +/* * This structure is used during recovery to record the buf log items which * have been canceled and should not be replayed. */ @@ -1005,0 +1015,57 @@ + +#ifdef DEBUG +void +xlog_check_buf_cancel_table( + struct xlog *log) +{ + int i; + + for (i = 0; i < XLOG_BC_TABLE_SIZE; i++) + ASSERT(list_empty(&log->l_buf_cancel_table[i])); +} +#endif + +int +xlog_alloc_buf_cancel_table( + struct xlog *log) +{ + void *p; + int i; + + ASSERT(log->l_buf_cancel_table == NULL); + + p = kmalloc_array(XLOG_BC_TABLE_SIZE, sizeof(struct list_head), + GFP_KERNEL); + if (!p) + return -ENOMEM; + + log->l_buf_cancel_table = p; + for (i = 0; i < XLOG_BC_TABLE_SIZE; i++) + INIT_LIST_HEAD(&log->l_buf_cancel_table[i]); + + return 0; +} + +void +xlog_free_buf_cancel_table( + struct xlog *log) +{ + int i; + + if (!log->l_buf_cancel_table) + return; + + for (i = 0; i < XLOG_BC_TABLE_SIZE; i++) { + struct xfs_buf_cancel *bc; + + while ((bc = list_first_entry_or_null( + &log->l_buf_cancel_table[i], + struct xfs_buf_cancel, bc_list))) { + list_del(&bc->bc_list); + kmem_free(bc); + } + } + + kmem_free(log->l_buf_cancel_table); + log->l_buf_cancel_table = NULL; +} diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_inode.c linux-lowlatency-5.15.0/fs/xfs/xfs_inode.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_inode.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_inode.c @@ -378,8 +378,8 @@ } if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) { - return __xfs_rwsem_islocked(&VFS_I(ip)->i_rwsem, - (lock_flags & XFS_IOLOCK_SHARED)); + return __xfs_rwsem_islocked(&VFS_I(ip)->i_mapping->invalidate_lock, + (lock_flags & XFS_MMAPLOCK_SHARED)); } if (lock_flags & (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED)) { diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_iops.c linux-lowlatency-5.15.0/fs/xfs/xfs_iops.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_iops.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_iops.c @@ -511,27 +511,6 @@ return ERR_PTR(error); } -STATIC const char * -xfs_vn_get_link_inline( - struct dentry *dentry, - struct inode *inode, - struct delayed_call *done) -{ - struct xfs_inode *ip = XFS_I(inode); - char *link; - - ASSERT(ip->i_df.if_format == XFS_DINODE_FMT_LOCAL); - - /* - * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED if - * if_data is junk. - */ - link = ip->i_df.if_u1.if_data; - if (XFS_IS_CORRUPT(ip->i_mount, !link)) - return ERR_PTR(-EFSCORRUPTED); - return link; -} - static uint32_t xfs_stat_blksize( struct xfs_inode *ip) @@ -1200,14 +1179,6 @@ .update_time = xfs_vn_update_time, }; -static const struct inode_operations xfs_inline_symlink_inode_operations = { - .get_link = xfs_vn_get_link_inline, - .getattr = xfs_vn_getattr, - .setattr = xfs_vn_setattr, - .listxattr = xfs_vn_listxattr, - .update_time = xfs_vn_update_time, -}; - /* Figure out if this file actually supports DAX. */ static bool xfs_inode_supports_dax( @@ -1358,10 +1329,7 @@ inode->i_fop = &xfs_dir_file_operations; break; case S_IFLNK: - if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) - inode->i_op = &xfs_inline_symlink_inode_operations; - else - inode->i_op = &xfs_symlink_inode_operations; + inode->i_op = &xfs_symlink_inode_operations; break; default: inode->i_op = &xfs_inode_operations; diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_log.c linux-lowlatency-5.15.0/fs/xfs/xfs_log.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_log.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_log.c @@ -2061,8 +2061,6 @@ xlog_in_core_t *iclog, *next_iclog; int i; - xlog_cil_destroy(log); - /* * Cycle all the iclogbuf locks to make sure all log IO completion * is done before we tear down these buffers. @@ -2074,6 +2072,13 @@ iclog = iclog->ic_next; } + /* + * Destroy the CIL after waiting for iclog IO completion because an + * iclog EIO error will try to shut down the log, which accesses the + * CIL to wake up the waiters. + */ + xlog_cil_destroy(log); + iclog = log->l_iclog; for (i = 0; i < log->l_iclog_bufs; i++) { next_iclog = iclog->ic_next; diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_log_priv.h linux-lowlatency-5.15.0/fs/xfs/xfs_log_priv.h --- linux-lowlatency-5.15.0/fs/xfs/xfs_log_priv.h +++ linux-lowlatency-5.15.0/fs/xfs/xfs_log_priv.h @@ -454,9 +454,6 @@ struct rw_semaphore l_incompat_users; }; -#define XLOG_BUF_CANCEL_BUCKET(log, blkno) \ - ((log)->l_buf_cancel_table + ((uint64_t)blkno % XLOG_BC_TABLE_SIZE)) - /* * Bits for operational state */ diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_log_recover.c linux-lowlatency-5.15.0/fs/xfs/xfs_log_recover.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_log_recover.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_log_recover.c @@ -2560,6 +2560,7 @@ for (lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); lip != NULL; lip = xfs_trans_ail_cursor_next(ailp, &cur)) { + const struct xfs_item_ops *ops; /* * We're done when we see something other than an intent. * There should be no intents left in the AIL now. @@ -2584,13 +2585,17 @@ * deferred ops, you /must/ attach them to the capture list in * the recover routine or else those subsequent intents will be * replayed in the wrong order! + * + * The recovery function can free the log item, so we must not + * access lip after it returns. */ spin_unlock(&ailp->ail_lock); - error = lip->li_ops->iop_recover(lip, &capture_list); + ops = lip->li_ops; + error = ops->iop_recover(lip, &capture_list); spin_lock(&ailp->ail_lock); if (error) { trace_xlog_intent_recovery_failed(log->l_mp, error, - lip->li_ops->iop_recover); + ops->iop_recover); break; } } @@ -2739,6 +2744,7 @@ * Call xlog_recover_clear_agi_bucket() to perform a transaction to * clear the inode pointer in the bucket. */ + xfs_inodegc_flush(mp); xlog_recover_clear_agi_bucket(mp, agno, bucket); return NULLAGINO; } @@ -3248,7 +3254,7 @@ xfs_daddr_t head_blk, xfs_daddr_t tail_blk) { - int error, i; + int error; ASSERT(head_blk != tail_blk); @@ -3256,37 +3262,25 @@ * First do a pass to find all of the cancelled buf log items. * Store them in the buf_cancel_table for use in the second pass. */ - log->l_buf_cancel_table = kmem_zalloc(XLOG_BC_TABLE_SIZE * - sizeof(struct list_head), - 0); - for (i = 0; i < XLOG_BC_TABLE_SIZE; i++) - INIT_LIST_HEAD(&log->l_buf_cancel_table[i]); + error = xlog_alloc_buf_cancel_table(log); + if (error) + return error; error = xlog_do_recovery_pass(log, head_blk, tail_blk, XLOG_RECOVER_PASS1, NULL); - if (error != 0) { - kmem_free(log->l_buf_cancel_table); - log->l_buf_cancel_table = NULL; - return error; - } + if (error != 0) + goto out_cancel; + /* * Then do a second pass to actually recover the items in the log. * When it is complete free the table of buf cancel items. */ error = xlog_do_recovery_pass(log, head_blk, tail_blk, XLOG_RECOVER_PASS2, NULL); -#ifdef DEBUG - if (!error) { - int i; - - for (i = 0; i < XLOG_BC_TABLE_SIZE; i++) - ASSERT(list_empty(&log->l_buf_cancel_table[i])); - } -#endif /* DEBUG */ - - kmem_free(log->l_buf_cancel_table); - log->l_buf_cancel_table = NULL; - + if (!error) + xlog_check_buf_cancel_table(log); +out_cancel: + xlog_free_buf_cancel_table(log); return error; } diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_qm.c linux-lowlatency-5.15.0/fs/xfs/xfs_qm.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_qm.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_qm.c @@ -1244,6 +1244,13 @@ error = -EINVAL; goto out_unlock; } + + if (!(bp->b_flags & _XBF_DELWRI_Q)) { + error = -EAGAIN; + xfs_buf_relse(bp); + goto out_unlock; + } + xfs_buf_unlock(bp); xfs_buf_delwri_pushbuf(bp, buffer_list); diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_reflink.c linux-lowlatency-5.15.0/fs/xfs/xfs_reflink.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_reflink.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_reflink.c @@ -340,9 +340,41 @@ return 0; } -/* Allocate all CoW reservations covering a range of blocks in a file. */ -int -xfs_reflink_allocate_cow( +static int +xfs_reflink_convert_unwritten( + struct xfs_inode *ip, + struct xfs_bmbt_irec *imap, + struct xfs_bmbt_irec *cmap, + bool convert_now) +{ + xfs_fileoff_t offset_fsb = imap->br_startoff; + xfs_filblks_t count_fsb = imap->br_blockcount; + int error; + + /* + * cmap might larger than imap due to cowextsize hint. + */ + xfs_trim_extent(cmap, offset_fsb, count_fsb); + + /* + * COW fork extents are supposed to remain unwritten until we're ready + * to initiate a disk write. For direct I/O we are going to write the + * data and need the conversion, but for buffered writes we're done. + */ + if (!convert_now || cmap->br_state == XFS_EXT_NORM) + return 0; + + trace_xfs_reflink_convert_cow(ip, cmap); + + error = xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); + if (!error) + cmap->br_state = XFS_EXT_NORM; + + return error; +} + +static int +xfs_reflink_fill_cow_hole( struct xfs_inode *ip, struct xfs_bmbt_irec *imap, struct xfs_bmbt_irec *cmap, @@ -351,25 +383,12 @@ bool convert_now) { struct xfs_mount *mp = ip->i_mount; - xfs_fileoff_t offset_fsb = imap->br_startoff; - xfs_filblks_t count_fsb = imap->br_blockcount; struct xfs_trans *tp; - int nimaps, error = 0; - bool found; xfs_filblks_t resaligned; - xfs_extlen_t resblks = 0; - - ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); - if (!ip->i_cowfp) { - ASSERT(!xfs_is_reflink_inode(ip)); - xfs_ifork_init_cow(ip); - } - - error = xfs_find_trim_cow_extent(ip, imap, cmap, shared, &found); - if (error || !*shared) - return error; - if (found) - goto convert; + xfs_extlen_t resblks; + int nimaps; + int error; + bool found; resaligned = xfs_aligned_fsb_count(imap->br_startoff, imap->br_blockcount, xfs_get_cowextsz_hint(ip)); @@ -385,17 +404,17 @@ *lockmode = XFS_ILOCK_EXCL; - /* - * Check for an overlapping extent again now that we dropped the ilock. - */ error = xfs_find_trim_cow_extent(ip, imap, cmap, shared, &found); if (error || !*shared) goto out_trans_cancel; + if (found) { xfs_trans_cancel(tp); goto convert; } + ASSERT(cmap->br_startoff > imap->br_startoff); + /* Allocate the entire reservation as unwritten blocks. */ nimaps = 1; error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount, @@ -415,23 +434,135 @@ */ if (nimaps == 0) return -ENOSPC; + convert: - xfs_trim_extent(cmap, offset_fsb, count_fsb); - /* - * COW fork extents are supposed to remain unwritten until we're ready - * to initiate a disk write. For direct I/O we are going to write the - * data and need the conversion, but for buffered writes we're done. - */ - if (!convert_now || cmap->br_state == XFS_EXT_NORM) - return 0; - trace_xfs_reflink_convert_cow(ip, cmap); - return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); + return xfs_reflink_convert_unwritten(ip, imap, cmap, convert_now); + +out_trans_cancel: + xfs_trans_cancel(tp); + return error; +} + +static int +xfs_reflink_fill_delalloc( + struct xfs_inode *ip, + struct xfs_bmbt_irec *imap, + struct xfs_bmbt_irec *cmap, + bool *shared, + uint *lockmode, + bool convert_now) +{ + struct xfs_mount *mp = ip->i_mount; + struct xfs_trans *tp; + int nimaps; + int error; + bool found; + + do { + xfs_iunlock(ip, *lockmode); + *lockmode = 0; + + error = xfs_trans_alloc_inode(ip, &M_RES(mp)->tr_write, 0, 0, + false, &tp); + if (error) + return error; + + *lockmode = XFS_ILOCK_EXCL; + + error = xfs_find_trim_cow_extent(ip, imap, cmap, shared, + &found); + if (error || !*shared) + goto out_trans_cancel; + + if (found) { + xfs_trans_cancel(tp); + break; + } + + ASSERT(isnullstartblock(cmap->br_startblock) || + cmap->br_startblock == DELAYSTARTBLOCK); + + /* + * Replace delalloc reservation with an unwritten extent. + */ + nimaps = 1; + error = xfs_bmapi_write(tp, ip, cmap->br_startoff, + cmap->br_blockcount, + XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, 0, + cmap, &nimaps); + if (error) + goto out_trans_cancel; + + xfs_inode_set_cowblocks_tag(ip); + error = xfs_trans_commit(tp); + if (error) + return error; + + /* + * Allocation succeeded but the requested range was not even + * partially satisfied? Bail out! + */ + if (nimaps == 0) + return -ENOSPC; + } while (cmap->br_startoff + cmap->br_blockcount <= imap->br_startoff); + + return xfs_reflink_convert_unwritten(ip, imap, cmap, convert_now); out_trans_cancel: xfs_trans_cancel(tp); return error; } +/* Allocate all CoW reservations covering a range of blocks in a file. */ +int +xfs_reflink_allocate_cow( + struct xfs_inode *ip, + struct xfs_bmbt_irec *imap, + struct xfs_bmbt_irec *cmap, + bool *shared, + uint *lockmode, + bool convert_now) +{ + int error; + bool found; + + ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); + if (!ip->i_cowfp) { + ASSERT(!xfs_is_reflink_inode(ip)); + xfs_ifork_init_cow(ip); + } + + error = xfs_find_trim_cow_extent(ip, imap, cmap, shared, &found); + if (error || !*shared) + return error; + + /* CoW fork has a real extent */ + if (found) + return xfs_reflink_convert_unwritten(ip, imap, cmap, + convert_now); + + /* + * CoW fork does not have an extent and data extent is shared. + * Allocate a real extent in the CoW fork. + */ + if (cmap->br_startoff > imap->br_startoff) + return xfs_reflink_fill_cow_hole(ip, imap, cmap, shared, + lockmode, convert_now); + + /* + * CoW fork has a delalloc reservation. Replace it with a real extent. + * There may or may not be a data fork mapping. + */ + if (isnullstartblock(cmap->br_startblock) || + cmap->br_startblock == DELAYSTARTBLOCK) + return xfs_reflink_fill_delalloc(ip, imap, cmap, shared, + lockmode, convert_now); + + /* Shouldn't get here. */ + ASSERT(0); + return -EFSCORRUPTED; +} + /* * Cancel CoW reservations for some block range of an inode. * diff -u linux-lowlatency-5.15.0/fs/xfs/xfs_symlink.c linux-lowlatency-5.15.0/fs/xfs/xfs_symlink.c --- linux-lowlatency-5.15.0/fs/xfs/xfs_symlink.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_symlink.c @@ -22,6 +22,7 @@ #include "xfs_trace.h" #include "xfs_trans.h" #include "xfs_ialloc.h" +#include "xfs_error.h" /* ----- Kernel only functions below ----- */ int @@ -96,17 +97,15 @@ int xfs_readlink( - struct xfs_inode *ip, - char *link) + struct xfs_inode *ip, + char *link) { - struct xfs_mount *mp = ip->i_mount; - xfs_fsize_t pathlen; - int error = 0; + struct xfs_mount *mp = ip->i_mount; + xfs_fsize_t pathlen; + int error = -EFSCORRUPTED; trace_xfs_readlink(ip); - ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_LOCAL); - if (xfs_is_shutdown(mp)) return -EIO; @@ -121,12 +120,22 @@ __func__, (unsigned long long) ip->i_ino, (long long) pathlen); ASSERT(0); - error = -EFSCORRUPTED; goto out; } - - error = xfs_readlink_bmap_ilocked(ip, link); + if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { + /* + * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED + * if if_data is junk. + */ + if (XFS_IS_CORRUPT(ip->i_mount, !ip->i_df.if_u1.if_data)) + goto out; + + memcpy(link, ip->i_df.if_u1.if_data, pathlen + 1); + error = 0; + } else { + error = xfs_readlink_bmap_ilocked(ip, link); + } out: xfs_iunlock(ip, XFS_ILOCK_SHARED); diff -u linux-lowlatency-5.15.0/include/drm/drm_mipi_dsi.h linux-lowlatency-5.15.0/include/drm/drm_mipi_dsi.h --- linux-lowlatency-5.15.0/include/drm/drm_mipi_dsi.h +++ linux-lowlatency-5.15.0/include/drm/drm_mipi_dsi.h @@ -227,9 +227,13 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host, const struct mipi_dsi_device_info *info); void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi); +struct mipi_dsi_device * +devm_mipi_dsi_device_register_full(struct device *dev, struct mipi_dsi_host *host, + const struct mipi_dsi_device_info *info); struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi); +int devm_mipi_dsi_attach(struct device *dev, struct mipi_dsi_device *dsi); int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi); int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi); int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, diff -u linux-lowlatency-5.15.0/include/linux/cpuhotplug.h linux-lowlatency-5.15.0/include/linux/cpuhotplug.h --- linux-lowlatency-5.15.0/include/linux/cpuhotplug.h +++ linux-lowlatency-5.15.0/include/linux/cpuhotplug.h @@ -188,10 +188,12 @@ /* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING, CPUHP_AP_ARM_XEN_STARTING, + CPUHP_AP_ARM_XEN_RUNSTATE_STARTING, CPUHP_AP_ARM_CORESIGHT_STARTING, CPUHP_AP_ARM_CORESIGHT_CTI_STARTING, CPUHP_AP_ARM64_ISNDEP_STARTING, CPUHP_AP_SMPCFD_DYING, + CPUHP_AP_HRTIMERS_DYING, CPUHP_AP_X86_TBOOT_DYING, CPUHP_AP_ARM_CACHE_B15_RAC_DYING, CPUHP_AP_ONLINE, diff -u linux-lowlatency-5.15.0/include/linux/ethtool.h linux-lowlatency-5.15.0/include/linux/ethtool.h --- linux-lowlatency-5.15.0/include/linux/ethtool.h +++ linux-lowlatency-5.15.0/include/linux/ethtool.h @@ -781,10 +781,10 @@ /** * ethtool_sprintf - Write formatted string to ethtool string data - * @data: Pointer to start of string to update + * @data: Pointer to a pointer to the start of string to update * @fmt: Format of string to write * - * Write formatted string to data. Update data to point at start of + * Write formatted string to *data. Update *data to point at start of * next string. */ extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); diff -u linux-lowlatency-5.15.0/include/linux/fs.h linux-lowlatency-5.15.0/include/linux/fs.h --- linux-lowlatency-5.15.0/include/linux/fs.h +++ linux-lowlatency-5.15.0/include/linux/fs.h @@ -1723,7 +1723,50 @@ kgid_has_mapping(fs_userns, kgid); } -extern struct timespec64 current_time(struct inode *inode); +struct timespec64 current_time(struct inode *inode); +struct timespec64 inode_set_ctime_current(struct inode *inode); + +/** + * inode_get_ctime - fetch the current ctime from the inode + * @inode: inode from which to fetch ctime + * + * Grab the current ctime from the inode and return it. + */ +static inline struct timespec64 inode_get_ctime(const struct inode *inode) +{ + return inode->i_ctime; +} + +/** + * inode_set_ctime_to_ts - set the ctime in the inode + * @inode: inode in which to set the ctime + * @ts: value to set in the ctime field + * + * Set the ctime in @inode to @ts + */ +static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, + struct timespec64 ts) +{ + inode->i_ctime = ts; + return ts; +} + +/** + * inode_set_ctime - set the ctime in the inode + * @inode: inode in which to set the ctime + * @sec: tv_sec value to set + * @nsec: tv_nsec value to set + * + * Set the ctime in @inode to { @sec, @nsec } + */ +static inline struct timespec64 inode_set_ctime(struct inode *inode, + time64_t sec, long nsec) +{ + struct timespec64 ts = { .tv_sec = sec, + .tv_nsec = nsec }; + + return inode_set_ctime_to_ts(inode, ts); +} /* * Snapshotting support. diff -u linux-lowlatency-5.15.0/include/linux/hid.h linux-lowlatency-5.15.0/include/linux/hid.h --- linux-lowlatency-5.15.0/include/linux/hid.h +++ linux-lowlatency-5.15.0/include/linux/hid.h @@ -630,8 +630,13 @@ struct list_head debug_list; spinlock_t debug_list_lock; wait_queue_head_t debug_wait; + struct kref ref; + + unsigned int id; /* system unique id */ }; +void hiddev_free(struct kref *ref); + #define to_hid_device(pdev) \ container_of(pdev, struct hid_device, dev) diff -u linux-lowlatency-5.15.0/include/linux/idr.h linux-lowlatency-5.15.0/include/linux/idr.h --- linux-lowlatency-5.15.0/include/linux/idr.h +++ linux-lowlatency-5.15.0/include/linux/idr.h @@ -200,7 +200,7 @@ */ #define idr_for_each_entry_ul(idr, entry, tmp, id) \ for (tmp = 0, id = 0; \ - tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ + ((entry) = tmp <= id ? idr_get_next_ul(idr, &(id)) : NULL) != NULL; \ tmp = id, ++id) /** @@ -224,10 +224,12 @@ * @id: Entry ID. * * Continue to iterate over entries, continuing after the current position. + * After normal termination @entry is left with the value NULL. This + * is convenient for a "not found" value. */ #define idr_for_each_entry_continue_ul(idr, entry, tmp, id) \ for (tmp = id; \ - tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ + ((entry) = tmp <= id ? idr_get_next_ul(idr, &(id)) : NULL) != NULL; \ tmp = id, ++id) /* diff -u linux-lowlatency-5.15.0/include/linux/kasan.h linux-lowlatency-5.15.0/include/linux/kasan.h --- linux-lowlatency-5.15.0/include/linux/kasan.h +++ linux-lowlatency-5.15.0/include/linux/kasan.h @@ -472,9 +472,9 @@ #endif /* (CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) && !CONFIG_KASAN_VMALLOC */ -#ifdef CONFIG_KASAN_INLINE +#ifdef CONFIG_KASAN void kasan_non_canonical_hook(unsigned long addr); -#else /* CONFIG_KASAN_INLINE */ +#else /* CONFIG_KASAN */ static inline void kasan_non_canonical_hook(unsigned long addr) { } -#endif /* CONFIG_KASAN_INLINE */ +#endif /* CONFIG_KASAN */ #endif /* LINUX_KASAN_H */ diff -u linux-lowlatency-5.15.0/include/linux/kprobes.h linux-lowlatency-5.15.0/include/linux/kprobes.h --- linux-lowlatency-5.15.0/include/linux/kprobes.h +++ linux-lowlatency-5.15.0/include/linux/kprobes.h @@ -139,7 +139,7 @@ * */ struct kretprobe_holder { - struct kretprobe *rp; + struct kretprobe __rcu *rp; refcount_t ref; }; @@ -232,10 +232,7 @@ static nokprobe_inline struct kretprobe *get_kretprobe(struct kretprobe_instance *ri) { - RCU_LOCKDEP_WARN(!rcu_read_lock_any_held(), - "Kretprobe is accessed from instance under preemptive context"); - - return READ_ONCE(ri->rph->rp); + return rcu_dereference_check(ri->rph->rp, rcu_read_lock_any_held()); } #else /* CONFIG_KRETPROBES */ diff -u linux-lowlatency-5.15.0/include/linux/lsm_hook_defs.h linux-lowlatency-5.15.0/include/linux/lsm_hook_defs.h --- linux-lowlatency-5.15.0/include/linux/lsm_hook_defs.h +++ linux-lowlatency-5.15.0/include/linux/lsm_hook_defs.h @@ -48,7 +48,7 @@ LSM_HOOK(int, 0, syslog, int type) LSM_HOOK(int, 0, settime, const struct timespec64 *ts, const struct timezone *tz) -LSM_HOOK(int, 0, vm_enough_memory, struct mm_struct *mm, long pages) +LSM_HOOK(int, 1, vm_enough_memory, struct mm_struct *mm, long pages) LSM_HOOK(int, 0, bprm_creds_for_exec, struct linux_binprm *bprm) LSM_HOOK(int, 0, bprm_creds_from_file, struct linux_binprm *bprm, struct file *file) LSM_HOOK(int, 0, bprm_check_security, struct linux_binprm *bprm) @@ -265,7 +265,7 @@ LSM_HOOK(void, LSM_RET_VOID, inode_invalidate_secctx, struct inode *inode) LSM_HOOK(int, 0, inode_notifysecctx, struct inode *inode, void *ctx, u32 ctxlen) LSM_HOOK(int, 0, inode_setsecctx, struct dentry *dentry, void *ctx, u32 ctxlen) -LSM_HOOK(int, 0, inode_getsecctx, struct inode *inode, void **ctx, +LSM_HOOK(int, -EOPNOTSUPP, inode_getsecctx, struct inode *inode, void **ctx, u32 *ctxlen) #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE) diff -u linux-lowlatency-5.15.0/include/linux/netdevice.h linux-lowlatency-5.15.0/include/linux/netdevice.h --- linux-lowlatency-5.15.0/include/linux/netdevice.h +++ linux-lowlatency-5.15.0/include/linux/netdevice.h @@ -2978,6 +2978,7 @@ struct net_device *dev_get_by_name(struct net *net, const char *name); struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); struct net_device *__dev_get_by_name(struct net *net, const char *name); +bool netdev_name_in_use(struct net *net, const char *name); int dev_alloc_name(struct net_device *dev, const char *name); int dev_open(struct net_device *dev, struct netlink_ext_ack *extack); void dev_close(struct net_device *dev); @@ -5499,4 +5500,5 @@ #define DEV_STATS_ADD(DEV, FIELD, VAL) \ atomic_long_add((VAL), &(DEV)->stats.__##FIELD) +#define DEV_STATS_READ(DEV, FIELD) atomic_long_read(&(DEV)->stats.__##FIELD) #endif /* _LINUX_NETDEVICE_H */ diff -u linux-lowlatency-5.15.0/include/linux/pci_ids.h linux-lowlatency-5.15.0/include/linux/pci_ids.h --- linux-lowlatency-5.15.0/include/linux/pci_ids.h +++ linux-lowlatency-5.15.0/include/linux/pci_ids.h @@ -556,6 +556,7 @@ #define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493 #define PCI_DEVICE_ID_AMD_17H_M60H_DF_F3 0x144b #define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443 +#define PCI_DEVICE_ID_AMD_VANGOGH_USB 0x163a #define PCI_DEVICE_ID_AMD_19H_DF_F3 0x1653 #define PCI_DEVICE_ID_AMD_19H_M10H_DF_F3 0x14b0 #define PCI_DEVICE_ID_AMD_19H_M40H_DF_F3 0x167c diff -u linux-lowlatency-5.15.0/include/linux/platform_device.h linux-lowlatency-5.15.0/include/linux/platform_device.h --- linux-lowlatency-5.15.0/include/linux/platform_device.h +++ linux-lowlatency-5.15.0/include/linux/platform_device.h @@ -31,7 +31,11 @@ struct resource *resource; const struct platform_device_id *id_entry; - char *driver_override; /* Driver name to force a match */ + /* + * Driver name to force a match. Do not set directly, because core + * frees it. Use driver_set_override() to set or clear it. + */ + const char *driver_override; /* MFD cell pointer */ struct mfd_cell *mfd_cell; diff -u linux-lowlatency-5.15.0/include/linux/pwm.h linux-lowlatency-5.15.0/include/linux/pwm.h --- linux-lowlatency-5.15.0/include/linux/pwm.h +++ linux-lowlatency-5.15.0/include/linux/pwm.h @@ -44,8 +44,8 @@ }; enum { - PWMF_REQUESTED = 1 << 0, - PWMF_EXPORTED = 1 << 1, + PWMF_REQUESTED = 0, + PWMF_EXPORTED = 1, }; /* diff -u linux-lowlatency-5.15.0/include/linux/rpmsg.h linux-lowlatency-5.15.0/include/linux/rpmsg.h --- linux-lowlatency-5.15.0/include/linux/rpmsg.h +++ linux-lowlatency-5.15.0/include/linux/rpmsg.h @@ -41,7 +41,9 @@ * rpmsg_device - device that belong to the rpmsg bus * @dev: the device struct * @id: device id (used to match between rpmsg drivers and devices) - * @driver_override: driver name to force a match + * @driver_override: driver name to force a match; do not set directly, + * because core frees it; use driver_set_override() to + * set or clear it. * @src: local address * @dst: destination address * @ept: the rpmsg endpoint of this channel @@ -51,7 +53,7 @@ struct rpmsg_device { struct device dev; struct rpmsg_device_id id; - char *driver_override; + const char *driver_override; u32 src; u32 dst; struct rpmsg_endpoint *ept; @@ -163,6 +165,8 @@ #if IS_ENABLED(CONFIG_RPMSG) +int rpmsg_register_device_override(struct rpmsg_device *rpdev, + const char *driver_override); int rpmsg_register_device(struct rpmsg_device *rpdev); int rpmsg_unregister_device(struct device *parent, struct rpmsg_channel_info *chinfo); @@ -188,6 +192,12 @@ #else +static inline int rpmsg_register_device_override(struct rpmsg_device *rpdev, + const char *driver_override) +{ + return -ENXIO; +} + static inline int rpmsg_register_device(struct rpmsg_device *rpdev) { return -ENXIO; diff -u linux-lowlatency-5.15.0/include/linux/stmmac.h linux-lowlatency-5.15.0/include/linux/stmmac.h --- linux-lowlatency-5.15.0/include/linux/stmmac.h +++ linux-lowlatency-5.15.0/include/linux/stmmac.h @@ -172,6 +172,7 @@ bool hs_enable; /* FPE handshake enable */ enum stmmac_fpe_state lp_fpe_state; /* Link Partner FPE state */ enum stmmac_fpe_state lo_fpe_state; /* Local station FPE state */ + u32 fpe_csr; /* MAC_FPE_CTRL_STS reg cache */ }; struct stmmac_safety_feature_cfg { diff -u linux-lowlatency-5.15.0/include/linux/string.h linux-lowlatency-5.15.0/include/linux/string.h --- linux-lowlatency-5.15.0/include/linux/string.h +++ linux-lowlatency-5.15.0/include/linux/string.h @@ -5,7 +5,9 @@ #include /* for inline */ #include /* for size_t */ #include /* for NULL */ +#include /* for ERR_PTR() */ #include /* for E2BIG */ +#include /* for check_mul_overflow() */ #include #include @@ -14,6 +16,44 @@ extern void *vmemdup_user(const void __user *, size_t); extern void *memdup_user_nul(const void __user *, size_t); +/** + * memdup_array_user - duplicate array from user space + * @src: source address in user space + * @n: number of array members to copy + * @size: size of one array member + * + * Return: an ERR_PTR() on failure. Result is physically + * contiguous, to be freed by kfree(). + */ +static inline void *memdup_array_user(const void __user *src, size_t n, size_t size) +{ + size_t nbytes; + + if (check_mul_overflow(n, size, &nbytes)) + return ERR_PTR(-EOVERFLOW); + + return memdup_user(src, nbytes); +} + +/** + * vmemdup_array_user - duplicate array from user space + * @src: source address in user space + * @n: number of array members to copy + * @size: size of one array member + * + * Return: an ERR_PTR() on failure. Result may be not + * physically contiguous. Use kvfree() to free. + */ +static inline void *vmemdup_array_user(const void __user *src, size_t n, size_t size) +{ + size_t nbytes; + + if (check_mul_overflow(n, size, &nbytes)) + return ERR_PTR(-EOVERFLOW); + + return vmemdup_user(src, nbytes); +} + /* * Include machine specific inline routines */ diff -u linux-lowlatency-5.15.0/include/linux/sunrpc/clnt.h linux-lowlatency-5.15.0/include/linux/sunrpc/clnt.h --- linux-lowlatency-5.15.0/include/linux/sunrpc/clnt.h +++ linux-lowlatency-5.15.0/include/linux/sunrpc/clnt.h @@ -83,6 +83,7 @@ }; const struct cred *cl_cred; unsigned int cl_max_connect; /* max number of transports not to the same IP */ + struct super_block *pipefs_sb; }; /* diff -u linux-lowlatency-5.15.0/include/linux/sysctl.h linux-lowlatency-5.15.0/include/linux/sysctl.h --- linux-lowlatency-5.15.0/include/linux/sysctl.h +++ linux-lowlatency-5.15.0/include/linux/sysctl.h @@ -210,6 +210,7 @@ const char *table_name); #define register_sysctl_init(path, table) __register_sysctl_init(path, table, #table) void do_sysctl_args(void); +bool sysctl_is_alias(char *param); extern int pwrsw_enabled; extern int unaligned_enabled; @@ -251,6 +252,11 @@ static inline void do_sysctl_args(void) { } + +static inline bool sysctl_is_alias(char *param) +{ + return false; +} #endif /* CONFIG_SYSCTL */ int sysctl_max_threads(struct ctl_table *table, int write, void *buffer, diff -u linux-lowlatency-5.15.0/include/linux/trace_events.h linux-lowlatency-5.15.0/include/linux/trace_events.h --- linux-lowlatency-5.15.0/include/linux/trace_events.h +++ linux-lowlatency-5.15.0/include/linux/trace_events.h @@ -468,6 +468,7 @@ EVENT_FILE_FL_TRIGGER_COND_BIT, EVENT_FILE_FL_PID_FILTER_BIT, EVENT_FILE_FL_WAS_ENABLED_BIT, + EVENT_FILE_FL_FREED_BIT, }; extern struct trace_event_file *trace_get_event_file(const char *instance, @@ -606,6 +607,7 @@ * TRIGGER_COND - When set, one or more triggers has an associated filter * PID_FILTER - When set, the event is filtered based on pid * WAS_ENABLED - Set when enabled to know to clear trace on module removal + * FREED - File descriptor is freed, all fields should be considered invalid */ enum { EVENT_FILE_FL_ENABLED = (1 << EVENT_FILE_FL_ENABLED_BIT), @@ -619,6 +621,7 @@ EVENT_FILE_FL_TRIGGER_COND = (1 << EVENT_FILE_FL_TRIGGER_COND_BIT), EVENT_FILE_FL_PID_FILTER = (1 << EVENT_FILE_FL_PID_FILTER_BIT), EVENT_FILE_FL_WAS_ENABLED = (1 << EVENT_FILE_FL_WAS_ENABLED_BIT), + EVENT_FILE_FL_FREED = (1 << EVENT_FILE_FL_FREED_BIT), }; struct trace_event_file { @@ -647,6 +650,7 @@ * caching and such. Which is mostly OK ;-) */ unsigned long flags; + atomic_t ref; /* ref count for opened files */ atomic_t sm_ref; /* soft-mode reference counter */ atomic_t tm_ref; /* trigger-mode reference counter */ }; diff -u linux-lowlatency-5.15.0/include/linux/workqueue.h linux-lowlatency-5.15.0/include/linux/workqueue.h --- linux-lowlatency-5.15.0/include/linux/workqueue.h +++ linux-lowlatency-5.15.0/include/linux/workqueue.h @@ -222,18 +222,16 @@ * to generate better code. */ #ifdef CONFIG_LOCKDEP -#define __INIT_WORK(_work, _func, _onstack) \ +#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \ do { \ - static struct lock_class_key __key; \ - \ __init_work((_work), _onstack); \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ - lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \ + lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, (_key), 0); \ INIT_LIST_HEAD(&(_work)->entry); \ (_work)->func = (_func); \ } while (0) #else -#define __INIT_WORK(_work, _func, _onstack) \ +#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \ do { \ __init_work((_work), _onstack); \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ @@ -242,12 +240,22 @@ } while (0) #endif +#define __INIT_WORK(_work, _func, _onstack) \ + do { \ + static __maybe_unused struct lock_class_key __key; \ + \ + __INIT_WORK_KEY(_work, _func, _onstack, &__key); \ + } while (0) + #define INIT_WORK(_work, _func) \ __INIT_WORK((_work), (_func), 0) #define INIT_WORK_ONSTACK(_work, _func) \ __INIT_WORK((_work), (_func), 1) +#define INIT_WORK_ONSTACK_KEY(_work, _func, _key) \ + __INIT_WORK_KEY((_work), (_func), 1, _key) + #define __INIT_DELAYED_WORK(_work, _func, _tflags) \ do { \ INIT_WORK(&(_work)->work, (_func)); \ @@ -454,6 +462,7 @@ int execute_in_process_context(work_func_t fn, struct execute_work *); extern bool flush_work(struct work_struct *work); +extern bool cancel_work(struct work_struct *work); extern bool cancel_work_sync(struct work_struct *work); extern bool flush_delayed_work(struct delayed_work *dwork); @@ -632,8 +641,32 @@ return fn(arg); } #else -long work_on_cpu(int cpu, long (*fn)(void *), void *arg); -long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg); +long work_on_cpu_key(int cpu, long (*fn)(void *), + void *arg, struct lock_class_key *key); +/* + * A new key is defined for each caller to make sure the work + * associated with the function doesn't share its locking class. + */ +#define work_on_cpu(_cpu, _fn, _arg) \ +({ \ + static struct lock_class_key __key; \ + \ + work_on_cpu_key(_cpu, _fn, _arg, &__key); \ +}) + +long work_on_cpu_safe_key(int cpu, long (*fn)(void *), + void *arg, struct lock_class_key *key); + +/* + * A new key is defined for each caller to make sure the work + * associated with the function doesn't share its locking class. + */ +#define work_on_cpu_safe(_cpu, _fn, _arg) \ +({ \ + static struct lock_class_key __key; \ + \ + work_on_cpu_safe_key(_cpu, _fn, _arg, &__key); \ +}) #endif /* CONFIG_SMP */ #ifdef CONFIG_FREEZER diff -u linux-lowlatency-5.15.0/include/net/bluetooth/hci_core.h linux-lowlatency-5.15.0/include/net/bluetooth/hci_core.h --- linux-lowlatency-5.15.0/include/net/bluetooth/hci_core.h +++ linux-lowlatency-5.15.0/include/net/bluetooth/hci_core.h @@ -310,7 +310,7 @@ struct list_head list; struct mutex lock; - char name[8]; + const char *name; unsigned long flags; __u16 id; __u8 bus; diff -u linux-lowlatency-5.15.0/include/net/flow.h linux-lowlatency-5.15.0/include/net/flow.h --- linux-lowlatency-5.15.0/include/net/flow.h +++ linux-lowlatency-5.15.0/include/net/flow.h @@ -39,8 +39,8 @@ #define FLOWI_FLAG_SKIP_NH_OIF 0x04 __u32 flowic_secid; kuid_t flowic_uid; - struct flowi_tunnel flowic_tun_key; __u32 flowic_multipath_hash; + struct flowi_tunnel flowic_tun_key; }; union flowi_uli { diff -u linux-lowlatency-5.15.0/include/net/inet_connection_sock.h linux-lowlatency-5.15.0/include/net/inet_connection_sock.h --- linux-lowlatency-5.15.0/include/net/inet_connection_sock.h +++ linux-lowlatency-5.15.0/include/net/inet_connection_sock.h @@ -66,7 +66,6 @@ * @icsk_ulp_ops Pluggable ULP control hook * @icsk_ulp_data ULP private data * @icsk_clean_acked Clean acked data hook - * @icsk_listen_portaddr_node hash to the portaddr listener hashtable * @icsk_ca_state: Congestion control state * @icsk_retransmits: Number of unrecovered [RTO] timeouts * @icsk_pending: Scheduled timer event @@ -96,7 +95,6 @@ const struct tcp_ulp_ops *icsk_ulp_ops; void __rcu *icsk_ulp_data; void (*icsk_clean_acked)(struct sock *sk, u32 acked_seq); - struct hlist_node icsk_listen_portaddr_node; unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); __u8 icsk_ca_state:5, icsk_ca_initialized:1, diff -u linux-lowlatency-5.15.0/include/net/inet_hashtables.h linux-lowlatency-5.15.0/include/net/inet_hashtables.h --- linux-lowlatency-5.15.0/include/net/inet_hashtables.h +++ linux-lowlatency-5.15.0/include/net/inet_hashtables.h @@ -111,11 +111,7 @@ #define LISTENING_NULLS_BASE (1U << 29) struct inet_listen_hashbucket { spinlock_t lock; - unsigned int count; - union { - struct hlist_head head; - struct hlist_nulls_head nulls_head; - }; + struct hlist_nulls_head nulls_head; }; /* This is for listening sockets, thus all sockets which possess wildcards. */ @@ -143,32 +139,8 @@ /* The 2nd listener table hashed by local port and address */ unsigned int lhash2_mask; struct inet_listen_hashbucket *lhash2; - - /* All the above members are written once at bootup and - * never written again _or_ are predominantly read-access. - * - * Now align to a new cache line as all the following members - * might be often dirty. - */ - /* All sockets in TCP_LISTEN state will be in listening_hash. - * This is the only table where wildcard'd TCP sockets can - * exist. listening_hash is only hashed by local port number. - * If lhash2 is initialized, the same socket will also be hashed - * to lhash2 by port and address. - */ - struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE] - ____cacheline_aligned_in_smp; }; -#define inet_lhash2_for_each_icsk_continue(__icsk) \ - hlist_for_each_entry_continue(__icsk, icsk_listen_portaddr_node) - -#define inet_lhash2_for_each_icsk(__icsk, list) \ - hlist_for_each_entry(__icsk, list, icsk_listen_portaddr_node) - -#define inet_lhash2_for_each_icsk_rcu(__icsk, list) \ - hlist_for_each_entry_rcu(__icsk, list, icsk_listen_portaddr_node) - static inline struct inet_listen_hashbucket * inet_lhash2_bucket(struct inet_hashinfo *h, u32 hash) { @@ -219,23 +191,11 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, const unsigned short snum); -/* These can have wildcards, don't try too hard. */ -static inline u32 inet_lhashfn(const struct net *net, const unsigned short num) -{ - return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1); -} - -static inline int inet_sk_listen_hashfn(const struct sock *sk) -{ - return inet_lhashfn(sock_net(sk), inet_sk(sk)->inet_num); -} - /* Caller must disable local BH processing. */ int __inet_inherit_port(const struct sock *sk, struct sock *child); void inet_put_port(struct sock *sk); -void inet_hashinfo_init(struct inet_hashinfo *h); void inet_hashinfo2_init(struct inet_hashinfo *h, const char *name, unsigned long numentries, int scale, unsigned long low_limit, diff -u linux-lowlatency-5.15.0/include/net/ip_fib.h linux-lowlatency-5.15.0/include/net/ip_fib.h --- linux-lowlatency-5.15.0/include/net/ip_fib.h +++ linux-lowlatency-5.15.0/include/net/ip_fib.h @@ -151,6 +151,7 @@ int fib_nhs; bool fib_nh_is_v6; bool nh_updated; + bool pfsrc_removed; struct nexthop *nh; struct rcu_head rcu; struct fib_nh fib_nh[]; diff -u linux-lowlatency-5.15.0/include/net/netfilter/nf_tables.h linux-lowlatency-5.15.0/include/net/netfilter/nf_tables.h --- linux-lowlatency-5.15.0/include/net/netfilter/nf_tables.h +++ linux-lowlatency-5.15.0/include/net/netfilter/nf_tables.h @@ -144,14 +144,29 @@ *(u16 *)dreg = val; } +static inline void nft_reg_store_be16(u32 *dreg, __be16 val) +{ + nft_reg_store16(dreg, (__force __u16)val); +} + static inline u16 nft_reg_load16(const u32 *sreg) { return *(u16 *)sreg; } -static inline void nft_reg_store64(u32 *dreg, u64 val) +static inline __be16 nft_reg_load_be16(const u32 *sreg) +{ + return (__force __be16)nft_reg_load16(sreg); +} + +static inline __be32 nft_reg_load_be32(const u32 *sreg) +{ + return *(__force __be32 *)sreg; +} + +static inline void nft_reg_store64(u64 *dreg, u64 val) { - put_unaligned(val, (u64 *)dreg); + put_unaligned(val, dreg); } static inline u64 nft_reg_load64(const u32 *sreg) diff -u linux-lowlatency-5.15.0/include/net/netns/xfrm.h linux-lowlatency-5.15.0/include/net/netns/xfrm.h --- linux-lowlatency-5.15.0/include/net/netns/xfrm.h +++ linux-lowlatency-5.15.0/include/net/netns/xfrm.h @@ -50,6 +50,7 @@ struct list_head policy_all; struct hlist_head *policy_byidx; unsigned int policy_idx_hmask; + unsigned int idx_generator; struct hlist_head policy_inexact[XFRM_POLICY_MAX]; struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX]; unsigned int policy_count[XFRM_POLICY_MAX * 2]; diff -u linux-lowlatency-5.15.0/include/net/sock.h linux-lowlatency-5.15.0/include/net/sock.h --- linux-lowlatency-5.15.0/include/net/sock.h +++ linux-lowlatency-5.15.0/include/net/sock.h @@ -1923,21 +1923,33 @@ /* sk_tx_queue_mapping accept only upto a 16-bit value */ if (WARN_ON_ONCE((unsigned short)tx_queue >= USHRT_MAX)) return; - sk->sk_tx_queue_mapping = tx_queue; + /* Paired with READ_ONCE() in sk_tx_queue_get() and + * other WRITE_ONCE() because socket lock might be not held. + */ + WRITE_ONCE(sk->sk_tx_queue_mapping, tx_queue); } #define NO_QUEUE_MAPPING USHRT_MAX static inline void sk_tx_queue_clear(struct sock *sk) { - sk->sk_tx_queue_mapping = NO_QUEUE_MAPPING; + /* Paired with READ_ONCE() in sk_tx_queue_get() and + * other WRITE_ONCE() because socket lock might be not held. + */ + WRITE_ONCE(sk->sk_tx_queue_mapping, NO_QUEUE_MAPPING); } static inline int sk_tx_queue_get(const struct sock *sk) { - if (sk && sk->sk_tx_queue_mapping != NO_QUEUE_MAPPING) - return sk->sk_tx_queue_mapping; + if (sk) { + /* Paired with WRITE_ONCE() in sk_tx_queue_clear() + * and sk_tx_queue_set(). + */ + int val = READ_ONCE(sk->sk_tx_queue_mapping); + if (val != NO_QUEUE_MAPPING) + return val; + } return -1; } @@ -2071,7 +2083,7 @@ if (ndst != dst) { rcu_assign_pointer(sk->sk_dst_cache, ndst); sk_tx_queue_clear(sk); - sk->sk_dst_pending_confirm = 0; + WRITE_ONCE(sk->sk_dst_pending_confirm, 0); } } } @@ -2088,7 +2100,7 @@ struct dst_entry *old_dst; sk_tx_queue_clear(sk); - sk->sk_dst_pending_confirm = 0; + WRITE_ONCE(sk->sk_dst_pending_confirm, 0); old_dst = rcu_dereference_protected(sk->sk_dst_cache, lockdep_sock_is_held(sk)); rcu_assign_pointer(sk->sk_dst_cache, dst); @@ -2101,7 +2113,7 @@ struct dst_entry *old_dst; sk_tx_queue_clear(sk); - sk->sk_dst_pending_confirm = 0; + WRITE_ONCE(sk->sk_dst_pending_confirm, 0); old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst); dst_release(old_dst); } diff -u linux-lowlatency-5.15.0/include/net/tcp.h linux-lowlatency-5.15.0/include/net/tcp.h --- linux-lowlatency-5.15.0/include/net/tcp.h +++ linux-lowlatency-5.15.0/include/net/tcp.h @@ -141,6 +141,9 @@ #define TCP_RTO_MAX ((unsigned)(120*HZ)) #define TCP_RTO_MIN ((unsigned)(HZ/5)) #define TCP_TIMEOUT_MIN (2U) /* Min timeout for TCP timers in jiffies */ + +#define TCP_TIMEOUT_MIN_US (2*USEC_PER_MSEC) /* Min TCP timeout in microsecs */ + #define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC6298 2.1 initial RTO value */ #define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now * used as a fallback RTO for the @@ -311,7 +314,7 @@ int tcp_v4_early_demux(struct sk_buff *skb); int tcp_v4_rcv(struct sk_buff *skb); -void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb); +void tcp_remove_empty_skb(struct sock *sk); int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size); @@ -783,7 +786,7 @@ } /* Convert a nsec timestamp into TCP TSval timestamp (ms based currently) */ -static inline u32 tcp_ns_to_ts(u64 ns) +static inline u64 tcp_ns_to_ts(u64 ns) { return div_u64(ns, NSEC_PER_SEC / TCP_TS_HZ); } diff -u linux-lowlatency-5.15.0/include/rdma/ib_umem.h linux-lowlatency-5.15.0/include/rdma/ib_umem.h --- linux-lowlatency-5.15.0/include/rdma/ib_umem.h +++ linux-lowlatency-5.15.0/include/rdma/ib_umem.h @@ -85,6 +85,13 @@ { __rdma_block_iter_start(biter, umem->sgt_append.sgt.sgl, umem->sgt_append.sgt.nents, pgsz); + biter->__sg_advance = ib_umem_offset(umem) & ~(pgsz - 1); + biter->__sg_numblocks = ib_umem_num_dma_blocks(umem, pgsz); +} + +static inline bool __rdma_umem_block_iter_next(struct ib_block_iter *biter) +{ + return __rdma_block_iter_next(biter) && biter->__sg_numblocks--; } /** @@ -100,7 +107,7 @@ */ #define rdma_umem_for_each_dma_block(umem, biter, pgsz) \ for (__rdma_umem_block_iter_start(biter, umem, pgsz); \ - __rdma_block_iter_next(biter);) + __rdma_umem_block_iter_next(biter);) #ifdef CONFIG_INFINIBAND_USER_MEM diff -u linux-lowlatency-5.15.0/include/rdma/ib_verbs.h linux-lowlatency-5.15.0/include/rdma/ib_verbs.h --- linux-lowlatency-5.15.0/include/rdma/ib_verbs.h +++ linux-lowlatency-5.15.0/include/rdma/ib_verbs.h @@ -2817,6 +2817,7 @@ /* internal states */ struct scatterlist *__sg; /* sg holding the current aligned block */ dma_addr_t __dma_addr; /* unaligned DMA address of this block */ + size_t __sg_numblocks; /* ib_umem_num_dma_blocks() */ unsigned int __sg_nents; /* number of SG entries */ unsigned int __sg_advance; /* number of bytes to advance in sg in next step */ unsigned int __pg_bit; /* alignment of current block */ diff -u linux-lowlatency-5.15.0/include/sound/soc.h linux-lowlatency-5.15.0/include/sound/soc.h --- linux-lowlatency-5.15.0/include/sound/soc.h +++ linux-lowlatency-5.15.0/include/sound/soc.h @@ -880,6 +880,17 @@ #ifdef CONFIG_DMI char dmi_longname[80]; #endif /* CONFIG_DMI */ + +#ifdef CONFIG_PCI + /* + * PCI does not define 0 as invalid, so pci_subsystem_set indicates + * whether a value has been written to these fields. + */ + unsigned short pci_subsystem_vendor; + unsigned short pci_subsystem_device; + bool pci_subsystem_set; +#endif /* CONFIG_PCI */ + char topology_shortname[32]; struct device *dev; diff -u linux-lowlatency-5.15.0/include/uapi/linux/can/isotp.h linux-lowlatency-5.15.0/include/uapi/linux/can/isotp.h --- linux-lowlatency-5.15.0/include/uapi/linux/can/isotp.h +++ linux-lowlatency-5.15.0/include/uapi/linux/can/isotp.h @@ -124,18 +124,19 @@ /* flags for isotp behaviour */ -#define CAN_ISOTP_LISTEN_MODE 0x001 /* listen only (do not send FC) */ -#define CAN_ISOTP_EXTEND_ADDR 0x002 /* enable extended addressing */ -#define CAN_ISOTP_TX_PADDING 0x004 /* enable CAN frame padding tx path */ -#define CAN_ISOTP_RX_PADDING 0x008 /* enable CAN frame padding rx path */ -#define CAN_ISOTP_CHK_PAD_LEN 0x010 /* check received CAN frame padding */ -#define CAN_ISOTP_CHK_PAD_DATA 0x020 /* check received CAN frame padding */ -#define CAN_ISOTP_HALF_DUPLEX 0x040 /* half duplex error state handling */ -#define CAN_ISOTP_FORCE_TXSTMIN 0x080 /* ignore stmin from received FC */ -#define CAN_ISOTP_FORCE_RXSTMIN 0x100 /* ignore CFs depending on rx stmin */ -#define CAN_ISOTP_RX_EXT_ADDR 0x200 /* different rx extended addressing */ -#define CAN_ISOTP_WAIT_TX_DONE 0x400 /* wait for tx completion */ -#define CAN_ISOTP_SF_BROADCAST 0x800 /* 1-to-N functional addressing */ +#define CAN_ISOTP_LISTEN_MODE 0x0001 /* listen only (do not send FC) */ +#define CAN_ISOTP_EXTEND_ADDR 0x0002 /* enable extended addressing */ +#define CAN_ISOTP_TX_PADDING 0x0004 /* enable CAN frame padding tx path */ +#define CAN_ISOTP_RX_PADDING 0x0008 /* enable CAN frame padding rx path */ +#define CAN_ISOTP_CHK_PAD_LEN 0x0010 /* check received CAN frame padding */ +#define CAN_ISOTP_CHK_PAD_DATA 0x0020 /* check received CAN frame padding */ +#define CAN_ISOTP_HALF_DUPLEX 0x0040 /* half duplex error state handling */ +#define CAN_ISOTP_FORCE_TXSTMIN 0x0080 /* ignore stmin from received FC */ +#define CAN_ISOTP_FORCE_RXSTMIN 0x0100 /* ignore CFs depending on rx stmin */ +#define CAN_ISOTP_RX_EXT_ADDR 0x0200 /* different rx extended addressing */ +#define CAN_ISOTP_WAIT_TX_DONE 0x0400 /* wait for tx completion */ +#define CAN_ISOTP_SF_BROADCAST 0x0800 /* 1-to-N functional addressing */ +#define CAN_ISOTP_CF_BROADCAST 0x1000 /* 1-to-N transmission w/o FC */ /* protocol machine default values */ diff -u linux-lowlatency-5.15.0/include/uapi/linux/perf_event.h linux-lowlatency-5.15.0/include/uapi/linux/perf_event.h --- linux-lowlatency-5.15.0/include/uapi/linux/perf_event.h +++ linux-lowlatency-5.15.0/include/uapi/linux/perf_event.h @@ -251,6 +251,8 @@ PERF_BR_SYSRET = 8, /* syscall return */ PERF_BR_COND_CALL = 9, /* conditional function call */ PERF_BR_COND_RET = 10, /* conditional function return */ + PERF_BR_ERET = 11, /* exception return */ + PERF_BR_IRQ = 12, /* irq */ PERF_BR_MAX, }; diff -u linux-lowlatency-5.15.0/include/uapi/linux/stddef.h linux-lowlatency-5.15.0/include/uapi/linux/stddef.h --- linux-lowlatency-5.15.0/include/uapi/linux/stddef.h +++ linux-lowlatency-5.15.0/include/uapi/linux/stddef.h @@ -27,7 +27,7 @@ union { \ struct { MEMBERS } ATTRS; \ struct TAG { MEMBERS } ATTRS NAME; \ - } + } ATTRS /** * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union diff -u linux-lowlatency-5.15.0/init/main.c linux-lowlatency-5.15.0/init/main.c --- linux-lowlatency-5.15.0/init/main.c +++ linux-lowlatency-5.15.0/init/main.c @@ -540,6 +540,10 @@ { size_t len = strlen(param); + /* Handle params aliased to sysctls */ + if (sysctl_is_alias(param)) + return 0; + repair_env_string(param, val); /* Handle obsolete-style parameters */ diff -u linux-lowlatency-5.15.0/io_uring/io_uring.c linux-lowlatency-5.15.0/io_uring/io_uring.c --- linux-lowlatency-5.15.0/io_uring/io_uring.c +++ linux-lowlatency-5.15.0/io_uring/io_uring.c @@ -2626,6 +2626,7 @@ if (!(ctx->flags & IORING_SETUP_IOPOLL)) return; + percpu_ref_get(&ctx->refs); mutex_lock(&ctx->uring_lock); while (!list_empty(&ctx->iopoll_list)) { unsigned int nr_events = 0; @@ -2647,6 +2648,7 @@ } } mutex_unlock(&ctx->uring_lock); + percpu_ref_put(&ctx->refs); } static int io_iopoll_check(struct io_ring_ctx *ctx, long min) @@ -3177,7 +3179,7 @@ */ const struct bio_vec *bvec = imu->bvec; - if (offset <= bvec->bv_len) { + if (offset < bvec->bv_len) { iov_iter_advance(iter, offset); } else { unsigned long seg_skip; @@ -4074,7 +4076,7 @@ newf = u64_to_user_ptr(READ_ONCE(sqe->addr2)); lnk->flags = READ_ONCE(sqe->hardlink_flags); - lnk->oldpath = getname(oldf); + lnk->oldpath = getname_uflags(oldf, lnk->flags); if (IS_ERR(lnk->oldpath)) return PTR_ERR(lnk->oldpath); @@ -8650,49 +8652,6 @@ return ret; } -static int io_sqe_file_register(struct io_ring_ctx *ctx, struct file *file, - int index) -{ -#if defined(CONFIG_UNIX) - struct sock *sock = ctx->ring_sock->sk; - struct sk_buff_head *head = &sock->sk_receive_queue; - struct sk_buff *skb; - - /* - * See if we can merge this file into an existing skb SCM_RIGHTS - * file set. If there's no room, fall back to allocating a new skb - * and filling it in. - */ - spin_lock_irq(&head->lock); - skb = skb_peek(head); - if (skb) { - struct scm_fp_list *fpl = UNIXCB(skb).fp; - - if (fpl->count < SCM_MAX_FD) { - __skb_unlink(skb, head); - spin_unlock_irq(&head->lock); - fpl->fp[fpl->count] = get_file(file); - unix_inflight(fpl->user, fpl->fp[fpl->count]); - fpl->count++; - spin_lock_irq(&head->lock); - __skb_queue_head(head, skb); - } else { - skb = NULL; - } - } - spin_unlock_irq(&head->lock); - - if (skb) { - fput(file); - return 0; - } - - return __io_sqe_files_scm(ctx, 1, index); -#else - return 0; -#endif -} - static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, struct io_rsrc_node *node, void *rsrc) { @@ -8750,12 +8709,6 @@ *io_get_tag_slot(ctx->file_data, slot_index) = 0; io_fixed_file_set(file_slot, file); - ret = io_sqe_file_register(ctx, file, slot_index); - if (ret) { - file_slot->file_ptr = 0; - goto err; - } - ret = 0; err: if (needs_switch) @@ -8869,12 +8822,6 @@ } *io_get_tag_slot(data, i) = tag; io_fixed_file_set(file_slot, file); - err = io_sqe_file_register(ctx, file, i); - if (err) { - file_slot->file_ptr = 0; - fput(file); - break; - } } } @@ -9796,12 +9743,7 @@ init_completion(&exit.completion); init_task_work(&exit.task_work, io_tctx_exit_cb); exit.ctx = ctx; - /* - * Some may use context even when all refs and requests have been put, - * and they are free to do so while still holding uring_lock or - * completion_lock, see io_req_task_submit(). Apart from other work, - * this lock/unlock section also waits them to finish. - */ + mutex_lock(&ctx->uring_lock); while (!list_empty(&ctx->tctx_list)) { WARN_ON_ONCE(time_after(jiffies, timeout)); @@ -10436,7 +10378,7 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m) { - struct io_sq_data *sq = NULL; + int sq_pid = -1, sq_cpu = -1; bool has_lock; int i; @@ -10449,13 +10391,19 @@ has_lock = mutex_trylock(&ctx->uring_lock); if (has_lock && (ctx->flags & IORING_SETUP_SQPOLL)) { - sq = ctx->sq_data; - if (!sq->thread) - sq = NULL; + struct io_sq_data *sq = ctx->sq_data; + + if (mutex_trylock(&sq->lock)) { + if (sq->thread) { + sq_pid = task_pid_nr(sq->thread); + sq_cpu = task_cpu(sq->thread); + } + mutex_unlock(&sq->lock); + } } - seq_printf(m, "SqThread:\t%d\n", sq ? task_pid_nr(sq->thread) : -1); - seq_printf(m, "SqThreadCpu:\t%d\n", sq ? task_cpu(sq->thread) : -1); + seq_printf(m, "SqThread:\t%d\n", sq_pid); + seq_printf(m, "SqThreadCpu:\t%d\n", sq_cpu); seq_printf(m, "UserFiles:\t%u\n", ctx->nr_user_files); for (i = 0; has_lock && i < ctx->nr_user_files; i++) { struct file *f = io_file_from_index(ctx, i); diff -u linux-lowlatency-5.15.0/kernel/bpf/core.c linux-lowlatency-5.15.0/kernel/bpf/core.c --- linux-lowlatency-5.15.0/kernel/bpf/core.c +++ linux-lowlatency-5.15.0/kernel/bpf/core.c @@ -605,7 +605,11 @@ if (val < ksym->start) return -1; - if (val >= ksym->end) + /* Ensure that we detect return addresses as part of the program, when + * the final instruction is a call for a program part of the stack + * trace. Therefore, do val > ksym->end instead of val >= ksym->end. + */ + if (val > ksym->end) return 1; return 0; diff -u linux-lowlatency-5.15.0/kernel/bpf/helpers.c linux-lowlatency-5.15.0/kernel/bpf/helpers.c --- linux-lowlatency-5.15.0/kernel/bpf/helpers.c +++ linux-lowlatency-5.15.0/kernel/bpf/helpers.c @@ -1118,13 +1118,6 @@ ret = -EBUSY; goto out; } - if (!atomic64_read(&map->usercnt)) { - /* maps with timers must be either held by user space - * or pinned in bpffs. - */ - ret = -EPERM; - goto out; - } /* allocate hrtimer via map_kmalloc to use memcg accounting */ t = bpf_map_kmalloc_node(map, sizeof(*t), GFP_ATOMIC, map->numa_node); if (!t) { @@ -1137,7 +1130,21 @@ rcu_assign_pointer(t->callback_fn, NULL); hrtimer_init(&t->timer, clockid, HRTIMER_MODE_REL_SOFT); t->timer.function = bpf_timer_cb; - timer->timer = t; + WRITE_ONCE(timer->timer, t); + /* Guarantee the order between timer->timer and map->usercnt. So + * when there are concurrent uref release and bpf timer init, either + * bpf_timer_cancel_and_free() called by uref release reads a no-NULL + * timer or atomic64_read() below returns a zero usercnt. + */ + smp_mb(); + if (!atomic64_read(&map->usercnt)) { + /* maps with timers must be either held by user space + * or pinned in bpffs. + */ + WRITE_ONCE(timer->timer, NULL); + kfree(t); + ret = -EPERM; + } out: __bpf_spin_unlock_irqrestore(&timer->lock); return ret; @@ -1305,7 +1312,7 @@ /* The subsequent bpf_timer_start/cancel() helpers won't be able to use * this timer, since it won't be initialized. */ - timer->timer = NULL; + WRITE_ONCE(timer->timer, NULL); out: __bpf_spin_unlock_irqrestore(&timer->lock); if (!t) diff -u linux-lowlatency-5.15.0/kernel/bpf/verifier.c linux-lowlatency-5.15.0/kernel/bpf/verifier.c --- linux-lowlatency-5.15.0/kernel/bpf/verifier.c +++ linux-lowlatency-5.15.0/kernel/bpf/verifier.c @@ -2189,7 +2189,12 @@ if (class == BPF_ALU || class == BPF_ALU64) { if (!(*reg_mask & dreg)) return 0; - if (opcode == BPF_MOV) { + if (opcode == BPF_END || opcode == BPF_NEG) { + /* sreg is reserved and unused + * dreg still need precision before this insn + */ + return 0; + } else if (opcode == BPF_MOV) { if (BPF_SRC(insn->code) == BPF_X) { /* dreg = sreg * dreg needs precision after this insn @@ -2885,7 +2890,7 @@ insn->imm != 0 && env->bpf_capable) { struct bpf_reg_state fake_reg = {}; - __mark_reg_known(&fake_reg, (u32)insn->imm); + __mark_reg_known(&fake_reg, insn->imm); fake_reg.type = SCALAR_VALUE; save_register_state(state, spi, &fake_reg, size); } else if (reg && is_spillable_regtype(reg->type)) { diff -u linux-lowlatency-5.15.0/kernel/cpu.c linux-lowlatency-5.15.0/kernel/cpu.c --- linux-lowlatency-5.15.0/kernel/cpu.c +++ linux-lowlatency-5.15.0/kernel/cpu.c @@ -1697,7 +1697,7 @@ [CPUHP_HRTIMERS_PREPARE] = { .name = "hrtimers:prepare", .startup.single = hrtimers_prepare_cpu, - .teardown.single = hrtimers_dead_cpu, + .teardown.single = NULL, }, [CPUHP_SMPCFD_PREPARE] = { .name = "smpcfd:prepare", @@ -1764,6 +1764,12 @@ .startup.single = NULL, .teardown.single = smpcfd_dying_cpu, }, + [CPUHP_AP_HRTIMERS_DYING] = { + .name = "hrtimers:dying", + .startup.single = NULL, + .teardown.single = hrtimers_cpu_dying, + }, + /* Entry state on starting. Interrupts enabled from here on. Transient * state for synchronsization */ [CPUHP_AP_ONLINE] = { diff -u linux-lowlatency-5.15.0/kernel/debug/debug_core.c linux-lowlatency-5.15.0/kernel/debug/debug_core.c --- linux-lowlatency-5.15.0/kernel/debug/debug_core.c +++ linux-lowlatency-5.15.0/kernel/debug/debug_core.c @@ -997,6 +997,9 @@ if (panic_timeout) return; + debug_locks_off(); + console_flush_on_panic(CONSOLE_FLUSH_PENDING); + if (dbg_kdb_mode) kdb_printf("PANIC: %s\n", msg); diff -u linux-lowlatency-5.15.0/kernel/events/core.c linux-lowlatency-5.15.0/kernel/events/core.c --- linux-lowlatency-5.15.0/kernel/events/core.c +++ linux-lowlatency-5.15.0/kernel/events/core.c @@ -13325,7 +13325,8 @@ !perf_get_aux_event(child_ctr, leader)) return -EINVAL; } - leader->group_generation = parent_event->group_generation; + if (leader) + leader->group_generation = parent_event->group_generation; return 0; } diff -u linux-lowlatency-5.15.0/kernel/events/internal.h linux-lowlatency-5.15.0/kernel/events/internal.h --- linux-lowlatency-5.15.0/kernel/events/internal.h +++ linux-lowlatency-5.15.0/kernel/events/internal.h @@ -210,12 +210,7 @@ static inline int get_recursion_context(int *recursion) { - unsigned int pc = preempt_count(); - unsigned char rctx = 0; - - rctx += !!(pc & (NMI_MASK)); - rctx += !!(pc & (NMI_MASK | HARDIRQ_MASK)); - rctx += !!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)); + unsigned char rctx = interrupt_context_level(); if (recursion[rctx]) return -1; diff -u linux-lowlatency-5.15.0/kernel/events/ring_buffer.c linux-lowlatency-5.15.0/kernel/events/ring_buffer.c --- linux-lowlatency-5.15.0/kernel/events/ring_buffer.c +++ linux-lowlatency-5.15.0/kernel/events/ring_buffer.c @@ -699,6 +699,12 @@ watermark = 0; } + /* + * kcalloc_node() is unable to allocate buffer if the size is larger + * than: PAGE_SIZE << MAX_ORDER; directly bail out in this case. + */ + if (get_order((unsigned long)nr_pages * sizeof(void *)) > MAX_ORDER) + return -ENOMEM; rb->aux_pages = kcalloc_node(nr_pages, sizeof(void *), GFP_KERNEL, node); if (!rb->aux_pages) diff -u linux-lowlatency-5.15.0/kernel/futex/core.c linux-lowlatency-5.15.0/kernel/futex/core.c --- linux-lowlatency-5.15.0/kernel/futex/core.c +++ linux-lowlatency-5.15.0/kernel/futex/core.c @@ -570,7 +570,17 @@ * but access_ok() should be faster than find_vma() */ if (!fshared) { - key->private.mm = mm; + /* + * On no-MMU, shared futexes are treated as private, therefore + * we must not include the current process in the key. Since + * there is only one address space, the address is a unique key + * on its own. + */ + if (IS_ENABLED(CONFIG_MMU)) + key->private.mm = mm; + else + key->private.mm = NULL; + key->private.address = address; return 0; } diff -u linux-lowlatency-5.15.0/kernel/kexec.c linux-lowlatency-5.15.0/kernel/kexec.c --- linux-lowlatency-5.15.0/kernel/kexec.c +++ linux-lowlatency-5.15.0/kernel/kexec.c @@ -240,7 +240,7 @@ ((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT)) return -EINVAL; - ksegments = memdup_user(segments, nr_segments * sizeof(ksegments[0])); + ksegments = memdup_array_user(segments, nr_segments, sizeof(ksegments[0])); if (IS_ERR(ksegments)) return PTR_ERR(ksegments); diff -u linux-lowlatency-5.15.0/kernel/kprobes.c linux-lowlatency-5.15.0/kernel/kprobes.c --- linux-lowlatency-5.15.0/kernel/kprobes.c +++ linux-lowlatency-5.15.0/kernel/kprobes.c @@ -2100,7 +2100,7 @@ if (!rp->rph) return -ENOMEM; - rp->rph->rp = rp; + rcu_assign_pointer(rp->rph->rp, rp); for (i = 0; i < rp->maxactive; i++) { inst = kzalloc(sizeof(struct kretprobe_instance) + rp->data_size, GFP_KERNEL); @@ -2157,7 +2157,7 @@ for (i = 0; i < num; i++) { if (__unregister_kprobe_top(&rps[i]->kp) < 0) rps[i]->kp.addr = NULL; - rps[i]->rph->rp = NULL; + rcu_assign_pointer(rps[i]->rph->rp, NULL); } mutex_unlock(&kprobe_mutex); diff -u linux-lowlatency-5.15.0/kernel/livepatch/core.c linux-lowlatency-5.15.0/kernel/livepatch/core.c --- linux-lowlatency-5.15.0/kernel/livepatch/core.c +++ linux-lowlatency-5.15.0/kernel/livepatch/core.c @@ -244,7 +244,7 @@ * symbols are exported and normal relas can be used instead. */ if (!sec_vmlinux && sym_vmlinux) { - pr_err("invalid access to vmlinux symbol '%s' from module-specific livepatch relocation section", + pr_err("invalid access to vmlinux symbol '%s' from module-specific livepatch relocation section\n", sym_name); return -EINVAL; } diff -u linux-lowlatency-5.15.0/kernel/locking/lockdep.c linux-lowlatency-5.15.0/kernel/locking/lockdep.c --- linux-lowlatency-5.15.0/kernel/locking/lockdep.c +++ linux-lowlatency-5.15.0/kernel/locking/lockdep.c @@ -3418,7 +3418,8 @@ size = chain_block_size(curr); if (likely(size >= req)) { del_chain_block(0, size, chain_block_next(curr)); - add_chain_block(curr + req, size - req); + if (size > req) + add_chain_block(curr + req, size - req); return curr; } } diff -u linux-lowlatency-5.15.0/kernel/padata.c linux-lowlatency-5.15.0/kernel/padata.c --- linux-lowlatency-5.15.0/kernel/padata.c +++ linux-lowlatency-5.15.0/kernel/padata.c @@ -194,7 +194,7 @@ *cb_cpu = cpu; } - err = -EBUSY; + err = -EBUSY; if ((pinst->flags & PADATA_RESET)) goto out; @@ -1094,12 +1094,16 @@ */ void padata_free_shell(struct padata_shell *ps) { + struct parallel_data *pd; + if (!ps) return; mutex_lock(&ps->pinst->lock); list_del(&ps->list); - padata_free_pd(rcu_dereference_protected(ps->pd, 1)); + pd = rcu_dereference_protected(ps->pd, 1); + if (refcount_dec_and_test(&pd->refcnt)) + padata_free_pd(pd); mutex_unlock(&ps->pinst->lock); kfree(ps); diff -u linux-lowlatency-5.15.0/kernel/power/snapshot.c linux-lowlatency-5.15.0/kernel/power/snapshot.c --- linux-lowlatency-5.15.0/kernel/power/snapshot.c +++ linux-lowlatency-5.15.0/kernel/power/snapshot.c @@ -2414,8 +2414,9 @@ pbe->copy_page = tmp; } else { /* Copy of the page will be stored in normal memory */ - kaddr = safe_pages_list; - safe_pages_list = safe_pages_list->next; + kaddr = __get_safe_page(ca->gfp_mask); + if (!kaddr) + return ERR_PTR(-ENOMEM); pbe->copy_page = virt_to_page(kaddr); } pbe->next = highmem_pblist; @@ -2595,8 +2596,9 @@ return ERR_PTR(-ENOMEM); } pbe->orig_address = page_address(page); - pbe->address = safe_pages_list; - safe_pages_list = safe_pages_list->next; + pbe->address = __get_safe_page(ca->gfp_mask); + if (!pbe->address) + return ERR_PTR(-ENOMEM); pbe->next = restore_pblist; restore_pblist = pbe; return pbe->address; @@ -2627,8 +2629,6 @@ if (handle->cur > 1 && handle->cur > nr_meta_pages + nr_copy_pages) return 0; - handle->sync_read = 1; - if (!handle->cur) { if (!buffer) /* This makes the buffer be freed by swsusp_free() */ @@ -2664,7 +2664,6 @@ memory_bm_position_reset(&orig_bm); restore_pblist = NULL; handle->buffer = get_buffer(&orig_bm, &ca); - handle->sync_read = 0; if (IS_ERR(handle->buffer)) return PTR_ERR(handle->buffer); } @@ -2674,9 +2673,8 @@ handle->buffer = get_buffer(&orig_bm, &ca); if (IS_ERR(handle->buffer)) return PTR_ERR(handle->buffer); - if (handle->buffer != buffer) - handle->sync_read = 0; } + handle->sync_read = (handle->buffer == buffer); handle->cur++; return PAGE_SIZE; } diff -u linux-lowlatency-5.15.0/kernel/rcu/tree.c linux-lowlatency-5.15.0/kernel/rcu/tree.c --- linux-lowlatency-5.15.0/kernel/rcu/tree.c +++ linux-lowlatency-5.15.0/kernel/rcu/tree.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1906,10 +1907,22 @@ */ static void rcu_gp_fqs(bool first_time) { + int nr_fqs = READ_ONCE(rcu_state.nr_fqs_jiffies_stall); struct rcu_node *rnp = rcu_get_root(); WRITE_ONCE(rcu_state.gp_activity, jiffies); WRITE_ONCE(rcu_state.n_force_qs, rcu_state.n_force_qs + 1); + + WARN_ON_ONCE(nr_fqs > 3); + /* Only countdown nr_fqs for stall purposes if jiffies moves. */ + if (nr_fqs) { + if (nr_fqs == 1) { + WRITE_ONCE(rcu_state.jiffies_stall, + jiffies + rcu_jiffies_till_stall_check()); + } + WRITE_ONCE(rcu_state.nr_fqs_jiffies_stall, --nr_fqs); + } + if (first_time) { /* Collect dyntick-idle snapshots. */ force_qs_rnp(dyntick_save_progress_counter); @@ -3597,6 +3610,14 @@ WRITE_ONCE(krcp->count, krcp->count + 1); + /* + * The kvfree_rcu() caller considers the pointer freed at this point + * and likely removes any references to it. Since the actual slab + * freeing (and kmemleak_free()) is deferred, tell kmemleak to ignore + * this object (no scanning or false positives reporting). + */ + kmemleak_ignore(ptr); + // Set timer to drain after KFREE_DRAIN_JIFFIES. if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && !krcp->monitor_todo) { diff -u linux-lowlatency-5.15.0/kernel/rcu/tree_plugin.h linux-lowlatency-5.15.0/kernel/rcu/tree_plugin.h --- linux-lowlatency-5.15.0/kernel/rcu/tree_plugin.h +++ linux-lowlatency-5.15.0/kernel/rcu/tree_plugin.h @@ -458,7 +458,7 @@ * be quite short, for example, in the case of the call from * rcu_read_unlock_special(). */ -static void +static notrace void rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags) { bool empty_exp; @@ -578,7 +578,7 @@ * is disabled. This function cannot be expected to understand these * nuances, so the caller must handle them. */ -static bool rcu_preempt_need_deferred_qs(struct task_struct *t) +static notrace bool rcu_preempt_need_deferred_qs(struct task_struct *t) { return (__this_cpu_read(rcu_data.exp_deferred_qs) || READ_ONCE(t->rcu_read_unlock_special.s)) && @@ -592,7 +592,7 @@ * evaluate safety in terms of interrupt, softirq, and preemption * disabling. */ -static void rcu_preempt_deferred_qs(struct task_struct *t) +static notrace void rcu_preempt_deferred_qs(struct task_struct *t) { unsigned long flags; @@ -923,7 +923,7 @@ * Because there is no preemptible RCU, there can be no deferred quiescent * states. */ -static bool rcu_preempt_need_deferred_qs(struct task_struct *t) +static notrace bool rcu_preempt_need_deferred_qs(struct task_struct *t) { return false; } diff -u linux-lowlatency-5.15.0/kernel/rcu/tree_stall.h linux-lowlatency-5.15.0/kernel/rcu/tree_stall.h --- linux-lowlatency-5.15.0/kernel/rcu/tree_stall.h +++ linux-lowlatency-5.15.0/kernel/rcu/tree_stall.h @@ -121,12 +121,17 @@ /** * rcu_cpu_stall_reset - restart stall-warning timeout for current grace period * + * To perform the reset request from the caller, disable stall detection until + * 3 fqs loops have passed. This is required to ensure a fresh jiffies is + * loaded. It should be safe to do from the fqs loop as enough timer + * interrupts and context switches should have passed. + * * The caller must disable hard irqs. */ void rcu_cpu_stall_reset(void) { - WRITE_ONCE(rcu_state.jiffies_stall, - jiffies + rcu_jiffies_till_stall_check()); + WRITE_ONCE(rcu_state.nr_fqs_jiffies_stall, 3); + WRITE_ONCE(rcu_state.jiffies_stall, ULONG_MAX); } ////////////////////////////////////////////////////////////////////////////// @@ -142,6 +147,7 @@ WRITE_ONCE(rcu_state.gp_start, j); j1 = rcu_jiffies_till_stall_check(); smp_mb(); // ->gp_start before ->jiffies_stall and caller's ->gp_seq. + WRITE_ONCE(rcu_state.nr_fqs_jiffies_stall, 0); WRITE_ONCE(rcu_state.jiffies_stall, j + j1); rcu_state.jiffies_resched = j + j1 / 2; rcu_state.n_force_qs_gpstart = READ_ONCE(rcu_state.n_force_qs); @@ -662,6 +668,16 @@ !rcu_gp_in_progress()) return; rcu_stall_kick_kthreads(); + + /* + * Check if it was requested (via rcu_cpu_stall_reset()) that the FQS + * loop has to set jiffies to ensure a non-stale jiffies value. This + * is required to have good jiffies value after coming out of long + * breaks of jiffies updates. Not doing so can cause false positives. + */ + if (READ_ONCE(rcu_state.nr_fqs_jiffies_stall) > 0) + return; + j = jiffies; /* diff -u linux-lowlatency-5.15.0/kernel/sched/core.c linux-lowlatency-5.15.0/kernel/sched/core.c --- linux-lowlatency-5.15.0/kernel/sched/core.c +++ linux-lowlatency-5.15.0/kernel/sched/core.c @@ -2377,9 +2377,11 @@ * it. */ WARN_ON_ONCE(!pending->stop_pending); + preempt_disable(); task_rq_unlock(rq, p, &rf); stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, &pending->arg, &pending->stop_work); + preempt_enable(); return 0; } out: @@ -2660,12 +2662,13 @@ complete = true; } + preempt_disable(); task_rq_unlock(rq, p, rf); - if (push_task) { stop_one_cpu_nowait(rq->cpu, push_cpu_stop, p, &rq->push_work); } + preempt_enable(); if (complete) complete_all(&pending->done); @@ -2731,12 +2734,13 @@ if (flags & SCA_MIGRATE_ENABLE) p->migration_flags &= ~MDF_PUSH; + preempt_disable(); task_rq_unlock(rq, p, rf); - if (!stop_pending) { stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop, &pending->arg, &pending->stop_work); } + preempt_enable(); if (flags & SCA_MIGRATE_ENABLE) return 0; @@ -8973,9 +8977,11 @@ * Temporarily drop rq->lock such that we can wake-up the stop task. * Both preemption and IRQs are still disabled. */ + preempt_disable(); raw_spin_rq_unlock(rq); stop_one_cpu_nowait(rq->cpu, __balance_push_cpu_stop, push_task, this_cpu_ptr(&push_work)); + preempt_enable(); /* * At this point need_resched() is true and we'll take the loop in * schedule(). The next pick is obviously going to be the stop task diff -u linux-lowlatency-5.15.0/kernel/sched/deadline.c linux-lowlatency-5.15.0/kernel/sched/deadline.c --- linux-lowlatency-5.15.0/kernel/sched/deadline.c +++ linux-lowlatency-5.15.0/kernel/sched/deadline.c @@ -2308,9 +2308,11 @@ double_unlock_balance(this_rq, src_rq); if (push_task) { + preempt_disable(); raw_spin_rq_unlock(this_rq); stop_one_cpu_nowait(src_rq->cpu, push_cpu_stop, push_task, &src_rq->push_work); + preempt_enable(); raw_spin_rq_lock(this_rq); } } diff -u linux-lowlatency-5.15.0/kernel/sched/fair.c linux-lowlatency-5.15.0/kernel/sched/fair.c --- linux-lowlatency-5.15.0/kernel/sched/fair.c +++ linux-lowlatency-5.15.0/kernel/sched/fair.c @@ -3987,22 +3987,6 @@ return max(task_util(p), _task_util_est(p)); } -#ifdef CONFIG_UCLAMP_TASK -static inline unsigned long uclamp_task_util(struct task_struct *p, - unsigned long uclamp_min, - unsigned long uclamp_max) -{ - return clamp(task_util_est(p), uclamp_min, uclamp_max); -} -#else -static inline unsigned long uclamp_task_util(struct task_struct *p, - unsigned long uclamp_min, - unsigned long uclamp_max) -{ - return task_util_est(p); -} -#endif - static inline void util_est_enqueue(struct cfs_rq *cfs_rq, struct task_struct *p) { @@ -7037,7 +7021,7 @@ target = prev_cpu; sync_entity_load_avg(&p->se); - if (!uclamp_task_util(p, p_util_min, p_util_max)) + if (!task_util_est(p) && p_util_min == 0) goto unlock; for (; pd; pd = pd->next) { @@ -10479,13 +10463,15 @@ busiest->push_cpu = this_cpu; active_balance = 1; } - raw_spin_rq_unlock_irqrestore(busiest, flags); + preempt_disable(); + raw_spin_rq_unlock_irqrestore(busiest, flags); if (active_balance) { stop_one_cpu_nowait(cpu_of(busiest), active_load_balance_cpu_stop, busiest, &busiest->active_balance_work); } + preempt_enable(); } } else { sd->nr_balance_failed = 0; diff -u linux-lowlatency-5.15.0/kernel/sched/rt.c linux-lowlatency-5.15.0/kernel/sched/rt.c --- linux-lowlatency-5.15.0/kernel/sched/rt.c +++ linux-lowlatency-5.15.0/kernel/sched/rt.c @@ -1951,9 +1951,11 @@ */ push_task = get_push_task(rq); if (push_task) { + preempt_disable(); raw_spin_rq_unlock(rq); stop_one_cpu_nowait(rq->cpu, push_cpu_stop, push_task, &rq->push_work); + preempt_enable(); raw_spin_rq_lock(rq); } @@ -2290,9 +2292,11 @@ double_unlock_balance(this_rq, src_rq); if (push_task) { + preempt_disable(); raw_spin_rq_unlock(this_rq); stop_one_cpu_nowait(src_rq->cpu, push_cpu_stop, push_task, &src_rq->push_work); + preempt_enable(); raw_spin_rq_lock(this_rq); } } diff -u linux-lowlatency-5.15.0/kernel/time/hrtimer.c linux-lowlatency-5.15.0/kernel/time/hrtimer.c --- linux-lowlatency-5.15.0/kernel/time/hrtimer.c +++ linux-lowlatency-5.15.0/kernel/time/hrtimer.c @@ -2216,29 +2216,22 @@ } } -int hrtimers_dead_cpu(unsigned int scpu) +int hrtimers_cpu_dying(unsigned int dying_cpu) { struct hrtimer_cpu_base *old_base, *new_base; - int i; + int i, ncpu = cpumask_first(cpu_active_mask); - BUG_ON(cpu_online(scpu)); - tick_cancel_sched_timer(scpu); + tick_cancel_sched_timer(dying_cpu); + + old_base = this_cpu_ptr(&hrtimer_bases); + new_base = &per_cpu(hrtimer_bases, ncpu); - /* - * this BH disable ensures that raise_softirq_irqoff() does - * not wakeup ksoftirqd (and acquire the pi-lock) while - * holding the cpu_base lock - */ - local_bh_disable(); - local_irq_disable(); - old_base = &per_cpu(hrtimer_bases, scpu); - new_base = this_cpu_ptr(&hrtimer_bases); /* * The caller is globally serialized and nobody else * takes two locks at once, deadlock is not possible. */ - raw_spin_lock(&new_base->lock); - raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); + raw_spin_lock(&old_base->lock); + raw_spin_lock_nested(&new_base->lock, SINGLE_DEPTH_NESTING); for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { migrate_hrtimer_list(&old_base->clock_base[i], @@ -2249,15 +2242,13 @@ * The migration might have changed the first expiring softirq * timer on this CPU. Update it. */ - hrtimer_update_softirq_timer(new_base, false); + __hrtimer_get_next_event(new_base, HRTIMER_ACTIVE_SOFT); + /* Tell the other CPU to retrigger the next event */ + smp_call_function_single(ncpu, retrigger_next_event, NULL, 0); - raw_spin_unlock(&old_base->lock); raw_spin_unlock(&new_base->lock); + raw_spin_unlock(&old_base->lock); - /* Check, if we got expired work to do */ - __hrtimer_peek_ahead_timers(); - local_irq_enable(); - local_bh_enable(); return 0; } diff -u linux-lowlatency-5.15.0/kernel/trace/ring_buffer.c linux-lowlatency-5.15.0/kernel/trace/ring_buffer.c --- linux-lowlatency-5.15.0/kernel/trace/ring_buffer.c +++ linux-lowlatency-5.15.0/kernel/trace/ring_buffer.c @@ -2982,23 +2982,20 @@ local_read(&bpage->write) & ~RB_WRITE_MASK; unsigned long event_length = rb_event_length(event); + /* + * For the before_stamp to be different than the write_stamp + * to make sure that the next event adds an absolute + * value and does not rely on the saved write stamp, which + * is now going to be bogus. + */ + rb_time_set(&cpu_buffer->before_stamp, 0); + /* Something came in, can't discard */ if (!rb_time_cmpxchg(&cpu_buffer->write_stamp, write_stamp, write_stamp - delta)) return 0; /* - * It's possible that the event time delta is zero - * (has the same time stamp as the previous event) - * in which case write_stamp and before_stamp could - * be the same. In such a case, force before_stamp - * to be different than write_stamp. It doesn't - * matter what it is, as long as its different. - */ - if (!delta) - rb_time_set(&cpu_buffer->before_stamp, 0); - - /* * If an event were to come in now, it would see that the * write_stamp and the before_stamp are different, and assume * that this event just added itself before updating @@ -3249,14 +3246,9 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) { unsigned int val = cpu_buffer->current_context; - unsigned long pc = preempt_count(); - int bit; + int bit = interrupt_context_level(); - if (!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET))) - bit = RB_CTX_NORMAL; - else - bit = pc & NMI_MASK ? RB_CTX_NMI : - pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ; + bit = RB_CTX_NORMAL - bit; if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) { /* diff -u linux-lowlatency-5.15.0/kernel/trace/trace.c linux-lowlatency-5.15.0/kernel/trace/trace.c --- linux-lowlatency-5.15.0/kernel/trace/trace.c +++ linux-lowlatency-5.15.0/kernel/trace/trace.c @@ -2284,13 +2284,7 @@ return global_trace.stop_count; } -/** - * tracing_start - quick start of the tracer - * - * If tracing is enabled but was stopped by tracing_stop, - * this will start the tracer back up. - */ -void tracing_start(void) +static void tracing_start_tr(struct trace_array *tr) { struct trace_buffer *buffer; unsigned long flags; @@ -2298,119 +2292,83 @@ if (tracing_disabled) return; - raw_spin_lock_irqsave(&global_trace.start_lock, flags); - if (--global_trace.stop_count) { - if (global_trace.stop_count < 0) { + raw_spin_lock_irqsave(&tr->start_lock, flags); + if (--tr->stop_count) { + if (WARN_ON_ONCE(tr->stop_count < 0)) { /* Someone screwed up their debugging */ - WARN_ON_ONCE(1); - global_trace.stop_count = 0; + tr->stop_count = 0; } goto out; } /* Prevent the buffers from switching */ - arch_spin_lock(&global_trace.max_lock); + arch_spin_lock(&tr->max_lock); - buffer = global_trace.array_buffer.buffer; + buffer = tr->array_buffer.buffer; if (buffer) ring_buffer_record_enable(buffer); #ifdef CONFIG_TRACER_MAX_TRACE - buffer = global_trace.max_buffer.buffer; + buffer = tr->max_buffer.buffer; if (buffer) ring_buffer_record_enable(buffer); #endif - arch_spin_unlock(&global_trace.max_lock); - - out: - raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); -} - -static void tracing_start_tr(struct trace_array *tr) -{ - struct trace_buffer *buffer; - unsigned long flags; - - if (tracing_disabled) - return; - - /* If global, we need to also start the max tracer */ - if (tr->flags & TRACE_ARRAY_FL_GLOBAL) - return tracing_start(); - - raw_spin_lock_irqsave(&tr->start_lock, flags); - - if (--tr->stop_count) { - if (tr->stop_count < 0) { - /* Someone screwed up their debugging */ - WARN_ON_ONCE(1); - tr->stop_count = 0; - } - goto out; - } - - buffer = tr->array_buffer.buffer; - if (buffer) - ring_buffer_record_enable(buffer); + arch_spin_unlock(&tr->max_lock); out: raw_spin_unlock_irqrestore(&tr->start_lock, flags); } /** - * tracing_stop - quick stop of the tracer + * tracing_start - quick start of the tracer * - * Light weight way to stop tracing. Use in conjunction with - * tracing_start. + * If tracing is enabled but was stopped by tracing_stop, + * this will start the tracer back up. */ -void tracing_stop(void) +void tracing_start(void) + +{ + return tracing_start_tr(&global_trace); +} + +static void tracing_stop_tr(struct trace_array *tr) { struct trace_buffer *buffer; unsigned long flags; - raw_spin_lock_irqsave(&global_trace.start_lock, flags); - if (global_trace.stop_count++) + raw_spin_lock_irqsave(&tr->start_lock, flags); + if (tr->stop_count++) goto out; /* Prevent the buffers from switching */ - arch_spin_lock(&global_trace.max_lock); + arch_spin_lock(&tr->max_lock); - buffer = global_trace.array_buffer.buffer; + buffer = tr->array_buffer.buffer; if (buffer) ring_buffer_record_disable(buffer); #ifdef CONFIG_TRACER_MAX_TRACE - buffer = global_trace.max_buffer.buffer; + buffer = tr->max_buffer.buffer; if (buffer) ring_buffer_record_disable(buffer); #endif - arch_spin_unlock(&global_trace.max_lock); + arch_spin_unlock(&tr->max_lock); out: - raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); + raw_spin_unlock_irqrestore(&tr->start_lock, flags); } -static void tracing_stop_tr(struct trace_array *tr) +/** + * tracing_stop - quick stop of the tracer + * + * Light weight way to stop tracing. Use in conjunction with + * tracing_start. + */ +void tracing_stop(void) { - struct trace_buffer *buffer; - unsigned long flags; - - /* If global, we need to also stop the max tracer */ - if (tr->flags & TRACE_ARRAY_FL_GLOBAL) - return tracing_stop(); - - raw_spin_lock_irqsave(&tr->start_lock, flags); - if (tr->stop_count++) - goto out; - - buffer = tr->array_buffer.buffer; - if (buffer) - ring_buffer_record_disable(buffer); - - out: - raw_spin_unlock_irqrestore(&tr->start_lock, flags); + return tracing_stop_tr(&global_trace); } static int trace_save_cmdline(struct task_struct *tsk) @@ -2692,8 +2650,11 @@ for_each_tracing_cpu(cpu) { page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_NORETRY, 0); - if (!page) - goto failed; + /* This is just an optimization and can handle failures */ + if (!page) { + pr_err("Failed to allocate event buffer\n"); + break; + } event = page_address(page); memset(event, 0, sizeof(*event)); @@ -2707,10 +2668,6 @@ WARN_ON_ONCE(1); preempt_enable(); } - - return; - failed: - trace_buffered_event_disable(); } static void enable_trace_buffered_event(void *data) @@ -2745,11 +2702,9 @@ if (--trace_buffered_event_ref) return; - preempt_disable(); /* For each CPU, set the buffer as used. */ - smp_call_function_many(tracing_buffer_mask, - disable_trace_buffered_event, NULL, 1); - preempt_enable(); + on_each_cpu_mask(tracing_buffer_mask, disable_trace_buffered_event, + NULL, true); /* Wait for all current users to finish */ synchronize_rcu(); @@ -2758,17 +2713,19 @@ free_page((unsigned long)per_cpu(trace_buffered_event, cpu)); per_cpu(trace_buffered_event, cpu) = NULL; } + /* - * Make sure trace_buffered_event is NULL before clearing - * trace_buffered_event_cnt. + * Wait for all CPUs that potentially started checking if they can use + * their event buffer only after the previous synchronize_rcu() call and + * they still read a valid pointer from trace_buffered_event. It must be + * ensured they don't see cleared trace_buffered_event_cnt else they + * could wrongly decide to use the pointed-to buffer which is now freed. */ - smp_wmb(); + synchronize_rcu(); - preempt_disable(); - /* Do the work on each cpu */ - smp_call_function_many(tracing_buffer_mask, - enable_trace_buffered_event, NULL, 1); - preempt_enable(); + /* For each CPU, relinquish the buffer */ + on_each_cpu_mask(tracing_buffer_mask, enable_trace_buffered_event, NULL, + true); } static struct trace_buffer *temp_buffer; @@ -4900,6 +4857,20 @@ if (ret) return ret; + mutex_lock(&event_mutex); + + /* Fail if the file is marked for removal */ + if (file->flags & EVENT_FILE_FL_FREED) { + trace_array_put(file->tr); + ret = -ENODEV; + } else { + event_file_get(file); + } + + mutex_unlock(&event_mutex); + if (ret) + return ret; + filp->private_data = inode->i_private; return 0; @@ -4910,6 +4881,7 @@ struct trace_event_file *file = inode->i_private; trace_array_put(file->tr); + event_file_put(file); return 0; } @@ -6218,6 +6190,15 @@ per_cpu_ptr(buf->data, cpu)->entries = val; } +static void update_buffer_entries(struct array_buffer *buf, int cpu) +{ + if (cpu == RING_BUFFER_ALL_CPUS) { + set_buffer_entries(buf, ring_buffer_size(buf->buffer, 0)); + } else { + per_cpu_ptr(buf->data, cpu)->entries = ring_buffer_size(buf->buffer, cpu); + } +} + #ifdef CONFIG_TRACER_MAX_TRACE /* resize @tr's buffer to the size of @size_tr's entries */ static int resize_buffer_duplicate_size(struct array_buffer *trace_buf, @@ -6262,13 +6243,15 @@ if (!tr->array_buffer.buffer) return 0; + /* Do not allow tracing while resizng ring buffer */ + tracing_stop_tr(tr); + ret = ring_buffer_resize(tr->array_buffer.buffer, size, cpu); if (ret < 0) - return ret; + goto out_start; #ifdef CONFIG_TRACER_MAX_TRACE - if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL) || - !tr->current_trace->use_max_tr) + if (!tr->current_trace->use_max_tr) goto out; ret = ring_buffer_resize(tr->max_buffer.buffer, size, cpu); @@ -6293,22 +6276,17 @@ WARN_ON(1); tracing_disabled = 1; } - return ret; + goto out_start; } - if (cpu == RING_BUFFER_ALL_CPUS) - set_buffer_entries(&tr->max_buffer, size); - else - per_cpu_ptr(tr->max_buffer.data, cpu)->entries = size; + update_buffer_entries(&tr->max_buffer, cpu); out: #endif /* CONFIG_TRACER_MAX_TRACE */ - if (cpu == RING_BUFFER_ALL_CPUS) - set_buffer_entries(&tr->array_buffer, size); - else - per_cpu_ptr(tr->array_buffer.data, cpu)->entries = size; - + update_buffer_entries(&tr->array_buffer, cpu); + out_start: + tracing_start_tr(tr); return ret; } diff -u linux-lowlatency-5.15.0/kernel/trace/trace.h linux-lowlatency-5.15.0/kernel/trace/trace.h --- linux-lowlatency-5.15.0/kernel/trace/trace.h +++ linux-lowlatency-5.15.0/kernel/trace/trace.h @@ -1620,6 +1620,9 @@ extern int unregister_event_command(struct event_command *cmd); extern int register_trigger_hist_enable_disable_cmds(void); +extern void event_file_get(struct trace_event_file *file); +extern void event_file_put(struct trace_event_file *file); + /** * struct event_trigger_ops - callbacks for trace event triggers * diff -u linux-lowlatency-5.15.0/kernel/trace/trace_events.c linux-lowlatency-5.15.0/kernel/trace/trace_events.c --- linux-lowlatency-5.15.0/kernel/trace/trace_events.c +++ linux-lowlatency-5.15.0/kernel/trace/trace_events.c @@ -969,26 +969,38 @@ } } -static void remove_event_file_dir(struct trace_event_file *file) +void event_file_get(struct trace_event_file *file) { - struct dentry *dir = file->dir; - struct dentry *child; + atomic_inc(&file->ref); +} - if (dir) { - spin_lock(&dir->d_lock); /* probably unneeded */ - list_for_each_entry(child, &dir->d_subdirs, d_child) { - if (d_really_is_positive(child)) /* probably unneeded */ - d_inode(child)->i_private = NULL; - } - spin_unlock(&dir->d_lock); +void event_file_put(struct trace_event_file *file) +{ + if (WARN_ON_ONCE(!atomic_read(&file->ref))) { + if (file->flags & EVENT_FILE_FL_FREED) + kmem_cache_free(file_cachep, file); + return; + } - tracefs_remove(dir); + if (atomic_dec_and_test(&file->ref)) { + /* Count should only go to zero when it is freed */ + if (WARN_ON_ONCE(!(file->flags & EVENT_FILE_FL_FREED))) + return; + kmem_cache_free(file_cachep, file); } +} + +static void remove_event_file_dir(struct trace_event_file *file) +{ + struct dentry *dir = file->dir; + + tracefs_remove(dir); list_del(&file->list); remove_subsystem(file->system); free_event_filter(file->filter); - kmem_cache_free(file_cachep, file); + file->flags |= EVENT_FILE_FL_FREED; + event_file_put(file); } /* @@ -1361,7 +1373,7 @@ flags = file->flags; mutex_unlock(&event_mutex); - if (!file) + if (!file || flags & EVENT_FILE_FL_FREED) return -ENODEV; if (flags & EVENT_FILE_FL_ENABLED && @@ -1399,7 +1411,7 @@ ret = -ENODEV; mutex_lock(&event_mutex); file = event_file_data(filp); - if (likely(file)) + if (likely(file && !(file->flags & EVENT_FILE_FL_FREED))) ret = ftrace_event_enable_disable(file, val); mutex_unlock(&event_mutex); break; @@ -1668,7 +1680,7 @@ mutex_lock(&event_mutex); file = event_file_data(filp); - if (file) + if (file && !(file->flags & EVENT_FILE_FL_FREED)) print_event_filter(file, s); mutex_unlock(&event_mutex); @@ -2753,6 +2765,7 @@ update_event_fields(call, map[i]); } } + cond_resched(); } up_write(&trace_event_sem); } @@ -2783,6 +2796,7 @@ atomic_set(&file->tm_ref, 0); INIT_LIST_HEAD(&file->triggers); list_add(&file->list, &tr->events); + event_file_get(file); return file; } diff -u linux-lowlatency-5.15.0/kernel/trace/trace_events_filter.c linux-lowlatency-5.15.0/kernel/trace/trace_events_filter.c --- linux-lowlatency-5.15.0/kernel/trace/trace_events_filter.c +++ linux-lowlatency-5.15.0/kernel/trace/trace_events_filter.c @@ -1872,6 +1872,9 @@ struct event_filter *filter = NULL; int err; + if (file->flags & EVENT_FILE_FL_FREED) + return -ENODEV; + if (!strcmp(strstrip(filter_string), "0")) { filter_disable(file); filter = event_filter(file); diff -u linux-lowlatency-5.15.0/kernel/trace/trace_events_synth.c linux-lowlatency-5.15.0/kernel/trace/trace_events_synth.c --- linux-lowlatency-5.15.0/kernel/trace/trace_events_synth.c +++ linux-lowlatency-5.15.0/kernel/trace/trace_events_synth.c @@ -454,7 +454,7 @@ #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if ((unsigned long)str_val < TASK_SIZE) - ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX); + ret = strncpy_from_user_nofault(str_field, (const void __user *)str_val, STR_VAR_LEN_MAX); else #endif ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX); diff -u linux-lowlatency-5.15.0/kernel/trace/trace_kprobe.c linux-lowlatency-5.15.0/kernel/trace/trace_kprobe.c --- linux-lowlatency-5.15.0/kernel/trace/trace_kprobe.c +++ linux-lowlatency-5.15.0/kernel/trace/trace_kprobe.c @@ -942,10 +942,10 @@ /** * __kprobe_event_gen_cmd_start - Generate a kprobe event command from arg list * @cmd: A pointer to the dynevent_cmd struct representing the new event + * @kretprobe: Is this a return probe? * @name: The name of the kprobe event * @loc: The location of the kprobe event - * @kretprobe: Is this a return probe? - * @args: Variable number of arg (pairs), one pair for each field + * @...: Variable number of arg (pairs), one pair for each field * * NOTE: Users normally won't want to call this function directly, but * rather use the kprobe_event_gen_cmd_start() wrapper, which automatically @@ -1018,7 +1018,7 @@ /** * __kprobe_event_add_fields - Add probe fields to a kprobe command from arg list * @cmd: A pointer to the dynevent_cmd struct representing the new event - * @args: Variable number of arg (pairs), one pair for each field + * @...: Variable number of arg (pairs), one pair for each field * * NOTE: Users normally won't want to call this function directly, but * rather use the kprobe_event_add_fields() wrapper, which diff -u linux-lowlatency-5.15.0/kernel/watch_queue.c linux-lowlatency-5.15.0/kernel/watch_queue.c --- linux-lowlatency-5.15.0/kernel/watch_queue.c +++ linux-lowlatency-5.15.0/kernel/watch_queue.c @@ -338,7 +338,7 @@ filter.__reserved != 0) return -EINVAL; - tf = memdup_user(_filter->filters, filter.nr_filters * sizeof(*tf)); + tf = memdup_array_user(_filter->filters, filter.nr_filters, sizeof(*tf)); if (IS_ERR(tf)) return PTR_ERR(tf); diff -u linux-lowlatency-5.15.0/kernel/watchdog.c linux-lowlatency-5.15.0/kernel/watchdog.c --- linux-lowlatency-5.15.0/kernel/watchdog.c +++ linux-lowlatency-5.15.0/kernel/watchdog.c @@ -183,6 +183,13 @@ static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); static unsigned long soft_lockup_nmi_warn; +static int __init softlockup_panic_setup(char *str) +{ + softlockup_panic = simple_strtoul(str, NULL, 0); + return 1; +} +__setup("softlockup_panic=", softlockup_panic_setup); + static int __init nowatchdog_setup(char *str) { watchdog_user_enabled = 0; diff -u linux-lowlatency-5.15.0/kernel/workqueue.c linux-lowlatency-5.15.0/kernel/workqueue.c --- linux-lowlatency-5.15.0/kernel/workqueue.c +++ linux-lowlatency-5.15.0/kernel/workqueue.c @@ -3277,6 +3277,15 @@ return ret; } +/* + * See cancel_delayed_work() + */ +bool cancel_work(struct work_struct *work) +{ + return __cancel_work(work, false); +} +EXPORT_SYMBOL(cancel_work); + /** * cancel_delayed_work - cancel a delayed work * @dwork: delayed_work to cancel @@ -5209,50 +5218,54 @@ } /** - * work_on_cpu - run a function in thread context on a particular cpu + * work_on_cpu_key - run a function in thread context on a particular cpu * @cpu: the cpu to run on * @fn: the function to run * @arg: the function arg + * @key: The lock class key for lock debugging purposes * * It is up to the caller to ensure that the cpu doesn't go offline. * The caller must not hold any locks which would prevent @fn from completing. * * Return: The value @fn returns. */ -long work_on_cpu(int cpu, long (*fn)(void *), void *arg) +long work_on_cpu_key(int cpu, long (*fn)(void *), + void *arg, struct lock_class_key *key) { struct work_for_cpu wfc = { .fn = fn, .arg = arg }; - INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); + INIT_WORK_ONSTACK_KEY(&wfc.work, work_for_cpu_fn, key); schedule_work_on(cpu, &wfc.work); flush_work(&wfc.work); destroy_work_on_stack(&wfc.work); return wfc.ret; } -EXPORT_SYMBOL_GPL(work_on_cpu); +EXPORT_SYMBOL_GPL(work_on_cpu_key); /** - * work_on_cpu_safe - run a function in thread context on a particular cpu + * work_on_cpu_safe_key - run a function in thread context on a particular cpu * @cpu: the cpu to run on * @fn: the function to run * @arg: the function argument + * @key: The lock class key for lock debugging purposes * * Disables CPU hotplug and calls work_on_cpu(). The caller must not hold * any locks which would prevent @fn from completing. * * Return: The value @fn returns. */ -long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg) +long work_on_cpu_safe_key(int cpu, long (*fn)(void *), + void *arg, struct lock_class_key *key) { long ret = -ENODEV; cpus_read_lock(); if (cpu_online(cpu)) - ret = work_on_cpu(cpu, fn, arg); + ret = work_on_cpu_key(cpu, fn, arg, key); cpus_read_unlock(); return ret; } -EXPORT_SYMBOL_GPL(work_on_cpu_safe); +EXPORT_SYMBOL_GPL(work_on_cpu_safe_key); #endif /* CONFIG_SMP */ #ifdef CONFIG_FREEZER diff -u linux-lowlatency-5.15.0/lib/Kconfig.debug linux-lowlatency-5.15.0/lib/Kconfig.debug --- linux-lowlatency-5.15.0/lib/Kconfig.debug +++ linux-lowlatency-5.15.0/lib/Kconfig.debug @@ -1226,13 +1226,16 @@ config DEBUG_PREEMPT bool "Debug preemptible kernel" depends on DEBUG_KERNEL && PREEMPTION && TRACE_IRQFLAGS_SUPPORT - default y help If you say Y here then the kernel will use a debug variant of the commonly used smp_processor_id() function and will print warnings if kernel code uses it in a preemption-unsafe way. Also, the kernel will detect preemption count underflows. + This option has potential to introduce high runtime overhead, + depending on workload as it triggers debugging routines for each + this_cpu operation. It should only be used for debugging purposes. + menu "Lock Debugging (spinlocks, mutexes, etc...)" config LOCK_DEBUGGING_SUPPORT diff -u linux-lowlatency-5.15.0/lib/errname.c linux-lowlatency-5.15.0/lib/errname.c --- linux-lowlatency-5.15.0/lib/errname.c +++ linux-lowlatency-5.15.0/lib/errname.c @@ -111,9 +111,6 @@ E(ENOSPC), E(ENOSR), E(ENOSTR), -#ifdef ENOSYM - E(ENOSYM), -#endif E(ENOSYS), E(ENOTBLK), E(ENOTCONN), @@ -144,9 +141,6 @@ #endif E(EREMOTE), E(EREMOTEIO), -#ifdef EREMOTERELEASE - E(EREMOTERELEASE), -#endif E(ERESTART), E(ERFKILL), E(EROFS), diff -u linux-lowlatency-5.15.0/mm/cma.c linux-lowlatency-5.15.0/mm/cma.c --- linux-lowlatency-5.15.0/mm/cma.c +++ linux-lowlatency-5.15.0/mm/cma.c @@ -503,7 +503,7 @@ */ if (page) { for (i = 0; i < count; i++) - page_kasan_tag_reset(page + i); + page_kasan_tag_reset(nth_page(page, i)); } if (ret && !no_warn) { diff -u linux-lowlatency-5.15.0/mm/filemap.c linux-lowlatency-5.15.0/mm/filemap.c --- linux-lowlatency-5.15.0/mm/filemap.c +++ linux-lowlatency-5.15.0/mm/filemap.c @@ -3209,7 +3209,7 @@ } } - if (pmd_none(*vmf->pmd)) { + if (pmd_none(*vmf->pmd) && vmf->prealloc_pte) { vmf->ptl = pmd_lock(mm, vmf->pmd); if (likely(pmd_none(*vmf->pmd))) { mm_inc_nr_ptes(mm); diff -u linux-lowlatency-5.15.0/mm/kasan/report.c linux-lowlatency-5.15.0/mm/kasan/report.c --- linux-lowlatency-5.15.0/mm/kasan/report.c +++ linux-lowlatency-5.15.0/mm/kasan/report.c @@ -457,9 +457,8 @@ return ret; } -#ifdef CONFIG_KASAN_INLINE /* - * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high + * With CONFIG_KASAN, accesses to bogus pointers (outside the high * canonical half of the address space) cause out-of-bounds shadow memory reads * before the actual access. For addresses in the low canonical half of the * address space, as well as most non-canonical addresses, that out-of-bounds @@ -498 +496,0 @@ -#endif diff -u linux-lowlatency-5.15.0/mm/memcontrol.c linux-lowlatency-5.15.0/mm/memcontrol.c --- linux-lowlatency-5.15.0/mm/memcontrol.c +++ linux-lowlatency-5.15.0/mm/memcontrol.c @@ -2822,7 +2822,8 @@ * Moreover, it should not come from DMA buffer and is not readily * reclaimable. So those GFP bits should be masked off. */ -#define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT) +#define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | \ + __GFP_ACCOUNT | __GFP_NOFAIL) int memcg_alloc_page_obj_cgroups(struct page *page, struct kmem_cache *s, gfp_t gfp, bool new_page) diff -u linux-lowlatency-5.15.0/mm/memory_hotplug.c linux-lowlatency-5.15.0/mm/memory_hotplug.c --- linux-lowlatency-5.15.0/mm/memory_hotplug.c +++ linux-lowlatency-5.15.0/mm/memory_hotplug.c @@ -1677,7 +1677,7 @@ */ if (HPageMigratable(head)) goto found; - skip = compound_nr(head) - (page - head); + skip = compound_nr(head) - (pfn - page_to_pfn(head)); pfn += skip - 1; } return -ENOENT; diff -u linux-lowlatency-5.15.0/mm/migrate.c linux-lowlatency-5.15.0/mm/migrate.c --- linux-lowlatency-5.15.0/mm/migrate.c +++ linux-lowlatency-5.15.0/mm/migrate.c @@ -1788,6 +1788,7 @@ const int __user *nodes, int __user *status, int flags) { + compat_uptr_t __user *compat_pages = (void __user *)pages; int current_node = NUMA_NO_NODE; LIST_HEAD(pagelist); int start, i; @@ -1801,8 +1802,17 @@ int node; err = -EFAULT; - if (get_user(p, pages + i)) - goto out_flush; + if (in_compat_syscall()) { + compat_uptr_t cp; + + if (get_user(cp, compat_pages + i)) + goto out_flush; + + p = compat_ptr(cp); + } else { + if (get_user(p, pages + i)) + goto out_flush; + } if (get_user(node, nodes + i)) goto out_flush; addr = (unsigned long)untagged_addr(p); diff -u linux-lowlatency-5.15.0/mm/page_alloc.c linux-lowlatency-5.15.0/mm/page_alloc.c --- linux-lowlatency-5.15.0/mm/page_alloc.c +++ linux-lowlatency-5.15.0/mm/page_alloc.c @@ -9481,6 +9481,7 @@ next_page = page; current_buddy = page + size; } + page = next_page; if (set_page_guard(zone, current_buddy, high, migratetype)) continue; @@ -9488,7 +9489,6 @@ if (current_buddy != target) { add_to_free_list(current_buddy, zone, high, migratetype); set_buddy_order(current_buddy, high); - page = next_page; } } } diff -u linux-lowlatency-5.15.0/net/8021q/vlan_dev.c linux-lowlatency-5.15.0/net/8021q/vlan_dev.c --- linux-lowlatency-5.15.0/net/8021q/vlan_dev.c +++ linux-lowlatency-5.15.0/net/8021q/vlan_dev.c @@ -622,7 +622,7 @@ } /* Note: this function might be called multiple times for the same device. */ -void vlan_dev_uninit(struct net_device *dev) +void vlan_dev_free_egress_priority(const struct net_device *dev) { struct vlan_priority_tci_mapping *pm; struct vlan_dev_priv *vlan = vlan_dev_priv(dev); @@ -636,6 +636,16 @@ } } +static void vlan_dev_uninit(struct net_device *dev) +{ + struct vlan_dev_priv *vlan = vlan_dev_priv(dev); + + vlan_dev_free_egress_priority(dev); + + /* Get rid of the vlan's reference to real_dev */ + dev_put(vlan->real_dev); +} + static netdev_features_t vlan_dev_fix_features(struct net_device *dev, netdev_features_t features) { @@ -846,9 +856,6 @@ free_percpu(vlan->vlan_pcpu_stats); vlan->vlan_pcpu_stats = NULL; - - /* Get rid of the vlan's reference to real_dev */ - dev_put(vlan->real_dev); } void vlan_setup(struct net_device *dev) diff -u linux-lowlatency-5.15.0/net/9p/client.c linux-lowlatency-5.15.0/net/9p/client.c --- linux-lowlatency-5.15.0/net/9p/client.c +++ linux-lowlatency-5.15.0/net/9p/client.c @@ -520,12 +520,14 @@ return 0; if (!p9_is_proto_dotl(c)) { - char *ename; + char *ename = NULL; err = p9pdu_readf(&req->rc, c->proto_version, "s?d", &ename, &ecode); - if (err) + if (err) { + kfree(ename); goto out_err; + } if (p9_is_proto_dotu(c) && ecode < 512) err = -ecode; @@ -2018,7 +2020,7 @@ goto error; } p9_debug(P9_DEBUG_9P, - ">>> TXATTRWALK file_fid %d, attr_fid %d name %s\n", + ">>> TXATTRWALK file_fid %d, attr_fid %d name '%s'\n", file_fid->fid, attr_fid->fid, attr_name); req = p9_client_rpc(clnt, P9_TXATTRWALK, "dds", diff -u linux-lowlatency-5.15.0/net/9p/trans_fd.c linux-lowlatency-5.15.0/net/9p/trans_fd.c --- linux-lowlatency-5.15.0/net/9p/trans_fd.c +++ linux-lowlatency-5.15.0/net/9p/trans_fd.c @@ -835,14 +835,21 @@ goto out_free_ts; if (!(ts->rd->f_mode & FMODE_READ)) goto out_put_rd; - /* prevent workers from hanging on IO when fd is a pipe */ - ts->rd->f_flags |= O_NONBLOCK; + /* Prevent workers from hanging on IO when fd is a pipe. + * It's technically possible for userspace or concurrent mounts to + * modify this flag concurrently, which will likely result in a + * broken filesystem. However, just having bad flags here should + * not crash the kernel or cause any other sort of bug, so mark this + * particular data race as intentional so that tooling (like KCSAN) + * can allow it and detect further problems. + */ + data_race(ts->rd->f_flags |= O_NONBLOCK); ts->wr = fget(wfd); if (!ts->wr) goto out_put_rd; if (!(ts->wr->f_mode & FMODE_WRITE)) goto out_put_wr; - ts->wr->f_flags |= O_NONBLOCK; + data_race(ts->wr->f_flags |= O_NONBLOCK); client->trans = ts; client->status = Connected; diff -u linux-lowlatency-5.15.0/net/bluetooth/af_bluetooth.c linux-lowlatency-5.15.0/net/bluetooth/af_bluetooth.c --- linux-lowlatency-5.15.0/net/bluetooth/af_bluetooth.c +++ linux-lowlatency-5.15.0/net/bluetooth/af_bluetooth.c @@ -263,11 +263,14 @@ if (flags & MSG_OOB) return -EOPNOTSUPP; + lock_sock(sk); + skb = skb_recv_datagram(sk, flags, noblock, &err); if (!skb) { if (sk->sk_shutdown & RCV_SHUTDOWN) - return 0; + err = 0; + release_sock(sk); return err; } @@ -293,6 +296,8 @@ skb_free_datagram(sk, skb); + release_sock(sk); + if (flags & MSG_TRUNC) copied = skblen; diff -u linux-lowlatency-5.15.0/net/bluetooth/hci_conn.c linux-lowlatency-5.15.0/net/bluetooth/hci_conn.c --- linux-lowlatency-5.15.0/net/bluetooth/hci_conn.c +++ linux-lowlatency-5.15.0/net/bluetooth/hci_conn.c @@ -135,13 +135,11 @@ hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); } - hci_conn_del_sysfs(conn); - debugfs_remove_recursive(conn->debugfs); - hci_dev_put(hdev); + hci_conn_del_sysfs(conn); - hci_conn_put(conn); + hci_dev_put(hdev); } static void le_scan_cleanup(struct work_struct *work) @@ -1300,6 +1298,15 @@ return ERR_PTR(-EOPNOTSUPP); } + /* Reject outgoing connection to device with same BD ADDR against + * CVE-2020-26555 + */ + if (!bacmp(&hdev->bdaddr, dst)) { + bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n", + dst); + return ERR_PTR(-ECONNREFUSED); + } + acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); if (!acl) { acl = hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER); @@ -1477,34 +1484,41 @@ if (!test_bit(HCI_CONN_AUTH, &conn->flags)) goto auth; - /* An authenticated FIPS approved combination key has sufficient - * security for security level 4. */ - if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256 && - sec_level == BT_SECURITY_FIPS) - goto encrypt; - - /* An authenticated combination key has sufficient security for - security level 3. */ - if ((conn->key_type == HCI_LK_AUTH_COMBINATION_P192 || - conn->key_type == HCI_LK_AUTH_COMBINATION_P256) && - sec_level == BT_SECURITY_HIGH) - goto encrypt; - - /* An unauthenticated combination key has sufficient security for - security level 1 and 2. */ - if ((conn->key_type == HCI_LK_UNAUTH_COMBINATION_P192 || - conn->key_type == HCI_LK_UNAUTH_COMBINATION_P256) && - (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW)) - goto encrypt; - - /* A combination key has always sufficient security for the security - levels 1 or 2. High security level requires the combination key - is generated using maximum PIN code length (16). - For pre 2.1 units. */ - if (conn->key_type == HCI_LK_COMBINATION && - (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW || - conn->pin_length == 16)) - goto encrypt; + switch (conn->key_type) { + case HCI_LK_AUTH_COMBINATION_P256: + /* An authenticated FIPS approved combination key has + * sufficient security for security level 4 or lower. + */ + if (sec_level <= BT_SECURITY_FIPS) + goto encrypt; + break; + case HCI_LK_AUTH_COMBINATION_P192: + /* An authenticated combination key has sufficient security for + * security level 3 or lower. + */ + if (sec_level <= BT_SECURITY_HIGH) + goto encrypt; + break; + case HCI_LK_UNAUTH_COMBINATION_P192: + case HCI_LK_UNAUTH_COMBINATION_P256: + /* An unauthenticated combination key has sufficient security + * for security level 2 or lower. + */ + if (sec_level <= BT_SECURITY_MEDIUM) + goto encrypt; + break; + case HCI_LK_COMBINATION: + /* A combination key has always sufficient security for the + * security levels 2 or lower. High security level requires the + * combination key is generated using maximum PIN code length + * (16). For pre 2.1 units. + */ + if (sec_level <= BT_SECURITY_MEDIUM || conn->pin_length == 16) + goto encrypt; + break; + default: + break; + } auth: if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) diff -u linux-lowlatency-5.15.0/net/bluetooth/hci_core.c linux-lowlatency-5.15.0/net/bluetooth/hci_core.c --- linux-lowlatency-5.15.0/net/bluetooth/hci_core.c +++ linux-lowlatency-5.15.0/net/bluetooth/hci_core.c @@ -3920,7 +3920,11 @@ if (id < 0) return id; - snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); + error = dev_set_name(&hdev->dev, "hci%u", id); + if (error) + return error; + + hdev->name = dev_name(&hdev->dev); hdev->id = id; BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); @@ -3942,8 +3946,6 @@ if (!IS_ERR_OR_NULL(bt_debugfs)) hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); - dev_set_name(&hdev->dev, "%s", hdev->name); - error = device_add(&hdev->dev); if (error < 0) goto err_wqueue; diff -u linux-lowlatency-5.15.0/net/bluetooth/hci_event.c linux-lowlatency-5.15.0/net/bluetooth/hci_event.c --- linux-lowlatency-5.15.0/net/bluetooth/hci_event.c +++ linux-lowlatency-5.15.0/net/bluetooth/hci_event.c @@ -25,6 +25,8 @@ /* Bluetooth HCI event handling. */ #include +#include +#include #include #include @@ -2794,6 +2796,16 @@ BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, ev->link_type); + /* Reject incoming connection from device with same BD ADDR against + * CVE-2020-26555 + */ + if (hdev && !bacmp(&hdev->bdaddr, &ev->bdaddr)) { + bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n", + &ev->bdaddr); + hci_reject_conn(hdev, &ev->bdaddr); + return; + } + mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, &flags); @@ -4173,6 +4185,15 @@ if (!conn) goto unlock; + /* Ignore NULL link key against CVE-2020-26555 */ + if (!crypto_memneq(ev->link_key, ZERO_KEY, HCI_LINK_KEY_SIZE)) { + bt_dev_dbg(hdev, "Ignore NULL link key (ZERO KEY) for %pMR", + &ev->bdaddr); + hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); + hci_conn_drop(conn); + goto unlock; + } + hci_conn_hold(conn); conn->disc_timeout = HCI_DISCONN_TIMEOUT; hci_conn_drop(conn); @@ -4677,8 +4698,8 @@ * available, then do not declare that OOB data is * present. */ - if (!memcmp(data->rand256, ZERO_KEY, 16) || - !memcmp(data->hash256, ZERO_KEY, 16)) + if (!crypto_memneq(data->rand256, ZERO_KEY, 16) || + !crypto_memneq(data->hash256, ZERO_KEY, 16)) return 0x00; return 0x02; @@ -4688,8 +4709,8 @@ * not supported by the hardware, then check that if * P-192 data values are present. */ - if (!memcmp(data->rand192, ZERO_KEY, 16) || - !memcmp(data->hash192, ZERO_KEY, 16)) + if (!crypto_memneq(data->rand192, ZERO_KEY, 16) || + !crypto_memneq(data->hash192, ZERO_KEY, 16)) return 0x00; return 0x01; @@ -4705,7 +4726,7 @@ hci_dev_lock(hdev); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); - if (!conn) + if (!conn || !hci_conn_ssp_enabled(conn)) goto unlock; hci_conn_hold(conn); @@ -4950,7 +4971,7 @@ hci_dev_lock(hdev); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); - if (!conn) + if (!conn || !hci_conn_ssp_enabled(conn)) goto unlock; /* Reset the authentication requirement to unknown */ diff -u linux-lowlatency-5.15.0/net/bluetooth/hci_sock.c linux-lowlatency-5.15.0/net/bluetooth/hci_sock.c --- linux-lowlatency-5.15.0/net/bluetooth/hci_sock.c +++ linux-lowlatency-5.15.0/net/bluetooth/hci_sock.c @@ -438,7 +438,8 @@ ni->type = hdev->dev_type; ni->bus = hdev->bus; bacpy(&ni->bdaddr, &hdev->bdaddr); - memcpy(ni->name, hdev->name, 8); + memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name, + strnlen(hdev->name, sizeof(ni->name)), '\0'); opcode = cpu_to_le16(HCI_MON_NEW_INDEX); break; diff -u linux-lowlatency-5.15.0/net/bluetooth/hci_sysfs.c linux-lowlatency-5.15.0/net/bluetooth/hci_sysfs.c --- linux-lowlatency-5.15.0/net/bluetooth/hci_sysfs.c +++ linux-lowlatency-5.15.0/net/bluetooth/hci_sysfs.c @@ -33,7 +33,7 @@ { struct hci_dev *hdev = conn->hdev; - BT_DBG("conn %p", conn); + bt_dev_dbg(hdev, "conn %p", conn); conn->dev.type = &bt_link; conn->dev.class = bt_class; @@ -46,27 +46,30 @@ { struct hci_dev *hdev = conn->hdev; - BT_DBG("conn %p", conn); + bt_dev_dbg(hdev, "conn %p", conn); if (device_is_registered(&conn->dev)) return; dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); - if (device_add(&conn->dev) < 0) { + if (device_add(&conn->dev) < 0) bt_dev_err(hdev, "failed to register connection device"); - return; - } - - hci_dev_hold(hdev); } void hci_conn_del_sysfs(struct hci_conn *conn) { struct hci_dev *hdev = conn->hdev; - if (!device_is_registered(&conn->dev)) + bt_dev_dbg(hdev, "conn %p", conn); + + if (!device_is_registered(&conn->dev)) { + /* If device_add() has *not* succeeded, use *only* put_device() + * to drop the reference count. + */ + put_device(&conn->dev); return; + } while (1) { struct device *dev; @@ -78,9 +81,7 @@ put_device(dev); } - device_del(&conn->dev); - - hci_dev_put(hdev); + device_unregister(&conn->dev); } static void bt_host_release(struct device *dev) diff -u linux-lowlatency-5.15.0/net/bluetooth/l2cap_core.c linux-lowlatency-5.15.0/net/bluetooth/l2cap_core.c --- linux-lowlatency-5.15.0/net/bluetooth/l2cap_core.c +++ linux-lowlatency-5.15.0/net/bluetooth/l2cap_core.c @@ -6493,6 +6493,14 @@ kfree_skb(skb); } +static inline void l2cap_sig_send_rej(struct l2cap_conn *conn, u16 ident) +{ + struct l2cap_cmd_rej_unk rej; + + rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); + l2cap_send_cmd(conn, ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); +} + static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb) { @@ -6518,23 +6526,24 @@ if (len > skb->len || !cmd->ident) { BT_DBG("corrupted command"); + l2cap_sig_send_rej(conn, cmd->ident); break; } err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data); if (err) { - struct l2cap_cmd_rej_unk rej; - BT_ERR("Wrong link type (%d)", err); - - rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); - l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ, - sizeof(rej), &rej); + l2cap_sig_send_rej(conn, cmd->ident); } skb_pull(skb, len); } + if (skb->len > 0) { + BT_DBG("corrupted command"); + l2cap_sig_send_rej(conn, 0); + } + drop: kfree_skb(skb); } diff -u linux-lowlatency-5.15.0/net/can/isotp.c linux-lowlatency-5.15.0/net/can/isotp.c --- linux-lowlatency-5.15.0/net/can/isotp.c +++ linux-lowlatency-5.15.0/net/can/isotp.c @@ -14,7 +14,6 @@ * - use CAN_ISOTP_WAIT_TX_DONE flag to block the caller until the PDU is sent * - as we have static buffers the check whether the PDU fits into the buffer * is done at FF reception time (no support for sending 'wait frames') - * - take care of the tx-queue-len as traffic shaping is still on the TODO list * * Copyright (c) 2020 Volkswagen Group Electronic Research * All rights reserved. @@ -87,9 +86,9 @@ /* ISO 15765-2:2016 supports more than 4095 byte per ISO PDU as the FF_DL can * take full 32 bit values (4 Gbyte). We would need some good concept to handle * this between user space and kernel space. For now increase the static buffer - * to something about 8 kbyte to be able to test this new functionality. + * to something about 64 kbyte to be able to test this new functionality. */ -#define MAX_MSG_LENGTH 8200 +#define MAX_MSG_LENGTH 66000 /* N_PCI type values in bits 7-4 of N_PCI bytes */ #define N_PCI_SF 0x00 /* single frame */ @@ -105,18 +104,23 @@ #define FC_CONTENT_SZ 3 /* flow control content size in byte (FS/BS/STmin) */ #define ISOTP_CHECK_PADDING (CAN_ISOTP_CHK_PAD_LEN | CAN_ISOTP_CHK_PAD_DATA) +#define ISOTP_ALL_BC_FLAGS (CAN_ISOTP_SF_BROADCAST | CAN_ISOTP_CF_BROADCAST) /* Flow Status given in FC frame */ #define ISOTP_FC_CTS 0 /* clear to send */ #define ISOTP_FC_WT 1 /* wait */ #define ISOTP_FC_OVFLW 2 /* overflow */ +#define ISOTP_FC_TIMEOUT 1 /* 1 sec */ +#define ISOTP_ECHO_TIMEOUT 2 /* 2 secs */ + enum { ISOTP_IDLE = 0, ISOTP_WAIT_FIRST_FC, ISOTP_WAIT_FC, ISOTP_WAIT_DATA, - ISOTP_SENDING + ISOTP_SENDING, + ISOTP_SHUTDOWN, }; struct tpcon { @@ -137,13 +141,14 @@ canid_t rxid; ktime_t tx_gap; ktime_t lastrxcf_tstamp; - struct hrtimer rxtimer, txtimer; + struct hrtimer rxtimer, txtimer, txfrtimer; struct can_isotp_options opt; struct can_isotp_fc_options rxfc, txfc; struct can_isotp_ll_options ll; u32 frame_txtime; u32 force_tx_stmin; u32 force_rx_stmin; + u32 cfecho; /* consecutive frame echo tag */ struct tpcon rx, tx; struct list_head notifier; wait_queue_head_t wait; @@ -159,6 +164,17 @@ return (struct isotp_sock *)sk; } +static u32 isotp_bc_flags(struct isotp_sock *so) +{ + return so->opt.flags & ISOTP_ALL_BC_FLAGS; +} + +static bool isotp_register_rxid(struct isotp_sock *so) +{ + /* no broadcast modes => register rx_id for FC frame reception */ + return (isotp_bc_flags(so) == 0); +} + static enum hrtimer_restart isotp_rx_timer_handler(struct hrtimer *hrtimer) { struct isotp_sock *so = container_of(hrtimer, struct isotp_sock, @@ -240,7 +256,8 @@ so->lastrxcf_tstamp = ktime_set(0, 0); /* start rx timeout watchdog */ - hrtimer_start(&so->rxtimer, ktime_set(1, 0), HRTIMER_MODE_REL_SOFT); + hrtimer_start(&so->rxtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), + HRTIMER_MODE_REL_SOFT); return 0; } @@ -326,6 +343,8 @@ return 0; } +static void isotp_send_cframe(struct isotp_sock *so); + static int isotp_rcv_fc(struct isotp_sock *so, struct canfd_frame *cf, int ae) { struct sock *sk = &so->sk; @@ -380,14 +399,15 @@ case ISOTP_FC_CTS: so->tx.bs = 0; so->tx.state = ISOTP_SENDING; - /* start cyclic timer for sending CF frame */ - hrtimer_start(&so->txtimer, so->tx_gap, + /* send CF frame and enable echo timeout handling */ + hrtimer_start(&so->txtimer, ktime_set(ISOTP_ECHO_TIMEOUT, 0), HRTIMER_MODE_REL_SOFT); + isotp_send_cframe(so); break; case ISOTP_FC_WT: /* start timer to wait for next FC frame */ - hrtimer_start(&so->txtimer, ktime_set(1, 0), + hrtimer_start(&so->txtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), HRTIMER_MODE_REL_SOFT); break; @@ -582,7 +602,7 @@ /* perform blocksize handling, if enabled */ if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) { /* start rx timeout watchdog */ - hrtimer_start(&so->rxtimer, ktime_set(1, 0), + hrtimer_start(&so->rxtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), HRTIMER_MODE_REL_SOFT); return 0; } @@ -713,6 +733,63 @@ cf->data[0] = so->opt.ext_address; } +static void isotp_send_cframe(struct isotp_sock *so) +{ + struct sock *sk = &so->sk; + struct sk_buff *skb; + struct net_device *dev; + struct canfd_frame *cf; + int can_send_ret; + int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0; + + dev = dev_get_by_index(sock_net(sk), so->ifindex); + if (!dev) + return; + + skb = alloc_skb(so->ll.mtu + sizeof(struct can_skb_priv), GFP_ATOMIC); + if (!skb) { + dev_put(dev); + return; + } + + can_skb_reserve(skb); + can_skb_prv(skb)->ifindex = dev->ifindex; + can_skb_prv(skb)->skbcnt = 0; + + cf = (struct canfd_frame *)skb->data; + skb_put_zero(skb, so->ll.mtu); + + /* create consecutive frame */ + isotp_fill_dataframe(cf, so, ae, 0); + + /* place consecutive frame N_PCI in appropriate index */ + cf->data[ae] = N_PCI_CF | so->tx.sn++; + so->tx.sn %= 16; + so->tx.bs++; + + cf->flags = so->ll.tx_flags; + + skb->dev = dev; + can_skb_set_owner(skb, sk); + + /* cfecho should have been zero'ed by init/isotp_rcv_echo() */ + if (so->cfecho) + pr_notice_once("can-isotp: cfecho is %08X != 0\n", so->cfecho); + + /* set consecutive frame echo tag */ + so->cfecho = *(u32 *)cf->data; + + /* send frame with local echo enabled */ + can_send_ret = can_send(skb, 1); + if (can_send_ret) { + pr_notice_once("can-isotp: %s: can_send_ret %pe\n", + __func__, ERR_PTR(can_send_ret)); + if (can_send_ret == -ENOBUFS) + pr_notice_once("can-isotp: tx queue is full\n"); + } + dev_put(dev); +} + static void isotp_create_fframe(struct canfd_frame *cf, struct isotp_sock *so, int ae) { @@ -746,145 +823,120 @@ cf->data[i] = so->tx.buf[so->tx.idx++]; so->tx.sn = 1; - so->tx.state = ISOTP_WAIT_FIRST_FC; } -static enum hrtimer_restart isotp_tx_timer_handler(struct hrtimer *hrtimer) +static void isotp_rcv_echo(struct sk_buff *skb, void *data) { - struct isotp_sock *so = container_of(hrtimer, struct isotp_sock, - txtimer); - struct sock *sk = &so->sk; - struct sk_buff *skb; - struct net_device *dev; - struct canfd_frame *cf; - enum hrtimer_restart restart = HRTIMER_NORESTART; - int can_send_ret; - int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0; + struct sock *sk = (struct sock *)data; + struct isotp_sock *so = isotp_sk(sk); + struct canfd_frame *cf = (struct canfd_frame *)skb->data; - switch (so->tx.state) { - case ISOTP_WAIT_FC: - case ISOTP_WAIT_FIRST_FC: - - /* we did not get any flow control frame in time */ - - /* report 'communication error on send' */ - sk->sk_err = ECOMM; - if (!sock_flag(sk, SOCK_DEAD)) - sk_error_report(sk); + /* only handle my own local echo CF/SF skb's (no FF!) */ + if (skb->sk != sk || so->cfecho != *(u32 *)cf->data) + return; - /* reset tx state */ + /* cancel local echo timeout */ + hrtimer_cancel(&so->txtimer); + + /* local echo skb with consecutive frame has been consumed */ + so->cfecho = 0; + + if (so->tx.idx >= so->tx.len) { + /* we are done */ so->tx.state = ISOTP_IDLE; wake_up_interruptible(&so->wait); - break; + return; + } - case ISOTP_SENDING: + if (so->txfc.bs && so->tx.bs >= so->txfc.bs) { + /* stop and wait for FC with timeout */ + so->tx.state = ISOTP_WAIT_FC; + hrtimer_start(&so->txtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), + HRTIMER_MODE_REL_SOFT); + return; + } - /* push out the next segmented pdu */ - dev = dev_get_by_index(sock_net(sk), so->ifindex); - if (!dev) - break; - -isotp_tx_burst: - skb = alloc_skb(so->ll.mtu + sizeof(struct can_skb_priv), - GFP_ATOMIC); - if (!skb) { - dev_put(dev); - break; - } + /* no gap between data frames needed => use burst mode */ + if (!so->tx_gap) { + /* enable echo timeout handling */ + hrtimer_start(&so->txtimer, ktime_set(ISOTP_ECHO_TIMEOUT, 0), + HRTIMER_MODE_REL_SOFT); + isotp_send_cframe(so); + return; + } - can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; - can_skb_prv(skb)->skbcnt = 0; - - cf = (struct canfd_frame *)skb->data; - skb_put_zero(skb, so->ll.mtu); - - /* create consecutive frame */ - isotp_fill_dataframe(cf, so, ae, 0); - - /* place consecutive frame N_PCI in appropriate index */ - cf->data[ae] = N_PCI_CF | so->tx.sn++; - so->tx.sn %= 16; - so->tx.bs++; - - cf->flags = so->ll.tx_flags; - - skb->dev = dev; - can_skb_set_owner(skb, sk); - - can_send_ret = can_send(skb, 1); - if (can_send_ret) { - pr_notice_once("can-isotp: %s: can_send_ret %pe\n", - __func__, ERR_PTR(can_send_ret)); - if (can_send_ret == -ENOBUFS) - pr_notice_once("can-isotp: tx queue is full, increasing txqueuelen may prevent this error\n"); - } - if (so->tx.idx >= so->tx.len) { - /* we are done */ - so->tx.state = ISOTP_IDLE; - dev_put(dev); - wake_up_interruptible(&so->wait); - break; - } + /* start timer to send next consecutive frame with correct delay */ + hrtimer_start(&so->txfrtimer, so->tx_gap, HRTIMER_MODE_REL_SOFT); +} - if (so->txfc.bs && so->tx.bs >= so->txfc.bs) { - /* stop and wait for FC */ - so->tx.state = ISOTP_WAIT_FC; - dev_put(dev); - hrtimer_set_expires(&so->txtimer, - ktime_add(ktime_get(), - ktime_set(1, 0))); - restart = HRTIMER_RESTART; - break; - } +static enum hrtimer_restart isotp_tx_timer_handler(struct hrtimer *hrtimer) +{ + struct isotp_sock *so = container_of(hrtimer, struct isotp_sock, + txtimer); + struct sock *sk = &so->sk; - /* no gap between data frames needed => use burst mode */ - if (!so->tx_gap) - goto isotp_tx_burst; + /* don't handle timeouts in IDLE or SHUTDOWN state */ + if (so->tx.state == ISOTP_IDLE || so->tx.state == ISOTP_SHUTDOWN) + return HRTIMER_NORESTART; + + /* we did not get any flow control or echo frame in time */ + + /* report 'communication error on send' */ + sk->sk_err = ECOMM; + if (!sock_flag(sk, SOCK_DEAD)) + sk_error_report(sk); + + /* reset tx state */ + so->tx.state = ISOTP_IDLE; + wake_up_interruptible(&so->wait); - /* start timer to send next data frame with correct delay */ - dev_put(dev); - hrtimer_set_expires(&so->txtimer, - ktime_add(ktime_get(), so->tx_gap)); - restart = HRTIMER_RESTART; - break; + return HRTIMER_NORESTART; +} - default: - WARN_ON_ONCE(1); - } +static enum hrtimer_restart isotp_txfr_timer_handler(struct hrtimer *hrtimer) +{ + struct isotp_sock *so = container_of(hrtimer, struct isotp_sock, + txfrtimer); + + /* start echo timeout handling and cover below protocol error */ + hrtimer_start(&so->txtimer, ktime_set(ISOTP_ECHO_TIMEOUT, 0), + HRTIMER_MODE_REL_SOFT); - return restart; + /* cfecho should be consumed by isotp_rcv_echo() here */ + if (so->tx.state == ISOTP_SENDING && !so->cfecho) + isotp_send_cframe(so); + + return HRTIMER_NORESTART; } static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) { struct sock *sk = sock->sk; struct isotp_sock *so = isotp_sk(sk); - u32 old_state = so->tx.state; struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf; int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0; int wait_tx_done = (so->opt.flags & CAN_ISOTP_WAIT_TX_DONE) ? 1 : 0; - s64 hrtimer_sec = 0; + s64 hrtimer_sec = ISOTP_ECHO_TIMEOUT; int off; int err; - if (!so->bound) + if (!so->bound || so->tx.state == ISOTP_SHUTDOWN) return -EADDRNOTAVAIL; - /* we do not support multiple buffers - for now */ - if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE || - wq_has_sleeper(&so->wait)) { - if (msg->msg_flags & MSG_DONTWAIT) { - err = -EAGAIN; - goto err_out; - } + while (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) { + /* we do not support multiple buffers - for now */ + if (msg->msg_flags & MSG_DONTWAIT) + return -EAGAIN; + + if (so->tx.state == ISOTP_SHUTDOWN) + return -EADDRNOTAVAIL; /* wait for complete transmission of current pdu */ err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); if (err) - goto err_out; + goto err_event_drop; } if (!size || size > MAX_MSG_LENGTH) { @@ -896,7 +948,7 @@ off = (so->tx.ll_dl > CAN_MAX_DLEN) ? 1 : 0; /* does the given data fit into a single frame for SF_BROADCAST? */ - if ((so->opt.flags & CAN_ISOTP_SF_BROADCAST) && + if ((isotp_bc_flags(so) == CAN_ISOTP_SF_BROADCAST) && (size > so->tx.ll_dl - SF_PCI_SZ4 - ae - off)) { err = -EINVAL; goto err_out_drop; @@ -929,6 +981,10 @@ cf = (struct canfd_frame *)skb->data; skb_put_zero(skb, so->ll.mtu); + /* cfecho should have been zero'ed by init / former isotp_rcv_echo() */ + if (so->cfecho) + pr_notice_once("can-isotp: uninit cfecho %08X\n", so->cfecho); + /* check for single frame transmission depending on TX_DL */ if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) { /* The message size generally fits into a SingleFrame - good. @@ -954,22 +1010,40 @@ else cf->data[ae] |= size; - so->tx.state = ISOTP_IDLE; - wake_up_interruptible(&so->wait); - - /* don't enable wait queue for a single frame transmission */ - wait_tx_done = 0; + /* set CF echo tag for isotp_rcv_echo() (SF-mode) */ + so->cfecho = *(u32 *)cf->data; } else { - /* send first frame and wait for FC */ + /* send first frame */ isotp_create_fframe(cf, so, ae); - /* start timeout for FC */ - hrtimer_sec = 1; - hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0), - HRTIMER_MODE_REL_SOFT); + if (isotp_bc_flags(so) == CAN_ISOTP_CF_BROADCAST) { + /* set timer for FC-less operation (STmin = 0) */ + if (so->opt.flags & CAN_ISOTP_FORCE_TXSTMIN) + so->tx_gap = ktime_set(0, so->force_tx_stmin); + else + so->tx_gap = ktime_set(0, so->frame_txtime); + + /* disable wait for FCs due to activated block size */ + so->txfc.bs = 0; + + /* set CF echo tag for isotp_rcv_echo() (CF-mode) */ + so->cfecho = *(u32 *)cf->data; + } else { + /* standard flow control check */ + so->tx.state = ISOTP_WAIT_FIRST_FC; + + /* start timeout for FC */ + hrtimer_sec = ISOTP_FC_TIMEOUT; + + /* no CF echo tag for isotp_rcv_echo() (FF-mode) */ + so->cfecho = 0; + } } + hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0), + HRTIMER_MODE_REL_SOFT); + /* send the first or only CAN frame */ cf->flags = so->ll.tx_flags; @@ -982,15 +1056,19 @@ __func__, ERR_PTR(err)); /* no transmission -> no timeout monitoring */ - if (hrtimer_sec) - hrtimer_cancel(&so->txtimer); + hrtimer_cancel(&so->txtimer); + + /* reset consecutive frame echo tag */ + so->cfecho = 0; goto err_out_drop; } if (wait_tx_done) { /* wait for complete transmission of current pdu */ - wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); + err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); + if (err) + goto err_event_drop; err = sock_error(sk); if (err) @@ -999,13 +1077,15 @@ return size; +err_event_drop: + /* got signal: force tx state machine to be idle */ + so->tx.state = ISOTP_IDLE; + hrtimer_cancel(&so->txfrtimer); + hrtimer_cancel(&so->txtimer); err_out_drop: /* drop this PDU and unlock a potential wait queue */ - old_state = ISOTP_IDLE; -err_out: - so->tx.state = old_state; - if (so->tx.state == ISOTP_IDLE) - wake_up_interruptible(&so->wait); + so->tx.state = ISOTP_IDLE; + wake_up_interruptible(&so->wait); return err; } @@ -1069,7 +1149,13 @@ net = sock_net(sk); /* wait for complete transmission of current pdu */ - wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); + while (wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE) == 0 && + cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SHUTDOWN) != ISOTP_IDLE) + ; + + /* force state machines to be idle also when a signal occurred */ + so->tx.state = ISOTP_SHUTDOWN; + so->rx.state = ISOTP_IDLE; spin_lock(&isotp_notifier_lock); while (isotp_busy_notifier == so) { @@ -1083,21 +1169,27 @@ lock_sock(sk); /* remove current filters & unregister */ - if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) { + if (so->bound) { if (so->ifindex) { struct net_device *dev; dev = dev_get_by_index(net, so->ifindex); if (dev) { - can_rx_unregister(net, dev, so->rxid, - SINGLE_MASK(so->rxid), - isotp_rcv, sk); + if (isotp_register_rxid(so)) + can_rx_unregister(net, dev, so->rxid, + SINGLE_MASK(so->rxid), + isotp_rcv, sk); + + can_rx_unregister(net, dev, so->txid, + SINGLE_MASK(so->txid), + isotp_rcv_echo, sk); dev_put(dev); synchronize_rcu(); } } } + hrtimer_cancel(&so->txfrtimer); hrtimer_cancel(&so->txtimer); hrtimer_cancel(&so->rxtimer); @@ -1121,26 +1213,38 @@ struct net *net = sock_net(sk); int ifindex; struct net_device *dev; - canid_t tx_id, rx_id; + canid_t tx_id = addr->can_addr.tp.tx_id; + canid_t rx_id = addr->can_addr.tp.rx_id; int err = 0; int notify_enetdown = 0; - int do_rx_reg = 1; if (len < ISOTP_MIN_NAMELEN) return -EINVAL; - /* sanitize tx/rx CAN identifiers */ - tx_id = addr->can_addr.tp.tx_id; + if (addr->can_family != AF_CAN) + return -EINVAL; + + /* sanitize tx CAN identifier */ if (tx_id & CAN_EFF_FLAG) tx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); else tx_id &= CAN_SFF_MASK; - rx_id = addr->can_addr.tp.rx_id; - if (rx_id & CAN_EFF_FLAG) - rx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); - else - rx_id &= CAN_SFF_MASK; + /* give feedback on wrong CAN-ID value */ + if (tx_id != addr->can_addr.tp.tx_id) + return -EINVAL; + + /* sanitize rx CAN identifier (if needed) */ + if (isotp_register_rxid(so)) { + if (rx_id & CAN_EFF_FLAG) + rx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); + else + rx_id &= CAN_SFF_MASK; + + /* give feedback on wrong CAN-ID value */ + if (rx_id != addr->can_addr.tp.rx_id) + return -EINVAL; + } if (!addr->can_ifindex) return -ENODEV; @@ -1152,12 +1256,8 @@ goto out; } - /* do not register frame reception for functional addressing */ - if (so->opt.flags & CAN_ISOTP_SF_BROADCAST) - do_rx_reg = 0; - - /* do not validate rx address for functional addressing */ - if (do_rx_reg && rx_id == tx_id) { + /* ensure different CAN IDs when the rx_id is to be registered */ + if (isotp_register_rxid(so) && rx_id == tx_id) { err = -EADDRNOTAVAIL; goto out; } @@ -1182,10 +1282,17 @@ ifindex = dev->ifindex; - if (do_rx_reg) + if (isotp_register_rxid(so)) can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id), isotp_rcv, sk, "isotp", sk); + /* no consecutive frame echo skb in flight */ + so->cfecho = 0; + + /* register for echo skb's */ + can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id), + isotp_rcv_echo, sk, "isotpe", sk); + dev_put(dev); /* switch to new settings */ @@ -1246,6 +1353,15 @@ if (!(so->opt.flags & CAN_ISOTP_RX_EXT_ADDR)) so->opt.rx_ext_address = so->opt.ext_address; + /* these broadcast flags are not allowed together */ + if (isotp_bc_flags(so) == ISOTP_ALL_BC_FLAGS) { + /* CAN_ISOTP_SF_BROADCAST is prioritized */ + so->opt.flags &= ~CAN_ISOTP_CF_BROADCAST; + + /* give user feedback on wrong config attempt */ + ret = -EINVAL; + } + /* check for frame_txtime changes (0 => no changes) */ if (so->opt.frame_txtime) { if (so->opt.frame_txtime == CAN_ISOTP_FRAME_TXTIME_ZERO) @@ -1396,10 +1512,16 @@ case NETDEV_UNREGISTER: lock_sock(sk); /* remove current filters & unregister */ - if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) - can_rx_unregister(dev_net(dev), dev, so->rxid, - SINGLE_MASK(so->rxid), - isotp_rcv, sk); + if (so->bound) { + if (isotp_register_rxid(so)) + can_rx_unregister(dev_net(dev), dev, so->rxid, + SINGLE_MASK(so->rxid), + isotp_rcv, sk); + + can_rx_unregister(dev_net(dev), dev, so->txid, + SINGLE_MASK(so->txid), + isotp_rcv_echo, sk); + } so->ifindex = 0; so->bound = 0; @@ -1472,6 +1594,8 @@ so->rxtimer.function = isotp_rx_timer_handler; hrtimer_init(&so->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT); so->txtimer.function = isotp_tx_timer_handler; + hrtimer_init(&so->txfrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT); + so->txfrtimer.function = isotp_txfr_timer_handler; init_waitqueue_head(&so->wait); spin_lock_init(&so->rx_lock); diff -u linux-lowlatency-5.15.0/net/core/dev.c linux-lowlatency-5.15.0/net/core/dev.c --- linux-lowlatency-5.15.0/net/core/dev.c +++ linux-lowlatency-5.15.0/net/core/dev.c @@ -303,6 +303,12 @@ return NULL; } +bool netdev_name_in_use(struct net *net, const char *name) +{ + return netdev_name_node_lookup(net, name); +} +EXPORT_SYMBOL(netdev_name_in_use); + int netdev_name_node_alt_create(struct net_device *dev, const char *name) { struct netdev_name_node *name_node; @@ -1135,7 +1141,7 @@ } snprintf(buf, IFNAMSIZ, name, i); - if (!__dev_get_by_name(net, buf)) + if (!netdev_name_in_use(net, buf)) return i; /* It is possible to run out of possible slots @@ -1145,6 +1151,26 @@ return -ENFILE; } +static int dev_prep_valid_name(struct net *net, struct net_device *dev, + const char *want_name, char *out_name) +{ + int ret; + + if (!dev_valid_name(want_name)) + return -EINVAL; + + if (strchr(want_name, '%')) { + ret = __dev_alloc_name(net, want_name, out_name); + return ret < 0 ? ret : 0; + } else if (netdev_name_in_use(net, want_name)) { + return -EEXIST; + } else if (out_name != want_name) { + strscpy(out_name, want_name, IFNAMSIZ); + } + + return 0; +} + static int dev_alloc_name_ns(struct net *net, struct net_device *dev, const char *name) @@ -1155,7 +1181,7 @@ BUG_ON(!net); ret = __dev_alloc_name(net, name, buf); if (ret >= 0) - strlcpy(dev->name, buf, IFNAMSIZ); + strscpy(dev->name, buf, IFNAMSIZ); return ret; } @@ -1182,19 +1208,13 @@ static int dev_get_valid_name(struct net *net, struct net_device *dev, const char *name) { - BUG_ON(!net); - - if (!dev_valid_name(name)) - return -EINVAL; - - if (strchr(name, '%')) - return dev_alloc_name_ns(net, dev, name); - else if (__dev_get_by_name(net, name)) - return -EEXIST; - else if (dev->name != name) - strlcpy(dev->name, name, IFNAMSIZ); + char buf[IFNAMSIZ]; + int ret; - return 0; + ret = dev_prep_valid_name(net, dev, name, buf); + if (ret >= 0) + strscpy(dev->name, buf, IFNAMSIZ); + return ret; } /** @@ -11148,6 +11168,7 @@ const char *pat, int new_ifindex) { struct net *net_old = dev_net(dev); + char new_name[IFNAMSIZ] = {}; int err, new_nsid; ASSERT_RTNL(); @@ -11170,11 +11191,11 @@ * we can use it in the destination network namespace. */ err = -EEXIST; - if (__dev_get_by_name(net, dev->name)) { + if (netdev_name_in_use(net, dev->name)) { /* We get here if we can't use the current device name */ if (!pat) goto out; - err = dev_get_valid_name(net, dev, pat); + err = dev_prep_valid_name(net, dev, pat, new_name); if (err < 0) goto out; } @@ -11242,6 +11263,9 @@ kobject_uevent(&dev->dev.kobj, KOBJ_ADD); netdev_adjacent_add_links(dev); + if (new_name[0]) /* Rename the netdev to prepared name */ + strscpy(dev->name, new_name, IFNAMSIZ); + /* Fixup kobjects */ err = device_rename(&dev->dev, dev->name); WARN_ON(err); @@ -11522,7 +11546,7 @@ /* Push remaining network devices to init_net */ snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); - if (__dev_get_by_name(&init_net, fb_name)) + if (netdev_name_in_use(&init_net, fb_name)) snprintf(fb_name, IFNAMSIZ, "dev%%d"); err = dev_change_net_namespace(dev, &init_net, fb_name); if (err) { diff -u linux-lowlatency-5.15.0/net/core/drop_monitor.c linux-lowlatency-5.15.0/net/core/drop_monitor.c --- linux-lowlatency-5.15.0/net/core/drop_monitor.c +++ linux-lowlatency-5.15.0/net/core/drop_monitor.c @@ -184,7 +184,7 @@ } static const struct genl_multicast_group dropmon_mcgrps[] = { - { .name = "events", }, + { .name = "events", .cap_sys_admin = 1 }, }; static void send_dm_alert(struct work_struct *work) @@ -473,7 +473,7 @@ goto out; hw_entry = &hw_entries->entries[hw_entries->num_entries]; - strlcpy(hw_entry->trap_name, metadata->trap_name, + strscpy(hw_entry->trap_name, metadata->trap_name, NET_DM_MAX_HW_TRAP_NAME_LEN - 1); hw_entry->count = 1; hw_entries->num_entries++; @@ -1618,11 +1618,13 @@ .cmd = NET_DM_CMD_START, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = net_dm_cmd_trace, + .flags = GENL_ADMIN_PERM, }, { .cmd = NET_DM_CMD_STOP, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = net_dm_cmd_trace, + .flags = GENL_ADMIN_PERM, }, { .cmd = NET_DM_CMD_CONFIG_GET, diff -u linux-lowlatency-5.15.0/net/core/filter.c linux-lowlatency-5.15.0/net/core/filter.c --- linux-lowlatency-5.15.0/net/core/filter.c +++ linux-lowlatency-5.15.0/net/core/filter.c @@ -2576,6 +2576,22 @@ return 0; } +static void sk_msg_reset_curr(struct sk_msg *msg) +{ + u32 i = msg->sg.start; + u32 len = 0; + + do { + len += sk_msg_elem(msg, i)->length; + sk_msg_iter_var_next(i); + if (len >= msg->sg.size) + break; + } while (i != msg->sg.end); + + msg->sg.curr = i; + msg->sg.copybreak = 0; +} + static const struct bpf_func_proto bpf_msg_cork_bytes_proto = { .func = bpf_msg_cork_bytes, .gpl_only = false, @@ -2695,6 +2711,7 @@ msg->sg.end - shift + NR_MSG_FRAG_IDS : msg->sg.end - shift; out: + sk_msg_reset_curr(msg); msg->data = sg_virt(&msg->sg.data[first_sge]) + start - offset; msg->data_end = msg->data + bytes; return 0; @@ -2831,6 +2848,7 @@ msg->sg.data[new] = rsge; } + sk_msg_reset_curr(msg); sk_msg_compute_data_pointers(msg); return 0; } @@ -2999,6 +3017,7 @@ sk_mem_uncharge(msg->sk, len - pop); msg->sg.size -= (len - pop); + sk_msg_reset_curr(msg); sk_msg_compute_data_pointers(msg); return 0; } diff -u linux-lowlatency-5.15.0/net/core/neighbour.c linux-lowlatency-5.15.0/net/core/neighbour.c --- linux-lowlatency-5.15.0/net/core/neighbour.c +++ linux-lowlatency-5.15.0/net/core/neighbour.c @@ -223,7 +223,8 @@ static int neigh_forced_gc(struct neigh_table *tbl) { - int max_clean = atomic_read(&tbl->gc_entries) - tbl->gc_thresh2; + int max_clean = atomic_read(&tbl->gc_entries) - + READ_ONCE(tbl->gc_thresh2); unsigned long tref = jiffies - 5 * HZ; struct neighbour *n, *tmp; int shrunk = 0; @@ -252,7 +253,7 @@ } } - tbl->last_flush = jiffies; + WRITE_ONCE(tbl->last_flush, jiffies); write_unlock_bh(&tbl->lock); @@ -408,17 +409,17 @@ { struct neighbour *n = NULL; unsigned long now = jiffies; - int entries; + int entries, gc_thresh3; if (exempt_from_gc) goto do_alloc; entries = atomic_inc_return(&tbl->gc_entries) - 1; - if (entries >= tbl->gc_thresh3 || - (entries >= tbl->gc_thresh2 && - time_after(now, tbl->last_flush + 5 * HZ))) { - if (!neigh_forced_gc(tbl) && - entries >= tbl->gc_thresh3) { + gc_thresh3 = READ_ONCE(tbl->gc_thresh3); + if (entries >= gc_thresh3 || + (entries >= READ_ONCE(tbl->gc_thresh2) && + time_after(now, READ_ONCE(tbl->last_flush) + 5 * HZ))) { + if (!neigh_forced_gc(tbl) && entries >= gc_thresh3) { net_info_ratelimited("%s: neighbor table overflow!\n", tbl->id); NEIGH_CACHE_STAT_INC(tbl, table_fulls); @@ -897,13 +898,14 @@ if (time_after(jiffies, tbl->last_rand + 300 * HZ)) { struct neigh_parms *p; - tbl->last_rand = jiffies; + + WRITE_ONCE(tbl->last_rand, jiffies); list_for_each_entry(p, &tbl->parms_list, list) p->reachable_time = neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME)); } - if (atomic_read(&tbl->entries) < tbl->gc_thresh1) + if (atomic_read(&tbl->entries) < READ_ONCE(tbl->gc_thresh1)) goto out; for (i = 0 ; i < (1 << nht->hash_shift); i++) { @@ -2047,15 +2049,16 @@ ndtmsg->ndtm_pad2 = 0; if (nla_put_string(skb, NDTA_NAME, tbl->id) || - nla_put_msecs(skb, NDTA_GC_INTERVAL, tbl->gc_interval, NDTA_PAD) || - nla_put_u32(skb, NDTA_THRESH1, tbl->gc_thresh1) || - nla_put_u32(skb, NDTA_THRESH2, tbl->gc_thresh2) || - nla_put_u32(skb, NDTA_THRESH3, tbl->gc_thresh3)) + nla_put_msecs(skb, NDTA_GC_INTERVAL, READ_ONCE(tbl->gc_interval), + NDTA_PAD) || + nla_put_u32(skb, NDTA_THRESH1, READ_ONCE(tbl->gc_thresh1)) || + nla_put_u32(skb, NDTA_THRESH2, READ_ONCE(tbl->gc_thresh2)) || + nla_put_u32(skb, NDTA_THRESH3, READ_ONCE(tbl->gc_thresh3))) goto nla_put_failure; { unsigned long now = jiffies; - long flush_delta = now - tbl->last_flush; - long rand_delta = now - tbl->last_rand; + long flush_delta = now - READ_ONCE(tbl->last_flush); + long rand_delta = now - READ_ONCE(tbl->last_rand); struct neigh_hash_table *nht; struct ndt_config ndc = { .ndtc_key_len = tbl->key_len, @@ -2063,7 +2066,7 @@ .ndtc_entries = atomic_read(&tbl->entries), .ndtc_last_flush = jiffies_to_msecs(flush_delta), .ndtc_last_rand = jiffies_to_msecs(rand_delta), - .ndtc_proxy_qlen = tbl->proxy_queue.qlen, + .ndtc_proxy_qlen = READ_ONCE(tbl->proxy_queue.qlen), }; rcu_read_lock_bh(); @@ -2086,17 +2089,17 @@ struct neigh_statistics *st; st = per_cpu_ptr(tbl->stats, cpu); - ndst.ndts_allocs += st->allocs; - ndst.ndts_destroys += st->destroys; - ndst.ndts_hash_grows += st->hash_grows; - ndst.ndts_res_failed += st->res_failed; - ndst.ndts_lookups += st->lookups; - ndst.ndts_hits += st->hits; - ndst.ndts_rcv_probes_mcast += st->rcv_probes_mcast; - ndst.ndts_rcv_probes_ucast += st->rcv_probes_ucast; - ndst.ndts_periodic_gc_runs += st->periodic_gc_runs; - ndst.ndts_forced_gc_runs += st->forced_gc_runs; - ndst.ndts_table_fulls += st->table_fulls; + ndst.ndts_allocs += READ_ONCE(st->allocs); + ndst.ndts_destroys += READ_ONCE(st->destroys); + ndst.ndts_hash_grows += READ_ONCE(st->hash_grows); + ndst.ndts_res_failed += READ_ONCE(st->res_failed); + ndst.ndts_lookups += READ_ONCE(st->lookups); + ndst.ndts_hits += READ_ONCE(st->hits); + ndst.ndts_rcv_probes_mcast += READ_ONCE(st->rcv_probes_mcast); + ndst.ndts_rcv_probes_ucast += READ_ONCE(st->rcv_probes_ucast); + ndst.ndts_periodic_gc_runs += READ_ONCE(st->periodic_gc_runs); + ndst.ndts_forced_gc_runs += READ_ONCE(st->forced_gc_runs); + ndst.ndts_table_fulls += READ_ONCE(st->table_fulls); } if (nla_put_64bit(skb, NDTA_STATS, sizeof(ndst), &ndst, @@ -2320,16 +2323,16 @@ goto errout_tbl_lock; if (tb[NDTA_THRESH1]) - tbl->gc_thresh1 = nla_get_u32(tb[NDTA_THRESH1]); + WRITE_ONCE(tbl->gc_thresh1, nla_get_u32(tb[NDTA_THRESH1])); if (tb[NDTA_THRESH2]) - tbl->gc_thresh2 = nla_get_u32(tb[NDTA_THRESH2]); + WRITE_ONCE(tbl->gc_thresh2, nla_get_u32(tb[NDTA_THRESH2])); if (tb[NDTA_THRESH3]) - tbl->gc_thresh3 = nla_get_u32(tb[NDTA_THRESH3]); + WRITE_ONCE(tbl->gc_thresh3, nla_get_u32(tb[NDTA_THRESH3])); if (tb[NDTA_GC_INTERVAL]) - tbl->gc_interval = nla_get_msecs(tb[NDTA_GC_INTERVAL]); + WRITE_ONCE(tbl->gc_interval, nla_get_msecs(tb[NDTA_GC_INTERVAL])); err = 0; diff -u linux-lowlatency-5.15.0/net/core/netpoll.c linux-lowlatency-5.15.0/net/core/netpoll.c --- linux-lowlatency-5.15.0/net/core/netpoll.c +++ linux-lowlatency-5.15.0/net/core/netpoll.c @@ -573,7 +573,7 @@ if ((delim = strchr(cur, ',')) == NULL) goto parse_failed; *delim = 0; - strlcpy(np->dev_name, cur, sizeof(np->dev_name)); + strscpy(np->dev_name, cur, sizeof(np->dev_name)); cur = delim; } cur++; @@ -627,7 +627,7 @@ int err; np->dev = ndev; - strlcpy(np->dev_name, ndev->name, IFNAMSIZ); + strscpy(np->dev_name, ndev->name, IFNAMSIZ); if (ndev->priv_flags & IFF_DISABLE_NETPOLL) { np_err(np, "%s doesn't support polling, aborting\n", diff -u linux-lowlatency-5.15.0/net/core/scm.c linux-lowlatency-5.15.0/net/core/scm.c --- linux-lowlatency-5.15.0/net/core/scm.c +++ linux-lowlatency-5.15.0/net/core/scm.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -103,6 +104,11 @@ if (fd < 0 || !(file = fget_raw(fd))) return -EBADF; + /* don't allow io_uring files */ + if (io_uring_get_socket(file)) { + fput(file); + return -EINVAL; + } *fpp++ = file; fpl->count++; } diff -u linux-lowlatency-5.15.0/net/core/sock.c linux-lowlatency-5.15.0/net/core/sock.c --- linux-lowlatency-5.15.0/net/core/sock.c +++ linux-lowlatency-5.15.0/net/core/sock.c @@ -557,7 +557,7 @@ INDIRECT_CALL_INET(dst->ops->check, ip6_dst_check, ipv4_dst_check, dst, cookie) == NULL) { sk_tx_queue_clear(sk); - sk->sk_dst_pending_confirm = 0; + WRITE_ONCE(sk->sk_dst_pending_confirm, 0); RCU_INIT_POINTER(sk->sk_dst_cache, NULL); dst_release(dst); return NULL; diff -u linux-lowlatency-5.15.0/net/dccp/ipv4.c linux-lowlatency-5.15.0/net/dccp/ipv4.c --- linux-lowlatency-5.15.0/net/dccp/ipv4.c +++ linux-lowlatency-5.15.0/net/dccp/ipv4.c @@ -623,9 +623,6 @@ if (dccp_parse_options(sk, dreq, skb)) goto drop_and_free; - if (security_inet_conn_request(sk, skb, req)) - goto drop_and_free; - ireq = inet_rsk(req); sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); @@ -633,6 +630,9 @@ ireq->ireq_family = AF_INET; ireq->ir_iif = sk->sk_bound_dev_if; + if (security_inet_conn_request(sk, skb, req)) + goto drop_and_free; + /* * Step 3: Process LISTEN state * diff -u linux-lowlatency-5.15.0/net/dccp/ipv6.c linux-lowlatency-5.15.0/net/dccp/ipv6.c --- linux-lowlatency-5.15.0/net/dccp/ipv6.c +++ linux-lowlatency-5.15.0/net/dccp/ipv6.c @@ -359,15 +359,15 @@ if (dccp_parse_options(sk, dreq, skb)) goto drop_and_free; - if (security_inet_conn_request(sk, skb, req)) - goto drop_and_free; - ireq = inet_rsk(req); ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; ireq->ireq_family = AF_INET6; ireq->ir_mark = inet_request_mark(sk, skb); + if (security_inet_conn_request(sk, skb, req)) + goto drop_and_free; + if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { diff -u linux-lowlatency-5.15.0/net/dccp/proto.c linux-lowlatency-5.15.0/net/dccp/proto.c --- linux-lowlatency-5.15.0/net/dccp/proto.c +++ linux-lowlatency-5.15.0/net/dccp/proto.c @@ -1131,7 +1131,6 @@ BUILD_BUG_ON(sizeof(struct dccp_skb_cb) > sizeof_field(struct sk_buff, cb)); - inet_hashinfo_init(&dccp_hashinfo); rc = inet_hashinfo2_init_mod(&dccp_hashinfo); if (rc) goto out_fail; diff -u linux-lowlatency-5.15.0/net/hsr/hsr_forward.c linux-lowlatency-5.15.0/net/hsr/hsr_forward.c --- linux-lowlatency-5.15.0/net/hsr/hsr_forward.c +++ linux-lowlatency-5.15.0/net/hsr/hsr_forward.c @@ -300,9 +300,7 @@ skb = skb_copy_expand(frame->skb_std, 0, skb_tailroom(frame->skb_std) + HSR_HLEN, GFP_ATOMIC); - prp_fill_rct(skb, frame, port); - - return skb; + return prp_fill_rct(skb, frame, port); } static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev, diff -u linux-lowlatency-5.15.0/net/ipv4/esp4.c linux-lowlatency-5.15.0/net/ipv4/esp4.c --- linux-lowlatency-5.15.0/net/ipv4/esp4.c +++ linux-lowlatency-5.15.0/net/ipv4/esp4.c @@ -739,7 +739,9 @@ skb->csum = csum_block_sub(skb->csum, csumdiff, skb->len - trimlen); } - pskb_trim(skb, skb->len - trimlen); + ret = pskb_trim(skb, skb->len - trimlen); + if (unlikely(ret)) + return ret; ret = nexthdr[1]; diff -u linux-lowlatency-5.15.0/net/ipv4/fib_semantics.c linux-lowlatency-5.15.0/net/ipv4/fib_semantics.c --- linux-lowlatency-5.15.0/net/ipv4/fib_semantics.c +++ linux-lowlatency-5.15.0/net/ipv4/fib_semantics.c @@ -1344,15 +1344,18 @@ unsigned char scope) { struct fib_nh *nh; + __be32 saddr; if (nhc->nhc_family != AF_INET) return inet_select_addr(nhc->nhc_dev, 0, scope); nh = container_of(nhc, struct fib_nh, nh_common); - nh->nh_saddr = inet_select_addr(nh->fib_nh_dev, nh->fib_nh_gw4, scope); - nh->nh_saddr_genid = atomic_read(&net->ipv4.dev_addr_genid); + saddr = inet_select_addr(nh->fib_nh_dev, nh->fib_nh_gw4, scope); - return nh->nh_saddr; + WRITE_ONCE(nh->nh_saddr, saddr); + WRITE_ONCE(nh->nh_saddr_genid, atomic_read(&net->ipv4.dev_addr_genid)); + + return saddr; } __be32 fib_result_prefsrc(struct net *net, struct fib_result *res) @@ -1366,8 +1369,9 @@ struct fib_nh *nh; nh = container_of(nhc, struct fib_nh, nh_common); - if (nh->nh_saddr_genid == atomic_read(&net->ipv4.dev_addr_genid)) - return nh->nh_saddr; + if (READ_ONCE(nh->nh_saddr_genid) == + atomic_read(&net->ipv4.dev_addr_genid)) + return READ_ONCE(nh->nh_saddr); } return fib_info_update_nhc_saddr(net, nhc, res->fi->fib_scope); @@ -1904,6 +1908,7 @@ continue; if (fi->fib_prefsrc == local) { fi->fib_flags |= RTNH_F_DEAD; + fi->pfsrc_removed = true; ret++; } } diff -u linux-lowlatency-5.15.0/net/ipv4/fib_trie.c linux-lowlatency-5.15.0/net/ipv4/fib_trie.c --- linux-lowlatency-5.15.0/net/ipv4/fib_trie.c +++ linux-lowlatency-5.15.0/net/ipv4/fib_trie.c @@ -2021,6 +2021,7 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) { struct trie *t = (struct trie *)tb->tb_data; + struct nl_info info = { .nl_net = net }; struct key_vector *pn = t->kv; unsigned long cindex = 1; struct hlist_node *tmp; @@ -2083,6 +2084,9 @@ fib_notify_alias_delete(net, n->key, &n->leaf, fa, NULL); + if (fi->pfsrc_removed) + rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa, + KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0); hlist_del_rcu(&fa->fa_list); fib_release_info(fa->fa_info); alias_free_mem_rcu(fa); diff -u linux-lowlatency-5.15.0/net/ipv4/inet_diag.c linux-lowlatency-5.15.0/net/ipv4/inet_diag.c --- linux-lowlatency-5.15.0/net/ipv4/inet_diag.c +++ linux-lowlatency-5.15.0/net/ipv4/inet_diag.c @@ -1028,12 +1028,13 @@ if (!(idiag_states & TCPF_LISTEN) || r->id.idiag_dport) goto skip_listen_ht; - for (i = s_i; i < INET_LHTABLE_SIZE; i++) { + for (i = s_i; i <= hashinfo->lhash2_mask; i++) { struct inet_listen_hashbucket *ilb; struct hlist_nulls_node *node; num = 0; - ilb = &hashinfo->listening_hash[i]; + ilb = &hashinfo->lhash2[i]; + spin_lock(&ilb->lock); sk_nulls_for_each(sk, node, &ilb->nulls_head) { struct inet_sock *inet = inet_sk(sk); diff -u linux-lowlatency-5.15.0/net/ipv4/inet_hashtables.c linux-lowlatency-5.15.0/net/ipv4/inet_hashtables.c --- linux-lowlatency-5.15.0/net/ipv4/inet_hashtables.c +++ linux-lowlatency-5.15.0/net/ipv4/inet_hashtables.c @@ -193,42 +193,6 @@ return inet_lhash2_bucket(h, hash); } -static void inet_hash2(struct inet_hashinfo *h, struct sock *sk) -{ - struct inet_listen_hashbucket *ilb2; - - if (!h->lhash2) - return; - - ilb2 = inet_lhash2_bucket_sk(h, sk); - - spin_lock(&ilb2->lock); - if (sk->sk_reuseport && sk->sk_family == AF_INET6) - hlist_add_tail_rcu(&inet_csk(sk)->icsk_listen_portaddr_node, - &ilb2->head); - else - hlist_add_head_rcu(&inet_csk(sk)->icsk_listen_portaddr_node, - &ilb2->head); - ilb2->count++; - spin_unlock(&ilb2->lock); -} - -static void inet_unhash2(struct inet_hashinfo *h, struct sock *sk) -{ - struct inet_listen_hashbucket *ilb2; - - if (!h->lhash2 || - WARN_ON_ONCE(hlist_unhashed(&inet_csk(sk)->icsk_listen_portaddr_node))) - return; - - ilb2 = inet_lhash2_bucket_sk(h, sk); - - spin_lock(&ilb2->lock); - hlist_del_init_rcu(&inet_csk(sk)->icsk_listen_portaddr_node); - ilb2->count--; - spin_unlock(&ilb2->lock); -} - static inline int compute_score(struct sock *sk, struct net *net, const unsigned short hnum, const __be32 daddr, const int dif, const int sdif) @@ -282,12 +246,11 @@ const __be32 daddr, const unsigned short hnum, const int dif, const int sdif) { - struct inet_connection_sock *icsk; struct sock *sk, *result = NULL; + struct hlist_nulls_node *node; int score, hiscore = 0; - inet_lhash2_for_each_icsk_rcu(icsk, &ilb2->head) { - sk = (struct sock *)icsk; + sk_nulls_for_each_rcu(sk, node, &ilb2->nulls_head) { score = compute_score(sk, net, hnum, daddr, dif, sdif); if (score > hiscore) { result = lookup_reuseport(net, sk, skb, doff, @@ -628,7 +591,7 @@ int __inet_hash(struct sock *sk, struct sock *osk) { struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; - struct inet_listen_hashbucket *ilb; + struct inet_listen_hashbucket *ilb2; int err = 0; if (sk->sk_state != TCP_LISTEN) { @@ -638,25 +601,23 @@ return 0; } WARN_ON(!sk_unhashed(sk)); - ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; + ilb2 = inet_lhash2_bucket_sk(hashinfo, sk); - spin_lock(&ilb->lock); + spin_lock(&ilb2->lock); if (sk->sk_reuseport) { - err = inet_reuseport_add_sock(sk, ilb); + err = inet_reuseport_add_sock(sk, ilb2); if (err) goto unlock; } + sock_set_flag(sk, SOCK_RCU_FREE); if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport && sk->sk_family == AF_INET6) - __sk_nulls_add_node_tail_rcu(sk, &ilb->nulls_head); + __sk_nulls_add_node_tail_rcu(sk, &ilb2->nulls_head); else - __sk_nulls_add_node_rcu(sk, &ilb->nulls_head); - inet_hash2(hashinfo, sk); - ilb->count++; - sock_set_flag(sk, SOCK_RCU_FREE); + __sk_nulls_add_node_rcu(sk, &ilb2->nulls_head); sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); unlock: - spin_unlock(&ilb->lock); + spin_unlock(&ilb2->lock); return err; } @@ -673,23 +634,6 @@ } EXPORT_SYMBOL_GPL(inet_hash); -static void __inet_unhash(struct sock *sk, struct inet_listen_hashbucket *ilb) -{ - if (sk_unhashed(sk)) - return; - - if (rcu_access_pointer(sk->sk_reuseport_cb)) - reuseport_stop_listen_sock(sk); - if (ilb) { - struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; - - inet_unhash2(hashinfo, sk); - ilb->count--; - } - __sk_nulls_del_node_init_rcu(sk); - sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); -} - void inet_unhash(struct sock *sk) { struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; @@ -698,20 +642,34 @@ return; if (sk->sk_state == TCP_LISTEN) { - struct inet_listen_hashbucket *ilb; + struct inet_listen_hashbucket *ilb2; - ilb = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; + ilb2 = inet_lhash2_bucket_sk(hashinfo, sk); /* Don't disable bottom halves while acquiring the lock to * avoid circular locking dependency on PREEMPT_RT. */ - spin_lock(&ilb->lock); - __inet_unhash(sk, ilb); - spin_unlock(&ilb->lock); + spin_lock(&ilb2->lock); + if (sk_unhashed(sk)) { + spin_unlock(&ilb2->lock); + return; + } + + if (rcu_access_pointer(sk->sk_reuseport_cb)) + reuseport_stop_listen_sock(sk); + + __sk_nulls_del_node_init_rcu(sk); + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); + spin_unlock(&ilb2->lock); } else { spinlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash); spin_lock_bh(lock); - __inet_unhash(sk, NULL); + if (sk_unhashed(sk)) { + spin_unlock_bh(lock); + return; + } + __sk_nulls_del_node_init_rcu(sk); + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); spin_unlock_bh(lock); } } @@ -859,29 +817,14 @@ } EXPORT_SYMBOL_GPL(inet_hash_connect); -void inet_hashinfo_init(struct inet_hashinfo *h) -{ - int i; - - for (i = 0; i < INET_LHTABLE_SIZE; i++) { - spin_lock_init(&h->listening_hash[i].lock); - INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].nulls_head, - i + LISTENING_NULLS_BASE); - h->listening_hash[i].count = 0; - } - - h->lhash2 = NULL; -} -EXPORT_SYMBOL_GPL(inet_hashinfo_init); - static void init_hashinfo_lhash2(struct inet_hashinfo *h) { int i; for (i = 0; i <= h->lhash2_mask; i++) { spin_lock_init(&h->lhash2[i].lock); - INIT_HLIST_HEAD(&h->lhash2[i].head); - h->lhash2[i].count = 0; + INIT_HLIST_NULLS_HEAD(&h->lhash2[i].nulls_head, + i + LISTENING_NULLS_BASE); } } diff -u linux-lowlatency-5.15.0/net/ipv4/ip_gre.c linux-lowlatency-5.15.0/net/ipv4/ip_gre.c --- linux-lowlatency-5.15.0/net/ipv4/ip_gre.c +++ linux-lowlatency-5.15.0/net/ipv4/ip_gre.c @@ -634,15 +634,18 @@ } if (dev->header_ops) { + int pull_len = tunnel->hlen + sizeof(struct iphdr); + if (skb_cow_head(skb, 0)) goto free_skb; tnl_params = (const struct iphdr *)skb->data; - /* Pull skb since ip_tunnel_xmit() needs skb->data pointing - * to gre header. - */ - skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); + if (!pskb_network_may_pull(skb, pull_len)) + goto free_skb; + + /* ip_tunnel_xmit() needs skb->data pointing to gre header. */ + skb_pull(skb, pull_len); skb_reset_mac_header(skb); if (skb->ip_summed == CHECKSUM_PARTIAL && diff -u linux-lowlatency-5.15.0/net/ipv4/route.c linux-lowlatency-5.15.0/net/ipv4/route.c --- linux-lowlatency-5.15.0/net/ipv4/route.c +++ linux-lowlatency-5.15.0/net/ipv4/route.c @@ -786,7 +786,7 @@ goto reject_redirect; } - n = __ipv4_neigh_lookup(rt->dst.dev, new_gw); + n = __ipv4_neigh_lookup(rt->dst.dev, (__force u32)new_gw); if (!n) n = neigh_create(&arp_tbl, &new_gw, rt->dst.dev); if (!IS_ERR(n)) { diff -u linux-lowlatency-5.15.0/net/ipv4/syncookies.c linux-lowlatency-5.15.0/net/ipv4/syncookies.c --- linux-lowlatency-5.15.0/net/ipv4/syncookies.c +++ linux-lowlatency-5.15.0/net/ipv4/syncookies.c @@ -43,7 +43,6 @@ * requested/supported by the syn/synack exchange. */ #define TSBITS 6 -#define TSMASK (((__u32)1 << TSBITS) - 1) static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport, u32 count, int c) @@ -64,27 +63,22 @@ */ u64 cookie_init_timestamp(struct request_sock *req, u64 now) { - struct inet_request_sock *ireq; - u32 ts, ts_now = tcp_ns_to_ts(now); + const struct inet_request_sock *ireq = inet_rsk(req); + u64 ts, ts_now = tcp_ns_to_ts(now); u32 options = 0; - ireq = inet_rsk(req); - options = ireq->wscale_ok ? ireq->snd_wscale : TS_OPT_WSCALE_MASK; if (ireq->sack_ok) options |= TS_OPT_SACK; if (ireq->ecn_ok) options |= TS_OPT_ECN; - ts = ts_now & ~TSMASK; + ts = (ts_now >> TSBITS) << TSBITS; ts |= options; - if (ts > ts_now) { - ts >>= TSBITS; - ts--; - ts <<= TSBITS; - ts |= options; - } - return (u64)ts * (NSEC_PER_SEC / TCP_TS_HZ); + if (ts > ts_now) + ts -= (1UL << TSBITS); + + return ts * (NSEC_PER_SEC / TCP_TS_HZ); } diff -u linux-lowlatency-5.15.0/net/ipv4/tcp.c linux-lowlatency-5.15.0/net/ipv4/tcp.c --- linux-lowlatency-5.15.0/net/ipv4/tcp.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp.c @@ -953,8 +953,10 @@ * importantly be able to generate EPOLLOUT for Edge Trigger epoll() * users. */ -void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb) +void tcp_remove_empty_skb(struct sock *sk) { + struct sk_buff *skb = tcp_write_queue_tail(sk); + if (skb && TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { tcp_unlink_write_queue(skb, sk); if (tcp_write_queue_empty(sk)) @@ -1107,7 +1109,7 @@ return copied; do_error: - tcp_remove_empty_skb(sk, tcp_write_queue_tail(sk)); + tcp_remove_empty_skb(sk); if (copied) goto out; out_err: @@ -1330,14 +1332,7 @@ if (copy > msg_data_left(msg)) copy = msg_data_left(msg); - /* Where to copy to? */ - if (skb_availroom(skb) > 0 && !zc) { - /* We have some space in skb head. Superb! */ - copy = min_t(int, copy, skb_availroom(skb)); - err = skb_add_data_nocache(sk, skb, &msg->msg_iter, copy); - if (err) - goto do_fault; - } else if (!zc) { + if (!zc) { bool merge = true; int i = skb_shinfo(skb)->nr_frags; struct page_frag *pfrag = sk_page_frag(sk); @@ -1436,9 +1431,7 @@ return copied + copied_syn; do_error: - skb = tcp_write_queue_tail(sk); -do_fault: - tcp_remove_empty_skb(sk, skb); + tcp_remove_empty_skb(sk); if (copied + copied_syn) goto out; @@ -4563,7 +4556,6 @@ timer_setup(&tcp_orphan_timer, tcp_orphan_update, TIMER_DEFERRABLE); mod_timer(&tcp_orphan_timer, jiffies + TCP_ORPHAN_TIMER_PERIOD); - inet_hashinfo_init(&tcp_hashinfo); inet_hashinfo2_init(&tcp_hashinfo, "tcp_listen_portaddr_hash", thash_entries, 21, /* one slot per 2 MB*/ 0, 64 * 1024); diff -u linux-lowlatency-5.15.0/net/ipv4/tcp_input.c linux-lowlatency-5.15.0/net/ipv4/tcp_input.c --- linux-lowlatency-5.15.0/net/ipv4/tcp_input.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp_input.c @@ -2195,16 +2195,17 @@ * restore sanity to the SACK scoreboard. If the apparent reneging * persists until this RTO then we'll clear the SACK scoreboard. */ -static bool tcp_check_sack_reneging(struct sock *sk, int flag) +static bool tcp_check_sack_reneging(struct sock *sk, int *ack_flag) { - if (flag & FLAG_SACK_RENEGING && - flag & FLAG_SND_UNA_ADVANCED) { + if (*ack_flag & FLAG_SACK_RENEGING && + *ack_flag & FLAG_SND_UNA_ADVANCED) { struct tcp_sock *tp = tcp_sk(sk); unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4), msecs_to_jiffies(10)); inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, delay, TCP_RTO_MAX); + *ack_flag &= ~FLAG_SET_XMIT_TIMER; return true; } return false; @@ -2974,7 +2975,7 @@ tp->prior_ssthresh = 0; /* B. In all the states check for reneging SACKs. */ - if (tcp_check_sack_reneging(sk, flag)) + if (tcp_check_sack_reneging(sk, ack_flag)) return; /* C. Check consistency of the current state. */ @@ -3795,8 +3796,12 @@ * then we can probably ignore it. */ if (before(ack, prior_snd_una)) { + u32 max_window; + + /* do not accept ACK for bytes we never sent. */ + max_window = min_t(u64, tp->max_window, tp->bytes_acked); /* RFC 5961 5.2 [Blind Data Injection Attack].[Mitigation] */ - if (before(ack, prior_snd_una - tp->max_window)) { + if (before(ack, prior_snd_una - max_window)) { if (!(flag & FLAG_NO_CHALLENGE_ACK)) tcp_send_challenge_ack(sk, skb); return -1; @@ -6375,22 +6380,23 @@ static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) { + struct tcp_sock *tp = tcp_sk(sk); struct request_sock *req; /* If we are still handling the SYNACK RTO, see if timestamp ECR allows * undo. If peer SACKs triggered fast recovery, we can't undo here. */ - if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss) - tcp_try_undo_loss(sk, false); + if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss && !tp->packets_out) + tcp_try_undo_recovery(sk); /* Reset rtx states to prevent spurious retransmits_timed_out() */ - tcp_sk(sk)->retrans_stamp = 0; + tp->retrans_stamp = 0; inet_csk(sk)->icsk_retransmits = 0; /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, * we no longer need req so release it. */ - req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, + req = rcu_dereference_protected(tp->fastopen_rsk, lockdep_sock_is_held(sk)); reqsk_fastopen_remove(sk, req, false); diff -u linux-lowlatency-5.15.0/net/ipv4/tcp_ipv4.c linux-lowlatency-5.15.0/net/ipv4/tcp_ipv4.c --- linux-lowlatency-5.15.0/net/ipv4/tcp_ipv4.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp_ipv4.c @@ -1863,6 +1863,7 @@ #ifdef CONFIG_TLS_DEVICE tail->decrypted != skb->decrypted || #endif + !mptcp_skb_can_collapse(tail, skb) || thtail->doff != th->doff || memcmp(thtail + 1, th + 1, hdrlen - sizeof(*th))) goto no_coalesce; @@ -2342,16 +2343,15 @@ st->offset = 0; for (; st->bucket <= tcp_hashinfo.lhash2_mask; st->bucket++) { struct inet_listen_hashbucket *ilb2; - struct inet_connection_sock *icsk; + struct hlist_nulls_node *node; struct sock *sk; ilb2 = &tcp_hashinfo.lhash2[st->bucket]; - if (hlist_empty(&ilb2->head)) + if (hlist_nulls_empty(&ilb2->nulls_head)) continue; spin_lock(&ilb2->lock); - inet_lhash2_for_each_icsk(icsk, &ilb2->head) { - sk = (struct sock *)icsk; + sk_nulls_for_each(sk, node, &ilb2->nulls_head) { if (seq_sk_match(seq, sk)) return sk; } @@ -2370,15 +2370,14 @@ { struct tcp_iter_state *st = seq->private; struct inet_listen_hashbucket *ilb2; - struct inet_connection_sock *icsk; + struct hlist_nulls_node *node; struct sock *sk = cur; ++st->num; ++st->offset; - icsk = inet_csk(sk); - inet_lhash2_for_each_icsk_continue(icsk) { - sk = (struct sock *)icsk; + sk = sk_nulls_next(sk); + sk_nulls_for_each_from(sk, node) { if (seq_sk_match(seq, sk)) return sk; } @@ -2787,16 +2786,15 @@ { struct bpf_tcp_iter_state *iter = seq->private; struct tcp_iter_state *st = &iter->state; - struct inet_connection_sock *icsk; + struct hlist_nulls_node *node; unsigned int expected = 1; struct sock *sk; sock_hold(start_sk); iter->batch[iter->end_sk++] = start_sk; - icsk = inet_csk(start_sk); - inet_lhash2_for_each_icsk_continue(icsk) { - sk = (struct sock *)icsk; + sk = sk_nulls_next(start_sk); + sk_nulls_for_each_from(sk, node) { if (seq_sk_match(seq, sk)) { if (iter->end_sk < iter->max_sk) { sock_hold(sk); diff -u linux-lowlatency-5.15.0/net/ipv4/tcp_metrics.c linux-lowlatency-5.15.0/net/ipv4/tcp_metrics.c --- linux-lowlatency-5.15.0/net/ipv4/tcp_metrics.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp_metrics.c @@ -470,11 +470,15 @@ u32 val, crtt = 0; /* cached RTT scaled by 8 */ sk_dst_confirm(sk); + /* ssthresh may have been reduced unnecessarily during. + * 3WHS. Restore it back to its initial default. + */ + tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; if (!dst) goto reset; rcu_read_lock(); - tm = tcp_get_metrics(sk, dst, true); + tm = tcp_get_metrics(sk, dst, false); if (!tm) { rcu_read_unlock(); goto reset; @@ -489,11 +493,6 @@ tp->snd_ssthresh = val; if (tp->snd_ssthresh > tp->snd_cwnd_clamp) tp->snd_ssthresh = tp->snd_cwnd_clamp; - } else { - /* ssthresh may have been reduced unnecessarily during. - * 3WHS. Restore it back to its initial default. - */ - tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; } val = tcp_metric_get(tm, TCP_METRIC_REORDERING); if (val && tp->reordering != val) @@ -908,7 +907,7 @@ match = net ? net_eq(tm_net(tm), net) : !refcount_read(&tm_net(tm)->ns.count); if (match) { - *pp = tm->tcpm_next; + rcu_assign_pointer(*pp, tm->tcpm_next); kfree_rcu(tm, rcu_head); } else { pp = &tm->tcpm_next; @@ -949,7 +948,7 @@ if (addr_same(&tm->tcpm_daddr, &daddr) && (!src || addr_same(&tm->tcpm_saddr, &saddr)) && net_eq(tm_net(tm), net)) { - *pp = tm->tcpm_next; + rcu_assign_pointer(*pp, tm->tcpm_next); kfree_rcu(tm, rcu_head); found = true; } else { diff -u linux-lowlatency-5.15.0/net/ipv4/tcp_output.c linux-lowlatency-5.15.0/net/ipv4/tcp_output.c --- linux-lowlatency-5.15.0/net/ipv4/tcp_output.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp_output.c @@ -1318,7 +1318,7 @@ skb->destructor = skb_is_tcp_pure_ack(skb) ? __sock_wfree : tcp_wfree; refcount_add(skb->truesize, &sk->sk_wmem_alloc); - skb_set_dst_pending_confirm(skb, sk->sk_dst_pending_confirm); + skb_set_dst_pending_confirm(skb, READ_ONCE(sk->sk_dst_pending_confirm)); /* Build TCP header and checksum it. */ th = (struct tcphdr *)skb->data; @@ -2486,6 +2486,18 @@ return true; } +static bool tcp_rtx_queue_empty_or_single_skb(const struct sock *sk) +{ + const struct rb_node *node = sk->tcp_rtx_queue.rb_node; + + /* No skb in the rtx queue. */ + if (!node) + return true; + + /* Only one skb in rtx queue. */ + return !node->rb_left && !node->rb_right; +} + /* TCP Small Queues : * Control number of packets in qdisc/devices to two packets / or ~1 ms. * (These limits are doubled for retransmits) @@ -2523,12 +2535,12 @@ limit += extra_bytes; } if (refcount_read(&sk->sk_wmem_alloc) > limit) { - /* Always send skb if rtx queue is empty. + /* Always send skb if rtx queue is empty or has one skb. * No need to wait for TX completion to call us back, * after softirq/tasklet schedule. * This helps when TX completions are delayed too much. */ - if (tcp_rtx_queue_empty(sk)) + if (tcp_rtx_queue_empty_or_single_skb(sk)) return false; set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags); @@ -2731,7 +2743,7 @@ { struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); - u32 timeout, rto_delta_us; + u32 timeout, timeout_us, rto_delta_us; int early_retrans; /* Don't do any loss probe on a Fast Open connection before 3WHS @@ -2755,11 +2767,12 @@ * sample is available then probe after TCP_TIMEOUT_INIT. */ if (tp->srtt_us) { - timeout = usecs_to_jiffies(tp->srtt_us >> 2); + timeout_us = tp->srtt_us >> 2; if (tp->packets_out == 1) - timeout += TCP_RTO_MIN; + timeout_us += tcp_rto_min_us(sk); else - timeout += TCP_TIMEOUT_MIN; + timeout_us += TCP_TIMEOUT_MIN_US; + timeout = usecs_to_jiffies(timeout_us); } else { timeout = TCP_TIMEOUT_INIT; } diff -u linux-lowlatency-5.15.0/net/ipv4/tcp_recovery.c linux-lowlatency-5.15.0/net/ipv4/tcp_recovery.c --- linux-lowlatency-5.15.0/net/ipv4/tcp_recovery.c +++ linux-lowlatency-5.15.0/net/ipv4/tcp_recovery.c @@ -109,7 +109,7 @@ tp->rack.advanced = 0; tcp_rack_detect_loss(sk, &timeout); if (timeout) { - timeout = usecs_to_jiffies(timeout) + TCP_TIMEOUT_MIN; + timeout = usecs_to_jiffies(timeout + TCP_TIMEOUT_MIN_US); inet_csk_reset_xmit_timer(sk, ICSK_TIME_REO_TIMEOUT, timeout, inet_csk(sk)->icsk_rto); } diff -u linux-lowlatency-5.15.0/net/ipv4/udp.c linux-lowlatency-5.15.0/net/ipv4/udp.c --- linux-lowlatency-5.15.0/net/ipv4/udp.c +++ linux-lowlatency-5.15.0/net/ipv4/udp.c @@ -2711,10 +2711,12 @@ case UDP_ENCAP_ESPINUDP_NON_IKE: #if IS_ENABLED(CONFIG_IPV6) if (sk->sk_family == AF_INET6) - up->encap_rcv = ipv6_stub->xfrm6_udp_encap_rcv; + WRITE_ONCE(up->encap_rcv, + ipv6_stub->xfrm6_udp_encap_rcv); else #endif - up->encap_rcv = xfrm4_udp_encap_rcv; + WRITE_ONCE(up->encap_rcv, + xfrm4_udp_encap_rcv); #endif fallthrough; case UDP_ENCAP_L2TPINUDP: diff -u linux-lowlatency-5.15.0/net/ipv6/esp6.c linux-lowlatency-5.15.0/net/ipv6/esp6.c --- linux-lowlatency-5.15.0/net/ipv6/esp6.c +++ linux-lowlatency-5.15.0/net/ipv6/esp6.c @@ -776,7 +776,9 @@ skb->csum = csum_block_sub(skb->csum, csumdiff, skb->len - trimlen); } - pskb_trim(skb, skb->len - trimlen); + ret = pskb_trim(skb, skb->len - trimlen); + if (unlikely(ret)) + return ret; ret = nexthdr[1]; diff -u linux-lowlatency-5.15.0/net/ipv6/inet6_hashtables.c linux-lowlatency-5.15.0/net/ipv6/inet6_hashtables.c --- linux-lowlatency-5.15.0/net/ipv6/inet6_hashtables.c +++ linux-lowlatency-5.15.0/net/ipv6/inet6_hashtables.c @@ -138,12 +138,11 @@ const __be16 sport, const struct in6_addr *daddr, const unsigned short hnum, const int dif, const int sdif) { - struct inet_connection_sock *icsk; struct sock *sk, *result = NULL; + struct hlist_nulls_node *node; int score, hiscore = 0; - inet_lhash2_for_each_icsk_rcu(icsk, &ilb2->head) { - sk = (struct sock *)icsk; + sk_nulls_for_each_rcu(sk, node, &ilb2->nulls_head) { score = compute_score(sk, net, hnum, daddr, dif, sdif); if (score > hiscore) { result = lookup_reuseport(net, sk, skb, doff, diff -u linux-lowlatency-5.15.0/net/ipv6/ip6_fib.c linux-lowlatency-5.15.0/net/ipv6/ip6_fib.c --- linux-lowlatency-5.15.0/net/ipv6/ip6_fib.c +++ linux-lowlatency-5.15.0/net/ipv6/ip6_fib.c @@ -1501,13 +1501,9 @@ if (!pn_leaf && !(pn->fn_flags & RTN_RTINFO)) { pn_leaf = fib6_find_prefix(info->nl_net, table, pn); -#if RT6_DEBUG >= 2 - if (!pn_leaf) { - WARN_ON(!pn_leaf); + if (!pn_leaf) pn_leaf = info->nl_net->ipv6.fib6_null_entry; - } -#endif fib6_info_hold(pn_leaf); rcu_assign_pointer(pn->leaf, pn_leaf); } diff -u linux-lowlatency-5.15.0/net/ipv6/ip6_output.c linux-lowlatency-5.15.0/net/ipv6/ip6_output.c --- linux-lowlatency-5.15.0/net/ipv6/ip6_output.c +++ linux-lowlatency-5.15.0/net/ipv6/ip6_output.c @@ -159,7 +159,13 @@ int err; skb_mark_not_on_list(segs); - err = ip6_fragment(net, sk, segs, ip6_finish_output2); + /* Last GSO segment can be smaller than gso_size (and MTU). + * Adding a fragment header would produce an "atomic fragment", + * which is considered harmful (RFC-8021). Avoid that. + */ + err = segs->len > mtu ? + ip6_fragment(net, sk, segs, ip6_finish_output2) : + ip6_finish_output2(net, sk, segs); if (err && ret == 0) ret = err; } diff -u linux-lowlatency-5.15.0/net/ipv6/syncookies.c linux-lowlatency-5.15.0/net/ipv6/syncookies.c --- linux-lowlatency-5.15.0/net/ipv6/syncookies.c +++ linux-lowlatency-5.15.0/net/ipv6/syncookies.c @@ -180,14 +180,15 @@ treq = tcp_rsk(req); treq->tfo_listener = false; - if (security_inet_conn_request(sk, skb, req)) - goto out_free; - req->mss = mss; ireq->ir_rmt_port = th->source; ireq->ir_num = ntohs(th->dest); ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; + + if (security_inet_conn_request(sk, skb, req)) + goto out_free; + if (ipv6_opt_accepted(sk, skb, &TCP_SKB_CB(skb)->header.h6) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { diff -u linux-lowlatency-5.15.0/net/ipv6/xfrm6_policy.c linux-lowlatency-5.15.0/net/ipv6/xfrm6_policy.c --- linux-lowlatency-5.15.0/net/ipv6/xfrm6_policy.c +++ linux-lowlatency-5.15.0/net/ipv6/xfrm6_policy.c @@ -120,11 +120,11 @@ { struct xfrm_dst *xdst = (struct xfrm_dst *)dst; - if (likely(xdst->u.rt6.rt6i_idev)) - in6_dev_put(xdst->u.rt6.rt6i_idev); dst_destroy_metrics_generic(dst); if (xdst->u.rt6.rt6i_uncached_list) rt6_uncached_list_del(&xdst->u.rt6); + if (likely(xdst->u.rt6.rt6i_idev)) + in6_dev_put(xdst->u.rt6.rt6i_idev); xfrm_dst_destroy(xdst); } diff -u linux-lowlatency-5.15.0/net/llc/llc_input.c linux-lowlatency-5.15.0/net/llc/llc_input.c --- linux-lowlatency-5.15.0/net/llc/llc_input.c +++ linux-lowlatency-5.15.0/net/llc/llc_input.c @@ -127,8 +127,14 @@ skb->transport_header += llc_len; skb_pull(skb, llc_len); if (skb->protocol == htons(ETH_P_802_2)) { - __be16 pdulen = eth_hdr(skb)->h_proto; - s32 data_size = ntohs(pdulen) - llc_len; + __be16 pdulen; + s32 data_size; + + if (skb->mac_len < ETH_HLEN) + return 0; + + pdulen = eth_hdr(skb)->h_proto; + data_size = ntohs(pdulen) - llc_len; if (data_size < 0 || !pskb_may_pull(skb, data_size)) diff -u linux-lowlatency-5.15.0/net/mac80211/cfg.c linux-lowlatency-5.15.0/net/mac80211/cfg.c --- linux-lowlatency-5.15.0/net/mac80211/cfg.c +++ linux-lowlatency-5.15.0/net/mac80211/cfg.c @@ -2762,6 +2762,10 @@ else *dbm = sdata->vif.bss_conf.txpower; + /* INT_MIN indicates no power level was set yet */ + if (*dbm == INT_MIN) + return -EINVAL; + return 0; } diff -u linux-lowlatency-5.15.0/net/mac80211/tx.c linux-lowlatency-5.15.0/net/mac80211/tx.c --- linux-lowlatency-5.15.0/net/mac80211/tx.c +++ linux-lowlatency-5.15.0/net/mac80211/tx.c @@ -644,7 +644,8 @@ } if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED && - !ieee80211_is_deauth(hdr->frame_control))) + !ieee80211_is_deauth(hdr->frame_control)) && + tx->skb->protocol != tx->sdata->control_port_protocol) return TX_DROP; if (!skip_hw && tx->key && diff -u linux-lowlatency-5.15.0/net/mctp/route.c linux-lowlatency-5.15.0/net/mctp/route.c --- linux-lowlatency-5.15.0/net/mctp/route.c +++ linux-lowlatency-5.15.0/net/mctp/route.c @@ -480,6 +480,10 @@ int rc = -EAGAIN; u8 tagbits; + /* for NULL destination EIDs, we may get a response from any peer */ + if (daddr == MCTP_ADDR_NULL) + daddr = MCTP_ADDR_ANY; + /* be optimistic, alloc now */ key = mctp_key_alloc(msk, saddr, daddr, 0, GFP_KERNEL); if (!key) @@ -545,6 +549,8 @@ { struct mctp_route *tmp, *rt = NULL; + rcu_read_lock(); + list_for_each_entry_rcu(tmp, &net->mctp.routes, list) { /* TODO: add metrics */ if (mctp_rt_match_eid(tmp, dnet, daddr)) { @@ -555,6 +561,28 @@ } } + rcu_read_unlock(); + + return rt; +} + +static struct mctp_route *mctp_route_lookup_null(struct net *net, + struct net_device *dev) +{ + struct mctp_route *tmp, *rt = NULL; + + rcu_read_lock(); + + list_for_each_entry_rcu(tmp, &net->mctp.routes, list) { + if (tmp->dev->dev == dev && tmp->type == RTN_LOCAL && + refcount_inc_not_zero(&tmp->refs)) { + rt = tmp; + break; + } + } + + rcu_read_unlock(); + return rt; } @@ -856,6 +884,11 @@ cb->net = READ_ONCE(mdev->net); rt = mctp_route_lookup(net, cb->net, mh->dest); + + /* NULL EID, but addressed to our physical address */ + if (!rt && mh->dest == MCTP_ADDR_NULL && skb->pkt_type == PACKET_HOST) + rt = mctp_route_lookup_null(net, dev); + if (!rt) goto err_drop; diff -u linux-lowlatency-5.15.0/net/mptcp/protocol.c linux-lowlatency-5.15.0/net/mptcp/protocol.c --- linux-lowlatency-5.15.0/net/mptcp/protocol.c +++ linux-lowlatency-5.15.0/net/mptcp/protocol.c @@ -1337,24 +1337,19 @@ if (copy == 0) { u64 snd_una = READ_ONCE(msk->snd_una); - if (snd_una != msk->snd_nxt) { - tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); + if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { + tcp_remove_empty_skb(ssk); return 0; } zero_window_probe = true; data_seq = snd_una - 1; copy = 1; - - /* all mptcp-level data is acked, no skbs should be present into the - * ssk write queue - */ - WARN_ON_ONCE(reuse_skb); } copy = min_t(size_t, copy, info->limit - info->sent); if (!sk_wmem_schedule(ssk, copy)) { - tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); + tcp_remove_empty_skb(ssk); return -ENOMEM; } @@ -1379,7 +1374,6 @@ if (reuse_skb) { TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; mpext->data_len += copy; - WARN_ON_ONCE(zero_window_probe); goto out; } diff -u linux-lowlatency-5.15.0/net/ncsi/ncsi-aen.c linux-lowlatency-5.15.0/net/ncsi/ncsi-aen.c --- linux-lowlatency-5.15.0/net/ncsi/ncsi-aen.c +++ linux-lowlatency-5.15.0/net/ncsi/ncsi-aen.c @@ -89,11 +89,6 @@ if ((had_link == has_link) || chained) return 0; - if (had_link) - netif_carrier_off(ndp->ndev.dev); - else - netif_carrier_on(ndp->ndev.dev); - if (!ndp->multi_package && !nc->package->multi_channel) { if (had_link) { ndp->flags |= NCSI_DEV_RESHUFFLE; diff -u linux-lowlatency-5.15.0/net/netfilter/ipset/ip_set_core.c linux-lowlatency-5.15.0/net/netfilter/ipset/ip_set_core.c --- linux-lowlatency-5.15.0/net/netfilter/ipset/ip_set_core.c +++ linux-lowlatency-5.15.0/net/netfilter/ipset/ip_set_core.c @@ -61,6 +61,8 @@ ip_set_dereference((inst)->ip_set_list)[id] #define ip_set_ref_netlink(inst,id) \ rcu_dereference_raw((inst)->ip_set_list)[id] +#define ip_set_dereference_nfnl(p) \ + rcu_dereference_check(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET)) /* The set types are implemented in modules and registered set types * can be found in ip_set_type_list. Adding/deleting types is @@ -708,15 +710,10 @@ static struct ip_set * ip_set_rcu_get(struct net *net, ip_set_id_t index) { - struct ip_set *set; struct ip_set_net *inst = ip_set_pernet(net); - rcu_read_lock(); - /* ip_set_list itself needs to be protected */ - set = rcu_dereference(inst->ip_set_list)[index]; - rcu_read_unlock(); - - return set; + /* ip_set_list and the set pointer need to be protected */ + return ip_set_dereference_nfnl(inst->ip_set_list)[index]; } static inline void @@ -1399,6 +1396,9 @@ ip_set(inst, to_id) = from; write_unlock_bh(&ip_set_ref_lock); + /* Make sure all readers of the old set pointers are completed. */ + synchronize_rcu(); + return 0; } diff -u linux-lowlatency-5.15.0/net/netfilter/nf_tables_api.c linux-lowlatency-5.15.0/net/netfilter/nf_tables_api.c --- linux-lowlatency-5.15.0/net/netfilter/nf_tables_api.c +++ linux-lowlatency-5.15.0/net/netfilter/nf_tables_api.c @@ -753,7 +753,7 @@ static struct nft_table *nft_table_lookup_byhandle(const struct net *net, const struct nlattr *nla, - u8 genmask, u32 nlpid) + int family, u8 genmask, u32 nlpid) { struct nftables_pernet *nft_net; struct nft_table *table; @@ -761,6 +761,7 @@ nft_net = nft_pernet(net); list_for_each_entry(table, &nft_net->tables, list) { if (be64_to_cpu(nla_get_be64(nla)) == table->handle && + table->family == family && nft_active_genmask(table, genmask)) { if (nft_table_has_owner(table) && nlpid && table->nlpid != nlpid) @@ -1485,7 +1486,7 @@ if (nla[NFTA_TABLE_HANDLE]) { attr = nla[NFTA_TABLE_HANDLE]; - table = nft_table_lookup_byhandle(net, attr, genmask, + table = nft_table_lookup_byhandle(net, attr, family, genmask, NETLINK_CB(skb).portid); } else { attr = nla[NFTA_TABLE_NAME]; @@ -3211,10 +3212,6 @@ goto cont_skip; if (*idx < s_idx) goto cont; - if (*idx > s_idx) { - memset(&cb->args[1], 0, - sizeof(cb->args) - sizeof(cb->args[0])); - } if (prule) handle = prule->handle; else @@ -9078,16 +9075,14 @@ call_rcu(&trans->rcu, nft_trans_gc_trans_free); } -static struct nft_trans_gc *nft_trans_gc_catchall(struct nft_trans_gc *gc, - unsigned int gc_seq, - bool sync) +struct nft_trans_gc *nft_trans_gc_catchall_async(struct nft_trans_gc *gc, + unsigned int gc_seq) { - struct nft_set_elem_catchall *catchall, *next; + struct nft_set_elem_catchall *catchall; const struct nft_set *set = gc->set; - struct nft_set_elem *elem; struct nft_set_ext *ext; - list_for_each_entry_safe(catchall, next, &set->catchall_list, list) { + list_for_each_entry_rcu(catchall, &set->catchall_list, list) { ext = nft_set_elem_ext(set, catchall->elem); if (!nft_set_elem_expired(ext)) @@ -9097,35 +9092,44 @@ nft_set_elem_dead(ext); dead_elem: - if (sync) - gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC); - else - gc = nft_trans_gc_queue_async(gc, gc_seq, GFP_ATOMIC); - + gc = nft_trans_gc_queue_async(gc, gc_seq, GFP_ATOMIC); if (!gc) return NULL; - elem = catchall->elem; - if (sync) { - nft_setelem_data_deactivate(gc->net, gc->set, elem); - nft_setelem_catchall_destroy(catchall); - } - - nft_trans_gc_elem_add(gc, elem->priv); + nft_trans_gc_elem_add(gc, catchall->elem); } return gc; } -struct nft_trans_gc *nft_trans_gc_catchall_async(struct nft_trans_gc *gc, - unsigned int gc_seq) -{ - return nft_trans_gc_catchall(gc, gc_seq, false); -} - struct nft_trans_gc *nft_trans_gc_catchall_sync(struct nft_trans_gc *gc) { - return nft_trans_gc_catchall(gc, 0, true); + struct nft_set_elem_catchall *catchall, *next; + const struct nft_set *set = gc->set; + struct nft_set_elem elem; + struct nft_set_ext *ext; + + WARN_ON_ONCE(!lockdep_commit_lock_is_held(gc->net)); + + list_for_each_entry_safe(catchall, next, &set->catchall_list, list) { + ext = nft_set_elem_ext(set, catchall->elem); + + if (!nft_set_elem_expired(ext)) + continue; + + gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL); + if (!gc) + return NULL; + + memset(&elem, 0, sizeof(elem)); + elem.priv = catchall->elem; + + nft_setelem_data_deactivate(gc->net, gc->set, &elem); + nft_setelem_catchall_destroy(catchall); + nft_trans_gc_elem_add(gc, elem.priv); + } + + return gc; } static void nf_tables_module_autoload_cleanup(struct net *net) diff -u linux-lowlatency-5.15.0/net/netfilter/nfnetlink_log.c linux-lowlatency-5.15.0/net/netfilter/nfnetlink_log.c --- linux-lowlatency-5.15.0/net/netfilter/nfnetlink_log.c +++ linux-lowlatency-5.15.0/net/netfilter/nfnetlink_log.c @@ -687,8 +687,8 @@ unsigned int plen = 0; struct nfnl_log_net *log = nfnl_log_pernet(net); const struct nfnl_ct_hook *nfnl_ct = NULL; + enum ip_conntrack_info ctinfo = 0; struct nf_conn *ct = NULL; - enum ip_conntrack_info ctinfo; if (li_user && li_user->type == NF_LOG_TYPE_ULOG) li = li_user; diff -u linux-lowlatency-5.15.0/net/netfilter/nft_byteorder.c linux-lowlatency-5.15.0/net/netfilter/nft_byteorder.c --- linux-lowlatency-5.15.0/net/netfilter/nft_byteorder.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_byteorder.c @@ -38,20 +38,22 @@ switch (priv->size) { case 8: { + u64 *dst64 = (void *)dst; u64 src64; switch (priv->op) { case NFT_BYTEORDER_NTOH: for (i = 0; i < priv->len / 8; i++) { src64 = nft_reg_load64(&src[i]); - nft_reg_store64(&dst[i], be64_to_cpu(src64)); + nft_reg_store64(&dst64[i], + be64_to_cpu((__force __be64)src64)); } break; case NFT_BYTEORDER_HTON: for (i = 0; i < priv->len / 8; i++) { src64 = (__force __u64) cpu_to_be64(nft_reg_load64(&src[i])); - nft_reg_store64(&dst[i], src64); + nft_reg_store64(&dst64[i], src64); } break; } diff -u linux-lowlatency-5.15.0/net/netfilter/nft_meta.c linux-lowlatency-5.15.0/net/netfilter/nft_meta.c --- linux-lowlatency-5.15.0/net/netfilter/nft_meta.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_meta.c @@ -63,7 +63,7 @@ { switch (key) { case NFT_META_TIME_NS: - nft_reg_store64(dest, ktime_get_real_ns()); + nft_reg_store64((u64 *)dest, ktime_get_real_ns()); break; case NFT_META_TIME_DAY: nft_reg_store8(dest, nft_meta_weekday()); diff -u linux-lowlatency-5.15.0/net/netfilter/nft_osf.c linux-lowlatency-5.15.0/net/netfilter/nft_osf.c --- linux-lowlatency-5.15.0/net/netfilter/nft_osf.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_osf.c @@ -99,7 +99,7 @@ if (nla_put_u8(skb, NFTA_OSF_TTL, priv->ttl)) goto nla_put_failure; - if (nla_put_be32(skb, NFTA_OSF_FLAGS, ntohl(priv->flags))) + if (nla_put_u32(skb, NFTA_OSF_FLAGS, ntohl((__force __be32)priv->flags))) goto nla_put_failure; if (nft_dump_register(skb, NFTA_OSF_DREG, priv->dreg)) diff -u linux-lowlatency-5.15.0/net/netfilter/nft_payload.c linux-lowlatency-5.15.0/net/netfilter/nft_payload.c --- linux-lowlatency-5.15.0/net/netfilter/nft_payload.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_payload.c @@ -133,7 +133,7 @@ switch (priv->base) { case NFT_PAYLOAD_LL_HEADER: - if (!skb_mac_header_was_set(skb)) + if (!skb_mac_header_was_set(skb) || skb_mac_header_len(skb) == 0) goto err; if (skb_vlan_tag_present(skb)) { diff -u linux-lowlatency-5.15.0/net/netfilter/nft_redir.c linux-lowlatency-5.15.0/net/netfilter/nft_redir.c --- linux-lowlatency-5.15.0/net/netfilter/nft_redir.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_redir.c @@ -64,6 +64,8 @@ } else { priv->sreg_proto_max = priv->sreg_proto_min; } + + priv->flags |= NF_NAT_RANGE_PROTO_SPECIFIED; } if (tb[NFTA_REDIR_FLAGS]) { @@ -98,25 +100,37 @@ return -1; } -static void nft_redir_ipv4_eval(const struct nft_expr *expr, - struct nft_regs *regs, - const struct nft_pktinfo *pkt) +static void nft_redir_eval(const struct nft_expr *expr, + struct nft_regs *regs, + const struct nft_pktinfo *pkt) { - struct nft_redir *priv = nft_expr_priv(expr); - struct nf_nat_ipv4_multi_range_compat mr; + const struct nft_redir *priv = nft_expr_priv(expr); + struct nf_nat_range2 range; - memset(&mr, 0, sizeof(mr)); + memset(&range, 0, sizeof(range)); + range.flags = priv->flags; if (priv->sreg_proto_min) { - mr.range[0].min.all = (__force __be16)nft_reg_load16( - ®s->data[priv->sreg_proto_min]); - mr.range[0].max.all = (__force __be16)nft_reg_load16( - ®s->data[priv->sreg_proto_max]); - mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED; + range.min_proto.all = (__force __be16) + nft_reg_load16(®s->data[priv->sreg_proto_min]); + range.max_proto.all = (__force __be16) + nft_reg_load16(®s->data[priv->sreg_proto_max]); } - mr.range[0].flags |= priv->flags; - - regs->verdict.code = nf_nat_redirect_ipv4(pkt->skb, &mr, nft_hook(pkt)); + switch (nft_pf(pkt)) { + case NFPROTO_IPV4: + regs->verdict.code = nf_nat_redirect_ipv4(pkt->skb, &range, + nft_hook(pkt)); + break; +#ifdef CONFIG_NF_TABLES_IPV6 + case NFPROTO_IPV6: + regs->verdict.code = nf_nat_redirect_ipv6(pkt->skb, &range, + nft_hook(pkt)); + break; +#endif + default: + WARN_ON_ONCE(1); + break; + } } static void @@ -129,7 +143,7 @@ static const struct nft_expr_ops nft_redir_ipv4_ops = { .type = &nft_redir_ipv4_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_redir)), - .eval = nft_redir_ipv4_eval, + .eval = nft_redir_eval, .init = nft_redir_init, .destroy = nft_redir_ipv4_destroy, .dump = nft_redir_dump, @@ -146,28 +160,6 @@ }; #ifdef CONFIG_NF_TABLES_IPV6 -static void nft_redir_ipv6_eval(const struct nft_expr *expr, - struct nft_regs *regs, - const struct nft_pktinfo *pkt) -{ - struct nft_redir *priv = nft_expr_priv(expr); - struct nf_nat_range2 range; - - memset(&range, 0, sizeof(range)); - if (priv->sreg_proto_min) { - range.min_proto.all = (__force __be16)nft_reg_load16( - ®s->data[priv->sreg_proto_min]); - range.max_proto.all = (__force __be16)nft_reg_load16( - ®s->data[priv->sreg_proto_max]); - range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; - } - - range.flags |= priv->flags; - - regs->verdict.code = - nf_nat_redirect_ipv6(pkt->skb, &range, nft_hook(pkt)); -} - static void nft_redir_ipv6_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) { @@ -178,7 +170,7 @@ static const struct nft_expr_ops nft_redir_ipv6_ops = { .type = &nft_redir_ipv6_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_redir)), - .eval = nft_redir_ipv6_eval, + .eval = nft_redir_eval, .init = nft_redir_init, .destroy = nft_redir_ipv6_destroy, .dump = nft_redir_dump, @@ -196,20 +188,6 @@ #endif #ifdef CONFIG_NF_TABLES_INET -static void nft_redir_inet_eval(const struct nft_expr *expr, - struct nft_regs *regs, - const struct nft_pktinfo *pkt) -{ - switch (nft_pf(pkt)) { - case NFPROTO_IPV4: - return nft_redir_ipv4_eval(expr, regs, pkt); - case NFPROTO_IPV6: - return nft_redir_ipv6_eval(expr, regs, pkt); - } - - WARN_ON_ONCE(1); -} - static void nft_redir_inet_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) { @@ -220,7 +198,7 @@ static const struct nft_expr_ops nft_redir_inet_ops = { .type = &nft_redir_inet_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_redir)), - .eval = nft_redir_inet_eval, + .eval = nft_redir_eval, .init = nft_redir_init, .destroy = nft_redir_inet_destroy, .dump = nft_redir_dump, diff -u linux-lowlatency-5.15.0/net/netfilter/nft_set_rbtree.c linux-lowlatency-5.15.0/net/netfilter/nft_set_rbtree.c --- linux-lowlatency-5.15.0/net/netfilter/nft_set_rbtree.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_set_rbtree.c @@ -568,6 +568,8 @@ nft_rbtree_interval_end(this)) { parent = parent->rb_right; continue; + } else if (nft_set_elem_expired(&rbe->ext)) { + break; } else if (!nft_set_elem_active(&rbe->ext, genmask)) { parent = parent->rb_left; continue; diff -u linux-lowlatency-5.15.0/net/netfilter/nft_socket.c linux-lowlatency-5.15.0/net/netfilter/nft_socket.c --- linux-lowlatency-5.15.0/net/netfilter/nft_socket.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_socket.c @@ -162,7 +162,7 @@ return -EOPNOTSUPP; } - priv->key = ntohl(nla_get_u32(tb[NFTA_SOCKET_KEY])); + priv->key = ntohl(nla_get_be32(tb[NFTA_SOCKET_KEY])); switch(priv->key) { case NFT_SOCKET_TRANSPARENT: case NFT_SOCKET_WILDCARD: @@ -178,7 +178,7 @@ if (!tb[NFTA_SOCKET_LEVEL]) return -EINVAL; - level = ntohl(nla_get_u32(tb[NFTA_SOCKET_LEVEL])); + level = ntohl(nla_get_be32(tb[NFTA_SOCKET_LEVEL])); if (level > 255) return -EOPNOTSUPP; @@ -200,12 +200,12 @@ { const struct nft_socket *priv = nft_expr_priv(expr); - if (nla_put_u32(skb, NFTA_SOCKET_KEY, htonl(priv->key))) + if (nla_put_be32(skb, NFTA_SOCKET_KEY, htonl(priv->key))) return -1; if (nft_dump_register(skb, NFTA_SOCKET_DREG, priv->dreg)) return -1; if (priv->key == NFT_SOCKET_CGROUPV2 && - nla_put_u32(skb, NFTA_SOCKET_LEVEL, htonl(priv->level))) + nla_put_be32(skb, NFTA_SOCKET_LEVEL, htonl(priv->level))) return -1; return 0; } diff -u linux-lowlatency-5.15.0/net/netfilter/nft_tproxy.c linux-lowlatency-5.15.0/net/netfilter/nft_tproxy.c --- linux-lowlatency-5.15.0/net/netfilter/nft_tproxy.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_tproxy.c @@ -52,11 +52,11 @@ skb->dev, NF_TPROXY_LOOKUP_ESTABLISHED); if (priv->sreg_addr) - taddr = regs->data[priv->sreg_addr]; + taddr = nft_reg_load_be32(®s->data[priv->sreg_addr]); taddr = nf_tproxy_laddr4(skb, taddr, iph->daddr); if (priv->sreg_port) - tport = nft_reg_load16(®s->data[priv->sreg_port]); + tport = nft_reg_load_be16(®s->data[priv->sreg_port]); if (!tport) tport = hp->dest; @@ -124,7 +124,7 @@ taddr = *nf_tproxy_laddr6(skb, &taddr, &iph->daddr); if (priv->sreg_port) - tport = nft_reg_load16(®s->data[priv->sreg_port]); + tport = nft_reg_load_be16(®s->data[priv->sreg_port]); if (!tport) tport = hp->dest; diff -u linux-lowlatency-5.15.0/net/netlink/genetlink.c linux-lowlatency-5.15.0/net/netlink/genetlink.c --- linux-lowlatency-5.15.0/net/netlink/genetlink.c +++ linux-lowlatency-5.15.0/net/netlink/genetlink.c @@ -1379,6 +1379,9 @@ if ((grp->flags & GENL_UNS_ADMIN_PERM) && !ns_capable(net->user_ns, CAP_NET_ADMIN)) ret = -EPERM; + if (grp->cap_sys_admin && + !ns_capable(net->user_ns, CAP_SYS_ADMIN)) + ret = -EPERM; break; } diff -u linux-lowlatency-5.15.0/net/packet/af_packet.c linux-lowlatency-5.15.0/net/packet/af_packet.c --- linux-lowlatency-5.15.0/net/packet/af_packet.c +++ linux-lowlatency-5.15.0/net/packet/af_packet.c @@ -4244,7 +4244,7 @@ struct sock *sk = sock->sk; if (sk) - atomic_inc(&pkt_sk(sk)->mapped); + atomic_long_inc(&pkt_sk(sk)->mapped); } static void packet_mm_close(struct vm_area_struct *vma) @@ -4254,7 +4254,7 @@ struct sock *sk = sock->sk; if (sk) - atomic_dec(&pkt_sk(sk)->mapped); + atomic_long_dec(&pkt_sk(sk)->mapped); } static const struct vm_operations_struct packet_mmap_ops = { @@ -4349,7 +4349,7 @@ err = -EBUSY; if (!closing) { - if (atomic_read(&po->mapped)) + if (atomic_long_read(&po->mapped)) goto out; if (packet_read_pending(rb)) goto out; @@ -4452,7 +4452,7 @@ err = -EBUSY; mutex_lock(&po->pg_vec_lock); - if (closing || atomic_read(&po->mapped) == 0) { + if (closing || atomic_long_read(&po->mapped) == 0) { err = 0; spin_lock_bh(&rb_queue->lock); swap(rb->pg_vec, pg_vec); @@ -4470,9 +4470,9 @@ po->prot_hook.func = (po->rx_ring.pg_vec) ? tpacket_rcv : packet_rcv; skb_queue_purge(rb_queue); - if (atomic_read(&po->mapped)) - pr_err("packet_mmap: vma is busy: %d\n", - atomic_read(&po->mapped)); + if (atomic_long_read(&po->mapped)) + pr_err("packet_mmap: vma is busy: %ld\n", + atomic_long_read(&po->mapped)); } mutex_unlock(&po->pg_vec_lock); @@ -4550,7 +4550,7 @@ } } - atomic_inc(&po->mapped); + atomic_long_inc(&po->mapped); vma->vm_ops = &packet_mmap_ops; err = 0; diff -u linux-lowlatency-5.15.0/net/packet/internal.h linux-lowlatency-5.15.0/net/packet/internal.h --- linux-lowlatency-5.15.0/net/packet/internal.h +++ linux-lowlatency-5.15.0/net/packet/internal.h @@ -126,7 +126,7 @@ __be16 num; struct packet_rollover *rollover; struct packet_mclist *mclist; - atomic_t mapped; + atomic_long_t mapped; enum tpacket_versions tp_version; unsigned int tp_hdrlen; unsigned int tp_reserve; diff -u linux-lowlatency-5.15.0/net/rose/af_rose.c linux-lowlatency-5.15.0/net/rose/af_rose.c --- linux-lowlatency-5.15.0/net/rose/af_rose.c +++ linux-lowlatency-5.15.0/net/rose/af_rose.c @@ -1307,9 +1307,11 @@ case TIOCINQ: { struct sk_buff *skb; long amount = 0L; - /* These two are safe on a single CPU system as only user tasks fiddle here */ + + spin_lock_irq(&sk->sk_receive_queue.lock); if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; + spin_unlock_irq(&sk->sk_receive_queue.lock); return put_user(amount, (unsigned int __user *) argp); } diff -u linux-lowlatency-5.15.0/net/sched/cls_u32.c linux-lowlatency-5.15.0/net/sched/cls_u32.c --- linux-lowlatency-5.15.0/net/sched/cls_u32.c +++ linux-lowlatency-5.15.0/net/sched/cls_u32.c @@ -364,7 +364,7 @@ idr_init(&root_ht->handle_idr); if (tp_c == NULL) { - tp_c = kzalloc(struct_size(tp_c, hlist->ht, 1), GFP_KERNEL); + tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL); if (tp_c == NULL) { kfree(root_ht); return -ENOBUFS; diff -u linux-lowlatency-5.15.0/net/sched/sch_hfsc.c linux-lowlatency-5.15.0/net/sched/sch_hfsc.c --- linux-lowlatency-5.15.0/net/sched/sch_hfsc.c +++ linux-lowlatency-5.15.0/net/sched/sch_hfsc.c @@ -903,6 +903,14 @@ cl->cl_flags |= HFSC_USC; } +static void +hfsc_upgrade_rt(struct hfsc_class *cl) +{ + cl->cl_fsc = cl->cl_rsc; + rtsc_init(&cl->cl_virtual, &cl->cl_fsc, cl->cl_vt, cl->cl_total); + cl->cl_flags |= HFSC_FSC; +} + static const struct nla_policy hfsc_policy[TCA_HFSC_MAX + 1] = { [TCA_HFSC_RSC] = { .len = sizeof(struct tc_service_curve) }, [TCA_HFSC_FSC] = { .len = sizeof(struct tc_service_curve) }, @@ -1012,10 +1020,6 @@ if (parent == NULL) return -ENOENT; } - if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) { - NL_SET_ERR_MSG(extack, "Invalid parent - parent class must have FSC"); - return -EINVAL; - } if (classid == 0 || TC_H_MAJ(classid ^ sch->handle) != 0) return -EINVAL; @@ -1068,6 +1072,12 @@ cl->cf_tree = RB_ROOT; sch_tree_lock(sch); + /* Check if the inner class is a misconfigured 'rt' */ + if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) { + NL_SET_ERR_MSG(extack, + "Forced curve change on parent 'rt' to 'sc'"); + hfsc_upgrade_rt(parent); + } qdisc_class_hash_insert(&q->clhash, &cl->cl_common); list_add_tail(&cl->siblings, &parent->children); if (parent->level == 0) diff -u linux-lowlatency-5.15.0/net/smc/af_smc.c linux-lowlatency-5.15.0/net/smc/af_smc.c --- linux-lowlatency-5.15.0/net/smc/af_smc.c +++ linux-lowlatency-5.15.0/net/smc/af_smc.c @@ -145,7 +145,7 @@ if (!smc->use_fallback) { rc = smc_close_active(smc); - sock_set_flag(sk, SOCK_DEAD); + smc_sock_set_flag(sk, SOCK_DEAD); sk->sk_shutdown |= SHUTDOWN_MASK; } else { if (sk->sk_state != SMC_CLOSED) { @@ -398,8 +398,12 @@ struct smc_llc_qentry *qentry; int rc; - /* receive CONFIRM LINK request from server over RoCE fabric */ - qentry = smc_llc_wait(link->lgr, NULL, SMC_LLC_WAIT_TIME, + /* Receive CONFIRM LINK request from server over RoCE fabric. + * Increasing the client's timeout by twice as much as the server's + * timeout by default can temporarily avoid decline messages of + * both sides crossing or colliding + */ + qentry = smc_llc_wait(link->lgr, NULL, 2 * SMC_LLC_WAIT_TIME, SMC_LLC_CONFIRM_LINK); if (!qentry) { struct smc_clc_msg_decline dclc; @@ -1462,7 +1466,7 @@ if (new_clcsock) sock_release(new_clcsock); new_sk->sk_state = SMC_CLOSED; - sock_set_flag(new_sk, SOCK_DEAD); + smc_sock_set_flag(new_sk, SOCK_DEAD); sock_put(new_sk); /* final */ *new_smc = NULL; goto out; diff -u linux-lowlatency-5.15.0/net/smc/smc.h linux-lowlatency-5.15.0/net/smc/smc.h --- linux-lowlatency-5.15.0/net/smc/smc.h +++ linux-lowlatency-5.15.0/net/smc/smc.h @@ -332,2 +332,7 @@ +static inline void smc_sock_set_flag(struct sock *sk, enum sock_flags flag) +{ + set_bit(flag, &sk->sk_flags); +} + #endif /* __SMC_H */ diff -u linux-lowlatency-5.15.0/net/smc/smc_cdc.c linux-lowlatency-5.15.0/net/smc/smc_cdc.c --- linux-lowlatency-5.15.0/net/smc/smc_cdc.c +++ linux-lowlatency-5.15.0/net/smc/smc_cdc.c @@ -28,13 +28,15 @@ { struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd; struct smc_connection *conn = cdcpend->conn; + struct smc_buf_desc *sndbuf_desc; struct smc_sock *smc; int diff; + sndbuf_desc = conn->sndbuf_desc; smc = container_of(conn, struct smc_sock, conn); bh_lock_sock(&smc->sk); - if (!wc_status) { - diff = smc_curs_diff(cdcpend->conn->sndbuf_desc->len, + if (!wc_status && sndbuf_desc) { + diff = smc_curs_diff(sndbuf_desc->len, &cdcpend->conn->tx_curs_fin, &cdcpend->cursor); /* sndbuf_space is decreased in smc_sendmsg */ @@ -104,9 +106,6 @@ union smc_host_cursor cfed; int rc; - if (unlikely(!READ_ONCE(conn->sndbuf_desc))) - return -ENOBUFS; - smc_cdc_add_pending_send(conn, pend); conn->tx_cdc_seq++; @@ -370,7 +369,7 @@ smc->sk.sk_shutdown |= RCV_SHUTDOWN; if (smc->clcsock && smc->clcsock->sk) smc->clcsock->sk->sk_shutdown |= RCV_SHUTDOWN; - sock_set_flag(&smc->sk, SOCK_DONE); + smc_sock_set_flag(&smc->sk, SOCK_DONE); sock_hold(&smc->sk); /* sock_put in close_work */ if (!queue_work(smc_close_wq, &conn->close_work)) sock_put(&smc->sk); diff -u linux-lowlatency-5.15.0/net/smc/smc_close.c linux-lowlatency-5.15.0/net/smc/smc_close.c --- linux-lowlatency-5.15.0/net/smc/smc_close.c +++ linux-lowlatency-5.15.0/net/smc/smc_close.c @@ -113,7 +113,8 @@ struct sock *sk = &smc->sk; release_sock(sk); - cancel_work_sync(&smc->conn.close_work); + if (cancel_work_sync(&smc->conn.close_work)) + sock_put(sk); cancel_delayed_work_sync(&smc->conn.tx_work); lock_sock(sk); } @@ -170,7 +171,7 @@ break; } - sock_set_flag(sk, SOCK_DEAD); + smc_sock_set_flag(sk, SOCK_DEAD); sk->sk_state_change(sk); if (release_clcsock) { diff -u linux-lowlatency-5.15.0/net/sunrpc/clnt.c linux-lowlatency-5.15.0/net/sunrpc/clnt.c --- linux-lowlatency-5.15.0/net/sunrpc/clnt.c +++ linux-lowlatency-5.15.0/net/sunrpc/clnt.c @@ -111,7 +111,8 @@ pipefs_sb = rpc_get_sb_net(net); if (pipefs_sb) { - __rpc_clnt_remove_pipedir(clnt); + if (pipefs_sb == clnt->pipefs_sb) + __rpc_clnt_remove_pipedir(clnt); rpc_put_sb_net(net); } } @@ -151,6 +152,8 @@ { struct dentry *dentry; + clnt->pipefs_sb = pipefs_sb; + if (clnt->cl_program->pipe_dir_name != NULL) { dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt); if (IS_ERR(dentry)) @@ -2088,6 +2091,7 @@ task->tk_status = 0; switch (status) { case -ECONNREFUSED: + case -ECONNRESET: /* A positive refusal suggests a rebind is needed. */ if (RPC_IS_SOFTCONN(task)) break; @@ -2096,7 +2100,6 @@ goto out_retry; } fallthrough; - case -ECONNRESET: case -ECONNABORTED: case -ENETDOWN: case -ENETUNREACH: diff -u linux-lowlatency-5.15.0/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c linux-lowlatency-5.15.0/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c --- linux-lowlatency-5.15.0/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ linux-lowlatency-5.15.0/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -852,7 +852,8 @@ if (ret == -EINVAL) svc_rdma_send_error(rdma_xprt, ctxt, ret); svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); - return ret; + svc_xprt_deferred_close(xprt); + return -ENOTCONN; out_backchannel: svc_rdma_handle_bc_reply(rqstp, ctxt); diff -u linux-lowlatency-5.15.0/net/tipc/link.c linux-lowlatency-5.15.0/net/tipc/link.c --- linux-lowlatency-5.15.0/net/tipc/link.c +++ linux-lowlatency-5.15.0/net/tipc/link.c @@ -1445,7 +1445,7 @@ p = (struct tipc_gap_ack_blks *)msg_data(hdr); sz = ntohs(p->len); /* Sanity check */ - if (sz == struct_size(p, gacks, p->ugack_cnt + p->bgack_cnt)) { + if (sz == struct_size(p, gacks, size_add(p->ugack_cnt, p->bgack_cnt))) { /* Good, check if the desired type exists */ if ((uc && p->ugack_cnt) || (!uc && p->bgack_cnt)) goto ok; @@ -1532,7 +1532,7 @@ __tipc_build_gap_ack_blks(ga, l, ga->bgack_cnt) : 0; /* Total len */ - len = struct_size(ga, gacks, ga->bgack_cnt + ga->ugack_cnt); + len = struct_size(ga, gacks, size_add(ga->bgack_cnt, ga->ugack_cnt)); ga->len = htons(len); return len; } diff -u linux-lowlatency-5.15.0/net/tipc/netlink_compat.c linux-lowlatency-5.15.0/net/tipc/netlink_compat.c --- linux-lowlatency-5.15.0/net/tipc/netlink_compat.c +++ linux-lowlatency-5.15.0/net/tipc/netlink_compat.c @@ -101,6 +101,7 @@ return -EMSGSIZE; skb_put(skb, TLV_SPACE(len)); + memset(tlv, 0, TLV_SPACE(len)); tlv->tlv_type = htons(type); tlv->tlv_len = htons(TLV_LENGTH(len)); if (len && data) diff -u linux-lowlatency-5.15.0/net/unix/af_unix.c linux-lowlatency-5.15.0/net/unix/af_unix.c --- linux-lowlatency-5.15.0/net/unix/af_unix.c +++ linux-lowlatency-5.15.0/net/unix/af_unix.c @@ -2529,15 +2529,16 @@ if (!(state->flags & MSG_PEEK)) WRITE_ONCE(u->oob_skb, NULL); - + else + skb_get(oob_skb); unix_state_unlock(sk); chunk = state->recv_actor(oob_skb, 0, chunk, state); - if (!(state->flags & MSG_PEEK)) { + if (!(state->flags & MSG_PEEK)) UNIXCB(oob_skb).consumed += 1; - kfree_skb(oob_skb); - } + + consume_skb(oob_skb); mutex_unlock(&u->iolock); diff -u linux-lowlatency-5.15.0/net/vmw_vsock/virtio_transport.c linux-lowlatency-5.15.0/net/vmw_vsock/virtio_transport.c --- linux-lowlatency-5.15.0/net/vmw_vsock/virtio_transport.c +++ linux-lowlatency-5.15.0/net/vmw_vsock/virtio_transport.c @@ -566,69 +566,35 @@ mutex_unlock(&vsock->rx_lock); } -static int virtio_vsock_probe(struct virtio_device *vdev) +static int virtio_vsock_vqs_init(struct virtio_vsock *vsock) { - vq_callback_t *callbacks[] = { - virtio_vsock_rx_done, - virtio_vsock_tx_done, - virtio_vsock_event_done, - }; + struct virtio_device *vdev = vsock->vdev; static const char * const names[] = { "rx", "tx", "event", }; - struct virtio_vsock *vsock = NULL; + vq_callback_t *callbacks[] = { + virtio_vsock_rx_done, + virtio_vsock_tx_done, + virtio_vsock_event_done, + }; int ret; - ret = mutex_lock_interruptible(&the_virtio_vsock_mutex); - if (ret) - return ret; - - /* Only one virtio-vsock device per guest is supported */ - if (rcu_dereference_protected(the_virtio_vsock, - lockdep_is_held(&the_virtio_vsock_mutex))) { - ret = -EBUSY; - goto out; - } - - vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); - if (!vsock) { - ret = -ENOMEM; - goto out; - } - - vsock->vdev = vdev; - - ret = virtio_find_vqs(vsock->vdev, VSOCK_VQ_MAX, - vsock->vqs, callbacks, names, + ret = virtio_find_vqs(vdev, VSOCK_VQ_MAX, vsock->vqs, callbacks, names, NULL); if (ret < 0) - goto out; + return ret; virtio_vsock_update_guest_cid(vsock); - vsock->rx_buf_nr = 0; - vsock->rx_buf_max_nr = 0; - atomic_set(&vsock->queued_replies, 0); - - mutex_init(&vsock->tx_lock); - mutex_init(&vsock->rx_lock); - mutex_init(&vsock->event_lock); - spin_lock_init(&vsock->send_pkt_list_lock); - INIT_LIST_HEAD(&vsock->send_pkt_list); - INIT_WORK(&vsock->rx_work, virtio_transport_rx_work); - INIT_WORK(&vsock->tx_work, virtio_transport_tx_work); - INIT_WORK(&vsock->event_work, virtio_transport_event_work); - INIT_WORK(&vsock->send_pkt_work, virtio_transport_send_pkt_work); - - if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET)) - vsock->seqpacket_allow = true; - - vdev->priv = vsock; - virtio_device_ready(vdev); + return 0; +} + +static void virtio_vsock_vqs_start(struct virtio_vsock *vsock) +{ mutex_lock(&vsock->tx_lock); vsock->tx_run = true; mutex_unlock(&vsock->tx_lock); @@ -643,30 +609,24 @@ vsock->event_run = true; mutex_unlock(&vsock->event_lock); - rcu_assign_pointer(the_virtio_vsock, vsock); - - mutex_unlock(&the_virtio_vsock_mutex); - - return 0; - -out: - kfree(vsock); - mutex_unlock(&the_virtio_vsock_mutex); - return ret; + /* virtio_transport_send_pkt() can queue packets once + * the_virtio_vsock is set, but they won't be processed until + * vsock->tx_run is set to true. We queue vsock->send_pkt_work + * when initialization finishes to send those packets queued + * earlier. + * We don't need to queue the other workers (rx, event) because + * as long as we don't fill the queues with empty buffers, the + * host can't send us any notification. + */ + queue_work(virtio_vsock_workqueue, &vsock->send_pkt_work); } -static void virtio_vsock_remove(struct virtio_device *vdev) +static void virtio_vsock_vqs_del(struct virtio_vsock *vsock) { - struct virtio_vsock *vsock = vdev->priv; + struct virtio_device *vdev = vsock->vdev; struct virtio_vsock_pkt *pkt; - mutex_lock(&the_virtio_vsock_mutex); - - vdev->priv = NULL; - rcu_assign_pointer(the_virtio_vsock, NULL); - synchronize_rcu(); - - /* Reset all connected sockets when the device disappear */ + /* Reset all connected sockets when the VQs disappear */ vsock_for_each_connected_socket(&virtio_transport.transport, virtio_vsock_reset_sock); @@ -711,6 +671,79 @@ /* Delete virtqueues and flush outstanding callbacks if any */ vdev->config->del_vqs(vdev); +} + +static int virtio_vsock_probe(struct virtio_device *vdev) +{ + struct virtio_vsock *vsock = NULL; + int ret; + + ret = mutex_lock_interruptible(&the_virtio_vsock_mutex); + if (ret) + return ret; + + /* Only one virtio-vsock device per guest is supported */ + if (rcu_dereference_protected(the_virtio_vsock, + lockdep_is_held(&the_virtio_vsock_mutex))) { + ret = -EBUSY; + goto out; + } + + vsock = kzalloc(sizeof(*vsock), GFP_KERNEL); + if (!vsock) { + ret = -ENOMEM; + goto out; + } + + vsock->vdev = vdev; + + vsock->rx_buf_nr = 0; + vsock->rx_buf_max_nr = 0; + atomic_set(&vsock->queued_replies, 0); + + mutex_init(&vsock->tx_lock); + mutex_init(&vsock->rx_lock); + mutex_init(&vsock->event_lock); + spin_lock_init(&vsock->send_pkt_list_lock); + INIT_LIST_HEAD(&vsock->send_pkt_list); + INIT_WORK(&vsock->rx_work, virtio_transport_rx_work); + INIT_WORK(&vsock->tx_work, virtio_transport_tx_work); + INIT_WORK(&vsock->event_work, virtio_transport_event_work); + INIT_WORK(&vsock->send_pkt_work, virtio_transport_send_pkt_work); + + if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET)) + vsock->seqpacket_allow = true; + + vdev->priv = vsock; + + ret = virtio_vsock_vqs_init(vsock); + if (ret < 0) + goto out; + + rcu_assign_pointer(the_virtio_vsock, vsock); + virtio_vsock_vqs_start(vsock); + + mutex_unlock(&the_virtio_vsock_mutex); + + return 0; + +out: + kfree(vsock); + mutex_unlock(&the_virtio_vsock_mutex); + return ret; +} + +static void virtio_vsock_remove(struct virtio_device *vdev) +{ + struct virtio_vsock *vsock = vdev->priv; + + mutex_lock(&the_virtio_vsock_mutex); + + vdev->priv = NULL; + rcu_assign_pointer(the_virtio_vsock, NULL); + synchronize_rcu(); + + virtio_vsock_vqs_del(vsock); /* Other works can be queued before 'config->del_vqs()', so we flush * all works before to free the vsock object to avoid use after free. @@ -725,6 +758,50 @@ kfree(vsock); } +#ifdef CONFIG_PM_SLEEP +static int virtio_vsock_freeze(struct virtio_device *vdev) +{ + struct virtio_vsock *vsock = vdev->priv; + + mutex_lock(&the_virtio_vsock_mutex); + + rcu_assign_pointer(the_virtio_vsock, NULL); + synchronize_rcu(); + + virtio_vsock_vqs_del(vsock); + + mutex_unlock(&the_virtio_vsock_mutex); + + return 0; +} + +static int virtio_vsock_restore(struct virtio_device *vdev) +{ + struct virtio_vsock *vsock = vdev->priv; + int ret; + + mutex_lock(&the_virtio_vsock_mutex); + + /* Only one virtio-vsock device per guest is supported */ + if (rcu_dereference_protected(the_virtio_vsock, + lockdep_is_held(&the_virtio_vsock_mutex))) { + ret = -EBUSY; + goto out; + } + + ret = virtio_vsock_vqs_init(vsock); + if (ret < 0) + goto out; + + rcu_assign_pointer(the_virtio_vsock, vsock); + virtio_vsock_vqs_start(vsock); + +out: + mutex_unlock(&the_virtio_vsock_mutex); + return ret; +} +#endif /* CONFIG_PM_SLEEP */ + static struct virtio_device_id id_table[] = { { VIRTIO_ID_VSOCK, VIRTIO_DEV_ANY_ID }, { 0 }, @@ -742,6 +819,10 @@ .id_table = id_table, .probe = virtio_vsock_probe, .remove = virtio_vsock_remove, +#ifdef CONFIG_PM_SLEEP + .freeze = virtio_vsock_freeze, + .restore = virtio_vsock_restore, +#endif }; static int __init virtio_vsock_init(void) diff -u linux-lowlatency-5.15.0/net/wireless/nl80211.c linux-lowlatency-5.15.0/net/wireless/nl80211.c --- linux-lowlatency-5.15.0/net/wireless/nl80211.c +++ linux-lowlatency-5.15.0/net/wireless/nl80211.c @@ -7664,7 +7664,7 @@ struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; - struct mesh_config cfg; + struct mesh_config cfg = {}; u32 mask; int err; diff -u linux-lowlatency-5.15.0/net/wireless/scan.c linux-lowlatency-5.15.0/net/wireless/scan.c --- linux-lowlatency-5.15.0/net/wireless/scan.c +++ linux-lowlatency-5.15.0/net/wireless/scan.c @@ -874,6 +874,10 @@ !cfg80211_find_ssid_match(ap, request)) continue; + if (!is_broadcast_ether_addr(request->bssid) && + !ether_addr_equal(request->bssid, ap->bssid)) + continue; + if (!request->n_ssids && ap->multi_bss && !ap->transmitted_bssid) continue; diff -u linux-lowlatency-5.15.0/net/xfrm/xfrm_interface_core.c linux-lowlatency-5.15.0/net/xfrm/xfrm_interface_core.c --- linux-lowlatency-5.15.0/net/xfrm/xfrm_interface_core.c +++ linux-lowlatency-5.15.0/net/xfrm/xfrm_interface_core.c @@ -274,8 +274,8 @@ skb->dev = dev; if (err) { - dev->stats.rx_errors++; - dev->stats.rx_dropped++; + DEV_STATS_INC(dev, rx_errors); + DEV_STATS_INC(dev, rx_dropped); return 0; } @@ -309,7 +309,6 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) { struct xfrm_if *xi = netdev_priv(dev); - struct net_device_stats *stats = &xi->dev->stats; struct dst_entry *dst = skb_dst(skb); unsigned int length = skb->len; struct net_device *tdev; @@ -335,7 +334,7 @@ tdev = dst->dev; if (tdev == dev) { - stats->collisions++; + DEV_STATS_INC(dev, collisions); net_warn_ratelimited("%s: Local routing loop detected!\n", dev->name); goto tx_err_dst_release; @@ -374,13 +373,13 @@ if (net_xmit_eval(err) == 0) { dev_sw_netstats_tx_add(dev, 1, length); } else { - stats->tx_errors++; - stats->tx_aborted_errors++; + DEV_STATS_INC(dev, tx_errors); + DEV_STATS_INC(dev, tx_aborted_errors); } return 0; tx_err_link_failure: - stats->tx_carrier_errors++; + DEV_STATS_INC(dev, tx_carrier_errors); dst_link_failure(skb); tx_err_dst_release: dst_release(dst); @@ -390,7 +389,6 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) { struct xfrm_if *xi = netdev_priv(dev); - struct net_device_stats *stats = &xi->dev->stats; struct dst_entry *dst = skb_dst(skb); struct flowi fl; int ret; @@ -407,7 +405,7 @@ dst = ip6_route_output(dev_net(dev), NULL, &fl.u.ip6); if (dst->error) { dst_release(dst); - stats->tx_carrier_errors++; + DEV_STATS_INC(dev, tx_carrier_errors); goto tx_err; } skb_dst_set(skb, dst); @@ -423,7 +421,7 @@ fl.u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; rt = __ip_route_output_key(dev_net(dev), &fl.u.ip4); if (IS_ERR(rt)) { - stats->tx_carrier_errors++; + DEV_STATS_INC(dev, tx_carrier_errors); goto tx_err; } skb_dst_set(skb, &rt->dst); @@ -442,8 +440,8 @@ return NETDEV_TX_OK; tx_err: - stats->tx_errors++; - stats->tx_dropped++; + DEV_STATS_INC(dev, tx_errors); + DEV_STATS_INC(dev, tx_dropped); kfree_skb(skb); return NETDEV_TX_OK; } diff -u linux-lowlatency-5.15.0/net/xfrm/xfrm_policy.c linux-lowlatency-5.15.0/net/xfrm/xfrm_policy.c --- linux-lowlatency-5.15.0/net/xfrm/xfrm_policy.c +++ linux-lowlatency-5.15.0/net/xfrm/xfrm_policy.c @@ -1371,8 +1371,6 @@ * of an absolute inpredictability of ordering of rules. This will not pass. */ static u32 xfrm_gen_index(struct net *net, int dir, u32 index) { - static u32 idx_generator; - for (;;) { struct hlist_head *list; struct xfrm_policy *p; @@ -1380,8 +1378,8 @@ int found; if (!index) { - idx = (idx_generator | dir); - idx_generator += 8; + idx = (net->xfrm.idx_generator | dir); + net->xfrm.idx_generator += 8; } else { idx = index; index = 0; diff -u linux-lowlatency-5.15.0/scripts/mod/file2alias.c linux-lowlatency-5.15.0/scripts/mod/file2alias.c --- linux-lowlatency-5.15.0/scripts/mod/file2alias.c +++ linux-lowlatency-5.15.0/scripts/mod/file2alias.c @@ -1339,13 +1339,13 @@ /* Looks like: tee:uuid */ static int do_tee_entry(const char *filename, void *symval, char *alias) { - DEF_FIELD(symval, tee_client_device_id, uuid); + DEF_FIELD_ADDR(symval, tee_client_device_id, uuid); sprintf(alias, "tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uuid.b[0], uuid.b[1], uuid.b[2], uuid.b[3], uuid.b[4], - uuid.b[5], uuid.b[6], uuid.b[7], uuid.b[8], uuid.b[9], - uuid.b[10], uuid.b[11], uuid.b[12], uuid.b[13], uuid.b[14], - uuid.b[15]); + uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4], + uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9], + uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14], + uuid->b[15]); add_wildcard(alias); return 1; diff -u linux-lowlatency-5.15.0/security/integrity/iint.c linux-lowlatency-5.15.0/security/integrity/iint.c --- linux-lowlatency-5.15.0/security/integrity/iint.c +++ linux-lowlatency-5.15.0/security/integrity/iint.c @@ -66,9 +66,32 @@ return iint; } -static void iint_free(struct integrity_iint_cache *iint) +#define IMA_MAX_NESTING (FILESYSTEM_MAX_STACK_DEPTH+1) + +/* + * It is not clear that IMA should be nested at all, but as long is it measures + * files both on overlayfs and on underlying fs, we need to annotate the iint + * mutex to avoid lockdep false positives related to IMA + overlayfs. + * See ovl_lockdep_annotate_inode_mutex_key() for more details. + */ +static inline void iint_lockdep_annotate(struct integrity_iint_cache *iint, + struct inode *inode) +{ +#ifdef CONFIG_LOCKDEP + static struct lock_class_key iint_mutex_key[IMA_MAX_NESTING]; + + int depth = inode->i_sb->s_stack_depth; + + if (WARN_ON_ONCE(depth < 0 || depth >= IMA_MAX_NESTING)) + depth = 0; + + lockdep_set_class(&iint->mutex, &iint_mutex_key[depth]); +#endif +} + +static void iint_init_always(struct integrity_iint_cache *iint, + struct inode *inode) { - kfree(iint->ima_hash); iint->ima_hash = NULL; iint->version = 0; iint->flags = 0UL; @@ -80,6 +103,14 @@ iint->ima_creds_status = INTEGRITY_UNKNOWN; iint->evm_status = INTEGRITY_UNKNOWN; iint->measured_pcrs = 0; + mutex_init(&iint->mutex); + iint_lockdep_annotate(iint, inode); +} + +static void iint_free(struct integrity_iint_cache *iint) +{ + kfree(iint->ima_hash); + mutex_destroy(&iint->mutex); kmem_cache_free(iint_cache, iint); } @@ -112,6 +143,8 @@ if (!iint) return NULL; + iint_init_always(iint, inode); + write_lock(&integrity_iint_lock); p = &integrity_iint_tree.rb_node; @@ -161,25 +194,18 @@ iint_free(iint); } -static void init_once(void *foo) +static void iint_init_once(void *foo) { struct integrity_iint_cache *iint = (struct integrity_iint_cache *) foo; memset(iint, 0, sizeof(*iint)); - iint->ima_file_status = INTEGRITY_UNKNOWN; - iint->ima_mmap_status = INTEGRITY_UNKNOWN; - iint->ima_bprm_status = INTEGRITY_UNKNOWN; - iint->ima_read_status = INTEGRITY_UNKNOWN; - iint->ima_creds_status = INTEGRITY_UNKNOWN; - iint->evm_status = INTEGRITY_UNKNOWN; - mutex_init(&iint->mutex); } static int __init integrity_iintcache_init(void) { iint_cache = kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache), - 0, SLAB_PANIC, init_once); + 0, SLAB_PANIC, iint_init_once); return 0; } DEFINE_LSM(integrity) = { diff -u linux-lowlatency-5.15.0/security/integrity/ima/ima_api.c linux-lowlatency-5.15.0/security/integrity/ima/ima_api.c --- linux-lowlatency-5.15.0/security/integrity/ima/ima_api.c +++ linux-lowlatency-5.15.0/security/integrity/ima/ima_api.c @@ -216,6 +216,7 @@ { const char *audit_cause = "failed"; struct inode *inode = file_inode(file); + struct inode *real_inode = d_real_inode(file_dentry(file)); const char *filename = file->f_path.dentry->d_name.name; int result = 0; int length; @@ -266,6 +267,10 @@ iint->ima_hash = tmpbuf; memcpy(iint->ima_hash, &hash, length); iint->version = i_version; + if (real_inode != inode) { + iint->real_ino = real_inode->i_ino; + iint->real_dev = real_inode->i_sb->s_dev; + } /* Possibly temporary failure due to type of read (eg. O_DIRECT) */ if (!result) diff -u linux-lowlatency-5.15.0/security/integrity/ima/ima_main.c linux-lowlatency-5.15.0/security/integrity/ima/ima_main.c --- linux-lowlatency-5.15.0/security/integrity/ima/ima_main.c +++ linux-lowlatency-5.15.0/security/integrity/ima/ima_main.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "ima.h" @@ -202,7 +203,7 @@ struct lsmblob *blob, char *buf, loff_t size, int mask, enum ima_hooks func) { - struct inode *inode = file_inode(file); + struct inode *backing_inode, *inode = file_inode(file); struct integrity_iint_cache *iint = NULL; struct ima_template_desc *template_desc = NULL; char *pathbuf = NULL; @@ -278,6 +279,19 @@ iint->measured_pcrs = 0; } + /* Detect and re-evaluate changes made to the backing file. */ + backing_inode = d_real_inode(file_dentry(file)); + if (backing_inode != inode && + (action & IMA_DO_MASK) && (iint->flags & IMA_DONE_MASK)) { + if (!IS_I_VERSION(backing_inode) || + backing_inode->i_sb->s_dev != iint->real_dev || + backing_inode->i_ino != iint->real_ino || + !inode_eq_iversion(backing_inode, iint->version)) { + iint->flags &= ~IMA_DONE_MASK; + iint->measured_pcrs = 0; + } + } + /* Determine if already appraised/measured based on bitmask * (IMA_MEASURE, IMA_MEASURED, IMA_XXXX_APPRAISE, IMA_XXXX_APPRAISED, * IMA_AUDIT, IMA_AUDITED) diff -u linux-lowlatency-5.15.0/security/keys/trusted-keys/trusted_core.c linux-lowlatency-5.15.0/security/keys/trusted-keys/trusted_core.c --- linux-lowlatency-5.15.0/security/keys/trusted-keys/trusted_core.c +++ linux-lowlatency-5.15.0/security/keys/trusted-keys/trusted_core.c @@ -354,17 +354,17 @@ if (!get_random) get_random = kernel_get_random; - static_call_update(trusted_key_seal, - trusted_key_sources[i].ops->seal); - static_call_update(trusted_key_unseal, - trusted_key_sources[i].ops->unseal); - static_call_update(trusted_key_get_random, - get_random); - trusted_key_exit = trusted_key_sources[i].ops->exit; - migratable = trusted_key_sources[i].ops->migratable; - ret = trusted_key_sources[i].ops->init(); - if (!ret) + if (!ret) { + static_call_update(trusted_key_seal, trusted_key_sources[i].ops->seal); + static_call_update(trusted_key_unseal, trusted_key_sources[i].ops->unseal); + static_call_update(trusted_key_get_random, get_random); + + trusted_key_exit = trusted_key_sources[i].ops->exit; + migratable = trusted_key_sources[i].ops->migratable; + } + + if (!ret || ret != -ENODEV) break; } diff -u linux-lowlatency-5.15.0/sound/core/info.c linux-lowlatency-5.15.0/sound/core/info.c --- linux-lowlatency-5.15.0/sound/core/info.c +++ linux-lowlatency-5.15.0/sound/core/info.c @@ -56,7 +56,7 @@ }; static int snd_info_version_init(void); -static void snd_info_disconnect(struct snd_info_entry *entry); +static void snd_info_clear_entries(struct snd_info_entry *entry); /* @@ -569,11 +569,16 @@ { if (!card) return; - mutex_lock(&info_mutex); + proc_remove(card->proc_root_link); - card->proc_root_link = NULL; if (card->proc_root) - snd_info_disconnect(card->proc_root); + proc_remove(card->proc_root->p); + + mutex_lock(&info_mutex); + if (card->proc_root) + snd_info_clear_entries(card->proc_root); + card->proc_root_link = NULL; + card->proc_root = NULL; mutex_unlock(&info_mutex); } @@ -745,15 +750,14 @@ } EXPORT_SYMBOL(snd_info_create_card_entry); -static void snd_info_disconnect(struct snd_info_entry *entry) +static void snd_info_clear_entries(struct snd_info_entry *entry) { struct snd_info_entry *p; if (!entry->p) return; list_for_each_entry(p, &entry->children, list) - snd_info_disconnect(p); - proc_remove(entry->p); + snd_info_clear_entries(p); entry->p = NULL; } @@ -770,8 +774,9 @@ if (!entry) return; if (entry->p) { + proc_remove(entry->p); mutex_lock(&info_mutex); - snd_info_disconnect(entry); + snd_info_clear_entries(entry); mutex_unlock(&info_mutex); } diff -u linux-lowlatency-5.15.0/sound/core/pcm.c linux-lowlatency-5.15.0/sound/core/pcm.c --- linux-lowlatency-5.15.0/sound/core/pcm.c +++ linux-lowlatency-5.15.0/sound/core/pcm.c @@ -251,6 +251,7 @@ STATE(DRAINING), STATE(PAUSED), STATE(SUSPENDED), + STATE(DISCONNECTED), }; static const char * const snd_pcm_access_names[] = { diff -u linux-lowlatency-5.15.0/sound/hda/hdac_stream.c linux-lowlatency-5.15.0/sound/hda/hdac_stream.c --- linux-lowlatency-5.15.0/sound/hda/hdac_stream.c +++ linux-lowlatency-5.15.0/sound/hda/hdac_stream.c @@ -320,8 +320,10 @@ struct hdac_stream *res = NULL; /* make a non-zero unique key for the substream */ - int key = (substream->pcm->device << 16) | (substream->number << 2) | - (substream->stream + 1); + int key = (substream->number << 2) | (substream->stream + 1); + + if (substream->pcm) + key |= (substream->pcm->device << 16); spin_lock_irq(&bus->reg_lock); list_for_each_entry(azx_dev, &bus->stream_list, list) { diff -u linux-lowlatency-5.15.0/sound/hda/intel-dsp-config.c linux-lowlatency-5.15.0/sound/hda/intel-dsp-config.c --- linux-lowlatency-5.15.0/sound/hda/intel-dsp-config.c +++ linux-lowlatency-5.15.0/sound/hda/intel-dsp-config.c @@ -330,6 +330,12 @@ DMI_MATCH(DMI_SYS_VENDOR, "Google"), } }, + { + .ident = "Google firmware", + .matches = { + DMI_MATCH(DMI_BIOS_VERSION, "Google"), + } + }, {} } }, diff -u linux-lowlatency-5.15.0/sound/pci/hda/hda_intel.c linux-lowlatency-5.15.0/sound/pci/hda/hda_intel.c --- linux-lowlatency-5.15.0/sound/pci/hda/hda_intel.c +++ linux-lowlatency-5.15.0/sound/pci/hda/hda_intel.c @@ -2210,6 +2210,8 @@ SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0), /* https://bugs.launchpad.net/bugs/1821663 */ SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0), + /* KONTRON SinglePC may cause a stall at runtime resume */ + SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0), {} }; #endif /* CONFIG_PM */ diff -u linux-lowlatency-5.15.0/sound/pci/hda/patch_cs8409.c linux-lowlatency-5.15.0/sound/pci/hda/patch_cs8409.c --- linux-lowlatency-5.15.0/sound/pci/hda/patch_cs8409.c +++ linux-lowlatency-5.15.0/sound/pci/hda/patch_cs8409.c @@ -1369,6 +1369,7 @@ spec->scodecs[CS8409_CODEC1] = &dolphin_cs42l42_1; spec->scodecs[CS8409_CODEC1]->codec = codec; spec->num_scodecs = 2; + spec->gen.suppress_vmaster = 1; codec->patch_ops = cs8409_dolphin_patch_ops; diff -u linux-lowlatency-5.15.0/sound/pci/hda/patch_realtek.c linux-lowlatency-5.15.0/sound/pci/hda/patch_realtek.c --- linux-lowlatency-5.15.0/sound/pci/hda/patch_realtek.c +++ linux-lowlatency-5.15.0/sound/pci/hda/patch_realtek.c @@ -1985,6 +1985,7 @@ ALC887_FIXUP_ASUS_AUDIO, ALC887_FIXUP_ASUS_HMIC, ALCS1200A_FIXUP_MIC_VREF, + ALC888VD_FIXUP_MIC_100VREF, }; static void alc889_fixup_coef(struct hda_codec *codec, @@ -2538,6 +2539,13 @@ {} } }, + [ALC888VD_FIXUP_MIC_100VREF] = { + .type = HDA_FIXUP_PINCTLS, + .v.pins = (const struct hda_pintbl[]) { + { 0x18, PIN_VREF100 }, /* headset mic */ + {} + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -2607,6 +2615,7 @@ SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF), SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF), SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD), SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), @@ -3254,6 +3263,7 @@ case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x10ec0257: case 0x19e58326: alc_write_coef_idx(codec, 0x48, 0x0); alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); @@ -3283,6 +3293,7 @@ case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x10ec0257: case 0x19e58326: alc_write_coef_idx(codec, 0x48, 0xd011); alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); @@ -6477,6 +6488,7 @@ case 0x10ec0236: case 0x10ec0255: case 0x10ec0256: + case 0x10ec0257: case 0x19e58326: alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); @@ -9342,6 +9354,7 @@ SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK), SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK), SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), @@ -10205,22 +10218,6 @@ {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, - {0x14, 0x90170110}, - {0x21, 0x04211020}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, - {0x14, 0x90170110}, - {0x21, 0x04211030}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, - ALC295_STANDARD_PINS, - {0x17, 0x21014020}, - {0x18, 0x21a19030}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, - ALC295_STANDARD_PINS, - {0x17, 0x21014040}, - {0x18, 0x21a19050}), - SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, - ALC295_STANDARD_PINS), SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, ALC298_STANDARD_PINS, {0x17, 0x90170110}), @@ -10264,6 +10261,9 @@ SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, {0x19, 0x40000000}, {0x1b, 0x40000000}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, + {0x19, 0x40000000}, + {0x1b, 0x40000000}), SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, {0x19, 0x40000000}, {0x1a, 0x40000000}), diff -u linux-lowlatency-5.15.0/sound/soc/codecs/hdmi-codec.c linux-lowlatency-5.15.0/sound/soc/codecs/hdmi-codec.c --- linux-lowlatency-5.15.0/sound/soc/codecs/hdmi-codec.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/hdmi-codec.c @@ -870,18 +870,13 @@ void *data) { struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); - int ret = -ENOTSUPP; if (hcp->hcd.ops->hook_plugged_cb) { hcp->jack = jack; - ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, - hcp->hcd.data, - plugged_cb, - component->dev); - if (ret) - hcp->jack = NULL; + return 0; } - return ret; + + return -ENOTSUPP; } static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai) @@ -965,6 +960,21 @@ return ret; } +static int hdmi_probe(struct snd_soc_component *component) +{ + struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); + int ret = 0; + + if (hcp->hcd.ops->hook_plugged_cb) { + ret = hcp->hcd.ops->hook_plugged_cb(component->dev->parent, + hcp->hcd.data, + plugged_cb, + component->dev); + } + + return ret; +} + static void hdmi_remove(struct snd_soc_component *component) { struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); @@ -975,6 +985,7 @@ } static const struct snd_soc_component_driver hdmi_driver = { + .probe = hdmi_probe, .remove = hdmi_remove, .dapm_widgets = hdmi_widgets, .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), diff -u linux-lowlatency-5.15.0/sound/soc/codecs/lpass-wsa-macro.c linux-lowlatency-5.15.0/sound/soc/codecs/lpass-wsa-macro.c --- linux-lowlatency-5.15.0/sound/soc/codecs/lpass-wsa-macro.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/lpass-wsa-macro.c @@ -1678,6 +1678,9 @@ boost_path_cfg1 = CDC_WSA_RX1_RX_PATH_CFG1; reg = CDC_WSA_RX1_RX_PATH_CTL; reg_mix = CDC_WSA_RX1_RX_PATH_MIX_CTL; + } else { + dev_warn(component->dev, "Incorrect widget name in the driver\n"); + return -EINVAL; } switch (event) { diff -u linux-lowlatency-5.15.0/sound/soc/codecs/rt5645.c linux-lowlatency-5.15.0/sound/soc/codecs/rt5645.c --- linux-lowlatency-5.15.0/sound/soc/codecs/rt5645.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/rt5645.c @@ -3251,6 +3251,8 @@ RT5645_GP1_PIN_IRQ, RT5645_GP1_PIN_IRQ); regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL1, RT5645_DIG_GATE_CTRL, RT5645_DIG_GATE_CTRL); + regmap_update_bits(rt5645->regmap, RT5645_DEPOP_M1, + RT5645_HP_CB_MASK, RT5645_HP_CB_PU); } rt5645_irq(0, rt5645); diff -u linux-lowlatency-5.15.0/sound/soc/codecs/wcd938x.c linux-lowlatency-5.15.0/sound/soc/codecs/wcd938x.c --- linux-lowlatency-5.15.0/sound/soc/codecs/wcd938x.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/wcd938x.c @@ -4411,7 +4411,8 @@ wcd938x->rxdev = wcd938x_sdw_device_get(wcd938x->rxnode); if (!wcd938x->rxdev) { dev_err(dev, "could not find slave with matching of node\n"); - return -EINVAL; + ret = -EINVAL; + goto err_unbind; } wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev); wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x; @@ -4419,46 +4420,47 @@ wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode); if (!wcd938x->txdev) { dev_err(dev, "could not find txslave with matching of node\n"); - return -EINVAL; + ret = -EINVAL; + goto err_put_rxdev; } wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev); wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x; wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev); - if (!wcd938x->tx_sdw_dev) { - dev_err(dev, "could not get txslave with matching of dev\n"); - return -EINVAL; - } /* As TX is main CSR reg interface, which should not be suspended first. * expicilty add the dependency link */ if (!device_link_add(wcd938x->rxdev, wcd938x->txdev, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) { dev_err(dev, "could not devlink tx and rx\n"); - return -EINVAL; + ret = -EINVAL; + goto err_put_txdev; } if (!device_link_add(dev, wcd938x->txdev, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) { dev_err(dev, "could not devlink wcd and tx\n"); - return -EINVAL; + ret = -EINVAL; + goto err_remove_rxtx_link; } if (!device_link_add(dev, wcd938x->rxdev, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) { dev_err(dev, "could not devlink wcd and rx\n"); - return -EINVAL; + ret = -EINVAL; + goto err_remove_tx_link; } wcd938x->regmap = devm_regmap_init_sdw(wcd938x->tx_sdw_dev, &wcd938x_regmap_config); if (IS_ERR(wcd938x->regmap)) { dev_err(dev, "%s: tx csr regmap not found\n", __func__); - return PTR_ERR(wcd938x->regmap); + ret = PTR_ERR(wcd938x->regmap); + goto err_remove_rx_link; } ret = wcd938x_irq_init(wcd938x, dev); if (ret) { dev_err(dev, "%s: IRQ init failed: %d\n", __func__, ret); - return ret; + goto err_remove_rx_link; } wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq; @@ -4467,27 +4469,45 @@ ret = wcd938x_set_micbias_data(wcd938x); if (ret < 0) { dev_err(dev, "%s: bad micbias pdata\n", __func__); - return ret; + goto err_remove_rx_link; } ret = snd_soc_register_component(dev, &soc_codec_dev_wcd938x, wcd938x_dais, ARRAY_SIZE(wcd938x_dais)); - if (ret) + if (ret) { dev_err(dev, "%s: Codec registration failed\n", __func__); + goto err_remove_rx_link; + } - return ret; + return 0; +err_remove_rx_link: + device_link_remove(dev, wcd938x->rxdev); +err_remove_tx_link: + device_link_remove(dev, wcd938x->txdev); +err_remove_rxtx_link: + device_link_remove(wcd938x->rxdev, wcd938x->txdev); +err_put_txdev: + put_device(wcd938x->txdev); +err_put_rxdev: + put_device(wcd938x->rxdev); +err_unbind: + component_unbind_all(dev, wcd938x); + + return ret; } static void wcd938x_unbind(struct device *dev) { struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); + snd_soc_unregister_component(dev); device_link_remove(dev, wcd938x->txdev); device_link_remove(dev, wcd938x->rxdev); device_link_remove(wcd938x->rxdev, wcd938x->txdev); - snd_soc_unregister_component(dev); + put_device(wcd938x->txdev); + put_device(wcd938x->rxdev); component_unbind_all(dev, wcd938x); } @@ -4578,7 +4598,13 @@ static int wcd938x_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &wcd938x_comp_ops); + struct device *dev = &pdev->dev; + + component_master_del(dev, &wcd938x_comp_ops); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); return 0; } diff -u linux-lowlatency-5.15.0/sound/soc/codecs/wm_adsp.c linux-lowlatency-5.15.0/sound/soc/codecs/wm_adsp.c --- linux-lowlatency-5.15.0/sound/soc/codecs/wm_adsp.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/wm_adsp.c @@ -3766,12 +3766,12 @@ ret = wm_adsp_buffer_read(buf, caps->region_defs[i].base_offset, ®ion->base_addr); if (ret < 0) - return ret; + goto err; ret = wm_adsp_buffer_read(buf, caps->region_defs[i].size_offset, &offset); if (ret < 0) - return ret; + goto err; region->cumulative_size = offset; @@ -3782,6 +3782,10 @@ } return 0; + +err: + kfree(buf->regions); + return ret; } static void wm_adsp_buffer_clear(struct wm_adsp_compr_buf *buf) diff -u linux-lowlatency-5.15.0/sound/soc/fsl/fsl_easrc.c linux-lowlatency-5.15.0/sound/soc/fsl/fsl_easrc.c --- linux-lowlatency-5.15.0/sound/soc/fsl/fsl_easrc.c +++ linux-lowlatency-5.15.0/sound/soc/fsl/fsl_easrc.c @@ -1965,17 +1965,21 @@ &fsl_easrc_dai, 1); if (ret) { dev_err(dev, "failed to register ASoC DAI\n"); - return ret; + goto err_pm_disable; } ret = devm_snd_soc_register_component(dev, &fsl_asrc_component, NULL, 0); if (ret) { dev_err(&pdev->dev, "failed to register ASoC platform\n"); - return ret; + goto err_pm_disable; } return 0; + +err_pm_disable: + pm_runtime_disable(&pdev->dev); + return ret; } static int fsl_easrc_remove(struct platform_device *pdev) diff -u linux-lowlatency-5.15.0/sound/soc/generic/simple-card.c linux-lowlatency-5.15.0/sound/soc/generic/simple-card.c --- linux-lowlatency-5.15.0/sound/soc/generic/simple-card.c +++ linux-lowlatency-5.15.0/sound/soc/generic/simple-card.c @@ -680,10 +680,12 @@ struct snd_soc_dai_link *dai_link = priv->dai_link; struct simple_dai_props *dai_props = priv->dai_props; + ret = -EINVAL; + cinfo = dev->platform_data; if (!cinfo) { dev_err(dev, "no info for asoc-simple-card\n"); - return -EINVAL; + goto err; } if (!cinfo->name || @@ -692,7 +694,7 @@ !cinfo->platform || !cinfo->cpu_dai.name) { dev_err(dev, "insufficient asoc_simple_card_info settings\n"); - return -EINVAL; + goto err; } cpus = dai_link->cpus; diff -u linux-lowlatency-5.15.0/sound/soc/sof/sof-pci-dev.c linux-lowlatency-5.15.0/sound/soc/sof/sof-pci-dev.c --- linux-lowlatency-5.15.0/sound/soc/sof/sof-pci-dev.c +++ linux-lowlatency-5.15.0/sound/soc/sof/sof-pci-dev.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -27,17 +28,22 @@ module_param(tplg_path, charp, 0444); MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); +static char *tplg_filename; +module_param(tplg_filename, charp, 0444); +MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology."); + static int sof_pci_debug; module_param_named(sof_pci_debug, sof_pci_debug, int, 0444); MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)"); -static const char *sof_override_tplg_name; +static const char *sof_dmi_override_tplg_name; +static bool sof_dmi_use_community_key; #define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) static int sof_tplg_cb(const struct dmi_system_id *id) { - sof_override_tplg_name = id->driver_data; + sof_dmi_override_tplg_name = id->driver_data; return 1; } @@ -62,25 +68,44 @@ {} }; +/* all Up boards use the community key */ +static int up_use_community_key(const struct dmi_system_id *id) +{ + sof_dmi_use_community_key = true; + return 1; +} + +/* + * For ApolloLake Chromebooks we want to force the use of the Intel production key. + * All newer platforms use the community key + */ +static int chromebook_use_community_key(const struct dmi_system_id *id) +{ + if (!soc_intel_is_apl()) + sof_dmi_use_community_key = true; + return 1; +} + static const struct dmi_system_id community_key_platforms[] = { { - .ident = "Up Squared", + .ident = "Up boards", + .callback = up_use_community_key, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), - DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), } }, { - .ident = "Up Extreme", + .ident = "Google Chromebooks", + .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), - DMI_MATCH(DMI_BOARD_NAME, "UP-WHL01"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, { - .ident = "Google Chromebooks", + .ident = "Google firmware", + .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), + DMI_MATCH(DMI_BIOS_VERSION, "Google"), } }, {}, @@ -171,7 +196,7 @@ "Module parameter used, changed fw path to %s\n", sof_pdata->fw_filename_prefix); - } else if (dmi_check_system(community_key_platforms)) { + } else if (dmi_check_system(community_key_platforms) && sof_dmi_use_community_key) { sof_pdata->fw_filename_prefix = devm_kasprintf(dev, GFP_KERNEL, "%s/%s", sof_pdata->desc->default_fw_path, @@ -191,9 +216,20 @@ sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path; - dmi_check_system(sof_tplg_table); - if (sof_override_tplg_name) - sof_pdata->tplg_filename = sof_override_tplg_name; + /* + * the topology filename will be provided in the machine descriptor, unless + * it is overridden by a module parameter or DMI quirk. + */ + if (tplg_filename) { + sof_pdata->tplg_filename = tplg_filename; + + dev_dbg(dev, "Module parameter used, changed tplg filename to %s\n", + sof_pdata->tplg_filename); + } else { + dmi_check_system(sof_tplg_table); + if (sof_dmi_override_tplg_name) + sof_pdata->tplg_filename = sof_dmi_override_tplg_name; + } /* set callback to be called on successful device probe to enable runtime_pm */ sof_pdata->sof_probe_complete = sof_pci_probe_complete; diff -u linux-lowlatency-5.15.0/sound/usb/mixer_quirks.c linux-lowlatency-5.15.0/sound/usb/mixer_quirks.c --- linux-lowlatency-5.15.0/sound/usb/mixer_quirks.c +++ linux-lowlatency-5.15.0/sound/usb/mixer_quirks.c @@ -2796,6 +2796,7 @@ #define SND_DJM_850_IDX 0x2 #define SND_DJM_900NXS2_IDX 0x3 #define SND_DJM_750MK2_IDX 0x4 +#define SND_DJM_450_IDX 0x5 #define SND_DJM_CTL(_name, suffix, _default_value, _windex) { \ @@ -2926,6 +2927,31 @@ }; +// DJM-450 +static const u16 snd_djm_opts_450_cap1[] = { + 0x0103, 0x0100, 0x0106, 0x0107, 0x0108, 0x0109, 0x010d, 0x010a }; + +static const u16 snd_djm_opts_450_cap2[] = { + 0x0203, 0x0200, 0x0206, 0x0207, 0x0208, 0x0209, 0x020d, 0x020a }; + +static const u16 snd_djm_opts_450_cap3[] = { + 0x030a, 0x0311, 0x0312, 0x0307, 0x0308, 0x0309, 0x030d }; + +static const u16 snd_djm_opts_450_pb1[] = { 0x0100, 0x0101, 0x0104 }; +static const u16 snd_djm_opts_450_pb2[] = { 0x0200, 0x0201, 0x0204 }; +static const u16 snd_djm_opts_450_pb3[] = { 0x0300, 0x0301, 0x0304 }; + +static const struct snd_djm_ctl snd_djm_ctls_450[] = { + SND_DJM_CTL("Capture Level", cap_level, 0, SND_DJM_WINDEX_CAPLVL), + SND_DJM_CTL("Ch1 Input", 450_cap1, 2, SND_DJM_WINDEX_CAP), + SND_DJM_CTL("Ch2 Input", 450_cap2, 2, SND_DJM_WINDEX_CAP), + SND_DJM_CTL("Ch3 Input", 450_cap3, 0, SND_DJM_WINDEX_CAP), + SND_DJM_CTL("Ch1 Output", 450_pb1, 0, SND_DJM_WINDEX_PB), + SND_DJM_CTL("Ch2 Output", 450_pb2, 1, SND_DJM_WINDEX_PB), + SND_DJM_CTL("Ch3 Output", 450_pb3, 2, SND_DJM_WINDEX_PB) +}; + + // DJM-750 static const u16 snd_djm_opts_750_cap1[] = { 0x0101, 0x0103, 0x0106, 0x0107, 0x0108, 0x0109, 0x010a, 0x010f }; @@ -3021,6 +3047,7 @@ [SND_DJM_850_IDX] = SND_DJM_DEVICE(850), [SND_DJM_900NXS2_IDX] = SND_DJM_DEVICE(900nxs2), [SND_DJM_750MK2_IDX] = SND_DJM_DEVICE(750mk2), + [SND_DJM_450_IDX] = SND_DJM_DEVICE(450), }; @@ -3263,6 +3290,9 @@ case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */ err = snd_djm_controls_create(mixer, SND_DJM_250MK2_IDX); break; + case USB_ID(0x2b73, 0x0013): /* Pioneer DJ DJM-450 */ + err = snd_djm_controls_create(mixer, SND_DJM_450_IDX); + break; case USB_ID(0x08e4, 0x017f): /* Pioneer DJ DJM-750 */ err = snd_djm_controls_create(mixer, SND_DJM_750_IDX); break; diff -u linux-lowlatency-5.15.0/tools/iio/iio_generic_buffer.c linux-lowlatency-5.15.0/tools/iio/iio_generic_buffer.c --- linux-lowlatency-5.15.0/tools/iio/iio_generic_buffer.c +++ linux-lowlatency-5.15.0/tools/iio/iio_generic_buffer.c @@ -54,9 +54,12 @@ static unsigned int size_from_channelarray(struct iio_channel_info *channels, int num_channels) { unsigned int bytes = 0; - int i = 0; + int i = 0, max = 0; + unsigned int misalignment; while (i < num_channels) { + if (channels[i].bytes > max) + max = channels[i].bytes; if (bytes % channels[i].bytes == 0) channels[i].location = bytes; else @@ -66,6 +69,14 @@ bytes = channels[i].location + channels[i].bytes; i++; } + /* + * We want the data in next sample to also be properly aligned so + * we'll add padding at the end if needed. Adding padding only + * works for channel data which size is 2^n bytes. + */ + misalignment = bytes % max; + if (misalignment) + bytes += max - misalignment; return bytes; } diff -u linux-lowlatency-5.15.0/tools/objtool/check.c linux-lowlatency-5.15.0/tools/objtool/check.c --- linux-lowlatency-5.15.0/tools/objtool/check.c +++ linux-lowlatency-5.15.0/tools/objtool/check.c @@ -2202,7 +2202,7 @@ if (!dest) return false; - if (dest->fentry) + if (dest->fentry || dest->embedded_insn) return true; } diff -u linux-lowlatency-5.15.0/tools/perf/util/hist.c linux-lowlatency-5.15.0/tools/perf/util/hist.c --- linux-lowlatency-5.15.0/tools/perf/util/hist.c +++ linux-lowlatency-5.15.0/tools/perf/util/hist.c @@ -2635,8 +2635,6 @@ /* If we have branch cycles always annotate them. */ if (bs && bs->nr && entries[0].flags.cycles) { - int i; - bi = sample__resolve_bstack(sample, al); if (bi) { struct addr_map_symbol *prev = NULL; @@ -2651,7 +2649,7 @@ * Note that perf stores branches reversed from * program order! */ - for (i = bs->nr - 1; i >= 0; i--) { + for (int i = bs->nr - 1; i >= 0; i--) { addr_map_symbol__account_cycles(&bi[i].from, nonany_branch_mode ? NULL : prev, bi[i].flags.cycles); @@ -2660,6 +2658,12 @@ if (total_cycles) *total_cycles += bi[i].flags.cycles; } + for (unsigned int i = 0; i < bs->nr; i++) { + map__put(bi[i].to.ms.map); + maps__put(bi[i].to.ms.maps); + map__put(bi[i].from.ms.map); + maps__put(bi[i].from.ms.maps); + } free(bi); } } diff -u linux-lowlatency-5.15.0/tools/perf/util/intel-pt.c linux-lowlatency-5.15.0/tools/perf/util/intel-pt.c --- linux-lowlatency-5.15.0/tools/perf/util/intel-pt.c +++ linux-lowlatency-5.15.0/tools/perf/util/intel-pt.c @@ -1346,9 +1346,11 @@ } else if (ptq->state->flags & INTEL_PT_ASYNC) { if (!ptq->state->to_ip) ptq->flags = PERF_IP_FLAG_BRANCH | + PERF_IP_FLAG_ASYNC | PERF_IP_FLAG_TRACE_END; else if (ptq->state->from_nr && !ptq->state->to_nr) ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | + PERF_IP_FLAG_ASYNC | PERF_IP_FLAG_VMEXIT; else ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | diff -u linux-lowlatency-5.15.0/tools/perf/util/machine.c linux-lowlatency-5.15.0/tools/perf/util/machine.c --- linux-lowlatency-5.15.0/tools/perf/util/machine.c +++ linux-lowlatency-5.15.0/tools/perf/util/machine.c @@ -2437,16 +2437,18 @@ save_lbr_cursor_node(thread, cursor, i); } - /* Add LBR ip from first entries.to */ - ip = entries[0].to; - flags = &entries[0].flags; - *branch_from = entries[0].from; - err = add_callchain_ip(thread, cursor, parent, - root_al, &cpumode, ip, - true, flags, NULL, - *branch_from); - if (err) - return err; + if (lbr_nr > 0) { + /* Add LBR ip from first entries.to */ + ip = entries[0].to; + flags = &entries[0].flags; + *branch_from = entries[0].from; + err = add_callchain_ip(thread, cursor, parent, + root_al, &cpumode, ip, + true, flags, NULL, + *branch_from); + if (err) + return err; + } return 0; } diff -u linux-lowlatency-5.15.0/tools/power/x86/turbostat/turbostat.c linux-lowlatency-5.15.0/tools/power/x86/turbostat/turbostat.c --- linux-lowlatency-5.15.0/tools/power/x86/turbostat/turbostat.c +++ linux-lowlatency-5.15.0/tools/power/x86/turbostat/turbostat.c @@ -2100,7 +2100,7 @@ if ((DO_BIC(BIC_CPU_c6) || soft_c1_residency_display(BIC_CPU_c6)) && !do_knl_cstates) { if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) return -7; - } else if (do_knl_cstates || soft_c1_residency_display(BIC_CPU_c6)) { + } else if (do_knl_cstates && soft_c1_residency_display(BIC_CPU_c6)) { if (get_msr(cpu, MSR_KNL_CORE_C6_RESIDENCY, &c->c6)) return -7; } @@ -5550,6 +5550,7 @@ rapl_probe(family, model); perf_limit_reasons_probe(family, model); automatic_cstate_conversion_probe(family, model); + prewake_cstate_probe(family, model); check_tcc_offset(model_orig); diff -u linux-lowlatency-5.15.0/tools/testing/selftests/net/pmtu.sh linux-lowlatency-5.15.0/tools/testing/selftests/net/pmtu.sh --- linux-lowlatency-5.15.0/tools/testing/selftests/net/pmtu.sh +++ linux-lowlatency-5.15.0/tools/testing/selftests/net/pmtu.sh @@ -1880,7 +1880,7 @@ case $ret in 0) all_skipped=false - [ $exitcode=$ksft_skip ] && exitcode=0 + [ $exitcode -eq $ksft_skip ] && exitcode=0 ;; $ksft_skip) [ $all_skipped = true ] && exitcode=$ksft_skip diff -u linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c --- linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c @@ -62,7 +62,7 @@ break; case PIDFD_PASS: - ksft_test_result_pass("%s test: Passed\n"); + ksft_test_result_pass("%s test: Passed\n", test_name); break; default: diff -u linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_test.c linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_test.c --- linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_test.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/pidfd/pidfd_test.c @@ -380,13 +380,13 @@ static void *test_pidfd_poll_exec_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); ksft_print_msg("Child Thread: doing exec of sleep\n"); execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -426,7 +426,7 @@ { pthread_t t1; - ksft_print_msg("Child (pidfd): starting. pid %d tid %d\n", getpid(), + ksft_print_msg("Child (pidfd): starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL); /* @@ -477,10 +477,10 @@ static void *test_pidfd_poll_leader_exit_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); sleep(CHILD_THREAD_MIN_WAIT); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -489,7 +489,7 @@ { pthread_t t1, t2; - ksft_print_msg("Child: starting. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child: starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL); pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL); diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/Makefile linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/Makefile --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/Makefile +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/Makefile @@ -1,4 +1,6 @@ -CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 +# SPDX-License-Identifier: GPL-2.0 + +CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE CFLAGS += $(KHDR_INCLUDES) TEST_GEN_PROGS := resctrl_tests diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/cmt_test.c linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/cmt_test.c --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/cmt_test.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/cmt_test.c @@ -91,9 +91,6 @@ if (ret) return ret; - if (!validate_resctrl_feature_request(CMT_STR)) - return -1; - ret = get_cbm_mask("L3", cbm_mask); if (ret) return ret; diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mba_test.c linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mba_test.c --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mba_test.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mba_test.c @@ -12,7 +12,7 @@ #define RESULT_FILE_NAME "result_mba" #define NUM_OF_RUNS 5 -#define MAX_DIFF_PERCENT 5 +#define MAX_DIFF_PERCENT 8 #define ALLOCATION_MAX 100 #define ALLOCATION_MIN 10 #define ALLOCATION_STEP 10 diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mbm_test.c linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mbm_test.c --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mbm_test.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/mbm_test.c @@ -11,7 +11,7 @@ #include "resctrl.h" #define RESULT_FILE_NAME "result_mbm" -#define MAX_DIFF_PERCENT 5 +#define MAX_DIFF_PERCENT 8 #define NUM_OF_RUNS 5 static int diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl.h linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl.h --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl.h +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl.h @@ -1,5 +1,4 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#define _GNU_SOURCE #ifndef RESCTRL_H #define RESCTRL_H #include diff -u linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl_tests.c linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl_tests.c --- linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl_tests.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/resctrl/resctrl_tests.c @@ -224,9 +224,14 @@ return ksft_exit_fail_msg("Not running as root, abort testing.\n"); if (has_ben) { + if (argc - ben_ind >= BENCHMARK_ARGS) + ksft_exit_fail_msg("Too long benchmark command.\n"); + /* Extract benchmark command from command line. */ for (i = ben_ind; i < argc; i++) { benchmark_cmd[i - ben_ind] = benchmark_cmd_area[i]; + if (strlen(argv[i]) >= BENCHMARK_ARG_SIZE) + ksft_exit_fail_msg("Too long benchmark command argument.\n"); sprintf(benchmark_cmd[i - ben_ind], "%s", argv[i]); } benchmark_cmd[ben_count] = NULL; diff -u linux-lowlatency-5.15.0/tools/testing/selftests/vm/charge_reserved_hugetlb.sh linux-lowlatency-5.15.0/tools/testing/selftests/vm/charge_reserved_hugetlb.sh --- linux-lowlatency-5.15.0/tools/testing/selftests/vm/charge_reserved_hugetlb.sh +++ linux-lowlatency-5.15.0/tools/testing/selftests/vm/charge_reserved_hugetlb.sh @@ -25,7 +25,7 @@ fi if [[ $cgroup2 ]]; then - cgroup_path=$(mount -t cgroup2 | head -1 | awk -e '{print $3}') + cgroup_path=$(mount -t cgroup2 | head -1 | awk '{print $3}') if [[ -z "$cgroup_path" ]]; then cgroup_path=/dev/cgroup/memory mount -t cgroup2 none $cgroup_path @@ -33,7 +33,7 @@ fi echo "+hugetlb" >$cgroup_path/cgroup.subtree_control else - cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}') + cgroup_path=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}') if [[ -z "$cgroup_path" ]]; then cgroup_path=/dev/cgroup/memory mount -t cgroup memory,hugetlb $cgroup_path diff -u linux-lowlatency-5.15.0/tools/testing/selftests/vm/hugetlb_reparenting_test.sh linux-lowlatency-5.15.0/tools/testing/selftests/vm/hugetlb_reparenting_test.sh --- linux-lowlatency-5.15.0/tools/testing/selftests/vm/hugetlb_reparenting_test.sh +++ linux-lowlatency-5.15.0/tools/testing/selftests/vm/hugetlb_reparenting_test.sh @@ -20,7 +20,7 @@ if [[ $cgroup2 ]]; then - CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk -e '{print $3}') + CGROUP_ROOT=$(mount -t cgroup2 | head -1 | awk '{print $3}') if [[ -z "$CGROUP_ROOT" ]]; then CGROUP_ROOT=/dev/cgroup/memory mount -t cgroup2 none $CGROUP_ROOT @@ -28,7 +28,7 @@ fi echo "+hugetlb +memory" >$CGROUP_ROOT/cgroup.subtree_control else - CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk -e '{print $3}') + CGROUP_ROOT=$(mount -t cgroup | grep ",hugetlb" | awk '{print $3}') if [[ -z "$CGROUP_ROOT" ]]; then CGROUP_ROOT=/dev/cgroup/memory mount -t cgroup memory,hugetlb $CGROUP_ROOT only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/ABI/testing/sysfs-bus-optee-devices +++ linux-lowlatency-5.15.0/Documentation/ABI/testing/sysfs-bus-optee-devices @@ -6,3 +6,12 @@ OP-TEE bus provides reference to registered drivers under this directory. The matches Trusted Application (TA) driver and corresponding TA in secure OS. Drivers are free to create needed API under optee-ta- directory. + +What: /sys/bus/tee/devices/optee-ta-/need_supplicant +Date: November 2023 +KernelVersion: 6.7 +Contact: op-tee@lists.trustedfirmware.org +Description: + Allows to distinguish whether an OP-TEE based TA/device requires user-space + tee-supplicant to function properly or not. This attribute will be present for + devices which depend on tee-supplicant to be running. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/process/howto.rst +++ linux-lowlatency-5.15.0/Documentation/process/howto.rst @@ -36,7 +36,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] The kernel is written using GNU C and the GNU toolchain. While it -adheres to the ISO C89 standard, it uses a number of extensions that are +adheres to the ISO C11 standard, it uses a number of extensions that are not featured in the standard. The kernel is a freestanding C environment, with no reliance on the standard C library, so some portions of the C standard are not supported. Arbitrary long long only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/translations/it_IT/process/howto.rst +++ linux-lowlatency-5.15.0/Documentation/translations/it_IT/process/howto.rst @@ -44,7 +44,7 @@ - "C: A Reference Manual" di Harbison and Steele [Prentice Hall] Il kernel è stato scritto usando GNU C e la toolchain GNU. -Sebbene si attenga allo standard ISO C89, esso utilizza una serie di +Sebbene si attenga allo standard ISO C11, esso utilizza una serie di estensioni che non sono previste in questo standard. Il kernel è un ambiente C indipendente, che non ha alcuna dipendenza dalle librerie C standard, così alcune parti del C standard non sono supportate. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/translations/ja_JP/howto.rst +++ linux-lowlatency-5.15.0/Documentation/translations/ja_JP/howto.rst @@ -65,7 +65,7 @@ - 『新・詳説 C 言語 H&S リファレンス』 (サミュエル P ハービソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトバンク] カーネルは GNU C と GNU ツールチェインを使って書かれています。カーネル -は ISO C89 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って +は ISO C11 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って います。カーネルは標準 C ライブラリに依存しない、C 言語非依存環境です。 そのため、C の標準の中で使えないものもあります。特に任意の long long の除算や浮動小数点は使えません。カーネルがツールチェインや C 言語拡張 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/translations/ko_KR/howto.rst +++ linux-lowlatency-5.15.0/Documentation/translations/ko_KR/howto.rst @@ -62,7 +62,7 @@ - "Practical C Programming" by Steve Oualline [O'Reilly] - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] -커널은 GNU C와 GNU 툴체인을 사용하여 작성되었다. 이 툴들은 ISO C89 표준을 +커널은 GNU C와 GNU 툴체인을 사용하여 작성되었다. 이 툴들은 ISO C11 표준을 따르는 반면 표준에 있지 않은 많은 확장기능도 가지고 있다. 커널은 표준 C 라이브러리와는 관계없이 freestanding C 환경이어서 C 표준의 일부는 지원되지 않는다. 임의의 long long 나누기나 floating point는 지원되지 않는다. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/translations/zh_CN/process/howto.rst +++ linux-lowlatency-5.15.0/Documentation/translations/zh_CN/process/howto.rst @@ -45,7 +45,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 《C语言参考手册(原书第5版)》(邱仲潘 等译)[机械工业出版社] -Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但也用到了一些 +Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C11标准,但也用到了一些 标准中没有定义的扩展。内核是自给自足的C环境,不依赖于标准C库的支持,所以 并不支持C标准中的部分定义。比如long long类型的大数除法和浮点运算就不允许 使用。有时候确实很难弄清楚内核对工具链的要求和它所使用的扩展,不幸的是目 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/Documentation/translations/zh_TW/process/howto.rst +++ linux-lowlatency-5.15.0/Documentation/translations/zh_TW/process/howto.rst @@ -48,7 +48,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 《C語言參考手冊(原書第5版)》(邱仲潘 等譯)[機械工業出版社] -Linux內核使用GNU C和GNU工具鏈開發。雖然它遵循ISO C89標準,但也用到了一些 +Linux內核使用GNU C和GNU工具鏈開發。雖然它遵循ISO C11標準,但也用到了一些 標準中沒有定義的擴展。內核是自給自足的C環境,不依賴於標準C庫的支持,所以 並不支持C標準中的部分定義。比如long long類型的大數除法和浮點運算就不允許 使用。有時候確實很難弄清楚內核對工具鏈的要求和它所使用的擴展,不幸的是目 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/boot/dts/imx28-xea.dts +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/imx28-xea.dts @@ -8,6 +8,7 @@ #include "imx28-lwe.dtsi" / { + model = "Liebherr XEA board"; compatible = "lwn,imx28-xea", "fsl,imx28"; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/boot/dts/imx6ul-pico.dtsi +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/imx6ul-pico.dtsi @@ -121,6 +121,8 @@ max-speed = <100>; interrupt-parent = <&gpio5>; interrupts = <6 IRQ_TYPE_LEVEL_LOW>; + clocks = <&clks IMX6UL_CLK_ENET_REF>; + clock-names = "rmii-ref"; }; }; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/boot/dts/r8a7792-blanche.dts +++ linux-lowlatency-5.15.0/arch/arm/boot/dts/r8a7792-blanche.dts @@ -239,7 +239,7 @@ }; keyboard_pins: keyboard { - pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_02"; + pins = "GP_3_10", "GP_3_11", "GP_3_12", "GP_3_15", "GP_11_2"; bias-pull-up; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/include/asm/exception.h +++ linux-lowlatency-5.15.0/arch/arm/include/asm/exception.h @@ -10,10 +10,6 @@ #include -#ifdef CONFIG_FUNCTION_GRAPH_TRACER #define __exception_irq_entry __irq_entry -#else -#define __exception_irq_entry -#endif #endif /* __ASM_ARM_EXCEPTION_H */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/lib/memset.S +++ linux-lowlatency-5.15.0/arch/arm/lib/memset.S @@ -17,6 +17,7 @@ ENTRY(mmioset) WEAK(memset) UNWIND( .fnstart ) + and r1, r1, #255 @ cast to unsigned char ands r3, r0, #3 @ 1 unaligned? mov ip, r0 @ preserve r0 as return value bne 6f @ 1 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm/xen/enlighten.c +++ linux-lowlatency-5.15.0/arch/arm/xen/enlighten.c @@ -159,9 +159,6 @@ BUG_ON(err); per_cpu(xen_vcpu, cpu) = vcpup; - if (!xen_kernel_unmapped_at_usr()) - xen_setup_runstate_info(cpu); - after_register_vcpu_info: enable_percpu_irq(xen_events_irq, 0); return 0; @@ -362,7 +359,8 @@ * for secondary CPUs as they are brought up. * For uniformity we use VCPUOP_register_vcpu_info even on cpu0. */ - xen_vcpu_info = alloc_percpu(struct vcpu_info); + xen_vcpu_info = __alloc_percpu(sizeof(struct vcpu_info), + 1 << fls(sizeof(struct vcpu_info) - 1)); if (xen_vcpu_info == NULL) return -ENOMEM; @@ -394,9 +392,6 @@ return -EINVAL; } - if (!xen_kernel_unmapped_at_usr()) - xen_time_setup_guest(); - if (xen_initial_domain()) pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); @@ -406,7 +401,13 @@ } early_initcall(xen_guest_init); -static int __init xen_pm_init(void) +static int xen_starting_runstate_cpu(unsigned int cpu) +{ + xen_setup_runstate_info(cpu); + return 0; +} + +static int __init xen_late_init(void) { if (!xen_domain()) return -ENODEV; @@ -419,9 +420,16 @@ do_settimeofday64(&ts); } - return 0; + if (xen_kernel_unmapped_at_usr()) + return 0; + + xen_time_setup_guest(); + + return cpuhp_setup_state(CPUHP_AP_ARM_XEN_RUNSTATE_STARTING, + "arm/xen_runstate:starting", + xen_starting_runstate_cpu, NULL); } -late_initcall(xen_pm_init); +late_initcall(xen_late_init); /* empty stubs */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/freescale/imx8qm-ss-img.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/freescale/imx8qm-ss-img.dtsi @@ -8,5 +8,5 @@ }; &jpegenc { - compatible = "nxp,imx8qm-jpgdec", "nxp,imx8qxp-jpgenc"; + compatible = "nxp,imx8qm-jpgenc", "nxp,imx8qxp-jpgenc"; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/marvell/cn9130-crb.dtsi @@ -107,7 +107,7 @@ "mpp59", "mpp60", "mpp61"; marvell,function = "sdio"; }; - cp0_spi0_pins: cp0-spi-pins-0 { + cp0_spi1_pins: cp0-spi-pins-1 { marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,function = "spi1"; }; @@ -149,7 +149,7 @@ &cp0_spi1 { pinctrl-names = "default"; - pinctrl-0 = <&cp0_spi0_pins>; + pinctrl-0 = <&cp0_spi1_pins>; reg = <0x700680 0x50>, /* control */ <0x2000000 0x1000000>; /* CS0 */ status = "okay"; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/marvell/cn9130-db.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/marvell/cn9130-db.dtsi @@ -307,7 +307,7 @@ &cp0_spi1 { status = "disabled"; pinctrl-names = "default"; - pinctrl-0 = <&cp0_spi0_pins>; + pinctrl-0 = <&cp0_spi1_pins>; reg = <0x700680 0x50>; spi-flash@0 { @@ -371,7 +371,7 @@ "mpp59", "mpp60", "mpp61"; marvell,function = "sdio"; }; - cp0_spi0_pins: cp0-spi-pins-0 { + cp0_spi1_pins: cp0-spi-pins-1 { marvell,pins = "mpp13", "mpp14", "mpp15", "mpp16"; marvell,function = "spi1"; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts @@ -55,7 +55,7 @@ }; }; - memory { + memory@40000000 { reg = <0 0x40000000 0 0x20000000>; }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8173-evb.dts @@ -43,7 +43,7 @@ id-gpio = <&pio 16 GPIO_ACTIVE_HIGH>; }; - usb_p1_vbus: regulator@0 { + usb_p1_vbus: regulator-usb-p1 { compatible = "regulator-fixed"; regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; @@ -52,7 +52,7 @@ enable-active-high; }; - usb_p0_vbus: regulator@1 { + usb_p0_vbus: regulator-usb-p0 { compatible = "regulator-fixed"; regulator-name = "vbus"; regulator-min-microvolt = <5000000>; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt8173.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8173.dtsi @@ -273,7 +273,7 @@ }; thermal-zones { - cpu_thermal: cpu_thermal { + cpu_thermal: cpu-thermal { polling-delay-passive = <1000>; /* milliseconds */ polling-delay = <1000>; /* milliseconds */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt8183-evb.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-evb.dts @@ -30,7 +30,7 @@ #address-cells = <2>; #size-cells = <2>; ranges; - scp_mem_reserved: scp_mem_region { + scp_mem_reserved: memory@50000000 { compatible = "shared-dma-pool"; reg = <0 0x50000000 0 0x2900000>; no-map; @@ -131,8 +131,8 @@ }; &pio { - i2c_pins_0: i2c0{ - pins_i2c{ + i2c_pins_0: i2c0 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -140,8 +140,8 @@ }; }; - i2c_pins_1: i2c1{ - pins_i2c{ + i2c_pins_1: i2c1 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -149,8 +149,8 @@ }; }; - i2c_pins_2: i2c2{ - pins_i2c{ + i2c_pins_2: i2c2 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -158,8 +158,8 @@ }; }; - i2c_pins_3: i2c3{ - pins_i2c{ + i2c_pins_3: i2c3 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -167,8 +167,8 @@ }; }; - i2c_pins_4: i2c4{ - pins_i2c{ + i2c_pins_4: i2c4 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -176,8 +176,8 @@ }; }; - i2c_pins_5: i2c5{ - pins_i2c{ + i2c_pins_5: i2c5 { + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -185,8 +185,8 @@ }; }; - spi_pins_0: spi0{ - pins_spi{ + spi_pins_0: spi0 { + pins_spi { pinmux = , , , @@ -300,8 +300,8 @@ }; }; - spi_pins_1: spi1{ - pins_spi{ + spi_pins_1: spi1 { + pins_spi { pinmux = , , , @@ -310,8 +310,8 @@ }; }; - spi_pins_2: spi2{ - pins_spi{ + spi_pins_2: spi2 { + pins_spi { pinmux = , , , @@ -320,8 +320,8 @@ }; }; - spi_pins_3: spi3{ - pins_spi{ + spi_pins_3: spi3 { + pins_spi { pinmux = , , , @@ -330,8 +330,8 @@ }; }; - spi_pins_4: spi4{ - pins_spi{ + spi_pins_4: spi4 { + pins_spi { pinmux = , , , @@ -340,8 +340,8 @@ }; }; - spi_pins_5: spi5{ - pins_spi{ + spi_pins_5: spi5 { + pins_spi { pinmux = , , , only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi @@ -102,6 +102,8 @@ &dsi0 { status = "okay"; + /delete-property/#size-cells; + /delete-property/#address-cells; /delete-node/panel@0; ports { port { @@ -438,20 +440,20 @@ }; touchscreen_pins: touchscreen-pins { - touch_int_odl { + touch-int-odl { pinmux = ; input-enable; bias-pull-up; }; - touch_rst_l { + touch-rst-l { pinmux = ; output-high; }; }; trackpad_pins: trackpad-pins { - trackpad_int { + trackpad-int { pinmux = ; input-enable; bias-disable; /* pulled externally */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts @@ -165,7 +165,7 @@ &pio { i2c_pins_0: i2c0 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -174,7 +174,7 @@ }; i2c_pins_1: i2c1 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -183,7 +183,7 @@ }; i2c_pins_2: i2c2 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -192,7 +192,7 @@ }; i2c_pins_3: i2c3 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -201,7 +201,7 @@ }; i2c_pins_4: i2c4 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; @@ -210,7 +210,7 @@ }; i2c_pins_5: i2c5 { - pins_i2c{ + pins_i2c { pinmux = , ; mediatek,pull-up-adv = <3>; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ linux-lowlatency-5.15.0/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -572,6 +572,8 @@ vdd-1.8-xo-supply = <&vreg_l7a_1p8>; vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; + + qcom,snoc-host-cap-8bit-quirk; }; /* PINCTRL - additions to nodes defined in sdm845.dtsi */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/mips/include/asm/mach-loongson64/boot_param.h +++ linux-lowlatency-5.15.0/arch/mips/include/asm/mach-loongson64/boot_param.h @@ -117,7 +117,8 @@ u64 pci_io_start_addr; u64 pci_io_end_addr; u64 pci_config_addr; - u32 dma_mask_bits; + u16 dma_mask_bits; + u16 dma_noncoherent; } __packed; struct interface_info { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/mips/kvm/mmu.c +++ linux-lowlatency-5.15.0/arch/mips/kvm/mmu.c @@ -593,7 +593,7 @@ gfn_t gfn = gpa >> PAGE_SHIFT; int srcu_idx, err; kvm_pfn_t pfn; - pte_t *ptep, entry, old_pte; + pte_t *ptep, entry; bool writeable; unsigned long prot_bits; unsigned long mmu_seq; @@ -665,7 +665,6 @@ entry = pfn_pte(pfn, __pgprot(prot_bits)); /* Write the PTE */ - old_pte = *ptep; set_pte(ptep, entry); err = 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/mips/loongson64/env.c +++ linux-lowlatency-5.15.0/arch/mips/loongson64/env.c @@ -13,6 +13,8 @@ * Copyright (C) 2009 Lemote Inc. * Author: Wu Zhangjin, wuzhangjin@gmail.com */ + +#include #include #include #include @@ -147,8 +149,14 @@ loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits; if (loongson_sysconf.dma_mask_bits < 32 || - loongson_sysconf.dma_mask_bits > 64) + loongson_sysconf.dma_mask_bits > 64) { loongson_sysconf.dma_mask_bits = 32; + dma_default_coherent = true; + } else { + dma_default_coherent = !eirq_source->dma_noncoherent; + } + + pr_info("Firmware: Coherent DMA: %s\n", dma_default_coherent ? "on" : "off"); loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm; loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/mips/loongson64/init.c +++ linux-lowlatency-5.15.0/arch/mips/loongson64/init.c @@ -86,6 +86,11 @@ break; } } + + /* Reserve vgabios if it comes from firmware */ + if (loongson_sysconf.vgabios_addr) + memblock_reserve(virt_to_phys((void *)loongson_sysconf.vgabios_addr), + SZ_256K); } #ifndef CONFIG_NUMA only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/parisc/include/uapi/asm/errno.h +++ linux-lowlatency-5.15.0/arch/parisc/include/uapi/asm/errno.h @@ -75,7 +75,6 @@ /* We now return you to your regularly scheduled HPUX. */ -#define ENOSYM 215 /* symbol does not exist in executable */ #define ENOTSOCK 216 /* Socket operation on non-socket */ #define EDESTADDRREQ 217 /* Destination address required */ #define EMSGSIZE 218 /* Message too long */ @@ -101,7 +100,6 @@ #define ETIMEDOUT 238 /* Connection timed out */ #define ECONNREFUSED 239 /* Connection refused */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ -#define EREMOTERELEASE 240 /* Remote peer released connection */ #define EHOSTDOWN 241 /* Host is down */ #define EHOSTUNREACH 242 /* No route to host */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/parisc/include/uapi/asm/pdc.h +++ linux-lowlatency-5.15.0/arch/parisc/include/uapi/asm/pdc.h @@ -465,6 +465,7 @@ unsigned long arch_rev; unsigned long pot_key; unsigned long curr_key; + unsigned long width; /* default of PSW_W bit (1=enabled) */ }; struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/include/asm/book3s/32/kup.h +++ linux-lowlatency-5.15.0/arch/powerpc/include/asm/book3s/32/kup.h @@ -12,7 +12,6 @@ #include extern struct static_key_false disable_kuap_key; -extern struct static_key_false disable_kuep_key; static __always_inline bool kuap_is_disabled(void) { @@ -21,41 +20,7 @@ static __always_inline bool kuep_is_disabled(void) { - return !IS_ENABLED(CONFIG_PPC_KUEP) || static_branch_unlikely(&disable_kuep_key); -} - -static inline void kuep_lock(void) -{ - if (kuep_is_disabled()) - return; - - update_user_segments(mfsr(0) | SR_NX); - /* - * This isync() shouldn't be necessary as the kernel is not excepted to - * run any instruction in userspace soon after the update of segments, - * but hash based cores (at least G3) seem to exhibit a random - * behaviour when the 'isync' is not there. 603 cores don't have this - * behaviour so don't do the 'isync' as it saves several CPU cycles. - */ - if (mmu_has_feature(MMU_FTR_HPTE_TABLE)) - isync(); /* Context sync required after mtsr() */ -} - -static inline void kuep_unlock(void) -{ - if (kuep_is_disabled()) - return; - - update_user_segments(mfsr(0) & ~SR_NX); - /* - * This isync() shouldn't be necessary as a 'rfi' will soon be executed - * to return to userspace, but hash based cores (at least G3) seem to - * exhibit a random behaviour when the 'isync' is not there. 603 cores - * don't have this behaviour so don't do the 'isync' as it saves several - * CPU cycles. - */ - if (mmu_has_feature(MMU_FTR_HPTE_TABLE)) - isync(); /* Context sync required after mtsr() */ + return !IS_ENABLED(CONFIG_PPC_KUEP); } #ifdef CONFIG_PPC_KUAP only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/include/asm/kup.h +++ linux-lowlatency-5.15.0/arch/powerpc/include/asm/kup.h @@ -38,11 +38,6 @@ static inline void setup_kuep(bool disabled) { } #endif /* CONFIG_PPC_KUEP */ -#ifndef CONFIG_PPC_BOOK3S_32 -static inline void kuep_lock(void) { } -static inline void kuep_unlock(void) { } -#endif - #ifdef CONFIG_PPC_KUAP void setup_kuap(bool disabled); #else only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/include/asm/nohash/32/pte-40x.h +++ linux-lowlatency-5.15.0/arch/powerpc/include/asm/nohash/32/pte-40x.h @@ -69,9 +69,6 @@ #define _PTE_NONE_MASK 0 -/* Until my rework is finished, 40x still needs atomic PTE updates */ -#define PTE_ATOMIC_UPDATES 1 - #define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED) #define _PAGE_BASE (_PAGE_BASE_NC) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/kernel/fpu.S +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/fpu.S @@ -23,6 +23,15 @@ #include #ifdef CONFIG_VSX +#define __REST_1FPVSR(n,c,base) \ +BEGIN_FTR_SECTION \ + b 2f; \ +END_FTR_SECTION_IFSET(CPU_FTR_VSX); \ + REST_FPR(n,base); \ + b 3f; \ +2: REST_VSR(n,c,base); \ +3: + #define __REST_32FPVSRS(n,c,base) \ BEGIN_FTR_SECTION \ b 2f; \ @@ -41,9 +50,11 @@ 2: SAVE_32VSRS(n,c,base); \ 3: #else +#define __REST_1FPVSR(n,b,base) REST_FPR(n, base) #define __REST_32FPVSRS(n,b,base) REST_32FPRS(n, base) #define __SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base) #endif +#define REST_1FPVSR(n,c,base) __REST_1FPVSR(n,__REG_##c,__REG_##base) #define REST_32FPVSRS(n,c,base) __REST_32FPVSRS(n,__REG_##c,__REG_##base) #define SAVE_32FPVSRS(n,c,base) __SAVE_32FPVSRS(n,__REG_##c,__REG_##base) @@ -67,6 +78,7 @@ SAVE_32FPVSRS(0, R4, R3) mffs fr0 stfd fr0,FPSTATE_FPSCR(r3) + REST_1FPVSR(0, R4, R3) blr EXPORT_SYMBOL(store_fp_state) @@ -133,4 +145,5 @@ 2: SAVE_32FPVSRS(0, R4, R6) mffs fr0 stfd fr0,FPSTATE_FPSCR(r6) + REST_1FPVSR(0, R4, R6) blr only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/kernel/head_book3s_32.S +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/head_book3s_32.S @@ -931,7 +931,11 @@ _GLOBAL(load_segment_registers) li r0, NUM_USER_SEGMENTS /* load up user segment register values */ mtctr r0 /* for context 0 */ +#ifdef CONFIG_PPC_KUEP + lis r3, SR_NX@h /* Kp = 0, Ks = 0, VSID = 0 */ +#else li r3, 0 /* Kp = 0, Ks = 0, VSID = 0 */ +#endif li r4, 0 3: mtsrin r3, r4 addi r3, r3, 0x111 /* increment VSID */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/kernel/head_fsl_booke.S +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/head_fsl_booke.S @@ -394,7 +394,7 @@ #ifdef CONFIG_PPC_FPU FP_UNAVAILABLE_EXCEPTION #else - EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, unknown_exception) + EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, emulation_assist_interrupt) #endif /* System Call Interrupt */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/kernel/vector.S +++ linux-lowlatency-5.15.0/arch/powerpc/kernel/vector.S @@ -32,6 +32,7 @@ mfvscr v0 li r4, VRSTATE_VSCR stvx v0, r4, r3 + lvx v0, 0, r3 blr EXPORT_SYMBOL(store_vr_state) @@ -104,6 +105,7 @@ mfvscr v0 li r4,VRSTATE_VSCR stvx v0,r4,r7 + lvx v0,0,r7 blr #ifdef CONFIG_VSX only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/mm/book3s32/kuep.c +++ linux-lowlatency-5.15.0/arch/powerpc/mm/book3s32/kuep.c @@ -3,18 +3,10 @@ #include #include -struct static_key_false disable_kuep_key; - void setup_kuep(bool disabled) { - if (!disabled) - kuep_lock(); - if (smp_processor_id() != boot_cpuid) return; - if (disabled) - static_branch_enable(&disable_kuep_key); - else - pr_info("Activating Kernel Userspace Execution Prevention\n"); + pr_info("Activating Kernel Userspace Execution Prevention\n"); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/powerpc/sysdev/xive/native.c +++ linux-lowlatency-5.15.0/arch/powerpc/sysdev/xive/native.c @@ -786,7 +786,7 @@ if (out_qpage) *out_qpage = be64_to_cpu(qpage); if (out_qsize) - *out_qsize = be32_to_cpu(qsize); + *out_qsize = be64_to_cpu(qsize); if (out_qeoi_page) *out_qeoi_page = be64_to_cpu(qeoi_page); if (out_escalate_irq) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/riscv/kernel/traps_misaligned.c +++ linux-lowlatency-5.15.0/arch/riscv/kernel/traps_misaligned.c @@ -344,16 +344,14 @@ } else if ((insn & INSN_MASK_C_SD) == INSN_MATCH_C_SD) { len = 8; val.data_ulong = GET_RS2S(insn, regs); - } else if ((insn & INSN_MASK_C_SDSP) == INSN_MATCH_C_SDSP && - ((insn >> SH_RD) & 0x1f)) { + } else if ((insn & INSN_MASK_C_SDSP) == INSN_MATCH_C_SDSP) { len = 8; val.data_ulong = GET_RS2C(insn, regs); #endif } else if ((insn & INSN_MASK_C_SW) == INSN_MATCH_C_SW) { len = 4; val.data_ulong = GET_RS2S(insn, regs); - } else if ((insn & INSN_MASK_C_SWSP) == INSN_MATCH_C_SWSP && - ((insn >> SH_RD) & 0x1f)) { + } else if ((insn & INSN_MASK_C_SWSP) == INSN_MATCH_C_SWSP) { len = 4; val.data_ulong = GET_RS2C(insn, regs); } else { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/s390/mm/page-states.c +++ linux-lowlatency-5.15.0/arch/s390/mm/page-states.c @@ -131,7 +131,7 @@ continue; if (!pud_folded(*pud)) { page = phys_to_page(pud_val(*pud)); - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) set_bit(PG_arch_1, &page[i].flags); } mark_kernel_pmd(pud, addr, next); @@ -152,7 +152,7 @@ continue; if (!p4d_folded(*p4d)) { page = phys_to_page(p4d_val(*p4d)); - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) set_bit(PG_arch_1, &page[i].flags); } mark_kernel_pud(p4d, addr, next); @@ -174,7 +174,7 @@ continue; if (!pgd_folded(*pgd)) { page = phys_to_page(pgd_val(*pgd)); - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) set_bit(PG_arch_1, &page[i].flags); } mark_kernel_p4d(pgd, addr, next); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/s390/pci/pci_dma.c +++ linux-lowlatency-5.15.0/arch/s390/pci/pci_dma.c @@ -542,6 +542,17 @@ s->dma_length = 0; } } + +static unsigned long *bitmap_vzalloc(size_t bits, gfp_t flags) +{ + size_t n = BITS_TO_LONGS(bits); + size_t bytes; + + if (unlikely(check_mul_overflow(n, sizeof(unsigned long), &bytes))) + return NULL; + + return vzalloc(bytes); +} int zpci_dma_init_device(struct zpci_dev *zdev) { @@ -578,13 +589,13 @@ zdev->end_dma - zdev->start_dma + 1); zdev->end_dma = zdev->start_dma + zdev->iommu_size - 1; zdev->iommu_pages = zdev->iommu_size >> PAGE_SHIFT; - zdev->iommu_bitmap = vzalloc(zdev->iommu_pages / 8); + zdev->iommu_bitmap = bitmap_vzalloc(zdev->iommu_pages, GFP_KERNEL); if (!zdev->iommu_bitmap) { rc = -ENOMEM; goto free_dma_table; } if (!s390_iommu_strict) { - zdev->lazy_bitmap = vzalloc(zdev->iommu_pages / 8); + zdev->lazy_bitmap = bitmap_vzalloc(zdev->iommu_pages, GFP_KERNEL); if (!zdev->lazy_bitmap) { rc = -ENOMEM; goto free_bitmap; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/sparc/lib/checksum_32.S +++ linux-lowlatency-5.15.0/arch/sparc/lib/checksum_32.S @@ -453,5 +453,5 @@ * we only bother with faults on loads... */ cc_fault: - ret + retl clr %o0 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/crypto/sha1_ssse3_glue.c +++ linux-lowlatency-5.15.0/arch/x86/crypto/sha1_ssse3_glue.c @@ -24,8 +24,17 @@ #include #include #include +#include #include +static const struct x86_cpu_id module_cpu_ids[] = { + X86_MATCH_FEATURE(X86_FEATURE_AVX2, NULL), + X86_MATCH_FEATURE(X86_FEATURE_AVX, NULL), + X86_MATCH_FEATURE(X86_FEATURE_SSSE3, NULL), + {} +}; +MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids); + static int sha1_update(struct shash_desc *desc, const u8 *data, unsigned int len, sha1_block_fn *sha1_xform) { @@ -301,6 +310,9 @@ static int __init sha1_ssse3_mod_init(void) { + if (!x86_match_cpu(module_cpu_ids)) + return -ENODEV; + if (register_sha1_ssse3()) goto fail; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/crypto/sha256_ssse3_glue.c +++ linux-lowlatency-5.15.0/arch/x86/crypto/sha256_ssse3_glue.c @@ -38,11 +38,20 @@ #include #include #include +#include #include asmlinkage void sha256_transform_ssse3(struct sha256_state *state, const u8 *data, int blocks); +static const struct x86_cpu_id module_cpu_ids[] = { + X86_MATCH_FEATURE(X86_FEATURE_AVX2, NULL), + X86_MATCH_FEATURE(X86_FEATURE_AVX, NULL), + X86_MATCH_FEATURE(X86_FEATURE_SSSE3, NULL), + {} +}; +MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids); + static int _sha256_update(struct shash_desc *desc, const u8 *data, unsigned int len, sha256_block_fn *sha256_xform) { @@ -366,6 +375,9 @@ static int __init sha256_ssse3_mod_init(void) { + if (!x86_match_cpu(module_cpu_ids)) + return -ENODEV; + if (register_sha256_ssse3()) goto fail; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/events/Makefile +++ linux-lowlatency-5.15.0/arch/x86/events/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += core.o probe.o +obj-y += core.o probe.o utils.o obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += rapl.o obj-y += amd/ obj-$(CONFIG_X86_LOCAL_APIC) += msr.o only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/events/intel/uncore_discovery.c +++ linux-lowlatency-5.15.0/arch/x86/events/intel/uncore_discovery.c @@ -140,13 +140,21 @@ unsigned int *box_offset, *ids; int i; - if (WARN_ON_ONCE(!unit->ctl || !unit->ctl_offset || !unit->ctr_offset)) + if (!unit->ctl || !unit->ctl_offset || !unit->ctr_offset) { + pr_info("Invalid address is detected for uncore type %d box %d, " + "Disable the uncore unit.\n", + unit->box_type, unit->box_id); return; + } if (parsed) { type = search_uncore_discovery_type(unit->box_type); - if (WARN_ON_ONCE(!type)) + if (!type) { + pr_info("A spurious uncore type %d is detected, " + "Disable the uncore type.\n", + unit->box_type); return; + } /* Store the first box of each die */ if (!type->box_ctrl_die[die]) type->box_ctrl_die[die] = unit->ctl; @@ -181,8 +189,12 @@ ids[i] = type->ids[i]; box_offset[i] = type->box_offset[i]; - if (WARN_ON_ONCE(unit->box_id == ids[i])) + if (unit->box_id == ids[i]) { + pr_info("Duplicate uncore type %d box ID %d is detected, " + "Drop the duplicate uncore unit.\n", + unit->box_type, unit->box_id); goto free_ids; + } } ids[i] = unit->box_id; box_offset[i] = unit->ctl - type->box_ctrl; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/events/utils.c +++ linux-lowlatency-5.15.0/arch/x86/events/utils.c @@ -0,0 +1,217 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +#include "perf_event.h" + +/* + * return the type of control flow change at address "from" + * instruction is not necessarily a branch (in case of interrupt). + * + * The branch type returned also includes the priv level of the + * target of the control flow change (X86_BR_USER, X86_BR_KERNEL). + * + * If a branch type is unknown OR the instruction cannot be + * decoded (e.g., text page not present), then X86_BR_NONE is + * returned. + */ +int branch_type(unsigned long from, unsigned long to, int abort) +{ + struct insn insn; + void *addr; + int bytes_read, bytes_left; + int ret = X86_BR_NONE; + int ext, to_plm, from_plm; + u8 buf[MAX_INSN_SIZE]; + int is64 = 0; + + to_plm = kernel_ip(to) ? X86_BR_KERNEL : X86_BR_USER; + from_plm = kernel_ip(from) ? X86_BR_KERNEL : X86_BR_USER; + + /* + * maybe zero if lbr did not fill up after a reset by the time + * we get a PMU interrupt + */ + if (from == 0 || to == 0) + return X86_BR_NONE; + + if (abort) + return X86_BR_ABORT | to_plm; + + if (from_plm == X86_BR_USER) { + /* + * can happen if measuring at the user level only + * and we interrupt in a kernel thread, e.g., idle. + */ + if (!current->mm) + return X86_BR_NONE; + + /* may fail if text not present */ + bytes_left = copy_from_user_nmi(buf, (void __user *)from, + MAX_INSN_SIZE); + bytes_read = MAX_INSN_SIZE - bytes_left; + if (!bytes_read) + return X86_BR_NONE; + + addr = buf; + } else { + /* + * The LBR logs any address in the IP, even if the IP just + * faulted. This means userspace can control the from address. + * Ensure we don't blindly read any address by validating it is + * a known text address and not a vsyscall address. + */ + if (kernel_text_address(from) && !in_gate_area_no_mm(from)) { + addr = (void *)from; + /* + * Assume we can get the maximum possible size + * when grabbing kernel data. This is not + * _strictly_ true since we could possibly be + * executing up next to a memory hole, but + * it is very unlikely to be a problem. + */ + bytes_read = MAX_INSN_SIZE; + } else { + return X86_BR_NONE; + } + } + + /* + * decoder needs to know the ABI especially + * on 64-bit systems running 32-bit apps + */ +#ifdef CONFIG_X86_64 + is64 = kernel_ip((unsigned long)addr) || any_64bit_mode(current_pt_regs()); +#endif + insn_init(&insn, addr, bytes_read, is64); + if (insn_get_opcode(&insn)) + return X86_BR_ABORT; + + switch (insn.opcode.bytes[0]) { + case 0xf: + switch (insn.opcode.bytes[1]) { + case 0x05: /* syscall */ + case 0x34: /* sysenter */ + ret = X86_BR_SYSCALL; + break; + case 0x07: /* sysret */ + case 0x35: /* sysexit */ + ret = X86_BR_SYSRET; + break; + case 0x80 ... 0x8f: /* conditional */ + ret = X86_BR_JCC; + break; + default: + ret = X86_BR_NONE; + } + break; + case 0x70 ... 0x7f: /* conditional */ + ret = X86_BR_JCC; + break; + case 0xc2: /* near ret */ + case 0xc3: /* near ret */ + case 0xca: /* far ret */ + case 0xcb: /* far ret */ + ret = X86_BR_RET; + break; + case 0xcf: /* iret */ + ret = X86_BR_IRET; + break; + case 0xcc ... 0xce: /* int */ + ret = X86_BR_INT; + break; + case 0xe8: /* call near rel */ + if (insn_get_immediate(&insn) || insn.immediate1.value == 0) { + /* zero length call */ + ret = X86_BR_ZERO_CALL; + break; + } + fallthrough; + case 0x9a: /* call far absolute */ + ret = X86_BR_CALL; + break; + case 0xe0 ... 0xe3: /* loop jmp */ + ret = X86_BR_JCC; + break; + case 0xe9 ... 0xeb: /* jmp */ + ret = X86_BR_JMP; + break; + case 0xff: /* call near absolute, call far absolute ind */ + if (insn_get_modrm(&insn)) + return X86_BR_ABORT; + + ext = (insn.modrm.bytes[0] >> 3) & 0x7; + switch (ext) { + case 2: /* near ind call */ + case 3: /* far ind call */ + ret = X86_BR_IND_CALL; + break; + case 4: + case 5: + ret = X86_BR_IND_JMP; + break; + } + break; + default: + ret = X86_BR_NONE; + } + /* + * interrupts, traps, faults (and thus ring transition) may + * occur on any instructions. Thus, to classify them correctly, + * we need to first look at the from and to priv levels. If they + * are different and to is in the kernel, then it indicates + * a ring transition. If the from instruction is not a ring + * transition instr (syscall, systenter, int), then it means + * it was a irq, trap or fault. + * + * we have no way of detecting kernel to kernel faults. + */ + if (from_plm == X86_BR_USER && to_plm == X86_BR_KERNEL + && ret != X86_BR_SYSCALL && ret != X86_BR_INT) + ret = X86_BR_IRQ; + + /* + * branch priv level determined by target as + * is done by HW when LBR_SELECT is implemented + */ + if (ret != X86_BR_NONE) + ret |= to_plm; + + return ret; +} + +#define X86_BR_TYPE_MAP_MAX 16 + +static int branch_map[X86_BR_TYPE_MAP_MAX] = { + PERF_BR_CALL, /* X86_BR_CALL */ + PERF_BR_RET, /* X86_BR_RET */ + PERF_BR_SYSCALL, /* X86_BR_SYSCALL */ + PERF_BR_SYSRET, /* X86_BR_SYSRET */ + PERF_BR_UNKNOWN, /* X86_BR_INT */ + PERF_BR_ERET, /* X86_BR_IRET */ + PERF_BR_COND, /* X86_BR_JCC */ + PERF_BR_UNCOND, /* X86_BR_JMP */ + PERF_BR_IRQ, /* X86_BR_IRQ */ + PERF_BR_IND_CALL, /* X86_BR_IND_CALL */ + PERF_BR_UNKNOWN, /* X86_BR_ABORT */ + PERF_BR_UNKNOWN, /* X86_BR_IN_TX */ + PERF_BR_UNKNOWN, /* X86_BR_NO_TX */ + PERF_BR_CALL, /* X86_BR_ZERO_CALL */ + PERF_BR_UNKNOWN, /* X86_BR_CALL_STACK */ + PERF_BR_IND, /* X86_BR_IND_JMP */ +}; + +int common_branch_type(int type) +{ + int i; + + type >>= 2; /* skip X86_BR_USER and X86_BR_KERNEL */ + + if (type) { + i = __ffs(type); + if (i < X86_BR_TYPE_MAP_MAX) + return branch_map[i]; + } + + return PERF_BR_UNKNOWN; +} only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/include/asm/i8259.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/i8259.h @@ -69,6 +69,8 @@ void (*make_irq)(unsigned int irq); }; +void legacy_pic_pcat_compat(void); + extern struct legacy_pic *legacy_pic; extern struct legacy_pic null_legacy_pic; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/include/asm/numa.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/numa.h @@ -12,13 +12,6 @@ #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) -/* - * Too small node sizes may confuse the VM badly. Usually they - * result from BIOS bugs. So dont recognize nodes as standalone - * NUMA entities that have less than this amount of RAM listed: - */ -#define NODE_MIN_SIZE (4*1024*1024) - extern int numa_off; /* only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/include/asm/page.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/page.h @@ -71,6 +71,16 @@ extern bool __virt_addr_valid(unsigned long kaddr); #define virt_addr_valid(kaddr) __virt_addr_valid((unsigned long) (kaddr)) +static __always_inline u64 __canonical_address(u64 vaddr, u8 vaddr_bits) +{ + return ((s64)vaddr << (64 - vaddr_bits)) >> (64 - vaddr_bits); +} + +static __always_inline u64 __is_canonical_address(u64 vaddr, u8 vaddr_bits) +{ + return __canonical_address(vaddr, vaddr_bits) == vaddr; +} + #endif /* __ASSEMBLY__ */ #include only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/include/asm/setup.h +++ linux-lowlatency-5.15.0/arch/x86/include/asm/setup.h @@ -108,27 +108,16 @@ void *extend_brk(size_t size, size_t align); /* - * Reserve space in the brk section. The name must be unique within - * the file, and somewhat descriptive. The size is in bytes. Must be - * used at file scope. + * Reserve space in the .brk section, which is a block of memory from which the + * caller is allowed to allocate very early (before even memblock is available) + * by calling extend_brk(). All allocated memory will be eventually converted + * to memblock. Any leftover unallocated memory will be freed. * - * (This uses a temp function to wrap the asm so we can pass it the - * size parameter; otherwise we wouldn't be able to. We can't use a - * "section" attribute on a normal variable because it always ends up - * being @progbits, which ends up allocating space in the vmlinux - * executable.) + * The size is in bytes. */ -#define RESERVE_BRK(name,sz) \ - static void __section(".discard.text") __used notrace \ - __brk_reservation_fn_##name##__(void) { \ - asm volatile ( \ - ".pushsection .brk_reservation,\"aw\",@nobits;" \ - ".brk." #name ":" \ - " 1:.skip %c0;" \ - " .size .brk." #name ", . - 1b;" \ - " .popsection" \ - : : "i" (sz)); \ - } +#define RESERVE_BRK(name, size) \ + __section(".bss..brk") __aligned(1) __used \ + static char __brk_##name[size] extern void probe_roms(void); #ifdef __i386__ @@ -141,12 +130,19 @@ #endif /* __i386__ */ #endif /* _SETUP */ -#else -#define RESERVE_BRK(name,sz) \ - .pushsection .brk_reservation,"aw",@nobits; \ -.brk.name: \ -1: .skip sz; \ - .size .brk.name,.-1b; \ + +#else /* __ASSEMBLY */ + +.macro __RESERVE_BRK name, size + .pushsection .bss..brk, "aw" +SYM_DATA_START(__brk_\name) + .skip \size +SYM_DATA_END(__brk_\name) .popsection +.endm + +#define RESERVE_BRK(name, size) __RESERVE_BRK name, size + #endif /* __ASSEMBLY__ */ + #endif /* _ASM_X86_SETUP_H */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/lib/copy_mc.c +++ linux-lowlatency-5.15.0/arch/x86/lib/copy_mc.c @@ -70,23 +70,23 @@ } EXPORT_SYMBOL_GPL(copy_mc_to_kernel); -unsigned long __must_check copy_mc_to_user(void *dst, const void *src, unsigned len) +unsigned long __must_check copy_mc_to_user(void __user *dst, const void *src, unsigned len) { unsigned long ret; if (copy_mc_fragile_enabled) { __uaccess_begin(); - ret = copy_mc_fragile(dst, src, len); + ret = copy_mc_fragile((__force void *)dst, src, len); __uaccess_end(); return ret; } if (static_cpu_has(X86_FEATURE_ERMS)) { __uaccess_begin(); - ret = copy_mc_enhanced_fast_string(dst, src, len); + ret = copy_mc_enhanced_fast_string((__force void *)dst, src, len); __uaccess_end(); return ret; } - return copy_user_generic(dst, src, len); + return copy_user_generic((__force void *)dst, src, len); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/arch/x86/mm/maccess.c +++ linux-lowlatency-5.15.0/arch/x86/mm/maccess.c @@ -4,22 +4,26 @@ #include #ifdef CONFIG_X86_64 -static __always_inline u64 canonical_address(u64 vaddr, u8 vaddr_bits) -{ - return ((s64)vaddr << (64 - vaddr_bits)) >> (64 - vaddr_bits); -} - bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size) { unsigned long vaddr = (unsigned long)unsafe_src; /* - * Range covering the highest possible canonical userspace address - * as well as non-canonical address range. For the canonical range - * we also need to include the userspace guard page. + * Do not allow userspace addresses. This disallows + * normal userspace and the userspace guard page: */ - return vaddr >= TASK_SIZE_MAX + PAGE_SIZE && - canonical_address(vaddr, boot_cpu_data.x86_virt_bits) == vaddr; + if (vaddr < TASK_SIZE_MAX + PAGE_SIZE) + return false; + + /* + * Allow everything during early boot before 'x86_virt_bits' + * is initialized. Needed for instruction decoding in early + * exception handlers. + */ + if (!boot_cpu_data.x86_virt_bits) + return true; + + return __is_canonical_address(vaddr, boot_cpu_data.x86_virt_bits); } #else bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/acpi/device_sysfs.c +++ linux-lowlatency-5.15.0/drivers/acpi/device_sysfs.c @@ -157,8 +157,8 @@ return 0; len = snprintf(modalias, size, "acpi:"); - if (len <= 0) - return len; + if (len >= size) + return -ENOMEM; size -= len; @@ -211,8 +211,10 @@ len = snprintf(modalias, size, "of:N%sT", (char *)buf.pointer); ACPI_FREE(buf.pointer); - if (len <= 0) - return len; + if (len >= size) + return -ENOMEM; + + size -= len; of_compatible = acpi_dev->data.of_compatible; if (of_compatible->type == ACPI_TYPE_PACKAGE) { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/acpi/irq.c +++ linux-lowlatency-5.15.0/drivers/acpi/irq.c @@ -52,6 +52,7 @@ int polarity) { struct irq_fwspec fwspec; + unsigned int irq; if (WARN_ON(!acpi_gsi_domain_id)) { pr_warn("GSI: No registered irqchip, giving up\n"); @@ -63,7 +64,11 @@ fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity); fwspec.param_count = 2; - return irq_create_fwspec_mapping(&fwspec); + irq = irq_create_fwspec_mapping(&fwspec); + if (!irq) + return -EINVAL; + + return irq; } EXPORT_SYMBOL_GPL(acpi_register_gsi); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/ata/pata_isapnp.c +++ linux-lowlatency-5.15.0/drivers/ata/pata_isapnp.c @@ -82,6 +82,9 @@ if (pnp_port_valid(idev, 1)) { ctl_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 1), 1); + if (!ctl_addr) + return -ENOMEM; + ap->ioaddr.altstatus_addr = ctl_addr; ap->ioaddr.ctl_addr = ctl_addr; ap->ops = &isapnp_port_ops; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/atm/iphase.c +++ linux-lowlatency-5.15.0/drivers/atm/iphase.c @@ -2293,19 +2293,21 @@ static int reset_sar(struct atm_dev *dev) { IADEV *iadev; - int i, error = 1; + int i, error; unsigned int pci[64]; iadev = INPH_IA_DEV(dev); - for(i=0; i<64; i++) - if ((error = pci_read_config_dword(iadev->pci, - i*4, &pci[i])) != PCIBIOS_SUCCESSFUL) - return error; + for (i = 0; i < 64; i++) { + error = pci_read_config_dword(iadev->pci, i * 4, &pci[i]); + if (error != PCIBIOS_SUCCESSFUL) + return error; + } writel(0, iadev->reg+IPHASE5575_EXT_RESET); - for(i=0; i<64; i++) - if ((error = pci_write_config_dword(iadev->pci, - i*4, pci[i])) != PCIBIOS_SUCCESSFUL) - return error; + for (i = 0; i < 64; i++) { + error = pci_write_config_dword(iadev->pci, i * 4, pci[i]); + if (error != PCIBIOS_SUCCESSFUL) + return error; + } udelay(5); return 0; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/base/devcoredump.c +++ linux-lowlatency-5.15.0/drivers/base/devcoredump.c @@ -25,6 +25,47 @@ struct device devcd_dev; void *data; size_t datalen; + /* + * Here, mutex is required to serialize the calls to del_wk work between + * user/kernel space which happens when devcd is added with device_add() + * and that sends uevent to user space. User space reads the uevents, + * and calls to devcd_data_write() which try to modify the work which is + * not even initialized/queued from devcoredump. + * + * + * + * cpu0(X) cpu1(Y) + * + * dev_coredump() uevent sent to user space + * device_add() ======================> user space process Y reads the + * uevents writes to devcd fd + * which results into writes to + * + * devcd_data_write() + * mod_delayed_work() + * try_to_grab_pending() + * del_timer() + * debug_assert_init() + * INIT_DELAYED_WORK() + * schedule_delayed_work() + * + * + * Also, mutex alone would not be enough to avoid scheduling of + * del_wk work after it get flush from a call to devcd_free() + * mentioned as below. + * + * disabled_store() + * devcd_free() + * mutex_lock() devcd_data_write() + * flush_delayed_work() + * mutex_unlock() + * mutex_lock() + * mod_delayed_work() + * mutex_unlock() + * So, delete_work flag is required. + */ + struct mutex mutex; + bool delete_work; struct module *owner; ssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen); @@ -84,7 +125,12 @@ struct device *dev = kobj_to_dev(kobj); struct devcd_entry *devcd = dev_to_devcd(dev); - mod_delayed_work(system_wq, &devcd->del_wk, 0); + mutex_lock(&devcd->mutex); + if (!devcd->delete_work) { + devcd->delete_work = true; + mod_delayed_work(system_wq, &devcd->del_wk, 0); + } + mutex_unlock(&devcd->mutex); return count; } @@ -112,7 +158,12 @@ { struct devcd_entry *devcd = dev_to_devcd(dev); + mutex_lock(&devcd->mutex); + if (!devcd->delete_work) + devcd->delete_work = true; + flush_delayed_work(&devcd->del_wk); + mutex_unlock(&devcd->mutex); return 0; } @@ -122,6 +173,30 @@ return sysfs_emit(buf, "%d\n", devcd_disabled); } +/* + * + * disabled_store() worker() + * class_for_each_device(&devcd_class, + * NULL, NULL, devcd_free) + * ... + * ... + * while ((dev = class_dev_iter_next(&iter)) + * devcd_del() + * device_del() + * put_device() <- last reference + * error = fn(dev, data) devcd_dev_release() + * devcd_free(dev, data) kfree(devcd) + * mutex_lock(&devcd->mutex); + * + * + * In the above diagram, It looks like disabled_store() would be racing with parallely + * running devcd_del() and result in memory abort while acquiring devcd->mutex which + * is called after kfree of devcd memory after dropping its last reference with + * put_device(). However, this will not happens as fn(dev, data) runs + * with its own reference to device via klist_node so it is not its last reference. + * so, above situation would not occur. + */ + static ssize_t disabled_store(struct class *class, struct class_attribute *attr, const char *buf, size_t count) { @@ -278,13 +353,17 @@ devcd->read = read; devcd->free = free; devcd->failing_dev = get_device(dev); + devcd->delete_work = false; + mutex_init(&devcd->mutex); device_initialize(&devcd->devcd_dev); dev_set_name(&devcd->devcd_dev, "devcd%d", atomic_inc_return(&devcd_count)); devcd->devcd_dev.class = &devcd_class; + mutex_lock(&devcd->mutex); + dev_set_uevent_suppress(&devcd->devcd_dev, true); if (device_add(&devcd->devcd_dev)) goto put_device; @@ -299,12 +378,15 @@ "devcoredump")) dev_warn(dev, "devcoredump create_link failed\n"); + dev_set_uevent_suppress(&devcd->devcd_dev, false); + kobject_uevent(&devcd->devcd_dev.kobj, KOBJ_ADD); INIT_DELAYED_WORK(&devcd->del_wk, devcd_del); schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT); - + mutex_unlock(&devcd->mutex); return; put_device: put_device(&devcd->devcd_dev); + mutex_unlock(&devcd->mutex); put_module: module_put(owner); free: only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/base/driver.c +++ linux-lowlatency-5.15.0/drivers/base/driver.c @@ -31,6 +31,75 @@ } /** + * driver_set_override() - Helper to set or clear driver override. + * @dev: Device to change + * @override: Address of string to change (e.g. &device->driver_override); + * The contents will be freed and hold newly allocated override. + * @s: NUL-terminated string, new driver name to force a match, pass empty + * string to clear it ("" or "\n", where the latter is only for sysfs + * interface). + * @len: length of @s + * + * Helper to set or clear driver override in a device, intended for the cases + * when the driver_override field is allocated by driver/bus code. + * + * Returns: 0 on success or a negative error code on failure. + */ +int driver_set_override(struct device *dev, const char **override, + const char *s, size_t len) +{ + const char *new, *old; + char *cp; + + if (!override || !s) + return -EINVAL; + + /* + * The stored value will be used in sysfs show callback (sysfs_emit()), + * which has a length limit of PAGE_SIZE and adds a trailing newline. + * Thus we can store one character less to avoid truncation during sysfs + * show. + */ + if (len >= (PAGE_SIZE - 1)) + return -EINVAL; + + if (!len) { + /* Empty string passed - clear override */ + device_lock(dev); + old = *override; + *override = NULL; + device_unlock(dev); + kfree(old); + + return 0; + } + + cp = strnchr(s, len, '\n'); + if (cp) + len = cp - s; + + new = kstrndup(s, len, GFP_KERNEL); + if (!new) + return -ENOMEM; + + device_lock(dev); + old = *override; + if (cp != s) { + *override = new; + } else { + /* "\n" passed - clear override */ + kfree(new); + *override = NULL; + } + device_unlock(dev); + + kfree(old); + + return 0; +} +EXPORT_SYMBOL_GPL(driver_set_override); + +/** * driver_for_each_device - Iterator for devices bound to a driver. * @drv: Driver we're iterating. * @start: Device to begin with only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/base/regmap/regmap-debugfs.c +++ linux-lowlatency-5.15.0/drivers/base/regmap/regmap-debugfs.c @@ -48,7 +48,7 @@ name = map->dev->driver->name; ret = snprintf(buf, PAGE_SIZE, "%s\n", name); - if (ret < 0) { + if (ret >= PAGE_SIZE) { kfree(buf); return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/clk-npcm7xx.c +++ linux-lowlatency-5.15.0/drivers/clk/clk-npcm7xx.c @@ -539,7 +539,7 @@ return; npcm7xx_init_fail: - kfree(npcm7xx_clk_data->hws); + kfree(npcm7xx_clk_data); npcm7xx_init_np_err: iounmap(clk_base); npcm7xx_init_error: only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/clk-scmi.c +++ linux-lowlatency-5.15.0/drivers/clk/clk-scmi.c @@ -178,6 +178,7 @@ sclk->info = scmi_proto_clk_ops->info_get(ph, idx); if (!sclk->info) { dev_dbg(dev, "invalid clock info for idx %d\n", idx); + devm_kfree(dev, sclk); continue; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/imx/Kconfig +++ linux-lowlatency-5.15.0/drivers/clk/imx/Kconfig @@ -96,5 +96,6 @@ depends on (ARCH_MXC && ARM64) || COMPILE_TEST depends on IMX_SCU && HAVE_ARM_SMCCC select MXC_CLK_SCU + select MXC_CLK help Build the driver for IMX8QXP SCU based clocks. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/imx/clk-imx8mq.c +++ linux-lowlatency-5.15.0/drivers/clk/imx/clk-imx8mq.c @@ -288,8 +288,7 @@ void __iomem *base; int err; - clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, - IMX8MQ_CLK_END), GFP_KERNEL); + clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MQ_CLK_END), GFP_KERNEL); if (WARN_ON(!clk_hw_data)) return -ENOMEM; @@ -306,10 +305,12 @@ hws[IMX8MQ_CLK_EXT4] = imx_obtain_fixed_clk_hw(np, "clk_ext4"); np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-anatop"); - base = of_iomap(np, 0); + base = devm_of_iomap(dev, np, 0, NULL); of_node_put(np); - if (WARN_ON(!base)) - return -ENOMEM; + if (WARN_ON(IS_ERR(base))) { + err = PTR_ERR(base); + goto unregister_hws; + } hws[IMX8MQ_ARM_PLL_REF_SEL] = imx_clk_hw_mux("arm_pll_ref_sel", base + 0x28, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); hws[IMX8MQ_GPU_PLL_REF_SEL] = imx_clk_hw_mux("gpu_pll_ref_sel", base + 0x18, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)); @@ -395,8 +396,10 @@ np = dev->of_node; base = devm_platform_ioremap_resource(pdev, 0); - if (WARN_ON(IS_ERR(base))) - return PTR_ERR(base); + if (WARN_ON(IS_ERR(base))) { + err = PTR_ERR(base); + goto unregister_hws; + } /* CORE */ hws[IMX8MQ_CLK_A53_DIV] = imx8m_clk_hw_composite_core("arm_a53_div", imx8mq_a53_sels, base + 0x8000); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt2701.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt2701.c @@ -675,6 +675,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_TOP_NR); + if (!clk_data) + return -ENOMEM; mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data); @@ -742,6 +744,8 @@ if (!infra_clk_data) { infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); + if (!infra_clk_data) + return; for (i = 0; i < CLK_INFRA_NR; i++) infra_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER); @@ -768,6 +772,8 @@ if (!infra_clk_data) { infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); + if (!infra_clk_data) + return -ENOMEM; } else { for (i = 0; i < CLK_INFRA_NR; i++) { if (infra_clk_data->clks[i] == ERR_PTR(-EPROBE_DEFER)) @@ -896,6 +902,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_PERI_NR); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), clk_data); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt6765.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt6765.c @@ -785,6 +785,8 @@ } clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); @@ -820,6 +822,8 @@ } clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), clk_data); @@ -860,6 +864,8 @@ } clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, ifr_clks, ARRAY_SIZE(ifr_clks), clk_data); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt6779.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt6779.c @@ -1216,6 +1216,8 @@ struct device_node *node = pdev->dev.of_node; clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); @@ -1236,6 +1238,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt6797.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt6797.c @@ -391,6 +391,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_TOP_NR); + if (!clk_data) + return -ENOMEM; mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs), clk_data); @@ -563,6 +565,8 @@ if (!infra_clk_data) { infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); + if (!infra_clk_data) + return; for (i = 0; i < CLK_INFRA_NR; i++) infra_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER); @@ -587,6 +591,8 @@ if (!infra_clk_data) { infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR); + if (!infra_clk_data) + return -ENOMEM; } else { for (i = 0; i < CLK_INFRA_NR; i++) { if (infra_clk_data->clks[i] == ERR_PTR(-EPROBE_DEFER)) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt7629-eth.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt7629-eth.c @@ -83,6 +83,8 @@ int r; clk_data = mtk_alloc_clk_data(CLK_ETH_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, eth_clks, CLK_ETH_NR_CLK, clk_data); @@ -105,6 +107,8 @@ int r; clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, sgmii_clks[id++], CLK_SGMII_NR_CLK, clk_data); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/mediatek/clk-mt7629.c +++ linux-lowlatency-5.15.0/drivers/clk/mediatek/clk-mt7629.c @@ -580,6 +580,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data); @@ -603,6 +605,8 @@ struct clk_onecell_data *clk_data; clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks), clk_data); @@ -626,6 +630,8 @@ return PTR_ERR(base); clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK); + if (!clk_data) + return -ENOMEM; mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), clk_data); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/qcom/gcc-sm8150.c +++ linux-lowlatency-5.15.0/drivers/clk/qcom/gcc-sm8150.c @@ -792,7 +792,7 @@ .name = "gcc_sdcc2_apps_clk_src", .parent_data = gcc_parents_6, .num_parents = ARRAY_SIZE(gcc_parents_6), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_OPS_PARENT_ENABLE, .ops = &clk_rcg2_floor_ops, }, }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/qcom/mmcc-msm8998.c +++ linux-lowlatency-5.15.0/drivers/clk/qcom/mmcc-msm8998.c @@ -2487,6 +2487,7 @@ static struct clk_branch mnoc_ahb_clk = { .halt_reg = 0x5024, + .halt_check = BRANCH_HALT_SKIP, .clkr = { .enable_reg = 0x5024, .enable_mask = BIT(0), @@ -2502,6 +2503,7 @@ static struct clk_branch bimc_smmu_ahb_clk = { .halt_reg = 0xe004, + .halt_check = BRANCH_HALT_SKIP, .hwcg_reg = 0xe004, .hwcg_bit = 1, .clkr = { @@ -2519,6 +2521,7 @@ static struct clk_branch bimc_smmu_axi_clk = { .halt_reg = 0xe008, + .halt_check = BRANCH_HALT_SKIP, .hwcg_reg = 0xe008, .hwcg_bit = 1, .clkr = { @@ -2659,11 +2662,13 @@ static struct gdsc bimc_smmu_gdsc = { .gdscr = 0xe020, .gds_hw_ctrl = 0xe024, + .cxcs = (unsigned int []){ 0xe008 }, + .cxc_count = 1, .pd = { .name = "bimc_smmu", }, .pwrsts = PWRSTS_OFF_ON, - .flags = HW_CTRL | ALWAYS_ON, + .flags = VOTABLE, }; static struct clk_regmap *mmcc_msm8998_clocks[] = { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/socfpga/stratix10-clk.h +++ linux-lowlatency-5.15.0/drivers/clk/socfpga/stratix10-clk.h @@ -7,8 +7,10 @@ #define __STRATIX10_CLK_H struct stratix10_clock_data { - struct clk_hw_onecell_data clk_data; void __iomem *base; + + /* Must be last */ + struct clk_hw_onecell_data clk_data; }; struct stratix10_pll_clock { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/apll.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/apll.c @@ -139,6 +139,7 @@ struct clk_hw *hw = user; struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct dpll_data *ad = clk_hw->dpll_data; + const char *name; struct clk *clk; const struct clk_init_data *init = clk_hw->hw.init; @@ -166,7 +167,8 @@ ad->clk_bypass = __clk_get_hw(clk); - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name); + name = ti_dt_clk_name(node); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); kfree(init->parent_names); @@ -198,7 +200,7 @@ clk_hw->dpll_data = ad; clk_hw->hw.init = init; - init->name = node->name; + init->name = ti_dt_clk_name(node); init->ops = &apll_ck_ops; init->num_parents = of_clk_get_parent_count(node); @@ -347,6 +349,7 @@ struct dpll_data *ad = NULL; struct clk_hw_omap *clk_hw = NULL; struct clk_init_data *init = NULL; + const char *name; struct clk *clk; const char *parent_name; u32 val; @@ -362,7 +365,8 @@ clk_hw->dpll_data = ad; clk_hw->hw.init = init; init->ops = &omap2_apll_ops; - init->name = node->name; + name = ti_dt_clk_name(node); + init->name = name; clk_hw->ops = &omap2_apll_hwops; init->num_parents = of_clk_get_parent_count(node); @@ -403,7 +407,8 @@ if (ret) goto cleanup; - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name); + name = ti_dt_clk_name(node); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); kfree(init); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/autoidle.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/autoidle.c @@ -205,7 +205,7 @@ return -ENOMEM; clk->shift = shift; - clk->name = node->name; + clk->name = ti_dt_clk_name(node); ret = ti_clk_get_reg_addr(node, 0, &clk->reg); if (ret) { kfree(clk); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/clock.h +++ linux-lowlatency-5.15.0/drivers/clk/ti/clock.h @@ -210,11 +210,12 @@ typedef void (*ti_of_clk_init_cb_t)(void *, struct device_node *); -struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw, - const char *con); -struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw, - const char *con); -int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con); +struct clk *of_ti_clk_register(struct device_node *node, struct clk_hw *hw, + const char *con); +struct clk *of_ti_clk_register_omap_hw(struct device_node *node, + struct clk_hw *hw, const char *con); +const char *ti_dt_clk_name(struct device_node *np); +int ti_clk_add_alias(struct clk *clk, const char *con); void ti_clk_add_aliases(void); void ti_clk_latch(struct clk_omap_reg *reg, s8 shift); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/clockdomain.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/clockdomain.c @@ -131,7 +131,7 @@ { struct clk *clk; struct clk_hw *clk_hw; - const char *clkdm_name = node->name; + const char *clkdm_name = ti_dt_clk_name(node); int i; unsigned int num_clks; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/composite.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/composite.c @@ -125,6 +125,7 @@ struct component_clk *comp; int num_parents = 0; const char **parent_names = NULL; + const char *name; int i; int ret; @@ -172,7 +173,8 @@ goto cleanup; } - clk = clk_register_composite(NULL, node->name, + name = ti_dt_clk_name(node); + clk = clk_register_composite(NULL, name, parent_names, num_parents, _get_hw(cclk, CLK_COMPONENT_TYPE_MUX), &ti_clk_mux_ops, @@ -182,7 +184,7 @@ &ti_composite_gate_ops, 0); if (!IS_ERR(clk)) { - ret = ti_clk_add_alias(NULL, clk, node->name); + ret = ti_clk_add_alias(clk, name); if (ret) { clk_unregister(clk); goto cleanup; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/divider.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/divider.c @@ -317,13 +317,14 @@ u32 flags, struct clk_omap_divider *div) { - struct clk *clk; struct clk_init_data init; const char *parent_name; + const char *name; parent_name = of_clk_get_parent_name(node, 0); - init.name = node->name; + name = ti_dt_clk_name(node); + init.name = name; init.ops = &ti_clk_divider_ops; init.flags = flags; init.parent_names = (parent_name ? &parent_name : NULL); @@ -332,12 +333,7 @@ div->hw.init = &init; /* register the clock */ - clk = ti_clk_register(NULL, &div->hw, node->name); - - if (IS_ERR(clk)) - kfree(div); - - return clk; + return of_ti_clk_register(node, &div->hw, name); } int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/dpll.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/dpll.c @@ -164,6 +164,7 @@ struct clk_hw *hw = user; struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct dpll_data *dd = clk_hw->dpll_data; + const char *name; struct clk *clk; const struct clk_init_data *init = hw->init; @@ -193,7 +194,8 @@ dd->clk_bypass = __clk_get_hw(clk); /* register the clock */ - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name); + name = ti_dt_clk_name(node); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); @@ -227,7 +229,7 @@ struct clk *clk; struct clk_init_data init = { NULL }; struct clk_hw_omap *clk_hw; - const char *name = node->name; + const char *name = ti_dt_clk_name(node); const char *parent_name; parent_name = of_clk_get_parent_name(node, 0); @@ -265,7 +267,7 @@ #endif /* register the clock */ - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (IS_ERR(clk)) kfree(clk_hw); @@ -304,7 +306,7 @@ clk_hw->ops = &clkhwops_omap3_dpll; clk_hw->hw.init = init; - init->name = node->name; + init->name = ti_dt_clk_name(node); init->ops = ops; init->num_parents = of_clk_get_parent_count(node); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/fapll.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/fapll.c @@ -19,6 +19,8 @@ #include #include +#include "clock.h" + /* FAPLL Control Register PLL_CTRL */ #define FAPLL_MAIN_MULT_N_SHIFT 16 #define FAPLL_MAIN_DIV_P_SHIFT 8 @@ -542,6 +544,7 @@ struct clk_init_data *init = NULL; const char *parent_name[2]; struct clk *pll_clk; + const char *name; int i; fd = kzalloc(sizeof(*fd), GFP_KERNEL); @@ -559,7 +562,8 @@ goto free; init->ops = &ti_fapll_ops; - init->name = node->name; + name = ti_dt_clk_name(node); + init->name = name; init->num_parents = of_clk_get_parent_count(node); if (init->num_parents != 2) { @@ -591,7 +595,7 @@ if (fapll_is_ddr_pll(fd->base)) fd->bypass_bit_inverted = true; - fd->name = node->name; + fd->name = name; fd->hw.init = init; /* Register the parent PLL */ @@ -638,8 +642,7 @@ freq = NULL; } synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance, - output_name, node->name, - pll_clk); + output_name, name, pll_clk); if (IS_ERR(synth_clk)) continue; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/fixed-factor.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/fixed-factor.c @@ -36,7 +36,7 @@ static void __init of_ti_fixed_factor_clk_setup(struct device_node *node) { struct clk *clk; - const char *clk_name = node->name; + const char *clk_name = ti_dt_clk_name(node); const char *parent_name; u32 div, mult; u32 flags = 0; @@ -62,7 +62,7 @@ if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); of_ti_clk_autoidle_setup(node); - ti_clk_add_alias(NULL, clk, clk_name); + ti_clk_add_alias(clk, clk_name); } } CLK_OF_DECLARE(ti_fixed_factor_clk, "ti,fixed-factor-clock", only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/gate.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/gate.c @@ -93,7 +93,7 @@ return ret; } -static struct clk *_register_gate(struct device *dev, const char *name, +static struct clk *_register_gate(struct device_node *node, const char *name, const char *parent_name, unsigned long flags, struct clk_omap_reg *reg, u8 bit_idx, u8 clk_gate_flags, const struct clk_ops *ops, @@ -123,7 +123,7 @@ init.flags = flags; - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (IS_ERR(clk)) kfree(clk_hw); @@ -138,6 +138,7 @@ struct clk *clk; const char *parent_name; struct clk_omap_reg reg; + const char *name; u8 enable_bit = 0; u32 val; u32 flags = 0; @@ -164,7 +165,8 @@ if (of_property_read_bool(node, "ti,set-bit-to-disable")) clk_gate_flags |= INVERT_ENABLE; - clk = _register_gate(NULL, node->name, parent_name, flags, ®, + name = ti_dt_clk_name(node); + clk = _register_gate(node, name, parent_name, flags, ®, enable_bit, clk_gate_flags, ops, hw_ops); if (!IS_ERR(clk)) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/interface.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/interface.c @@ -32,7 +32,8 @@ .is_enabled = &omap2_dflt_clk_is_enabled, }; -static struct clk *_register_interface(struct device *dev, const char *name, +static struct clk *_register_interface(struct device_node *node, + const char *name, const char *parent_name, struct clk_omap_reg *reg, u8 bit_idx, const struct clk_hw_omap_ops *ops) @@ -57,7 +58,7 @@ init.num_parents = 1; init.parent_names = &parent_name; - clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name); + clk = of_ti_clk_register_omap_hw(node, &clk_hw->hw, name); if (IS_ERR(clk)) kfree(clk_hw); @@ -72,6 +73,7 @@ const char *parent_name; struct clk_omap_reg reg; u8 enable_bit = 0; + const char *name; u32 val; if (ti_clk_get_reg_addr(node, 0, ®)) @@ -86,7 +88,8 @@ return; } - clk = _register_interface(NULL, node->name, parent_name, ®, + name = ti_dt_clk_name(node); + clk = _register_interface(node, name, parent_name, ®, enable_bit, ops); if (!IS_ERR(clk)) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clk/ti/mux.c +++ linux-lowlatency-5.15.0/drivers/clk/ti/mux.c @@ -126,7 +126,7 @@ .restore_context = clk_mux_restore_context, }; -static struct clk *_register_mux(struct device *dev, const char *name, +static struct clk *_register_mux(struct device_node *node, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, struct clk_omap_reg *reg, u8 shift, u32 mask, @@ -156,7 +156,7 @@ mux->table = table; mux->hw.init = &init; - clk = ti_clk_register(dev, &mux->hw, name); + clk = of_ti_clk_register(node, &mux->hw, name); if (IS_ERR(clk)) kfree(mux); @@ -176,6 +176,7 @@ struct clk_omap_reg reg; unsigned int num_parents; const char **parent_names; + const char *name; u8 clk_mux_flags = 0; u32 mask = 0; u32 shift = 0; @@ -213,7 +214,8 @@ mask = (1 << fls(mask)) - 1; - clk = _register_mux(NULL, node->name, parent_names, num_parents, + name = ti_dt_clk_name(node); + clk = _register_mux(node, name, parent_names, num_parents, flags, ®, shift, mask, latch, clk_mux_flags, NULL); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clocksource/timer-atmel-tcb.c +++ linux-lowlatency-5.15.0/drivers/clocksource/timer-atmel-tcb.c @@ -315,6 +315,7 @@ writel(mck_divisor_idx /* likely divide-by-8 */ | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP /* free-run */ + | ATMEL_TC_ASWTRG_SET /* TIOA0 rises at software trigger */ | ATMEL_TC_ACPA_SET /* TIOA0 rises at 0 */ | ATMEL_TC_ACPC_CLEAR, /* (duty cycle 50%) */ tcaddr + ATMEL_TC_REG(0, CMR)); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/clocksource/timer-imx-gpt.c +++ linux-lowlatency-5.15.0/drivers/clocksource/timer-imx-gpt.c @@ -454,12 +454,16 @@ return -ENOMEM; imxtm->base = of_iomap(np, 0); - if (!imxtm->base) - return -ENXIO; + if (!imxtm->base) { + ret = -ENXIO; + goto err_kfree; + } imxtm->irq = irq_of_parse_and_map(np, 0); - if (imxtm->irq <= 0) - return -EINVAL; + if (imxtm->irq <= 0) { + ret = -EINVAL; + goto err_kfree; + } imxtm->clk_ipg = of_clk_get_by_name(np, "ipg"); @@ -472,11 +476,15 @@ ret = _mxc_timer_init(imxtm); if (ret) - return ret; + goto err_kfree; initialized = 1; return 0; + +err_kfree: + kfree(imxtm); + return ret; } static int __init imx1_timer_init_dt(struct device_node *np) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/cpufreq/cpufreq_stats.c +++ linux-lowlatency-5.15.0/drivers/cpufreq/cpufreq_stats.c @@ -131,25 +131,25 @@ len += scnprintf(buf + len, PAGE_SIZE - len, " From : To\n"); len += scnprintf(buf + len, PAGE_SIZE - len, " : "); for (i = 0; i < stats->state_num; i++) { - if (len >= PAGE_SIZE) + if (len >= PAGE_SIZE - 1) break; len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ", stats->freq_table[i]); } - if (len >= PAGE_SIZE) - return PAGE_SIZE; + if (len >= PAGE_SIZE - 1) + return PAGE_SIZE - 1; len += scnprintf(buf + len, PAGE_SIZE - len, "\n"); for (i = 0; i < stats->state_num; i++) { - if (len >= PAGE_SIZE) + if (len >= PAGE_SIZE - 1) break; len += scnprintf(buf + len, PAGE_SIZE - len, "%9u: ", stats->freq_table[i]); for (j = 0; j < stats->state_num; j++) { - if (len >= PAGE_SIZE) + if (len >= PAGE_SIZE - 1) break; if (pending) @@ -159,12 +159,12 @@ len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ", count); } - if (len >= PAGE_SIZE) + if (len >= PAGE_SIZE - 1) break; len += scnprintf(buf + len, PAGE_SIZE - len, "\n"); } - if (len >= PAGE_SIZE) { + if (len >= PAGE_SIZE - 1) { pr_warn_once("cpufreq transition table exceeds PAGE_SIZE. Disabling\n"); return -EFBIG; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/cpufreq/imx6q-cpufreq.c +++ linux-lowlatency-5.15.0/drivers/cpufreq/imx6q-cpufreq.c @@ -209,6 +209,14 @@ .suspend = cpufreq_generic_suspend, }; +static void imx6x_disable_freq_in_opp(struct device *dev, unsigned long freq) +{ + int ret = dev_pm_opp_disable(dev, freq); + + if (ret < 0 && ret != -ENODEV) + dev_warn(dev, "failed to disable %ldMHz OPP\n", freq / 1000000); +} + #define OCOTP_CFG3 0x440 #define OCOTP_CFG3_SPEED_SHIFT 16 #define OCOTP_CFG3_SPEED_1P2GHZ 0x3 @@ -254,17 +262,15 @@ val &= 0x3; if (val < OCOTP_CFG3_SPEED_996MHZ) - if (dev_pm_opp_disable(dev, 996000000)) - dev_warn(dev, "failed to disable 996MHz OPP\n"); + imx6x_disable_freq_in_opp(dev, 996000000); if (of_machine_is_compatible("fsl,imx6q") || of_machine_is_compatible("fsl,imx6qp")) { if (val != OCOTP_CFG3_SPEED_852MHZ) - if (dev_pm_opp_disable(dev, 852000000)) - dev_warn(dev, "failed to disable 852MHz OPP\n"); + imx6x_disable_freq_in_opp(dev, 852000000); + if (val != OCOTP_CFG3_SPEED_1P2GHZ) - if (dev_pm_opp_disable(dev, 1200000000)) - dev_warn(dev, "failed to disable 1.2GHz OPP\n"); + imx6x_disable_freq_in_opp(dev, 1200000000); } return 0; @@ -316,20 +322,16 @@ val >>= OCOTP_CFG3_SPEED_SHIFT; val &= 0x3; - if (of_machine_is_compatible("fsl,imx6ul")) { + if (of_machine_is_compatible("fsl,imx6ul")) if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) - if (dev_pm_opp_disable(dev, 696000000)) - dev_warn(dev, "failed to disable 696MHz OPP\n"); - } + imx6x_disable_freq_in_opp(dev, 696000000); if (of_machine_is_compatible("fsl,imx6ull")) { - if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ) - if (dev_pm_opp_disable(dev, 792000000)) - dev_warn(dev, "failed to disable 792MHz OPP\n"); + if (val < OCOTP_CFG3_6ULL_SPEED_792MHZ) + imx6x_disable_freq_in_opp(dev, 792000000); if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ) - if (dev_pm_opp_disable(dev, 900000000)) - dev_warn(dev, "failed to disable 900MHz OPP\n"); + imx6x_disable_freq_in_opp(dev, 900000000); } return ret; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/crypto/qat/qat_common/adf_transport_debug.c +++ linux-lowlatency-5.15.0/drivers/crypto/qat/qat_common/adf_transport_debug.c @@ -90,7 +90,7 @@ int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name) { struct adf_etr_ring_debug_entry *ring_debug; - char entry_name[8]; + char entry_name[16]; ring_debug = kzalloc(sizeof(*ring_debug), GFP_KERNEL); if (!ring_debug) @@ -192,7 +192,7 @@ { struct adf_accel_dev *accel_dev = bank->accel_dev; struct dentry *parent = accel_dev->transport->debug; - char name[8]; + char name[16]; snprintf(name, sizeof(name), "bank_%02d", bank->bank_number); bank->bank_debug_dir = debugfs_create_dir(name, parent); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/cxl/core/memdev.c +++ linux-lowlatency-5.15.0/drivers/cxl/core/memdev.c @@ -139,10 +139,9 @@ struct cdev *cdev = &cxlmd->cdev; const struct cdevm_file_operations *cdevm_fops; + cdev_device_del(&cxlmd->cdev, dev); cdevm_fops = container_of(cdev->ops, typeof(*cdevm_fops), fops); cdevm_fops->shutdown(dev); - - cdev_device_del(&cxlmd->cdev, dev); put_device(dev); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/devfreq/event/rockchip-dfi.c +++ linux-lowlatency-5.15.0/drivers/devfreq/event/rockchip-dfi.c @@ -194,14 +194,15 @@ return PTR_ERR(data->clk); } - /* try to find the optional reference to the pmu syscon */ node = of_parse_phandle(np, "rockchip,pmu", 0); - if (node) { - data->regmap_pmu = syscon_node_to_regmap(node); - of_node_put(node); - if (IS_ERR(data->regmap_pmu)) - return PTR_ERR(data->regmap_pmu); - } + if (!node) + return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n"); + + data->regmap_pmu = syscon_node_to_regmap(node); + of_node_put(node); + if (IS_ERR(data->regmap_pmu)) + return PTR_ERR(data->regmap_pmu); + data->dev = dev; desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/dma/idxd/Makefile +++ linux-lowlatency-5.15.0/drivers/dma/idxd/Makefile @@ -1,12 +1,12 @@ ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD +obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o +idxd_bus-y := bus.o + obj-$(CONFIG_INTEL_IDXD) += idxd.o idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o -obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o -idxd_bus-y := bus.o - obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o idxd_compat-y := compat.o only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/dma/ti/edma.c +++ linux-lowlatency-5.15.0/drivers/dma/ti/edma.c @@ -2459,7 +2459,7 @@ if (irq < 0 && node) irq = irq_of_parse_and_map(node, 0); - if (irq >= 0) { + if (irq > 0) { irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint", dev_name(dev)); ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name, @@ -2475,7 +2475,7 @@ if (irq < 0 && node) irq = irq_of_parse_and_map(node, 2); - if (irq >= 0) { + if (irq > 0) { irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint", dev_name(dev)); ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/firewire/core-device.c +++ linux-lowlatency-5.15.0/drivers/firewire/core-device.c @@ -719,14 +719,11 @@ fw_unit_attributes, &unit->attribute_group); - if (device_register(&unit->device) < 0) - goto skip_unit; - fw_device_get(device); - continue; - - skip_unit: - kfree(unit); + if (device_register(&unit->device) < 0) { + put_device(&unit->device); + continue; + } } } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/firmware/ti_sci.c +++ linux-lowlatency-5.15.0/drivers/firmware/ti_sci.c @@ -190,19 +190,6 @@ return 0; } -/** - * ti_sci_debugfs_destroy() - clean up log debug file - * @pdev: platform device pointer - * @info: Pointer to SCI entity information - */ -static void ti_sci_debugfs_destroy(struct platform_device *pdev, - struct ti_sci_info *info) -{ - if (IS_ERR(info->debug_region)) - return; - - debugfs_remove(info->d); -} #else /* CONFIG_DEBUG_FS */ static inline int ti_sci_debugfs_create(struct platform_device *dev, struct ti_sci_info *info) @@ -3435,43 +3422,12 @@ return ret; } -static int ti_sci_remove(struct platform_device *pdev) -{ - struct ti_sci_info *info; - struct device *dev = &pdev->dev; - int ret = 0; - - of_platform_depopulate(dev); - - info = platform_get_drvdata(pdev); - - if (info->nb.notifier_call) - unregister_restart_handler(&info->nb); - - mutex_lock(&ti_sci_list_mutex); - if (info->users) - ret = -EBUSY; - else - list_del(&info->node); - mutex_unlock(&ti_sci_list_mutex); - - if (!ret) { - ti_sci_debugfs_destroy(pdev, info); - - /* Safe to free channels since no more users */ - mbox_free_channel(info->chan_tx); - mbox_free_channel(info->chan_rx); - } - - return ret; -} - static struct platform_driver ti_sci_driver = { .probe = ti_sci_probe, - .remove = ti_sci_remove, .driver = { .name = "ti-sci", .of_match_table = of_match_ptr(ti_sci_of_match), + .suppress_bind_attrs = true, }, }; module_platform_driver(ti_sci_driver); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpio/gpio-timberdale.c +++ linux-lowlatency-5.15.0/drivers/gpio/gpio-timberdale.c @@ -43,9 +43,10 @@ unsigned offset, bool enabled) { struct timbgpio *tgpio = gpiochip_get_data(gpio); + unsigned long flags; u32 reg; - spin_lock(&tgpio->lock); + spin_lock_irqsave(&tgpio->lock, flags); reg = ioread32(tgpio->membase + offset); if (enabled) @@ -54,7 +55,7 @@ reg &= ~(1 << index); iowrite32(reg, tgpio->membase + offset); - spin_unlock(&tgpio->lock); + spin_unlock_irqrestore(&tgpio->lock, flags); return 0; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1192,7 +1192,8 @@ { struct amdgpu_ras *con = amdgpu_ras_get_context(adev); - sysfs_remove_file_from_group(&adev->dev->kobj, + if (adev->dev->kobj.sd) + sysfs_remove_file_from_group(&adev->dev->kobj, &con->badpages_attr.attr, RAS_FS_NAME); } @@ -1209,7 +1210,8 @@ .attrs = attrs, }; - sysfs_remove_group(&adev->dev->kobj, &group); + if (adev->dev->kobj.sd) + sysfs_remove_group(&adev->dev->kobj, &group); return 0; } @@ -1257,7 +1259,8 @@ if (!obj || !obj->attr_inuse) return -EINVAL; - sysfs_remove_file_from_group(&adev->dev->kobj, + if (adev->dev->kobj.sd) + sysfs_remove_file_from_group(&adev->dev->kobj, &obj->sysfs_attr.attr, RAS_FS_NAME); obj->attr_inuse = 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/amd/display/dc/core/dc_stream.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/display/dc/core/dc_stream.c @@ -562,7 +562,7 @@ for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; - if (res_ctx->pipe_ctx[i].stream != stream) + if (res_ctx->pipe_ctx[i].stream != stream || !tg) continue; return tg->funcs->get_frame_count(tg); @@ -621,7 +621,7 @@ for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; - if (res_ctx->pipe_ctx[i].stream != stream) + if (res_ctx->pipe_ctx[i].stream != stream || !tg) continue; tg->funcs->get_scanoutpos(tg, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/amd/include/pptable.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/include/pptable.h @@ -78,7 +78,7 @@ typedef struct _ATOM_PPLIB_STATE { UCHAR ucNonClockStateIndex; - UCHAR ucClockStateIndices[1]; // variable-sized + UCHAR ucClockStateIndices[]; // variable-sized } ATOM_PPLIB_STATE; @@ -473,7 +473,7 @@ /** * Driver will read the first ucNumDPMLevels in this array */ - UCHAR clockInfoIndex[1]; + UCHAR clockInfoIndex[]; } ATOM_PPLIB_STATE_V2; typedef struct _StateArray{ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +++ linux-lowlatency-5.15.0/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h @@ -164,7 +164,7 @@ typedef struct _ATOM_Tonga_State_Array { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_State entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_State entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_State_Array; typedef struct _ATOM_Tonga_MCLK_Dependency_Record { @@ -179,7 +179,7 @@ typedef struct _ATOM_Tonga_MCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_MCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_MCLK_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_MCLK_Dependency_Table; typedef struct _ATOM_Tonga_SCLK_Dependency_Record { @@ -194,7 +194,7 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_SCLK_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_SCLK_Dependency_Table; typedef struct _ATOM_Polaris_SCLK_Dependency_Record { @@ -210,7 +210,7 @@ typedef struct _ATOM_Polaris_SCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Polaris_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Polaris_SCLK_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Polaris_SCLK_Dependency_Table; typedef struct _ATOM_Tonga_PCIE_Record { @@ -222,7 +222,7 @@ typedef struct _ATOM_Tonga_PCIE_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_PCIE_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_PCIE_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_PCIE_Table; typedef struct _ATOM_Polaris10_PCIE_Record { @@ -235,7 +235,7 @@ typedef struct _ATOM_Polaris10_PCIE_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Polaris10_PCIE_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Polaris10_PCIE_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Polaris10_PCIE_Table; @@ -252,7 +252,7 @@ typedef struct _ATOM_Tonga_MM_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_MM_Dependency_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_MM_Dependency_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_MM_Dependency_Table; typedef struct _ATOM_Tonga_Voltage_Lookup_Record { @@ -265,7 +265,7 @@ typedef struct _ATOM_Tonga_Voltage_Lookup_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_Voltage_Lookup_Record entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_Voltage_Lookup_Record entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_Voltage_Lookup_Table; typedef struct _ATOM_Tonga_Fan_Table { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -1223,7 +1223,7 @@ return 0; } -static void +static int komeda_pipeline_unbound_components(struct komeda_pipeline *pipe, struct komeda_pipeline_state *new) { @@ -1243,8 +1243,12 @@ c = komeda_pipeline_get_component(pipe, id); c_st = komeda_component_get_state_and_set_user(c, drm_st, NULL, new->crtc); + if (PTR_ERR(c_st) == -EDEADLK) + return -EDEADLK; WARN_ON(IS_ERR(c_st)); } + + return 0; } /* release unclaimed pipeline resource */ @@ -1266,9 +1270,8 @@ if (WARN_ON(IS_ERR_OR_NULL(st))) return -EINVAL; - komeda_pipeline_unbound_components(pipe, st); + return komeda_pipeline_unbound_components(pipe, st); - return 0; } /* Since standalong disabled components must be disabled separately and in the only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/i915/display/intel_crt.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_crt.c @@ -343,8 +343,13 @@ struct drm_device *dev = connector->dev; struct drm_i915_private *dev_priv = to_i915(dev); int max_dotclk = dev_priv->max_dotclk_freq; + enum drm_mode_status status; int max_clock; + status = intel_cpu_transcoder_mode_valid(dev_priv, mode); + if (status != MODE_OK) + return status; + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) return MODE_NO_DBLESCAN; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/i915/display/intel_dvo.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_dvo.c @@ -220,14 +220,20 @@ } static enum drm_mode_status -intel_dvo_mode_valid(struct drm_connector *connector, +intel_dvo_mode_valid(struct drm_connector *_connector, struct drm_display_mode *mode) { - struct intel_dvo *intel_dvo = intel_attached_dvo(to_intel_connector(connector)); - const struct drm_display_mode *fixed_mode = - to_intel_connector(connector)->panel.fixed_mode; - int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; + struct intel_connector *connector = to_intel_connector(_connector); + struct drm_i915_private *i915 = to_i915(connector->base.dev); + struct intel_dvo *intel_dvo = intel_attached_dvo(connector); + const struct drm_display_mode *fixed_mode = connector->panel.fixed_mode; + int max_dotclk = i915->max_dotclk_freq; int target_clock = mode->clock; + enum drm_mode_status status; + + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; if (mode->flags & DRM_MODE_FLAG_DBLSCAN) return MODE_NO_DBLESCAN; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/i915/display/intel_tv.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/display/intel_tv.c @@ -955,8 +955,14 @@ intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + struct drm_i915_private *i915 = to_i915(connector->dev); const struct tv_mode *tv_mode = intel_tv_mode_find(connector->state); - int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; + int max_dotclk = i915->max_dotclk_freq; + enum drm_mode_status status; + + status = intel_cpu_transcoder_mode_valid(i915, mode); + if (status != MODE_OK) + return status; if (mode->flags & DRM_MODE_FLAG_DBLSCAN) return MODE_NO_DBLESCAN; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/i915/i915_pmu.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/i915/i915_pmu.c @@ -761,9 +761,18 @@ static void i915_pmu_event_stop(struct perf_event *event, int flags) { + struct drm_i915_private *i915 = + container_of(event->pmu, typeof(*i915), pmu.base); + struct i915_pmu *pmu = &i915->pmu; + + if (pmu->closed) + goto out; + if (flags & PERF_EF_UPDATE) i915_pmu_event_read(event); i915_pmu_disable(event); + +out: event->hw.state = PERF_HES_STOPPED; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -154,9 +154,9 @@ plane->state->src_y = new_state->src_y; plane->state->src_h = new_state->src_h; plane->state->src_w = new_state->src_w; - swap(plane->state->fb, new_state->fb); mtk_plane_update_new_state(new_state, new_plane_state); + swap(plane->state->fb, new_state->fb); wmb(); /* Make sure the above parameters are set before update */ new_plane_state->pending.async_dirty = true; mtk_drm_crtc_async_update(new_state->crtc, plane, state); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/panel/panel-arm-versatile.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-arm-versatile.c @@ -267,6 +267,8 @@ connector->display_info.bus_flags = vpanel->panel_type->bus_flags; mode = drm_mode_duplicate(connector->dev, &vpanel->panel_type->mode); + if (!mode) + return -ENOMEM; drm_mode_set_name(mode); mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -36,6 +36,7 @@ const struct panel_init_cmd *init_cmds; unsigned int lanes; bool discharge_on_disable; + bool lp11_before_reset; }; struct boe_panel { @@ -551,6 +552,10 @@ usleep_range(5000, 10000); + if (boe->desc->lp11_before_reset) { + mipi_dsi_dcs_nop(boe->dsi); + usleep_range(1000, 2000); + } gpiod_set_value(boe->enable_gpio, 1); usleep_range(1000, 2000); gpiod_set_value(boe->enable_gpio, 0); @@ -692,6 +697,7 @@ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_LPM, .init_cmds = auo_b101uan08_3_init_cmd, + .lp11_before_reset = true, }; static const struct drm_display_mode boe_tv105wum_nw0_default_mode = { @@ -719,6 +725,7 @@ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_LPM, .init_cmds = boe_init_cmd, + .lp11_before_reset = true, }; static int boe_panel_get_modes(struct drm_panel *panel, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -428,29 +428,30 @@ return 0; dev_dbg(ctx->dev, "Resetting the panel\n"); - ret = regulator_enable(ctx->vcc); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + + ret = regulator_enable(ctx->iovcc); if (ret < 0) { - dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); return ret; } - ret = regulator_enable(ctx->iovcc); + + ret = regulator_enable(ctx->vcc); if (ret < 0) { - dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); - goto disable_vcc; + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); + regulator_disable(ctx->iovcc); + return ret; } - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - usleep_range(20, 40); + /* Give power supplies time to stabilize before deasserting reset. */ + usleep_range(10000, 20000); + gpiod_set_value_cansleep(ctx->reset_gpio, 0); - msleep(20); + usleep_range(15000, 20000); ctx->prepared = true; return 0; - -disable_vcc: - regulator_disable(ctx->vcc); - return ret; } static int st7703_get_modes(struct drm_panel *panel, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/panel/panel-tpo-tpg110.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/panel/panel-tpo-tpg110.c @@ -379,6 +379,8 @@ connector->display_info.bus_flags = tpg->panel_mode->bus_flags; mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode); + if (!mode) + return -ENOMEM; drm_mode_set_name(mode); mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/qxl/qxl_display.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/qxl/qxl_display.c @@ -1221,6 +1221,9 @@ if (!qdev->monitors_config_bo) return 0; + kfree(qdev->dumb_heads); + qdev->dumb_heads = NULL; + qdev->monitors_config = NULL; qdev->ram_header->monitors_config = 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/radeon/evergreen.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/radeon/evergreen.c @@ -4820,14 +4820,15 @@ break; case 44: /* hdmi */ afmt_idx = src_data; - if (!(afmt_status[afmt_idx] & AFMT_AZ_FORMAT_WTRIG)) - DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); - if (afmt_idx > 5) { DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); break; } + + if (!(afmt_status[afmt_idx] & AFMT_AZ_FORMAT_WTRIG)) + DRM_DEBUG("IH: IH event w/o asserted irq bit?\n"); + afmt_status[afmt_idx] &= ~AFMT_AZ_FORMAT_WTRIG; queue_hdmi = true; DRM_DEBUG("IH: HDMI%d\n", afmt_idx + 1); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/ttm/ttm_device.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/ttm/ttm_device.c @@ -234,10 +234,6 @@ struct ttm_resource_manager *man; unsigned i; - man = ttm_manager_type(bdev, TTM_PL_SYSTEM); - ttm_resource_manager_set_used(man, false); - ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); - mutex_lock(&ttm_global_mutex); list_del(&bdev->device_list); mutex_unlock(&ttm_global_mutex); @@ -247,6 +243,10 @@ if (ttm_bo_delayed_delete(bdev, true)) pr_debug("Delayed destroy list was clean\n"); + man = ttm_manager_type(bdev, TTM_PL_SYSTEM); + ttm_resource_manager_set_used(man, false); + ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); + spin_lock(&bdev->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) if (list_empty(&man->lru[0])) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ linux-lowlatency-5.15.0/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -807,9 +807,9 @@ metadata->num_sizes = num_sizes; user_srf->size = size; metadata->sizes = - memdup_user((struct drm_vmw_size __user *)(unsigned long) + memdup_array_user((struct drm_vmw_size __user *)(unsigned long) req->size_addr, - sizeof(*metadata->sizes) * metadata->num_sizes); + metadata->num_sizes, sizeof(*metadata->sizes)); if (IS_ERR(metadata->sizes)) { ret = PTR_ERR(metadata->sizes); goto out_no_sizes; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/hid/hid-lenovo.c +++ linux-lowlatency-5.15.0/drivers/hid/hid-lenovo.c @@ -50,7 +50,12 @@ int select_right; int sensitivity; int press_speed; - u8 middlebutton_state; /* 0:Up, 1:Down (undecided), 2:Scrolling */ + /* 0: Up + * 1: Down (undecided) + * 2: Scrolling + * 3: Patched firmware, disable workaround + */ + u8 middlebutton_state; bool fn_lock; }; @@ -529,31 +534,48 @@ { struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev); - /* "wheel" scroll events */ - if (usage->type == EV_REL && (usage->code == REL_WHEEL || - usage->code == REL_HWHEEL)) { - /* Scroll events disable middle-click event */ - cptkbd_data->middlebutton_state = 2; - return 0; - } + if (cptkbd_data->middlebutton_state != 3) { + /* REL_X and REL_Y events during middle button pressed + * are only possible on patched, bug-free firmware + * so set middlebutton_state to 3 + * to never apply workaround anymore + */ + if (cptkbd_data->middlebutton_state == 1 && + usage->type == EV_REL && + (usage->code == REL_X || usage->code == REL_Y)) { + cptkbd_data->middlebutton_state = 3; + /* send middle button press which was hold before */ + input_event(field->hidinput->input, + EV_KEY, BTN_MIDDLE, 1); + input_sync(field->hidinput->input); + } - /* Middle click events */ - if (usage->type == EV_KEY && usage->code == BTN_MIDDLE) { - if (value == 1) { - cptkbd_data->middlebutton_state = 1; - } else if (value == 0) { - if (cptkbd_data->middlebutton_state == 1) { - /* No scrolling inbetween, send middle-click */ - input_event(field->hidinput->input, - EV_KEY, BTN_MIDDLE, 1); - input_sync(field->hidinput->input); - input_event(field->hidinput->input, - EV_KEY, BTN_MIDDLE, 0); - input_sync(field->hidinput->input); + /* "wheel" scroll events */ + if (usage->type == EV_REL && (usage->code == REL_WHEEL || + usage->code == REL_HWHEEL)) { + /* Scroll events disable middle-click event */ + cptkbd_data->middlebutton_state = 2; + return 0; + } + + /* Middle click events */ + if (usage->type == EV_KEY && usage->code == BTN_MIDDLE) { + if (value == 1) { + cptkbd_data->middlebutton_state = 1; + } else if (value == 0) { + if (cptkbd_data->middlebutton_state == 1) { + /* No scrolling inbetween, send middle-click */ + input_event(field->hidinput->input, + EV_KEY, BTN_MIDDLE, 1); + input_sync(field->hidinput->input); + input_event(field->hidinput->input, + EV_KEY, BTN_MIDDLE, 0); + input_sync(field->hidinput->input); + } + cptkbd_data->middlebutton_state = 0; } - cptkbd_data->middlebutton_state = 0; + return 1; } - return 1; } return 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/hwmon/acpi_power_meter.c +++ linux-lowlatency-5.15.0/drivers/hwmon/acpi_power_meter.c @@ -31,6 +31,7 @@ #define POWER_METER_CAN_NOTIFY (1 << 3) #define POWER_METER_IS_BATTERY (1 << 8) #define UNKNOWN_HYSTERESIS 0xFFFFFFFF +#define UNKNOWN_POWER 0xFFFFFFFF #define METER_NOTIFY_CONFIG 0x80 #define METER_NOTIFY_TRIP 0x81 @@ -348,6 +349,9 @@ update_meter(resource); mutex_unlock(&resource->lock); + if (resource->power == UNKNOWN_POWER) + return -ENODATA; + return sprintf(buf, "%llu\n", resource->power * 1000); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/hwmon/axi-fan-control.c +++ linux-lowlatency-5.15.0/drivers/hwmon/axi-fan-control.c @@ -508,6 +508,21 @@ return -ENODEV; } + ret = axi_fan_control_init(ctl, pdev->dev.of_node); + if (ret) { + dev_err(&pdev->dev, "Failed to initialize device\n"); + return ret; + } + + ctl->hdev = devm_hwmon_device_register_with_info(&pdev->dev, + name, + ctl, + &axi_chip_info, + axi_fan_control_groups); + + if (IS_ERR(ctl->hdev)) + return PTR_ERR(ctl->hdev); + ctl->irq = platform_get_irq(pdev, 0); if (ctl->irq < 0) return ctl->irq; @@ -521,19 +536,7 @@ return ret; } - ret = axi_fan_control_init(ctl, pdev->dev.of_node); - if (ret) { - dev_err(&pdev->dev, "Failed to initialize device\n"); - return ret; - } - - ctl->hdev = devm_hwmon_device_register_with_info(&pdev->dev, - name, - ctl, - &axi_chip_info, - axi_fan_control_groups); - - return PTR_ERR_OR_ZERO(ctl->hdev); + return 0; } static struct platform_driver axi_fan_control_driver = { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/hwmon/nzxt-kraken2.c +++ linux-lowlatency-5.15.0/drivers/hwmon/nzxt-kraken2.c @@ -161,13 +161,13 @@ ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); if (ret) { hid_err(hdev, "hid hw start failed with %d\n", ret); - goto fail_and_stop; + return ret; } ret = hid_hw_open(hdev); if (ret) { hid_err(hdev, "hid hw open failed with %d\n", ret); - goto fail_and_close; + goto fail_and_stop; } priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "kraken2", only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i2c/busses/i2c-pxa.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-pxa.c @@ -264,6 +264,9 @@ u32 hs_mask; struct i2c_bus_recovery_info recovery; + struct pinctrl *pinctrl; + struct pinctrl_state *pinctrl_default; + struct pinctrl_state *pinctrl_recovery; }; #define _IBMR(i2c) ((i2c)->reg_ibmr) @@ -1302,12 +1305,13 @@ */ gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); + + WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); } static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) { struct pxa_i2c *i2c = adap->algo_data; - struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; u32 isr; /* @@ -1321,7 +1325,7 @@ i2c_pxa_do_reset(i2c); } - WARN_ON(pinctrl_select_state(bri->pinctrl, bri->pins_default)); + WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); dev_dbg(&i2c->adap.dev, "recovery: IBMR 0x%08x ISR 0x%08x\n", readl(_IBMR(i2c)), readl(_ISR(i2c))); @@ -1343,20 +1347,76 @@ if (IS_ENABLED(CONFIG_I2C_PXA_SLAVE)) return 0; - bri->pinctrl = devm_pinctrl_get(dev); - if (PTR_ERR(bri->pinctrl) == -ENODEV) { - bri->pinctrl = NULL; + i2c->pinctrl = devm_pinctrl_get(dev); + if (PTR_ERR(i2c->pinctrl) == -ENODEV) + i2c->pinctrl = NULL; + if (IS_ERR(i2c->pinctrl)) + return PTR_ERR(i2c->pinctrl); + + if (!i2c->pinctrl) + return 0; + + i2c->pinctrl_default = pinctrl_lookup_state(i2c->pinctrl, + PINCTRL_STATE_DEFAULT); + i2c->pinctrl_recovery = pinctrl_lookup_state(i2c->pinctrl, "recovery"); + + if (IS_ERR(i2c->pinctrl_default) || IS_ERR(i2c->pinctrl_recovery)) { + dev_info(dev, "missing pinmux recovery information: %ld %ld\n", + PTR_ERR(i2c->pinctrl_default), + PTR_ERR(i2c->pinctrl_recovery)); + return 0; + } + + /* + * Claiming GPIOs can influence the pinmux state, and may glitch the + * I2C bus. Do this carefully. + */ + bri->scl_gpiod = devm_gpiod_get(dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); + if (bri->scl_gpiod == ERR_PTR(-EPROBE_DEFER)) + return -EPROBE_DEFER; + if (IS_ERR(bri->scl_gpiod)) { + dev_info(dev, "missing scl gpio recovery information: %pe\n", + bri->scl_gpiod); + return 0; + } + + /* + * We have SCL. Pull SCL low and wait a bit so that SDA glitches + * have no effect. + */ + gpiod_direction_output(bri->scl_gpiod, 0); + udelay(10); + bri->sda_gpiod = devm_gpiod_get(dev, "sda", GPIOD_OUT_HIGH_OPEN_DRAIN); + + /* Wait a bit in case of a SDA glitch, and then release SCL. */ + udelay(10); + gpiod_direction_output(bri->scl_gpiod, 1); + + if (bri->sda_gpiod == ERR_PTR(-EPROBE_DEFER)) + return -EPROBE_DEFER; + + if (IS_ERR(bri->sda_gpiod)) { + dev_info(dev, "missing sda gpio recovery information: %pe\n", + bri->sda_gpiod); return 0; } - if (IS_ERR(bri->pinctrl)) - return PTR_ERR(bri->pinctrl); bri->prepare_recovery = i2c_pxa_prepare_recovery; bri->unprepare_recovery = i2c_pxa_unprepare_recovery; + bri->recover_bus = i2c_generic_scl_recovery; i2c->adap.bus_recovery_info = bri; - return 0; + /* + * Claiming GPIOs can change the pinmux state, which confuses the + * pinctrl since pinctrl's idea of the current setting is unaffected + * by the pinmux change caused by claiming the GPIO. Work around that + * by switching pinctrl to the GPIO state here. We do it this way to + * avoid glitching the I2C bus. + */ + pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery); + + return pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default); } static int i2c_pxa_probe(struct platform_device *dev) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i2c/busses/i2c-sun6i-p2wi.c +++ linux-lowlatency-5.15.0/drivers/i2c/busses/i2c-sun6i-p2wi.c @@ -201,6 +201,11 @@ return -EINVAL; } + if (clk_freq == 0) { + dev_err(dev, "clock-frequency is set to 0 in DT\n"); + return -EINVAL; + } + if (of_get_child_count(np) > 1) { dev_err(dev, "P2WI only supports one slave device\n"); return -EINVAL; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i2c/i2c-core.h +++ linux-lowlatency-5.15.0/drivers/i2c/i2c-core.h @@ -29,7 +29,7 @@ */ static inline bool i2c_in_atomic_xfer_mode(void) { - return system_state > SYSTEM_RUNNING && irqs_disabled(); + return system_state > SYSTEM_RUNNING && !preemptible(); } static inline int __i2c_lock_bus_helper(struct i2c_adapter *adap) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i2c/i2c-mux.c +++ linux-lowlatency-5.15.0/drivers/i2c/i2c-mux.c @@ -340,7 +340,7 @@ priv->adap.lock_ops = &i2c_parent_lock_ops; /* Sanity check on class */ - if (i2c_mux_parent_classes(parent) & class) + if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED) dev_err(&parent->dev, "Segment %d behind mux can't share classes with ancestors\n", chan_id); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i2c/muxes/i2c-mux-pinctrl.c +++ linux-lowlatency-5.15.0/drivers/i2c/muxes/i2c-mux-pinctrl.c @@ -62,7 +62,7 @@ dev_err(dev, "Cannot parse i2c-parent\n"); return ERR_PTR(-ENODEV); } - parent = of_find_i2c_adapter_by_node(parent_np); + parent = of_get_i2c_adapter_by_node(parent_np); of_node_put(parent_np); if (!parent) return ERR_PTR(-EPROBE_DEFER); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i3c/master/i3c-master-cdns.c +++ linux-lowlatency-5.15.0/drivers/i3c/master/i3c-master-cdns.c @@ -192,7 +192,7 @@ #define SLV_STATUS1_HJ_DIS BIT(18) #define SLV_STATUS1_MR_DIS BIT(17) #define SLV_STATUS1_PROT_ERR BIT(16) -#define SLV_STATUS1_DA(x) (((s) & GENMASK(15, 9)) >> 9) +#define SLV_STATUS1_DA(s) (((s) & GENMASK(15, 9)) >> 9) #define SLV_STATUS1_HAS_DA BIT(8) #define SLV_STATUS1_DDR_RX_FULL BIT(7) #define SLV_STATUS1_DDR_TX_FULL BIT(6) @@ -1624,13 +1624,13 @@ /* Device ID0 is reserved to describe this master. */ master->maxdevs = CONF_STATUS0_DEVS_NUM(val); master->free_rr_slots = GENMASK(master->maxdevs, 1); + master->caps.ibirfifodepth = CONF_STATUS0_IBIR_DEPTH(val); + master->caps.cmdrfifodepth = CONF_STATUS0_CMDR_DEPTH(val); val = readl(master->regs + CONF_STATUS1); master->caps.cmdfifodepth = CONF_STATUS1_CMD_DEPTH(val); master->caps.rxfifodepth = CONF_STATUS1_RX_DEPTH(val); master->caps.txfifodepth = CONF_STATUS1_TX_DEPTH(val); - master->caps.ibirfifodepth = CONF_STATUS0_IBIR_DEPTH(val); - master->caps.cmdrfifodepth = CONF_STATUS0_CMDR_DEPTH(val); spin_lock_init(&master->ibi.lock); master->ibi.num_slots = CONF_STATUS1_IBI_HW_RES(val); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/i3c/master/mipi-i3c-hci/dma.c +++ linux-lowlatency-5.15.0/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -734,7 +734,7 @@ unsigned int i; bool handled = false; - for (i = 0; mask && i < 8; i++) { + for (i = 0; mask && i < rings->total; i++) { struct hci_rh_data *rh; u32 status; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/iio/adc/exynos_adc.c +++ linux-lowlatency-5.15.0/drivers/iio/adc/exynos_adc.c @@ -826,16 +826,26 @@ } } + /* leave out any TS related code if unreachable */ + if (IS_REACHABLE(CONFIG_INPUT)) { + has_ts = of_property_read_bool(pdev->dev.of_node, + "has-touchscreen") || pdata; + } + irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; info->irq = irq; - irq = platform_get_irq(pdev, 1); - if (irq == -EPROBE_DEFER) - return irq; - - info->tsirq = irq; + if (has_ts) { + irq = platform_get_irq(pdev, 1); + if (irq == -EPROBE_DEFER) + return irq; + + info->tsirq = irq; + } else { + info->tsirq = -1; + } info->dev = &pdev->dev; @@ -900,12 +910,6 @@ if (info->data->init_hw) info->data->init_hw(info); - /* leave out any TS related code if unreachable */ - if (IS_REACHABLE(CONFIG_INPUT)) { - has_ts = of_property_read_bool(pdev->dev.of_node, - "has-touchscreen") || pdata; - } - if (pdata) info->delay = pdata->delay; else only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/iio/adc/xilinx-xadc-core.c +++ linux-lowlatency-5.15.0/drivers/iio/adc/xilinx-xadc-core.c @@ -454,6 +454,9 @@ .interrupt_handler = xadc_zynq_interrupt_handler, .update_alarm = xadc_zynq_update_alarm, .type = XADC_TYPE_S7, + /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ + .temp_scale = 503975, + .temp_offset = 273150, }; static const unsigned int xadc_axi_reg_offsets[] = { @@ -564,6 +567,9 @@ .interrupt_handler = xadc_axi_interrupt_handler, .flags = XADC_FLAGS_BUFFERED, .type = XADC_TYPE_S7, + /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ + .temp_scale = 503975, + .temp_offset = 273150, }; static const struct xadc_ops xadc_us_axi_ops = { @@ -575,6 +581,12 @@ .interrupt_handler = xadc_axi_interrupt_handler, .flags = XADC_FLAGS_BUFFERED, .type = XADC_TYPE_US, + /** + * Values below are for UltraScale+ (SYSMONE4) using internal reference. + * See https://docs.xilinx.com/v/u/en-US/ug580-ultrascale-sysmon + */ + .temp_scale = 509314, + .temp_offset = 280231, }; static int _xadc_update_adc_reg(struct xadc *xadc, unsigned int reg, @@ -946,8 +958,7 @@ *val2 = chan->scan_type.realbits; return IIO_VAL_FRACTIONAL_LOG2; case IIO_TEMP: - /* Temp in C = (val * 503.975) / 2**bits - 273.15 */ - *val = 503975; + *val = xadc->ops->temp_scale; *val2 = bits; return IIO_VAL_FRACTIONAL_LOG2; default: @@ -955,7 +966,7 @@ } case IIO_CHAN_INFO_OFFSET: /* Only the temperature channel has an offset */ - *val = -((273150 << bits) / 503975); + *val = -((xadc->ops->temp_offset << bits) / xadc->ops->temp_scale); return IIO_VAL_INT; case IIO_CHAN_INFO_SAMP_FREQ: ret = xadc_read_samplerate(xadc); @@ -1434,28 +1445,6 @@ if (ret) return ret; - /* Disable all alarms */ - ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK, - XADC_CONF1_ALARM_MASK); - if (ret) - return ret; - - /* Set thresholds to min/max */ - for (i = 0; i < 16; i++) { - /* - * Set max voltage threshold and both temperature thresholds to - * 0xffff, min voltage threshold to 0. - */ - if (i % 8 < 4 || i == 7) - xadc->threshold[i] = 0xffff; - else - xadc->threshold[i] = 0; - ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i), - xadc->threshold[i]); - if (ret) - return ret; - } - /* Go to non-buffered mode */ xadc_postdisable(indio_dev); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/iio/adc/xilinx-xadc.h +++ linux-lowlatency-5.15.0/drivers/iio/adc/xilinx-xadc.h @@ -86,6 +86,8 @@ unsigned int flags; enum xadc_type type; + int temp_scale; + int temp_offset; }; static inline int _xadc_read_adc_reg(struct xadc *xadc, unsigned int reg, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/infiniband/core/sa_query.c +++ linux-lowlatency-5.15.0/drivers/infiniband/core/sa_query.c @@ -2132,7 +2132,9 @@ s = rdma_start_port(device); e = rdma_end_port(device); - sa_dev = kzalloc(struct_size(sa_dev, port, e - s + 1), GFP_KERNEL); + sa_dev = kzalloc(struct_size(sa_dev, port, + size_add(size_sub(e, s), 1)), + GFP_KERNEL); if (!sa_dev) return -ENOMEM; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/infiniband/hw/hfi1/efivar.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/hfi1/efivar.c @@ -110,7 +110,7 @@ unsigned long *size, void **return_data) { char prefix_name[64]; - char name[64]; + char name[128]; int result; int i; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/infiniband/hw/hfi1/pcie.c +++ linux-lowlatency-5.15.0/drivers/infiniband/hw/hfi1/pcie.c @@ -3,6 +3,7 @@ * Copyright(c) 2015 - 2019 Intel Corporation. */ +#include #include #include #include @@ -212,12 +213,6 @@ return speed; } -/* return the PCIe link speed from the given link status */ -static u32 extract_width(u16 linkstat) -{ - return (linkstat & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT; -} - /* read the link status and set dd->{lbus_width,lbus_speed,lbus_info} */ static void update_lbus_info(struct hfi1_devdata *dd) { @@ -230,7 +225,7 @@ return; } - dd->lbus_width = extract_width(linkstat); + dd->lbus_width = FIELD_GET(PCI_EXP_LNKSTA_NLW, linkstat); dd->lbus_speed = extract_speed(linkstat); snprintf(dd->lbus_info, sizeof(dd->lbus_info), "PCIe,%uMHz,x%u", dd->lbus_speed, dd->lbus_width); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/input/rmi4/rmi_bus.c +++ linux-lowlatency-5.15.0/drivers/input/rmi4/rmi_bus.c @@ -276,11 +276,11 @@ device_del(&fn->dev); of_node_put(fn->dev.of_node); - put_device(&fn->dev); for (i = 0; i < fn->num_of_irqs; i++) irq_dispose_mapping(fn->irq[i]); + put_device(&fn->dev); } /** only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/input/rmi4/rmi_smbus.c +++ linux-lowlatency-5.15.0/drivers/input/rmi4/rmi_smbus.c @@ -235,12 +235,29 @@ static int rmi_smb_enable_smbus_mode(struct rmi_smb_xport *rmi_smb) { - int retval; + struct i2c_client *client = rmi_smb->client; + int smbus_version; + + /* + * psmouse driver resets the controller, we only need to wait + * to give the firmware chance to fully reinitialize. + */ + if (rmi_smb->xport.pdata.reset_delay_ms) + msleep(rmi_smb->xport.pdata.reset_delay_ms); /* we need to get the smbus version to activate the touchpad */ - retval = rmi_smb_get_version(rmi_smb); - if (retval < 0) - return retval; + smbus_version = rmi_smb_get_version(rmi_smb); + if (smbus_version < 0) + return smbus_version; + + rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d", + smbus_version); + + if (smbus_version != 2 && smbus_version != 3) { + dev_err(&client->dev, "Unrecognized SMB version %d\n", + smbus_version); + return -ENODEV; + } return 0; } @@ -253,11 +270,10 @@ rmi_smb_clear_state(rmi_smb); /* - * we do not call the actual reset command, it has to be handled in - * PS/2 or there will be races between PS/2 and SMBus. - * PS/2 should ensure that a psmouse_reset is called before - * intializing the device and after it has been removed to be in a known - * state. + * We do not call the actual reset command, it has to be handled in + * PS/2 or there will be races between PS/2 and SMBus. PS/2 should + * ensure that a psmouse_reset is called before initializing the + * device and after it has been removed to be in a known state. */ return rmi_smb_enable_smbus_mode(rmi_smb); } @@ -273,7 +289,6 @@ { struct rmi_device_platform_data *pdata = dev_get_platdata(&client->dev); struct rmi_smb_xport *rmi_smb; - int smbus_version; int error; if (!pdata) { @@ -312,18 +327,9 @@ rmi_smb->xport.proto_name = "smb"; rmi_smb->xport.ops = &rmi_smb_ops; - smbus_version = rmi_smb_get_version(rmi_smb); - if (smbus_version < 0) - return smbus_version; - - rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d", - smbus_version); - - if (smbus_version != 2 && smbus_version != 3) { - dev_err(&client->dev, "Unrecognized SMB version %d\n", - smbus_version); - return -ENODEV; - } + error = rmi_smb_enable_smbus_mode(rmi_smb); + if (error) + return error; i2c_set_clientdata(client, rmi_smb); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/input/touchscreen/cyttsp4_core.c +++ linux-lowlatency-5.15.0/drivers/input/touchscreen/cyttsp4_core.c @@ -1263,9 +1263,8 @@ * Ensure we wait until the watchdog timer * running on a different CPU finishes */ - del_timer_sync(&cd->watchdog_timer); + timer_shutdown_sync(&cd->watchdog_timer); cancel_work_sync(&cd->watchdog_work); - del_timer_sync(&cd->watchdog_timer); } static void cyttsp4_watchdog_timer(struct timer_list *t) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/irqchip/irq-riscv-intc.c +++ linux-lowlatency-5.15.0/drivers/irqchip/irq-riscv-intc.c @@ -109,8 +109,16 @@ * for each INTC DT node. We only need to do INTC initialization * for the INTC DT node belonging to boot CPU (or boot HART). */ - if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) + if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) { + /* + * The INTC nodes of each CPU are suppliers for downstream + * interrupt controllers (such as PLIC, IMSIC and APLIC + * direct-mode) so we should mark an INTC node as initialized + * if we are not creating IRQ domain for it. + */ + fwnode_dev_initialized(of_fwnode_handle(node), true); return 0; + } intc_domain = irq_domain_add_linear(node, BITS_PER_LONG, &riscv_intc_domain_ops, NULL); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/irqchip/irq-stm32-exti.c +++ linux-lowlatency-5.15.0/drivers/irqchip/irq-stm32-exti.c @@ -408,6 +408,7 @@ .map = irq_map_generic_chip, .alloc = stm32_exti_alloc, .free = stm32_exti_free, + .xlate = irq_domain_xlate_twocell, }; static void stm32_irq_ack(struct irq_data *d) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/leds/leds-turris-omnia.c +++ linux-lowlatency-5.15.0/drivers/leds/leds-turris-omnia.c @@ -2,7 +2,7 @@ /* * CZ.NIC's Turris Omnia LEDs driver * - * 2020 by Marek Behún + * 2020, 2023 by Marek Behún */ #include @@ -41,6 +41,37 @@ struct omnia_led leds[]; }; +static int omnia_cmd_write_u8(const struct i2c_client *client, u8 cmd, u8 val) +{ + u8 buf[2] = { cmd, val }; + + return i2c_master_send(client, buf, sizeof(buf)); +} + +static int omnia_cmd_read_u8(const struct i2c_client *client, u8 cmd) +{ + struct i2c_msg msgs[2]; + u8 reply; + int ret; + + msgs[0].addr = client->addr; + msgs[0].flags = 0; + msgs[0].len = 1; + msgs[0].buf = &cmd; + msgs[1].addr = client->addr; + msgs[1].flags = I2C_M_RD; + msgs[1].len = 1; + msgs[1].buf = &reply; + + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (likely(ret == ARRAY_SIZE(msgs))) + return reply; + else if (ret < 0) + return ret; + else + return -EIO; +} + static int omnia_led_brightness_set_blocking(struct led_classdev *cdev, enum led_brightness brightness) { @@ -64,7 +95,7 @@ if (buf[2] || buf[3] || buf[4]) state |= CMD_LED_STATE_ON; - ret = i2c_smbus_write_byte_data(leds->client, CMD_LED_STATE, state); + ret = omnia_cmd_write_u8(leds->client, CMD_LED_STATE, state); if (ret >= 0 && (state & CMD_LED_STATE_ON)) ret = i2c_master_send(leds->client, buf, 5); @@ -114,9 +145,9 @@ cdev->brightness_set_blocking = omnia_led_brightness_set_blocking; /* put the LED into software mode */ - ret = i2c_smbus_write_byte_data(client, CMD_LED_MODE, - CMD_LED_MODE_LED(led->reg) | - CMD_LED_MODE_USER); + ret = omnia_cmd_write_u8(client, CMD_LED_MODE, + CMD_LED_MODE_LED(led->reg) | + CMD_LED_MODE_USER); if (ret < 0) { dev_err(dev, "Cannot set LED %pOF to software mode: %i\n", np, ret); @@ -124,8 +155,8 @@ } /* disable the LED */ - ret = i2c_smbus_write_byte_data(client, CMD_LED_STATE, - CMD_LED_STATE_LED(led->reg)); + ret = omnia_cmd_write_u8(client, CMD_LED_STATE, + CMD_LED_STATE_LED(led->reg)); if (ret < 0) { dev_err(dev, "Cannot set LED %pOF brightness: %i\n", np, ret); return ret; @@ -156,12 +187,9 @@ char *buf) { struct i2c_client *client = to_i2c_client(dev); - struct omnia_leds *leds = i2c_get_clientdata(client); int ret; - mutex_lock(&leds->lock); - ret = i2c_smbus_read_byte_data(client, CMD_LED_GET_BRIGHTNESS); - mutex_unlock(&leds->lock); + ret = omnia_cmd_read_u8(client, CMD_LED_GET_BRIGHTNESS); if (ret < 0) return ret; @@ -173,7 +201,6 @@ const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); - struct omnia_leds *leds = i2c_get_clientdata(client); unsigned long brightness; int ret; @@ -183,15 +210,9 @@ if (brightness > 100) return -EINVAL; - mutex_lock(&leds->lock); - ret = i2c_smbus_write_byte_data(client, CMD_LED_SET_BRIGHTNESS, - (u8)brightness); - mutex_unlock(&leds->lock); - - if (ret < 0) - return ret; + ret = omnia_cmd_write_u8(client, CMD_LED_SET_BRIGHTNESS, brightness); - return count; + return ret < 0 ? ret : count; } static DEVICE_ATTR_RW(brightness); @@ -250,8 +271,8 @@ u8 buf[5]; /* put all LEDs into default (HW triggered) mode */ - i2c_smbus_write_byte_data(client, CMD_LED_MODE, - CMD_LED_MODE_LED(OMNIA_BOARD_LEDS)); + omnia_cmd_write_u8(client, CMD_LED_MODE, + CMD_LED_MODE_LED(OMNIA_BOARD_LEDS)); /* set all LEDs color to [255, 255, 255] */ buf[0] = CMD_LED_COLOR; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/leds/trigger/ledtrig-cpu.c +++ linux-lowlatency-5.15.0/drivers/leds/trigger/ledtrig-cpu.c @@ -130,7 +130,7 @@ static int __init ledtrig_cpu_init(void) { - int cpu; + unsigned int cpu; int ret; /* Supports up to 9999 cpu cores */ @@ -152,7 +152,7 @@ if (cpu >= 8) continue; - snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); + snprintf(trig->name, MAX_NAME_LEN, "cpu%u", cpu); led_trigger_register_simple(trig->name, &trig->_trig); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mcb/mcb-lpc.c +++ linux-lowlatency-5.15.0/drivers/mcb/mcb-lpc.c @@ -23,7 +23,7 @@ { struct resource *res; struct priv *priv; - int ret = 0; + int ret = 0, table_size; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -58,16 +58,43 @@ ret = chameleon_parse_cells(priv->bus, priv->mem->start, priv->base); if (ret < 0) { - mcb_release_bus(priv->bus); - return ret; + goto out_mcb_bus; } - dev_dbg(&pdev->dev, "Found %d cells\n", ret); + table_size = ret; + + if (table_size < CHAM_HEADER_SIZE) { + /* Release the previous resources */ + devm_iounmap(&pdev->dev, priv->base); + devm_release_mem_region(&pdev->dev, priv->mem->start, resource_size(priv->mem)); + + /* Then, allocate it again with the actual chameleon table size */ + res = devm_request_mem_region(&pdev->dev, priv->mem->start, + table_size, + KBUILD_MODNAME); + if (!res) { + dev_err(&pdev->dev, "Failed to request PCI memory\n"); + ret = -EBUSY; + goto out_mcb_bus; + } + + priv->base = devm_ioremap(&pdev->dev, priv->mem->start, table_size); + if (!priv->base) { + dev_err(&pdev->dev, "Cannot ioremap\n"); + ret = -ENOMEM; + goto out_mcb_bus; + } + + platform_set_drvdata(pdev, priv); + } mcb_bus_add_devices(priv->bus); return 0; +out_mcb_bus: + mcb_release_bus(priv->bus); + return ret; } static int mcb_lpc_remove(struct platform_device *pdev) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/md/bcache/sysfs.c +++ linux-lowlatency-5.15.0/drivers/md/bcache/sysfs.c @@ -1099,7 +1099,7 @@ sum += INITIAL_PRIO - cached[i]; if (n) - do_div(sum, n); + sum = div64_u64(sum, n); for (i = 0; i < ARRAY_SIZE(q); i++) q[i] = INITIAL_PRIO - cached[n * (i + 1) / only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/md/dm-delay.c +++ linux-lowlatency-5.15.0/drivers/md/dm-delay.c @@ -30,7 +30,7 @@ struct workqueue_struct *kdelayd_wq; struct work_struct flush_expired_bios; struct list_head delayed_bios; - atomic_t may_delay; + bool may_delay; struct delay_class read; struct delay_class write; @@ -191,7 +191,7 @@ INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); INIT_LIST_HEAD(&dc->delayed_bios); mutex_init(&dc->timer_lock); - atomic_set(&dc->may_delay, 1); + dc->may_delay = true; dc->argc = argc; ret = delay_class_ctr(ti, &dc->read, argv); @@ -245,7 +245,7 @@ struct dm_delay_info *delayed; unsigned long expires = 0; - if (!c->delay || !atomic_read(&dc->may_delay)) + if (!c->delay) return DM_MAPIO_REMAPPED; delayed = dm_per_bio_data(bio, sizeof(struct dm_delay_info)); @@ -254,6 +254,10 @@ delayed->expires = expires = jiffies + msecs_to_jiffies(c->delay); mutex_lock(&delayed_bios_lock); + if (unlikely(!dc->may_delay)) { + mutex_unlock(&delayed_bios_lock); + return DM_MAPIO_REMAPPED; + } c->ops++; list_add_tail(&delayed->list, &dc->delayed_bios); mutex_unlock(&delayed_bios_lock); @@ -267,7 +271,10 @@ { struct delay_c *dc = ti->private; - atomic_set(&dc->may_delay, 0); + mutex_lock(&delayed_bios_lock); + dc->may_delay = false; + mutex_unlock(&delayed_bios_lock); + del_timer_sync(&dc->delay_timer); flush_bios(flush_delayed_bios(dc, 1)); } @@ -276,7 +283,7 @@ { struct delay_c *dc = ti->private; - atomic_set(&dc->may_delay, 1); + dc->may_delay = true; } static int delay_map(struct dm_target *ti, struct bio *bio) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/md/dm-verity-fec.c +++ linux-lowlatency-5.15.0/drivers/md/dm-verity-fec.c @@ -24,7 +24,8 @@ */ static inline struct dm_verity_fec_io *fec_io(struct dm_verity_io *io) { - return (struct dm_verity_fec_io *) verity_io_digest_end(io->v, io); + return (struct dm_verity_fec_io *) + ((char *)io + io->v->ti->per_io_data_size - sizeof(struct dm_verity_fec_io)); } /* only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/md/dm-verity.h +++ linux-lowlatency-5.15.0/drivers/md/dm-verity.h @@ -111,12 +111,6 @@ return (u8 *)(io + 1) + v->ahash_reqsize + v->digest_size; } -static inline u8 *verity_io_digest_end(struct dm_verity *v, - struct dm_verity_io *io) -{ - return verity_io_want_digest(v, io) + v->digest_size; -} - extern int verity_for_bv_block(struct dm_verity *v, struct dm_verity_io *io, struct bvec_iter *iter, int (*process)(struct dm_verity *v, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/cec/platform/Makefile +++ linux-lowlatency-5.15.0/drivers/media/cec/platform/Makefile @@ -6,7 +6,7 @@ # Please keep it in alphabetic order obj-$(CONFIG_CEC_CROS_EC) += cros-ec/ obj-$(CONFIG_CEC_GPIO) += cec-gpio/ -obj-$(CONFIG_CEC_MESON_AO) += meson/ +obj-y += meson/ obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/ obj-$(CONFIG_CEC_SECO) += seco/ obj-$(CONFIG_CEC_STI) += sti/ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/i2c/ccs/ccs-quirk.h +++ linux-lowlatency-5.15.0/drivers/media/i2c/ccs/ccs-quirk.h @@ -32,12 +32,10 @@ * @reg: Pointer to the register to access * @value: Register value, set by the caller on write, or * by the quirk on read - * - * @flags: Quirk flags - * * @return: 0 on success, -ENOIOCTLCMD if no register * access may be done by the caller (default read * value is zero), else negative error code on error + * @flags: Quirk flags */ struct ccs_quirk { int (*limits)(struct ccs_sensor *sensor); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/pci/cobalt/cobalt-driver.c +++ linux-lowlatency-5.15.0/drivers/media/pci/cobalt/cobalt-driver.c @@ -8,6 +8,7 @@ * All rights reserved. */ +#include #include #include #include @@ -210,17 +211,17 @@ pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &stat); cobalt_info("PCIe link capability 0x%08x: %s per lane and %u lanes\n", capa, get_link_speed(capa), - (capa & PCI_EXP_LNKCAP_MLW) >> 4); + FIELD_GET(PCI_EXP_LNKCAP_MLW, capa)); cobalt_info("PCIe link control 0x%04x\n", ctrl); cobalt_info("PCIe link status 0x%04x: %s per lane and %u lanes\n", stat, get_link_speed(stat), - (stat & PCI_EXP_LNKSTA_NLW) >> 4); + FIELD_GET(PCI_EXP_LNKSTA_NLW, stat)); /* Bus */ pcie_capability_read_dword(pci_bus_dev, PCI_EXP_LNKCAP, &capa); cobalt_info("PCIe bus link capability 0x%08x: %s per lane and %u lanes\n", capa, get_link_speed(capa), - (capa & PCI_EXP_LNKCAP_MLW) >> 4); + FIELD_GET(PCI_EXP_LNKCAP_MLW, capa)); /* Slot */ pcie_capability_read_dword(pci_dev, PCI_EXP_SLTCAP, &capa); @@ -239,7 +240,7 @@ if (!pci_is_pcie(pci_dev)) return 0; pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &link); - return (link & PCI_EXP_LNKSTA_NLW) >> 4; + return FIELD_GET(PCI_EXP_LNKSTA_NLW, link); } static unsigned pcie_bus_link_get_lanes(struct cobalt *cobalt) @@ -250,7 +251,7 @@ if (!pci_is_pcie(pci_dev)) return 0; pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &link); - return (link & PCI_EXP_LNKCAP_MLW) >> 4; + return FIELD_GET(PCI_EXP_LNKCAP_MLW, link); } static void msi_config_show(struct cobalt *cobalt, struct pci_dev *pci_dev) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/cadence/cdns-csi2rx.c +++ linux-lowlatency-5.15.0/drivers/media/platform/cadence/cdns-csi2rx.c @@ -407,8 +407,10 @@ fwh, struct v4l2_async_subdev); of_node_put(ep); - if (IS_ERR(asd)) + if (IS_ERR(asd)) { + v4l2_async_notifier_cleanup(&csi2rx->notifier); return PTR_ERR(asd); + } csi2rx->notifier.ops = &csi2rx_notifier_ops; @@ -471,6 +473,7 @@ return 0; err_cleanup: + v4l2_async_notifier_unregister(&csi2rx->notifier); v4l2_async_notifier_cleanup(&csi2rx->notifier); err_free_priv: kfree(csi2rx); @@ -481,6 +484,8 @@ { struct csi2rx_priv *csi2rx = platform_get_drvdata(pdev); + v4l2_async_notifier_unregister(&csi2rx->notifier); + v4l2_async_notifier_cleanup(&csi2rx->notifier); v4l2_async_unregister_subdev(&csi2rx->subdev); kfree(csi2rx); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/camss/camss-csid.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid.c @@ -180,6 +180,8 @@ return ret; } + csid->phy.need_vc_update = true; + enable_irq(csid->irq); ret = csid->ops->reset(csid); @@ -229,7 +231,10 @@ return -ENOLINK; } - csid->ops->configure_stream(csid, enable); + if (csid->phy.need_vc_update) { + csid->ops->configure_stream(csid, enable); + csid->phy.need_vc_update = false; + } return 0; } @@ -440,6 +445,7 @@ { struct csid_device *csid = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *format; + int i; format = __csid_get_format(csid, sd_state, fmt->pad, fmt->which); if (format == NULL) @@ -448,14 +454,14 @@ csid_try_format(csid, sd_state, fmt->pad, &fmt->format, fmt->which); *format = fmt->format; - /* Propagate the format from sink to source */ + /* Propagate the format from sink to source pads */ if (fmt->pad == MSM_CSID_PAD_SINK) { - format = __csid_get_format(csid, sd_state, MSM_CSID_PAD_SRC, - fmt->which); + for (i = MSM_CSID_PAD_FIRST_SRC; i < MSM_CSID_PADS_NUM; ++i) { + format = __csid_get_format(csid, sd_state, i, fmt->which); - *format = fmt->format; - csid_try_format(csid, sd_state, MSM_CSID_PAD_SRC, format, - fmt->which); + *format = fmt->format; + csid_try_format(csid, sd_state, i, format, fmt->which); + } } return 0; @@ -695,7 +701,6 @@ struct csid_device *csid; struct csiphy_device *csiphy; struct csiphy_lanes_cfg *lane_cfg; - struct v4l2_subdev_format format = { 0 }; sd = media_entity_to_v4l2_subdev(entity); csid = v4l2_get_subdevdata(sd); @@ -718,11 +723,22 @@ lane_cfg = &csiphy->cfg.csi2->lane_cfg; csid->phy.lane_cnt = lane_cfg->num_data; csid->phy.lane_assign = csid_get_lane_assign(lane_cfg); + } + /* Decide which virtual channels to enable based on which source pads are enabled */ + if (local->flags & MEDIA_PAD_FL_SOURCE) { + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); + struct csid_device *csid = v4l2_get_subdevdata(sd); + struct device *dev = csid->camss->dev; + + if (flags & MEDIA_LNK_FL_ENABLED) + csid->phy.en_vc |= BIT(local->index - 1); + else + csid->phy.en_vc &= ~BIT(local->index - 1); + + csid->phy.need_vc_update = true; - /* Reset format on source pad to sink pad format */ - format.pad = MSM_CSID_PAD_SRC; - format.which = V4L2_SUBDEV_FORMAT_ACTIVE; - csid_set_format(&csid->subdev, NULL, &format); + dev_dbg(dev, "%s: Enabled CSID virtual channels mask 0x%x\n", + __func__, csid->phy.en_vc); } return 0; @@ -773,6 +789,7 @@ struct v4l2_subdev *sd = &csid->subdev; struct media_pad *pads = csid->pads; struct device *dev = csid->camss->dev; + int i; int ret; v4l2_subdev_init(sd, &csid_v4l2_ops); @@ -809,7 +826,8 @@ } pads[MSM_CSID_PAD_SINK].flags = MEDIA_PAD_FL_SINK; - pads[MSM_CSID_PAD_SRC].flags = MEDIA_PAD_FL_SOURCE; + for (i = MSM_CSID_PAD_FIRST_SRC; i < MSM_CSID_PADS_NUM; ++i) + pads[i].flags = MEDIA_PAD_FL_SOURCE; sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; sd->entity.ops = &csid_media_ops; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/camss/camss-csid.h +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-csid.h @@ -19,8 +19,13 @@ #include #define MSM_CSID_PAD_SINK 0 -#define MSM_CSID_PAD_SRC 1 -#define MSM_CSID_PADS_NUM 2 +#define MSM_CSID_PAD_FIRST_SRC 1 +#define MSM_CSID_PADS_NUM 5 + +#define MSM_CSID_PAD_SRC (MSM_CSID_PAD_FIRST_SRC) + +/* CSID hardware can demultiplex up to 4 outputs */ +#define MSM_CSID_MAX_SRC_STREAMS 4 #define DATA_TYPE_EMBEDDED_DATA_8BIT 0x12 #define DATA_TYPE_YUV420_8BIT 0x18 @@ -81,6 +86,8 @@ u8 csiphy_id; u8 lane_cnt; u32 lane_assign; + u32 en_vc; + u8 need_vc_update; }; struct csid_device; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/camss/camss-vfe.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss-vfe.c @@ -533,7 +533,8 @@ struct camss_clock *clock = &vfe->clock[i]; if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1")) { + !strcmp(clock->name, "vfe1") || + !strcmp(clock->name, "vfe_lite")) { u64 min_rate = 0; unsigned long rate; @@ -607,7 +608,7 @@ } else { ret = vfe_check_clock_rates(vfe); if (ret < 0) - goto error_pm_runtime_get; + goto error_pm_domain; } vfe->power_count++; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/camss/camss.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/camss/camss.c @@ -1369,6 +1369,12 @@ goto err_cleanup; } + ret = camss_configure_pd(camss); + if (ret < 0) { + dev_err(dev, "Failed to configure power domains: %d\n", ret); + goto err_cleanup; + } + ret = camss_init_subdevices(camss); if (ret < 0) goto err_cleanup; @@ -1421,12 +1427,6 @@ } } - ret = camss_configure_pd(camss); - if (ret < 0) { - dev_err(dev, "Failed to configure power domains: %d\n", ret); - return ret; - } - pm_runtime_enable(dev); return 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/venus/hfi_msgs.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -367,7 +367,7 @@ memcpy(&bufreq[idx], buf_req, sizeof(*bufreq)); idx++; - if (idx > HFI_BUFFER_TYPE_MAX) + if (idx >= HFI_BUFFER_TYPE_MAX) return HFI_ERR_SESSION_INVALID_PARAMETER; req_bytes -= sizeof(struct hfi_buffer_requirements); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/qcom/venus/hfi_parser.c +++ linux-lowlatency-5.15.0/drivers/media/platform/qcom/venus/hfi_parser.c @@ -19,6 +19,9 @@ struct hfi_plat_caps *caps = core->caps, *cap; unsigned long bit; + if (hweight_long(core->dec_codecs) + hweight_long(core->enc_codecs) > MAX_CODEC_NUM) + return; + for_each_set_bit(bit, &core->dec_codecs, MAX_CODEC_NUM) { cap = &caps[core->codecs_count++]; cap->codec = BIT(bit); @@ -86,6 +89,9 @@ { const struct hfi_profile_level *pl = data; + if (cap->num_pl + num >= HFI_MAX_PROFILE_COUNT) + return; + memcpy(&cap->pl[cap->num_pl], pl, num * sizeof(*pl)); cap->num_pl += num; } @@ -111,6 +117,9 @@ { const struct hfi_capability *caps = data; + if (cap->num_caps + num >= MAX_CAP_ENTRIES) + return; + memcpy(&cap->caps[cap->num_caps], caps, num * sizeof(*caps)); cap->num_caps += num; } @@ -137,6 +146,9 @@ { const struct raw_formats *formats = fmts; + if (cap->num_fmts + num_fmts >= MAX_FMT_ENTRIES) + return; + memcpy(&cap->fmts[cap->num_fmts], formats, num_fmts * sizeof(*formats)); cap->num_fmts += num_fmts; } @@ -159,6 +171,9 @@ rawfmts[i].buftype = fmt->buffer_type; i++; + if (i >= MAX_FMT_ENTRIES) + return; + if (pinfo->num_planes > MAX_PLANES) break; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/platform/s3c-camif/camif-capture.c +++ linux-lowlatency-5.15.0/drivers/media/platform/s3c-camif/camif-capture.c @@ -1132,12 +1132,12 @@ ret = vb2_queue_init(q); if (ret) - goto err_vd_rel; + return ret; vp->pad.flags = MEDIA_PAD_FL_SINK; ret = media_entity_pads_init(&vfd->entity, 1, &vp->pad); if (ret) - goto err_vd_rel; + return ret; video_set_drvdata(vfd, vp); @@ -1170,8 +1170,6 @@ v4l2_ctrl_handler_free(&vp->ctrl_handler); err_me_cleanup: media_entity_cleanup(&vfd->entity); -err_vd_rel: - video_device_release(vfd); return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/rc/ir-sharp-decoder.c +++ linux-lowlatency-5.15.0/drivers/media/rc/ir-sharp-decoder.c @@ -15,7 +15,9 @@ #define SHARP_UNIT 40 /* us */ #define SHARP_BIT_PULSE (8 * SHARP_UNIT) /* 320us */ #define SHARP_BIT_0_PERIOD (25 * SHARP_UNIT) /* 1ms (680us space) */ -#define SHARP_BIT_1_PERIOD (50 * SHARP_UNIT) /* 2ms (1680ms space) */ +#define SHARP_BIT_1_PERIOD (50 * SHARP_UNIT) /* 2ms (1680us space) */ +#define SHARP_BIT_0_SPACE (17 * SHARP_UNIT) /* 680us space */ +#define SHARP_BIT_1_SPACE (42 * SHARP_UNIT) /* 1680us space */ #define SHARP_ECHO_SPACE (1000 * SHARP_UNIT) /* 40 ms */ #define SHARP_TRAILER_SPACE (125 * SHARP_UNIT) /* 5 ms (even longer) */ @@ -168,8 +170,8 @@ .header_pulse = 0, .header_space = 0, .bit_pulse = SHARP_BIT_PULSE, - .bit_space[0] = SHARP_BIT_0_PERIOD, - .bit_space[1] = SHARP_BIT_1_PERIOD, + .bit_space[0] = SHARP_BIT_0_SPACE, + .bit_space[1] = SHARP_BIT_1_SPACE, .trailer_pulse = SHARP_BIT_PULSE, .trailer_space = SHARP_ECHO_SPACE, .msb_first = 1, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/rc/lirc_dev.c +++ linux-lowlatency-5.15.0/drivers/media/rc/lirc_dev.c @@ -287,7 +287,11 @@ if (ret < 0) goto out_kfree_raw; - count = ret; + /* drop trailing space */ + if (!(ret % 2)) + count = ret - 1; + else + count = ret; txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL); if (!txbuf) { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/test-drivers/vidtv/vidtv_mux.c +++ linux-lowlatency-5.15.0/drivers/media/test-drivers/vidtv/vidtv_mux.c @@ -504,13 +504,16 @@ m->priv = args->priv; m->network_id = args->network_id; m->network_name = kstrdup(args->network_name, GFP_KERNEL); + if (!m->network_name) + goto free_mux_buf; + m->timing.current_jiffies = get_jiffies_64(); if (args->channels) m->channels = args->channels; else if (vidtv_channels_init(m) < 0) - goto free_mux_buf; + goto free_mux_network_name; /* will alloc data for pmt_sections after initializing pat */ if (vidtv_channel_si_init(m) < 0) @@ -527,6 +530,8 @@ vidtv_channel_si_destroy(m); free_channels: vidtv_channels_destroy(m); +free_mux_network_name: + kfree(m->network_name); free_mux_buf: vfree(m->mux_buf); free_mux: only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/test-drivers/vidtv/vidtv_psi.c +++ linux-lowlatency-5.15.0/drivers/media/test-drivers/vidtv/vidtv_psi.c @@ -307,16 +307,29 @@ desc->service_name_len = service_name_len; - if (service_name && service_name_len) + if (service_name && service_name_len) { desc->service_name = kstrdup(service_name, GFP_KERNEL); + if (!desc->service_name) + goto free_desc; + } desc->provider_name_len = provider_name_len; - if (provider_name && provider_name_len) + if (provider_name && provider_name_len) { desc->provider_name = kstrdup(provider_name, GFP_KERNEL); + if (!desc->provider_name) + goto free_desc_service_name; + } vidtv_psi_desc_chain(head, (struct vidtv_psi_desc *)desc); return desc; + +free_desc_service_name: + if (service_name && service_name_len) + kfree(desc->service_name); +free_desc: + kfree(desc); + return NULL; } struct vidtv_psi_desc_registration @@ -361,8 +374,13 @@ desc->length = network_name_len; - if (network_name && network_name_len) + if (network_name && network_name_len) { desc->network_name = kstrdup(network_name, GFP_KERNEL); + if (!desc->network_name) { + kfree(desc); + return NULL; + } + } vidtv_psi_desc_chain(head, (struct vidtv_psi_desc *)desc); return desc; @@ -448,15 +466,32 @@ iso_language_code = "eng"; desc->iso_language_code = kstrdup(iso_language_code, GFP_KERNEL); + if (!desc->iso_language_code) + goto free_desc; - if (event_name && event_name_len) + if (event_name && event_name_len) { desc->event_name = kstrdup(event_name, GFP_KERNEL); + if (!desc->event_name) + goto free_desc_language_code; + } - if (text && text_len) + if (text && text_len) { desc->text = kstrdup(text, GFP_KERNEL); + if (!desc->text) + goto free_desc_event_name; + } vidtv_psi_desc_chain(head, (struct vidtv_psi_desc *)desc); return desc; + +free_desc_event_name: + if (event_name && event_name_len) + kfree(desc->event_name); +free_desc_language_code: + kfree(desc->iso_language_code); +free_desc: + kfree(desc); + return NULL; } struct vidtv_psi_desc *vidtv_psi_desc_clone(struct vidtv_psi_desc *desc) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/test-drivers/vivid/vivid-rds-gen.c +++ linux-lowlatency-5.15.0/drivers/media/test-drivers/vivid/vivid-rds-gen.c @@ -145,7 +145,7 @@ rds->ta = alt; rds->ms = true; snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d", - freq / 16, ((freq & 0xf) * 10) / 16); + (freq / 16) % 1000000, (((freq & 0xf) * 10) / 16) % 10); if (alt) strscpy(rds->radiotext, " The Radio Data System can switch between different Radio Texts ", only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/media/usb/gspca/cpia1.c +++ linux-lowlatency-5.15.0/drivers/media/usb/gspca/cpia1.c @@ -18,6 +18,7 @@ #include #include +#include #include "gspca.h" @@ -1028,6 +1029,8 @@ sd->params.exposure.expMode = 2; sd->exposure_status = EXPOSURE_NORMAL; } + if (sd->params.exposure.gain >= BITS_PER_TYPE(currentexp)) + return -EINVAL; currentexp = currentexp << sd->params.exposure.gain; sd->params.exposure.gain = 0; /* round down current exposure to nearest value */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mfd/arizona-spi.c +++ linux-lowlatency-5.15.0/drivers/mfd/arizona-spi.c @@ -118,6 +118,9 @@ arizona->pdata.micd_ranges = arizona_micd_aosp_ranges; arizona->pdata.num_micd_ranges = ARRAY_SIZE(arizona_micd_aosp_ranges); + /* Use left headphone speaker for HP vs line-out detection */ + arizona->pdata.hpdet_channel = ARIZONA_ACCDET_MODE_HPL; + return 0; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/misc/mei/client.c +++ linux-lowlatency-5.15.0/drivers/misc/mei/client.c @@ -1975,7 +1975,7 @@ mei_hdr = mei_msg_hdr_init(cb); if (IS_ERR(mei_hdr)) { - rets = -PTR_ERR(mei_hdr); + rets = PTR_ERR(mei_hdr); mei_hdr = NULL; goto err; } @@ -1999,7 +1999,7 @@ hbuf_slots = mei_hbuf_empty_slots(dev); if (hbuf_slots < 0) { - rets = -EOVERFLOW; + buf_len = -EOVERFLOW; goto out; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/misc/ti-st/st_core.c +++ linux-lowlatency-5.15.0/drivers/misc/ti-st/st_core.c @@ -15,6 +15,7 @@ #include #include +#include extern void st_kim_recv(void *, const unsigned char *, long); void st_int_recv(void *, const unsigned char *, long); @@ -435,7 +436,7 @@ case ST_LL_AWAKE_TO_ASLEEP: pr_err("ST LL is illegal state(%ld)," "purging received skb.", st_ll_getstate(st_gdata)); - kfree_skb(skb); + dev_kfree_skb_irq(skb); break; case ST_LL_ASLEEP: skb_queue_tail(&st_gdata->tx_waitq, skb); @@ -444,7 +445,7 @@ default: pr_err("ST LL is illegal state(%ld)," "purging received skb.", st_ll_getstate(st_gdata)); - kfree_skb(skb); + dev_kfree_skb_irq(skb); break; } @@ -498,7 +499,7 @@ spin_unlock_irqrestore(&st_data->lock, flags); break; } - kfree_skb(skb); + dev_kfree_skb_irq(skb); spin_unlock_irqrestore(&st_data->lock, flags); } /* if wake-up is set in another context- restart sending */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mmc/core/regulator.c +++ linux-lowlatency-5.15.0/drivers/mmc/core/regulator.c @@ -271,3 +271,44 @@ return 0; } EXPORT_SYMBOL_GPL(mmc_regulator_get_supply); + +/** + * mmc_regulator_enable_vqmmc - enable VQMMC regulator for a host + * @mmc: the host to regulate + * + * Returns 0 or errno. Enables the regulator for vqmmc. + * Keeps track of the enable status for ensuring that calls to + * regulator_enable/disable are balanced. + */ +int mmc_regulator_enable_vqmmc(struct mmc_host *mmc) +{ + int ret = 0; + + if (!IS_ERR(mmc->supply.vqmmc) && !mmc->vqmmc_enabled) { + ret = regulator_enable(mmc->supply.vqmmc); + if (ret < 0) + dev_err(mmc_dev(mmc), "enabling vqmmc regulator failed\n"); + else + mmc->vqmmc_enabled = true; + } + + return ret; +} +EXPORT_SYMBOL_GPL(mmc_regulator_enable_vqmmc); + +/** + * mmc_regulator_disable_vqmmc - disable VQMMC regulator for a host + * @mmc: the host to regulate + * + * Returns 0 or errno. Disables the regulator for vqmmc. + * Keeps track of the enable status for ensuring that calls to + * regulator_enable/disable are balanced. + */ +void mmc_regulator_disable_vqmmc(struct mmc_host *mmc) +{ + if (!IS_ERR(mmc->supply.vqmmc) && mmc->vqmmc_enabled) { + regulator_disable(mmc->supply.vqmmc); + mmc->vqmmc_enabled = false; + } +} +EXPORT_SYMBOL_GPL(mmc_regulator_disable_vqmmc); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mmc/host/cqhci-core.c +++ linux-lowlatency-5.15.0/drivers/mmc/host/cqhci-core.c @@ -935,8 +935,8 @@ ret = cqhci_tasks_cleared(cq_host); if (!ret) - pr_debug("%s: cqhci: Failed to clear tasks\n", - mmc_hostname(mmc)); + pr_warn("%s: cqhci: Failed to clear tasks\n", + mmc_hostname(mmc)); return ret; } @@ -969,7 +969,7 @@ ret = cqhci_halted(cq_host); if (!ret) - pr_debug("%s: cqhci: Failed to halt\n", mmc_hostname(mmc)); + pr_warn("%s: cqhci: Failed to halt\n", mmc_hostname(mmc)); return ret; } @@ -977,10 +977,10 @@ /* * After halting we expect to be able to use the command line. We interpret the * failure to halt to mean the data lines might still be in use (and the upper - * layers will need to send a STOP command), so we set the timeout based on a - * generous command timeout. + * layers will need to send a STOP command), however failing to halt complicates + * the recovery, so set a timeout that would reasonably allow I/O to complete. */ -#define CQHCI_START_HALT_TIMEOUT 5 +#define CQHCI_START_HALT_TIMEOUT 500 static void cqhci_recovery_start(struct mmc_host *mmc) { @@ -1068,28 +1068,28 @@ ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); - if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) - ok = false; - /* * The specification contradicts itself, by saying that tasks cannot be * cleared if CQHCI does not halt, but if CQHCI does not halt, it should * be disabled/re-enabled, but not to disable before clearing tasks. * Have a go anyway. */ - if (!ok) { - pr_debug("%s: cqhci: disable / re-enable\n", mmc_hostname(mmc)); - cqcfg = cqhci_readl(cq_host, CQHCI_CFG); - cqcfg &= ~CQHCI_ENABLE; - cqhci_writel(cq_host, cqcfg, CQHCI_CFG); - cqcfg |= CQHCI_ENABLE; - cqhci_writel(cq_host, cqcfg, CQHCI_CFG); - /* Be sure that there are no tasks */ - ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); - if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) - ok = false; - WARN_ON(!ok); - } + if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) + ok = false; + + /* Disable to make sure tasks really are cleared */ + cqcfg = cqhci_readl(cq_host, CQHCI_CFG); + cqcfg &= ~CQHCI_ENABLE; + cqhci_writel(cq_host, cqcfg, CQHCI_CFG); + + cqcfg = cqhci_readl(cq_host, CQHCI_CFG); + cqcfg |= CQHCI_ENABLE; + cqhci_writel(cq_host, cqcfg, CQHCI_CFG); + + cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); + + if (!ok) + cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT); cqhci_recover_mrqs(cq_host); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mtd/chips/cfi_cmdset_0001.c +++ linux-lowlatency-5.15.0/drivers/mtd/chips/cfi_cmdset_0001.c @@ -421,9 +421,25 @@ extra_size = 0; /* Protection Register info */ - if (extp->NumProtectionFields) + if (extp->NumProtectionFields) { + struct cfi_intelext_otpinfo *otp = + (struct cfi_intelext_otpinfo *)&extp->extra[0]; + extra_size += (extp->NumProtectionFields - 1) * - sizeof(struct cfi_intelext_otpinfo); + sizeof(struct cfi_intelext_otpinfo); + + if (extp_size >= sizeof(*extp) + extra_size) { + int i; + + /* Do some byteswapping if necessary */ + for (i = 0; i < extp->NumProtectionFields - 1; i++) { + otp->ProtRegAddr = le32_to_cpu(otp->ProtRegAddr); + otp->FactGroups = le16_to_cpu(otp->FactGroups); + otp->UserGroups = le16_to_cpu(otp->UserGroups); + otp++; + } + } + } } if (extp->MinorVersion >= '1') { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mtd/maps/physmap-core.c +++ linux-lowlatency-5.15.0/drivers/mtd/maps/physmap-core.c @@ -556,6 +556,17 @@ if (info->probe_type) { info->mtds[i] = do_map_probe(info->probe_type, &info->maps[i]); + + /* Fall back to mapping region as ROM */ + if (!info->mtds[i] && IS_ENABLED(CONFIG_MTD_ROM) && + strcmp(info->probe_type, "map_rom")) { + dev_warn(&dev->dev, + "map_probe() failed for type %s\n", + info->probe_type); + + info->mtds[i] = do_map_probe("map_rom", + &info->maps[i]); + } } else { int j; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/mtd/nand/spi/micron.c +++ linux-lowlatency-5.15.0/drivers/mtd/nand/spi/micron.c @@ -12,7 +12,7 @@ #define SPINAND_MFR_MICRON 0x2c -#define MICRON_STATUS_ECC_MASK GENMASK(7, 4) +#define MICRON_STATUS_ECC_MASK GENMASK(6, 4) #define MICRON_STATUS_ECC_NO_BITFLIPS (0 << 4) #define MICRON_STATUS_ECC_1TO3_BITFLIPS (1 << 4) #define MICRON_STATUS_ECC_4TO6_BITFLIPS (3 << 4) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/arcnet/arcdevice.h +++ linux-lowlatency-5.15.0/drivers/net/arcnet/arcdevice.h @@ -186,6 +186,8 @@ #define ARC_IS_5MBIT 1 /* card default speed is 5MBit */ #define ARC_CAN_10MBIT 2 /* card uses COM20022, supporting 10MBit, but default is 2.5MBit. */ +#define ARC_HAS_LED 4 /* card has software controlled LEDs */ +#define ARC_HAS_ROTARY 8 /* card has rotary encoder */ /* information needed to define an encapsulation driver */ struct ArcProto { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/can/dev/dev.c +++ linux-lowlatency-5.15.0/drivers/net/can/dev/dev.c @@ -141,7 +141,8 @@ struct can_frame *cf; int err; - BUG_ON(netif_carrier_ok(dev)); + if (netif_carrier_ok(dev)) + netdev_err(dev, "Attempt to restart for bus-off recovery, but carrier is OK?\n"); /* No synchronization needed because the device is bus-off and * no messages can come in or go out. @@ -165,11 +166,12 @@ priv->can_stats.restarts++; /* Now restart the device */ - err = priv->do_set_mode(dev, CAN_MODE_START); - netif_carrier_on(dev); - if (err) + err = priv->do_set_mode(dev, CAN_MODE_START); + if (err) { netdev_err(dev, "Error %d during restart", err); + netif_carrier_off(dev); + } } static void can_restart_work(struct work_struct *work) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/can/dev/skb.c +++ linux-lowlatency-5.15.0/drivers/net/can/dev/skb.c @@ -42,7 +42,11 @@ { struct can_priv *priv = netdev_priv(dev); - BUG_ON(idx >= priv->echo_skb_max); + if (idx >= priv->echo_skb_max) { + netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", + __func__, idx, priv->echo_skb_max); + return -EINVAL; + } /* check flag whether this packet has to be looped back */ if (!(dev->flags & IFF_ECHO) || only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/dsa/lan9303_mdio.c +++ linux-lowlatency-5.15.0/drivers/net/dsa/lan9303_mdio.c @@ -32,7 +32,7 @@ struct lan9303_mdio *sw_dev = (struct lan9303_mdio *)ctx; reg <<= 2; /* reg num to offset */ - mutex_lock(&sw_dev->device->bus->mdio_lock); + mutex_lock_nested(&sw_dev->device->bus->mdio_lock, MDIO_MUTEX_NESTED); lan9303_mdio_real_write(sw_dev->device, reg, val & 0xffff); lan9303_mdio_real_write(sw_dev->device, reg + 2, (val >> 16) & 0xffff); mutex_unlock(&sw_dev->device->bus->mdio_lock); @@ -50,7 +50,7 @@ struct lan9303_mdio *sw_dev = (struct lan9303_mdio *)ctx; reg <<= 2; /* reg num to offset */ - mutex_lock(&sw_dev->device->bus->mdio_lock); + mutex_lock_nested(&sw_dev->device->bus->mdio_lock, MDIO_MUTEX_NESTED); *val = lan9303_mdio_real_read(sw_dev->device, reg); *val |= (lan9303_mdio_real_read(sw_dev->device, reg + 2) << 16); mutex_unlock(&sw_dev->device->bus->mdio_lock); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c @@ -314,10 +314,15 @@ cmd->base.phy_address = pdata->phy.address; - cmd->base.autoneg = pdata->phy.autoneg; - cmd->base.speed = pdata->phy.speed; - cmd->base.duplex = pdata->phy.duplex; + if (netif_carrier_ok(netdev)) { + cmd->base.speed = pdata->phy.speed; + cmd->base.duplex = pdata->phy.duplex; + } else { + cmd->base.speed = SPEED_UNKNOWN; + cmd->base.duplex = DUPLEX_UNKNOWN; + } + cmd->base.autoneg = pdata->phy.autoneg; cmd->base.port = PORT_NONE; XGBE_LM_COPY(cmd, supported, lks, supported); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/atheros/atl1c/atl1c.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/atheros/atl1c/atl1c.h @@ -504,15 +504,12 @@ u16 next_to_use; u16 next_to_clean; struct napi_struct napi; - struct page *rx_page; - unsigned int rx_page_offset; }; /* board specific private data structure */ struct atl1c_adapter { struct net_device *netdev; struct pci_dev *pdev; - unsigned int rx_frag_size; struct atl1c_hw hw; struct atl1c_hw_stats hw_stats; struct mii_if_info mii; /* MII interface info */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/broadcom/tg3.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/broadcom/tg3.h @@ -3018,6 +3018,7 @@ u16 *rx_rcb_prod_idx; struct tg3_rx_prodring_set prodring; struct tg3_rx_buffer_desc *rx_rcb; + unsigned long rx_dropped; u32 tx_prod ____cacheline_aligned; u32 tx_cons; @@ -3026,6 +3027,7 @@ u32 prodmbox; struct tg3_tx_buffer_desc *tx_ring; struct tg3_tx_ring_info *tx_buffers; + unsigned long tx_dropped; dma_addr_t status_mapping; dma_addr_t rx_rcb_mapping; @@ -3219,8 +3221,6 @@ /* begin "everything else" cacheline(s) section */ - unsigned long rx_dropped; - unsigned long tx_dropped; struct rtnl_link_stats64 net_stats_prev; struct tg3_ethtool_stats estats_prev; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/cortina/gemini.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/cortina/gemini.h @@ -502,7 +502,7 @@ #define SOF_BIT 0x80000000 #define EOF_BIT 0x40000000 #define EOFIE_BIT BIT(29) -#define MTU_SIZE_BIT_MASK 0x1fff +#define MTU_SIZE_BIT_MASK 0x7ff /* Max MTU 2047 bytes */ /* GMAC Tx Descriptor */ struct gmac_txdesc { @@ -787,7 +787,7 @@ #define CONFIG0_MAXLEN_1536 0 #define CONFIG0_MAXLEN_1518 1 #define CONFIG0_MAXLEN_1522 2 -#define CONFIG0_MAXLEN_1542 3 +#define CONFIG0_MAXLEN_1548 3 #define CONFIG0_MAXLEN_9k 4 /* 9212 */ #define CONFIG0_MAXLEN_10k 5 /* 10236 */ #define CONFIG0_MAXLEN_1518__6 6 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h @@ -670,7 +670,7 @@ static inline unsigned int dpaa2_eth_needed_headroom(struct sk_buff *skb) { - unsigned int headroom = DPAA2_ETH_SWA_SIZE; + unsigned int headroom = DPAA2_ETH_SWA_SIZE + DPAA2_ETH_TX_BUF_ALIGN; /* If we don't have an skb (e.g. XDP buffer), we only need space for * the software annotation area only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -66,6 +66,27 @@ } } +static u32 hns_mac_link_anti_shake(struct mac_driver *mac_ctrl_drv) +{ +#define HNS_MAC_LINK_WAIT_TIME 5 +#define HNS_MAC_LINK_WAIT_CNT 40 + + u32 link_status = 0; + int i; + + if (!mac_ctrl_drv->get_link_status) + return link_status; + + for (i = 0; i < HNS_MAC_LINK_WAIT_CNT; i++) { + msleep(HNS_MAC_LINK_WAIT_TIME); + mac_ctrl_drv->get_link_status(mac_ctrl_drv, &link_status); + if (!link_status) + break; + } + + return link_status; +} + void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status) { struct mac_driver *mac_ctrl_drv; @@ -83,6 +104,14 @@ &sfp_prsnt); if (!ret) *link_status = *link_status && sfp_prsnt; + + /* for FIBER port, it may have a fake link up. + * when the link status changes from down to up, we need to do + * anti-shake. the anti-shake time is base on tests. + * only FIBER port need to do this. + */ + if (*link_status && !mac_cb->link) + *link_status = hns_mac_link_anti_shake(mac_ctrl_drv); } mac_cb->link = *link_status; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h @@ -131,11 +131,20 @@ }; struct hclge_pf_to_vf_msg { - u16 code; - u16 vf_mbx_msg_code; - u16 vf_mbx_msg_subcode; - u16 resp_status; - u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE]; + __le16 code; + union { + /* used for mbx response */ + struct { + __le16 vf_mbx_msg_code; + __le16 vf_mbx_msg_subcode; + __le16 resp_status; + u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE]; + }; + /* used for general mbx */ + struct { + u8 msg_data[HCLGE_MBX_MAX_MSG_SIZE]; + }; + }; }; struct hclge_mbx_vf_to_pf_cmd { @@ -145,7 +154,7 @@ u8 rsv1[1]; u8 msg_len; u8 rsv2; - u16 match_id; + __le16 match_id; struct hclge_vf_to_pf_msg msg; }; @@ -156,7 +165,7 @@ u8 rsv[3]; u8 msg_len; u8 rsv1; - u16 match_id; + __le16 match_id; struct hclge_pf_to_vf_msg msg; }; @@ -166,6 +175,28 @@ u8 rsv[22]; }; +#pragma pack(1) +struct hclge_mbx_link_status { + __le16 link_status; + __le32 speed; + __le16 duplex; + u8 flag; +}; + +struct hclge_mbx_link_mode { + __le16 idx; + __le64 link_mode; +}; + +struct hclge_mbx_port_base_vlan { + __le16 state; + __le16 vlan_proto; + __le16 qos; + __le16 vlan_tag; +}; + +#pragma pack() + /* used by VF to store the received Async responses from PF */ struct hclgevf_mbx_arq_ring { #define HCLGE_MBX_MAX_ARQ_MSG_SIZE 8 @@ -174,7 +205,7 @@ u32 head; u32 tail; atomic_t count; - u16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE]; + __le16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE]; }; #define hclge_mbx_ring_ptr_move_crq(crq) \ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h @@ -62,7 +62,7 @@ TP_fast_assign( __entry->vfid = req->dest_vfid; - __entry->code = req->msg.code; + __entry->code = le16_to_cpu(req->msg.code); __assign_str(pciname, pci_name(hdev->pdev)); __assign_str(devname, &hdev->vport[0].nic.kinfo.netdev->name); memcpy(__entry->mbx_data, req, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h @@ -29,7 +29,7 @@ TP_fast_assign( __entry->vfid = req->dest_vfid; - __entry->code = req->msg.code; + __entry->code = le16_to_cpu(req->msg.code); __assign_str(pciname, pci_name(hdev->pdev)); __assign_str(devname, &hdev->nic.kinfo.netdev->name); memcpy(__entry->mbx_data, req, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h @@ -118,6 +118,9 @@ #define ICE_AQC_CAPS_PENDING_NET_VER 0x004D #define ICE_AQC_CAPS_RDMA 0x0051 #define ICE_AQC_CAPS_NVM_MGMT 0x0080 +#define ICE_AQC_CAPS_FW_LAG_SUPPORT 0x0092 +#define ICE_AQC_BIT_ROCEV2_LAG 0x01 +#define ICE_AQC_BIT_SRIOV_LAG 0x02 u8 major_ver; u8 minor_ver; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/intel/ice/ice_lib.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_lib.h @@ -116,4 +116,7 @@ int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi); int ice_clear_dflt_vsi(struct ice_sw *sw); +bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f); +void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f); +void ice_init_feature_support(struct ice_pf *pf); #endif /* !_ICE_LIB_H_ */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/intel/ice/ice_type.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/intel/ice/ice_type.h @@ -268,6 +268,8 @@ u8 dcb; u8 ieee_1588; u8 rdma; + u8 roce_lag; + u8 sriov_lag; bool nvm_update_pending_nvm; bool nvm_update_pending_orom; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c @@ -1284,7 +1284,7 @@ rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq"); if (!rvu_dl->devlink_wq) - goto err; + return -ENOMEM; INIT_WORK(&rvu_reporters->intr_work, rvu_npa_intr_work); INIT_WORK(&rvu_reporters->err_work, rvu_npa_err_work); @@ -1292,9 +1292,6 @@ INIT_WORK(&rvu_reporters->ras_work, rvu_npa_ras_work); return 0; -err: - rvu_npa_health_reporters_destroy(rvu_dl); - return -ENOMEM; } static int rvu_npa_health_reporters_create(struct rvu_devlink *rvu_dl) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c @@ -31,8 +31,8 @@ {NIX_TXSCH_LVL_TL4, 3, 0xFFFF, {{0x0B00, 0x0B08}, {0x0B10, 0x0B18}, {0x1200, 0x12E0} } }, {NIX_TXSCH_LVL_TL3, 4, 0xFFFF, {{0x1000, 0x10E0}, {0x1600, 0x1608}, - {0x1610, 0x1618}, {0x1700, 0x17B0} } }, - {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17B0} } }, + {0x1610, 0x1618}, {0x1700, 0x17C8} } }, + {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17C8} } }, {NIX_TXSCH_LVL_TL1, 1, 0xFFFF, {{0x0C00, 0x0D98} } }, }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -316,9 +316,12 @@ if (is_otx2_lbkvf(pfvf->pdev)) return; + mutex_lock(&pfvf->mbox.lock); req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox); - if (!req) + if (!req) { + mutex_unlock(&pfvf->mbox.lock); return; + } if (!otx2_sync_mbox_msg(&pfvf->mbox)) { rsp = (struct cgx_pause_frm_cfg *) @@ -326,6 +329,7 @@ pause->rx_pause = rsp->rx_pause; pause->tx_pause = rsp->tx_pause; } + mutex_unlock(&pfvf->mbox.lock); } static int otx2_set_pauseparam(struct net_device *netdev, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/marvell/sky2.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/marvell/sky2.h @@ -2195,7 +2195,7 @@ struct sk_buff *skb; dma_addr_t data_addr; DEFINE_DMA_UNMAP_LEN(data_size); - dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT]; + dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1]; }; enum flow_control { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.c @@ -155,3 +155,50 @@ return mh->modify_hdr; } +char * +mlx5e_mod_hdr_alloc(struct mlx5_core_dev *mdev, int namespace, + struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts) +{ + int new_num_actions, max_hw_actions; + size_t new_sz, old_sz; + void *ret; + + if (mod_hdr_acts->num_actions < mod_hdr_acts->max_actions) + goto out; + + max_hw_actions = mlx5e_mod_hdr_max_actions(mdev, namespace); + new_num_actions = min(max_hw_actions, + mod_hdr_acts->actions ? + mod_hdr_acts->max_actions * 2 : 1); + if (mod_hdr_acts->max_actions == new_num_actions) + return ERR_PTR(-ENOSPC); + + new_sz = MLX5_MH_ACT_SZ * new_num_actions; + old_sz = mod_hdr_acts->max_actions * MLX5_MH_ACT_SZ; + + ret = krealloc(mod_hdr_acts->actions, new_sz, GFP_KERNEL); + if (!ret) + return ERR_PTR(-ENOMEM); + + memset(ret + old_sz, 0, new_sz - old_sz); + mod_hdr_acts->actions = ret; + mod_hdr_acts->max_actions = new_num_actions; + +out: + return mod_hdr_acts->actions + (mod_hdr_acts->num_actions * MLX5_MH_ACT_SZ); +} + +void +mlx5e_mod_hdr_dealloc(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts) +{ + kfree(mod_hdr_acts->actions); + mod_hdr_acts->actions = NULL; + mod_hdr_acts->num_actions = 0; + mod_hdr_acts->max_actions = 0; +} + +char * +mlx5e_mod_hdr_get_item(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts, int pos) +{ + return mod_hdr_acts->actions + (pos * MLX5_MH_ACT_SZ); +} only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.h @@ -15,6 +15,11 @@ void *actions; }; +char *mlx5e_mod_hdr_alloc(struct mlx5_core_dev *mdev, int namespace, + struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts); +void mlx5e_mod_hdr_dealloc(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts); +char *mlx5e_mod_hdr_get_item(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts, int pos); + struct mlx5e_mod_hdr_handle * mlx5e_mod_hdr_attach(struct mlx5_core_dev *mdev, struct mod_hdr_tbl *tbl, @@ -28,4 +33,12 @@ void mlx5e_mod_hdr_tbl_init(struct mod_hdr_tbl *tbl); void mlx5e_mod_hdr_tbl_destroy(struct mod_hdr_tbl *tbl); +static inline int mlx5e_mod_hdr_max_actions(struct mlx5_core_dev *mdev, int namespace) +{ + if (namespace == MLX5_FLOW_NAMESPACE_FDB) /* FDB offloading */ + return MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, max_modify_header_actions); + else /* namespace is MLX5_FLOW_NAMESPACE_KERNEL - NIC offloading */ + return MLX5_CAP_FLOWTABLE_NIC_RX(mdev, max_modify_header_actions); +} + #endif /* __MLX5E_EN_MOD_HDR_H__ */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c @@ -5,6 +5,7 @@ #include #include "en/mapping.h" #include "en/tc/post_act.h" +#include "en/mod_hdr.h" #include "sample.h" #include "eswitch.h" #include "en_tc.h" @@ -255,12 +256,12 @@ goto err_modify_hdr; } - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); return modify_hdr; err_modify_hdr: err_post_act: - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); err_set_regc0: return ERR_PTR(err); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c @@ -14,6 +14,7 @@ #include "fs_core.h" #include "esw/indir_table.h" #include "lib/fs_chains.h" +#include "en/mod_hdr.h" #define MLX5_ESW_INDIR_TABLE_SIZE 128 #define MLX5_ESW_INDIR_TABLE_RECIRC_IDX_MAX (MLX5_ESW_INDIR_TABLE_SIZE - 2) @@ -226,7 +227,7 @@ goto err_handle; } - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); rule->handle = handle; rule->vni = esw_attr->rx_tun_attr->vni; rule->mh = flow_act.modify_hdr; @@ -243,7 +244,7 @@ mlx5_modify_header_dealloc(esw->dev, flow_act.modify_hdr); err_mod_hdr_alloc: err_mod_hdr_regc1: - dealloc_mod_hdr_actions(&mod_acts); + mlx5e_mod_hdr_dealloc(&mod_acts); err_mod_hdr_regc0: err_ethertype: kfree(rule); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c @@ -251,7 +251,7 @@ * is 2^ACL_MAX_BF_LOG */ bf_bank_size = 1 << MLXSW_CORE_RES_GET(mlxsw_sp->core, ACL_MAX_BF_LOG); - bf = kzalloc(struct_size(bf, refcnt, bf_bank_size * num_erp_banks), + bf = kzalloc(struct_size(bf, refcnt, size_mul(bf_bank_size, num_erp_banks)), GFP_KERNEL); if (!bf) return ERR_PTR(-ENOMEM); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/netronome/nfp/flower/cmsg.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/cmsg.c @@ -210,6 +210,7 @@ unsigned int msg_len = nfp_flower_cmsg_get_data_len(skb); struct nfp_flower_cmsg_merge_hint *msg; struct nfp_fl_payload *sub_flows[2]; + struct nfp_flower_priv *priv; int err, i, flow_cnt; msg = nfp_flower_cmsg_get_data(skb); @@ -228,14 +229,15 @@ return; } - rtnl_lock(); + priv = app->priv; + mutex_lock(&priv->nfp_fl_lock); for (i = 0; i < flow_cnt; i++) { u32 ctx = be32_to_cpu(msg->flow[i].host_ctx); sub_flows[i] = nfp_flower_get_fl_payload_from_ctx(app, ctx); if (!sub_flows[i]) { nfp_flower_cmsg_warn(app, "Invalid flow in merge hint\n"); - goto err_rtnl_unlock; + goto err_mutex_unlock; } } @@ -244,8 +246,8 @@ if (err == -ENOMEM) nfp_flower_cmsg_warn(app, "Flow merge memory fail.\n"); -err_rtnl_unlock: - rtnl_unlock(); +err_mutex_unlock: + mutex_unlock(&priv->nfp_fl_lock); } static void only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/netronome/nfp/flower/main.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -196,6 +196,7 @@ * @ct_zone_table: Hash table used to store the different zones * @ct_zone_wc: Special zone entry for wildcarded zone matches * @ct_map_table: Hash table used to referennce ct flows + * @nfp_fl_lock: Lock to protect the flow offload operation */ struct nfp_flower_priv { struct nfp_app *app; @@ -233,6 +234,7 @@ struct rhashtable ct_zone_table; struct nfp_fl_ct_zone_entry *ct_zone_wc; struct rhashtable ct_map_table; + struct mutex nfp_fl_lock; /* Protect the flow operation */ }; /** only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/netronome/nfp/flower/metadata.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/metadata.c @@ -530,6 +530,8 @@ if (err) goto err_free_stats_ctx_table; + mutex_init(&priv->nfp_fl_lock); + err = rhashtable_init(&priv->ct_zone_table, &nfp_zone_table_params); if (err) goto err_free_merge_table; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1009,8 +1009,6 @@ u64 parent_ctx = 0; int err; - ASSERT_RTNL(); - if (sub_flow1 == sub_flow2 || nfp_flower_is_merge_flow(sub_flow1) || nfp_flower_is_merge_flow(sub_flow2)) @@ -1662,19 +1660,30 @@ nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev, struct flow_cls_offload *flower) { + struct nfp_flower_priv *priv = app->priv; + int ret; + if (!eth_proto_is_802_3(flower->common.protocol)) return -EOPNOTSUPP; + mutex_lock(&priv->nfp_fl_lock); switch (flower->command) { case FLOW_CLS_REPLACE: - return nfp_flower_add_offload(app, netdev, flower); + ret = nfp_flower_add_offload(app, netdev, flower); + break; case FLOW_CLS_DESTROY: - return nfp_flower_del_offload(app, netdev, flower); + ret = nfp_flower_del_offload(app, netdev, flower); + break; case FLOW_CLS_STATS: - return nfp_flower_get_stats(app, netdev, flower); + ret = nfp_flower_get_stats(app, netdev, flower); + break; default: - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + break; } + mutex_unlock(&priv->nfp_fl_lock); + + return ret; } static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type, @@ -1713,6 +1722,7 @@ repr_priv = repr->app_priv; repr_priv->block_shared = f->block_shared; f->driver_block_list = &nfp_block_cb_list; + f->unlocked_driver_cb = true; switch (f->command) { case FLOW_BLOCK_BIND: @@ -1811,6 +1821,8 @@ nfp_flower_internal_port_can_offload(app, netdev))) return -EOPNOTSUPP; + f->unlocked_driver_cb = true; + switch (f->command) { case FLOW_BLOCK_BIND: cb_priv = nfp_flower_indr_block_cb_priv_lookup(app, netdev); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c @@ -421,23 +421,29 @@ { struct netlink_ext_ack *extack = flow->common.extack; struct nfp_flower_priv *fl_priv = app->priv; + int ret; if (!(fl_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)) { NL_SET_ERR_MSG_MOD(extack, "unsupported offload: loaded firmware does not support qos rate limit offload"); return -EOPNOTSUPP; } + mutex_lock(&fl_priv->nfp_fl_lock); switch (flow->command) { case TC_CLSMATCHALL_REPLACE: - return nfp_flower_install_rate_limiter(app, netdev, flow, - extack); + ret = nfp_flower_install_rate_limiter(app, netdev, flow, extack); + break; case TC_CLSMATCHALL_DESTROY: - return nfp_flower_remove_rate_limiter(app, netdev, flow, - extack); + ret = nfp_flower_remove_rate_limiter(app, netdev, flow, extack); + break; case TC_CLSMATCHALL_STATS: - return nfp_flower_stats_rate_limiter(app, netdev, flow, - extack); + ret = nfp_flower_stats_rate_limiter(app, netdev, flow, extack); + break; default: - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + break; } + mutex_unlock(&fl_priv->nfp_fl_lock); + + return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/qlogic/qed/qed_ll2.c @@ -87,7 +87,10 @@ static int qed_ll2_alloc_buffer(struct qed_dev *cdev, u8 **data, dma_addr_t *phys_addr) { - *data = kmalloc(cdev->ll2->rx_size, GFP_ATOMIC); + size_t size = cdev->ll2->rx_size + NET_SKB_PAD + + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + + *data = kmalloc(size, GFP_ATOMIC); if (!(*data)) { DP_INFO(cdev, "Failed to allocate LL2 buffer data\n"); return -ENOMEM; @@ -2548,7 +2551,7 @@ INIT_LIST_HEAD(&cdev->ll2->list); spin_lock_init(&cdev->ll2->lock); - cdev->ll2->rx_size = NET_SKB_PAD + ETH_HLEN + + cdev->ll2->rx_size = PRM_DMA_PAD_BYTES_NUM + ETH_HLEN + L1_CACHE_BYTES + params->mtu; /* Allocate memory for LL2. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac5.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwmac5.h @@ -153,9 +153,11 @@ unsigned int ptp_rate); void dwmac5_est_irq_status(void __iomem *ioaddr, struct net_device *dev, struct stmmac_extra_stats *x, u32 txqcnt); -void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, +void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable); void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, + struct stmmac_fpe_cfg *cfg, enum stmmac_mpacket_type type); int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -222,7 +222,7 @@ ((val) << XGMAC_PPS_MINIDX(x)) #define XGMAC_PPSCMD_START 0x2 #define XGMAC_PPSCMD_STOP 0x5 -#define XGMAC_PPSEN0 BIT(4) +#define XGMAC_PPSENx(x) BIT(4 + (x) * 8) #define XGMAC_PPSx_TARGET_TIME_SEC(x) (0x00000d80 + (x) * 0x10) #define XGMAC_PPSx_TARGET_TIME_NSEC(x) (0x00000d84 + (x) * 0x10) #define XGMAC_TRGTBUSY0 BIT(31) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -1134,7 +1134,19 @@ val |= XGMAC_PPSCMDx(index, XGMAC_PPSCMD_START); val |= XGMAC_TRGTMODSELx(index, XGMAC_PPSCMD_START); - val |= XGMAC_PPSEN0; + + /* XGMAC Core has 4 PPS outputs at most. + * + * Prior XGMAC Core 3.20, Fixed mode or Flexible mode are selectable for + * PPS0 only via PPSEN0. PPS{1,2,3} are in Flexible mode by default, + * and can not be switched to Fixed mode, since PPSEN{1,2,3} are + * read-only reserved to 0. + * But we always set PPSEN{1,2,3} do not make things worse ;-) + * + * From XGMAC Core 3.20 and later, PPSEN{0,1,2,3} are writable and must + * be set, or the PPS outputs stay in Fixed PPS mode by default. + */ + val |= XGMAC_PPSENx(index); writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index)); @@ -1428,7 +1440,8 @@ return 0; } -static void dwxgmac3_fpe_configure(void __iomem *ioaddr, u32 num_txq, +static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable) { u32 value; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -395,9 +395,11 @@ unsigned int ptp_rate); void (*est_irq_status)(void __iomem *ioaddr, struct net_device *dev, struct stmmac_extra_stats *x, u32 txqcnt); - void (*fpe_configure)(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, + void (*fpe_configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable); void (*fpe_send_mpacket)(void __iomem *ioaddr, + struct stmmac_fpe_cfg *cfg, enum stmmac_mpacket_type type); int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev); }; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/stmicro/stmmac/mmc_core.c @@ -177,8 +177,10 @@ #define MMC_XGMAC_RX_DISCARD_OCT_GB 0x1b4 #define MMC_XGMAC_RX_ALIGN_ERR_PKT 0x1bc +#define MMC_XGMAC_TX_FPE_INTR_MASK 0x204 #define MMC_XGMAC_TX_FPE_FRAG 0x208 #define MMC_XGMAC_TX_HOLD_REQ 0x20c +#define MMC_XGMAC_RX_FPE_INTR_MASK 0x224 #define MMC_XGMAC_RX_PKT_ASSEMBLY_ERR 0x228 #define MMC_XGMAC_RX_PKT_SMD_ERR 0x22c #define MMC_XGMAC_RX_PKT_ASSEMBLY_OK 0x230 @@ -352,6 +354,8 @@ { writel(0x0, mmcaddr + MMC_RX_INTR_MASK); writel(0x0, mmcaddr + MMC_TX_INTR_MASK); + writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_TX_FPE_INTR_MASK); + writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_FPE_INTR_MASK); writel(MMC_DEFAULT_MASK, mmcaddr + MMC_XGMAC_RX_IPC_INTR_MASK); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c @@ -1217,7 +1217,7 @@ key_index = wl->current_key; if (!enc->length && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { - /* reques to change default key index */ + /* request to change default key index */ pr_debug("%s: request to change default key to %d\n", __func__, key_index); wl->current_key = key_index; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ethernet/toshiba/spider_net.c +++ linux-lowlatency-5.15.0/drivers/net/ethernet/toshiba/spider_net.c @@ -2332,7 +2332,7 @@ struct spider_net_card *card; netdev = alloc_etherdev(struct_size(card, darray, - tx_descriptors + rx_descriptors)); + size_add(tx_descriptors, rx_descriptors))); if (!netdev) return NULL; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/hyperv/Kconfig +++ linux-lowlatency-5.15.0/drivers/net/hyperv/Kconfig @@ -3,5 +3,6 @@ tristate "Microsoft Hyper-V virtual network driver" depends on HYPERV select UCS2_STRING + select NLS help Select this option to enable the Hyper-V virtual network driver. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/ppp/ppp_synctty.c +++ linux-lowlatency-5.15.0/drivers/net/ppp/ppp_synctty.c @@ -464,6 +464,10 @@ case PPPIOCSMRU: if (get_user(val, (int __user *) argp)) break; + if (val > U16_MAX) { + err = -EINVAL; + break; + } if (val < PPP_MRU) val = PPP_MRU; ap->mru = val; @@ -699,7 +703,7 @@ /* strip address/control field if present */ p = skb->data; - if (p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { + if (skb->len >= 2 && p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { /* chop off address/control */ if (skb->len < 3) goto err; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/ath/ath10k/debug.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath10k/debug.c @@ -1139,7 +1139,7 @@ u32 sset, u8 *data) { if (sset == ETH_SS_STATS) - memcpy(data, *ath10k_gstrings_stats, + memcpy(data, ath10k_gstrings_stats, sizeof(ath10k_gstrings_stats)); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/ath/ath9k/debug.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/ath/ath9k/debug.c @@ -1284,7 +1284,7 @@ u32 sset, u8 *data) { if (sset == ETH_SS_STATS) - memcpy(data, *ath9k_gstrings_stats, + memcpy(data, ath9k_gstrings_stats, sizeof(ath9k_gstrings_stats)); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/intel/iwlwifi/dvm/tx.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/dvm/tx.c @@ -3,6 +3,7 @@ * * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2023 Intel Corporation * * Contact Information: * Intel Linux Wireless @@ -1174,7 +1175,7 @@ iwlagn_check_ratid_empty(priv, sta_id, tid); } - iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); + iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs, false); freed = 0; @@ -1320,7 +1321,7 @@ * block-ack window (we assume that they've been successfully * transmitted ... if not, it's too late anyway). */ iwl_trans_reclaim(priv->trans, scd_flow, ba_resp_scd_ssn, - &reclaimed_skbs); + &reclaimed_skbs, false); IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " "sta_id = %d\n", only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ linux-lowlatency-5.15.0/drivers/net/wireless/intel/iwlwifi/iwl-trans.h @@ -539,7 +539,7 @@ int (*tx)(struct iwl_trans *trans, struct sk_buff *skb, struct iwl_device_tx_cmd *dev_cmd, int queue); void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, - struct sk_buff_head *skbs); + struct sk_buff_head *skbs, bool is_flush); void (*set_q_ptrs)(struct iwl_trans *trans, int queue, int ptr); @@ -1122,14 +1122,15 @@ } static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, - int ssn, struct sk_buff_head *skbs) + int ssn, struct sk_buff_head *skbs, + bool is_flush) { if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) { IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state); return; } - trans->ops->reclaim(trans, queue, ssn, skbs); + trans->ops->reclaim(trans, queue, ssn, skbs, is_flush); } static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c @@ -10,12 +10,31 @@ }; static void +mt7603_mac_stuck_beacon_recovery(struct mt7603_dev *dev) +{ + if (dev->beacon_check % 5 != 4) + return; + + mt76_clear(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_EN); + mt76_set(dev, MT_SCH_4, MT_SCH_4_RESET); + mt76_clear(dev, MT_SCH_4, MT_SCH_4_RESET); + mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_EN); + + mt76_set(dev, MT_WF_CFG_OFF_WOCCR, MT_WF_CFG_OFF_WOCCR_TMAC_GC_DIS); + mt76_set(dev, MT_ARB_SCR, MT_ARB_SCR_TX_DISABLE); + mt76_clear(dev, MT_ARB_SCR, MT_ARB_SCR_TX_DISABLE); + mt76_clear(dev, MT_WF_CFG_OFF_WOCCR, MT_WF_CFG_OFF_WOCCR_TMAC_GC_DIS); +} + +static void mt7603_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) { struct mt7603_dev *dev = (struct mt7603_dev *)priv; struct mt76_dev *mdev = &dev->mt76; struct mt7603_vif *mvif = (struct mt7603_vif *)vif->drv_priv; struct sk_buff *skb = NULL; + u32 om_idx = mvif->idx; + u32 val; if (!(mdev->beacon_mask & BIT(mvif->idx))) return; @@ -24,20 +43,33 @@ if (!skb) return; - mt76_tx_queue_skb(dev, dev->mphy.q_tx[MT_TXQ_BEACON], skb, - &mvif->sta.wcid, NULL); + if (om_idx) + om_idx |= 0x10; + val = MT_DMA_FQCR0_BUSY | MT_DMA_FQCR0_MODE | + FIELD_PREP(MT_DMA_FQCR0_TARGET_BSS, om_idx) | + FIELD_PREP(MT_DMA_FQCR0_DEST_PORT_ID, 3) | + FIELD_PREP(MT_DMA_FQCR0_DEST_QUEUE_ID, 8); spin_lock_bh(&dev->ps_lock); - mt76_wr(dev, MT_DMA_FQCR0, MT_DMA_FQCR0_BUSY | - FIELD_PREP(MT_DMA_FQCR0_TARGET_WCID, mvif->sta.wcid.idx) | - FIELD_PREP(MT_DMA_FQCR0_TARGET_QID, - dev->mphy.q_tx[MT_TXQ_CAB]->hw_idx) | - FIELD_PREP(MT_DMA_FQCR0_DEST_PORT_ID, 3) | - FIELD_PREP(MT_DMA_FQCR0_DEST_QUEUE_ID, 8)); - if (!mt76_poll(dev, MT_DMA_FQCR0, MT_DMA_FQCR0_BUSY, 0, 5000)) + mt76_wr(dev, MT_DMA_FQCR0, val | + FIELD_PREP(MT_DMA_FQCR0_TARGET_QID, MT_TX_HW_QUEUE_BCN)); + if (!mt76_poll(dev, MT_DMA_FQCR0, MT_DMA_FQCR0_BUSY, 0, 5000)) { + dev->beacon_check = MT7603_WATCHDOG_TIMEOUT; + goto out; + } + + mt76_wr(dev, MT_DMA_FQCR0, val | + FIELD_PREP(MT_DMA_FQCR0_TARGET_QID, MT_TX_HW_QUEUE_BMC)); + if (!mt76_poll(dev, MT_DMA_FQCR0, MT_DMA_FQCR0_BUSY, 0, 5000)) { dev->beacon_check = MT7603_WATCHDOG_TIMEOUT; + goto out; + } + mt76_tx_queue_skb(dev, dev->mphy.q_tx[MT_TXQ_BEACON], + MT_TXQ_BEACON, skb, &mvif->sta.wcid, NULL); + +out: spin_unlock_bh(&dev->ps_lock); } @@ -81,6 +113,18 @@ data.dev = dev; __skb_queue_head_init(&data.q); + /* Flush all previous CAB queue packets and beacons */ + mt76_wr(dev, MT_WF_ARB_CAB_FLUSH, GENMASK(30, 16) | BIT(0)); + + mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_CAB], false); + mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_BEACON], false); + + if (dev->mphy.q_tx[MT_TXQ_BEACON]->queued > 0) + dev->beacon_check++; + else + dev->beacon_check = 0; + mt7603_mac_stuck_beacon_recovery(dev); + q = dev->mphy.q_tx[MT_TXQ_BEACON]; spin_lock_bh(&q->lock); ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), @@ -89,14 +133,9 @@ mt76_queue_kick(dev, q); spin_unlock_bh(&q->lock); - /* Flush all previous CAB queue packets */ - mt76_wr(dev, MT_WF_ARB_CAB_FLUSH, GENMASK(30, 16) | BIT(0)); - - mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_CAB], false); - mt76_csa_check(mdev); if (mdev->csa_complete) - goto out; + return; q = dev->mphy.q_tx[MT_TXQ_CAB]; do { @@ -108,7 +147,7 @@ skb_queue_len(&data.q) < 8); if (skb_queue_empty(&data.q)) - goto out; + return; for (i = 0; i < ARRAY_SIZE(data.tail); i++) { if (!data.tail[i]) @@ -123,7 +162,7 @@ struct ieee80211_vif *vif = info->control.vif; struct mt7603_vif *mvif = (struct mt7603_vif *)vif->drv_priv; - mt76_tx_queue_skb(dev, q, skb, &mvif->sta.wcid, NULL); + mt76_tx_queue_skb(dev, q, MT_TXQ_CAB, skb, &mvif->sta.wcid, NULL); } mt76_queue_kick(dev, q); spin_unlock_bh(&q->lock); @@ -136,11 +175,6 @@ MT_WF_ARB_CAB_START_BSSn(0) | (MT_WF_ARB_CAB_START_BSS0n(1) * ((1 << (MT7603_MAX_INTERFACES - 1)) - 1))); - -out: - mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_BEACON], false); - if (dev->mphy.q_tx[MT_TXQ_BEACON]->queued > hweight8(mdev->beacon_mask)) - dev->beacon_check++; } void mt7603_beacon_set_timer(struct mt7603_dev *dev, int idx, int intval) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/mediatek/mt76/mt7603/core.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/core.c @@ -42,11 +42,13 @@ } if (intr & MT_INT_RX_DONE(0)) { + dev->rx_pse_check = 0; mt7603_irq_disable(dev, MT_INT_RX_DONE(0)); napi_schedule(&dev->mt76.napi[0]); } if (intr & MT_INT_RX_DONE(1)) { + dev->rx_pse_check = 0; mt7603_irq_disable(dev, MT_INT_RX_DONE(1)); napi_schedule(&dev->mt76.napi[1]); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/mediatek/mt76/mt7603/regs.h +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt7603/regs.h @@ -462,6 +462,11 @@ #define MT_WF_SEC_BASE 0x21a00 #define MT_WF_SEC(ofs) (MT_WF_SEC_BASE + (ofs)) +#define MT_WF_CFG_OFF_BASE 0x21e00 +#define MT_WF_CFG_OFF(ofs) (MT_WF_CFG_OFF_BASE + (ofs)) +#define MT_WF_CFG_OFF_WOCCR MT_WF_CFG_OFF(0x004) +#define MT_WF_CFG_OFF_WOCCR_TMAC_GC_DIS BIT(4) + #define MT_SEC_SCR MT_WF_SEC(0x004) #define MT_SEC_SCR_MASK_ORDER GENMASK(1, 0) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c @@ -59,7 +59,8 @@ struct ieee80211_vif *vif = info->control.vif; struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; - mt76_tx_queue_skb(dev, q, skb, &mvif->group_wcid, NULL); + mt76_tx_queue_skb(dev, q, MT_TXQ_PSD, skb, &mvif->group_wcid, + NULL); } spin_unlock_bh(&q->lock); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c @@ -799,7 +799,7 @@ } if (rtlpriv->btcoexist.bt_edca_dl != 0) { - edca_be_ul = rtlpriv->btcoexist.bt_edca_dl; + edca_be_dl = rtlpriv->btcoexist.bt_edca_dl; bt_change_edca = true; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c @@ -640,7 +640,7 @@ } if (rtlpriv->btcoexist.bt_edca_dl != 0) { - edca_be_ul = rtlpriv->btcoexist.bt_edca_dl; + edca_be_dl = rtlpriv->btcoexist.bt_edca_dl; bt_change_edca = true; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c @@ -466,7 +466,7 @@ } if (rtlpriv->btcoexist.bt_edca_dl != 0) { - edca_be_ul = rtlpriv->btcoexist.bt_edca_dl; + edca_be_dl = rtlpriv->btcoexist.bt_edca_dl; bt_change_edca = true; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/net/wireless/realtek/rtw88/debug.c +++ linux-lowlatency-5.15.0/drivers/net/wireless/realtek/rtw88/debug.c @@ -1061,9 +1061,9 @@ #define rtw_debugfs_add_core(name, mode, fopname, parent) \ do { \ rtw_debug_priv_ ##name.rtwdev = rtwdev; \ - if (!debugfs_create_file(#name, mode, \ + if (IS_ERR(debugfs_create_file(#name, mode, \ parent, &rtw_debug_priv_ ##name,\ - &file_ops_ ##fopname)) \ + &file_ops_ ##fopname))) \ pr_debug("Unable to initialize debugfs:%s\n", \ #name); \ } while (0) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/nvdimm/of_pmem.c +++ linux-lowlatency-5.15.0/drivers/nvdimm/of_pmem.c @@ -30,7 +30,13 @@ if (!priv) return -ENOMEM; - priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL); + priv->bus_desc.provider_name = devm_kstrdup(&pdev->dev, pdev->name, + GFP_KERNEL); + if (!priv->bus_desc.provider_name) { + kfree(priv); + return -ENOMEM; + } + priv->bus_desc.module = THIS_MODULE; priv->bus_desc.of_node = np; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/nvme/target/fabrics-cmd.c +++ linux-lowlatency-5.15.0/drivers/nvme/target/fabrics-cmd.c @@ -206,6 +206,8 @@ goto out; } + d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0'; + d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0'; status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req, le32_to_cpu(c->kato), &ctrl); if (status) @@ -263,6 +265,8 @@ goto out; } + d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0'; + d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0'; ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn, le16_to_cpu(d->cntlid), req); if (!ctrl) { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/nvmem/imx-ocotp.c +++ linux-lowlatency-5.15.0/drivers/nvmem/imx-ocotp.c @@ -485,7 +485,7 @@ }; static const struct ocotp_params imx6sll_params = { - .nregs = 128, + .nregs = 80, .bank_address_words = 0, .set_timing = imx_ocotp_set_imx6_timing, .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, @@ -499,14 +499,14 @@ }; static const struct ocotp_params imx6ul_params = { - .nregs = 128, + .nregs = 144, .bank_address_words = 0, .set_timing = imx_ocotp_set_imx6_timing, .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, }; static const struct ocotp_params imx6ull_params = { - .nregs = 64, + .nregs = 80, .bank_address_words = 0, .set_timing = imx_ocotp_set_imx6_timing, .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/pci/controller/dwc/pci-exynos.c +++ linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pci-exynos.c @@ -377,7 +377,7 @@ return ret; } -static int __exit exynos_pcie_remove(struct platform_device *pdev) +static int exynos_pcie_remove(struct platform_device *pdev) { struct exynos_pcie *ep = platform_get_drvdata(pdev); @@ -433,7 +433,7 @@ static struct platform_driver exynos_pcie_driver = { .probe = exynos_pcie_probe, - .remove = __exit_p(exynos_pcie_remove), + .remove = exynos_pcie_remove, .driver = { .name = "exynos-pcie", .of_match_table = exynos_pcie_of_match, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/pci/controller/dwc/pci-keystone.c +++ linux-lowlatency-5.15.0/drivers/pci/controller/dwc/pci-keystone.c @@ -1080,7 +1080,7 @@ { }, }; -static int __init ks_pcie_probe(struct platform_device *pdev) +static int ks_pcie_probe(struct platform_device *pdev) { const struct dw_pcie_host_ops *host_ops; const struct dw_pcie_ep_ops *ep_ops; @@ -1284,7 +1284,7 @@ return ret; } -static int __exit ks_pcie_remove(struct platform_device *pdev) +static int ks_pcie_remove(struct platform_device *pdev) { struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); struct device_link **link = ks_pcie->link; @@ -1300,9 +1300,9 @@ return 0; } -static struct platform_driver ks_pcie_driver __refdata = { +static struct platform_driver ks_pcie_driver = { .probe = ks_pcie_probe, - .remove = __exit_p(ks_pcie_remove), + .remove = ks_pcie_remove, .driver = { .name = "keystone-pcie", .of_match_table = of_match_ptr(ks_pcie_of_match), only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/pcmcia/ds.c +++ linux-lowlatency-5.15.0/drivers/pcmcia/ds.c @@ -513,9 +513,6 @@ /* by default don't allow DMA */ p_dev->dma_mask = 0; p_dev->dev.dma_mask = &p_dev->dma_mask; - dev_set_name(&p_dev->dev, "%d.%d", p_dev->socket->sock, p_dev->device_no); - if (!dev_name(&p_dev->dev)) - goto err_free; p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); if (!p_dev->devname) goto err_free; @@ -573,8 +570,15 @@ pcmcia_device_query(p_dev); - if (device_register(&p_dev->dev)) - goto err_unreg; + dev_set_name(&p_dev->dev, "%d.%d", p_dev->socket->sock, p_dev->device_no); + if (device_register(&p_dev->dev)) { + mutex_lock(&s->ops_mutex); + list_del(&p_dev->socket_device_list); + s->device_count--; + mutex_unlock(&s->ops_mutex); + put_device(&p_dev->dev); + return NULL; + } return p_dev; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +++ linux-lowlatency-5.15.0/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c @@ -434,8 +434,8 @@ ret = perf_pmu_register(&pa_pmu->pmu, name, -1); if (ret) { dev_err(pa_pmu->dev, "PMU register failed, ret = %d\n", ret); - cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE, - &pa_pmu->node); + cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE, + &pa_pmu->node); return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +++ linux-lowlatency-5.15.0/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c @@ -463,8 +463,8 @@ ret = perf_pmu_register(&sllc_pmu->pmu, name, -1); if (ret) { dev_err(sllc_pmu->dev, "PMU register failed, ret = %d\n", ret); - cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE, - &sllc_pmu->node); + cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE, + &sllc_pmu->node); return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/platform/mellanox/mlxbf-bootctl.c +++ linux-lowlatency-5.15.0/drivers/platform/mellanox/mlxbf-bootctl.c @@ -17,6 +17,7 @@ #define MLXBF_BOOTCTL_SB_SECURE_MASK 0x03 #define MLXBF_BOOTCTL_SB_TEST_MASK 0x0c +#define MLXBF_BOOTCTL_SB_DEV_MASK BIT(4) #define MLXBF_SB_KEY_NUM 4 @@ -37,11 +38,18 @@ { MLXBF_BOOTCTL_NONE, "none" }, }; +enum { + MLXBF_BOOTCTL_SB_LIFECYCLE_PRODUCTION = 0, + MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE = 1, + MLXBF_BOOTCTL_SB_LIFECYCLE_GA_NON_SECURE = 2, + MLXBF_BOOTCTL_SB_LIFECYCLE_RMA = 3 +}; + static const char * const mlxbf_bootctl_lifecycle_states[] = { - [0] = "Production", - [1] = "GA Secured", - [2] = "GA Non-Secured", - [3] = "RMA", + [MLXBF_BOOTCTL_SB_LIFECYCLE_PRODUCTION] = "Production", + [MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE] = "GA Secured", + [MLXBF_BOOTCTL_SB_LIFECYCLE_GA_NON_SECURE] = "GA Non-Secured", + [MLXBF_BOOTCTL_SB_LIFECYCLE_RMA] = "RMA", }; /* ARM SMC call which is atomic and no need for lock. */ @@ -165,25 +173,30 @@ static ssize_t lifecycle_state_show(struct device *dev, struct device_attribute *attr, char *buf) { + int status_bits; + int use_dev_key; + int test_state; int lc_state; - lc_state = mlxbf_bootctl_smc(MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS, - MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE); - if (lc_state < 0) - return lc_state; - - lc_state &= - MLXBF_BOOTCTL_SB_TEST_MASK | MLXBF_BOOTCTL_SB_SECURE_MASK; + status_bits = mlxbf_bootctl_smc(MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS, + MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE); + if (status_bits < 0) + return status_bits; + + use_dev_key = status_bits & MLXBF_BOOTCTL_SB_DEV_MASK; + test_state = status_bits & MLXBF_BOOTCTL_SB_TEST_MASK; + lc_state = status_bits & MLXBF_BOOTCTL_SB_SECURE_MASK; /* * If the test bits are set, we specify that the current state may be * due to using the test bits. */ - if (lc_state & MLXBF_BOOTCTL_SB_TEST_MASK) { - lc_state &= MLXBF_BOOTCTL_SB_SECURE_MASK; - + if (test_state) { return sprintf(buf, "%s(test)\n", mlxbf_bootctl_lifecycle_states[lc_state]); + } else if (use_dev_key && + (lc_state == MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE)) { + return sprintf(buf, "Secured (development)\n"); } return sprintf(buf, "%s\n", mlxbf_bootctl_lifecycle_states[lc_state]); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/platform/surface/surface_platform_profile.c +++ linux-lowlatency-5.15.0/drivers/platform/surface/surface_platform_profile.c @@ -159,8 +159,7 @@ set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices); - platform_profile_register(&tpd->handler); - return 0; + return platform_profile_register(&tpd->handler); } static void surface_platform_profile_remove(struct ssam_device *sdev) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/platform/x86/asus-wmi.h +++ linux-lowlatency-5.15.0/drivers/platform/x86/asus-wmi.h @@ -18,13 +18,20 @@ #include #define ASUS_WMI_KEY_IGNORE (-1) -#define ASUS_WMI_BRN_DOWN 0x20 +#define ASUS_WMI_BRN_DOWN 0x2e #define ASUS_WMI_BRN_UP 0x2f struct module; struct key_entry; struct asus_wmi; +enum asus_wmi_tablet_switch_mode { + asus_wmi_no_tablet_switch, + asus_wmi_kbd_dock_devid, + asus_wmi_lid_flip_devid, + asus_wmi_lid_flip_rog_devid, +}; + struct quirk_entry { bool hotplug_wireless; bool scalar_panel_brightness; @@ -33,8 +40,7 @@ bool wmi_backlight_native; bool wmi_backlight_set_devstate; bool wmi_force_als_set; - bool use_kbd_dock_devid; - bool use_lid_flip_devid; + enum asus_wmi_tablet_switch_mode tablet_switch_mode; int wapf; /* * For machines with AMD graphic chips, it will send out WMI event only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/ptp/ptp_chardev.c +++ linux-lowlatency-5.15.0/drivers/ptp/ptp_chardev.c @@ -487,7 +487,8 @@ for (i = 0; i < cnt; i++) { event[i] = queue->buf[queue->head]; - queue->head = (queue->head + 1) % PTP_MAX_TIMESTAMPS; + /* Paired with READ_ONCE() in queue_cnt() */ + WRITE_ONCE(queue->head, (queue->head + 1) % PTP_MAX_TIMESTAMPS); } spin_unlock_irqrestore(&queue->lock, flags); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/ptp/ptp_private.h +++ linux-lowlatency-5.15.0/drivers/ptp/ptp_private.h @@ -74,9 +74,13 @@ * that a writer might concurrently increment the tail does not * matter, since the queue remains nonempty nonetheless. */ -static inline int queue_cnt(struct timestamp_event_queue *q) +static inline int queue_cnt(const struct timestamp_event_queue *q) { - int cnt = q->tail - q->head; + /* + * Paired with WRITE_ONCE() in enqueue_external_timestamp(), + * ptp_read(), extts_fifo_show(). + */ + int cnt = READ_ONCE(q->tail) - READ_ONCE(q->head); return cnt < 0 ? PTP_MAX_TIMESTAMPS + cnt : cnt; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/pwm/pwm-brcmstb.c +++ linux-lowlatency-5.15.0/drivers/pwm/pwm-brcmstb.c @@ -294,7 +294,7 @@ { struct brcmstb_pwm *p = dev_get_drvdata(dev); - clk_disable(p->clk); + clk_disable_unprepare(p->clk); return 0; } @@ -303,7 +303,7 @@ { struct brcmstb_pwm *p = dev_get_drvdata(dev); - clk_enable(p->clk); + clk_prepare_enable(p->clk); return 0; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/pwm/pwm-sti.c +++ linux-lowlatency-5.15.0/drivers/pwm/pwm-sti.c @@ -79,6 +79,7 @@ unsigned int cpt_num_devs; unsigned int max_pwm_cnt; unsigned int max_prescale; + struct sti_cpt_ddata *ddata; }; struct sti_pwm_chip { @@ -314,7 +315,7 @@ { struct sti_pwm_chip *pc = to_sti_pwmchip(chip); struct sti_pwm_compat_data *cdata = pc->cdata; - struct sti_cpt_ddata *ddata = pwm_get_chip_data(pwm); + struct sti_cpt_ddata *ddata = &cdata->ddata[pwm->hwpwm]; struct device *dev = pc->dev; unsigned int effective_ticks; unsigned long long high, low; @@ -417,7 +418,7 @@ while (cpt_int_stat) { devicenum = ffs(cpt_int_stat) - 1; - ddata = pwm_get_chip_data(&pc->chip.pwms[devicenum]); + ddata = &pc->cdata->ddata[devicenum]; /* * Capture input: @@ -615,30 +616,28 @@ dev_err(dev, "failed to prepare clock\n"); return ret; } + + cdata->ddata = devm_kzalloc(dev, cdata->cpt_num_devs * sizeof(*cdata->ddata), GFP_KERNEL); + if (!cdata->ddata) + return -ENOMEM; } pc->chip.dev = dev; pc->chip.ops = &sti_pwm_ops; pc->chip.npwm = pc->cdata->pwm_num_devs; - ret = pwmchip_add(&pc->chip); - if (ret < 0) { - clk_unprepare(pc->pwm_clk); - clk_unprepare(pc->cpt_clk); - return ret; - } - for (i = 0; i < cdata->cpt_num_devs; i++) { - struct sti_cpt_ddata *ddata; - - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); - if (!ddata) - return -ENOMEM; + struct sti_cpt_ddata *ddata = &cdata->ddata[i]; init_waitqueue_head(&ddata->wait); mutex_init(&ddata->lock); + } - pwm_set_chip_data(&pc->chip.pwms[i], ddata); + ret = pwmchip_add(&pc->chip); + if (ret < 0) { + clk_unprepare(pc->pwm_clk); + clk_unprepare(pc->cpt_clk); + return ret; } platform_set_drvdata(pdev, pc); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/rpmsg/rpmsg_internal.h +++ linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_internal.h @@ -90,10 +90,7 @@ */ static inline int rpmsg_chrdev_register_device(struct rpmsg_device *rpdev) { - strcpy(rpdev->id.name, "rpmsg_chrdev"); - rpdev->driver_override = "rpmsg_chrdev"; - - return rpmsg_register_device(rpdev); + return rpmsg_register_device_override(rpdev, "rpmsg_ctrl"); } #endif only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/rpmsg/rpmsg_ns.c +++ linux-lowlatency-5.15.0/drivers/rpmsg/rpmsg_ns.c @@ -20,12 +20,10 @@ */ int rpmsg_ns_register_device(struct rpmsg_device *rpdev) { - strcpy(rpdev->id.name, "rpmsg_ns"); - rpdev->driver_override = "rpmsg_ns"; rpdev->src = RPMSG_NS_ADDR; rpdev->dst = RPMSG_NS_ADDR; - return rpmsg_register_device(rpdev); + return rpmsg_register_device_override(rpdev, "rpmsg_ns"); } EXPORT_SYMBOL(rpmsg_ns_register_device); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/rtc/rtc-pcf85363.c +++ linux-lowlatency-5.15.0/drivers/rtc/rtc-pcf85363.c @@ -403,7 +403,7 @@ if (client->irq > 0) { regmap_write(pcf85363->regmap, CTRL_FLAGS, 0); regmap_update_bits(pcf85363->regmap, CTRL_PIN_IO, - PIN_IO_INTA_OUT, PIN_IO_INTAPM); + PIN_IO_INTAPM, PIN_IO_INTA_OUT); ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, pcf85363_rtc_handle_irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/scsi/libfc/fc_lport.c +++ linux-lowlatency-5.15.0/drivers/scsi/libfc/fc_lport.c @@ -241,6 +241,12 @@ } mutex_lock(&lport->disc.disc_mutex); lport->ptp_rdata = fc_rport_create(lport, remote_fid); + if (!lport->ptp_rdata) { + printk(KERN_WARNING "libfc: Failed to setup lport 0x%x\n", + lport->port_id); + mutex_unlock(&lport->disc.disc_mutex); + return; + } kref_get(&lport->ptp_rdata->kref); lport->ptp_rdata->ids.port_name = remote_wwpn; lport->ptp_rdata->ids.node_name = remote_wwnn; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/spi/spi-npcm-fiu.c +++ linux-lowlatency-5.15.0/drivers/spi/spi-npcm-fiu.c @@ -334,8 +334,9 @@ uma_cfg |= ilog2(op->cmd.buswidth); uma_cfg |= ilog2(op->addr.buswidth) << NPCM_FIU_UMA_CFG_ADBPCK_SHIFT; - uma_cfg |= ilog2(op->dummy.buswidth) - << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; + if (op->dummy.nbytes) + uma_cfg |= ilog2(op->dummy.buswidth) + << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; uma_cfg |= ilog2(op->data.buswidth) << NPCM_FIU_UMA_CFG_RDBPCK_SHIFT; uma_cfg |= op->dummy.nbytes << NPCM_FIU_UMA_CFG_DBSIZ_SHIFT; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/staging/media/sunxi/cedrus/cedrus_hw.c +++ linux-lowlatency-5.15.0/drivers/staging/media/sunxi/cedrus/cedrus_hw.c @@ -147,12 +147,12 @@ { struct cedrus_dev *dev = dev_get_drvdata(device); - reset_control_assert(dev->rstc); - clk_disable_unprepare(dev->ram_clk); clk_disable_unprepare(dev->mod_clk); clk_disable_unprepare(dev->ahb_clk); + reset_control_assert(dev->rstc); + return 0; } @@ -161,11 +161,18 @@ struct cedrus_dev *dev = dev_get_drvdata(device); int ret; + ret = reset_control_reset(dev->rstc); + if (ret) { + dev_err(dev->dev, "Failed to apply reset\n"); + + return ret; + } + ret = clk_prepare_enable(dev->ahb_clk); if (ret) { dev_err(dev->dev, "Failed to enable AHB clock\n"); - return ret; + goto err_rst; } ret = clk_prepare_enable(dev->mod_clk); @@ -182,21 +189,14 @@ goto err_mod_clk; } - ret = reset_control_reset(dev->rstc); - if (ret) { - dev_err(dev->dev, "Failed to apply reset\n"); - - goto err_ram_clk; - } - return 0; -err_ram_clk: - clk_disable_unprepare(dev->ram_clk); err_mod_clk: clk_disable_unprepare(dev->mod_clk); err_ahb_clk: clk_disable_unprepare(dev->ahb_clk); +err_rst: + reset_control_assert(dev->rstc); return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/tty/serial/8250/8250_early.c +++ linux-lowlatency-5.15.0/drivers/tty/serial/8250/8250_early.c @@ -199,6 +199,7 @@ OF_EARLYCON_DECLARE(omap8250, "ti,omap2-uart", early_omap8250_setup); OF_EARLYCON_DECLARE(omap8250, "ti,omap3-uart", early_omap8250_setup); OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup); +OF_EARLYCON_DECLARE(omap8250, "ti,am654-uart", early_omap8250_setup); #endif only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/tty/tty_jobctrl.c +++ linux-lowlatency-5.15.0/drivers/tty/tty_jobctrl.c @@ -300,12 +300,7 @@ return; } - spin_lock_irq(¤t->sighand->siglock); - put_pid(current->signal->tty_old_pgrp); - current->signal->tty_old_pgrp = NULL; - tty = tty_kref_get(current->signal->tty); - spin_unlock_irq(¤t->sighand->siglock); - + tty = get_current_tty(); if (tty) { unsigned long flags; @@ -320,6 +315,16 @@ tty_kref_put(tty); } + /* If tty->ctrl.pgrp is not NULL, it may be assigned to + * current->signal->tty_old_pgrp in a race condition, and + * cause pid memleak. Release current->signal->tty_old_pgrp + * after tty->ctrl.pgrp set to NULL. + */ + spin_lock_irq(¤t->sighand->siglock); + put_pid(current->signal->tty_old_pgrp); + current->signal->tty_old_pgrp = NULL; + spin_unlock_irq(¤t->sighand->siglock); + /* Now clear signal->tty under the lock */ read_lock(&tasklist_lock); session_clear_tty(task_session(current)); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/tty/vcc.c +++ linux-lowlatency-5.15.0/drivers/tty/vcc.c @@ -578,18 +578,22 @@ return -ENOMEM; name = kstrdup(dev_name(&vdev->dev), GFP_KERNEL); + if (!name) { + rv = -ENOMEM; + goto free_port; + } rv = vio_driver_init(&port->vio, vdev, VDEV_CONSOLE_CON, vcc_versions, ARRAY_SIZE(vcc_versions), NULL, name); if (rv) - goto free_port; + goto free_name; port->vio.debug = vcc_dbg_vio; vcc_ldc_cfg.debug = vcc_dbg_ldc; rv = vio_ldc_alloc(&port->vio, &vcc_ldc_cfg, port); if (rv) - goto free_port; + goto free_name; spin_lock_init(&port->lock); @@ -623,6 +627,11 @@ goto unreg_tty; } port->domain = kstrdup(domain, GFP_KERNEL); + if (!port->domain) { + rv = -ENOMEM; + goto unreg_tty; + } + mdesc_release(hp); @@ -652,8 +661,9 @@ vcc_table_remove(port->index); free_ldc: vio_ldc_free(&port->vio); -free_port: +free_name: kfree(name); +free_port: kfree(port); return rv; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/usb/chipidea/host.c +++ linux-lowlatency-5.15.0/drivers/usb/chipidea/host.c @@ -30,8 +30,7 @@ }; struct ci_hdrc_dma_aligned_buffer { - void *kmalloc_ptr; - void *old_xfer_buffer; + void *original_buffer; u8 data[]; }; @@ -372,59 +371,52 @@ return 0; } -static void ci_hdrc_free_dma_aligned_buffer(struct urb *urb) +static void ci_hdrc_free_dma_aligned_buffer(struct urb *urb, bool copy_back) { struct ci_hdrc_dma_aligned_buffer *temp; - size_t length; if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER)) return; + urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER; temp = container_of(urb->transfer_buffer, struct ci_hdrc_dma_aligned_buffer, data); + urb->transfer_buffer = temp->original_buffer; + + if (copy_back && usb_urb_dir_in(urb)) { + size_t length; - if (usb_urb_dir_in(urb)) { if (usb_pipeisoc(urb->pipe)) length = urb->transfer_buffer_length; else length = urb->actual_length; - memcpy(temp->old_xfer_buffer, temp->data, length); + memcpy(temp->original_buffer, temp->data, length); } - urb->transfer_buffer = temp->old_xfer_buffer; - kfree(temp->kmalloc_ptr); - urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER; + kfree(temp); } static int ci_hdrc_alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags) { - struct ci_hdrc_dma_aligned_buffer *temp, *kmalloc_ptr; - const unsigned int ci_hdrc_usb_dma_align = 32; - size_t kmalloc_size; + struct ci_hdrc_dma_aligned_buffer *temp; - if (urb->num_sgs || urb->sg || urb->transfer_buffer_length == 0 || - !((uintptr_t)urb->transfer_buffer & (ci_hdrc_usb_dma_align - 1))) + if (urb->num_sgs || urb->sg || urb->transfer_buffer_length == 0) + return 0; + if (IS_ALIGNED((uintptr_t)urb->transfer_buffer, 4) + && IS_ALIGNED(urb->transfer_buffer_length, 4)) return 0; - /* Allocate a buffer with enough padding for alignment */ - kmalloc_size = urb->transfer_buffer_length + - sizeof(struct ci_hdrc_dma_aligned_buffer) + - ci_hdrc_usb_dma_align - 1; - - kmalloc_ptr = kmalloc(kmalloc_size, mem_flags); - if (!kmalloc_ptr) + temp = kmalloc(sizeof(*temp) + ALIGN(urb->transfer_buffer_length, 4), mem_flags); + if (!temp) return -ENOMEM; - /* Position our struct dma_aligned_buffer such that data is aligned */ - temp = PTR_ALIGN(kmalloc_ptr + 1, ci_hdrc_usb_dma_align) - 1; - temp->kmalloc_ptr = kmalloc_ptr; - temp->old_xfer_buffer = urb->transfer_buffer; if (usb_urb_dir_out(urb)) memcpy(temp->data, urb->transfer_buffer, urb->transfer_buffer_length); - urb->transfer_buffer = temp->data; + temp->original_buffer = urb->transfer_buffer; + urb->transfer_buffer = temp->data; urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER; return 0; @@ -441,7 +433,7 @@ ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); if (ret) - ci_hdrc_free_dma_aligned_buffer(urb); + ci_hdrc_free_dma_aligned_buffer(urb, false); return ret; } @@ -449,7 +441,7 @@ static void ci_hdrc_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) { usb_hcd_unmap_urb_for_dma(hcd, urb); - ci_hdrc_free_dma_aligned_buffer(urb); + ci_hdrc_free_dma_aligned_buffer(urb, true); } int ci_hdrc_host_init(struct ci_hdrc *ci) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/usb/dwc2/hcd_intr.c +++ linux-lowlatency-5.15.0/drivers/usb/dwc2/hcd_intr.c @@ -2045,15 +2045,17 @@ { struct dwc2_qtd *qtd; struct dwc2_host_chan *chan; - u32 hcint, hcintmsk; + u32 hcint, hcintraw, hcintmsk; chan = hsotg->hc_ptr_array[chnum]; - hcint = dwc2_readl(hsotg, HCINT(chnum)); + hcintraw = dwc2_readl(hsotg, HCINT(chnum)); hcintmsk = dwc2_readl(hsotg, HCINTMSK(chnum)); + hcint = hcintraw & hcintmsk; + dwc2_writel(hsotg, hcint, HCINT(chnum)); + if (!chan) { dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n"); - dwc2_writel(hsotg, hcint, HCINT(chnum)); return; } @@ -2062,11 +2064,9 @@ chnum); dev_vdbg(hsotg->dev, " hcint 0x%08x, hcintmsk 0x%08x, hcint&hcintmsk 0x%08x\n", - hcint, hcintmsk, hcint & hcintmsk); + hcintraw, hcintmsk, hcint); } - dwc2_writel(hsotg, hcint, HCINT(chnum)); - /* * If we got an interrupt after someone called * dwc2_hcd_endpoint_disable() we don't want to crash below @@ -2076,8 +2076,7 @@ return; } - chan->hcint = hcint; - hcint &= hcintmsk; + chan->hcint = hcintraw; /* * If the channel was halted due to a dequeue, the qtd list might only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/usb/storage/unusual_cypress.h +++ linux-lowlatency-5.15.0/drivers/usb/storage/unusual_cypress.h @@ -19,7 +19,7 @@ "Cypress ISD-300LP", USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), -UNUSUAL_DEV( 0x14cd, 0x6116, 0x0160, 0x0160, +UNUSUAL_DEV( 0x14cd, 0x6116, 0x0150, 0x0160, "Super Top", "USB 2.0 SATA BRIDGE", USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/video/fbdev/aty/atyfb_base.c +++ linux-lowlatency-5.15.0/drivers/video/fbdev/aty/atyfb_base.c @@ -3447,11 +3447,15 @@ } info->fix.mmio_start = raddr; +#if defined(__i386__) || defined(__ia64__) /* * By using strong UC we force the MTRR to never have an * effect on the MMIO region on both non-PAT and PAT systems. */ par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000); +#else + par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); +#endif if (par->ati_regbase == NULL) return -ENOMEM; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/video/fbdev/fsl-diu-fb.c +++ linux-lowlatency-5.15.0/drivers/video/fbdev/fsl-diu-fb.c @@ -490,7 +490,7 @@ * Workaround for failed writing desc register of planes. * Needed with MPC5121 DIU rev 2.0 silicon. */ -void wr_reg_wa(u32 *reg, u32 val) +static void wr_reg_wa(u32 *reg, u32 val) { do { out_be32(reg, val); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/virtio/virtio_balloon.c +++ linux-lowlatency-5.15.0/drivers/virtio/virtio_balloon.c @@ -402,7 +402,11 @@ virtio_cread_le(vb->vdev, struct virtio_balloon_config, num_pages, &num_pages); - target = num_pages; + /* + * Aligned up to guest page size to avoid inflating and deflating + * balloon endlessly. + */ + target = ALIGN(num_pages, VIRTIO_BALLOON_PAGES_PER_PAGE); return target - vb->num_pages; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/xen/xen-pciback/conf_space.c +++ linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space.c @@ -288,12 +288,6 @@ u16 val; int ret = 0; - err = pci_read_config_word(dev, PCI_COMMAND, &val); - if (err) - return err; - if (!(val & PCI_COMMAND_INTX_DISABLE)) - ret |= INTERRUPT_TYPE_INTX; - /* * Do not trust dev->msi(x)_enabled here, as enabling could be done * bypassing the pci_*msi* functions, by the qemu. @@ -316,6 +310,19 @@ if (val & PCI_MSIX_FLAGS_ENABLE) ret |= INTERRUPT_TYPE_MSIX; } + + /* + * PCIe spec says device cannot use INTx if MSI/MSI-X is enabled, + * so check for INTx only when both are disabled. + */ + if (!ret) { + err = pci_read_config_word(dev, PCI_COMMAND, &val); + if (err) + return err; + if (!(val & PCI_COMMAND_INTX_DISABLE)) + ret |= INTERRUPT_TYPE_INTX; + } + return ret ?: INTERRUPT_TYPE_NONE; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/drivers/xen/xen-pciback/conf_space_header.c +++ linux-lowlatency-5.15.0/drivers/xen/xen-pciback/conf_space_header.c @@ -104,24 +104,9 @@ pci_clear_mwi(dev); } - if (dev_data && dev_data->allow_interrupt_control) { - if ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE) { - if (value & PCI_COMMAND_INTX_DISABLE) { - pci_intx(dev, 0); - } else { - /* Do not allow enabling INTx together with MSI or MSI-X. */ - switch (xen_pcibk_get_interrupt_type(dev)) { - case INTERRUPT_TYPE_NONE: - pci_intx(dev, 1); - break; - case INTERRUPT_TYPE_INTX: - break; - default: - return PCIBIOS_SET_FAILED; - } - } - } - } + if (dev_data && dev_data->allow_interrupt_control && + ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE)) + pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE)); cmd->val = value; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/9p/xattr.c +++ linux-lowlatency-5.15.0/fs/9p/xattr.c @@ -73,7 +73,7 @@ struct p9_fid *fid; int ret; - p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu\n", + p9_debug(P9_DEBUG_VFS, "name = '%s' value_len = %zu\n", name, buffer_size); fid = v9fs_fid_lookup(dentry); if (IS_ERR(fid)) @@ -144,7 +144,8 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) { - return v9fs_xattr_get(dentry, NULL, buffer, buffer_size); + /* Txattrwalk with an empty string lists xattrs instead */ + return v9fs_xattr_get(dentry, "", buffer, buffer_size); } static int v9fs_xattr_handler_get(const struct xattr_handler *handler, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/afs/dynroot.c +++ linux-lowlatency-5.15.0/fs/afs/dynroot.c @@ -131,8 +131,8 @@ ret = dns_query(net->net, "afsdb", name, len, "srv=1", NULL, NULL, false); - if (ret == -ENODATA) - ret = -EDESTADDRREQ; + if (ret == -ENODATA || ret == -ENOKEY) + ret = -ENOENT; return ret; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/afs/server_list.c +++ linux-lowlatency-5.15.0/fs/afs/server_list.c @@ -17,7 +17,7 @@ for (i = 0; i < slist->nr_servers; i++) afs_unuse_server(net, slist->servers[i].server, afs_server_trace_put_slist); - kfree(slist); + kfree_rcu(slist, rcu); } } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/afs/vl_rotate.c +++ linux-lowlatency-5.15.0/fs/afs/vl_rotate.c @@ -58,6 +58,12 @@ } /* Status load is ordered after lookup counter load */ + if (cell->dns_status == DNS_LOOKUP_GOT_NOT_FOUND) { + pr_warn("No record of cell %s\n", cell->name); + vc->error = -ENOENT; + return false; + } + if (cell->dns_source == DNS_RECORD_UNAVAILABLE) { vc->error = -EDESTADDRREQ; return false; @@ -285,6 +291,7 @@ */ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc) { + struct afs_cell *cell = vc->cell; static int count; int i; @@ -294,6 +301,9 @@ rcu_read_lock(); pr_notice("EDESTADDR occurred\n"); + pr_notice("CELL: %s err=%d\n", cell->name, cell->error); + pr_notice("DNS: src=%u st=%u lc=%x\n", + cell->dns_source, cell->dns_status, cell->dns_lookup_count); pr_notice("VC: ut=%lx ix=%u ni=%hu fl=%hx err=%hd\n", vc->untried, vc->index, vc->nr_iterations, vc->flags, vc->error); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/btrfs/ref-verify.c +++ linux-lowlatency-5.15.0/fs/btrfs/ref-verify.c @@ -788,6 +788,7 @@ dump_ref_action(fs_info, ra); kfree(ref); kfree(ra); + kfree(re); goto out_unlock; } else if (be->num_refs == 0) { btrfs_err(fs_info, @@ -797,6 +798,7 @@ dump_ref_action(fs_info, ra); kfree(ref); kfree(ra); + kfree(re); goto out_unlock; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/cifs/cifs_spnego.c +++ linux-lowlatency-5.15.0/fs/cifs/cifs_spnego.c @@ -64,8 +64,8 @@ * strlen(";sec=ntlmsspi") */ #define MAX_MECH_STR_LEN 13 -/* strlen of "host=" */ -#define HOST_KEY_LEN 5 +/* strlen of ";host=" */ +#define HOST_KEY_LEN 6 /* strlen of ";ip4=" or ";ip6=" */ #define IP_KEY_LEN 5 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/ext4/acl.h +++ linux-lowlatency-5.15.0/fs/ext4/acl.h @@ -68,6 +68,11 @@ static inline int ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) { + /* usually, the umask is applied by posix_acl_create(), but if + ext4 ACL support is disabled at compile time, we need to do + it here, because posix_acl_create() will never be called */ + inode->i_mode &= ~current_umask(); + return 0; } #endif /* CONFIG_EXT4_FS_POSIX_ACL */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/ext4/mballoc.h +++ linux-lowlatency-5.15.0/fs/ext4/mballoc.h @@ -219,6 +219,20 @@ (fex->fe_start << EXT4_SB(sb)->s_cluster_bits); } +static inline loff_t extent_logical_end(struct ext4_sb_info *sbi, + struct ext4_free_extent *fex) +{ + /* Use loff_t to avoid end exceeding ext4_lblk_t max. */ + return (loff_t)fex->fe_logical + EXT4_C2B(sbi, fex->fe_len); +} + +static inline loff_t pa_logical_end(struct ext4_sb_info *sbi, + struct ext4_prealloc_space *pa) +{ + /* Use loff_t to avoid end exceeding ext4_lblk_t max. */ + return (loff_t)pa->pa_lstart + EXT4_C2B(sbi, pa->pa_len); +} + typedef int (*ext4_mballoc_query_range_fn)( struct super_block *sb, ext4_group_t agno, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/ntfs3/dir.c +++ linux-lowlatency-5.15.0/fs/ntfs3/dir.c @@ -309,7 +309,11 @@ return 0; } - dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG; + /* NTFS: symlinks are "dir + reparse" or "file + reparse" */ + if (fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) + dt_type = DT_LNK; + else + dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG; return !dir_emit(ctx, (s8 *)name, name_len, ino, dt_type); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/libxfs/xfs_dir2_leaf.c +++ linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_dir2_leaf.c @@ -146,6 +146,8 @@ xfs_dir2_leaf_tail_t *ltp; int stale; int i; + bool isleaf1 = (hdr->magic == XFS_DIR2_LEAF1_MAGIC || + hdr->magic == XFS_DIR3_LEAF1_MAGIC); ltp = xfs_dir2_leaf_tail_p(geo, leaf); @@ -158,8 +160,7 @@ return __this_address; /* Leaves and bests don't overlap in leaf format. */ - if ((hdr->magic == XFS_DIR2_LEAF1_MAGIC || - hdr->magic == XFS_DIR3_LEAF1_MAGIC) && + if (isleaf1 && (char *)&hdr->ents[hdr->count] > (char *)xfs_dir2_leaf_bests_p(ltp)) return __this_address; @@ -175,6 +176,10 @@ } if (hdr->ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) stale++; + if (isleaf1 && xfs_dir2_dataptr_to_db(geo, + be32_to_cpu(hdr->ents[i].address)) >= + be32_to_cpu(ltp->bestcount)) + return __this_address; } if (hdr->stale != stale) return __this_address; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/libxfs/xfs_log_recover.h +++ linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_log_recover.h @@ -108,12 +108,6 @@ #define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr) -/* - * This is the number of entries in the l_buf_cancel_table used during - * recovery. - */ -#define XLOG_BC_TABLE_SIZE 64 - #define XLOG_RECOVER_CRCPASS 0 #define XLOG_RECOVER_PASS1 1 #define XLOG_RECOVER_PASS2 2 @@ -126,5 +120,13 @@ struct xfs_inode **ipp); void xlog_recover_release_intent(struct xlog *log, unsigned short intent_type, uint64_t intent_id); +int xlog_alloc_buf_cancel_table(struct xlog *log); +void xlog_free_buf_cancel_table(struct xlog *log); + +#ifdef DEBUG +void xlog_check_buf_cancel_table(struct xlog *log); +#else +#define xlog_check_buf_cancel_table(log) do { } while (0) +#endif #endif /* __XFS_LOG_RECOVER_H__ */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/libxfs/xfs_trans_resv.c +++ linux-lowlatency-5.15.0/fs/xfs/libxfs/xfs_trans_resv.c @@ -423,7 +423,7 @@ { return XFS_DQUOT_LOGRES(mp) + xfs_calc_iunlink_add_reservation(mp) + - max((xfs_calc_inode_res(mp, 1) + + max((xfs_calc_inode_res(mp, 2) + xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) + only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/xfs_attr_inactive.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_attr_inactive.c @@ -158,6 +158,7 @@ } child_fsb = be32_to_cpu(ichdr.btree[0].before); xfs_trans_brelse(*trans, bp); /* no locks for later trans */ + bp = NULL; /* * If this is the node level just above the leaves, simply loop @@ -211,12 +212,8 @@ &child_bp); if (error) return error; - error = bp->b_error; - if (error) { - xfs_trans_brelse(*trans, child_bp); - return error; - } xfs_trans_binval(*trans, child_bp); + child_bp = NULL; /* * If we're not done, re-read the parent to get the next @@ -233,6 +230,7 @@ bp->b_addr); child_fsb = be32_to_cpu(phdr.btree[i + 1].before); xfs_trans_brelse(*trans, bp); + bp = NULL; } /* * Atomically commit the whole invalidate stuff. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/xfs_error.c +++ linux-lowlatency-5.15.0/fs/xfs/xfs_error.c @@ -224,13 +224,18 @@ xfs_errortag_init( struct xfs_mount *mp) { + int ret; + mp->m_errortag = kmem_zalloc(sizeof(unsigned int) * XFS_ERRTAG_MAX, KM_MAYFAIL); if (!mp->m_errortag) return -ENOMEM; - return xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype, - &mp->m_kobj, "errortag"); + ret = xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype, + &mp->m_kobj, "errortag"); + if (ret) + kmem_free(mp->m_errortag); + return ret; } void only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/fs/xfs/xfs_sysfs.h +++ linux-lowlatency-5.15.0/fs/xfs/xfs_sysfs.h @@ -33,10 +33,15 @@ const char *name) { struct kobject *parent; + int err; parent = parent_kobj ? &parent_kobj->kobject : NULL; init_completion(&kobj->complete); - return kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name); + err = kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name); + if (err) + kobject_put(&kobj->kobject); + + return err; } static inline void only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/device/driver.h +++ linux-lowlatency-5.15.0/include/linux/device/driver.h @@ -150,6 +150,8 @@ extern void driver_remove_file(struct device_driver *driver, const struct driver_attribute *attr); +int driver_set_override(struct device *dev, const char **override, + const char *s, size_t len); extern int __must_check driver_for_each_device(struct device_driver *drv, struct device *start, void *data, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/hrtimer.h +++ linux-lowlatency-5.15.0/include/linux/hrtimer.h @@ -531,9 +531,9 @@ int hrtimers_prepare_cpu(unsigned int cpu); #ifdef CONFIG_HOTPLUG_CPU -int hrtimers_dead_cpu(unsigned int cpu); +int hrtimers_cpu_dying(unsigned int cpu); #else -#define hrtimers_dead_cpu NULL +#define hrtimers_cpu_dying NULL #endif #endif only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/iio/afe/rescale.h +++ linux-lowlatency-5.15.0/include/linux/iio/afe/rescale.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2018 Axentia Technologies AB + */ + +#ifndef __IIO_RESCALE_H__ +#define __IIO_RESCALE_H__ + +#include +#include + +struct device; +struct rescale; + +struct rescale_cfg { + enum iio_chan_type type; + int (*props)(struct device *dev, struct rescale *rescale); +}; + +struct rescale { + const struct rescale_cfg *cfg; + struct iio_channel *source; + struct iio_chan_spec chan; + struct iio_chan_spec_ext_info *ext_info; + bool chan_processed; + s32 numerator; + s32 denominator; + s32 offset; +}; + +int rescale_process_scale(struct rescale *rescale, int scale_type, + int *val, int *val2); +int rescale_process_offset(struct rescale *rescale, int scale_type, + int scale, int scale2, int schan_off, + int *val, int *val2); +#endif /* __IIO_RESCALE_H__ */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/iio/iio.h +++ linux-lowlatency-5.15.0/include/linux/iio/iio.h @@ -542,6 +542,8 @@ }; int iio_device_id(struct iio_dev *indio_dev); +int iio_device_get_current_mode(struct iio_dev *indio_dev); +bool iio_buffer_enabled(struct iio_dev *indio_dev); const struct iio_chan_spec *iio_find_channel_from_si(struct iio_dev *indio_dev, int si); @@ -573,6 +575,8 @@ int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); int iio_device_claim_direct_mode(struct iio_dev *indio_dev); void iio_device_release_direct_mode(struct iio_dev *indio_dev); +int iio_device_claim_buffer_mode(struct iio_dev *indio_dev); +void iio_device_release_buffer_mode(struct iio_dev *indio_dev); extern struct bus_type iio_bus_type; @@ -671,16 +675,6 @@ __printf(2, 3) struct iio_trigger *devm_iio_trigger_alloc(struct device *parent, const char *fmt, ...); -/** - * iio_buffer_enabled() - helper function to test if the buffer is enabled - * @indio_dev: IIO device structure for device - **/ -static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) -{ - return indio_dev->currentmode - & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | - INDIO_BUFFER_SOFTWARE); -} /** * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/kallsyms.h +++ linux-lowlatency-5.15.0/include/linux/kallsyms.h @@ -74,11 +74,11 @@ return ptr; } +#ifdef CONFIG_KALLSYMS int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long), void *data); -#ifdef CONFIG_KALLSYMS /* Lookup the address for a symbol. Returns 0 if not found. */ unsigned long kallsyms_lookup_name(const char *name); @@ -172,6 +172,11 @@ return false; } +static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, + unsigned long), void *data) +{ + return -EOPNOTSUPP; +} #endif /*CONFIG_KALLSYMS*/ static inline void print_ip_sym(const char *loglvl, unsigned long ip) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/mfd/core.h +++ linux-lowlatency-5.15.0/include/linux/mfd/core.h @@ -92,7 +92,7 @@ * (above) when matching OF nodes with devices that have identical * compatible strings */ - const u64 of_reg; + u64 of_reg; /* Set to 'true' to use 'of_reg' (above) - allows for of_reg=0 */ bool use_of_reg; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/mmc/host.h +++ linux-lowlatency-5.15.0/include/linux/mmc/host.h @@ -428,6 +428,7 @@ unsigned int retune_paused:1; /* re-tuning is temporarily disabled */ unsigned int retune_crc_disable:1; /* don't trigger retune upon crc */ unsigned int can_dma_map_merge:1; /* merging can be used */ + unsigned int vqmmc_enabled:1; /* vqmmc regulator is enabled */ int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */ @@ -574,6 +575,8 @@ #endif int mmc_regulator_get_supply(struct mmc_host *mmc); +int mmc_regulator_enable_vqmmc(struct mmc_host *mmc); +void mmc_regulator_disable_vqmmc(struct mmc_host *mmc); static inline int mmc_card_is_removable(struct mmc_host *host) { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/platform_data/x86/asus-wmi.h +++ linux-lowlatency-5.15.0/include/linux/platform_data/x86/asus-wmi.h @@ -64,6 +64,7 @@ #define ASUS_WMI_DEVID_PANEL_OD 0x00050019 #define ASUS_WMI_DEVID_CAMERA 0x00060013 #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 +#define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077 /* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/platform_data/x86/soc.h +++ linux-lowlatency-5.15.0/include/linux/platform_data/x86/soc.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Helpers for Intel SoC model detection + * + * Copyright (c) 2019, Intel Corporation. + */ + +#ifndef __PLATFORM_DATA_X86_SOC_H +#define __PLATFORM_DATA_X86_SOC_H + +#if IS_ENABLED(CONFIG_X86) + +#include +#include + +#define SOC_INTEL_IS_CPU(soc, type) \ +static inline bool soc_intel_is_##soc(void) \ +{ \ + static const struct x86_cpu_id soc##_cpu_ids[] = { \ + X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ + {} \ + }; \ + const struct x86_cpu_id *id; \ + \ + id = x86_match_cpu(soc##_cpu_ids); \ + if (id) \ + return true; \ + return false; \ +} + +SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); +SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); +SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); +SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); +SOC_INTEL_IS_CPU(cml, KABYLAKE_L); + +#else /* IS_ENABLED(CONFIG_X86) */ + +static inline bool soc_intel_is_byt(void) +{ + return false; +} + +static inline bool soc_intel_is_cht(void) +{ + return false; +} + +static inline bool soc_intel_is_apl(void) +{ + return false; +} + +static inline bool soc_intel_is_glk(void) +{ + return false; +} + +static inline bool soc_intel_is_cml(void) +{ + return false; +} +#endif /* IS_ENABLED(CONFIG_X86) */ + +#endif /* __PLATFORM_DATA_X86_SOC_H */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/preempt.h +++ linux-lowlatency-5.15.0/include/linux/preempt.h @@ -77,14 +77,42 @@ /* preempt_count() and related functions, depends on PREEMPT_NEED_RESCHED */ #include +/** + * interrupt_context_level - return interrupt context level + * + * Returns the current interrupt context level. + * 0 - normal context + * 1 - softirq context + * 2 - hardirq context + * 3 - NMI context + */ +static __always_inline unsigned char interrupt_context_level(void) +{ + unsigned long pc = preempt_count(); + unsigned char level = 0; + + level += !!(pc & (NMI_MASK)); + level += !!(pc & (NMI_MASK | HARDIRQ_MASK)); + level += !!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)); + + return level; +} + +/* + * These macro definitions avoid redundant invocations of preempt_count() + * because such invocations would result in redundant loads given that + * preempt_count() is commonly implemented with READ_ONCE(). + */ + #define nmi_count() (preempt_count() & NMI_MASK) #define hardirq_count() (preempt_count() & HARDIRQ_MASK) #ifdef CONFIG_PREEMPT_RT # define softirq_count() (current->softirq_disable_cnt & SOFTIRQ_MASK) +# define irq_count() ((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | softirq_count()) #else # define softirq_count() (preempt_count() & SOFTIRQ_MASK) +# define irq_count() (preempt_count() & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_MASK)) #endif -#define irq_count() (nmi_count() | hardirq_count() | softirq_count()) /* * Macros to retrieve the current execution context: @@ -97,7 +125,11 @@ #define in_nmi() (nmi_count()) #define in_hardirq() (hardirq_count()) #define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET) -#define in_task() (!(in_nmi() | in_hardirq() | in_serving_softirq())) +#ifdef CONFIG_PREEMPT_RT +# define in_task() (!((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | in_serving_softirq())) +#else +# define in_task() (!(preempt_count() & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET))) +#endif /* * The following macros are deprecated and should not be used in new code: only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/linux/trace_recursion.h +++ linux-lowlatency-5.15.0/include/linux/trace_recursion.h @@ -116,13 +116,9 @@ static __always_inline int trace_get_context_bit(void) { - unsigned long pc = preempt_count(); + unsigned char bit = interrupt_context_level(); - if (!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET))) - return TRACE_CTX_NORMAL; - else - return pc & NMI_MASK ? TRACE_CTX_NMI : - pc & HARDIRQ_MASK ? TRACE_CTX_IRQ : TRACE_CTX_SOFTIRQ; + return TRACE_CTX_NORMAL - bit; } #ifdef CONFIG_FTRACE_RECORD_RECURSION only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/net/bluetooth/hci_mon.h +++ linux-lowlatency-5.15.0/include/net/bluetooth/hci_mon.h @@ -56,7 +56,7 @@ __u8 type; __u8 bus; bdaddr_t bdaddr; - char name[8]; + char name[8] __nonstring; } __packed; #define HCI_MON_NEW_INDEX_SIZE 16 only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/net/genetlink.h +++ linux-lowlatency-5.15.0/include/net/genetlink.h @@ -11,10 +11,13 @@ /** * struct genl_multicast_group - generic netlink multicast group * @name: name of the multicast group, names are per-family + * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM) + * @cap_sys_admin: whether %CAP_SYS_ADMIN is required for binding */ struct genl_multicast_group { char name[GENL_NAMSIZ]; u8 flags; + u8 cap_sys_admin:1; }; struct genl_ops; @@ -116,7 +119,7 @@ * struct genl_small_ops - generic netlink operations (small version) * @cmd: command identifier * @internal_flags: flags used by the family - * @flags: flags + * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM) * @validate: validation flags from enum genl_validate_flags * @doit: standard command callback * @dumpit: callback for dumpers @@ -137,7 +140,7 @@ * struct genl_ops - generic netlink operations * @cmd: command identifier * @internal_flags: flags used by the family - * @flags: flags + * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM) * @maxattr: maximum number of attributes supported * @policy: netlink policy (takes precedence over family policy) * @validate: validation flags from enum genl_validate_flags only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/net/netfilter/nf_nat_redirect.h +++ linux-lowlatency-5.15.0/include/net/netfilter/nf_nat_redirect.h @@ -6,8 +6,7 @@ #include unsigned int -nf_nat_redirect_ipv4(struct sk_buff *skb, - const struct nf_nat_ipv4_multi_range_compat *mr, +nf_nat_redirect_ipv4(struct sk_buff *skb, const struct nf_nat_range2 *range, unsigned int hooknum); unsigned int nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/sound/soc-card.h +++ linux-lowlatency-5.15.0/include/sound/soc-card.h @@ -40,6 +40,43 @@ void snd_soc_card_remove_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); +#ifdef CONFIG_PCI +static inline void snd_soc_card_set_pci_ssid(struct snd_soc_card *card, + unsigned short vendor, + unsigned short device) +{ + card->pci_subsystem_vendor = vendor; + card->pci_subsystem_device = device; + card->pci_subsystem_set = true; +} + +static inline int snd_soc_card_get_pci_ssid(struct snd_soc_card *card, + unsigned short *vendor, + unsigned short *device) +{ + if (!card->pci_subsystem_set) + return -ENOENT; + + *vendor = card->pci_subsystem_vendor; + *device = card->pci_subsystem_device; + + return 0; +} +#else /* !CONFIG_PCI */ +static inline void snd_soc_card_set_pci_ssid(struct snd_soc_card *card, + unsigned short vendor, + unsigned short device) +{ +} + +static inline int snd_soc_card_get_pci_ssid(struct snd_soc_card *card, + unsigned short *vendor, + unsigned short *device) +{ + return -ENOENT; +} +#endif /* CONFIG_PCI */ + /* device driver data */ static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, void *data) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/trace/events/neigh.h +++ linux-lowlatency-5.15.0/include/trace/events/neigh.h @@ -39,7 +39,6 @@ ), TP_fast_assign( - struct in6_addr *pin6; __be32 *p32; __entry->family = tbl->family; @@ -47,7 +46,6 @@ __entry->entries = atomic_read(&tbl->gc_entries); __entry->created = n != NULL; __entry->gc_exempt = exempt_from_gc; - pin6 = (struct in6_addr *)__entry->primary_key6; p32 = (__be32 *)__entry->primary_key4; if (tbl->family == AF_INET) @@ -57,6 +55,8 @@ #if IS_ENABLED(CONFIG_IPV6) if (tbl->family == AF_INET6) { + struct in6_addr *pin6; + pin6 = (struct in6_addr *)__entry->primary_key6; *pin6 = *(struct in6_addr *)pkey; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/include/uapi/linux/gtp.h +++ linux-lowlatency-5.15.0/include/uapi/linux/gtp.h @@ -32,6 +32,6 @@ GTPA_PAD, __GTPA_MAX, }; -#define GTPA_MAX (__GTPA_MAX + 1) +#define GTPA_MAX (__GTPA_MAX - 1) #endif /* _UAPI_LINUX_GTP_H_ */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/audit_watch.c +++ linux-lowlatency-5.15.0/kernel/audit_watch.c @@ -527,11 +527,18 @@ unsigned long ino; dev_t dev; - exe_file = get_task_exe_file(tsk); + /* only do exe filtering if we are recording @current events/records */ + if (tsk != current) + return 0; + + if (!current->mm) + return 0; + exe_file = get_mm_exe_file(current->mm); if (!exe_file) return 0; ino = file_inode(exe_file)->i_ino; dev = file_inode(exe_file)->i_sb->s_dev; fput(exe_file); + return audit_mark_compare(mark, ino, dev); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/irq/generic-chip.c +++ linux-lowlatency-5.15.0/kernel/irq/generic-chip.c @@ -541,21 +541,34 @@ void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, unsigned int clr, unsigned int set) { - unsigned int i = gc->irq_base; + unsigned int i, virq; raw_spin_lock(&gc_lock); list_del(&gc->list); raw_spin_unlock(&gc_lock); - for (; msk; msk >>= 1, i++) { + for (i = 0; msk; msk >>= 1, i++) { if (!(msk & 0x01)) continue; + /* + * Interrupt domain based chips store the base hardware + * interrupt number in gc::irq_base. Otherwise gc::irq_base + * contains the base Linux interrupt number. + */ + if (gc->domain) { + virq = irq_find_mapping(gc->domain, gc->irq_base + i); + if (!virq) + continue; + } else { + virq = gc->irq_base + i; + } + /* Remove handler first. That will mask the irq line */ - irq_set_handler(i, NULL); - irq_set_chip(i, &no_irq_chip); - irq_set_chip_data(i, NULL); - irq_modify_status(i, clr, set); + irq_set_handler(virq, NULL); + irq_set_chip(virq, &no_irq_chip); + irq_set_chip_data(virq, NULL); + irq_modify_status(virq, clr, set); } } EXPORT_SYMBOL_GPL(irq_remove_generic_chip); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/irq/matrix.c +++ linux-lowlatency-5.15.0/kernel/irq/matrix.c @@ -466,16 +466,16 @@ } /** - * irq_matrix_allocated - Get the number of allocated irqs on the local cpu + * irq_matrix_allocated - Get the number of allocated non-managed irqs on the local CPU * @m: Pointer to the matrix to search * - * This returns number of allocated irqs + * This returns number of allocated non-managed interrupts. */ unsigned int irq_matrix_allocated(struct irq_matrix *m) { struct cpumap *cm = this_cpu_ptr(m->maps); - return cm->allocated; + return cm->allocated - cm->managed_allocated; } #ifdef CONFIG_GENERIC_IRQ_DEBUGFS only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/kallsyms.c +++ linux-lowlatency-5.15.0/kernel/kallsyms.c @@ -204,7 +204,6 @@ return module_kallsyms_lookup_name(name); } -#ifdef CONFIG_LIVEPATCH /* * Iterate over all symbols in vmlinux. For symbols from modules use * module_kallsyms_on_each_symbol instead. @@ -226,7 +225,6 @@ } return 0; } -#endif /* CONFIG_LIVEPATCH */ static unsigned long get_symbol_pos(unsigned long addr, unsigned long *symbolsize, only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/locking/test-ww_mutex.c +++ linux-lowlatency-5.15.0/kernel/locking/test-ww_mutex.c @@ -426,7 +426,6 @@ } while (!time_after(jiffies, stress->timeout)); kfree(order); - kfree(stress); } struct reorder_lock { @@ -491,7 +490,6 @@ list_for_each_entry_safe(ll, ln, &locks, link) kfree(ll); kfree(order); - kfree(stress); } static void stress_one_work(struct work_struct *work) @@ -512,8 +510,6 @@ break; } } while (!time_after(jiffies, stress->timeout)); - - kfree(stress); } #define STRESS_INORDER BIT(0) @@ -524,15 +520,24 @@ static int stress(int nlocks, int nthreads, unsigned int flags) { struct ww_mutex *locks; - int n; + struct stress *stress_array; + int n, count; locks = kmalloc_array(nlocks, sizeof(*locks), GFP_KERNEL); if (!locks) return -ENOMEM; + stress_array = kmalloc_array(nthreads, sizeof(*stress_array), + GFP_KERNEL); + if (!stress_array) { + kfree(locks); + return -ENOMEM; + } + for (n = 0; n < nlocks; n++) ww_mutex_init(&locks[n], &ww_class); + count = 0; for (n = 0; nthreads; n++) { struct stress *stress; void (*fn)(struct work_struct *work); @@ -556,9 +561,7 @@ if (!fn) continue; - stress = kmalloc(sizeof(*stress), GFP_KERNEL); - if (!stress) - break; + stress = &stress_array[count++]; INIT_WORK(&stress->work, fn); stress->locks = locks; @@ -573,6 +576,7 @@ for (n = 0; n < nlocks; n++) ww_mutex_destroy(&locks[n]); + kfree(stress_array); kfree(locks); return 0; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/rcu/tree.h +++ linux-lowlatency-5.15.0/kernel/rcu/tree.h @@ -351,6 +351,10 @@ /* in jiffies. */ unsigned long jiffies_stall; /* Time at which to check */ /* for CPU stalls. */ + int nr_fqs_jiffies_stall; /* Number of fqs loops after + * which read jiffies and set + * jiffies_stall. Stall + * warnings disabled if !0. */ unsigned long jiffies_resched; /* Time at which to resched */ /* a reluctant CPU. */ unsigned long n_force_qs_gpstart; /* Snapshot of n_force_qs at */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/kernel/reboot.c +++ linux-lowlatency-5.15.0/kernel/reboot.c @@ -65,6 +65,7 @@ void emergency_restart(void) { kmsg_dump(KMSG_DUMP_EMERG); + system_state = SYSTEM_RESTART; machine_emergency_restart(); } EXPORT_SYMBOL_GPL(emergency_restart); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/mm/readahead.c +++ linux-lowlatency-5.15.0/mm/readahead.c @@ -627,7 +627,8 @@ */ ret = -EINVAL; if (!f.file->f_mapping || !f.file->f_mapping->a_ops || - !S_ISREG(file_inode(f.file)->i_mode)) + (!S_ISREG(file_inode(f.file)->i_mode) && + !S_ISBLK(file_inode(f.file)->i_mode))) goto out; ret = vfs_fadvise(f.file, offset, count, POSIX_FADV_WILLNEED); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/8021q/vlan.h +++ linux-lowlatency-5.15.0/net/8021q/vlan.h @@ -129,6 +129,7 @@ u32 skb_prio, u16 vlan_prio); int vlan_dev_set_egress_priority(const struct net_device *dev, u32 skb_prio, u16 vlan_prio); +void vlan_dev_free_egress_priority(const struct net_device *dev); int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); void vlan_dev_get_realdev_name(const struct net_device *dev, char *result, size_t size); @@ -139,7 +140,6 @@ void vlan_setup(struct net_device *dev); int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack); void unregister_vlan_dev(struct net_device *dev, struct list_head *head); -void vlan_dev_uninit(struct net_device *dev); bool vlan_dev_inherit_address(struct net_device *dev, struct net_device *real_dev); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/8021q/vlan_netlink.c +++ linux-lowlatency-5.15.0/net/8021q/vlan_netlink.c @@ -183,10 +183,11 @@ return -EINVAL; err = vlan_changelink(dev, tb, data, extack); - if (!err) - err = register_vlan_dev(dev, extack); if (err) - vlan_dev_uninit(dev); + return err; + err = register_vlan_dev(dev, extack); + if (err) + vlan_dev_free_egress_priority(dev); return err; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/bridge/netfilter/nf_conntrack_bridge.c +++ linux-lowlatency-5.15.0/net/bridge/netfilter/nf_conntrack_bridge.c @@ -36,7 +36,7 @@ ktime_t tstamp = skb->tstamp; struct ip_frag_state state; struct iphdr *iph; - int err; + int err = 0; /* for offloaded checksums cleanup checksum before fragmentation */ if (skb->ip_summed == CHECKSUM_PARTIAL && only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/bridge/netfilter/nft_meta_bridge.c +++ linux-lowlatency-5.15.0/net/bridge/netfilter/nft_meta_bridge.c @@ -53,7 +53,7 @@ goto err; br_vlan_get_proto(br_dev, &p_proto); - nft_reg_store16(dest, htons(p_proto)); + nft_reg_store_be16(dest, htons(p_proto)); return; } default: only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/core/pktgen.c +++ linux-lowlatency-5.15.0/net/core/pktgen.c @@ -668,19 +668,19 @@ seq_puts(seq, " Flags: "); for (i = 0; i < NR_PKT_FLAGS; i++) { - if (i == F_FLOW_SEQ) + if (i == FLOW_SEQ_SHIFT) if (!pkt_dev->cflows) continue; - if (pkt_dev->flags & (1 << i)) + if (pkt_dev->flags & (1 << i)) { seq_printf(seq, "%s ", pkt_flag_names[i]); - else if (i == F_FLOW_SEQ) - seq_puts(seq, "FLOW_RND "); - #ifdef CONFIG_XFRM - if (i == F_IPSEC && pkt_dev->spi) - seq_printf(seq, "spi:%u", pkt_dev->spi); + if (i == IPSEC_SHIFT && pkt_dev->spi) + seq_printf(seq, "spi:%u ", pkt_dev->spi); #endif + } else if (i == FLOW_SEQ_SHIFT) { + seq_puts(seq, "FLOW_RND "); + } } seq_puts(seq, "\n"); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/llc/llc_s_ac.c +++ linux-lowlatency-5.15.0/net/llc/llc_s_ac.c @@ -153,6 +153,9 @@ int rc = 1; u32 data_size; + if (skb->mac_len < ETH_HLEN) + return 1; + llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_da(skb, mac_sa); llc_pdu_decode_ssap(skb, &dsap); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/llc/llc_station.c +++ linux-lowlatency-5.15.0/net/llc/llc_station.c @@ -76,6 +76,9 @@ u32 data_size; struct sk_buff *nskb; + if (skb->mac_len < ETH_HLEN) + goto out; + /* The test request command is type U (llc_len = 3) */ data_size = ntohs(eth_hdr(skb)->h_proto) - 3; nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, data_size); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/mptcp/mptcp_diag.c +++ linux-lowlatency-5.15.0/net/mptcp/mptcp_diag.c @@ -66,20 +66,103 @@ return err; } +struct mptcp_diag_ctx { + long s_slot; + long s_num; + unsigned int l_slot; + unsigned int l_num; +}; + +static void mptcp_diag_dump_listeners(struct sk_buff *skb, struct netlink_callback *cb, + const struct inet_diag_req_v2 *r, + bool net_admin) +{ + struct inet_diag_dump_data *cb_data = cb->data; + struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + struct nlattr *bc = cb_data->inet_diag_nla_bc; + struct net *net = sock_net(skb->sk); + int i; + + for (i = diag_ctx->l_slot; i <= tcp_hashinfo.lhash2_mask; i++) { + struct inet_listen_hashbucket *ilb; + struct hlist_nulls_node *node; + struct sock *sk; + int num = 0; + + ilb = &tcp_hashinfo.lhash2[i]; + + rcu_read_lock(); + spin_lock(&ilb->lock); + sk_nulls_for_each(sk, node, &ilb->nulls_head) { + const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); + struct inet_sock *inet = inet_sk(sk); + int ret; + + if (num < diag_ctx->l_num) + goto next_listen; + + if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) + goto next_listen; + + sk = ctx->conn; + if (!sk || !net_eq(sock_net(sk), net)) + goto next_listen; + + if (r->sdiag_family != AF_UNSPEC && + sk->sk_family != r->sdiag_family) + goto next_listen; + + if (r->id.idiag_sport != inet->inet_sport && + r->id.idiag_sport) + goto next_listen; + + if (!refcount_inc_not_zero(&sk->sk_refcnt)) + goto next_listen; + + ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + + sock_put(sk); + + if (ret < 0) { + spin_unlock(&ilb->lock); + rcu_read_unlock(); + diag_ctx->l_slot = i; + diag_ctx->l_num = num; + return; + } + diag_ctx->l_num = num + 1; + num = 0; +next_listen: + ++num; + } + spin_unlock(&ilb->lock); + rcu_read_unlock(); + + cond_resched(); + diag_ctx->l_num = 0; + } + + diag_ctx->l_num = 0; + diag_ctx->l_slot = i; +} + static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, const struct inet_diag_req_v2 *r) { bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); + struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; struct net *net = sock_net(skb->sk); struct inet_diag_dump_data *cb_data; struct mptcp_sock *msk; struct nlattr *bc; + BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); + cb_data = cb->data; bc = cb_data->inet_diag_nla_bc; - while ((msk = mptcp_token_iter_next(net, &cb->args[0], &cb->args[1])) != - NULL) { + while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, + &diag_ctx->s_num)) != NULL) { struct inet_sock *inet = (struct inet_sock *)msk; struct sock *sk = (struct sock *)msk; int ret = 0; @@ -101,11 +184,14 @@ sock_put(sk); if (ret < 0) { /* will retry on the same position */ - cb->args[1]--; + diag_ctx->s_num--; break; } cond_resched(); } + + if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) + mptcp_diag_dump_listeners(skb, cb, r, net_admin); } static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, @@ -119,6 +205,19 @@ r->idiag_rqueue = sk_rmem_alloc_get(sk); r->idiag_wqueue = sk_wmem_alloc_get(sk); + + if (inet_sk_state_load(sk) == TCP_LISTEN) { + struct sock *lsk = READ_ONCE(msk->first); + + if (lsk) { + /* override with settings from tcp listener, + * so Send-Q will show accept queue. + */ + r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); + r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); + } + } + if (!info) return; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/netfilter/nf_nat_redirect.c +++ linux-lowlatency-5.15.0/net/netfilter/nf_nat_redirect.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -24,81 +25,104 @@ #include #include +static unsigned int +nf_nat_redirect(struct sk_buff *skb, const struct nf_nat_range2 *range, + const union nf_inet_addr *newdst) +{ + struct nf_nat_range2 newrange; + enum ip_conntrack_info ctinfo; + struct nf_conn *ct; + + ct = nf_ct_get(skb, &ctinfo); + + memset(&newrange, 0, sizeof(newrange)); + + newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS; + newrange.min_addr = *newdst; + newrange.max_addr = *newdst; + newrange.min_proto = range->min_proto; + newrange.max_proto = range->max_proto; + + return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST); +} + unsigned int -nf_nat_redirect_ipv4(struct sk_buff *skb, - const struct nf_nat_ipv4_multi_range_compat *mr, +nf_nat_redirect_ipv4(struct sk_buff *skb, const struct nf_nat_range2 *range, unsigned int hooknum) { - struct nf_conn *ct; - enum ip_conntrack_info ctinfo; - __be32 newdst; - struct nf_nat_range2 newrange; + union nf_inet_addr newdst = {}; WARN_ON(hooknum != NF_INET_PRE_ROUTING && hooknum != NF_INET_LOCAL_OUT); - ct = nf_ct_get(skb, &ctinfo); - WARN_ON(!(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED))); - /* Local packets: make them go to loopback */ if (hooknum == NF_INET_LOCAL_OUT) { - newdst = htonl(0x7F000001); + newdst.ip = htonl(INADDR_LOOPBACK); } else { const struct in_device *indev; - newdst = 0; - indev = __in_dev_get_rcu(skb->dev); if (indev) { const struct in_ifaddr *ifa; ifa = rcu_dereference(indev->ifa_list); if (ifa) - newdst = ifa->ifa_local; + newdst.ip = ifa->ifa_local; } - if (!newdst) + if (!newdst.ip) return NF_DROP; } - /* Transfer from original range. */ - memset(&newrange.min_addr, 0, sizeof(newrange.min_addr)); - memset(&newrange.max_addr, 0, sizeof(newrange.max_addr)); - newrange.flags = mr->range[0].flags | NF_NAT_RANGE_MAP_IPS; - newrange.min_addr.ip = newdst; - newrange.max_addr.ip = newdst; - newrange.min_proto = mr->range[0].min; - newrange.max_proto = mr->range[0].max; - - /* Hand modified range to generic setup. */ - return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST); + return nf_nat_redirect(skb, range, &newdst); } EXPORT_SYMBOL_GPL(nf_nat_redirect_ipv4); static const struct in6_addr loopback_addr = IN6ADDR_LOOPBACK_INIT; +static bool nf_nat_redirect_ipv6_usable(const struct inet6_ifaddr *ifa, unsigned int scope) +{ + unsigned int ifa_addr_type = ipv6_addr_type(&ifa->addr); + + if (ifa_addr_type & IPV6_ADDR_MAPPED) + return false; + + if ((ifa->flags & IFA_F_TENTATIVE) && (!(ifa->flags & IFA_F_OPTIMISTIC))) + return false; + + if (scope) { + unsigned int ifa_scope = ifa_addr_type & IPV6_ADDR_SCOPE_MASK; + + if (!(scope & ifa_scope)) + return false; + } + + return true; +} + unsigned int nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range, unsigned int hooknum) { - struct nf_nat_range2 newrange; - struct in6_addr newdst; - enum ip_conntrack_info ctinfo; - struct nf_conn *ct; + union nf_inet_addr newdst = {}; - ct = nf_ct_get(skb, &ctinfo); if (hooknum == NF_INET_LOCAL_OUT) { - newdst = loopback_addr; + newdst.in6 = loopback_addr; } else { + unsigned int scope = ipv6_addr_scope(&ipv6_hdr(skb)->daddr); struct inet6_dev *idev; - struct inet6_ifaddr *ifa; bool addr = false; idev = __in6_dev_get(skb->dev); if (idev != NULL) { + const struct inet6_ifaddr *ifa; + read_lock_bh(&idev->lock); list_for_each_entry(ifa, &idev->addr_list, if_list) { - newdst = ifa->addr; + if (!nf_nat_redirect_ipv6_usable(ifa, scope)) + continue; + + newdst.in6 = ifa->addr; addr = true; break; } @@ -109,12 +133,6 @@ return NF_DROP; } - newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS; - newrange.min_addr.in6 = newdst; - newrange.max_addr.in6 = newdst; - newrange.min_proto = range->min_proto; - newrange.max_proto = range->max_proto; - - return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST); + return nf_nat_redirect(skb, range, &newdst); } EXPORT_SYMBOL_GPL(nf_nat_redirect_ipv6); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/netfilter/nft_xfrm.c +++ linux-lowlatency-5.15.0/net/netfilter/nft_xfrm.c @@ -50,7 +50,7 @@ return -EOPNOTSUPP; } - priv->key = ntohl(nla_get_u32(tb[NFTA_XFRM_KEY])); + priv->key = ntohl(nla_get_be32(tb[NFTA_XFRM_KEY])); switch (priv->key) { case NFT_XFRM_KEY_REQID: case NFT_XFRM_KEY_SPI: @@ -132,13 +132,13 @@ WARN_ON_ONCE(1); break; case NFT_XFRM_KEY_DADDR_IP4: - *dest = state->id.daddr.a4; + *dest = (__force __u32)state->id.daddr.a4; return; case NFT_XFRM_KEY_DADDR_IP6: memcpy(dest, &state->id.daddr.in6, sizeof(struct in6_addr)); return; case NFT_XFRM_KEY_SADDR_IP4: - *dest = state->props.saddr.a4; + *dest = (__force __u32)state->props.saddr.a4; return; case NFT_XFRM_KEY_SADDR_IP6: memcpy(dest, &state->props.saddr.in6, sizeof(struct in6_addr)); @@ -147,7 +147,7 @@ *dest = state->props.reqid; return; case NFT_XFRM_KEY_SPI: - *dest = state->id.spi; + *dest = (__force __u32)state->id.spi; return; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/netfilter/xt_REDIRECT.c +++ linux-lowlatency-5.15.0/net/netfilter/xt_REDIRECT.c @@ -46,7 +46,6 @@ nf_ct_netns_put(par->net, par->family); } -/* FIXME: Take multiple ranges --RR */ static int redirect_tg4_check(const struct xt_tgchk_param *par) { const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo; @@ -65,7 +64,14 @@ static unsigned int redirect_tg4(struct sk_buff *skb, const struct xt_action_param *par) { - return nf_nat_redirect_ipv4(skb, par->targinfo, xt_hooknum(par)); + const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo; + struct nf_nat_range2 range = { + .flags = mr->range[0].flags, + .min_proto = mr->range[0].min, + .max_proto = mr->range[0].max, + }; + + return nf_nat_redirect_ipv4(skb, &range, xt_hooknum(par)); } static struct xt_target redirect_tg_reg[] __read_mostly = { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/netfilter/xt_owner.c +++ linux-lowlatency-5.15.0/net/netfilter/xt_owner.c @@ -76,18 +76,23 @@ */ return false; - filp = sk->sk_socket->file; - if (filp == NULL) + read_lock_bh(&sk->sk_callback_lock); + filp = sk->sk_socket ? sk->sk_socket->file : NULL; + if (filp == NULL) { + read_unlock_bh(&sk->sk_callback_lock); return ((info->match ^ info->invert) & (XT_OWNER_UID | XT_OWNER_GID)) == 0; + } if (info->match & XT_OWNER_UID) { kuid_t uid_min = make_kuid(net->user_ns, info->uid_min); kuid_t uid_max = make_kuid(net->user_ns, info->uid_max); if ((uid_gte(filp->f_cred->fsuid, uid_min) && uid_lte(filp->f_cred->fsuid, uid_max)) ^ - !(info->invert & XT_OWNER_UID)) + !(info->invert & XT_OWNER_UID)) { + read_unlock_bh(&sk->sk_callback_lock); return false; + } } if (info->match & XT_OWNER_GID) { @@ -112,10 +117,13 @@ } } - if (match ^ !(info->invert & XT_OWNER_GID)) + if (match ^ !(info->invert & XT_OWNER_GID)) { + read_unlock_bh(&sk->sk_callback_lock); return false; + } } + read_unlock_bh(&sk->sk_callback_lock); return true; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/netfilter/xt_recent.c +++ linux-lowlatency-5.15.0/net/netfilter/xt_recent.c @@ -561,7 +561,7 @@ { struct recent_table *t = PDE_DATA(file_inode(file)); struct recent_entry *e; - char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; + char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255")]; const char *c = buf; union nf_inet_addr addr = {}; u_int16_t family; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/nfc/nci/spi.c +++ linux-lowlatency-5.15.0/net/nfc/nci/spi.c @@ -151,6 +151,8 @@ int ret; skb = nci_skb_alloc(nspi->ndev, 0, GFP_KERNEL); + if (!skb) + return -ENOMEM; /* add the NCI SPI header to the start of the buffer */ hdr = skb_push(skb, NCI_SPI_HDR_LEN); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/psample/psample.c +++ linux-lowlatency-5.15.0/net/psample/psample.c @@ -31,7 +31,8 @@ static const struct genl_multicast_group psample_nl_mcgrps[] = { [PSAMPLE_NL_MCGRP_CONFIG] = { .name = PSAMPLE_NL_MCGRP_CONFIG_NAME }, - [PSAMPLE_NL_MCGRP_SAMPLE] = { .name = PSAMPLE_NL_MCGRP_SAMPLE_NAME }, + [PSAMPLE_NL_MCGRP_SAMPLE] = { .name = PSAMPLE_NL_MCGRP_SAMPLE_NAME, + .flags = GENL_UNS_ADMIN_PERM }, }; static struct genl_family psample_nl_family __ro_after_init; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/rfkill/rfkill-gpio.c +++ linux-lowlatency-5.15.0/net/rfkill/rfkill-gpio.c @@ -98,13 +98,13 @@ rfkill->clk = devm_clk_get(&pdev->dev, NULL); - gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); + gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_ASIS); if (IS_ERR(gpio)) return PTR_ERR(gpio); rfkill->reset_gpio = gpio; - gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW); + gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_ASIS); if (IS_ERR(gpio)) return PTR_ERR(gpio); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/sunrpc/rpcb_clnt.c +++ linux-lowlatency-5.15.0/net/sunrpc/rpcb_clnt.c @@ -746,6 +746,10 @@ child = rpcb_call_async(rpcb_clnt, map, proc); rpc_release_client(rpcb_clnt); + if (IS_ERR(child)) { + /* rpcb_map_release() has freed the arguments */ + return; + } xprt->stat.bind_count++; rpc_put_task(child); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/net/tipc/netlink.c +++ linux-lowlatency-5.15.0/net/tipc/netlink.c @@ -88,7 +88,7 @@ const struct nla_policy tipc_nl_link_policy[TIPC_NLA_LINK_MAX + 1] = { [TIPC_NLA_LINK_UNSPEC] = { .type = NLA_UNSPEC }, - [TIPC_NLA_LINK_NAME] = { .type = NLA_STRING, + [TIPC_NLA_LINK_NAME] = { .type = NLA_NUL_STRING, .len = TIPC_MAX_LINK_NAME }, [TIPC_NLA_LINK_MTU] = { .type = NLA_U32 }, [TIPC_NLA_LINK_BROADCAST] = { .type = NLA_FLAG }, @@ -125,7 +125,7 @@ const struct nla_policy tipc_nl_bearer_policy[TIPC_NLA_BEARER_MAX + 1] = { [TIPC_NLA_BEARER_UNSPEC] = { .type = NLA_UNSPEC }, - [TIPC_NLA_BEARER_NAME] = { .type = NLA_STRING, + [TIPC_NLA_BEARER_NAME] = { .type = NLA_NUL_STRING, .len = TIPC_MAX_BEARER_NAME }, [TIPC_NLA_BEARER_PROP] = { .type = NLA_NESTED }, [TIPC_NLA_BEARER_DOMAIN] = { .type = NLA_U32 } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/scripts/checkstack.pl +++ linux-lowlatency-5.15.0/scripts/checkstack.pl @@ -142,15 +142,11 @@ while (my $line = ) { if ($line =~ m/$funcre/) { $func = $1; - next if $line !~ m/^($xs*)/; + next if $line !~ m/^($x*)/; if ($total_size > $min_stack) { push @stack, "$intro$total_size\n"; } - - $addr = $1; - $addr =~ s/ /0/g; - $addr = "0x$addr"; - + $addr = "0x$1"; $intro = "$addr $func [$file]:"; my $padlen = 56 - length($intro); while ($padlen > 0) { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/scripts/gcc-plugins/randomize_layout_plugin.c +++ linux-lowlatency-5.15.0/scripts/gcc-plugins/randomize_layout_plugin.c @@ -209,12 +209,14 @@ static void performance_shuffle(tree *newtree, unsigned long length, ranctx *prng_state) { - unsigned long i, x; + unsigned long i, x, index; struct partition_group size_group[length]; unsigned long num_groups = 0; unsigned long randnum; partition_struct(newtree, length, (struct partition_group *)&size_group, &num_groups); + + /* FIXME: this group shuffle is currently a no-op. */ for (i = num_groups - 1; i > 0; i--) { struct partition_group tmp; randnum = ranval(prng_state) % (i + 1); @@ -224,11 +226,14 @@ } for (x = 0; x < num_groups; x++) { - for (i = size_group[x].start + size_group[x].length - 1; i > size_group[x].start; i--) { + for (index = size_group[x].length - 1; index > 0; index--) { tree tmp; + + i = size_group[x].start + index; if (DECL_BIT_FIELD_TYPE(newtree[i])) continue; - randnum = ranval(prng_state) % (i + 1); + randnum = ranval(prng_state) % (index + 1); + randnum += size_group[x].start; // we could handle this case differently if desired if (DECL_BIT_FIELD_TYPE(newtree[randnum])) continue; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/scripts/kconfig/symbol.c +++ linux-lowlatency-5.15.0/scripts/kconfig/symbol.c @@ -122,9 +122,9 @@ static void sym_validate_range(struct symbol *sym) { struct property *prop; + struct symbol *range_sym; int base; long long val, val2; - char str[64]; switch (sym->type) { case S_INT: @@ -140,17 +140,15 @@ if (!prop) return; val = strtoll(sym->curr.val, NULL, base); - val2 = sym_get_range_val(prop->expr->left.sym, base); + range_sym = prop->expr->left.sym; + val2 = sym_get_range_val(range_sym, base); if (val >= val2) { - val2 = sym_get_range_val(prop->expr->right.sym, base); + range_sym = prop->expr->right.sym; + val2 = sym_get_range_val(range_sym, base); if (val <= val2) return; } - if (sym->type == S_INT) - sprintf(str, "%lld", val2); - else - sprintf(str, "0x%llx", val2); - sym->curr.val = xstrdup(str); + sym->curr.val = range_sym->curr.val; } static void sym_set_changed(struct symbol *sym) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/security/integrity/integrity.h +++ linux-lowlatency-5.15.0/security/integrity/integrity.h @@ -131,6 +131,8 @@ unsigned long flags; unsigned long measured_pcrs; unsigned long atomic_flags; + unsigned long real_ino; + dev_t real_dev; enum integrity_status ima_file_status:4; enum integrity_status ima_mmap_status:4; enum integrity_status ima_bprm_status:4; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/codecs/wcd938x-sdw.c +++ linux-lowlatency-5.15.0/sound/soc/codecs/wcd938x-sdw.c @@ -266,7 +266,31 @@ pm_runtime_set_active(dev); pm_runtime_enable(dev); - return component_add(dev, &wcd938x_sdw_component_ops); + ret = component_add(dev, &wcd938x_sdw_component_ops); + if (ret) + goto err_disable_rpm; + + return 0; + +err_disable_rpm: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); + + return ret; +} + +static int wcd9380_remove(struct sdw_slave *pdev) +{ + struct device *dev = &pdev->dev; + + component_del(dev, &wcd938x_sdw_component_ops); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); + + return 0; } static const struct sdw_device_id wcd9380_slave_id[] = { @@ -307,6 +331,7 @@ static struct sdw_driver wcd9380_codec_driver = { .probe = wcd9380_probe, + .remove = wcd9380_remove, .ops = &wcd9380_slave_ops, .id_table = wcd9380_slave_id, .driver = { only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/fsl/mpc5200_dma.c +++ linux-lowlatency-5.15.0/sound/soc/fsl/mpc5200_dma.c @@ -100,6 +100,9 @@ /** * psc_dma_trigger: start and stop the DMA transfer. + * @component: triggered component + * @substream: triggered substream + * @cmd: triggered command * * This function is called by ALSA to start, stop, pause, and resume the DMA * transfer of data. only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/intel/common/soc-intel-quirks.h +++ linux-lowlatency-5.15.0/sound/soc/intel/common/soc-intel-quirks.h @@ -9,34 +9,13 @@ #ifndef _SND_SOC_INTEL_QUIRKS_H #define _SND_SOC_INTEL_QUIRKS_H +#include + #if IS_ENABLED(CONFIG_X86) #include -#include -#include #include -#define SOC_INTEL_IS_CPU(soc, type) \ -static inline bool soc_intel_is_##soc(void) \ -{ \ - static const struct x86_cpu_id soc##_cpu_ids[] = { \ - X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ - {} \ - }; \ - const struct x86_cpu_id *id; \ - \ - id = x86_match_cpu(soc##_cpu_ids); \ - if (id) \ - return true; \ - return false; \ -} - -SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); -SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); -SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); -SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); -SOC_INTEL_IS_CPU(cml, KABYLAKE_L); - static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) { /* @@ -114,30 +93,6 @@ return false; } -static inline bool soc_intel_is_byt(void) -{ - return false; -} - -static inline bool soc_intel_is_cht(void) -{ - return false; -} - -static inline bool soc_intel_is_apl(void) -{ - return false; -} - -static inline bool soc_intel_is_glk(void) -{ - return false; -} - -static inline bool soc_intel_is_cml(void) -{ - return false; -} #endif - #endif /* _SND_SOC_INTEL_QUIRKS_H */ +#endif /* _SND_SOC_INTEL_QUIRKS_H */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/intel/skylake/skl-sst-utils.c +++ linux-lowlatency-5.15.0/sound/soc/intel/skylake/skl-sst-utils.c @@ -299,6 +299,7 @@ module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL); if (!module->instance_id) { ret = -ENOMEM; + kfree(module); goto free_uuid_list; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/pxa/pxa-ssp.c +++ linux-lowlatency-5.15.0/sound/soc/pxa/pxa-ssp.c @@ -779,7 +779,7 @@ if (IS_ERR(priv->extclk)) { ret = PTR_ERR(priv->extclk); if (ret == -EPROBE_DEFER) - return ret; + goto err_priv; priv->extclk = NULL; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/ti/ams-delta.c +++ linux-lowlatency-5.15.0/sound/soc/ti/ams-delta.c @@ -303,7 +303,7 @@ static void cx81801_close(struct tty_struct *tty) { struct snd_soc_component *component = tty->disc_data; - struct snd_soc_dapm_context *dapm = &component->card->dapm; + struct snd_soc_dapm_context *dapm; del_timer_sync(&cx81801_timer); @@ -315,6 +315,8 @@ v253_ops.close(tty); + dapm = &component->card->dapm; + /* Revert back to default audio input/output constellation */ snd_soc_dapm_mutex_lock(dapm); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/sound/soc/ti/omap-mcbsp.c +++ linux-lowlatency-5.15.0/sound/soc/ti/omap-mcbsp.c @@ -74,14 +74,16 @@ return -EINVAL; } - pm_runtime_put_sync(mcbsp->dev); + if (mcbsp->active) + pm_runtime_put_sync(mcbsp->dev); r = clk_set_parent(mcbsp->fclk, fck_src); if (r) dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n", src); - pm_runtime_get_sync(mcbsp->dev); + if (mcbsp->active) + pm_runtime_get_sync(mcbsp->dev); clk_put(fck_src); only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/arch/parisc/include/uapi/asm/errno.h +++ linux-lowlatency-5.15.0/tools/arch/parisc/include/uapi/asm/errno.h @@ -75,7 +75,6 @@ /* We now return you to your regularly scheduled HPUX. */ -#define ENOSYM 215 /* symbol does not exist in executable */ #define ENOTSOCK 216 /* Socket operation on non-socket */ #define EDESTADDRREQ 217 /* Destination address required */ #define EMSGSIZE 218 /* Message too long */ @@ -101,7 +100,6 @@ #define ETIMEDOUT 238 /* Connection timed out */ #define ECONNREFUSED 239 /* Connection refused */ #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ -#define EREMOTERELEASE 240 /* Remote peer released connection */ #define EHOSTDOWN 241 /* Host is down */ #define EHOSTUNREACH 242 /* No route to host */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/include/uapi/linux/perf_event.h +++ linux-lowlatency-5.15.0/tools/include/uapi/linux/perf_event.h @@ -251,6 +251,8 @@ PERF_BR_SYSRET = 8, /* syscall return */ PERF_BR_COND_CALL = 9, /* conditional function call */ PERF_BR_COND_RET = 10, /* conditional function return */ + PERF_BR_ERET = 11, /* exception return */ + PERF_BR_IRQ = 12, /* irq */ PERF_BR_MAX, }; @@ -299,6 +301,7 @@ * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 id; } && PERF_FORMAT_ID + * { u64 lost; } && PERF_FORMAT_LOST * } && !PERF_FORMAT_GROUP * * { u64 nr; @@ -306,6 +309,7 @@ * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING * { u64 value; * { u64 id; } && PERF_FORMAT_ID + * { u64 lost; } && PERF_FORMAT_LOST * } cntr[nr]; * } && PERF_FORMAT_GROUP * }; @@ -315,8 +319,9 @@ PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3, + PERF_FORMAT_LOST = 1U << 4, - PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ + PERF_FORMAT_MAX = 1U << 5, /* non-ABI */ }; #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/perf/util/branch.c +++ linux-lowlatency-5.15.0/tools/perf/util/branch.c @@ -49,7 +49,9 @@ "SYSCALL", "SYSRET", "COND_CALL", - "COND_RET" + "COND_RET", + "ERET", + "IRQ" }; if (type >= 0 && type < PERF_BR_MAX) only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/testing/selftests/bpf/prog_tests/tailcalls.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/bpf/prog_tests/tailcalls.c @@ -272,11 +272,11 @@ data_map = bpf_object__find_map_by_name(obj, "tailcall.bss"); if (CHECK_FAIL(!data_map || !bpf_map__is_internal(data_map))) - return; + goto out; data_fd = bpf_map__fd(data_map); - if (CHECK_FAIL(map_fd < 0)) - return; + if (CHECK_FAIL(data_fd < 0)) + goto out; i = 0; err = bpf_map_lookup_elem(data_fd, &i, &val); @@ -334,11 +334,11 @@ data_map = bpf_object__find_map_by_name(obj, "tailcall.bss"); if (CHECK_FAIL(!data_map || !bpf_map__is_internal(data_map))) - return; + goto out; data_fd = bpf_map__fd(data_map); - if (CHECK_FAIL(map_fd < 0)) - return; + if (CHECK_FAIL(data_fd < 0)) + goto out; for (i = 0; i < bpf_map__def(prog_array)->max_entries; i++) { snprintf(prog_name, sizeof(prog_name), "classifier/%i", i); @@ -422,11 +422,11 @@ data_map = bpf_object__find_map_by_name(obj, "tailcall.bss"); if (CHECK_FAIL(!data_map || !bpf_map__is_internal(data_map))) - return; + goto out; data_fd = bpf_map__fd(data_map); - if (CHECK_FAIL(map_fd < 0)) - return; + if (CHECK_FAIL(data_fd < 0)) + goto out; for (i = 0; i < bpf_map__def(prog_array)->max_entries; i++) { snprintf(prog_name, sizeof(prog_name), "classifier/%i", i); @@ -610,11 +610,11 @@ data_map = bpf_object__find_map_by_name(obj, "tailcall.bss"); if (CHECK_FAIL(!data_map || !bpf_map__is_internal(data_map))) - return; + goto out; data_fd = bpf_map__fd(data_map); - if (CHECK_FAIL(map_fd < 0)) - return; + if (CHECK_FAIL(data_fd < 0)) + goto out; i = 0; err = bpf_map_lookup_elem(data_fd, &i, &val); @@ -783,11 +783,11 @@ data_map = bpf_object__find_map_by_name(obj, "tailcall.bss"); if (CHECK_FAIL(!data_map || !bpf_map__is_internal(data_map))) - return; + goto out; data_fd = bpf_map__fd(data_map); - if (CHECK_FAIL(map_fd < 0)) - return; + if (CHECK_FAIL(data_fd < 0)) + goto out; i = 0; val.noise = noise; @@ -810,6 +810,59 @@ bpf_object__close(obj); } +#include "tailcall_bpf2bpf6.skel.h" + +/* Tail call counting works even when there is data on stack which is + * not aligned to 8 bytes. + */ +static void test_tailcall_bpf2bpf_6(void) +{ + struct tailcall_bpf2bpf6 *obj; + int err, map_fd, prog_fd, main_fd, data_fd, i, val; + LIBBPF_OPTS(bpf_test_run_opts, topts, + .data_in = &pkt_v4, + .data_size_in = sizeof(pkt_v4), + .repeat = 1, + ); + + obj = tailcall_bpf2bpf6__open_and_load(); + if (!ASSERT_OK_PTR(obj, "open and load")) + return; + + main_fd = bpf_program__fd(obj->progs.entry); + if (!ASSERT_GE(main_fd, 0, "entry prog fd")) + goto out; + + map_fd = bpf_map__fd(obj->maps.jmp_table); + if (!ASSERT_GE(map_fd, 0, "jmp_table map fd")) + goto out; + + prog_fd = bpf_program__fd(obj->progs.classifier_0); + if (!ASSERT_GE(prog_fd, 0, "classifier_0 prog fd")) + goto out; + + i = 0; + err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); + if (!ASSERT_OK(err, "jmp_table map update")) + goto out; + + err = bpf_prog_test_run_opts(main_fd, &topts); + ASSERT_OK(err, "entry prog test run"); + ASSERT_EQ(topts.retval, 0, "tailcall retval"); + + data_fd = bpf_map__fd(obj->maps.bss); + if (!ASSERT_GE(data_fd, 0, "bss map fd")) + goto out; + + i = 0; + err = bpf_map_lookup_elem(data_fd, &i, &val); + ASSERT_OK(err, "bss map lookup"); + ASSERT_EQ(val, 1, "done flag is set"); + +out: + tailcall_bpf2bpf6__destroy(obj); +} + void test_tailcalls(void) { if (test__start_subtest("tailcall_1")) @@ -832,4 +885,6 @@ test_tailcall_bpf2bpf_4(false); if (test__start_subtest("tailcall_bpf2bpf_5")) test_tailcall_bpf2bpf_4(true); + if (test__start_subtest("tailcall_bpf2bpf_6")) + test_tailcall_bpf2bpf_6(); } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +#define __unused __attribute__((unused)) + +struct { + __uint(type, BPF_MAP_TYPE_PROG_ARRAY); + __uint(max_entries, 1); + __uint(key_size, sizeof(__u32)); + __uint(value_size, sizeof(__u32)); +} jmp_table SEC(".maps"); + +int done = 0; + +SEC("tc") +int classifier_0(struct __sk_buff *skb __unused) +{ + done = 1; + return 0; +} + +static __noinline +int subprog_tail(struct __sk_buff *skb) +{ + /* Don't propagate the constant to the caller */ + volatile int ret = 1; + + bpf_tail_call_static(skb, &jmp_table, 0); + return ret; +} + +SEC("tc") +int entry(struct __sk_buff *skb) +{ + /* Have data on stack which size is not a multiple of 8 */ + volatile char arr[1] = {}; + + return subprog_tail(skb); +} + +char __license[] SEC("license") = "GPL"; only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/testing/selftests/efivarfs/create-read.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/efivarfs/create-read.c @@ -32,8 +32,10 @@ rc = read(fd, buf, sizeof(buf)); if (rc != 0) { fprintf(stderr, "Reading a new var should return EOF\n"); + close(fd); return EXIT_FAILURE; } + close(fd); return EXIT_SUCCESS; } only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc +++ linux-lowlatency-5.15.0/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc @@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Test failure of registering kprobe on non unique symbol +# requires: kprobe_events + +SYMBOL='name_show' + +# We skip this test on kernel where SYMBOL is unique or does not exist. +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then + exit_unsupported +fi + +! echo "p:test_non_unique ${SYMBOL}" > kprobe_events only in patch2: unchanged: --- linux-lowlatency-5.15.0.orig/tools/testing/selftests/net/ipsec.c +++ linux-lowlatency-5.15.0/tools/testing/selftests/net/ipsec.c @@ -2278,7 +2278,7 @@ int main(int argc, char **argv) { - unsigned int nr_process = 1; + long nr_process = 1; int route_sock = -1, ret = KSFT_SKIP; int test_desc_fd[2]; uint32_t route_seq; @@ -2299,7 +2299,7 @@ exit_usage(argv); } - if (nr_process > MAX_PROCESSES || !nr_process) { + if (nr_process > MAX_PROCESSES || nr_process < 1) { printk("nr_process should be between [1; %u]", MAX_PROCESSES); exit_usage(argv);