diff -Nru linux-aws-5.19.0/arch/arm/boot/compressed/misc.c linux-aws-5.19.0/arch/arm/boot/compressed/misc.c --- linux-aws-5.19.0/arch/arm/boot/compressed/misc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/compressed/misc.c 2022-11-29 07:06:46.000000000 +0000 @@ -23,7 +23,9 @@ #include #include #include "misc.h" +#ifdef CONFIG_ARCH_EP93XX #include "misc-ep93xx.h" +#endif static void putstr(const char *ptr); diff -Nru linux-aws-5.19.0/arch/arm/boot/compressed/vmlinux.lds.S linux-aws-5.19.0/arch/arm/boot/compressed/vmlinux.lds.S --- linux-aws-5.19.0/arch/arm/boot/compressed/vmlinux.lds.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/compressed/vmlinux.lds.S 2022-11-29 07:06:46.000000000 +0000 @@ -23,6 +23,7 @@ *(.ARM.extab*) *(.note.*) *(.rel.*) + *(.printk_index) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates @@ -57,6 +58,7 @@ *(.rodata) *(.rodata.*) *(.data.rel.ro) + *(.data.rel.ro.*) } .piggydata : { *(.piggydata) diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/am33xx-l4.dtsi linux-aws-5.19.0/arch/arm/boot/dts/am33xx-l4.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/am33xx-l4.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/am33xx-l4.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1502,8 +1502,7 @@ mmc1: mmc@0 { compatible = "ti,am335-sdhci"; ti,needs-special-reset; - dmas = <&edma_xbar 24 0 0 - &edma_xbar 25 0 0>; + dmas = <&edma 24 0>, <&edma 25 0>; dma-names = "tx", "rx"; interrupts = <64>; reg = <0x0 0x1000>; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/am5748.dtsi linux-aws-5.19.0/arch/arm/boot/dts/am5748.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/am5748.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/am5748.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -25,6 +25,10 @@ status = "disabled"; }; +&usb4_tm { + status = "disabled"; +}; + &atl_tm { status = "disabled"; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/armada-385-turris-omnia.dts linux-aws-5.19.0/arch/arm/boot/dts/armada-385-turris-omnia.dts --- linux-aws-5.19.0/arch/arm/boot/dts/armada-385-turris-omnia.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/armada-385-turris-omnia.dts 2022-11-29 07:06:46.000000000 +0000 @@ -478,7 +478,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -513,7 +513,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -76,8 +76,8 @@ regulators { vdd_3v3: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -95,8 +95,8 @@ vddio_ddr: VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -118,8 +118,8 @@ vdd_core: VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -160,8 +160,8 @@ LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-always-on; regulator-state-standby { @@ -175,9 +175,8 @@ LDO2 { regulator-name = "LDO2"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; - regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; regulator-state-standby { regulator-on-in-suspend; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d2_icp.dts linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d2_icp.dts --- linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d2_icp.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/at91-sama5d2_icp.dts 2022-11-29 07:06:46.000000000 +0000 @@ -197,8 +197,8 @@ regulators { vdd_io_reg: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -216,8 +216,8 @@ VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -235,8 +235,8 @@ VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -258,7 +258,6 @@ regulator-max-microvolt = <1850000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; - regulator-always-on; regulator-state-standby { regulator-on-in-suspend; @@ -273,8 +272,8 @@ LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; regulator-always-on; regulator-state-standby { @@ -288,8 +287,8 @@ LDO2 { regulator-name = "LDO2"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-always-on; regulator-state-standby { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/at91-sama7g5ek.dts linux-aws-5.19.0/arch/arm/boot/dts/at91-sama7g5ek.dts --- linux-aws-5.19.0/arch/arm/boot/dts/at91-sama7g5ek.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/at91-sama7g5ek.dts 2022-11-29 07:06:46.000000000 +0000 @@ -244,8 +244,8 @@ regulators { vdd_3v3: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -264,8 +264,8 @@ vddioddr: VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <1300000>; - regulator-max-microvolt = <1450000>; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -285,8 +285,8 @@ vddcore: VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <1100000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -306,7 +306,7 @@ vddcpu: VDD_OTHER { regulator-name = "VDD_OTHER"; regulator-min-microvolt = <1050000>; - regulator-max-microvolt = <1850000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-ramp-delay = <3125>; @@ -326,8 +326,8 @@ vldo1: LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; regulator-always-on; regulator-state-standby { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-midas.dtsi linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-midas.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-midas.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-midas.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -585,7 +585,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-origen.dts linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-origen.dts --- linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-origen.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/exynos4412-origen.dts 2022-11-29 07:06:46.000000000 +0000 @@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1"; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6dl.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6dl.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6dl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6dl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6dl-riotboard.dts linux-aws-5.19.0/arch/arm/boot/dts/imx6dl-riotboard.dts --- linux-aws-5.19.0/arch/arm/boot/dts/imx6dl-riotboard.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6dl-riotboard.dts 2022-11-29 07:06:46.000000000 +0000 @@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6q-arm2.dts linux-aws-5.19.0/arch/arm/boot/dts/imx6q-arm2.dts --- linux-aws-5.19.0/arch/arm/boot/dts/imx6q-arm2.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6q-arm2.dts 2022-11-29 07:06:46.000000000 +0000 @@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -51,16 +51,6 @@ vin-supply = <®_3p3v_s5>; }; - reg_3p3v_s0: regulator-3p3v-s0 { - compatible = "regulator-fixed"; - regulator-name = "V_3V3_S0"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - regulator-boot-on; - vin-supply = <®_3p3v_s5>; - }; - reg_3p3v_s5: regulator-3p3v-s5 { compatible = "regulator-fixed"; regulator-name = "V_3V3_S5"; @@ -259,7 +249,7 @@ /* default boot source: workaround #1 for errata ERR006282 */ smarc_flash: flash@0 { - compatible = "winbond,w25q16dw", "jedec,spi-nor"; + compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <20000000>; }; @@ -273,6 +263,10 @@ phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; }; +&hdmi { + ddc-i2c-bus = <&i2c2>; +}; + &i2c_intern { pmic@8 { compatible = "fsl,pfuze100"; @@ -397,7 +391,7 @@ /* HDMI_CTRL */ &i2c2 { - clock-frequency = <375000>; + clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -7,6 +7,7 @@ #include &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-ts7970.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-ts7970.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-ts7970.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-ts7970.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-vicut1.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-vicut1.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-vicut1.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qdl-vicut1.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -28,7 +28,7 @@ enable-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>; }; - backlight_led: backlight_led { + backlight_led: backlight-led { compatible = "pwm-backlight"; pwms = <&pwm3 0 5000000 0>; brightness-levels = <0 16 64 255>; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6q.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6q.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6q.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6q.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6q-evi.dts linux-aws-5.19.0/arch/arm/boot/dts/imx6q-evi.dts --- linux-aws-5.19.0/arch/arm/boot/dts/imx6q-evi.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6q-evi.dts 2022-11-29 07:06:46.000000000 +0000 @@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6q-mccmon6.dts linux-aws-5.19.0/arch/arm/boot/dts/imx6q-mccmon6.dts --- linux-aws-5.19.0/arch/arm/boot/dts/imx6q-mccmon6.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6q-mccmon6.dts 2022-11-29 07:06:46.000000000 +0000 @@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay"; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6qp.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6qp.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6qp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6qp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6sl.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6sl.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6sl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6sl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; @@ -222,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -235,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -248,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -309,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -322,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -711,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6sll.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6sll.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6sll.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6sll.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6sx.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6sx.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6sx.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6sx.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi linux-aws-5.19.0/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - ; + ; }; pinctrl_enet1: enet1grp { @@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = , @@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - ; + ; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - ; + ; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - , - ; + , + ; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - ; + ; }; pinctrl_usdhc2: usdhc2grp { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/imx7d-sdb.dts linux-aws-5.19.0/arch/arm/boot/dts/imx7d-sdb.dts --- linux-aws-5.19.0/arch/arm/boot/dts/imx7d-sdb.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/imx7d-sdb.dts 2022-11-29 07:06:46.000000000 +0000 @@ -206,12 +206,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/integratorap.dts linux-aws-5.19.0/arch/arm/boot/dts/integratorap.dts --- linux-aws-5.19.0/arch/arm/boot/dts/integratorap.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/integratorap.dts 2022-11-29 07:06:46.000000000 +0000 @@ -160,6 +160,7 @@ pci: pciv3@62000000 { compatible = "arm,integrator-ap-pci", "v3,v360epc-pci"; + device_type = "pci"; #interrupt-cells = <1>; #size-cells = <2>; #address-cells = <3>; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/kirkwood-lsxl.dtsi linux-aws-5.19.0/arch/arm/boot/dts/kirkwood-lsxl.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/kirkwood-lsxl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/kirkwood-lsxl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; @@ -213,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/lan966x.dtsi linux-aws-5.19.0/arch/arm/boot/dts/lan966x.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/lan966x.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/lan966x.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -515,13 +515,13 @@ phy0: ethernet-phy@1 { reg = <1>; - interrupts = ; + interrupts = ; status = "disabled"; }; phy1: ethernet-phy@2 { reg = <2>; - interrupts = ; + interrupts = ; status = "disabled"; }; }; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/moxart.dtsi linux-aws-5.19.0/arch/arm/boot/dts/moxart.dtsi --- linux-aws-5.19.0/arch/arm/boot/dts/moxart.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/moxart.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -93,8 +93,8 @@ clock-names = "PCLK"; }; - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_apb>; diff -Nru linux-aws-5.19.0/arch/arm/boot/dts/moxart-uc7112lx.dts linux-aws-5.19.0/arch/arm/boot/dts/moxart-uc7112lx.dts --- linux-aws-5.19.0/arch/arm/boot/dts/moxart-uc7112lx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/boot/dts/moxart-uc7112lx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -79,7 +79,7 @@ clocks = <&ref12>; }; -&sdhci { +&mmc { status = "okay"; }; diff -Nru linux-aws-5.19.0/arch/arm/include/asm/stacktrace.h linux-aws-5.19.0/arch/arm/include/asm/stacktrace.h --- linux-aws-5.19.0/arch/arm/include/asm/stacktrace.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/include/asm/stacktrace.h 2022-11-29 07:06:46.000000000 +0000 @@ -21,6 +21,9 @@ struct llist_node *kr_cur; struct task_struct *tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + bool ex_frame; +#endif }; static __always_inline @@ -34,6 +37,9 @@ frame->kr_cur = NULL; frame->tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame = in_entry_text(frame->pc); +#endif } extern int unwind_frame(struct stackframe *frame); diff -Nru linux-aws-5.19.0/arch/arm/Kconfig linux-aws-5.19.0/arch/arm/Kconfig --- linux-aws-5.19.0/arch/arm/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -1653,7 +1653,6 @@ choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available" diff -Nru linux-aws-5.19.0/arch/arm/kernel/return_address.c linux-aws-5.19.0/arch/arm/kernel/return_address.c --- linux-aws-5.19.0/arch/arm/kernel/return_address.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/kernel/return_address.c 2022-11-29 07:06:46.000000000 +0000 @@ -47,6 +47,7 @@ frame.kr_cur = NULL; frame.tsk = current; #endif + frame.ex_frame = false; walk_stackframe(&frame, save_return_addr, &data); diff -Nru linux-aws-5.19.0/arch/arm/kernel/stacktrace.c linux-aws-5.19.0/arch/arm/kernel/stacktrace.c --- linux-aws-5.19.0/arch/arm/kernel/stacktrace.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/kernel/stacktrace.c 2022-11-29 07:06:46.000000000 +0000 @@ -9,6 +9,8 @@ #include #include +#include "reboot.h" + #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) /* * Unwind the current stack frame and store the new register values in the @@ -39,29 +41,74 @@ * Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check(struct stackframe *frame) { unsigned long high, low; unsigned long fp = frame->fp; + unsigned long pc = frame->pc; + + /* + * call_with_stack() is the only place we allow SP to jump from one + * stack to another, with FP and SP pointing to different stacks, + * skipping the FP boundary check at this point. + */ + if (pc >= (unsigned long)&call_with_stack && + pc < (unsigned long)&call_with_stack_end) + return 0; /* only go to a higher address on the stack */ low = frame->sp; high = ALIGN(low, THREAD_SIZE); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low + 4 || fp > high - 4) return -EINVAL; - - frame->sp = frame->fp; - frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); - frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); #else - /* check current frame pointer is within bounds */ if (fp < low + 12 || fp > high - 4) return -EINVAL; +#endif + + return 0; +} + +int notrace unwind_frame(struct stackframe *frame) +{ + unsigned long fp = frame->fp; + + if (frame_pointer_check(frame)) + return -EINVAL; + + /* + * When we unwind through an exception stack, include the saved PC + * value into the stack trace. + */ + if (frame->ex_frame) { + struct pt_regs *regs = (struct pt_regs *)frame->sp; + + /* + * We check that 'regs + sizeof(struct pt_regs)' (that is, + * ®s[1]) does not exceed the bottom of the stack to avoid + * accessing data outside the task's stack. This may happen + * when frame->ex_frame is a false positive. + */ + if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) + return -EINVAL; + + frame->pc = regs->ARM_pc; + frame->ex_frame = false; + return 0; + } /* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); + frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); +#else frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 12)); frame->sp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 8)); frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 4)); @@ -72,6 +119,9 @@ (void *)frame->fp, &frame->kr_cur); #endif + if (in_entry_text(frame->pc)) + frame->ex_frame = true; + return 0; } #endif @@ -102,7 +152,6 @@ { struct stack_trace_data *data = d; struct stack_trace *trace = data->trace; - struct pt_regs *regs; unsigned long addr = frame->pc; if (data->no_sched_functions && in_sched_functions(addr)) @@ -113,19 +162,6 @@ } trace->entries[trace->nr_entries++] = addr; - - if (trace->nr_entries >= trace->max_entries) - return 1; - - if (!in_entry_text(frame->pc)) - return 0; - - regs = (struct pt_regs *)frame->sp; - if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) - return 0; - - trace->entries[trace->nr_entries++] = regs->ARM_pc; - return trace->nr_entries >= trace->max_entries; } @@ -167,6 +203,9 @@ frame.kr_cur = NULL; frame.tsk = tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = false; +#endif walk_stackframe(&frame, save_trace, &data); } @@ -188,6 +227,9 @@ frame.kr_cur = NULL; frame.tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = in_entry_text(frame.pc); +#endif walk_stackframe(&frame, save_trace, &data); } diff -Nru linux-aws-5.19.0/arch/arm/lib/call_with_stack.S linux-aws-5.19.0/arch/arm/lib/call_with_stack.S --- linux-aws-5.19.0/arch/arm/lib/call_with_stack.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/lib/call_with_stack.S 2022-11-29 07:06:46.000000000 +0000 @@ -46,4 +46,6 @@ pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack) diff -Nru linux-aws-5.19.0/arch/arm/mach-at91/pm.c linux-aws-5.19.0/arch/arm/mach-at91/pm.c --- linux-aws-5.19.0/arch/arm/mach-at91/pm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/mach-at91/pm.c 2022-11-29 07:06:46.000000000 +0000 @@ -541,10 +541,42 @@ static int at91_suspend_finish(unsigned long val) { + unsigned char modified_gray_code[] = { + 0x00, 0x01, 0x02, 0x03, 0x06, 0x07, 0x04, 0x05, 0x0c, 0x0d, + 0x0e, 0x0f, 0x0a, 0x0b, 0x08, 0x09, 0x18, 0x19, 0x1a, 0x1b, + 0x1e, 0x1f, 0x1c, 0x1d, 0x14, 0x15, 0x16, 0x17, 0x12, 0x13, + 0x10, 0x11, + }; + unsigned int tmp, index; int i; if (soc_pm.data.mode == AT91_PM_BACKUP && soc_pm.data.ramc_phy) { /* + * Bootloader will perform DDR recalibration and will try to + * restore the ZQ0SR0 with the value saved here. But the + * calibration is buggy and restoring some values from ZQ0SR0 + * is forbidden and risky thus we need to provide processed + * values for these (modified gray code values). + */ + tmp = readl(soc_pm.data.ramc_phy + DDR3PHY_ZQ0SR0); + + /* Store pull-down output impedance select. */ + index = (tmp >> DDR3PHY_ZQ0SR0_PDO_OFF) & 0x1f; + soc_pm.bu->ddr_phy_calibration[0] = modified_gray_code[index]; + + /* Store pull-up output impedance select. */ + index = (tmp >> DDR3PHY_ZQ0SR0_PUO_OFF) & 0x1f; + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; + + /* Store pull-down on-die termination impedance select. */ + index = (tmp >> DDR3PHY_ZQ0SR0_PDODT_OFF) & 0x1f; + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; + + /* Store pull-up on-die termination impedance select. */ + index = (tmp >> DDR3PHY_ZQ0SRO_PUODT_OFF) & 0x1f; + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; + + /* * The 1st 8 words of memory might get corrupted in the process * of DDR PHY recalibration; it is saved here in securam and it * will be restored later, after recalibration, by bootloader @@ -1066,10 +1098,6 @@ of_scan_flat_dt(at91_pm_backup_scan_memcs, &located); if (!located) goto securam_fail; - - /* DDR3PHY_ZQ0SR0 */ - soc_pm.bu->ddr_phy_calibration[0] = readl(soc_pm.data.ramc_phy + - 0x188); } return 0; diff -Nru linux-aws-5.19.0/arch/arm/mach-at91/pm_suspend.S linux-aws-5.19.0/arch/arm/mach-at91/pm_suspend.S --- linux-aws-5.19.0/arch/arm/mach-at91/pm_suspend.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/mach-at91/pm_suspend.S 2022-11-29 07:06:46.000000000 +0000 @@ -172,9 +172,15 @@ /* Put DDR PHY's DLL in bypass mode for non-backup modes. */ cmp r7, #AT91_PM_BACKUP beq sr_ena_3 - ldr tmp1, [r3, #DDR3PHY_PIR] - orr tmp1, tmp1, #DDR3PHY_PIR_DLLBYP - str tmp1, [r3, #DDR3PHY_PIR] + + /* Disable DX DLLs. */ + ldr tmp1, [r3, #DDR3PHY_DX0DLLCR] + orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS + str tmp1, [r3, #DDR3PHY_DX0DLLCR] + + ldr tmp1, [r3, #DDR3PHY_DX1DLLCR] + orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS + str tmp1, [r3, #DDR3PHY_DX1DLLCR] sr_ena_3: /* Power down DDR PHY data receivers. */ @@ -221,10 +227,14 @@ bic tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0 str tmp1, [r3, #DDR3PHY_DSGCR] - /* Take DDR PHY's DLL out of bypass mode. */ - ldr tmp1, [r3, #DDR3PHY_PIR] - bic tmp1, tmp1, #DDR3PHY_PIR_DLLBYP - str tmp1, [r3, #DDR3PHY_PIR] + /* Enable DX DLLs. */ + ldr tmp1, [r3, #DDR3PHY_DX0DLLCR] + bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS + str tmp1, [r3, #DDR3PHY_DX0DLLCR] + + ldr tmp1, [r3, #DDR3PHY_DX1DLLCR] + bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS + str tmp1, [r3, #DDR3PHY_DX1DLLCR] /* Enable quasi-dynamic programming. */ mov tmp1, #0 diff -Nru linux-aws-5.19.0/arch/arm/mm/dump.c linux-aws-5.19.0/arch/arm/mm/dump.c --- linux-aws-5.19.0/arch/arm/mm/dump.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/mm/dump.c 2022-11-29 07:06:46.000000000 +0000 @@ -346,7 +346,7 @@ addr = start + i * PMD_SIZE; domain = get_domain_name(pmd); if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd)) - note_page(st, addr, 3, pmd_val(*pmd), domain); + note_page(st, addr, 4, pmd_val(*pmd), domain); else walk_pte(st, pmd, addr, domain); diff -Nru linux-aws-5.19.0/arch/arm/mm/kasan_init.c linux-aws-5.19.0/arch/arm/mm/kasan_init.c --- linux-aws-5.19.0/arch/arm/mm/kasan_init.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/mm/kasan_init.c 2022-11-29 07:06:46.000000000 +0000 @@ -264,12 +264,17 @@ /* * 1. The module global variables are in MODULES_VADDR ~ MODULES_END, - * so we need to map this area. + * so we need to map this area if CONFIG_KASAN_VMALLOC=n. With + * VMALLOC support KASAN will manage this region dynamically, + * refer to kasan_populate_vmalloc() and ARM's implementation of + * module_alloc(). * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't * use kasan_populate_zero_shadow. */ - create_mapping((void *)MODULES_VADDR, (void *)(PKMAP_BASE + PMD_SIZE)); + if (!IS_ENABLED(CONFIG_KASAN_VMALLOC) && IS_ENABLED(CONFIG_MODULES)) + create_mapping((void *)MODULES_VADDR, (void *)(MODULES_END)); + create_mapping((void *)PKMAP_BASE, (void *)(PKMAP_BASE + PMD_SIZE)); /* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so diff -Nru linux-aws-5.19.0/arch/arm/mm/mmu.c linux-aws-5.19.0/arch/arm/mm/mmu.c --- linux-aws-5.19.0/arch/arm/mm/mmu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm/mm/mmu.c 2022-11-29 07:06:46.000000000 +0000 @@ -300,7 +300,11 @@ .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_XN | L_PTE_RDONLY, .prot_l1 = PMD_TYPE_TABLE, +#ifdef CONFIG_ARM_LPAE + .prot_sect = PMD_TYPE_SECT | L_PMD_SECT_RDONLY | PMD_SECT_AP2, +#else .prot_sect = PMD_TYPE_SECT, +#endif .domain = DOMAIN_KERNEL, }, [MT_ROM] = { diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts 2022-11-29 07:06:46.000000000 +0000 @@ -25,7 +25,6 @@ &enetc_port0 { phy-handle = <&slot1_sgmii>; phy-mode = "2500base-x"; - managed = "in-band-status"; status = "okay"; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts 2022-11-29 07:06:46.000000000 +0000 @@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 { @@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts 2022-11-29 07:06:46.000000000 +0000 @@ -152,11 +152,11 @@ * CPLD_reset is RESET_SOFT in schematic */ gpio-line-names = - "CPLD_D[1]", "CPLD_int", "CPLD_reset", "", - "", "CPLD_D[0]", "", "", - "", "", "", "CPLD_D[2]", - "CPLD_D[3]", "CPLD_D[4]", "CPLD_D[5]", "CPLD_D[6]", - "CPLD_D[7]", "", "", "", + "CPLD_D[6]", "CPLD_int", "CPLD_reset", "", + "", "CPLD_D[7]", "", "", + "", "", "", "CPLD_D[5]", + "CPLD_D[4]", "CPLD_D[3]", "CPLD_D[2]", "CPLD_D[1]", + "CPLD_D[0]", "", "", "", "", "", "", "", "", "", "", "KBD_intK", "", "", "", ""; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -3,6 +3,7 @@ * Copyright 2020-2021 TQ-Systems GmbH */ +#include #include "imx8mm.dtsi" / { diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -5,7 +5,6 @@ /dts-v1/; -#include #include "imx8mm-tqma8mqml.dtsi" #include "mba8mx.dtsi" diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts 2022-11-29 07:06:46.000000000 +0000 @@ -626,24 +626,28 @@ lan1: port@0 { reg = <0>; label = "lan1"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan2: port@1 { reg = <1>; label = "lan2"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan3: port@2 { reg = <2>; label = "lan3"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan4: port@3 { reg = <3>; label = "lan4"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -32,10 +32,10 @@ }; /* Fixed clock dedicated to SPI CAN controller */ - clk20m: oscillator { + clk40m: oscillator { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <20000000>; + clock-frequency = <40000000>; }; gpio-keys { @@ -194,8 +194,8 @@ can1: can@0 { compatible = "microchip,mcp251xfd"; - clocks = <&clk20m>; - interrupts-extended = <&gpio1 6 IRQ_TYPE_EDGE_FALLING>; + clocks = <&clk40m>; + interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_can1_int>; reg = <0>; @@ -359,8 +359,8 @@ nxp,dvs-standby-voltage = <850000>; regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <950000>; - regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1050000>; + regulator-min-microvolt = <805000>; regulator-name = "On-module +VDD_ARM (BUCK2)"; regulator-ramp-delay = <3125>; }; @@ -368,8 +368,8 @@ reg_vdd_dram: BUCK3 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <950000>; - regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1000000>; + regulator-min-microvolt = <805000>; regulator-name = "On-module +VDD_GPU_VPU_DDR (BUCK3)"; }; @@ -408,7 +408,7 @@ reg_vdd_snvs: LDO2 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <900000>; + regulator-max-microvolt = <800000>; regulator-min-microvolt = <800000>; regulator-name = "On-module +V0.8_SNVS (LDO2)"; }; @@ -595,7 +595,7 @@ pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; reg = <0x4a>; /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ - reset-gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; status = "disabled"; }; @@ -737,6 +737,7 @@ }; &usbphynop2 { + power-domains = <&pgc_otg2>; vcc-supply = <®_vdd_3v3>; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -672,7 +672,6 @@ <&clk IMX8MN_CLK_GPU_SHADER>, <&clk IMX8MN_CLK_GPU_BUS_ROOT>, <&clk IMX8MN_CLK_GPU_AHB>; - resets = <&src IMX8MQ_RESET_GPU_RESET>; }; pgc_dispmix: power-domain@3 { diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1168,7 +1168,7 @@ interrupts = ; phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; @@ -1210,7 +1210,7 @@ interrupts = ; phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -123,8 +123,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_reg_can>; regulator-name = "can2_stby"; - gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; - enable-active-high; + gpio = <&gpio3 19 GPIO_ACTIVE_LOW>; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; @@ -484,35 +483,40 @@ lan1: port@0 { reg = <0>; label = "lan1"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan2: port@1 { reg = <1>; label = "lan2"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan3: port@2 { reg = <2>; label = "lan3"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan4: port@3 { reg = <3>; label = "lan4"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan5: port@4 { reg = <4>; label = "lan5"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; - port@6 { - reg = <6>; + port@5 { + reg = <5>; label = "cpu"; ethernet = <&fec>; phy-mode = "rgmii-id"; @@ -770,10 +774,10 @@ pinctrl_sai2: sai2grp { fsl,pins = < - MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC - MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 - MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK - MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK + MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC 0xd6 + MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0xd6 + MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0xd6 + MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 0xd6 >; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -620,7 +620,7 @@ interrupts = <5 IRQ_TYPE_EDGE_FALLING>; reg = <0x4a>; /* Verdin GPIO_2 (SODIMM 208) */ - reset-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; status = "disabled"; }; }; @@ -697,7 +697,7 @@ pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; reg = <0x4a>; /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ - reset-gpios = <&gpio5 0 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; status = "disabled"; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -204,7 +204,6 @@ reg = <0x51>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_rtc>; - interrupt-names = "irq"; interrupt-parent = <&gpio1>; interrupts = <1 IRQ_TYPE_EDGE_FALLING>; quartz-load-femtofarads = <7000>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8ulp.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8ulp.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8ulp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/freescale/imx8ulp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -172,6 +172,7 @@ compatible = "fsl,imx8ulp-pcc3"; reg = <0x292d0000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; tpm5: tpm@29340000 { @@ -270,6 +271,7 @@ compatible = "fsl,imx8ulp-pcc4"; reg = <0x29800000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; lpi2c6: i2c@29840000 { @@ -414,6 +416,7 @@ compatible = "fsl,imx8ulp-pcc5"; reg = <0x2da70000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sdm845-mtp.dts linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sdm845-mtp.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 2022-11-29 07:06:46.000000000 +0000 @@ -536,42 +536,42 @@ reg = ; label = "xo_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4d { reg = ; label = "msm_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4f { reg = ; label = "pa_therm1"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@51 { reg = ; label = "quiet_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@83 { reg = ; label = "vph_pwr"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@85 { reg = ; label = "vcoin"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sm8350.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sm8350.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sm8350.dtsi 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/qcom/sm8350.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -2128,7 +2128,7 @@ ufs_mem_phy: phy@1d87000 { compatible = "qcom,sm8350-qmp-ufs-phy"; - reg = <0 0x01d87000 0 0xe10>; + reg = <0 0x01d87000 0 0x1c4>; #address-cells = <2>; #size-cells = <2>; ranges; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r8a779g0.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r8a779g0.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r8a779g0.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r8a779g0.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -85,7 +85,7 @@ "renesas,rcar-gen4-hscif", "renesas,hscif"; reg = <0 0xe6540000 0 96>; - interrupts = ; + interrupts = ; clocks = <&cpg CPG_MOD 514>, <&cpg CPG_CORE R8A779G0_CLK_S0D3_PER>, <&scif_clk>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g043.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g043.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g043.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g043.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -334,8 +334,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI0_CLKP>; @@ -349,8 +349,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g044.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g044.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g044.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g044.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -394,8 +394,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI0_CLKP>; @@ -409,8 +409,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g054.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g054.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g054.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/renesas/r9a07g054.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -399,8 +399,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI0_CLKP>; @@ -414,8 +414,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -2,8 +2,8 @@ /* * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd * Copyright (c) 2020 Engicam srl - * Copyright (c) 2020 Amarula Solutons - * Copyright (c) 2020 Amarula Solutons(India) + * Copyright (c) 2020 Amarula Solutions + * Copyright (c) 2020 Amarula Solutions(India) */ #include diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts 2022-11-29 07:06:46.000000000 +0000 @@ -88,3 +88,8 @@ }; }; }; + +&wlan_host_wake_l { + /* Kevin has an external pull up, but Bob does not. */ + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; +}; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -244,6 +244,14 @@ &edp { status = "okay"; + /* + * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only + * set this here, because rk3399-gru.dtsi ensures we can generate this + * off GPLL=600MHz, whereas some other RK3399 boards may not. + */ + assigned-clocks = <&cru PCLK_EDP>; + assigned-clock-rates = <24000000>; + ports { edp_out: port@1 { reg = <1>; @@ -578,6 +586,7 @@ }; wlan_host_wake_l: wlan-host-wake-l { + /* Kevin has an external pull up, but Bob does not */ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -62,7 +62,6 @@ vcc5v0_host: vcc5v0-host-regulator { compatible = "regulator-fixed"; gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; - enable-active-low; pinctrl-names = "default"; pinctrl-0 = <&vcc5v0_host_en>; regulator-name = "vcc5v0_host"; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts 2022-11-29 07:06:46.000000000 +0000 @@ -163,7 +163,6 @@ vcc3v3_sd: vcc3v3_sd { compatible = "regulator-fixed"; - enable-active-low; gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&vcc_sd_h>; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts 2022-11-29 07:06:46.000000000 +0000 @@ -506,7 +506,7 @@ disable-wp; pinctrl-names = "default"; pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; - sd-uhs-sdr104; + sd-uhs-sdr50; vmmc-supply = <&vcc3v3_sd>; vqmmc-supply = <&vccio_sd>; status = "okay"; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts 2022-11-29 07:06:46.000000000 +0000 @@ -558,7 +558,7 @@ }; &usb_host0_xhci { - extcon = <&usb2phy0>; + dr_mode = "host"; status = "okay"; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts 2022-11-29 07:06:46.000000000 +0000 @@ -618,7 +618,7 @@ }; &usb2phy0_otg { - vbus-supply = <&vcc5v0_usb_otg>; + phy-supply = <&vcc5v0_usb_otg>; status = "okay"; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts 2022-11-29 07:06:46.000000000 +0000 @@ -543,7 +543,7 @@ }; &usb2phy0_otg { - vbus-supply = <&vcc5v0_usb_otg>; + phy-supply = <&vcc5v0_usb_otg>; status = "okay"; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts --- linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts 2022-11-29 07:06:46.000000000 +0000 @@ -134,15 +134,17 @@ >; }; - main_usbss0_pins_default: main-usbss0-pins-default { + vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ + J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ >; }; +}; - vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { +&main_pmx1 { + main_usbss0_pins_default: main-usbss0-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ + J721E_IOPAD(0x04, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ >; }; }; diff -Nru linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi --- linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -295,7 +295,16 @@ main_pmx0: pinctrl@11c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x11c000 0x00 0x2b4>; + reg = <0x00 0x11c000 0x00 0x10c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + main_pmx1: pinctrl@11c11c { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x11c11c 0x00 0xc>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>; diff -Nru linux-aws-5.19.0/arch/arm64/include/asm/mte.h linux-aws-5.19.0/arch/arm64/include/asm/mte.h --- linux-aws-5.19.0/arch/arm64/include/asm/mte.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/include/asm/mte.h 2022-11-29 07:06:46.000000000 +0000 @@ -42,7 +42,9 @@ void mte_copy_page_tags(void *kto, const void *kfrom); void mte_thread_init_user(void); void mte_thread_switch(struct task_struct *next); +void mte_cpu_setup(void); void mte_suspend_enter(void); +void mte_suspend_exit(void); long set_mte_ctrl(struct task_struct *task, unsigned long arg); long get_mte_ctrl(struct task_struct *task); int mte_ptrace_copy_tags(struct task_struct *child, long request, @@ -72,6 +74,9 @@ static inline void mte_suspend_enter(void) { } +static inline void mte_suspend_exit(void) +{ +} static inline long set_mte_ctrl(struct task_struct *task, unsigned long arg) { return 0; diff -Nru linux-aws-5.19.0/arch/arm64/Kconfig linux-aws-5.19.0/arch/arm64/Kconfig --- linux-aws-5.19.0/arch/arm64/Kconfig 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -629,6 +629,23 @@ config ARM64_WORKAROUND_REPEAT_TLBI bool +config ARM64_ERRATUM_2441007 + bool "Cortex-A55: Completion of affected memory accesses might not be guaranteed by completion of a TLBI" + default y + select ARM64_WORKAROUND_REPEAT_TLBI + help + This option adds a workaround for ARM Cortex-A55 erratum #2441007. + + Under very rare circumstances, affected Cortex-A55 CPUs + may not handle a race between a break-before-make sequence on one + CPU, and another CPU accessing the same page. This could allow a + store to a page that has been unmapped. + + Work around this by adding the affected CPUs to the list that needs + TLB sequences to be done twice. + + If unsure, say Y. + config ARM64_ERRATUM_1286807 bool "Cortex-A76: Modification of the translation table for a virtual address might lead to read-after-read ordering violation" default y @@ -914,6 +931,23 @@ If unsure, say Y. +config ARM64_ERRATUM_2457168 + bool "Cortex-A510: 2457168: workaround for AMEVCNTR01 incrementing incorrectly" + depends on ARM64_AMU_EXTN + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 2457168. + + The AMU counter AMEVCNTR01 (constant counter) should increment at the same rate + as the system counter. On affected Cortex-A510 cores AMEVCNTR01 increments + incorrectly giving a significantly higher output value. + + Work around this problem by returning 0 when reading the affected counter in + key locations that results in disabling all users of this counter. This effect + is the same to firmware disabling affected counters. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y @@ -1868,6 +1902,8 @@ depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697 depends on !CC_IS_GCC || GCC_VERSION >= 100100 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106671 + depends on !CC_IS_GCC # https://github.com/llvm/llvm-project/commit/a88c722e687e6780dcd6a58718350dc76fcc4cc9 depends on !CC_IS_CLANG || CLANG_VERSION >= 120000 depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS) diff -Nru linux-aws-5.19.0/arch/arm64/kernel/cpu_errata.c linux-aws-5.19.0/arch/arm64/kernel/cpu_errata.c --- linux-aws-5.19.0/arch/arm64/kernel/cpu_errata.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/cpu_errata.c 2022-11-29 07:06:46.000000000 +0000 @@ -214,6 +214,11 @@ ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), }, #endif +#ifdef CONFIG_ARM64_ERRATUM_2441007 + { + ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + }, +#endif #ifdef CONFIG_ARM64_ERRATUM_2441009 { /* Cortex-A510 r0p0 -> r1p1. Fixed in r1p2 */ @@ -656,6 +661,16 @@ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) }, #endif +#ifdef CONFIG_ARM64_ERRATUM_2457168 + { + .desc = "ARM erratum 2457168", + .capability = ARM64_WORKAROUND_2457168, + .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, + + /* Cortex-A510 r0p0-r1p1 */ + CAP_MIDR_RANGE(MIDR_CORTEX_A510, 0, 0, 1, 1) + }, +#endif #ifdef CONFIG_ARM64_ERRATUM_2038923 { .desc = "ARM erratum 2038923", diff -Nru linux-aws-5.19.0/arch/arm64/kernel/cpufeature.c linux-aws-5.19.0/arch/arm64/kernel/cpufeature.c --- linux-aws-5.19.0/arch/arm64/kernel/cpufeature.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/cpufeature.c 2022-11-29 07:06:46.000000000 +0000 @@ -1798,7 +1798,10 @@ pr_info("detected CPU%d: Activity Monitors Unit (AMU)\n", smp_processor_id()); cpumask_set_cpu(smp_processor_id(), &amu_cpus); - update_freq_counters_refs(); + + /* 0 reference values signal broken/disabled counters */ + if (!this_cpu_has_cap(ARM64_WORKAROUND_2457168)) + update_freq_counters_refs(); } } @@ -1959,7 +1962,8 @@ static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) { sysreg_clear_set(sctlr_el1, 0, SCTLR_ELx_ATA | SCTLR_EL1_ATA0); - isb(); + + mte_cpu_setup(); /* * Clear the tags in the zero page. This needs to be done via the diff -Nru linux-aws-5.19.0/arch/arm64/kernel/ftrace.c linux-aws-5.19.0/arch/arm64/kernel/ftrace.c --- linux-aws-5.19.0/arch/arm64/kernel/ftrace.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/ftrace.c 2022-11-29 07:06:46.000000000 +0000 @@ -217,11 +217,26 @@ unsigned long pc = rec->ip; u32 old = 0, new; + new = aarch64_insn_gen_nop(); + + /* + * When using mcount, callsites in modules may have been initalized to + * call an arbitrary module PLT (which redirects to the _mcount stub) + * rather than the ftrace PLT we'll use at runtime (which redirects to + * the ftrace trampoline). We can ignore the old PLT when initializing + * the callsite. + * + * Note: 'mod' is only set at module load time. + */ + if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && + IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && mod) { + return aarch64_insn_patch_text_nosync((void *)pc, new); + } + if (!ftrace_find_callable_addr(rec, mod, &addr)) return -EINVAL; old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); - new = aarch64_insn_gen_nop(); return ftrace_modify_code(pc, old, new, true); } diff -Nru linux-aws-5.19.0/arch/arm64/kernel/hibernate.c linux-aws-5.19.0/arch/arm64/kernel/hibernate.c --- linux-aws-5.19.0/arch/arm64/kernel/hibernate.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/hibernate.c 2022-07-31 21:03:01.000000000 +0000 @@ -300,6 +300,11 @@ unsigned long pfn = xa_state.xa_index; struct page *page = pfn_to_online_page(pfn); + /* + * It is not required to invoke page_kasan_tag_reset(page) + * at this point since the tags stored in page->flags are + * already restored. + */ mte_restore_page_tags(page_address(page), tags); mte_free_tag_storage(tags); diff -Nru linux-aws-5.19.0/arch/arm64/kernel/machine_kexec_file.c linux-aws-5.19.0/arch/arm64/kernel/machine_kexec_file.c --- linux-aws-5.19.0/arch/arm64/kernel/machine_kexec_file.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/machine_kexec_file.c 2022-11-29 07:06:46.000000000 +0000 @@ -47,7 +47,7 @@ u64 i; phys_addr_t start, end; - nr_ranges = 1; /* for exclusion of crashkernel region */ + nr_ranges = 2; /* for exclusion of crashkernel region */ for_each_mem_range(i, &start, &end) nr_ranges++; diff -Nru linux-aws-5.19.0/arch/arm64/kernel/mte.c linux-aws-5.19.0/arch/arm64/kernel/mte.c --- linux-aws-5.19.0/arch/arm64/kernel/mte.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/mte.c 2022-11-29 07:06:46.000000000 +0000 @@ -48,6 +48,15 @@ if (!pte_is_tagged) return; + page_kasan_tag_reset(page); + /* + * We need smp_wmb() in between setting the flags and clearing the + * tags because if another thread reads page->flags and builds a + * tagged address out of it, there is an actual dependency to the + * memory access, but on the current thread we do not guarantee that + * the new page->flags are visible before the tags were updated. + */ + smp_wmb(); mte_clear_page_tags(page_address(page)); } @@ -285,6 +294,49 @@ mte_check_tfsr_el1(); } +void mte_cpu_setup(void) +{ + u64 rgsr; + + /* + * CnP must be enabled only after the MAIR_EL1 register has been set + * up. Inconsistent MAIR_EL1 between CPUs sharing the same TLB may + * lead to the wrong memory type being used for a brief window during + * CPU power-up. + * + * CnP is not a boot feature so MTE gets enabled before CnP, but let's + * make sure that is the case. + */ + BUG_ON(read_sysreg(ttbr0_el1) & TTBR_CNP_BIT); + BUG_ON(read_sysreg(ttbr1_el1) & TTBR_CNP_BIT); + + /* Normal Tagged memory type at the corresponding MAIR index */ + sysreg_clear_set(mair_el1, + MAIR_ATTRIDX(MAIR_ATTR_MASK, MT_NORMAL_TAGGED), + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_TAGGED, + MT_NORMAL_TAGGED)); + + write_sysreg_s(KERNEL_GCR_EL1, SYS_GCR_EL1); + + /* + * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then + * RGSR_EL1.SEED must be non-zero for IRG to produce + * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we + * must initialize it. + */ + rgsr = (read_sysreg(CNTVCT_EL0) & SYS_RGSR_EL1_SEED_MASK) << + SYS_RGSR_EL1_SEED_SHIFT; + if (rgsr == 0) + rgsr = 1 << SYS_RGSR_EL1_SEED_SHIFT; + write_sysreg_s(rgsr, SYS_RGSR_EL1); + + /* clear any pending tag check faults in TFSR*_EL1 */ + write_sysreg_s(0, SYS_TFSR_EL1); + write_sysreg_s(0, SYS_TFSRE0_EL1); + + local_flush_tlb_all(); +} + void mte_suspend_enter(void) { if (!system_supports_mte()) @@ -301,6 +353,14 @@ mte_check_tfsr_el1(); } +void mte_suspend_exit(void) +{ + if (!system_supports_mte()) + return; + + mte_cpu_setup(); +} + long set_mte_ctrl(struct task_struct *task, unsigned long arg) { u64 mte_ctrl = (~((arg & PR_MTE_TAG_MASK) >> PR_MTE_TAG_SHIFT) & diff -Nru linux-aws-5.19.0/arch/arm64/kernel/suspend.c linux-aws-5.19.0/arch/arm64/kernel/suspend.c --- linux-aws-5.19.0/arch/arm64/kernel/suspend.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/suspend.c 2022-11-29 07:06:46.000000000 +0000 @@ -43,6 +43,8 @@ { unsigned int cpu = smp_processor_id(); + mte_suspend_exit(); + /* * We are resuming from reset with the idmap active in TTBR0_EL1. * We must uninstall the idmap and restore the expected MMU diff -Nru linux-aws-5.19.0/arch/arm64/kernel/topology.c linux-aws-5.19.0/arch/arm64/kernel/topology.c --- linux-aws-5.19.0/arch/arm64/kernel/topology.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/kernel/topology.c 2022-11-29 07:06:46.000000000 +0000 @@ -22,46 +22,6 @@ #include #include -void store_cpu_topology(unsigned int cpuid) -{ - struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; - u64 mpidr; - - if (cpuid_topo->package_id != -1) - goto topology_populated; - - mpidr = read_cpuid_mpidr(); - - /* Uniprocessor systems can rely on default topology values */ - if (mpidr & MPIDR_UP_BITMASK) - return; - - /* - * This would be the place to create cpu topology based on MPIDR. - * - * However, it cannot be trusted to depict the actual topology; some - * pieces of the architecture enforce an artificial cap on Aff0 values - * (e.g. GICv3's ICC_SGI1R_EL1 limits it to 15), leading to an - * artificial cycling of Aff1, Aff2 and Aff3 values. IOW, these end up - * having absolutely no relationship to the actual underlying system - * topology, and cannot be reasonably used as core / package ID. - * - * If the MT bit is set, Aff0 *could* be used to define a thread ID, but - * we still wouldn't be able to obtain a sane core ID. This means we - * need to entirely ignore MPIDR for any topology deduction. - */ - cpuid_topo->thread_id = -1; - cpuid_topo->core_id = cpuid; - cpuid_topo->package_id = cpu_to_node(cpuid); - - pr_debug("CPU%u: cluster %d core %d thread %d mpidr %#016llx\n", - cpuid, cpuid_topo->package_id, cpuid_topo->core_id, - cpuid_topo->thread_id, mpidr); - -topology_populated: - update_siblings_masks(cpuid); -} - #ifdef CONFIG_ACPI static bool __init acpi_cpu_is_threaded(int cpu) { @@ -251,7 +211,7 @@ for_each_cpu(cpu, cpus) { if (!freq_counters_valid(cpu) || freq_inv_set_max_ratio(cpu, - cpufreq_get_hw_max_freq(cpu) * 1000, + cpufreq_get_hw_max_freq(cpu) * 1000ULL, arch_timer_get_rate())) return; } @@ -310,12 +270,25 @@ static void cpu_read_corecnt(void *val) { + /* + * A value of 0 can be returned if the current CPU does not support AMUs + * or if the counter is disabled for this CPU. A return value of 0 at + * counter read is properly handled as an error case by the users of the + * counter. + */ *(u64 *)val = read_corecnt(); } static void cpu_read_constcnt(void *val) { - *(u64 *)val = read_constcnt(); + /* + * Return 0 if the current CPU is affected by erratum 2457168. A value + * of 0 is also returned if the current CPU does not support AMUs or if + * the counter is disabled. A return value of 0 at counter read is + * properly handled as an error case by the users of the counter. + */ + *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_2457168) ? + 0UL : read_constcnt(); } static inline @@ -342,7 +315,22 @@ */ bool cpc_ffh_supported(void) { - return freq_counters_valid(get_cpu_with_amu_feat()); + int cpu = get_cpu_with_amu_feat(); + + /* + * FFH is considered supported if there is at least one present CPU that + * supports AMUs. Using FFH to read core and reference counters for CPUs + * that do not support AMUs, have counters disabled or that are affected + * by errata, will result in a return value of 0. + * + * This is done to allow any enabled and valid counters to be read + * through FFH, knowing that potentially returning 0 as counter value is + * properly handled by the users of these counters. + */ + if ((cpu >= nr_cpu_ids) || !cpumask_test_cpu(cpu, cpu_present_mask)) + return false; + + return true; } int cpc_read_ffh(int cpu, struct cpc_reg *reg, u64 *val) diff -Nru linux-aws-5.19.0/arch/arm64/mm/copypage.c linux-aws-5.19.0/arch/arm64/mm/copypage.c --- linux-aws-5.19.0/arch/arm64/mm/copypage.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/mm/copypage.c 2022-07-31 21:03:01.000000000 +0000 @@ -23,6 +23,15 @@ if (system_supports_mte() && test_bit(PG_mte_tagged, &from->flags)) { set_bit(PG_mte_tagged, &to->flags); + page_kasan_tag_reset(to); + /* + * We need smp_wmb() in between setting the flags and clearing the + * tags because if another thread reads page->flags and builds a + * tagged address out of it, there is an actual dependency to the + * memory access, but on the current thread we do not guarantee that + * the new page->flags are visible before the tags were updated. + */ + smp_wmb(); mte_copy_page_tags(kto, kfrom); } } diff -Nru linux-aws-5.19.0/arch/arm64/mm/mteswap.c linux-aws-5.19.0/arch/arm64/mm/mteswap.c --- linux-aws-5.19.0/arch/arm64/mm/mteswap.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/mm/mteswap.c 2022-07-31 21:03:01.000000000 +0000 @@ -53,6 +53,15 @@ if (!tags) return false; + page_kasan_tag_reset(page); + /* + * We need smp_wmb() in between setting the flags and clearing the + * tags because if another thread reads page->flags and builds a + * tagged address out of it, there is an actual dependency to the + * memory access, but on the current thread we do not guarantee that + * the new page->flags are visible before the tags were updated. + */ + smp_wmb(); mte_restore_page_tags(page_address(page), tags); return true; diff -Nru linux-aws-5.19.0/arch/arm64/mm/proc.S linux-aws-5.19.0/arch/arm64/mm/proc.S --- linux-aws-5.19.0/arch/arm64/mm/proc.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/mm/proc.S 2022-11-29 07:06:46.000000000 +0000 @@ -47,17 +47,19 @@ #ifdef CONFIG_KASAN_HW_TAGS #define TCR_MTE_FLAGS TCR_TCMA1 | TCR_TBI1 | TCR_TBID1 -#else +#elif defined(CONFIG_ARM64_MTE) /* * The mte_zero_clear_page_tags() implementation uses DC GZVA, which relies on * TBI being enabled at EL1. */ #define TCR_MTE_FLAGS TCR_TBI1 | TCR_TBID1 +#else +#define TCR_MTE_FLAGS 0 #endif /* * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal memory and - * changed during __cpu_setup to Normal Tagged if the system supports MTE. + * changed during mte_cpu_setup to Normal Tagged if the system supports MTE. */ #define MAIR_EL1_SET \ (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ @@ -421,46 +423,8 @@ mov_q mair, MAIR_EL1_SET mov_q tcr, TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ TCR_TG_FLAGS | TCR_KASLR_FLAGS | TCR_ASID16 | \ - TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS - -#ifdef CONFIG_ARM64_MTE - /* - * Update MAIR_EL1, GCR_EL1 and TFSR*_EL1 if MTE is supported - * (ID_AA64PFR1_EL1[11:8] > 1). - */ - mrs x10, ID_AA64PFR1_EL1 - ubfx x10, x10, #ID_AA64PFR1_MTE_SHIFT, #4 - cmp x10, #ID_AA64PFR1_MTE - b.lt 1f - - /* Normal Tagged memory type at the corresponding MAIR index */ - mov x10, #MAIR_ATTR_NORMAL_TAGGED - bfi mair, x10, #(8 * MT_NORMAL_TAGGED), #8 + TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS | TCR_MTE_FLAGS - mov x10, #KERNEL_GCR_EL1 - msr_s SYS_GCR_EL1, x10 - - /* - * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then - * RGSR_EL1.SEED must be non-zero for IRG to produce - * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we - * must initialize it. - */ - mrs x10, CNTVCT_EL0 - ands x10, x10, #SYS_RGSR_EL1_SEED_MASK - csinc x10, x10, xzr, ne - lsl x10, x10, #SYS_RGSR_EL1_SEED_SHIFT - msr_s SYS_RGSR_EL1, x10 - - /* clear any pending tag check faults in TFSR*_EL1 */ - msr_s SYS_TFSR_EL1, xzr - msr_s SYS_TFSRE0_EL1, xzr - - /* set the TCR_EL1 bits */ - mov_q x10, TCR_MTE_FLAGS - orr tcr, tcr, x10 -1: -#endif tcr_clear_errata_bits tcr, x9, x5 #ifdef CONFIG_ARM64_VA_BITS_52 diff -Nru linux-aws-5.19.0/arch/arm64/tools/cpucaps linux-aws-5.19.0/arch/arm64/tools/cpucaps --- linux-aws-5.19.0/arch/arm64/tools/cpucaps 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/arm64/tools/cpucaps 2022-11-29 07:06:46.000000000 +0000 @@ -66,6 +66,7 @@ WORKAROUND_2038923 WORKAROUND_2064142 WORKAROUND_2077057 +WORKAROUND_2457168 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE diff -Nru linux-aws-5.19.0/arch/ia64/mm/numa.c linux-aws-5.19.0/arch/ia64/mm/numa.c --- linux-aws-5.19.0/arch/ia64/mm/numa.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/ia64/mm/numa.c 2022-11-29 07:06:46.000000000 +0000 @@ -75,5 +75,6 @@ return 0; return nid; } +EXPORT_SYMBOL(memory_add_physaddr_to_nid); #endif #endif diff -Nru linux-aws-5.19.0/arch/loongarch/include/asm/acpi.h linux-aws-5.19.0/arch/loongarch/include/asm/acpi.h --- linux-aws-5.19.0/arch/loongarch/include/asm/acpi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/loongarch/include/asm/acpi.h 2022-11-29 07:06:46.000000000 +0000 @@ -15,7 +15,7 @@ extern int acpi_noirq; #define acpi_os_ioremap acpi_os_ioremap -void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); static inline void disable_acpi(void) { diff -Nru linux-aws-5.19.0/arch/loongarch/Kconfig linux-aws-5.19.0/arch/loongarch/Kconfig --- linux-aws-5.19.0/arch/loongarch/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/loongarch/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -36,6 +36,7 @@ select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION + select ARCH_KEEP_MEMBLOCK select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ARCH_SPARSEMEM_ENABLE diff -Nru linux-aws-5.19.0/arch/loongarch/kernel/acpi.c linux-aws-5.19.0/arch/loongarch/kernel/acpi.c --- linux-aws-5.19.0/arch/loongarch/kernel/acpi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/loongarch/kernel/acpi.c 2022-11-29 07:06:46.000000000 +0000 @@ -113,7 +113,7 @@ early_memunmap(map, size); } -void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { if (!memblock_is_memory(phys)) return ioremap(phys, size); diff -Nru linux-aws-5.19.0/arch/loongarch/mm/init.c linux-aws-5.19.0/arch/loongarch/mm/init.c --- linux-aws-5.19.0/arch/loongarch/mm/init.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/loongarch/mm/init.c 2022-11-29 07:06:46.000000000 +0000 @@ -131,18 +131,6 @@ return ret; } -#ifdef CONFIG_NUMA -int memory_add_physaddr_to_nid(u64 start) -{ - int nid; - - nid = pa_to_nid(start); - return nid; -} -EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); -#endif - -#ifdef CONFIG_MEMORY_HOTREMOVE void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap) { unsigned long start_pfn = start >> PAGE_SHIFT; @@ -154,6 +142,16 @@ page += vmem_altmap_offset(altmap); __remove_pages(start_pfn, nr_pages, altmap); } + +#ifdef CONFIG_NUMA +int memory_add_physaddr_to_nid(u64 start) +{ + int nid; + + nid = pa_to_nid(start); + return nid; +} +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); #endif #endif diff -Nru linux-aws-5.19.0/arch/mips/bcm47xx/prom.c linux-aws-5.19.0/arch/mips/bcm47xx/prom.c --- linux-aws-5.19.0/arch/mips/bcm47xx/prom.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/bcm47xx/prom.c 2022-11-29 07:06:46.000000000 +0000 @@ -86,7 +86,7 @@ pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -159,7 +159,7 @@ off = EXTVBASE + __pa(off); for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) { - if (!memcmp(prom_init, (void *)(off + extmem), 16)) + if (!memcmp((void *)prom_init, (void *)(off + extmem), 16)) break; } extmem -= lowmem; diff -Nru linux-aws-5.19.0/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts linux-aws-5.19.0/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts --- linux-aws-5.19.0/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts 2022-11-29 07:06:46.000000000 +0000 @@ -83,12 +83,12 @@ &gmac1 { status = "okay"; - phy-handle = <ðphy7>; + phy-handle = <ðphy5>; }; &mdio { - ethphy7: ethernet-phy@7 { - reg = <7>; + ethphy5: ethernet-phy@5 { + reg = <5>; phy-mode = "rgmii-rxid"; }; }; diff -Nru linux-aws-5.19.0/arch/mips/lantiq/clk.c linux-aws-5.19.0/arch/mips/lantiq/clk.c --- linux-aws-5.19.0/arch/mips/lantiq/clk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/lantiq/clk.c 2022-11-29 07:06:46.000000000 +0000 @@ -50,6 +50,7 @@ { return &cpu_clk_generic[2]; } +EXPORT_SYMBOL_GPL(clk_get_io); struct clk *clk_get_ppe(void) { diff -Nru linux-aws-5.19.0/arch/mips/loongson32/common/platform.c linux-aws-5.19.0/arch/mips/loongson32/common/platform.c --- linux-aws-5.19.0/arch/mips/loongson32/common/platform.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/loongson32/common/platform.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,7 +98,7 @@ if (plat_dat->bus_id) { __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 | GMAC1_USE_UART0, LS1X_MUX_CTRL0); - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &= ~(GMAC1_USE_TXCLK | GMAC1_USE_PWM23); break; @@ -107,12 +107,12 @@ break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &= ~GMAC1_SHUT; } else { - switch (plat_dat->interface) { + switch (plat_dat->phy_interface) { case PHY_INTERFACE_MODE_RGMII: val &= ~(GMAC0_USE_TXCLK | GMAC0_USE_PWM01); break; @@ -121,7 +121,7 @@ break; default: pr_err("unsupported mii mode %d\n", - plat_dat->interface); + plat_dat->phy_interface); return -ENOTSUPP; } val &= ~GMAC0_SHUT; @@ -131,7 +131,7 @@ plat_dat = dev_get_platdata(&pdev->dev); val &= ~PHY_INTF_SELI; - if (plat_dat->interface == PHY_INTERFACE_MODE_RMII) + if (plat_dat->phy_interface == PHY_INTERFACE_MODE_RMII) val |= 0x4 << PHY_INTF_SELI_SHIFT; __raw_writel(val, LS1X_MUX_CTRL1); @@ -146,9 +146,9 @@ .bus_id = 0, .phy_addr = -1, #if defined(CONFIG_LOONGSON1_LS1B) - .interface = PHY_INTERFACE_MODE_MII, + .phy_interface = PHY_INTERFACE_MODE_MII, #elif defined(CONFIG_LOONGSON1_LS1C) - .interface = PHY_INTERFACE_MODE_RMII, + .phy_interface = PHY_INTERFACE_MODE_RMII, #endif .mdio_bus_data = &ls1x_mdio_bus_data, .dma_cfg = &ls1x_eth_dma_cfg, @@ -186,7 +186,7 @@ static struct plat_stmmacenet_data ls1x_eth1_pdata = { .bus_id = 1, .phy_addr = -1, - .interface = PHY_INTERFACE_MODE_MII, + .phy_interface = PHY_INTERFACE_MODE_MII, .mdio_bus_data = &ls1x_mdio_bus_data, .dma_cfg = &ls1x_eth_dma_cfg, .has_gmac = 1, diff -Nru linux-aws-5.19.0/arch/mips/loongson32/ls1c/board.c linux-aws-5.19.0/arch/mips/loongson32/ls1c/board.c --- linux-aws-5.19.0/arch/mips/loongson32/ls1c/board.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/loongson32/ls1c/board.c 2022-11-29 07:06:46.000000000 +0000 @@ -15,7 +15,6 @@ static int __init ls1c_platform_init(void) { ls1x_serial_set_uartclk(&ls1x_uart_pdev); - ls1x_rtc_set_extclk(&ls1x_rtc_pdev); return platform_add_devices(ls1c_platform_devices, ARRAY_SIZE(ls1c_platform_devices)); diff -Nru linux-aws-5.19.0/arch/mips/sgi-ip27/ip27-xtalk.c linux-aws-5.19.0/arch/mips/sgi-ip27/ip27-xtalk.c --- linux-aws-5.19.0/arch/mips/sgi-ip27/ip27-xtalk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/sgi-ip27/ip27-xtalk.c 2022-11-29 07:06:46.000000000 +0000 @@ -27,15 +27,18 @@ { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; unsigned long offset; offset = NODE_OFFSET(nasid); wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", offset + (widget << SWIN_SIZE_BITS)); @@ -46,24 +49,35 @@ w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform resources.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_bd; } @@ -84,15 +98,31 @@ bd->io.flags = IORESOURCE_IO; bd->io_offset = offset; - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return; -no_mem: - pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static int probe_one_port(nasid_t nasid, int widget, int masterwid) diff -Nru linux-aws-5.19.0/arch/mips/sgi-ip30/ip30-xtalk.c linux-aws-5.19.0/arch/mips/sgi-ip30/ip30-xtalk.c --- linux-aws-5.19.0/arch/mips/sgi-ip30/ip30-xtalk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/mips/sgi-ip30/ip30-xtalk.c 2022-11-29 07:06:46.000000000 +0000 @@ -40,12 +40,15 @@ { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", IP30_SWIN_BASE(widget)); @@ -56,24 +59,35 @@ w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:%x bridge failed to add platform resources.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_bd; } bd->bridge_addr = IP30_RAW_SWIN_BASE(widget); @@ -93,15 +107,31 @@ bd->io.flags = IORESOURCE_IO; bd->io_offset = IP30_SWIN_BASE(widget); - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:%x bridge widget\n", widget); return; -no_mem: - pr_warn("xtalk:%x bridge create out of memory\n", widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static unsigned int __init xbow_widget_active(s8 wid) diff -Nru linux-aws-5.19.0/arch/parisc/include/asm/bitops.h linux-aws-5.19.0/arch/parisc/include/asm/bitops.h --- linux-aws-5.19.0/arch/parisc/include/asm/bitops.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/parisc/include/asm/bitops.h 2022-11-29 07:06:46.000000000 +0000 @@ -12,14 +12,6 @@ #include #include -/* compiler build environment sanity checks: */ -#if !defined(CONFIG_64BIT) && defined(__LP64__) -#error "Please use 'ARCH=parisc' to build the 32-bit kernel." -#endif -#if defined(CONFIG_64BIT) && !defined(__LP64__) -#error "Please use 'ARCH=parisc64' to build the 64-bit kernel." -#endif - /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion * on use of volatile and __*_bit() (set/clear/change): * *_bit() want use of volatile. diff -Nru linux-aws-5.19.0/arch/parisc/include/asm/pgtable.h linux-aws-5.19.0/arch/parisc/include/asm/pgtable.h --- linux-aws-5.19.0/arch/parisc/include/asm/pgtable.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/parisc/include/asm/pgtable.h 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,11 @@ #define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */ #define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */ #define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */ +#ifdef CONFIG_HUGETLB_PAGE +#define _PAGE_SPECIAL_BIT _PAGE_DMB_BIT /* DMB feature is currently unused */ +#else +#define _PAGE_SPECIAL_BIT _PAGE_HPAGE_BIT /* use unused HUGE PAGE bit */ +#endif /* N.B. The bits are defined in terms of a 32 bit word above, so the */ /* following macro is ok for both 32 and 64 bit. */ @@ -219,7 +224,7 @@ #define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) #define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT)) #define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT)) -#define _PAGE_SPECIAL (_PAGE_DMB) +#define _PAGE_SPECIAL (1 << xlate_pabit(_PAGE_SPECIAL_BIT)) #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_SPECIAL) diff -Nru linux-aws-5.19.0/arch/parisc/Kconfig linux-aws-5.19.0/arch/parisc/Kconfig --- linux-aws-5.19.0/arch/parisc/Kconfig 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/parisc/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -225,8 +225,18 @@ Enabling this option will probably slow down your kernel. config 64BIT - def_bool "$(ARCH)" = "parisc64" + def_bool y if "$(ARCH)" = "parisc64" + bool "64-bit kernel" if "$(ARCH)" = "parisc" depends on PA8X00 + help + Enable this if you want to support 64bit kernel on PA-RISC platform. + + At the moment, only people willing to use more than 2GB of RAM, + or having a 64bit-only capable PA-RISC machine should say Y here. + + Since there is no 64bit userland on PA-RISC, there is no point to + enable this option otherwise. The 64bit kernel is significantly bigger + and slower than the 32bit one. choice prompt "Kernel page size" diff -Nru linux-aws-5.19.0/arch/parisc/kernel/entry.S linux-aws-5.19.0/arch/parisc/kernel/entry.S --- linux-aws-5.19.0/arch/parisc/kernel/entry.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/parisc/kernel/entry.S 2022-11-29 07:06:46.000000000 +0000 @@ -499,6 +499,10 @@ * Finally, _PAGE_READ goes in the top bit of PL1 (so we * trigger an access rights trap in user space if the user * tries to read an unreadable page */ +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif depd \pte,8,7,\prot /* PAGE_USER indicates the page can be read with user privileges, @@ -529,6 +533,10 @@ * makes the tlb entry for the differently formatted pa11 * insertion instructions */ .macro make_insert_tlb_11 spc,pte,prot +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif zdep \spc,30,15,\prot dep \pte,8,7,\prot extru,= \pte,_PAGE_NO_CACHE_BIT,1,%r0 diff -Nru linux-aws-5.19.0/arch/parisc/kernel/head.S linux-aws-5.19.0/arch/parisc/kernel/head.S --- linux-aws-5.19.0/arch/parisc/kernel/head.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/parisc/kernel/head.S 2022-11-29 07:06:46.000000000 +0000 @@ -22,7 +22,7 @@ #include #include - .level PA_ASM_LEVEL + .level 1.1 __INITDATA ENTRY(boot_args) @@ -70,6 +70,47 @@ 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. */ + ldi 32,%r10 + mtctl %r10,%cr11 + .level 2.0 + mfctl,w %cr11,%r10 + .level 1.1 + comib,<>,n 0,%r10,$cpu_ok + + load32 PA(msg1),%arg0 + ldi msg1_end-msg1,%arg1 +$iodc_panic: + copy %arg0, %r10 + copy %arg1, %r11 + load32 PA(init_stack),%sp +#define MEM_CONS 0x3A0 + ldw MEM_CONS+32(%r0),%arg0 // HPA + ldi ENTRY_IO_COUT,%arg1 + ldw MEM_CONS+36(%r0),%arg2 // SPA + ldw MEM_CONS+8(%r0),%arg3 // layers + load32 PA(__bss_start),%r1 + stw %r1,-52(%sp) // arg4 + stw %r0,-56(%sp) // arg5 + stw %r10,-60(%sp) // arg6 = ptr to text + stw %r11,-64(%sp) // arg7 = len + stw %r0,-68(%sp) // arg8 + load32 PA(.iodc_panic_ret), %rp + ldw MEM_CONS+40(%r0),%r1 // ENTRY_IODC + bv,n (%r1) +.iodc_panic_ret: + b . /* wait endless with ... */ + or %r10,%r10,%r10 /* qemu idle sleep */ +msg1: .ascii "Can't boot kernel which was built for PA8x00 CPUs on this machine.\r\n" +msg1_end: + +$cpu_ok: +#endif + + .level PA_ASM_LEVEL + /* Initialize startup VM. Just map first 16/32 MB of memory */ load32 PA(swapper_pg_dir),%r4 mtctl %r4,%cr24 /* Initialize kernel root pointer */ diff -Nru linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi --- linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +}; diff -Nru linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8540ads.dts linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8540ads.dts --- linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8540ads.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8540ads.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS"; diff -Nru linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8541cds.dts linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8541cds.dts --- linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8541cds.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8541cds.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS"; diff -Nru linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8555cds.dts linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8555cds.dts --- linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8555cds.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8555cds.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS"; diff -Nru linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8560ads.dts linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8560ads.dts --- linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8560ads.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/dts/fsl/mpc8560ads.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; diff -Nru linux-aws-5.19.0/arch/powerpc/boot/Makefile linux-aws-5.19.0/arch/powerpc/boot/Makefile --- linux-aws-5.19.0/arch/powerpc/boot/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/boot/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -34,6 +34,7 @@ BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ $(LINUXINCLUDE) diff -Nru linux-aws-5.19.0/arch/powerpc/configs/pseries_defconfig linux-aws-5.19.0/arch/powerpc/configs/pseries_defconfig --- linux-aws-5.19.0/arch/powerpc/configs/pseries_defconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/configs/pseries_defconfig 2022-11-29 07:06:46.000000000 +0000 @@ -40,6 +40,7 @@ CONFIG_DTL=y CONFIG_PPC_SMLPAR=y CONFIG_IBMEBUS=y +CONFIG_LIBNVDIMM=m CONFIG_PAPR_SCM=m CONFIG_PPC_SVM=y # CONFIG_PPC_PMAC is not set diff -Nru linux-aws-5.19.0/arch/powerpc/include/asm/firmware.h linux-aws-5.19.0/arch/powerpc/include/asm/firmware.h --- linux-aws-5.19.0/arch/powerpc/include/asm/firmware.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/include/asm/firmware.h 2022-11-29 07:06:46.000000000 +0000 @@ -82,6 +82,8 @@ FW_FEATURE_POWERNV_ALWAYS = 0, FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, + FW_FEATURE_NATIVE_POSSIBLE = 0, + FW_FEATURE_NATIVE_ALWAYS = 0, FW_FEATURE_POSSIBLE = #ifdef CONFIG_PPC_PSERIES FW_FEATURE_PSERIES_POSSIBLE | @@ -92,6 +94,9 @@ #ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_POSSIBLE | #endif +#ifdef CONFIG_PPC_HASH_MMU_NATIVE + FW_FEATURE_NATIVE_ALWAYS | +#endif 0, FW_FEATURE_ALWAYS = #ifdef CONFIG_PPC_PSERIES @@ -103,6 +108,9 @@ #ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_ALWAYS & #endif +#ifdef CONFIG_PPC_HASH_MMU_NATIVE + FW_FEATURE_NATIVE_ALWAYS & +#endif FW_FEATURE_POSSIBLE, #else /* CONFIG_PPC64 */ diff -Nru linux-aws-5.19.0/arch/powerpc/include/asm/paca.h linux-aws-5.19.0/arch/powerpc/include/asm/paca.h --- linux-aws-5.19.0/arch/powerpc/include/asm/paca.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/include/asm/paca.h 2022-11-29 07:06:46.000000000 +0000 @@ -263,7 +263,6 @@ u64 l1d_flush_size; #endif #ifdef CONFIG_PPC_PSERIES - struct rtas_args *rtas_args_reentrant; u8 *mce_data_buf; /* buffer to hold per cpu rtas errlog */ #endif /* CONFIG_PPC_PSERIES */ diff -Nru linux-aws-5.19.0/arch/powerpc/include/asm/rtas.h linux-aws-5.19.0/arch/powerpc/include/asm/rtas.h --- linux-aws-5.19.0/arch/powerpc/include/asm/rtas.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/include/asm/rtas.h 2022-11-29 07:06:46.000000000 +0000 @@ -240,7 +240,6 @@ extern int rtas_token(const char *service); extern int rtas_service_present(const char *service); extern int rtas_call(int token, int, int, int *, ...); -int rtas_call_reentrant(int token, int nargs, int nret, int *outputs, ...); void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, ...); extern void __noreturn rtas_restart(char *cmd); diff -Nru linux-aws-5.19.0/arch/powerpc/include/asm/syscalls.h linux-aws-5.19.0/arch/powerpc/include/asm/syscalls.h --- linux-aws-5.19.0/arch/powerpc/include/asm/syscalls.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/include/asm/syscalls.h 2022-11-29 07:06:46.000000000 +0000 @@ -8,6 +8,18 @@ #include #include +/* + * long long munging: + * The 32 bit ABI passes long longs in an odd even register pair. + * High and low parts are swapped depending on endian mode, + * so define a macro (similar to mips linux32) to handle that. + */ +#ifdef __LITTLE_ENDIAN__ +#define merge_64(low, high) (((u64)high << 32) | low) +#else +#define merge_64(high, low) (((u64)high << 32) | low) +#endif + struct rtas_args; asmlinkage long sys_mmap(unsigned long addr, size_t len, diff -Nru linux-aws-5.19.0/arch/powerpc/Kconfig linux-aws-5.19.0/arch/powerpc/Kconfig --- linux-aws-5.19.0/arch/powerpc/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -817,7 +817,7 @@ default 24 if STRICT_KERNEL_RWX && PPC64 range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 range 19 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx - range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_FSL_BOOKE + range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && FSL_BOOKE default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32 default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 default 23 if STRICT_KERNEL_RWX && PPC_8xx diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/interrupt_64.S linux-aws-5.19.0/arch/powerpc/kernel/interrupt_64.S --- linux-aws-5.19.0/arch/powerpc/kernel/interrupt_64.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/interrupt_64.S 2022-11-29 07:06:46.000000000 +0000 @@ -559,15 +559,54 @@ ld r11,SOFTE(r1) cmpwi r11,IRQS_ENABLED stb r11,PACAIRQSOFTMASK(r13) - bne 1f + beq .Linterrupt_return_\srr\()_soft_enabled + + /* + * Returning to soft-disabled context. + * Check if a MUST_HARD_MASK interrupt has become pending, in which + * case we need to disable MSR[EE] in the return context. + */ + ld r12,_MSR(r1) + andi. r10,r12,MSR_EE + beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled + lbz r11,PACAIRQHAPPENED(r13) + andi. r10,r11,PACA_IRQ_MUST_HARD_MASK + beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending + + /* Must clear MSR_EE from _MSR */ +#ifdef CONFIG_PPC_BOOK3S + li r10,0 + /* Clear valid before changing _MSR */ + .ifc \srr,srr + stb r10,PACASRR_VALID(r13) + .else + stb r10,PACAHSRR_VALID(r13) + .endif +#endif + xori r12,r12,MSR_EE + std r12,_MSR(r1) + b .Lfast_kernel_interrupt_return_\srr\() + +.Linterrupt_return_\srr\()_soft_enabled: + /* + * In the soft-enabled case, need to double-check that we have no + * pending interrupts that might have come in before we reached the + * restart section of code, and restart the exit so those can be + * handled. + * + * If there are none, it is be possible that the interrupt still + * has PACA_IRQ_HARD_DIS set, which needs to be cleared for the + * interrupted context. This clear will not clobber a new pending + * interrupt coming in, because we're in the restart section, so + * such would return to the restart location. + */ #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif li r11,0 - stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS -1: + stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS .Lfast_kernel_interrupt_return_\srr\(): cmpdi cr1,r3,0 diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/interrupt.c linux-aws-5.19.0/arch/powerpc/kernel/interrupt.c --- linux-aws-5.19.0/arch/powerpc/kernel/interrupt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/interrupt.c 2022-11-29 07:06:46.000000000 +0000 @@ -592,16 +592,6 @@ if (unlikely(stack_store)) __hard_EE_RI_disable(); - /* - * Returning to a kernel context with local irqs disabled. - * Here, if EE was enabled in the interrupted context, enable - * it on return as well. A problem exists here where a soft - * masked interrupt may have cleared MSR[EE] and set HARD_DIS - * here, and it will still exist on return to the caller. This - * will be resolved by the masked interrupt firing again. - */ - if (regs->msr & MSR_EE) - local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; #endif /* CONFIG_PPC64 */ } diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/kprobes.c linux-aws-5.19.0/arch/powerpc/kernel/kprobes.c --- linux-aws-5.19.0/arch/powerpc/kernel/kprobes.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/kprobes.c 2022-11-29 07:06:46.000000000 +0000 @@ -161,7 +161,13 @@ preempt_disable(); prev = get_kprobe(p->addr - 1); preempt_enable_no_resched(); - if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { + + /* + * When prev is a ftrace-based kprobe, we don't have an insn, and it + * doesn't probe for prefixed instruction. + */ + if (prev && !kprobe_ftrace(prev) && + ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { printk("Cannot register a kprobe on the second word of prefixed instruction\n"); ret = -EINVAL; } diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/paca.c linux-aws-5.19.0/arch/powerpc/kernel/paca.c --- linux-aws-5.19.0/arch/powerpc/kernel/paca.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/paca.c 2022-11-29 07:06:46.000000000 +0000 @@ -16,7 +16,6 @@ #include #include #include -#include #include "setup.h" @@ -170,30 +169,6 @@ } #endif /* CONFIG_PPC_64S_HASH_MMU */ -#ifdef CONFIG_PPC_PSERIES -/** - * new_rtas_args() - Allocates rtas args - * @cpu: CPU number - * @limit: Memory limit for this allocation - * - * Allocates a struct rtas_args and return it's pointer, - * if not in Hypervisor mode - * - * Return: Pointer to allocated rtas_args - * NULL if CPU in Hypervisor Mode - */ -static struct rtas_args * __init new_rtas_args(int cpu, unsigned long limit) -{ - limit = min_t(unsigned long, limit, RTAS_INSTANTIATE_MAX); - - if (early_cpu_has_feature(CPU_FTR_HVMODE)) - return NULL; - - return alloc_paca_data(sizeof(struct rtas_args), L1_CACHE_BYTES, - limit, cpu); -} -#endif /* CONFIG_PPC_PSERIES */ - /* The Paca is an array with one entry per processor. Each contains an * lppaca, which contains the information shared between the * hypervisor and Linux. @@ -232,10 +207,6 @@ /* For now -- if we have threads this will be adjusted later */ new_paca->tcd_ptr = &new_paca->tcd; #endif - -#ifdef CONFIG_PPC_PSERIES - new_paca->rtas_args_reentrant = NULL; -#endif } /* Put the paca pointer into r13 and SPRG_PACA */ @@ -308,9 +279,6 @@ #ifdef CONFIG_PPC_64S_HASH_MMU paca->slb_shadow_ptr = new_slb_shadow(cpu, limit); #endif -#ifdef CONFIG_PPC_PSERIES - paca->rtas_args_reentrant = new_rtas_args(cpu, limit); -#endif paca_struct_size += sizeof(struct paca_struct); } diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/pci_dn.c linux-aws-5.19.0/arch/powerpc/kernel/pci_dn.c --- linux-aws-5.19.0/arch/powerpc/kernel/pci_dn.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/pci_dn.c 2022-11-29 07:06:46.000000000 +0000 @@ -330,6 +330,7 @@ INIT_LIST_HEAD(&pdn->list); parent = of_get_parent(dn); pdn->parent = parent ? PCI_DN(parent) : NULL; + of_node_put(parent); if (pdn->parent) list_add_tail(&pdn->list, &pdn->parent->child_list); diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/rtas.c linux-aws-5.19.0/arch/powerpc/kernel/rtas.c --- linux-aws-5.19.0/arch/powerpc/kernel/rtas.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/rtas.c 2022-11-29 07:06:46.000000000 +0000 @@ -43,7 +43,6 @@ #include #include #include -#include /* This is here deliberately so it's only used in this file */ void enter_rtas(unsigned long); @@ -932,59 +931,6 @@ pr_err("ibm,activate-firmware failed (%i)\n", fwrc); } -#ifdef CONFIG_PPC_PSERIES -/** - * rtas_call_reentrant() - Used for reentrant rtas calls - * @token: Token for desired reentrant RTAS call - * @nargs: Number of Input Parameters - * @nret: Number of Output Parameters - * @outputs: Array of outputs - * @...: Inputs for desired RTAS call - * - * According to LoPAR documentation, only "ibm,int-on", "ibm,int-off", - * "ibm,get-xive" and "ibm,set-xive" are currently reentrant. - * Reentrant calls need their own rtas_args buffer, so not using rtas.args, but - * PACA one instead. - * - * Return: -1 on error, - * First output value of RTAS call if (nret > 0), - * 0 otherwise, - */ -int rtas_call_reentrant(int token, int nargs, int nret, int *outputs, ...) -{ - va_list list; - struct rtas_args *args; - unsigned long flags; - int i, ret = 0; - - if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE) - return -1; - - local_irq_save(flags); - preempt_disable(); - - /* We use the per-cpu (PACA) rtas args buffer */ - args = local_paca->rtas_args_reentrant; - - va_start(list, outputs); - va_rtas_call_unlocked(args, token, nargs, nret, list); - va_end(list); - - if (nret > 1 && outputs) - for (i = 0; i < nret - 1; ++i) - outputs[i] = be32_to_cpu(args->rets[i + 1]); - - if (nret > 0) - ret = be32_to_cpu(args->rets[0]); - - local_irq_restore(flags); - preempt_enable(); - - return ret; -} - -#endif /* CONFIG_PPC_PSERIES */ - /** * get_pseries_errorlog() - Find a specific pseries error log in an RTAS * extended event log. diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/rtas_entry.S linux-aws-5.19.0/arch/powerpc/kernel/rtas_entry.S --- linux-aws-5.19.0/arch/powerpc/kernel/rtas_entry.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/rtas_entry.S 2022-11-29 07:06:46.000000000 +0000 @@ -109,8 +109,12 @@ * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S] * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if * MSR[S] is set, it will remain when entering RTAS. + * If we're in HV mode, RTAS must also run in HV mode, so extract MSR_HV + * from the saved MSR value and insert into the value RTAS will use. */ + extrdi r0, r6, 1, 63 - MSR_HV_LG LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI) + insrdi r6, r0, 1, 63 - MSR_HV_LG li r0,0 mtmsrd r0,1 /* disable RI before using SRR0/1 */ diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/setup_64.c linux-aws-5.19.0/arch/powerpc/kernel/setup_64.c --- linux-aws-5.19.0/arch/powerpc/kernel/setup_64.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/setup_64.c 2022-11-29 07:06:46.000000000 +0000 @@ -183,8 +183,10 @@ get_paca()->cpu_start = 1; /* Allow percpu accesses to work until we setup percpu data */ get_paca()->data_offset = 0; - /* Mark interrupts disabled in PACA */ + /* Mark interrupts soft and hard disabled in PACA */ irq_soft_mask_set(IRQS_DISABLED); + get_paca()->irq_happened = PACA_IRQ_HARD_DIS; + WARN_ON(mfmsr() & MSR_EE); } static void __init configure_exceptions(void) diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/syscalls.c linux-aws-5.19.0/arch/powerpc/kernel/syscalls.c --- linux-aws-5.19.0/arch/powerpc/kernel/syscalls.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/syscalls.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,8 +98,8 @@ long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) { - return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low, - (u64)len_high << 32 | len_low, advice); + return ksys_fadvise64_64(fd, merge_64(offset_high, offset_low), + merge_64(len_high, len_low), advice); } SYSCALL_DEFINE0(switch_endian) diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/sys_ppc32.c linux-aws-5.19.0/arch/powerpc/kernel/sys_ppc32.c --- linux-aws-5.19.0/arch/powerpc/kernel/sys_ppc32.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/sys_ppc32.c 2022-11-29 07:06:46.000000000 +0000 @@ -56,18 +56,6 @@ return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); } -/* - * long long munging: - * The 32 bit ABI passes long longs in an odd even register pair. - * High and low parts are swapped depending on endian mode, - * so define a macro (similar to mips linux32) to handle that. - */ -#ifdef __LITTLE_ENDIAN__ -#define merge_64(low, high) ((u64)high << 32) | low -#else -#define merge_64(high, low) ((u64)high << 32) | low -#endif - compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 pos1, u32 pos2) { @@ -94,7 +82,7 @@ asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offset1, u32 offset2, u32 len1, u32 len2) { - return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) | offset2, + return ksys_fallocate(fd, mode, merge_64(offset1, offset2), merge_64(len1, len2)); } diff -Nru linux-aws-5.19.0/arch/powerpc/kernel/systbl.S linux-aws-5.19.0/arch/powerpc/kernel/systbl.S --- linux-aws-5.19.0/arch/powerpc/kernel/systbl.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/kernel/systbl.S 2022-11-29 07:06:46.000000000 +0000 @@ -18,6 +18,7 @@ .p2align 3 #define __SYSCALL(nr, entry) .8byte entry #else + .p2align 2 #define __SYSCALL(nr, entry) .long entry #endif diff -Nru linux-aws-5.19.0/arch/powerpc/Makefile linux-aws-5.19.0/arch/powerpc/Makefile --- linux-aws-5.19.0/arch/powerpc/Makefile 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -152,7 +152,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 endif else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 diff -Nru linux-aws-5.19.0/arch/powerpc/math-emu/math_efp.c linux-aws-5.19.0/arch/powerpc/math-emu/math_efp.c --- linux-aws-5.19.0/arch/powerpc/math-emu/math_efp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/math-emu/math_efp.c 2022-11-29 07:06:46.000000000 +0000 @@ -17,6 +17,7 @@ #include #include +#include #include #include diff -Nru linux-aws-5.19.0/arch/powerpc/mm/book3s64/radix_pgtable.c linux-aws-5.19.0/arch/powerpc/mm/book3s64/radix_pgtable.c --- linux-aws-5.19.0/arch/powerpc/mm/book3s64/radix_pgtable.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/mm/book3s64/radix_pgtable.c 2022-11-29 07:06:46.000000000 +0000 @@ -937,15 +937,6 @@ pmd = *pmdp; pmd_clear(pmdp); - /* - * pmdp collapse_flush need to ensure that there are no parallel gup - * walk after this call. This is needed so that we can have stable - * page ref count when collapsing a page. We don't allow a collapse page - * if we have gup taken on the page. We can ensure that by sending IPI - * because gup walk happens with IRQ disabled. - */ - serialize_against_pte_lookup(vma->vm_mm); - radix__flush_tlb_collapsed_pmd(vma->vm_mm, address); return pmd; diff -Nru linux-aws-5.19.0/arch/powerpc/platforms/powernv/opal.c linux-aws-5.19.0/arch/powerpc/platforms/powernv/opal.c --- linux-aws-5.19.0/arch/powerpc/platforms/powernv/opal.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/platforms/powernv/opal.c 2022-11-29 07:06:46.000000000 +0000 @@ -892,6 +892,7 @@ kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } diff -Nru linux-aws-5.19.0/arch/powerpc/platforms/pseries/papr_scm.c linux-aws-5.19.0/arch/powerpc/platforms/pseries/papr_scm.c --- linux-aws-5.19.0/arch/powerpc/platforms/pseries/papr_scm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/platforms/pseries/papr_scm.c 2022-11-29 07:06:46.000000000 +0000 @@ -124,9 +124,6 @@ /* The bits which needs to be overridden */ u64 health_bitmap_inject_mask; - - /* array to have event_code and stat_id mappings */ - u8 *nvdimm_events_map; }; static int papr_scm_pmem_flush(struct nd_region *nd_region, @@ -350,6 +347,25 @@ #ifdef CONFIG_PERF_EVENTS #define to_nvdimm_pmu(_pmu) container_of(_pmu, struct nvdimm_pmu, pmu) +static const char * const nvdimm_events_map[] = { + [1] = "CtlResCt", + [2] = "CtlResTm", + [3] = "PonSecs ", + [4] = "MemLife ", + [5] = "CritRscU", + [6] = "HostLCnt", + [7] = "HostSCnt", + [8] = "HostSDur", + [9] = "HostLDur", + [10] = "MedRCnt ", + [11] = "MedWCnt ", + [12] = "MedRDur ", + [13] = "MedWDur ", + [14] = "CchRHCnt", + [15] = "CchWHCnt", + [16] = "FastWCnt", +}; + static int papr_scm_pmu_get_value(struct perf_event *event, struct device *dev, u64 *count) { struct papr_scm_perf_stat *stat; @@ -357,11 +373,15 @@ struct papr_scm_priv *p = (struct papr_scm_priv *)dev->driver_data; int rc, size; + /* Invalid eventcode */ + if (event->attr.config == 0 || event->attr.config >= ARRAY_SIZE(nvdimm_events_map)) + return -EINVAL; + /* Allocate request buffer enough to hold single performance stat */ size = sizeof(struct papr_scm_perf_stats) + sizeof(struct papr_scm_perf_stat); - if (!p || !p->nvdimm_events_map) + if (!p) return -EINVAL; stats = kzalloc(size, GFP_KERNEL); @@ -370,7 +390,7 @@ stat = &stats->scm_statistic[0]; memcpy(&stat->stat_id, - &p->nvdimm_events_map[event->attr.config * sizeof(stat->stat_id)], + nvdimm_events_map[event->attr.config], sizeof(stat->stat_id)); stat->stat_val = 0; @@ -458,56 +478,6 @@ papr_scm_pmu_read(event); } -static int papr_scm_pmu_check_events(struct papr_scm_priv *p, struct nvdimm_pmu *nd_pmu) -{ - struct papr_scm_perf_stat *stat; - struct papr_scm_perf_stats *stats; - u32 available_events; - int index, rc = 0; - - if (!p->stat_buffer_len) - return -ENOENT; - - available_events = (p->stat_buffer_len - sizeof(struct papr_scm_perf_stats)) - / sizeof(struct papr_scm_perf_stat); - if (available_events == 0) - return -EOPNOTSUPP; - - /* Allocate the buffer for phyp where stats are written */ - stats = kzalloc(p->stat_buffer_len, GFP_KERNEL); - if (!stats) { - rc = -ENOMEM; - return rc; - } - - /* Called to get list of events supported */ - rc = drc_pmem_query_stats(p, stats, 0); - if (rc) - goto out; - - /* - * Allocate memory and populate nvdimm_event_map. - * Allocate an extra element for NULL entry - */ - p->nvdimm_events_map = kcalloc(available_events + 1, - sizeof(stat->stat_id), - GFP_KERNEL); - if (!p->nvdimm_events_map) { - rc = -ENOMEM; - goto out; - } - - /* Copy all stat_ids to event map */ - for (index = 0, stat = stats->scm_statistic; - index < available_events; index++, ++stat) { - memcpy(&p->nvdimm_events_map[index * sizeof(stat->stat_id)], - &stat->stat_id, sizeof(stat->stat_id)); - } -out: - kfree(stats); - return rc; -} - static void papr_scm_pmu_register(struct papr_scm_priv *p) { struct nvdimm_pmu *nd_pmu; @@ -519,9 +489,10 @@ goto pmu_err_print; } - rc = papr_scm_pmu_check_events(p, nd_pmu); - if (rc) + if (!p->stat_buffer_len) { + rc = -ENOENT; goto pmu_check_events_err; + } nd_pmu->pmu.task_ctx_nr = perf_invalid_context; nd_pmu->pmu.name = nvdimm_name(p->nvdimm); @@ -539,7 +510,7 @@ rc = register_nvdimm_pmu(nd_pmu, p->pdev); if (rc) - goto pmu_register_err; + goto pmu_check_events_err; /* * Set archdata.priv value to nvdimm_pmu structure, to handle the @@ -548,8 +519,6 @@ p->pdev->archdata.priv = nd_pmu; return; -pmu_register_err: - kfree(p->nvdimm_events_map); pmu_check_events_err: kfree(nd_pmu); pmu_err_print: @@ -1560,7 +1529,6 @@ unregister_nvdimm_pmu(pdev->archdata.priv); pdev->archdata.priv = NULL; - kfree(p->nvdimm_events_map); kfree(p->bus_desc.provider_name); kfree(p); diff -Nru linux-aws-5.19.0/arch/powerpc/platforms/pseries/vas.c linux-aws-5.19.0/arch/powerpc/platforms/pseries/vas.c --- linux-aws-5.19.0/arch/powerpc/platforms/pseries/vas.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/platforms/pseries/vas.c 2022-11-29 07:06:46.000000000 +0000 @@ -332,7 +332,7 @@ * So no unpacking needs to be done. */ rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, domain, - VPHN_FLAG_VCPU, smp_processor_id()); + VPHN_FLAG_VCPU, hard_smp_processor_id()); if (rc != H_SUCCESS) { pr_err("H_HOME_NODE_ASSOCIATIVITY error: %d\n", rc); goto out; diff -Nru linux-aws-5.19.0/arch/powerpc/sysdev/fsl_msi.c linux-aws-5.19.0/arch/powerpc/sysdev/fsl_msi.c --- linux-aws-5.19.0/arch/powerpc/sysdev/fsl_msi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/sysdev/fsl_msi.c 2022-11-29 07:06:46.000000000 +0000 @@ -209,8 +209,10 @@ dev_err(&pdev->dev, "node %pOF has an invalid fsl,msi phandle %u\n", hose->dn, np->phandle); + of_node_put(np); return -EINVAL; } + of_node_put(np); } msi_for_each_desc(entry, &pdev->dev, MSI_DESC_NOTASSOCIATED) { diff -Nru linux-aws-5.19.0/arch/powerpc/sysdev/xics/ics-rtas.c linux-aws-5.19.0/arch/powerpc/sysdev/xics/ics-rtas.c --- linux-aws-5.19.0/arch/powerpc/sysdev/xics/ics-rtas.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/powerpc/sysdev/xics/ics-rtas.c 2022-11-29 07:06:46.000000000 +0000 @@ -36,8 +36,8 @@ server = xics_get_irq_server(d->irq, irq_data_get_affinity_mask(d), 0); - call_status = rtas_call_reentrant(ibm_set_xive, 3, 1, NULL, hw_irq, - server, DEFAULT_PRIORITY); + call_status = rtas_call(ibm_set_xive, 3, 1, NULL, hw_irq, server, + DEFAULT_PRIORITY); if (call_status != 0) { printk(KERN_ERR "%s: ibm_set_xive irq %u server %x returned %d\n", @@ -46,7 +46,7 @@ } /* Now unmask the interrupt (often a no-op) */ - call_status = rtas_call_reentrant(ibm_int_on, 1, 1, NULL, hw_irq); + call_status = rtas_call(ibm_int_on, 1, 1, NULL, hw_irq); if (call_status != 0) { printk(KERN_ERR "%s: ibm_int_on irq=%u returned %d\n", __func__, hw_irq, call_status); @@ -68,7 +68,7 @@ if (hw_irq == XICS_IPI) return; - call_status = rtas_call_reentrant(ibm_int_off, 1, 1, NULL, hw_irq); + call_status = rtas_call(ibm_int_off, 1, 1, NULL, hw_irq); if (call_status != 0) { printk(KERN_ERR "%s: ibm_int_off irq=%u returned %d\n", __func__, hw_irq, call_status); @@ -76,8 +76,8 @@ } /* Have to set XIVE to 0xff to be able to remove a slot */ - call_status = rtas_call_reentrant(ibm_set_xive, 3, 1, NULL, hw_irq, - xics_default_server, 0xff); + call_status = rtas_call(ibm_set_xive, 3, 1, NULL, hw_irq, + xics_default_server, 0xff); if (call_status != 0) { printk(KERN_ERR "%s: ibm_set_xive(0xff) irq=%u returned %d\n", __func__, hw_irq, call_status); @@ -108,7 +108,7 @@ if (hw_irq == XICS_IPI || hw_irq == XICS_IRQ_SPURIOUS) return -1; - status = rtas_call_reentrant(ibm_get_xive, 1, 3, xics_status, hw_irq); + status = rtas_call(ibm_get_xive, 1, 3, xics_status, hw_irq); if (status) { printk(KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n", @@ -126,8 +126,8 @@ pr_debug("%s: irq %d [hw 0x%x] server: 0x%x\n", __func__, d->irq, hw_irq, irq_server); - status = rtas_call_reentrant(ibm_set_xive, 3, 1, NULL, - hw_irq, irq_server, xics_status[1]); + status = rtas_call(ibm_set_xive, 3, 1, NULL, + hw_irq, irq_server, xics_status[1]); if (status) { printk(KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n", @@ -158,7 +158,7 @@ return -EINVAL; /* Check if RTAS knows about this interrupt */ - rc = rtas_call_reentrant(ibm_get_xive, 1, 3, status, hw_irq); + rc = rtas_call(ibm_get_xive, 1, 3, status, hw_irq); if (rc) return -ENXIO; @@ -174,7 +174,7 @@ { int rc, status[2]; - rc = rtas_call_reentrant(ibm_get_xive, 1, 3, status, vec); + rc = rtas_call(ibm_get_xive, 1, 3, status, vec); if (rc) return -1; return status[0]; diff -Nru linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs.dtsi linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs.dtsi --- linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs.dtsi 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -161,7 +161,7 @@ ranges; cctrllr: cache-controller@2010000 { - compatible = "sifive,fu540-c000-ccache", "cache"; + compatible = "microchip,mpfs-ccache", "sifive,fu540-c000-ccache", "cache"; reg = <0x0 0x2010000 0x0 0x1000>; cache-block-size = <64>; cache-level = <2>; diff -Nru linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit.dts linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit.dts --- linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit.dts 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit.dts 2022-11-29 07:06:46.000000000 +0000 @@ -32,15 +32,26 @@ ddrc_cache_lo: memory@80000000 { device_type = "memory"; - reg = <0x0 0x80000000 0x0 0x2e000000>; + reg = <0x0 0x80000000 0x0 0x40000000>; status = "okay"; }; ddrc_cache_hi: memory@1000000000 { device_type = "memory"; - reg = <0x10 0x0 0x0 0x40000000>; + reg = <0x10 0x40000000 0x0 0x40000000>; status = "okay"; }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + hss_payload: region@BFC00000 { + reg = <0x0 0xBFC00000 0x0 0x400000>; + no-map; + }; + }; }; &core_pwm0 { @@ -125,9 +136,11 @@ status = "okay"; }; +/* UBUNTU: PCIe support is not yet ready, so disable it for now &pcie { status = "okay"; }; +*/ &qspi { status = "okay"; diff -Nru linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit-fabric.dtsi linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit-fabric.dtsi --- linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit-fabric.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/boot/dts/microchip/mpfs-icicle-kit-fabric.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -4,18 +4,18 @@ / { compatible = "microchip,mpfs-icicle-reference-rtlv2203", "microchip,mpfs"; - core_pwm0: pwm@41000000 { + core_pwm0: pwm@40000000 { compatible = "microchip,corepwm-rtl-v4"; - reg = <0x0 0x41000000 0x0 0xF0>; + reg = <0x0 0x40000000 0x0 0xF0>; microchip,sync-update-mask = /bits/ 32 <0>; #pwm-cells = <2>; clocks = <&fabric_clk3>; status = "disabled"; }; - i2c2: i2c@44000000 { + i2c2: i2c@40000200 { compatible = "microchip,corei2c-rtl-v7"; - reg = <0x0 0x44000000 0x0 0x1000>; + reg = <0x0 0x40000200 0x0 0x100>; #address-cells = <1>; #size-cells = <0>; clocks = <&fabric_clk3>; @@ -28,7 +28,7 @@ fabric_clk3: fabric-clk3 { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <62500000>; + clock-frequency = <50000000>; }; fabric_clk1: fabric-clk1 { diff -Nru linux-aws-5.19.0/arch/riscv/include/asm/io.h linux-aws-5.19.0/arch/riscv/include/asm/io.h --- linux-aws-5.19.0/arch/riscv/include/asm/io.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/include/asm/io.h 2022-11-29 07:06:46.000000000 +0000 @@ -101,9 +101,9 @@ __io_reads_ins(ins, u8, b, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u16, w, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u32, l, __io_pbr(), __io_par(addr)) -#define insb(addr, buffer, count) __insb((void __iomem *)(long)addr, buffer, count) -#define insw(addr, buffer, count) __insw((void __iomem *)(long)addr, buffer, count) -#define insl(addr, buffer, count) __insl((void __iomem *)(long)addr, buffer, count) +#define insb(addr, buffer, count) __insb(PCI_IOBASE + (addr), buffer, count) +#define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count) +#define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u8, b, __io_bw(), __io_aw()) __io_writes_outs(writes, u16, w, __io_bw(), __io_aw()) @@ -115,22 +115,22 @@ __io_writes_outs(outs, u8, b, __io_pbw(), __io_paw()) __io_writes_outs(outs, u16, w, __io_pbw(), __io_paw()) __io_writes_outs(outs, u32, l, __io_pbw(), __io_paw()) -#define outsb(addr, buffer, count) __outsb((void __iomem *)(long)addr, buffer, count) -#define outsw(addr, buffer, count) __outsw((void __iomem *)(long)addr, buffer, count) -#define outsl(addr, buffer, count) __outsl((void __iomem *)(long)addr, buffer, count) +#define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count) +#define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count) +#define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count) #ifdef CONFIG_64BIT __io_reads_ins(reads, u64, q, __io_br(), __io_ar(addr)) #define readsq(addr, buffer, count) __readsq(addr, buffer, count) __io_reads_ins(ins, u64, q, __io_pbr(), __io_par(addr)) -#define insq(addr, buffer, count) __insq((void __iomem *)addr, buffer, count) +#define insq(addr, buffer, count) __insq(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u64, q, __io_bw(), __io_aw()) #define writesq(addr, buffer, count) __writesq(addr, buffer, count) __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw()) -#define outsq(addr, buffer, count) __outsq((void __iomem *)addr, buffer, count) +#define outsq(addr, buffer, count) __outsq(PCI_IOBASE + (addr), buffer, count) #endif #include diff -Nru linux-aws-5.19.0/arch/riscv/include/asm/kvm_vcpu_sbi.h linux-aws-5.19.0/arch/riscv/include/asm/kvm_vcpu_sbi.h --- linux-aws-5.19.0/arch/riscv/include/asm/kvm_vcpu_sbi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/include/asm/kvm_vcpu_sbi.h 2022-11-29 07:06:46.000000000 +0000 @@ -33,4 +33,16 @@ u32 type, u64 flags); const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(unsigned long extid); +#ifdef CONFIG_RISCV_SBI_V01 +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01; +#endif +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_base; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_time; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental; +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor; + #endif /* __RISCV_KVM_VCPU_SBI_H__ */ diff -Nru linux-aws-5.19.0/arch/riscv/include/asm/mmu.h linux-aws-5.19.0/arch/riscv/include/asm/mmu.h --- linux-aws-5.19.0/arch/riscv/include/asm/mmu.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/include/asm/mmu.h 2022-11-29 07:06:46.000000000 +0000 @@ -16,7 +16,6 @@ atomic_long_t id; #endif void *vdso; - void *vdso_info; #ifdef CONFIG_SMP /* A local icache flush is needed before user execution can resume. */ cpumask_t icache_stale_mask; diff -Nru linux-aws-5.19.0/arch/riscv/Kconfig linux-aws-5.19.0/arch/riscv/Kconfig --- linux-aws-5.19.0/arch/riscv/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -52,7 +52,7 @@ select COMMON_CLK select CPU_PM if CPU_IDLE select EDAC_SUPPORT - select GENERIC_ARCH_TOPOLOGY if SMP + select GENERIC_ARCH_TOPOLOGY select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_EARLY_IOREMAP @@ -361,6 +361,7 @@ config RISCV_ISA_SVPBMT bool "SVPBMT extension support" depends on 64BIT && MMU + depends on !XIP_KERNEL select RISCV_ALTERNATIVE default y help diff -Nru linux-aws-5.19.0/arch/riscv/Kconfig.erratas linux-aws-5.19.0/arch/riscv/Kconfig.erratas --- linux-aws-5.19.0/arch/riscv/Kconfig.erratas 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/Kconfig.erratas 2022-11-29 07:06:46.000000000 +0000 @@ -46,7 +46,7 @@ config ERRATA_THEAD_PBMT bool "Apply T-Head memory type errata" - depends on ERRATA_THEAD && 64BIT + depends on ERRATA_THEAD && 64BIT && MMU select RISCV_ALTERNATIVE_EARLY default y help diff -Nru linux-aws-5.19.0/arch/riscv/kernel/setup.c linux-aws-5.19.0/arch/riscv/kernel/setup.c --- linux-aws-5.19.0/arch/riscv/kernel/setup.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/kernel/setup.c 2022-11-29 07:06:46.000000000 +0000 @@ -251,10 +251,10 @@ pr_info("Machine model: %s\n", name); dump_stack_set_arch_desc("%s (DT)", name); } - return; + } else { + pr_err("No DTB passed to the kernel\n"); } - pr_err("No DTB passed to the kernel\n"); #ifdef CONFIG_CMDLINE_FORCE strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); pr_info("Forcing kernel command line to: %s\n", boot_command_line); diff -Nru linux-aws-5.19.0/arch/riscv/kernel/signal.c linux-aws-5.19.0/arch/riscv/kernel/signal.c --- linux-aws-5.19.0/arch/riscv/kernel/signal.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/kernel/signal.c 2022-11-29 07:06:46.000000000 +0000 @@ -124,6 +124,8 @@ if (restore_altstack(&frame->uc.uc_stack)) goto badframe; + regs->cause = -1UL; + return regs->a0; badframe: diff -Nru linux-aws-5.19.0/arch/riscv/kernel/smpboot.c linux-aws-5.19.0/arch/riscv/kernel/smpboot.c --- linux-aws-5.19.0/arch/riscv/kernel/smpboot.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/kernel/smpboot.c 2022-11-29 07:06:46.000000000 +0000 @@ -49,6 +49,7 @@ unsigned int curr_cpuid; curr_cpuid = smp_processor_id(); + store_cpu_topology(curr_cpuid); numa_store_cpu_info(curr_cpuid); numa_add_cpu(curr_cpuid); @@ -161,9 +162,9 @@ mmgrab(mm); current->active_mm = mm; + store_cpu_topology(curr_cpuid); notify_cpu_starting(curr_cpuid); numa_add_cpu(curr_cpuid); - update_siblings_masks(curr_cpuid); set_cpu_online(curr_cpuid, 1); /* diff -Nru linux-aws-5.19.0/arch/riscv/kernel/vdso.c linux-aws-5.19.0/arch/riscv/kernel/vdso.c --- linux-aws-5.19.0/arch/riscv/kernel/vdso.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/kernel/vdso.c 2022-11-29 07:06:46.000000000 +0000 @@ -60,6 +60,11 @@ struct vm_special_mapping *cm; }; +static struct __vdso_info vdso_info; +#ifdef CONFIG_COMPAT +static struct __vdso_info compat_vdso_info; +#endif + static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) { @@ -114,15 +119,18 @@ { struct mm_struct *mm = task->mm; struct vm_area_struct *vma; - struct __vdso_info *vdso_info = mm->context.vdso_info; mmap_read_lock(mm); for (vma = mm->mmap; vma; vma = vma->vm_next) { unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, vdso_info->dm)) + if (vma_is_special_mapping(vma, vdso_info.dm)) zap_page_range(vma, vma->vm_start, size); +#ifdef CONFIG_COMPAT + if (vma_is_special_mapping(vma, compat_vdso_info.dm)) + zap_page_range(vma, vma->vm_start, size); +#endif } mmap_read_unlock(mm); @@ -264,7 +272,6 @@ vdso_base += VVAR_SIZE; mm->context.vdso = (void *)vdso_base; - mm->context.vdso_info = (void *)vdso_info; ret = _install_special_mapping(mm, vdso_base, vdso_text_len, diff -Nru linux-aws-5.19.0/arch/riscv/kvm/vcpu_sbi.c linux-aws-5.19.0/arch/riscv/kvm/vcpu_sbi.c --- linux-aws-5.19.0/arch/riscv/kvm/vcpu_sbi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/kvm/vcpu_sbi.c 2022-11-29 07:06:46.000000000 +0000 @@ -32,23 +32,13 @@ }; } -#ifdef CONFIG_RISCV_SBI_V01 -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01; -#else +#ifndef CONFIG_RISCV_SBI_V01 static const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01 = { .extid_start = -1UL, .extid_end = -1UL, .handler = NULL, }; #endif -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_base; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_time; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental; -extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor; static const struct kvm_vcpu_sbi_extension *sbi_ext[] = { &vcpu_sbi_ext_v01, diff -Nru linux-aws-5.19.0/arch/riscv/Makefile linux-aws-5.19.0/arch/riscv/Makefile --- linux-aws-5.19.0/arch/riscv/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -37,6 +37,7 @@ endif ifeq ($(CONFIG_LD_IS_LLD),y) +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0) KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifndef CONFIG_AS_IS_LLVM @@ -44,6 +45,7 @@ KBUILD_AFLAGS += -Wa,-mno-relax endif endif +endif # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima diff -Nru linux-aws-5.19.0/arch/riscv/mm/fault.c linux-aws-5.19.0/arch/riscv/mm/fault.c --- linux-aws-5.19.0/arch/riscv/mm/fault.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/mm/fault.c 2022-11-29 07:06:46.000000000 +0000 @@ -184,7 +184,8 @@ } break; case EXC_LOAD_PAGE_FAULT: - if (!(vma->vm_flags & VM_READ)) { + /* Write implies read */ + if (!(vma->vm_flags & (VM_READ | VM_WRITE))) { return true; } break; diff -Nru linux-aws-5.19.0/arch/riscv/mm/pageattr.c linux-aws-5.19.0/arch/riscv/mm/pageattr.c --- linux-aws-5.19.0/arch/riscv/mm/pageattr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/riscv/mm/pageattr.c 2022-11-29 07:06:46.000000000 +0000 @@ -118,10 +118,10 @@ if (!numpages) return 0; - mmap_read_lock(&init_mm); + mmap_write_lock(&init_mm); ret = walk_page_range_novma(&init_mm, start, end, &pageattr_ops, NULL, &masks); - mmap_read_unlock(&init_mm); + mmap_write_unlock(&init_mm); flush_tlb_kernel_range(start, end); diff -Nru linux-aws-5.19.0/arch/s390/boot/vmlinux.lds.S linux-aws-5.19.0/arch/s390/boot/vmlinux.lds.S --- linux-aws-5.19.0/arch/s390/boot/vmlinux.lds.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/boot/vmlinux.lds.S 2022-11-29 07:06:46.000000000 +0000 @@ -102,8 +102,17 @@ _compressed_start = .; *(.vmlinux.bin.compressed) _compressed_end = .; - FILL(0xff); - . = ALIGN(4096); + } + +#define SB_TRAILER_SIZE 32 + /* Trailer needed for Secure Boot */ + . += SB_TRAILER_SIZE; /* make sure .sb.trailer does not overwrite the previous section */ + . = ALIGN(4096) - SB_TRAILER_SIZE; + .sb.trailer : { + QUAD(0) + QUAD(0) + QUAD(0) + QUAD(0x000000207a49504c) } _end = .; diff -Nru linux-aws-5.19.0/arch/s390/include/asm/hugetlb.h linux-aws-5.19.0/arch/s390/include/asm/hugetlb.h --- linux-aws-5.19.0/arch/s390/include/asm/hugetlb.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/include/asm/hugetlb.h 2022-11-29 07:06:46.000000000 +0000 @@ -28,9 +28,11 @@ static inline int prepare_hugepage_range(struct file *file, unsigned long addr, unsigned long len) { - if (len & ~HPAGE_MASK) + struct hstate *h = hstate_file(file); + + if (len & ~huge_page_mask(h)) return -EINVAL; - if (addr & ~HPAGE_MASK) + if (addr & ~huge_page_mask(h)) return -EINVAL; return 0; } diff -Nru linux-aws-5.19.0/arch/s390/kernel/nmi.c linux-aws-5.19.0/arch/s390/kernel/nmi.c --- linux-aws-5.19.0/arch/s390/kernel/nmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/kernel/nmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -63,7 +63,7 @@ * structure. The structure is required for machine check happening * early in the boot process. */ -static struct mcesa boot_mcesa __initdata __aligned(MCESA_MAX_SIZE); +static struct mcesa boot_mcesa __aligned(MCESA_MAX_SIZE); void __init nmi_alloc_mcesa_early(u64 *mcesad) { diff -Nru linux-aws-5.19.0/arch/s390/kernel/setup.c linux-aws-5.19.0/arch/s390/kernel/setup.c --- linux-aws-5.19.0/arch/s390/kernel/setup.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/kernel/setup.c 2022-11-29 07:06:46.000000000 +0000 @@ -487,6 +487,7 @@ put_abs_lowcore(restart_data, lc->restart_data); put_abs_lowcore(restart_source, lc->restart_source); put_abs_lowcore(restart_psw, lc->restart_psw); + put_abs_lowcore(mcesad, lc->mcesad); lc->spinlock_lockval = arch_spin_lockval(0); lc->spinlock_index = 0; diff -Nru linux-aws-5.19.0/arch/s390/kernel/vmlinux.lds.S linux-aws-5.19.0/arch/s390/kernel/vmlinux.lds.S --- linux-aws-5.19.0/arch/s390/kernel/vmlinux.lds.S 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/kernel/vmlinux.lds.S 2022-11-29 07:06:46.000000000 +0000 @@ -131,6 +131,7 @@ /* * Table with the patch locations to undo expolines */ + . = ALIGN(4); .nospec_call_table : { __nospec_call_start = . ; *(.s390_indirect*) diff -Nru linux-aws-5.19.0/arch/s390/kvm/gaccess.c linux-aws-5.19.0/arch/s390/kvm/gaccess.c --- linux-aws-5.19.0/arch/s390/kvm/gaccess.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/s390/kvm/gaccess.c 2022-11-29 07:06:46.000000000 +0000 @@ -489,6 +489,8 @@ PROT_TYPE_ALC = 2, PROT_TYPE_DAT = 3, PROT_TYPE_IEP = 4, + /* Dummy value for passing an initialized value when code != PGM_PROTECTION */ + PROT_NONE, }; static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar, @@ -504,6 +506,10 @@ switch (code) { case PGM_PROTECTION: switch (prot) { + case PROT_NONE: + /* We should never get here, acts like termination */ + WARN_ON_ONCE(1); + break; case PROT_TYPE_IEP: tec->b61 = 1; fallthrough; @@ -968,8 +974,10 @@ return rc; } else { gpa = kvm_s390_real_to_abs(vcpu, ga); - if (kvm_is_error_gpa(vcpu->kvm, gpa)) + if (kvm_is_error_gpa(vcpu->kvm, gpa)) { rc = PGM_ADDRESSING; + prot = PROT_NONE; + } } if (rc) return trans_exc(vcpu, rc, ga, ar, mode, prot); @@ -1112,8 +1120,6 @@ if (rc == PGM_PROTECTION && try_storage_prot_override) rc = access_guest_page_with_key(vcpu->kvm, mode, gpas[idx], data, fragment_len, PAGE_SPO_ACC); - if (rc == PGM_PROTECTION) - prot = PROT_TYPE_KEYC; if (rc) break; len -= fragment_len; @@ -1123,6 +1129,10 @@ if (rc > 0) { bool terminate = (mode == GACC_STORE) && (idx > 0); + if (rc == PGM_PROTECTION) + prot = PROT_TYPE_KEYC; + else + prot = PROT_NONE; rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate); } out_unlock: diff -Nru linux-aws-5.19.0/arch/sh/include/asm/sections.h linux-aws-5.19.0/arch/sh/include/asm/sections.h --- linux-aws-5.19.0/arch/sh/include/asm/sections.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sh/include/asm/sections.h 2022-11-29 07:06:46.000000000 +0000 @@ -4,7 +4,7 @@ #include -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[]; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; diff -Nru linux-aws-5.19.0/arch/sh/kernel/machvec.c linux-aws-5.19.0/arch/sh/kernel/machvec.c --- linux-aws-5.19.0/arch/sh/kernel/machvec.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sh/kernel/machvec.c 2022-11-29 07:06:46.000000000 +0000 @@ -20,8 +20,8 @@ #define MV_NAME_SIZE 32 #define for_each_mv(mv) \ - for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ - (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ + for ((mv) = (struct sh_machine_vector *)__machvec_start; \ + (mv) && (unsigned long)(mv) < (unsigned long)__machvec_end; \ (mv)++) static struct sh_machine_vector * __init get_mv_byname(const char *name) @@ -87,8 +87,8 @@ if (!machvec_selected) { unsigned long machvec_size; - machvec_size = ((unsigned long)&__machvec_end - - (unsigned long)&__machvec_start); + machvec_size = ((unsigned long)__machvec_end - + (unsigned long)__machvec_start); /* * Sanity check for machvec section alignment. Ensure @@ -102,7 +102,7 @@ * vector (usually the only one) from .machvec.init. */ if (machvec_size >= sizeof(struct sh_machine_vector)) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; } pr_notice("Booting machvec: %s\n", get_system_type()); diff -Nru linux-aws-5.19.0/arch/sparc/include/asm/smp_32.h linux-aws-5.19.0/arch/sparc/include/asm/smp_32.h --- linux-aws-5.19.0/arch/sparc/include/asm/smp_32.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sparc/include/asm/smp_32.h 2022-11-29 07:06:46.000000000 +0000 @@ -33,9 +33,6 @@ extern cpumask_t smp_commenced_mask; extern struct linux_prom_registers smp_penguin_ctable; -typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long); - void cpu_panic(void); /* @@ -57,7 +54,7 @@ void smp_info(struct seq_file *); struct sparc32_ipi_ops { - void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1, + void (*cross_call)(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4); void (*resched)(int cpu); @@ -66,28 +63,28 @@ }; extern const struct sparc32_ipi_ops *sparc32_ipi_ops; -static inline void xc0(smpfunc_t func) +static inline void xc0(void *func) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0); } -static inline void xc1(smpfunc_t func, unsigned long arg1) +static inline void xc1(void *func, unsigned long arg1) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0); } -static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) +static inline void xc2(void *func, unsigned long arg1, unsigned long arg2) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0); } -static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, +static inline void xc3(void *func, unsigned long arg1, unsigned long arg2, unsigned long arg3) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, arg3, 0); } -static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, +static inline void xc4(void *func, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { sparc32_ipi_ops->cross_call(func, *cpu_online_mask, diff -Nru linux-aws-5.19.0/arch/sparc/kernel/leon_smp.c linux-aws-5.19.0/arch/sparc/kernel/leon_smp.c --- linux-aws-5.19.0/arch/sparc/kernel/leon_smp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sparc/kernel/leon_smp.c 2022-11-29 07:06:46.000000000 +0000 @@ -359,7 +359,7 @@ } static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -372,7 +372,7 @@ static DEFINE_SPINLOCK(cross_call_lock); /* Cross calls must be serialized, at least currently. */ -static void leon_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, +static void leon_cross_call(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -384,7 +384,7 @@ { /* If you make changes here, make sure gcc generates proper code... */ - register smpfunc_t f asm("i0") = func; + register void *f asm("i0") = func; register unsigned long a1 asm("i1") = arg1; register unsigned long a2 asm("i2") = arg2; register unsigned long a3 asm("i3") = arg3; @@ -444,11 +444,13 @@ /* Running cross calls. */ void leon_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) = ccall_info.func; int i = smp_processor_id(); ccall_info.processors_in[i] = 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] = 1; } diff -Nru linux-aws-5.19.0/arch/sparc/kernel/sun4d_smp.c linux-aws-5.19.0/arch/sparc/kernel/sun4d_smp.c --- linux-aws-5.19.0/arch/sparc/kernel/sun4d_smp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sparc/kernel/sun4d_smp.c 2022-11-29 07:06:46.000000000 +0000 @@ -268,7 +268,7 @@ } static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -281,7 +281,7 @@ static DEFINE_SPINLOCK(cross_call_lock); /* Cross calls must be serialized, at least currently. */ -static void sun4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, +static void sun4d_cross_call(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -296,7 +296,7 @@ * If you make changes here, make sure * gcc generates proper code... */ - register smpfunc_t f asm("i0") = func; + register void *f asm("i0") = func; register unsigned long a1 asm("i1") = arg1; register unsigned long a2 asm("i2") = arg2; register unsigned long a3 asm("i3") = arg3; @@ -353,11 +353,13 @@ /* Running cross calls. */ void smp4d_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) = ccall_info.func; int i = hard_smp_processor_id(); ccall_info.processors_in[i] = 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] = 1; } diff -Nru linux-aws-5.19.0/arch/sparc/kernel/sun4m_smp.c linux-aws-5.19.0/arch/sparc/kernel/sun4m_smp.c --- linux-aws-5.19.0/arch/sparc/kernel/sun4m_smp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sparc/kernel/sun4m_smp.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,7 +157,7 @@ } static struct smp_funcall { - smpfunc_t func; + void *func; unsigned long arg1; unsigned long arg2; unsigned long arg3; @@ -170,7 +170,7 @@ static DEFINE_SPINLOCK(cross_call_lock); /* Cross calls must be serialized, at least currently. */ -static void sun4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, +static void sun4m_cross_call(void *func, cpumask_t mask, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { @@ -230,11 +230,13 @@ /* Running cross calls. */ void smp4m_cross_call_irq(void) { + void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long) = ccall_info.func; int i = smp_processor_id(); ccall_info.processors_in[i] = 1; - ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, - ccall_info.arg4, ccall_info.arg5); + func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, + ccall_info.arg5); ccall_info.processors_out[i] = 1; } diff -Nru linux-aws-5.19.0/arch/sparc/mm/srmmu.c linux-aws-5.19.0/arch/sparc/mm/srmmu.c --- linux-aws-5.19.0/arch/sparc/mm/srmmu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/sparc/mm/srmmu.c 2022-11-29 07:06:46.000000000 +0000 @@ -1636,19 +1636,19 @@ /* Local cross-calls. */ static void smp_flush_page_for_dma(unsigned long page) { - xc1((smpfunc_t) local_ops->page_for_dma, page); + xc1(local_ops->page_for_dma, page); local_ops->page_for_dma(page); } static void smp_flush_cache_all(void) { - xc0((smpfunc_t) local_ops->cache_all); + xc0(local_ops->cache_all); local_ops->cache_all(); } static void smp_flush_tlb_all(void) { - xc0((smpfunc_t) local_ops->tlb_all); + xc0(local_ops->tlb_all); local_ops->tlb_all(); } @@ -1659,7 +1659,7 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc1((smpfunc_t) local_ops->cache_mm, (unsigned long) mm); + xc1(local_ops->cache_mm, (unsigned long)mm); local_ops->cache_mm(mm); } } @@ -1671,7 +1671,7 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) { - xc1((smpfunc_t) local_ops->tlb_mm, (unsigned long) mm); + xc1(local_ops->tlb_mm, (unsigned long)mm); if (atomic_read(&mm->mm_users) == 1 && current->active_mm == mm) cpumask_copy(mm_cpumask(mm), cpumask_of(smp_processor_id())); @@ -1691,8 +1691,8 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc3((smpfunc_t) local_ops->cache_range, - (unsigned long) vma, start, end); + xc3(local_ops->cache_range, (unsigned long)vma, start, + end); local_ops->cache_range(vma, start, end); } } @@ -1708,8 +1708,8 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc3((smpfunc_t) local_ops->tlb_range, - (unsigned long) vma, start, end); + xc3(local_ops->tlb_range, (unsigned long)vma, start, + end); local_ops->tlb_range(vma, start, end); } } @@ -1723,8 +1723,7 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->cache_page, - (unsigned long) vma, page); + xc2(local_ops->cache_page, (unsigned long)vma, page); local_ops->cache_page(vma, page); } } @@ -1738,8 +1737,7 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->tlb_page, - (unsigned long) vma, page); + xc2(local_ops->tlb_page, (unsigned long)vma, page); local_ops->tlb_page(vma, page); } } @@ -1753,7 +1751,7 @@ * XXX This experiment failed, research further... -DaveM */ #if 1 - xc1((smpfunc_t) local_ops->page_to_ram, page); + xc1(local_ops->page_to_ram, page); #endif local_ops->page_to_ram(page); } @@ -1764,8 +1762,7 @@ cpumask_copy(&cpu_mask, mm_cpumask(mm)); cpumask_clear_cpu(smp_processor_id(), &cpu_mask); if (!cpumask_empty(&cpu_mask)) - xc2((smpfunc_t) local_ops->sig_insns, - (unsigned long) mm, insn_addr); + xc2(local_ops->sig_insns, (unsigned long)mm, insn_addr); local_ops->sig_insns(mm, insn_addr); } diff -Nru linux-aws-5.19.0/arch/um/kernel/um_arch.c linux-aws-5.19.0/arch/um/kernel/um_arch.c --- linux-aws-5.19.0/arch/um/kernel/um_arch.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/um/kernel/um_arch.c 2022-11-29 07:06:46.000000000 +0000 @@ -33,7 +33,7 @@ #include "um_arch.h" #define DEFAULT_COMMAND_LINE_ROOT "root=98:0" -#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty" +#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty0" /* Changed in add_arg and setup_arch, which run before SMP is started */ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 }; @@ -96,7 +96,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < NR_CPUS ? cpu_data + *pos : NULL; + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) diff -Nru linux-aws-5.19.0/arch/um/Makefile linux-aws-5.19.0/arch/um/Makefile --- linux-aws-5.19.0/arch/um/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/um/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -132,10 +132,18 @@ # The wrappers will select whether using "malloc" or the kernel allocator. LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc +# Avoid binutils 2.39+ warnings by marking the stack non-executable and +# ignorning warnings for the kallsyms sections. +LDFLAGS_EXECSTACK = -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments) +endif + LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) # Used by link-vmlinux.sh which has special support for um link export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) +export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK) # When cleaning we don't include .config, so we don't include # TT or skas makefiles and don't clean skas_ptregs.h. diff -Nru linux-aws-5.19.0/arch/x86/events/intel/core.c linux-aws-5.19.0/arch/x86/events/intel/core.c --- linux-aws-5.19.0/arch/x86/events/intel/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/events/intel/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -2101,6 +2101,15 @@ EVENT_EXTRA_END }; +EVENT_ATTR_STR(mem-loads, mem_ld_grt, "event=0xd0,umask=0x5,ldlat=3"); +EVENT_ATTR_STR(mem-stores, mem_st_grt, "event=0xd0,umask=0x6"); + +static struct attribute *grt_mem_attrs[] = { + EVENT_PTR(mem_ld_grt), + EVENT_PTR(mem_st_grt), + NULL +}; + static struct extra_reg intel_grt_extra_regs[] __read_mostly = { /* must define OFFCORE_RSP_X first, see intel_fixup_er() */ INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0), @@ -5874,6 +5883,36 @@ name = "Tremont"; break; + case INTEL_FAM6_ALDERLAKE_N: + x86_pmu.mid_ack = true; + memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, + sizeof(hw_cache_event_ids)); + memcpy(hw_cache_extra_regs, tnt_hw_cache_extra_regs, + sizeof(hw_cache_extra_regs)); + hw_cache_event_ids[C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] = -1; + + x86_pmu.event_constraints = intel_slm_event_constraints; + x86_pmu.pebs_constraints = intel_grt_pebs_event_constraints; + x86_pmu.extra_regs = intel_grt_extra_regs; + + x86_pmu.pebs_aliases = NULL; + x86_pmu.pebs_prec_dist = true; + x86_pmu.pebs_block = true; + x86_pmu.lbr_pt_coexist = true; + x86_pmu.flags |= PMU_FL_HAS_RSP_1; + x86_pmu.flags |= PMU_FL_INSTR_LATENCY; + + intel_pmu_pebs_data_source_grt(); + x86_pmu.pebs_latency_data = adl_latency_data_small; + x86_pmu.get_event_constraints = tnt_get_event_constraints; + x86_pmu.limit_period = spr_limit_period; + td_attr = tnt_events_attrs; + mem_attr = grt_mem_attrs; + extra_attr = nhm_format_attr; + pr_cont("Gracemont events, "); + name = "gracemont"; + break; + case INTEL_FAM6_WESTMERE: case INTEL_FAM6_WESTMERE_EP: case INTEL_FAM6_WESTMERE_EX: @@ -6216,7 +6255,6 @@ case INTEL_FAM6_ALDERLAKE: case INTEL_FAM6_ALDERLAKE_L: - case INTEL_FAM6_ALDERLAKE_N: case INTEL_FAM6_RAPTORLAKE: case INTEL_FAM6_RAPTORLAKE_P: /* diff -Nru linux-aws-5.19.0/arch/x86/events/intel/ds.c linux-aws-5.19.0/arch/x86/events/intel/ds.c --- linux-aws-5.19.0/arch/x86/events/intel/ds.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/events/intel/ds.c 2022-11-29 07:06:46.000000000 +0000 @@ -110,13 +110,18 @@ __intel_pmu_pebs_data_source_skl(pmem, pebs_data_source); } -static void __init intel_pmu_pebs_data_source_grt(u64 *data_source) +static void __init __intel_pmu_pebs_data_source_grt(u64 *data_source) { data_source[0x05] = OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOP, HIT); data_source[0x06] = OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOP, HITM); data_source[0x08] = OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOPX, FWD); } +void __init intel_pmu_pebs_data_source_grt(void) +{ + __intel_pmu_pebs_data_source_grt(pebs_data_source); +} + void __init intel_pmu_pebs_data_source_adl(void) { u64 *data_source; @@ -127,7 +132,7 @@ data_source = x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX].pebs_data_source; memcpy(data_source, pebs_data_source, sizeof(pebs_data_source)); - intel_pmu_pebs_data_source_grt(data_source); + __intel_pmu_pebs_data_source_grt(data_source); } static u64 precise_store_data(u64 status) diff -Nru linux-aws-5.19.0/arch/x86/events/perf_event.h linux-aws-5.19.0/arch/x86/events/perf_event.h --- linux-aws-5.19.0/arch/x86/events/perf_event.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/events/perf_event.h 2022-11-29 07:06:46.000000000 +0000 @@ -1513,6 +1513,8 @@ void intel_pmu_pebs_data_source_adl(void); +void intel_pmu_pebs_data_source_grt(void); + int intel_pmu_setup_lbr_filter(struct perf_event *event); void intel_pt_interrupt(void); diff -Nru linux-aws-5.19.0/arch/x86/include/asm/cpu.h linux-aws-5.19.0/arch/x86/include/asm/cpu.h --- linux-aws-5.19.0/arch/x86/include/asm/cpu.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/cpu.h 2022-11-29 07:06:46.000000000 +0000 @@ -94,4 +94,6 @@ return p1 & p2; } +extern u64 x86_read_arch_cap_msr(void); + #endif /* _ASM_X86_CPU_H */ diff -Nru linux-aws-5.19.0/arch/x86/include/asm/hyperv-tlfs.h linux-aws-5.19.0/arch/x86/include/asm/hyperv-tlfs.h --- linux-aws-5.19.0/arch/x86/include/asm/hyperv-tlfs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/hyperv-tlfs.h 2022-11-29 07:06:46.000000000 +0000 @@ -546,7 +546,7 @@ u64 guest_rip; u32 hv_clean_fields; - u32 hv_padding_32; + u32 padding32_1; u32 hv_synthetic_controls; struct { u32 nested_flush_hypercall:1; @@ -554,7 +554,7 @@ u32 reserved:30; } __packed hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4]; diff -Nru linux-aws-5.19.0/arch/x86/include/asm/intel-family.h linux-aws-5.19.0/arch/x86/include/asm/intel-family.h --- linux-aws-5.19.0/arch/x86/include/asm/intel-family.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/intel-family.h 2022-11-29 07:06:46.000000000 +0000 @@ -27,6 +27,7 @@ * _X - regular server parts * _D - micro server parts * _N,_P - other mobile parts + * _S - other client parts * * Historical OPTDIFFs: * @@ -112,6 +113,7 @@ #define INTEL_FAM6_RAPTORLAKE 0xB7 #define INTEL_FAM6_RAPTORLAKE_P 0xBA +#define INTEL_FAM6_RAPTORLAKE_S 0xBF /* "Small Core" Processors (Atom) */ diff -Nru linux-aws-5.19.0/arch/x86/include/asm/kvm_host.h linux-aws-5.19.0/arch/x86/include/asm/kvm_host.h --- linux-aws-5.19.0/arch/x86/include/asm/kvm_host.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/kvm_host.h 2022-11-29 07:06:46.000000000 +0000 @@ -713,6 +713,7 @@ struct fpu_guest guest_fpu; u64 xcr0; + u64 guest_supported_xcr0; struct kvm_pio_request pio; void *pio_data; diff -Nru linux-aws-5.19.0/arch/x86/include/asm/microcode.h linux-aws-5.19.0/arch/x86/include/asm/microcode.h --- linux-aws-5.19.0/arch/x86/include/asm/microcode.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/microcode.h 2022-11-29 07:06:46.000000000 +0000 @@ -9,6 +9,7 @@ struct ucode_patch { struct list_head plist; void *data; /* Intel uses only this one */ + unsigned int size; u32 patch_id; u16 equiv_cpu; }; diff -Nru linux-aws-5.19.0/arch/x86/include/asm/msr-index.h linux-aws-5.19.0/arch/x86/include/asm/msr-index.h --- linux-aws-5.19.0/arch/x86/include/asm/msr-index.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/msr-index.h 2022-11-29 07:06:46.000000000 +0000 @@ -155,6 +155,11 @@ * Return Stack Buffer Predictions. */ +#define ARCH_CAP_XAPIC_DISABLE BIT(21) /* + * IA32_XAPIC_DISABLE_STATUS MSR + * supported + */ + #define MSR_IA32_FLUSH_CMD 0x0000010b #define L1D_FLUSH BIT(0) /* * Writeback and invalidate the @@ -1046,4 +1051,12 @@ #define MSR_IA32_HW_FEEDBACK_PTR 0x17d0 #define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1 +/* x2APIC locked status */ +#define MSR_IA32_XAPIC_DISABLE_STATUS 0xBD +#define LEGACY_XAPIC_DISABLED BIT(0) /* + * x2APIC mode is locked and + * disabling x2APIC will cause + * a #GP + */ + #endif /* _ASM_X86_MSR_INDEX_H */ diff -Nru linux-aws-5.19.0/arch/x86/include/asm/paravirt_types.h linux-aws-5.19.0/arch/x86/include/asm/paravirt_types.h --- linux-aws-5.19.0/arch/x86/include/asm/paravirt_types.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/paravirt_types.h 2022-11-29 07:06:46.000000000 +0000 @@ -414,8 +414,17 @@ "=c" (__ecx) #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) -/* void functions are still allowed [re]ax for scratch */ +/* + * void functions are still allowed [re]ax for scratch. + * + * The ZERO_CALL_USED REGS feature may end up zeroing out callee-saved + * registers. Make sure we model this with the appropriate clobbers. + */ +#ifdef CONFIG_ZERO_CALL_USED_REGS +#define PVOP_VCALLEE_CLOBBERS "=a" (__eax), PVOP_VCALL_CLOBBERS +#else #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) +#endif #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS #define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11" diff -Nru linux-aws-5.19.0/arch/x86/include/asm/sev.h linux-aws-5.19.0/arch/x86/include/asm/sev.h --- linux-aws-5.19.0/arch/x86/include/asm/sev.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/sev.h 2022-11-29 07:06:46.000000000 +0000 @@ -195,7 +195,7 @@ void snp_set_memory_private(unsigned long vaddr, unsigned int npages); void snp_set_wakeup_secondary_cpu(void); bool snp_init(struct boot_params *bp); -void snp_abort(void); +void __init __noreturn snp_abort(void); int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned long *fw_err); #else static inline void sev_es_ist_enter(struct pt_regs *regs) { } diff -Nru linux-aws-5.19.0/arch/x86/include/asm/smp.h linux-aws-5.19.0/arch/x86/include/asm/smp.h --- linux-aws-5.19.0/arch/x86/include/asm/smp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/include/asm/smp.h 2022-11-29 07:06:46.000000000 +0000 @@ -21,16 +21,6 @@ DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_l2c_id); DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); -static inline struct cpumask *cpu_llc_shared_mask(int cpu) -{ - return per_cpu(cpu_llc_shared_map, cpu); -} - -static inline struct cpumask *cpu_l2c_shared_mask(int cpu) -{ - return per_cpu(cpu_l2c_shared_map, cpu); -} - DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid); DECLARE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid); DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_bios_cpu_apicid); @@ -172,6 +162,16 @@ # define safe_smp_processor_id() smp_processor_id() #endif +static inline struct cpumask *cpu_llc_shared_mask(int cpu) +{ + return per_cpu(cpu_llc_shared_map, cpu); +} + +static inline struct cpumask *cpu_l2c_shared_mask(int cpu) +{ + return per_cpu(cpu_l2c_shared_map, cpu); +} + #else /* !CONFIG_SMP */ #define wbinvd_on_cpu(cpu) wbinvd() static inline int wbinvd_on_all_cpus(void) @@ -179,6 +179,11 @@ wbinvd(); return 0; } + +static inline struct cpumask *cpu_llc_shared_mask(int cpu) +{ + return (struct cpumask *)cpumask_of(0); +} #endif /* CONFIG_SMP */ extern unsigned disabled_cpus; diff -Nru linux-aws-5.19.0/arch/x86/Kconfig linux-aws-5.19.0/arch/x86/Kconfig --- linux-aws-5.19.0/arch/x86/Kconfig 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -450,6 +450,11 @@ This allows 32-bit apic IDs (so it can support very large systems), and accesses the local apic via MSRs not via mmio. + Some Intel systems circa 2022 and later are locked into x2APIC mode + and can not fall back to the legacy APIC modes if SGX or TDX are + enabled in the BIOS. They will be unable to boot without enabling + this option. + If you don't know what to do here, say N. config X86_MPPARSE @@ -1930,7 +1935,7 @@ config X86_SGX bool "Software Guard eXtensions (SGX)" - depends on X86_64 && CPU_SUP_INTEL + depends on X86_64 && CPU_SUP_INTEL && X86_X2APIC depends on CRYPTO=y depends on CRYPTO_SHA256=y select SRCU diff -Nru linux-aws-5.19.0/arch/x86/kernel/alternative.c linux-aws-5.19.0/arch/x86/kernel/alternative.c --- linux-aws-5.19.0/arch/x86/kernel/alternative.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/alternative.c 2022-11-29 07:06:46.000000000 +0000 @@ -1319,22 +1319,23 @@ atomic_t refs; }; -static struct bp_patching_desc *bp_desc; +static struct bp_patching_desc bp_desc; static __always_inline -struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp) +struct bp_patching_desc *try_get_desc(void) { - /* rcu_dereference */ - struct bp_patching_desc *desc = __READ_ONCE(*descp); + struct bp_patching_desc *desc = &bp_desc; - if (!desc || !arch_atomic_inc_not_zero(&desc->refs)) + if (!arch_atomic_inc_not_zero(&desc->refs)) return NULL; return desc; } -static __always_inline void put_desc(struct bp_patching_desc *desc) +static __always_inline void put_desc(void) { + struct bp_patching_desc *desc = &bp_desc; + smp_mb__before_atomic(); arch_atomic_dec(&desc->refs); } @@ -1367,15 +1368,15 @@ /* * Having observed our INT3 instruction, we now must observe - * bp_desc: + * bp_desc with non-zero refcount: * - * bp_desc = desc INT3 + * bp_desc.refs = 1 INT3 * WMB RMB - * write INT3 if (desc) + * write INT3 if (bp_desc.refs != 0) */ smp_rmb(); - desc = try_get_desc(&bp_desc); + desc = try_get_desc(); if (!desc) return 0; @@ -1429,7 +1430,7 @@ ret = 1; out_put: - put_desc(desc); + put_desc(); return ret; } @@ -1460,18 +1461,20 @@ */ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries) { - struct bp_patching_desc desc = { - .vec = tp, - .nr_entries = nr_entries, - .refs = ATOMIC_INIT(1), - }; unsigned char int3 = INT3_INSN_OPCODE; unsigned int i; int do_sync; lockdep_assert_held(&text_mutex); - smp_store_release(&bp_desc, &desc); /* rcu_assign_pointer */ + bp_desc.vec = tp; + bp_desc.nr_entries = nr_entries; + + /* + * Corresponds to the implicit memory barrier in try_get_desc() to + * ensure reading a non-zero refcount provides up to date bp_desc data. + */ + atomic_set_release(&bp_desc.refs, 1); /* * Corresponding read barrier in int3 notifier for making sure the @@ -1559,12 +1562,10 @@ text_poke_sync(); /* - * Remove and synchronize_rcu(), except we have a very primitive - * refcount based completion. + * Remove and wait for refs to be zero. */ - WRITE_ONCE(bp_desc, NULL); /* RCU_INIT_POINTER */ - if (!atomic_dec_and_test(&desc.refs)) - atomic_cond_read_acquire(&desc.refs, !VAL); + if (!atomic_dec_and_test(&bp_desc.refs)) + atomic_cond_read_acquire(&bp_desc.refs, !VAL); } static void text_poke_loc_init(struct text_poke_loc *tp, void *addr, diff -Nru linux-aws-5.19.0/arch/x86/kernel/apic/apic.c linux-aws-5.19.0/arch/x86/kernel/apic/apic.c --- linux-aws-5.19.0/arch/x86/kernel/apic/apic.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/apic/apic.c 2022-11-29 07:06:46.000000000 +0000 @@ -61,6 +61,7 @@ #include #include #include +#include unsigned int num_processors; @@ -1756,11 +1757,26 @@ enum { X2APIC_OFF, - X2APIC_ON, X2APIC_DISABLED, + /* All states below here have X2APIC enabled */ + X2APIC_ON, + X2APIC_ON_LOCKED }; static int x2apic_state; +static bool x2apic_hw_locked(void) +{ + u64 ia32_cap; + u64 msr; + + ia32_cap = x86_read_arch_cap_msr(); + if (ia32_cap & ARCH_CAP_XAPIC_DISABLE) { + rdmsrl(MSR_IA32_XAPIC_DISABLE_STATUS, msr); + return (msr & LEGACY_XAPIC_DISABLED); + } + return false; +} + static void __x2apic_disable(void) { u64 msr; @@ -1798,6 +1814,10 @@ apicid); return 0; } + if (x2apic_hw_locked()) { + pr_warn("APIC locked in x2apic mode, can't disable\n"); + return 0; + } pr_warn("x2apic already enabled.\n"); __x2apic_disable(); } @@ -1812,10 +1832,18 @@ void x2apic_setup(void) { /* - * If x2apic is not in ON state, disable it if already enabled + * Try to make the AP's APIC state match that of the BSP, but if the + * BSP is unlocked and the AP is locked then there is a state mismatch. + * Warn about the mismatch in case a GP fault occurs due to a locked AP + * trying to be turned off. + */ + if (x2apic_state != X2APIC_ON_LOCKED && x2apic_hw_locked()) + pr_warn("x2apic lock mismatch between BSP and AP.\n"); + /* + * If x2apic is not in ON or LOCKED state, disable it if already enabled * from BIOS. */ - if (x2apic_state != X2APIC_ON) { + if (x2apic_state < X2APIC_ON) { __x2apic_disable(); return; } @@ -1836,6 +1864,11 @@ if (x2apic_id >= 255) panic("Cannot disable x2apic, id: %08x\n", x2apic_id); + if (x2apic_hw_locked()) { + pr_warn("Cannot disable locked x2apic, id: %08x\n", x2apic_id); + return; + } + __x2apic_disable(); register_lapic_address(mp_lapic_addr); } @@ -1894,7 +1927,10 @@ if (x2apic_enabled()) { pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); x2apic_mode = 1; - x2apic_state = X2APIC_ON; + if (x2apic_hw_locked()) + x2apic_state = X2APIC_ON_LOCKED; + else + x2apic_state = X2APIC_ON; } else if (!boot_cpu_has(X86_FEATURE_X2APIC)) { x2apic_state = X2APIC_DISABLED; } diff -Nru linux-aws-5.19.0/arch/x86/kernel/cpu/feat_ctl.c linux-aws-5.19.0/arch/x86/kernel/cpu/feat_ctl.c --- linux-aws-5.19.0/arch/x86/kernel/cpu/feat_ctl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/cpu/feat_ctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include #include -#include "cpu.h" #undef pr_fmt #define pr_fmt(fmt) "x86/cpu: " fmt diff -Nru linux-aws-5.19.0/arch/x86/kernel/cpu/mce/apei.c linux-aws-5.19.0/arch/x86/kernel/cpu/mce/apei.c --- linux-aws-5.19.0/arch/x86/kernel/cpu/mce/apei.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/cpu/mce/apei.c 2022-11-29 07:06:46.000000000 +0000 @@ -29,15 +29,26 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) { struct mce m; + int lsb; if (!(mem_err->validation_bits & CPER_MEM_VALID_PA)) return; + /* + * Even if the ->validation_bits are set for address mask, + * to be extra safe, check and reject an error radius '0', + * and fall back to the default page size. + */ + if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) + lsb = find_first_bit((void *)&mem_err->physical_addr_mask, PAGE_SHIFT); + else + lsb = PAGE_SHIFT; + mce_setup(&m); m.bank = -1; /* Fake a memory read error with unknown channel */ m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | MCI_STATUS_MISCV | 0x9f; - m.misc = (MCI_MISC_ADDR_PHYS << 6) | PAGE_SHIFT; + m.misc = (MCI_MISC_ADDR_PHYS << 6) | lsb; if (severity >= GHES_SEV_RECOVERABLE) m.status |= MCI_STATUS_UC; diff -Nru linux-aws-5.19.0/arch/x86/kernel/cpu/microcode/amd.c linux-aws-5.19.0/arch/x86/kernel/cpu/microcode/amd.c --- linux-aws-5.19.0/arch/x86/kernel/cpu/microcode/amd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/cpu/microcode/amd.c 2022-11-29 07:06:46.000000000 +0000 @@ -788,6 +788,7 @@ kfree(patch); return -EINVAL; } + patch->size = *patch_size; mc_hdr = (struct microcode_header_amd *)(fw + SECTION_HDR_SIZE); proc_id = mc_hdr->processor_rev_id; @@ -869,7 +870,7 @@ return ret; memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); - memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE)); + memcpy(amd_ucode_patch, p->data, min_t(u32, p->size, PATCH_MAX_SIZE)); return ret; } diff -Nru linux-aws-5.19.0/arch/x86/kernel/cpu/resctrl/pseudo_lock.c linux-aws-5.19.0/arch/x86/kernel/cpu/resctrl/pseudo_lock.c --- linux-aws-5.19.0/arch/x86/kernel/cpu/resctrl/pseudo_lock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/cpu/resctrl/pseudo_lock.c 2022-11-29 07:06:46.000000000 +0000 @@ -420,6 +420,7 @@ struct pseudo_lock_region *plr = rdtgrp->plr; u32 rmid_p, closid_p; unsigned long i; + u64 saved_msr; #ifdef CONFIG_KASAN /* * The registers used for local register variables are also used @@ -463,6 +464,7 @@ * the buffer and evict pseudo-locked memory read earlier from the * cache. */ + saved_msr = __rdmsr(MSR_MISC_FEATURE_CONTROL); __wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); closid_p = this_cpu_read(pqr_state.cur_closid); rmid_p = this_cpu_read(pqr_state.cur_rmid); @@ -514,7 +516,7 @@ __wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p); /* Re-enable the hardware prefetcher(s) */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr); local_irq_enable(); plr->thread_done = 1; @@ -871,6 +873,7 @@ static int measure_cycles_lat_fn(void *_plr) { struct pseudo_lock_region *plr = _plr; + u32 saved_low, saved_high; unsigned long i; u64 start, end; void *mem_r; @@ -879,6 +882,7 @@ /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); mem_r = READ_ONCE(plr->kmem); /* @@ -895,7 +899,7 @@ end = rdtsc_ordered(); trace_pseudo_lock_mem_latency((u32)(end - start)); } - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); plr->thread_done = 1; wake_up_interruptible(&plr->lock_thread_wq); @@ -940,6 +944,7 @@ u64 hits_before = 0, hits_after = 0, miss_before = 0, miss_after = 0; struct perf_event *miss_event, *hit_event; int hit_pmcnum, miss_pmcnum; + u32 saved_low, saved_high; unsigned int line_size; unsigned int size; unsigned long i; @@ -973,6 +978,7 @@ /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); /* Initialize rest of local variables */ @@ -1031,7 +1037,7 @@ */ rmb(); /* Re-enable hardware prefetchers */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); out_hit: perf_event_release_kernel(hit_event); diff -Nru linux-aws-5.19.0/arch/x86/kernel/cpu/sgx/main.c linux-aws-5.19.0/arch/x86/kernel/cpu/sgx/main.c --- linux-aws-5.19.0/arch/x86/kernel/cpu/sgx/main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/cpu/sgx/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -49,9 +49,13 @@ * Reset post-kexec EPC pages to the uninitialized state. The pages are removed * from the input list, and made available for the page allocator. SECS pages * prepending their children in the input list are left intact. + * + * Return 0 when sanitization was successful or kthread was stopped, and the + * number of unsanitized pages otherwise. */ -static void __sgx_sanitize_pages(struct list_head *dirty_page_list) +static unsigned long __sgx_sanitize_pages(struct list_head *dirty_page_list) { + unsigned long left_dirty = 0; struct sgx_epc_page *page; LIST_HEAD(dirty); int ret; @@ -59,7 +63,7 @@ /* dirty_page_list is thread-local, no need for a lock: */ while (!list_empty(dirty_page_list)) { if (kthread_should_stop()) - return; + return 0; page = list_first_entry(dirty_page_list, struct sgx_epc_page, list); @@ -92,12 +96,14 @@ } else { /* The page is not yet clean - move to the dirty list. */ list_move_tail(&page->list, &dirty); + left_dirty++; } cond_resched(); } list_splice(&dirty, dirty_page_list); + return left_dirty; } static bool sgx_reclaimer_age(struct sgx_epc_page *epc_page) @@ -440,10 +446,7 @@ * required for SECS pages, whose child pages blocked EREMOVE. */ __sgx_sanitize_pages(&sgx_dirty_page_list); - __sgx_sanitize_pages(&sgx_dirty_page_list); - - /* sanity check: */ - WARN_ON(!list_empty(&sgx_dirty_page_list)); + WARN_ON(__sgx_sanitize_pages(&sgx_dirty_page_list)); while (!kthread_should_stop()) { if (try_to_freeze()) diff -Nru linux-aws-5.19.0/arch/x86/kernel/sev.c linux-aws-5.19.0/arch/x86/kernel/sev.c --- linux-aws-5.19.0/arch/x86/kernel/sev.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kernel/sev.c 2022-11-29 07:06:46.000000000 +0000 @@ -2112,7 +2112,7 @@ return true; } -void __init snp_abort(void) +void __init __noreturn snp_abort(void) { sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED); } diff -Nru linux-aws-5.19.0/arch/x86/kvm/cpuid.c linux-aws-5.19.0/arch/x86/kvm/cpuid.c --- linux-aws-5.19.0/arch/x86/kvm/cpuid.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/cpuid.c 2022-11-29 07:06:46.000000000 +0000 @@ -283,7 +283,6 @@ { struct kvm_lapic *apic = vcpu->arch.apic; struct kvm_cpuid_entry2 *best; - u64 guest_supported_xcr0; best = kvm_find_cpuid_entry(vcpu, 1, 0); if (best && apic) { @@ -295,10 +294,16 @@ kvm_apic_set_version(vcpu); } - guest_supported_xcr0 = + vcpu->arch.guest_supported_xcr0 = cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent); - vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0; + /* + * FP+SSE can always be saved/restored via KVM_{G,S}ET_XSAVE, even if + * XSAVE/XCRO are not exposed to the guest, and even if XSAVE isn't + * supported by the host. + */ + vcpu->arch.guest_fpu.fpstate->user_xfeatures = vcpu->arch.guest_supported_xcr0 | + XFEATURE_MASK_FPSSE; kvm_update_pv_runtime(vcpu); @@ -865,8 +870,6 @@ entry->edx = 0; } break; - case 9: - break; case 0xa: { /* Architectural Performance Monitoring */ struct x86_pmu_capability cap; union cpuid10_eax eax; diff -Nru linux-aws-5.19.0/arch/x86/kvm/emulate.c linux-aws-5.19.0/arch/x86/kvm/emulate.c --- linux-aws-5.19.0/arch/x86/kvm/emulate.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/emulate.c 2022-11-29 07:06:46.000000000 +0000 @@ -1955,7 +1955,7 @@ if (rc != X86EMUL_CONTINUE) return rc; - if (ctxt->modrm_reg == VCPU_SREG_SS) + if (seg == VCPU_SREG_SS) ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; if (ctxt->op_bytes > 2) rsp_increment(ctxt, ctxt->op_bytes - 2); @@ -4134,6 +4134,9 @@ { u32 eax, ecx, edx; + if (!(ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSXSAVE)) + return emulate_ud(ctxt); + eax = reg_read(ctxt, VCPU_REGS_RAX); edx = reg_read(ctxt, VCPU_REGS_RDX); ecx = reg_read(ctxt, VCPU_REGS_RCX); diff -Nru linux-aws-5.19.0/arch/x86/kvm/mmu/mmu.c linux-aws-5.19.0/arch/x86/kvm/mmu/mmu.c --- linux-aws-5.19.0/arch/x86/kvm/mmu/mmu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/mmu/mmu.c 2022-11-29 07:06:46.000000000 +0000 @@ -5907,47 +5907,18 @@ const struct kvm_memory_slot *memslot, int start_level) { - bool flush = false; - if (kvm_memslots_have_rmaps(kvm)) { write_lock(&kvm->mmu_lock); - flush = slot_handle_level(kvm, memslot, slot_rmap_write_protect, - start_level, KVM_MAX_HUGEPAGE_LEVEL, - false); + slot_handle_level(kvm, memslot, slot_rmap_write_protect, + start_level, KVM_MAX_HUGEPAGE_LEVEL, false); write_unlock(&kvm->mmu_lock); } if (is_tdp_mmu_enabled(kvm)) { read_lock(&kvm->mmu_lock); - flush |= kvm_tdp_mmu_wrprot_slot(kvm, memslot, start_level); + kvm_tdp_mmu_wrprot_slot(kvm, memslot, start_level); read_unlock(&kvm->mmu_lock); } - - /* - * Flush TLBs if any SPTEs had to be write-protected to ensure that - * guest writes are reflected in the dirty bitmap before the memslot - * update completes, i.e. before enabling dirty logging is visible to - * userspace. - * - * Perform the TLB flush outside the mmu_lock to reduce the amount of - * time the lock is held. However, this does mean that another CPU can - * now grab mmu_lock and encounter a write-protected SPTE while CPUs - * still have a writable mapping for the associated GFN in their TLB. - * - * This is safe but requires KVM to be careful when making decisions - * based on the write-protection status of an SPTE. Specifically, KVM - * also write-protects SPTEs to monitor changes to guest page tables - * during shadow paging, and must guarantee no CPUs can write to those - * page before the lock is dropped. As mentioned in the previous - * paragraph, a write-protected SPTE is no guarantee that CPU cannot - * perform writes. So to determine if a TLB flush is truly required, KVM - * will clear a separate software-only bit (MMU-writable) and skip the - * flush if-and-only-if this bit was already clear. - * - * See is_writable_pte() for more details. - */ - if (flush) - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot); } /* Must be called with the mmu_lock held in write-mode. */ @@ -6070,32 +6041,30 @@ void kvm_mmu_slot_leaf_clear_dirty(struct kvm *kvm, const struct kvm_memory_slot *memslot) { - bool flush = false; - if (kvm_memslots_have_rmaps(kvm)) { write_lock(&kvm->mmu_lock); /* * Clear dirty bits only on 4k SPTEs since the legacy MMU only * support dirty logging at a 4k granularity. */ - flush = slot_handle_level_4k(kvm, memslot, __rmap_clear_dirty, false); + slot_handle_level_4k(kvm, memslot, __rmap_clear_dirty, false); write_unlock(&kvm->mmu_lock); } if (is_tdp_mmu_enabled(kvm)) { read_lock(&kvm->mmu_lock); - flush |= kvm_tdp_mmu_clear_dirty_slot(kvm, memslot); + kvm_tdp_mmu_clear_dirty_slot(kvm, memslot); read_unlock(&kvm->mmu_lock); } /* + * The caller will flush the TLBs after this function returns. + * * It's also safe to flush TLBs out of mmu lock here as currently this * function is only used for dirty logging, in which case flushing TLB * out of mmu lock also guarantees no dirty pages will be lost in * dirty_bitmap. */ - if (flush) - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot); } void kvm_mmu_zap_all(struct kvm *kvm) diff -Nru linux-aws-5.19.0/arch/x86/kvm/mmu/spte.h linux-aws-5.19.0/arch/x86/kvm/mmu/spte.h --- linux-aws-5.19.0/arch/x86/kvm/mmu/spte.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/mmu/spte.h 2022-11-29 07:06:46.000000000 +0000 @@ -326,7 +326,7 @@ } /* - * An shadow-present leaf SPTE may be non-writable for 3 possible reasons: + * A shadow-present leaf SPTE may be non-writable for 4 possible reasons: * * 1. To intercept writes for dirty logging. KVM write-protects huge pages * so that they can be split be split down into the dirty logging @@ -344,8 +344,13 @@ * read-only memslot or guest memory backed by a read-only VMA. Writes to * such pages are disallowed entirely. * - * To keep track of why a given SPTE is write-protected, KVM uses 2 - * software-only bits in the SPTE: + * 4. To emulate the Accessed bit for SPTEs without A/D bits. Note, in this + * case, the SPTE is access-protected, not just write-protected! + * + * For cases #1 and #4, KVM can safely make such SPTEs writable without taking + * mmu_lock as capturing the Accessed/Dirty state doesn't require taking it. + * To differentiate #1 and #4 from #2 and #3, KVM uses two software-only bits + * in the SPTE: * * shadow_mmu_writable_mask, aka MMU-writable - * Cleared on SPTEs that KVM is currently write-protecting for shadow paging @@ -374,7 +379,8 @@ * shadow page tables between vCPUs. Write-protecting an SPTE for dirty logging * (which does not clear the MMU-writable bit), does not flush TLBs before * dropping the lock, as it only needs to synchronize guest writes with the - * dirty bitmap. + * dirty bitmap. Similarly, making the SPTE inaccessible (and non-writable) for + * access-tracking via the clear_young() MMU notifier also does not flush TLBs. * * So, there is the problem: clearing the MMU-writable bit can encounter a * write-protected SPTE while CPUs still have writable mappings for that SPTE diff -Nru linux-aws-5.19.0/arch/x86/kvm/vmx/nested.c linux-aws-5.19.0/arch/x86/kvm/vmx/nested.c --- linux-aws-5.19.0/arch/x86/kvm/vmx/nested.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/vmx/nested.c 2022-11-29 07:06:46.000000000 +0000 @@ -2322,9 +2322,14 @@ * are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate * on the related bits (if supported by the CPU) in the hope that * we can avoid VMWrites during vmx_set_efer(). + * + * Similarly, take vmcs01's PERF_GLOBAL_CTRL in the hope that if KVM is + * loading PERF_GLOBAL_CTRL via the VMCS for L1, then KVM will want to + * do the same for L2. */ exec_control = __vm_entry_controls_get(vmcs01); - exec_control |= vmcs12->vm_entry_controls; + exec_control |= (vmcs12->vm_entry_controls & + ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL); exec_control &= ~(VM_ENTRY_IA32E_MODE | VM_ENTRY_LOAD_IA32_EFER); if (cpu_has_load_ia32_efer()) { if (guest_efer & EFER_LMA) @@ -3834,7 +3839,16 @@ u32 intr_info = nr | INTR_INFO_VALID_MASK; if (vcpu->arch.exception.has_error_code) { - vmcs12->vm_exit_intr_error_code = vcpu->arch.exception.error_code; + /* + * Intel CPUs do not generate error codes with bits 31:16 set, + * and more importantly VMX disallows setting bits 31:16 in the + * injected error code for VM-Entry. Drop the bits to mimic + * hardware and avoid inducing failure on nested VM-Entry if L1 + * chooses to inject the exception back to L2. AMD CPUs _do_ + * generate "full" 32-bit error codes, so KVM allows userspace + * to inject exception error codes with bits 31:16 set. + */ + vmcs12->vm_exit_intr_error_code = (u16)vcpu->arch.exception.error_code; intr_info |= INTR_INFO_DELIVER_CODE_MASK; } @@ -4264,14 +4278,6 @@ nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL); } - - /* - * Drop what we picked up for L2 via vmx_complete_interrupts. It is - * preserved above and would only end up incorrectly in L1. - */ - vcpu->arch.nmi_injected = false; - kvm_clear_exception_queue(vcpu); - kvm_clear_interrupt_queue(vcpu); } /* @@ -4611,6 +4617,17 @@ WARN_ON_ONCE(nested_early_check); } + /* + * Drop events/exceptions that were queued for re-injection to L2 + * (picked up via vmx_complete_interrupts()), as well as exceptions + * that were pending for L2. Note, this must NOT be hoisted above + * prepare_vmcs12(), events/exceptions queued for re-injection need to + * be captured in vmcs12 (see vmcs12_save_pending_event()). + */ + vcpu->arch.nmi_injected = false; + kvm_clear_exception_queue(vcpu); + kvm_clear_interrupt_queue(vcpu); + vmx_switch_vmcs(vcpu, &vmx->vmcs01); /* Update any VMCS fields that might have changed while L2 ran */ diff -Nru linux-aws-5.19.0/arch/x86/kvm/vmx/vmx.c linux-aws-5.19.0/arch/x86/kvm/vmx/vmx.c --- linux-aws-5.19.0/arch/x86/kvm/vmx/vmx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/vmx/vmx.c 2022-11-29 07:06:46.000000000 +0000 @@ -835,8 +835,7 @@ if (!(exec_controls_get(vmx) & CPU_BASED_USE_MSR_BITMAPS)) return true; - return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, - MSR_IA32_SPEC_CTRL); + return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, msr); } unsigned int __vmx_vcpu_run_flags(struct vcpu_vmx *vmx) @@ -1688,7 +1687,17 @@ kvm_deliver_exception_payload(vcpu); if (has_error_code) { - vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); + /* + * Despite the error code being architecturally defined as 32 + * bits, and the VMCS field being 32 bits, Intel CPUs and thus + * VMX don't actually supporting setting bits 31:16. Hardware + * will (should) never provide a bogus error code, but AMD CPUs + * do generate error codes with bits 31:16 set, and so KVM's + * ABI lets userspace shove in arbitrary 32-bit values. Drop + * the upper bits to avoid VM-Fail, losing information that + * does't really exist is preferable to killing the VM. + */ + vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, (u16)error_code); intr_info |= INTR_INFO_DELIVER_CODE_MASK; } diff -Nru linux-aws-5.19.0/arch/x86/kvm/x86.c linux-aws-5.19.0/arch/x86/kvm/x86.c --- linux-aws-5.19.0/arch/x86/kvm/x86.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/kvm/x86.c 2022-11-29 07:06:46.000000000 +0000 @@ -1025,15 +1025,10 @@ } EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state); -static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu) -{ - return vcpu->arch.guest_fpu.fpstate->user_xfeatures; -} - #ifdef CONFIG_X86_64 static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu) { - return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC; + return vcpu->arch.guest_supported_xcr0 & XFEATURE_MASK_USER_DYNAMIC; } #endif @@ -1056,7 +1051,7 @@ * saving. However, xcr0 bit 0 is always set, even if the * emulated CPU does not support XSAVE (see kvm_vcpu_reset()). */ - valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP; + valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP; if (xcr0 & ~valid_bits) return 1; @@ -1084,6 +1079,7 @@ int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu) { + /* Note, #UD due to CR4.OSXSAVE=0 has priority over the intercept. */ if (static_call(kvm_x86_get_cpl)(vcpu) != 0 || __kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) { kvm_inject_gp(vcpu, 0); @@ -1570,12 +1566,32 @@ static u32 msr_based_features[ARRAY_SIZE(msr_based_features_all)]; static unsigned int num_msr_based_features; +/* + * Some IA32_ARCH_CAPABILITIES bits have dependencies on MSRs that KVM + * does not yet virtualize. These include: + * 10 - MISC_PACKAGE_CTRLS + * 11 - ENERGY_FILTERING_CTL + * 12 - DOITM + * 18 - FB_CLEAR_CTRL + * 21 - XAPIC_DISABLE_STATUS + * 23 - OVERCLOCKING_STATUS + */ + +#define KVM_SUPPORTED_ARCH_CAP \ + (ARCH_CAP_RDCL_NO | ARCH_CAP_IBRS_ALL | ARCH_CAP_RSBA | \ + ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \ + ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ + ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ + ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO) + static u64 kvm_get_arch_capabilities(void) { u64 data = 0; - if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) + if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) { rdmsrl(MSR_IA32_ARCH_CAPABILITIES, data); + data &= KVM_SUPPORTED_ARCH_CAP; + } /* * If nx_huge_pages is enabled, KVM's shadow paging will ensure that @@ -1623,9 +1639,6 @@ */ } - /* Guests don't need to know "Fill buffer clear control" exists */ - data &= ~ARCH_CAP_FB_CLEAR_CTRL; - return data; } @@ -12248,6 +12261,50 @@ } else { kvm_mmu_slot_remove_write_access(kvm, new, PG_LEVEL_4K); } + + /* + * Unconditionally flush the TLBs after enabling dirty logging. + * A flush is almost always going to be necessary (see below), + * and unconditionally flushing allows the helpers to omit + * the subtly complex checks when removing write access. + * + * Do the flush outside of mmu_lock to reduce the amount of + * time mmu_lock is held. Flushing after dropping mmu_lock is + * safe as KVM only needs to guarantee the slot is fully + * write-protected before returning to userspace, i.e. before + * userspace can consume the dirty status. + * + * Flushing outside of mmu_lock requires KVM to be careful when + * making decisions based on writable status of an SPTE, e.g. a + * !writable SPTE doesn't guarantee a CPU can't perform writes. + * + * Specifically, KVM also write-protects guest page tables to + * monitor changes when using shadow paging, and must guarantee + * no CPUs can write to those page before mmu_lock is dropped. + * Because CPUs may have stale TLB entries at this point, a + * !writable SPTE doesn't guarantee CPUs can't perform writes. + * + * KVM also allows making SPTES writable outside of mmu_lock, + * e.g. to allow dirty logging without taking mmu_lock. + * + * To handle these scenarios, KVM uses a separate software-only + * bit (MMU-writable) to track if a SPTE is !writable due to + * a guest page table being write-protected (KVM clears the + * MMU-writable flag when write-protecting for shadow paging). + * + * The use of MMU-writable is also the primary motivation for + * the unconditional flush. Because KVM must guarantee that a + * CPU doesn't contain stale, writable TLB entries for a + * !MMU-writable SPTE, KVM must flush if it encounters any + * MMU-writable SPTE regardless of whether the actual hardware + * writable bit was set. I.e. KVM is almost guaranteed to need + * to flush, while unconditionally flushing allows the "remove + * write access" helpers to ignore MMU-writable entirely. + * + * See is_writable_pte() for more details (the case involving + * access-tracked SPTEs is particularly relevant). + */ + kvm_arch_flush_remote_tlbs_memslot(kvm, new); } } diff -Nru linux-aws-5.19.0/arch/x86/lib/usercopy.c linux-aws-5.19.0/arch/x86/lib/usercopy.c --- linux-aws-5.19.0/arch/x86/lib/usercopy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/lib/usercopy.c 2022-11-29 07:06:46.000000000 +0000 @@ -44,7 +44,7 @@ * called from other contexts. */ pagefault_disable(); - ret = __copy_from_user_inatomic(to, from, n); + ret = raw_copy_from_user(to, from, n); pagefault_enable(); return ret; diff -Nru linux-aws-5.19.0/arch/x86/net/bpf_jit_comp.c linux-aws-5.19.0/arch/x86/net/bpf_jit_comp.c --- linux-aws-5.19.0/arch/x86/net/bpf_jit_comp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/net/bpf_jit_comp.c 2022-11-29 07:06:46.000000000 +0000 @@ -2216,7 +2216,7 @@ return ret; } -static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) +static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs, u8 *image, u8 *buf) { u8 *jg_reloc, *prog = *pprog; int pivot, err, jg_bytes = 1; @@ -2232,12 +2232,12 @@ EMIT2_off32(0x81, add_1reg(0xF8, BPF_REG_3), progs[a]); err = emit_cond_near_jump(&prog, /* je func */ - (void *)progs[a], prog, + (void *)progs[a], image + (prog - buf), X86_JE); if (err) return err; - emit_indirect_jump(&prog, 2 /* rdx */, prog); + emit_indirect_jump(&prog, 2 /* rdx */, image + (prog - buf)); *pprog = prog; return 0; @@ -2262,7 +2262,7 @@ jg_reloc = prog; err = emit_bpf_dispatcher(&prog, a, a + pivot, /* emit lower_part */ - progs); + progs, image, buf); if (err) return err; @@ -2276,7 +2276,7 @@ emit_code(jg_reloc - jg_bytes, jg_offset, jg_bytes); err = emit_bpf_dispatcher(&prog, a + pivot + 1, /* emit upper_part */ - b, progs); + b, progs, image, buf); if (err) return err; @@ -2296,12 +2296,12 @@ return 0; } -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { - u8 *prog = image; + u8 *prog = buf; sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); - return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs); + return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs, image, buf); } struct x64_jit_data { diff -Nru linux-aws-5.19.0/arch/x86/um/shared/sysdep/syscalls_32.h linux-aws-5.19.0/arch/x86/um/shared/sysdep/syscalls_32.h --- linux-aws-5.19.0/arch/x86/um/shared/sysdep/syscalls_32.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/um/shared/sysdep/syscalls_32.h 2022-11-29 07:06:46.000000000 +0000 @@ -6,10 +6,9 @@ #include #include -typedef long syscall_handler_t(struct pt_regs); +typedef long syscall_handler_t(struct syscall_args); extern syscall_handler_t *sys_call_table[]; #define EXECUTE_SYSCALL(syscall, regs) \ - ((long (*)(struct syscall_args)) \ - (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) + ((*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) diff -Nru linux-aws-5.19.0/arch/x86/um/tls_32.c linux-aws-5.19.0/arch/x86/um/tls_32.c --- linux-aws-5.19.0/arch/x86/um/tls_32.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/um/tls_32.c 2022-11-29 07:06:46.000000000 +0000 @@ -65,9 +65,6 @@ struct thread_struct *t = &task->thread; int idx; - if (!t->arch.tls_array) - return GDT_ENTRY_TLS_MIN; - for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) if (!t->arch.tls_array[idx].present) return idx + GDT_ENTRY_TLS_MIN; @@ -240,9 +237,6 @@ { struct thread_struct *t = &task->thread; - if (!t->arch.tls_array) - goto clear; - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL; diff -Nru linux-aws-5.19.0/arch/x86/um/vdso/Makefile linux-aws-5.19.0/arch/x86/um/vdso/Makefile --- linux-aws-5.19.0/arch/x86/um/vdso/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/um/vdso/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -62,7 +62,7 @@ -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' -VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv +VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv -z noexecstack GCOV_PROFILE := n # diff -Nru linux-aws-5.19.0/arch/x86/xen/enlighten_pv.c linux-aws-5.19.0/arch/x86/xen/enlighten_pv.c --- linux-aws-5.19.0/arch/x86/xen/enlighten_pv.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/arch/x86/xen/enlighten_pv.c 2022-11-29 07:06:46.000000000 +0000 @@ -765,6 +765,7 @@ { static DEFINE_SPINLOCK(lock); static struct trap_info traps[257]; + static const struct trap_info zero = { }; unsigned out; trace_xen_cpu_load_idt(desc); @@ -774,7 +775,7 @@ memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); out = xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] = zero; xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) diff -Nru linux-aws-5.19.0/block/bio.c linux-aws-5.19.0/block/bio.c --- linux-aws-5.19.0/block/bio.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/block/bio.c 2022-11-29 07:06:46.000000000 +0000 @@ -760,8 +760,6 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) { bio_set_flag(bio, BIO_CLONED); - if (bio_flagged(bio_src, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_iter = bio_src->bi_iter; diff -Nru linux-aws-5.19.0/block/blk-core.c linux-aws-5.19.0/block/blk-core.c --- linux-aws-5.19.0/block/blk-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -285,49 +285,6 @@ } /** - * blk_cleanup_queue - shutdown a request queue - * @q: request queue to shutdown - * - * Mark @q DYING, drain all pending requests, mark @q DEAD, destroy and - * put it. All future requests will be failed immediately with -ENODEV. - * - * Context: can sleep - */ -void blk_cleanup_queue(struct request_queue *q) -{ - /* cannot be called from atomic context */ - might_sleep(); - - WARN_ON_ONCE(blk_queue_registered(q)); - - /* mark @q DYING, no new request or merges will be allowed afterwards */ - blk_queue_flag_set(QUEUE_FLAG_DYING, q); - blk_queue_start_drain(q); - - blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q); - blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q); - - /* - * Drain all requests queued before DYING marking. Set DEAD flag to - * prevent that blk_mq_run_hw_queues() accesses the hardware queues - * after draining finished. - */ - blk_freeze_queue(q); - - blk_queue_flag_set(QUEUE_FLAG_DEAD, q); - - blk_sync_queue(q); - if (queue_is_mq(q)) { - blk_mq_cancel_work_sync(q); - blk_mq_exit_queue(q); - } - - /* @q is and will stay empty, shutdown and put */ - blk_put_queue(q); -} -EXPORT_SYMBOL(blk_cleanup_queue); - -/** * blk_queue_enter() - try to increase q->q_usage_counter * @q: request queue pointer * @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PM @@ -338,7 +295,7 @@ while (!blk_try_enter_queue(q, pm)) { if (flags & BLK_MQ_REQ_NOWAIT) - return -EBUSY; + return -EAGAIN; /* * read pair of barrier in blk_freeze_queue_start(), we need to @@ -368,7 +325,7 @@ if (test_bit(GD_DEAD, &disk->state)) goto dead; bio_wouldblock_error(bio); - return -EBUSY; + return -EAGAIN; } /* diff -Nru linux-aws-5.19.0/block/blk.h linux-aws-5.19.0/block/blk.h --- linux-aws-5.19.0/block/blk.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk.h 2022-11-29 07:06:46.000000000 +0000 @@ -260,8 +260,7 @@ void blk_insert_flush(struct request *rq); -int elevator_switch_mq(struct request_queue *q, - struct elevator_type *new_e); +int elevator_switch(struct request_queue *q, struct elevator_type *new_e); void elevator_exit(struct request_queue *q); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); @@ -411,6 +410,9 @@ sector_t length); void blk_drop_partitions(struct gendisk *disk); +struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, + struct lock_class_key *lkclass); + int bio_add_hw_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset, unsigned int max_sectors, bool *same_page); diff -Nru linux-aws-5.19.0/block/blk-lib.c linux-aws-5.19.0/block/blk-lib.c --- linux-aws-5.19.0/block/blk-lib.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk-lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -311,6 +311,11 @@ struct blk_plug plug; int ret = 0; + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */ + if (max_sectors > UINT_MAX >> SECTOR_SHIFT) + max_sectors = UINT_MAX >> SECTOR_SHIFT; + max_sectors &= ~bs_mask; + if (max_sectors == 0) return -EOPNOTSUPP; if ((sector | nr_sects) & bs_mask) @@ -324,10 +329,10 @@ bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp); bio->bi_iter.bi_sector = sector; - bio->bi_iter.bi_size = len; + bio->bi_iter.bi_size = len << SECTOR_SHIFT; - sector += len << SECTOR_SHIFT; - nr_sects -= len << SECTOR_SHIFT; + sector += len; + nr_sects -= len; if (!nr_sects) { ret = submit_bio_wait(bio); bio_put(bio); diff -Nru linux-aws-5.19.0/block/blk-mq.c linux-aws-5.19.0/block/blk-mq.c --- linux-aws-5.19.0/block/blk-mq.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/block/blk-mq.c 2022-11-29 07:06:46.000000000 +0000 @@ -3896,7 +3896,7 @@ q->queuedata = queuedata; ret = blk_mq_init_allocated_queue(set, q); if (ret) { - blk_cleanup_queue(q); + blk_put_queue(q); return ERR_PTR(ret); } return q; @@ -3908,6 +3908,35 @@ } EXPORT_SYMBOL(blk_mq_init_queue); +/** + * blk_mq_destroy_queue - shutdown a request queue + * @q: request queue to shutdown + * + * This shuts down a request queue allocated by blk_mq_init_queue() and drops + * the initial reference. All future requests will failed with -ENODEV. + * + * Context: can sleep + */ +void blk_mq_destroy_queue(struct request_queue *q) +{ + WARN_ON_ONCE(!queue_is_mq(q)); + WARN_ON_ONCE(blk_queue_registered(q)); + + might_sleep(); + + blk_queue_flag_set(QUEUE_FLAG_DYING, q); + blk_queue_start_drain(q); + blk_freeze_queue(q); + + blk_sync_queue(q); + blk_mq_cancel_work_sync(q); + blk_mq_exit_queue(q); + + /* @q is and will stay empty, shutdown and put */ + blk_put_queue(q); +} +EXPORT_SYMBOL(blk_mq_destroy_queue); + struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set, void *queuedata, struct lock_class_key *lkclass) { @@ -3920,13 +3949,23 @@ disk = __alloc_disk_node(q, set->numa_node, lkclass); if (!disk) { - blk_cleanup_queue(q); + blk_mq_destroy_queue(q); return ERR_PTR(-ENOMEM); } + set_bit(GD_OWNS_QUEUE, &disk->state); return disk; } EXPORT_SYMBOL(__blk_mq_alloc_disk); +struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q, + struct lock_class_key *lkclass) +{ + if (!blk_get_queue(q)) + return NULL; + return __alloc_disk_node(q, NUMA_NO_NODE, lkclass); +} +EXPORT_SYMBOL(blk_mq_alloc_disk_for_queue); + static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx( struct blk_mq_tag_set *set, struct request_queue *q, int hctx_idx, int node) @@ -4442,14 +4481,14 @@ list_add(&qe->node, head); /* - * After elevator_switch_mq, the previous elevator_queue will be + * After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get(qe->type->elevator_owner); - elevator_switch_mq(q, NULL); + elevator_switch(q, NULL); mutex_unlock(&q->sysfs_lock); return true; @@ -4481,7 +4520,7 @@ kfree(qe); mutex_lock(&q->sysfs_lock); - elevator_switch_mq(q, t); + elevator_switch(q, t); mutex_unlock(&q->sysfs_lock); } diff -Nru linux-aws-5.19.0/block/blk-mq-debugfs.c linux-aws-5.19.0/block/blk-mq-debugfs.c --- linux-aws-5.19.0/block/blk-mq-debugfs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/block/blk-mq-debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -116,7 +116,6 @@ QUEUE_FLAG_NAME(NOXMERGES), QUEUE_FLAG_NAME(ADD_RANDOM), QUEUE_FLAG_NAME(SAME_FORCE), - QUEUE_FLAG_NAME(DEAD), QUEUE_FLAG_NAME(INIT_DONE), QUEUE_FLAG_NAME(STABLE_WRITES), QUEUE_FLAG_NAME(POLL), @@ -151,11 +150,10 @@ char opbuf[16] = { }, *op; /* - * The "state" attribute is removed after blk_cleanup_queue() has called - * blk_mq_free_queue(). Return if QUEUE_FLAG_DEAD has been set to avoid - * triggering a use-after-free. + * The "state" attribute is removed when the queue is removed. Don't + * allow setting the state on a dying queue to avoid a use-after-free. */ - if (blk_queue_dead(q)) + if (blk_queue_dying(q)) return -ENOENT; if (count >= sizeof(opbuf)) { diff -Nru linux-aws-5.19.0/block/blk-sysfs.c linux-aws-5.19.0/block/blk-sysfs.c --- linux-aws-5.19.0/block/blk-sysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk-sysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -748,11 +748,6 @@ * decremented with blk_put_queue(). Once the refcount reaches 0 this function * is called. * - * For drivers that have a request_queue on a gendisk and added with - * __device_add_disk() the refcount to request_queue will reach 0 with - * the last put_disk() called by the driver. For drivers which don't use - * __device_add_disk() this happens with blk_cleanup_queue(). - * * Drivers exist which depend on the release of the request_queue to be * synchronous, it should not be deferred. * diff -Nru linux-aws-5.19.0/block/blk-throttle.c linux-aws-5.19.0/block/blk-throttle.c --- linux-aws-5.19.0/block/blk-throttle.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk-throttle.c 2022-11-29 07:06:46.000000000 +0000 @@ -806,12 +806,12 @@ u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); - u64 bytes_allowed, extra_bytes, tmp; + u64 bytes_allowed, extra_bytes; unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; unsigned int bio_size = throtl_bio_data_size(bio); /* no need to throttle if this bio's bytes have been accounted */ - if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED)) { + if (bps_limit == U64_MAX || bio_flagged(bio, BIO_BPS_THROTTLED)) { if (wait) *wait = 0; return true; @@ -824,10 +824,8 @@ jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; - do_div(tmp, HZ); - bytes_allowed = tmp; + bytes_allowed = mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed_rnd, + (u64)HZ); if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) { if (wait) @@ -921,22 +919,13 @@ unsigned int bio_size = throtl_bio_data_size(bio); /* Charge the bio to the group */ - if (!bio_flagged(bio, BIO_THROTTLED)) { + if (!bio_flagged(bio, BIO_BPS_THROTTLED)) { tg->bytes_disp[rw] += bio_size; tg->last_bytes_disp[rw] += bio_size; } tg->io_disp[rw]++; tg->last_io_disp[rw]++; - - /* - * BIO_THROTTLED is used to prevent the same bio to be throttled - * more than once as a throttled bio will go through blk-throtl the - * second time when it eventually gets issued. Set it when a bio - * is being charged to a tg. - */ - if (!bio_flagged(bio, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); } /** @@ -1026,6 +1015,7 @@ sq->nr_queued[rw]--; throtl_charge_bio(tg, bio); + bio_set_flag(bio, BIO_BPS_THROTTLED); /* * If our parent is another tg, we just need to transfer @bio to @@ -2159,8 +2149,10 @@ qn = &tg->qnode_on_parent[rw]; sq = sq->parent_sq; tg = sq_to_tg(sq); - if (!tg) + if (!tg) { + bio_set_flag(bio, BIO_BPS_THROTTLED); goto out_unlock; + } } /* out-of-limit, queue to @tg */ @@ -2189,8 +2181,6 @@ } out_unlock: - bio_set_flag(bio, BIO_THROTTLED); - #ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY; diff -Nru linux-aws-5.19.0/block/blk-throttle.h linux-aws-5.19.0/block/blk-throttle.h --- linux-aws-5.19.0/block/blk-throttle.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/blk-throttle.h 2022-11-29 07:06:46.000000000 +0000 @@ -175,7 +175,7 @@ struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg); /* no need to throttle bps any more if the bio has been throttled */ - if (bio_flagged(bio, BIO_THROTTLED) && + if (bio_flagged(bio, BIO_BPS_THROTTLED) && !(tg->flags & THROTL_TG_HAS_IOPS_LIMIT)) return false; diff -Nru linux-aws-5.19.0/block/blk-wbt.c linux-aws-5.19.0/block/blk-wbt.c --- linux-aws-5.19.0/block/blk-wbt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/block/blk-wbt.c 2022-11-29 07:06:46.000000000 +0000 @@ -841,8 +841,11 @@ rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec = RWB_WINDOW_NSEC; rwb->enable_state = WBT_STATE_ON_DEFAULT; - rwb->wc = 1; + rwb->wc = test_bit(QUEUE_FLAG_WC, &q->queue_flags); rwb->rq_depth.default_depth = RWB_DEF_DEPTH; + rwb->min_lat_nsec = wbt_default_latency_nsec(q); + + wbt_queue_depth_changed(&rwb->rqos); /* * Assign rwb and add the stats callback. @@ -853,11 +856,6 @@ blk_stat_add_callback(q, rwb->cb); - rwb->min_lat_nsec = wbt_default_latency_nsec(q); - - wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - return 0; err_free: diff -Nru linux-aws-5.19.0/block/bsg-lib.c linux-aws-5.19.0/block/bsg-lib.c --- linux-aws-5.19.0/block/bsg-lib.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/bsg-lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -324,7 +324,7 @@ container_of(q->tag_set, struct bsg_set, tag_set); bsg_unregister_queue(bset->bd); - blk_cleanup_queue(q); + blk_mq_destroy_queue(q); blk_mq_free_tag_set(&bset->tag_set); kfree(bset); } @@ -399,7 +399,7 @@ return q; out_cleanup_queue: - blk_cleanup_queue(q); + blk_mq_destroy_queue(q); out_queue: blk_mq_free_tag_set(set); out_tag_set: diff -Nru linux-aws-5.19.0/block/elevator.c linux-aws-5.19.0/block/elevator.c --- linux-aws-5.19.0/block/elevator.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/elevator.c 2022-11-29 07:06:46.000000000 +0000 @@ -588,7 +588,7 @@ } EXPORT_SYMBOL_GPL(elv_unregister); -int elevator_switch_mq(struct request_queue *q, +static int elevator_switch_mq(struct request_queue *q, struct elevator_type *new_e) { int ret; @@ -723,7 +723,7 @@ * need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) +int elevator_switch(struct request_queue *q, struct elevator_type *new_e) { int err; diff -Nru linux-aws-5.19.0/block/genhd.c linux-aws-5.19.0/block/genhd.c --- linux-aws-5.19.0/block/genhd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/genhd.c 2022-11-29 07:06:46.000000000 +0000 @@ -617,13 +617,14 @@ * Fail any new I/O. */ set_bit(GD_DEAD, &disk->state); + if (test_bit(GD_OWNS_QUEUE, &disk->state)) + blk_queue_flag_set(QUEUE_FLAG_DYING, q); set_capacity(disk, 0); /* * Prevent new I/O from crossing bio_queue_enter(). */ blk_queue_start_drain(q); - blk_mq_freeze_queue_wait(q); if (!(disk->flags & GENHD_FL_HIDDEN)) { sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); @@ -647,6 +648,8 @@ pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); device_del(disk_to_dev(disk)); + blk_mq_freeze_queue_wait(q); + blk_throtl_cancel_bios(disk->queue); blk_sync_queue(q); @@ -663,11 +666,16 @@ blk_mq_unquiesce_queue(q); /* - * Allow using passthrough request again after the queue is torn down. + * If the disk does not own the queue, allow using passthrough requests + * again. Else leave the queue frozen to fail all I/O. */ - blk_queue_flag_clear(QUEUE_FLAG_INIT_DONE, q); - __blk_mq_unfreeze_queue(q, true); - + if (!test_bit(GD_OWNS_QUEUE, &disk->state)) { + blk_queue_flag_clear(QUEUE_FLAG_INIT_DONE, q); + __blk_mq_unfreeze_queue(q, true); + } else { + if (queue_is_mq(q)) + blk_mq_exit_queue(q); + } } EXPORT_SYMBOL(del_gendisk); @@ -1151,6 +1159,18 @@ might_sleep(); WARN_ON_ONCE(disk_live(disk)); + /* + * To undo the all initialization from blk_mq_init_allocated_queue in + * case of a probe failure where add_disk is never called we have to + * call blk_mq_exit_queue here. We can't do this for the more common + * teardown case (yet) as the tagset can be gone by the time the disk + * is released once it was added. + */ + if (queue_is_mq(disk->queue) && + test_bit(GD_OWNS_QUEUE, &disk->state) && + !test_bit(GD_ADDED, &disk->state)) + blk_mq_exit_queue(disk->queue); + blkcg_exit_queue(disk->queue); disk_release_events(disk); @@ -1338,12 +1358,9 @@ { struct gendisk *disk; - if (!blk_get_queue(q)) - return NULL; - disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); if (!disk) - goto out_put_queue; + return NULL; disk->bdi = bdi_alloc(node_id); if (!disk->bdi) @@ -1387,11 +1404,8 @@ bdi_put(disk->bdi); out_free_disk: kfree(disk); -out_put_queue: - blk_put_queue(q); return NULL; } -EXPORT_SYMBOL(__alloc_disk_node); struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass) { @@ -1404,9 +1418,10 @@ disk = __alloc_disk_node(q, node, lkclass); if (!disk) { - blk_cleanup_queue(q); + blk_put_queue(q); return NULL; } + set_bit(GD_OWNS_QUEUE, &disk->state); return disk; } EXPORT_SYMBOL(__blk_alloc_disk); @@ -1418,6 +1433,9 @@ * This decrements the refcount for the struct gendisk. When this reaches 0 * we'll have disk_release() called. * + * Note: for blk-mq disk put_disk must be called before freeing the tag_set + * when handling probe errors (that is before add_disk() is called). + * * Context: Any context, but the last reference must not be dropped from * atomic context. */ @@ -1439,7 +1457,6 @@ */ void blk_cleanup_disk(struct gendisk *disk) { - blk_cleanup_queue(disk->queue); put_disk(disk); } EXPORT_SYMBOL(blk_cleanup_disk); diff -Nru linux-aws-5.19.0/block/partitions/core.c linux-aws-5.19.0/block/partitions/core.c --- linux-aws-5.19.0/block/partitions/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/block/partitions/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -597,6 +597,9 @@ if (disk->flags & GENHD_FL_NO_PART) return 0; + if (test_bit(GD_SUPPRESS_PART_SCAN, &disk->state)) + return 0; + state = check_partition(disk); if (!state) return 0; diff -Nru linux-aws-5.19.0/certs/Kconfig linux-aws-5.19.0/certs/Kconfig --- linux-aws-5.19.0/certs/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/certs/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -43,7 +43,7 @@ bool "Provide system-wide ring of trusted keys" depends on KEYS depends on ASYMMETRIC_KEY_TYPE - depends on X509_CERTIFICATE_PARSER + depends on X509_CERTIFICATE_PARSER = y help Provide a system keyring to which trusted keys can be added. Keys in the keyring are considered to be trusted. Keys may be added at will diff -Nru linux-aws-5.19.0/crypto/akcipher.c linux-aws-5.19.0/crypto/akcipher.c --- linux-aws-5.19.0/crypto/akcipher.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/crypto/akcipher.c 2022-11-29 07:06:46.000000000 +0000 @@ -120,6 +120,12 @@ return -ENOSYS; } +static int akcipher_default_set_key(struct crypto_akcipher *tfm, + const void *key, unsigned int keylen) +{ + return -ENOSYS; +} + int crypto_register_akcipher(struct akcipher_alg *alg) { struct crypto_alg *base = &alg->base; @@ -132,6 +138,8 @@ alg->encrypt = akcipher_default_op; if (!alg->decrypt) alg->decrypt = akcipher_default_op; + if (!alg->set_priv_key) + alg->set_priv_key = akcipher_default_set_key; akcipher_prepare_alg(alg); return crypto_register_alg(base); diff -Nru linux-aws-5.19.0/debian/changelog linux-aws-5.19.0/debian/changelog --- linux-aws-5.19.0/debian/changelog 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/changelog 2022-11-29 07:06:46.000000000 +0000 @@ -1,6 +1,1695 @@ -linux-aws (5.19.0-1014.15) kinetic; urgency=medium +linux-aws (5.19.0-1015.16) kinetic; urgency=medium - * kinetic/linux-aws: 5.19.0-1014.15 -proposed tracker (LP: #1997421) + * kinetic/linux-aws: 5.19.0-1015.16 -proposed tracker (LP: #1997781) + + * Kinetic update: v5.19.9 upstream stable release (LP: #1994068) // Kinetic + update: v5.19.12 upstream stable release (LP: #1994074) // Kinetic update: + v5.19.15 upstream stable release (LP: #1994078) // Kinetic update: v5.19.17 + upstream stable release (LP: #1994179) + - [Config] Updates after rebase + + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/master) + + [ Ubuntu: 5.19.0-27.28 ] + + * kinetic/linux: 5.19.0-27.28 -proposed tracker (LP: #1997794) + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/2022.11.14) + * selftests/.../nat6to4 breaks the selftests build (LP: #1996536) + - [Config] Disable selftests/net/bpf/nat6to4 + * Expose built-in trusted and revoked certificates (LP: #1996892) + - [Packaging] Expose built-in trusted and revoked certificates + * support for same series backports versioning numbers (LP: #1993563) + - [Packaging] sameport -- add support for sameport versioning + * Add cs35l41 firmware loading support (LP: #1995957) + - ASoC: cs35l41: Move cs35l41 exit hibernate function into shared code + - ASoC: cs35l41: Add common cs35l41 enter hibernate function + - ASoC: cs35l41: Do not print error when waking from hibernation + - ALSA: hda: cs35l41: Don't dereference fwnode handle + - ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations + - ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() + - ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 + - ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls + - ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly + - ALSA: hda: cs35l41: Save codec object inside component struct + - ALSA: hda: cs35l41: Add initial DSP support and firmware loading + - ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver + - ALSA: hda: cs35l41: Support reading subsystem id from ACPI + - ALSA: hda: cs35l41: Support multiple load paths for firmware + - ALSA: hda: cs35l41: Support Speaker ID for laptops + - ALSA: hda: cs35l41: Support Hibernation during Suspend + - ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables + - ALSA: hda: hda_cs_dsp_ctl: Add fw id strings + - ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence + - ALSA: hda: cs35l41: Support Firmware switching and reloading + - ALSA: hda: cs35l41: Add module parameter to control firmware load + - Revert "ALSA: hda: cs35l41: Allow compilation test on non-ACPI + configurations" + - ALSA: hda/realtek: More robust component matching for CS35L41 + - [Config] updateconfigs for SND_HDA_CS_DSP_CONTROLS + * Fibocom WWAN FM350-GL suspend error (notebook not suspend) (LP: #1990700) + - net: wwan: t7xx: Add AP CLDMA + * Screen cannot turn on after screen off with Matrox G200eW3 [102b:0536] + (LP: #1995573) + - drm/mgag200: Optimize damage clips + - drm/mgag200: Add FB_DAMAGE_CLIPS support + - drm/mgag200: Enable atomic gamma lut update + * TEE Support for CCP driver (LP: #1991608) + - crypto: ccp: Add support for TEE for PCI ID 0x14CA + * AMD Cezanne takes 5 minutes to wake up from suspend (LP: #1993715) + - platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems + * Fix ath11k deadlock on WCN6855 (LP: #1995041) + - wifi: ath11k: avoid deadlock during regulatory update in + ath11k_regd_update() + * intel_pmc_core not load on Raptor Lake (LP: #1988461) + - x86/cpu: Add new Raptor Lake CPU model number + - platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver + * [UBUNTU 20.04] boot: Add s390x secure boot trailer (LP: #1996071) + - s390/boot: add secure boot trailer + * Fix rfkill causing soft blocked wifi (LP: #1996198) + - platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi + * Support Icicle Kit reference design v2022.10 (LP: #1993148) + - riscv: dts: microchip: icicle: re-jig fabric peripheral addresses + - riscv: dts: microchip: reduce the fic3 clock rate + - riscv: dts: microchip: update memory configuration for v2022.10 + - riscv: dts: microchip: fix fabric i2c reg size + - SAUCE: riscv: dts: microchip: Disable PCIe on the Icicle Kit + * Fix Turbostat is not working for fam: 6 model: 191: stepping: 2 CPU + (LP: #1991365) + - tools/power turbostat: Add support for RPL-S + * armhf kernel compiled with gcc-12 fails to boot on pi 3/2 (LP: #1993120) + - [Packaging] Support arch-specific compilers in updateconfigs + * Kinetic update: v5.19.17 upstream stable release (LP: #1994179) + - Revert "fs: check FMODE_LSEEK to control internal pipe splicing" + - ALSA: oss: Fix potential deadlock at unregistration + - ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() + - ALSA: usb-audio: Fix potential memory leaks + - ALSA: usb-audio: Fix NULL dererence at error path + - ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 + - ALSA: hda/realtek: Correct pin configs for ASUS G533Z + - ALSA: hda/realtek: Add quirk for ASUS GV601R laptop + - ALSA: hda/realtek: Add Intel Reference SSID to support headset keys + - mtd: rawnand: atmel: Unmap streaming DMA mappings + - io_uring/rw: fix unexpected link breakage + - io_uring/net: fix fast_iov assignment in io_setup_async_msg() + - io_uring/net: don't update msg_name if not provided + - io_uring: correct pinned_vm accounting + - hv_netvsc: Fix race between VF offering and VF association message from host + - cifs: destage dirty pages before re-reading them for cache=none + - cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message + - iio: dac: ad5593r: Fix i2c read protocol requirements + - iio: ltc2497: Fix reading conversion results + - iio: adc: ad7923: fix channel readings for some variants + - iio: pressure: dps310: Refactor startup procedure + - iio: pressure: dps310: Reset chip after timeout + - xhci: dbc: Fix memory leak in xhci_alloc_dbc() + - usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video() + - usb: add quirks for Lenovo OneLink+ Dock + - mmc: core: Add SD card quirk for broken discard + - can: kvaser_usb: Fix use of uninitialized completion + - can: kvaser_usb_leaf: Fix overread with an invalid command + - can: kvaser_usb_leaf: Fix TX queue out of sync after restart + - can: kvaser_usb_leaf: Fix CAN state after restart + - mmc: renesas_sdhi: Fix rounding errors + - mmc: sdhci-tegra: Use actual clock rate for SW tuning correction + - mmc: sdhci-sprd: Fix minimum clock limit + - i2c: designware: Fix handling of real but unexpected device interrupts + - fs: dlm: fix race between test_bit() and queue_work() + - fs: dlm: handle -EBUSY first in lock arg validation + - fs: dlm: fix invalid derefence of sb_lvbptr + - btf: Export bpf_dynptr definition + - HID: multitouch: Add memory barriers + - quota: Check next/prev free block number after reading from quota file + - platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure + - arm64: dts: qcom: sdm845-mtp: correct ADC settle time + - ASoC: wcd9335: fix order of Slimbus unprepare/disable + - ASoC: wcd934x: fix order of Slimbus unprepare/disable + - hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API + - net: thunderbolt: Enable DMA paths only after rings are enabled + - regulator: qcom_rpm: Fix circular deferral regression + - arm64: topology: move store_cpu_topology() to shared code + - riscv: topology: fix default topology reporting + - RISC-V: Re-enable counter access from userspace + - RISC-V: Make port I/O string accessors actually work + - parisc: fbdev/stifb: Align graphics memory size to 4MB + - parisc: Fix userspace graphics card breakage due to pgtable special bit + - riscv: vdso: fix NULL deference in vdso_join_timens() when vfork + - riscv: Make VM_WRITE imply VM_READ + - riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb + - riscv: Pass -mno-relax only on lld < 15.0.0 + - UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK + - nvmem: core: Fix memleak in nvmem_register() + - nvme-multipath: fix possible hang in live ns resize with ANA access + - dmaengine: mxs: use platform_driver_register + - dmaengine: qcom-adm: fix wrong sizeof config in slave_config + - dmaengine: qcom-adm: fix wrong calling convention for prep_slave_sg + - drm/virtio: Check whether transferred 2D BO is shmem + - drm/virtio: Unlock reservations on virtio_gpu_object_shmem_init() error + - drm/virtio: Unlock reservations on dma_resv_reserve_fences() error + - drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb() + - drm/udl: Restore display mode on resume + - arm64: mte: move register initialization to C + - [Config] updateconfigs for ARM64_ERRATUM_2441007 + - arm64: errata: Add Cortex-A55 to the repeat tlbi list + - clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value + - mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page + - mm/damon: validate if the pmd entry is present before accessing + - mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in + - mm/mmap: undo ->mmap() when arch_validate_flags() fails + - xen/gntdev: Prevent leaking grants + - xen/gntdev: Accommodate VMA splitting + - PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge + - serial: cpm_uart: Don't request IRQ too early for console port + - serial: stm32: Deassert Transmit Enable on ->rs485_config() + - serial: 8250: Let drivers request full 16550A feature probing + - serial: 8250: Request full 16550A feature probing for OxSemi PCIe devices + - cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning + - powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain + - powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE + - powerpc/boot: Explicitly disable usage of SPE instructions + - slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure + - slimbus: qcom-ngd: cleanup in probe error path + - scsi: lpfc: Rework MIB Rx Monitor debug info logic + - scsi: qedf: Populate sysfs attributes for vport + - gpio: rockchip: request GPIO mux to pinctrl when setting direction + - pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback + - fbdev: smscufx: Fix use-after-free in ufx_ops_open() + - hwrng: core - let sleep be interrupted when unregistering hwrng + - smb3: do not log confusing message when server returns no network interfaces + - ksmbd: fix incorrect handling of iterate_dir + - ksmbd: fix endless loop when encryption for response fails + - ksmbd: Fix wrong return value and message length check in smb2_ioctl() + - ksmbd: Fix user namespace mapping + - fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE + - btrfs: fix alignment of VMA for memory mapped files on THP + - btrfs: enhance unsupported compat RO flags handling + - btrfs: fix race between quota enable and quota rescan ioctl + - btrfs: fix missed extent on fsync after dropping extent maps + - btrfs: set generation before calling btrfs_clean_tree_block in + btrfs_init_new_buffer + - f2fs: fix wrong continue condition in GC + - f2fs: complete checkpoints during remount + - f2fs: flush pending checkpoints when freezing super + - f2fs: increase the limit for reserve_root + - f2fs: fix to do sanity check on destination blkaddr during recovery + - f2fs: fix to do sanity check on summary info + - jbd2: wake up journal waiters in FIFO order, not LIFO + - jbd2: fix potential buffer head reference count leak + - jbd2: fix potential use-after-free in jbd2_fc_wait_bufs + - jbd2: add miss release buffer head in fc_do_one_pass() + - ext2: Add sanity checks for group and filesystem size + - ext4: avoid crash when inline data creation follows DIO write + - ext4: fix null-ptr-deref in ext4_write_info + - ext4: make ext4_lazyinit_thread freezable + - ext4: fix check for block being out of directory size + - ext4: don't increase iversion counter for ea_inodes + - ext4: unconditionally enable the i_version counter + - ext4: ext4_read_bh_lock() should submit IO if the buffer isn't uptodate + - ext4: place buffer head allocation before handle start + - ext4: fix i_version handling in ext4 + - ext4: fix dir corruption when ext4_dx_add_entry() fails + - ext4: fix miss release buffer head in ext4_fc_write_inode + - ext4: fix potential memory leak in ext4_fc_record_modified_inode() + - ext4: fix potential memory leak in ext4_fc_record_regions() + - ext4: update 'state->fc_regions_size' after successful memory allocation + - livepatch: fix race between fork and KLP transition + - ftrace: Properly unset FTRACE_HASH_FL_MOD + - ftrace: Still disable enabled records marked as disabled + - ring-buffer: Allow splice to read previous partially read pages + - ring-buffer: Have the shortest_full queue be the shortest not longest + - ring-buffer: Check pending waiters when doing wake ups as well + - ring-buffer: Add ring_buffer_wake_waiters() + - ring-buffer: Fix race between reset page and reading page + - tracing: Disable interrupt or preemption before acquiring arch_spinlock_t + - tracing: Wake up ring buffer waiters on closing of the file + - tracing: Wake up waiters when tracing is disabled + - tracing: Add ioctl() to force ring buffer waiters to wake up + - tracing: Do not free snapshot if tracer is on cmdline + - tracing: Move duplicate code of trace_kprobe/eprobe.c into header + - tracing: Add "(fault)" name injection to kernel probes + - tracing: Fix reading strings from synthetic events + - rpmsg: char: Avoid double destroy of default endpoint + - thunderbolt: Explicitly enable lane adapter hotplug events at startup + - efi: libstub: drop pointless get_memory_map() call + - media: cedrus: Set the platform driver data earlier + - media: cedrus: Fix endless loop in cedrus_h265_skip_bits() + - blk-throttle: fix that io throttle can only work for single bio + - blk-wbt: call rq_qos_add() after wb_normal is initialized + - KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility + - KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" + - KVM: nVMX: Don't propagate vmcs12's PERF_GLOBAL_CTRL settings to vmcs02 + - KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS + - staging: greybus: audio_helper: remove unused and wrong debugfs usage + - drm/nouveau/kms/nv140-: Disable interlacing + - drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() + - drm/i915/gt: Use i915_vm_put on ppgtt_create error paths + - drm/i915: Fix watermark calculations for gen12+ RC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ MC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier + - drm/i915: Fix watermark calculations for DG2 CCS modifiers + - drm/i915: Fix watermark calculations for DG2 CCS+CC modifier + - drm/amd/display: Fix vblank refcount in vrr transition + - drm/amd/display: explicitly disable psr_feature_enable appropriately + - smb3: must initialize two ACL struct fields to zero + - selinux: use "grep -E" instead of "egrep" + - ima: fix blocking of security.ima xattrs of unsupported algorithms + - userfaultfd: open userfaultfds with O_RDONLY + - ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers + - thermal: cpufreq_cooling: Check the policy first in + cpufreq_cooling_register() + - cpufreq: amd-pstate: Fix initial highest_perf value + - sh: machvec: Use char[] for section boundaries + - MIPS: SGI-IP30: Fix platform-device leak in bridge_platform_create() + - MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() + - erofs: fix order >= MAX_ORDER warning due to crafted negative i_size + - erofs: use kill_anon_super() to kill super in fscache mode + - ARM: 9243/1: riscpc: Unbreak the build + - ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() + - ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE + - ACPI: PCC: Release resources on address space setup failure path + - ACPI: PCC: replace wait_for_completion() + - ACPI: PCC: Fix Tx acknowledge in the PCC address space handler + - objtool: Preserve special st_shndx indexes in elf_update_symbol + - nfsd: Fix a memory leak in an error handling path + - NFSD: Fix handling of oversized NFSv4 COMPOUND requests + - x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled + - wifi: rtlwifi: 8192de: correct checking of IQK reload + - wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() + - bpf: Fix non-static bpf_func_proto struct definitions + - bpf: convert cgroup_bpf.progs to hlist + - bpf: Cleanup check_refcount_ok + - leds: lm3601x: Don't use mutex after it was destroyed + - tsnep: Fix TSNEP_INFO_TX_TIME register define + - bpf: Fix reference state management for synchronous callbacks + - wifi: cfg80211: get correct AP link chandef + - wifi: mac80211: allow bw change during channel switch in mesh + - bpftool: Fix a wrong type cast in btf_dumper_int + - audit: explicitly check audit_context->context enum value + - audit: free audit_proctitle only on task exit + - esp: choose the correct inner protocol for GSO on inter address family + tunnels + - spi: mt7621: Fix an error message in mt7621_spi_probe() + - x86/resctrl: Fix to restore to original value when re-enabling hardware + prefetch register + - xsk: Fix backpressure mechanism on Tx + - selftests/xsk: Add missing close() on netns fd + - bpf: Disable preemption when increasing per-cpu map_locked + - bpf: Propagate error from htab_lock_bucket() to userspace + - wifi: ath11k: Fix incorrect QMI message ID mappings + - bpf: Use this_cpu_{inc|dec|inc_return} for bpf_task_storage_busy + - bpf: Use this_cpu_{inc_return|dec} for prog->active + - Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend + - wifi: rtw89: pci: fix interrupt stuck after leaving low power mode + - wifi: rtw89: pci: correct TX resource checking in low power mode + - wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() + - wifi: wfx: prevent underflow in wfx_send_pds() + - wifi: rtw88: add missing destroy_workqueue() on error path in + rtw_core_init() + - selftests/xsk: Avoid use-after-free on ctx + - spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() + - spi: qup: add missing clk_disable_unprepare on error in + spi_qup_pm_resume_runtime() + - wifi: rtl8xxxu: Fix skb misuse in TX queue selection + - spi: meson-spicc: do not rely on busy flag in pow2 clk ops + - bpf: btf: fix truncated last_member_type_id in btf_struct_resolve + - wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration + - wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask + - wifi: mt76: mt7921e: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921s: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921u: fix race issue between reset and suspend/resume + - wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work + - wifi: mt76: sdio: poll sta stat when device transmits data + - wifi: mt76: sdio: fix transmitting packet hangs + - wifi: mt76: mt7615: add mt7615_mutex_acquire/release in + mt7615_sta_set_decap_offload + - wifi: mt76: mt7915: fix possible unaligned access in + mt7915_mac_add_twt_setup + - wifi: mt76: connac: fix possible unaligned access in + mt76_connac_mcu_add_nested_tlv + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload + - wifi: mt76: mt7915: fix mcs value in ht mode + - wifi: mt76: mt7915: do not check state before configuring implicit beamform + - wifi: mt76: mt7921e: fix rmmod crash in driver reload test + - Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release + - net: fs_enet: Fix wrong check in do_pd_setup + - bpf: Ensure correct locking around vulnerable function find_vpid() + - wifi: ath11k: Include STA_KEEPALIVE_ARP_RESPONSE TLV header by default + - Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure + - netfilter: conntrack: fix the gc rescheduling delay + - netfilter: conntrack: revisit the gc initial rescheduling bias + - flow_dissector: Do not count vlan tags inside tunnel payload + - wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected + - wifi: ath11k: fix number of VHT beamformee spatial streams + - mips: dts: ralink: mt7621: fix external phy on GB-PC2 + - x86/microcode/AMD: Track patch allocation size explicitly + - wifi: ath11k: fix peer addition/deletion error on sta band migration + - x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype + - spi: cadence-quadspi: Fix PM disable depth imbalance in cqspi_probe + - spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe + - spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe + - skmsg: Schedule psock work if the cached skb exists on the psock + - cw1200: fix incorrect check to determine if no element is found in list + - i2c: mlxbf: support lock mechanism + - Bluetooth: hci_core: Fix not handling link timeouts propertly + - xfrm: Reinject transport-mode packets through workqueue + - netfilter: nft_fib: Fix for rpath check with VRF devices + - spi: s3c64xx: Fix large transfers with DMA + - wifi: rtl8xxxu: gen2: Enable 40 MHz channel width + - wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM + - vhost/vsock: Use kvmalloc/kvfree for larger packets. + - eth: alx: take rtnl_lock on resume + - sctp: handle the error returned from sctp_auth_asoc_init_active_key + - tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited + - spi: Ensure that sg_table won't be used after being freed + - Bluetooth: hci_sync: Fix not indicating power state + - hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 + controller + - net: rds: don't hold sock lock when cancelling work from + rds_tcp_reset_callbacks() + - af_unix: Fix memory leaks of the whole sk due to OOB skb. + - net: prestera: acl: Add check for kmemdup + - eth: lan743x: reject extts for non-pci11x1x devices + - bnx2x: fix potential memory leak in bnx2x_tpa_stop() + - eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address + - net: wwan: iosm: Call mutex_init before locking it + - net/ieee802154: reject zero-sized raw_sendmsg() + - once: add DO_ONCE_SLOW() for sleepable contexts + - net: mvpp2: fix mvpp2 debugfs leak + - drm: bridge: adv7511: fix CEC power down control register offset + - drm: bridge: adv7511: unregister cec i2c device after cec adapter + - drm/bridge: Avoid uninitialized variable warning + - drm/mipi-dsi: Detach devices when removing the host + - drm/bridge: it6505: Power on downstream device in .atomic_enable + - drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling + - drm/bridge: tc358767: Add of_node_put() when breaking out of loop + - drm/bridge: parade-ps8640: Fix regulator supply order + - drm/dp_mst: fix drm_dp_dpcd_read return value checks + - drm:pl111: Add of_node_put() when breaking out of + for_each_available_child_of_node() + - ASoC: mt6359: fix tests for platform_get_irq() failure + - drm/msm: Make .remove and .shutdown HW shutdown consistent + - platform/chrome: fix double-free in chromeos_laptop_prepare() + - platform/chrome: fix memory corruption in ioctl + - drm/virtio: Fix same-context optimization + - ASoC: soc-pcm.c: call __soc_pcm_close() in soc_pcm_close() + - ASoC: tas2764: Allow mono streams + - ASoC: tas2764: Drop conflicting set_bias_level power setting + - ASoC: tas2764: Fix mute/unmute + - platform/x86: msi-laptop: Fix old-ec check for backlight registering + - platform/x86: msi-laptop: Fix resource cleanup + - platform/chrome: cros_ec_typec: Correct alt mode index + - drm/amdgpu: add missing pci_disable_device() in + amdgpu_pmops_runtime_resume() + - drm/bridge: megachips: Fix a null pointer dereference bug + - drm/bridge: it6505: Fix the order of DP_SET_POWER commands + - ASoC: rsnd: Add check for rsnd_mod_power_on + - ASoC: wm_adsp: Handle optional legacy support + - ALSA: hda: beep: Simplify keep-power-at-enable behavior + - drm/virtio: set fb_modifiers_not_supported + - drm/bochs: fix blanking + - ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON + - drm/omap: dss: Fix refcount leak bugs + - drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue() + - mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() + - ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API + - drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices + - drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx + - drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() + - ALSA: usb-audio: Properly refcounting clock rate + - drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() + - virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() + - ASoC: codecs: tx-macro: fix kcontrol put + - ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() + - ALSA: dmaengine: increment buffer pointer atomically + - mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() + - ASoC: stm32: dfsdm: Fix PM disable depth imbalance in stm32_adfsdm_probe + - ASoC: stm32: spdifrx: Fix PM disable depth imbalance in stm32_spdifrx_probe + - ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe + - ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe + - ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe + - ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe + - ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe + - ALSA: hda/hdmi: Don't skip notification handling during PM operation + - memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() + - memory: of: Fix refcount leak bug in of_get_ddr_timings() + - memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() + - locks: fix TOCTOU race when granting write lease + - soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() + - soc: qcom: smem_state: Add refcounting for the 'state->of_node' + - ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus + - arm64: dts: renesas: r9a07g044: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types + - dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1 + - ARM: dts: turris-omnia: Fix mpp26 pin name and comment + - ARM: dts: kirkwood: lsxl: fix serial line + - ARM: dts: kirkwood: lsxl: remove first ethernet port + - ia64: export memory_add_physaddr_to_nid to fix cxl build error + - soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA + - arm64: dts: ti: k3-j7200: fix main pinmux range + - ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family + - ARM: Drop CMDLINE_* dependency on ATAGS + - ext4: don't run ext4lazyinit for read-only filesystems + - arm64: ftrace: fix module PLTs with mcount + - ARM: dts: exynos: fix polarity of VBUS GPIO of Origen + - iomap: iomap: fix memory corruption when recording errors during writeback + - iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX + - iio: adc: at91-sama5d2_adc: check return status for pressure and touch + - iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq + - iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume + - iio: inkern: only release the device node when done with it + - iio: inkern: fix return value in devm_of_iio_channel_get_by_name() + - iio: ABI: Fix wrong format of differential capacitance channel ABI. + - iio: magnetometer: yas530: Change data type of hard_offsets to signed + - RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey + - usb: common: debug: Check non-standard control requests + - clk: meson: Hold reference returned by of_get_parent() + - clk: st: Hold reference returned by of_get_parent() + - clk: oxnas: Hold reference returned by of_get_parent() + - clk: qoriq: Hold reference returned by of_get_parent() + - clk: berlin: Add of_node_put() for of_get_parent() + - clk: sprd: Hold reference returned by of_get_parent() + - clk: tegra: Fix refcount leak in tegra210_clock_init + - clk: tegra: Fix refcount leak in tegra114_clock_init + - clk: tegra20: Fix refcount leak in tegra20_clock_init + - clk: samsung: exynosautov9: correct register offsets of peric0/c1 + - HSI: omap_ssi: Fix refcount leak in ssi_probe + - HSI: omap_ssi_port: Fix dma_map_sg error check + - clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock + - media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop + - tty: xilinx_uartps: Fix the ignore_status + - media: amphion: insert picture startcode after seek for vc1g format + - media: amphion: adjust the encoder's value range of gop size + - media: amphion: don't change the colorspace reported by decoder. + - media: amphion: fix a bug that vpu core may not resume after suspend + - media: meson: vdec: add missing clk_disable_unprepare on error in + vdec_hevc_start() + - media: uvcvideo: Fix memory leak in uvc_gpio_parse + - media: uvcvideo: Use entity get_cur in uvc_ctrl_set + - media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init + - RDMA/rxe: Fix "kernel NULL pointer dereference" error + - RDMA/rxe: Fix the error caused by qp->sk + - clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intf's parent + - clk: mediatek: clk-mt8195-vdo1: Reparent and set rate on vdo1_dpintf's + parent + - clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical + - misc: ocxl: fix possible refcount leak in afu_ioctl() + - fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() + - phy: rockchip-inno-usb2: Return zero after otg sync + - dmaengine: idxd: avoid deadlock in process_misc_interrupts() + - dmaengine: hisilicon: Disable channels when unregister hisi_dma + - dmaengine: hisilicon: Fix CQ head update + - dmaengine: hisilicon: Add multi-thread support for a DMA channel + - usb: gadget: f_fs: stricter integer overflow checks + - dyndbg: fix static_branch manipulation + - dyndbg: fix module.dyndbg handling + - dyndbg: let query-modname override actual module name + - dyndbg: drop EXPORTed dynamic_debug_exec_queries + - clk: qcom: sm6115: Select QCOM_GDSC + - mtd: devices: docg3: check the return value of devm_ioremap() in the probe + - remoteproc: Harden rproc_handle_vdev() against integer overflow + - phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by + of_get_parent() + - phy: phy-mtk-tphy: fix the phy type setting issue + - mtd: rawnand: intel: Read the chip-select line from the correct OF node + - mtd: rawnand: intel: Remove undocumented compatible string + - mtd: rawnand: fsl_elbc: Fix none ECC mode + - RDMA/irdma: Align AE id codes to correct flush code and event + - RDMA/irdma: Validate udata inlen and outlen + - RDMA/srp: Fix srp_abort() + - RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. + - RDMA/siw: Fix QP destroy to wait for all references dropped. + - ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() + - ata: fix ata_id_has_devslp() + - ata: fix ata_id_has_ncq_autosense() + - ata: fix ata_id_has_dipm() + - mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() + - md/raid5: Ensure stripe_fill happens on non-read IO with journal + - md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() + - RDMA/cm: Use SLID in the work completion as the DLID in responder side + - IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers + - xhci: Don't show warning for reinit on known broken suspend + - usb: gadget: function: fix dangling pnp_string in f_printer.c + - usb: dwc3: core: fix some leaks in probe + - drivers: serial: jsm: fix some leaks in probe + - serial: 8250: Toggle IER bits on only after irq has been set up + - tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown + - phy: qualcomm: call clk_disable_unprepare in the error handling + - staging: vt6655: fix some erroneous memory clean-up loops + - slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON + - slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register + - firmware: google: Test spinlock on panic path to avoid lockups + - serial: 8250: Fix restoring termios speed after suspend + - scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() + - scsi: pm8001: Fix running_req for internal abort commands + - scsi: iscsi: Rename iscsi_conn_queue_work() + - scsi: iscsi: Add recv workqueue helpers + - scsi: iscsi: Run recv path from workqueue + - scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() + - clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical + - clk: qcom: gcc-sm6115: Override default Alpha PLL regs + - RDMA/rxe: Fix resize_finish() in rxe_queue.c + - fsi: core: Check error number after calling ida_simple_get + - mfd: intel_soc_pmic: Fix an error handling path in + intel_soc_pmic_i2c_probe() + - mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() + - mfd: lp8788: Fix an error handling path in lp8788_probe() + - mfd: lp8788: Fix an error handling path in lp8788_irq_init() and + lp8788_irq_init() + - mfd: fsl-imx25: Fix check for platform_get_irq() errors + - mfd: sm501: Add check for platform_driver_register() + - mfd: da9061: Fix Failed to set Two-Wire Bus Mode. + - clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent + - clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes + - clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup + - clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() + - dmaengine: ioat: stop mod_timer from resurrecting deleted timer in + __cleanup() + - usb: mtu3: fix failed runtime suspend in host only mode + - spmi: pmic-arb: correct duplicate APID to PPID mapping logic + - clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD + - clk: baikal-t1: Fix invalid xGMAC PTP clock divider + - clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent + - clk: baikal-t1: Add SATA internal ref clock buffer + - clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration + - clk: imx: scu: fix memleak on platform_device_add() fails + - clk: ti: Balance of_node_get() calls for of_find_node_by_name() + - clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe + - clk: ast2600: BCLK comes from EPLL + - mailbox: mpfs: fix handling of the reg property + - mailbox: mpfs: account for mbox offsets while sending + - mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg + - ipc: mqueue: fix possible memory leak in init_mqueue_fs() + - powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig + - powerpc/math_emu/efp: Include module.h + - powerpc/sysdev/fsl_msi: Add missing of_node_put() + - powerpc/pci_dn: Add missing of_node_put() + - powerpc/powernv: add missing of_node_put() in opal_export_attrs() + - cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage + - powerpc: Fix fallocate and fadvise64_64 compat parameter combination + - x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition + - powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 + - powerpc/64: mark irqs hard disabled in boot paca + - powerpc/64/interrupt: Fix return to masked context after hard-mask irq + becomes pending + - powerpc: Fix SPE Power ISA properties for e500v1 platforms + - powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe() + - powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL + - crypto: sahara - don't sleep when in softirq + - crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr + - hwrng: arm-smccc-trng - fix NO_ENTROPY handling + - crypto: ccp - Fail the PSP initialization when writing psp data file failed + - cgroup: Honor caller's cgroup NS when resolving path + - hwrng: imx-rngc - Moving IRQ handler registering after + imx_rngc_irq_mask_clear() + - crypto: qat - fix default value of WDT timer + - crypto: hisilicon/qm - fix missing put dfx access + - cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset + - iommu/omap: Fix buffer overflow in debugfs + - crypto: akcipher - default implementation for setting a private key + - crypto: ccp - Release dma channels before dmaengine unrgister + - crypto: inside-secure - Change swab to swab32 + - crypto: qat - fix DMA transfer direction + - clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921 + - clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe + - cifs: return correct error in ->calc_signature() + - iommu/iova: Fix module config properly + - tracing: kprobe: Fix kprobe event gen test module on exit + - tracing: kprobe: Make gen test module work in arm and riscv + - tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads + - kbuild: remove the target in signal traps when interrupted + - linux/export: use inline assembler to populate symbol CRCs + - kbuild: rpm-pkg: fix breakage when V=1 is used + - crypto: marvell/octeontx - prevent integer overflows + - crypto: cavium - prevent integer overflow loading firmware + - random: schedule jitter credit for next jiffy, not in two jiffies + - thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id + - ACPI: APEI: do not add task_work to kernel thread to avoid memory leak + - f2fs: fix race condition on setting FI_NO_EXTENT flag + - f2fs: fix to account FS_CP_DATA_IO correctly + - selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle + - module: tracking: Keep a record of tainted unloaded modules only + - fs: dlm: fix race in lowcomms + - rcu: Avoid triggering strict-GP irq-work when RCU is idle + - rcu: Back off upon fill_page_cache_func() allocation failure + - cpufreq: amd_pstate: fix wrong lowest perf fetch + - ACPI: video: Add Toshiba Satellite/Portege Z830 quirk + - fortify: Fix __compiletime_strlen() under UBSAN_BOUNDS_LOCAL + - ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address + - cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode + - MIPS: BCM47XX: Cast memcmp() of function to (void *) + - powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue + - thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to + avoid crash + - ARM: decompressor: Include .data.rel.ro.local + - ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable + - x86/entry: Work around Clang __bdos() bug + - NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data + - NFSD: fix use-after-free on source server when doing inter-server copy + - wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices + - wifi: brcmfmac: fix invalid address access when enabling SCAN log level + - bpftool: Clear errno after libcap's checks + - ice: set tx_tstamps when creating new Tx rings via ethtool + - net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 + - openvswitch: Fix double reporting of drops in dropwatch + - openvswitch: Fix overreporting of drops in dropwatch + - tcp: annotate data-race around tcp_md5sig_pool_populated + - x86/mce: Retrieve poison range from hardware + - wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() + - thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround + - x86/apic: Don't disable x2APIC if locked + - net: axienet: Switch to 64-bit RX/TX statistics + - net-next: Fix IP_UNICAST_IF option behavior for connected sockets + - xfrm: Update ipcomp_scratches with NULL when freed + - wifi: ath11k: Register shutdown handler for WCN6750 + - rtw89: ser: leave lps with mutex + - iavf: Fix race between iavf_close and iavf_reset_task + - wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() + - Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk + - regulator: core: Prevent integer underflow + - wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register() + - wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value + - wifi: rtw89: free unused skb to prevent memory leak + - wifi: rtw89: fix rx filter after scan + - Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() + - Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times + - bnxt_en: replace reset with config timestamps + - selftests/bpf: Free the allocated resources after test case succeeds + - can: bcm: check the result of can_send() in bcm_can_tx() + - wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620 + - wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 + - wifi: rt2x00: set VGC gain for both chains of MT7620 + - wifi: rt2x00: set SoC wmac clock register + - wifi: rt2x00: correctly set BBP register 86 for MT7620 + - hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms + - net: If sock is dead don't access sock's sk_wq in sk_stream_wait_memory + - bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT + - bpf: use bpf_prog_pack for bpf_dispatcher + - Bluetooth: L2CAP: Fix user-after-free + - i2c: designware-pci: Group AMD NAVI quirk parts together + - drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() + - drm: Use size_t type for len variable in drm_copy_field() + - drm: Prevent drm_copy_field() to attempt copying a NULL pointer + - drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook + - gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() + - drm/amd/display: fix overflow on MIN_I64 definition + - udmabuf: Set ubuf->sg = NULL if the creation of sg table fails + - platform/x86: pmc_atom: Improve quirk message to be less cryptic + - drm: bridge: dw_hdmi: only trigger hotplug event on link change + - drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 + - drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF + - ALSA: usb-audio: Register card at the last interface + - drm/vc4: vec: Fix timings for VEC modes + - drm: panel-orientation-quirks: Add quirk for Anbernic Win600 + - drm: panel-orientation-quirks: Add quirk for Aya Neo Air + - platform/chrome: cros_ec: Notify the PM of wake events during resume + - platform/x86: hp-wmi: Setting thermal profile fails with 0x06 + - platform/x86: msi-laptop: Change DMI match / alias strings to fix module + autoloading + - ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS + - ASoC: SOF: pci: Change DMI match info to support all Chrome platforms + - ASoC: SOF: add quirk to override topology mclk_id + - drm/amdgpu: SDMA update use unlocked iterator + - drm/amd/display: correct hostvm flag + - drm/amdgpu: fix initial connector audio value + - drm/meson: reorder driver deinit sequence to fix use-after-free bug + - drm/meson: explicitly remove aggregate driver at module unload time + - drm/meson: remove drm bridges at aggregate driver unbind time + - drm/dp: Don't rewrite link config when setting phy test pattern + - drm/amd/display: Remove interface for periodic interrupt 1 + - drm/amd/display: polling vid stream status in hpo dp blank + - drm/amdkfd: Fix UBSAN shift-out-of-bounds warning + - ARM: dts: imx6: delete interrupts property if interrupts-extended is set + - ARM: dts: imx7d-sdb: config the max pressure for tsc2046 + - ARM: dts: imx6q: add missing properties for sram + - ARM: dts: imx6dl: add missing properties for sram + - ARM: dts: imx6qp: add missing properties for sram + - ARM: dts: imx6sl: add missing properties for sram + - ARM: dts: imx6sll: add missing properties for sram + - ARM: dts: imx6sx: add missing properties for sram + - ARM: dts: imx6sl: use tabs for code indent + - ARM: dts: imx6sx-udoo-neo: don't use multiple blank lines + - kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT + - arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO + voltage + - arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply + - btrfs: dump extra info if one free space cache has more bitmaps than it + should + - btrfs: scrub: properly report super block errors in system log + - btrfs: scrub: try to fix super block errors + - btrfs: don't print information about space cache or tree every remount + - btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure + - ARM: 9233/1: stacktrace: Skip frame pointer boundary check for + call_with_stack() + - ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value + - ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n + - clk: zynqmp: Fix stack-out-of-bounds in strncpy` + - media: cx88: Fix a null-ptr-deref bug in buffer_prepare() + - media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc + - clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate + - RDMA/rxe: Delete error messages triggered by incoming Read requests + - usb: host: xhci-plat: suspend and resume clocks + - usb: host: xhci-plat: suspend/resume clks for brcm + - scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID + - dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow + - scsi: 3w-9xxx: Avoid disabling device if failing to enable it + - nbd: Fix hung when signal interrupts nbd_start_device_ioctl() + - iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to + identity + - usb: gadget: uvc: increase worker prio to WQ_HIGHPRI + - power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() + - staging: vt6655: fix potential memory leak + - blk-throttle: prevent overflow while calculating wait time + - ata: libahci_platform: Sanity check the DT child nodes number + - bcache: fix set_at_max_writeback_rate() for multiple attached devices + - soundwire: cadence: Don't overwrite msg->buf during write commands + - soundwire: intel: fix error handling on dai registration issues + - HID: roccat: Fix use-after-free in roccat_read() + - HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() + - HID: nintendo: check analog user calibration for plausibility + - eventfd: guard wake_up in eventfd fs calls as well + - md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d + - usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() + - usb: musb: Fix musb_gadget.c rxstate overflow bug + - usb: dwc3: core: add gfladj_refclk_lpm_sel quirk + - arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes + - usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after + resume bug + - Revert "usb: storage: Add quirk for Samsung Fit flash" + - staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() + - staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() + - scsi: tracing: Fix compile error in trace_array calls when TRACING is + disabled + - ext2: Use kvmalloc() for group descriptor array + - nvme: handle effects after freeing the request + - nvme: copy firmware_rev on each init + - nvmet-tcp: add bounds check on Transfer Tag + - usb: idmouse: fix an uninit-value in idmouse_open + - blk-mq: use quiesced elevator switch when reinitializing queues + - hwmon (occ): Retry for checksum failure + - fsi: occ: Prevent use after free + - usb: typec: ucsi: Don't warn on probe deferral + - clk: bcm2835: Make peripheral PLLC critical + - clk: bcm2835: Round UART input clock up + - perf: Skip and warn on unknown format 'configN' attrs + - perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc + - perf intel-pt: Fix system_wide dummy event for hybrid + - mm: hugetlb: fix UAF in hugetlb_handle_userfault + - net: ieee802154: return -EINVAL for unknown addr type + - ALSA: usb-audio: Fix last interface check for registration + - blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() + - [Config] updateconfigs for MDIO_BITBANG + - net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses + - Revert "drm/amd/display: correct hostvm flag" + - Revert "net/ieee802154: reject zero-sized raw_sendmsg()" + - net/ieee802154: don't warn zero-sized raw_sendmsg() + - powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked + context + - drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n + - kbuild: Add skip_encoding_btf_enum64 option to pahole + - Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5 + - Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT + - [Config] updateconfigs for AS_HAS_NON_CONST_LEB128 + - lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 + - HID: uclogic: Add missing suffix for digitalizers + - ext4: continue to expand file system when the target size doesn't reach + - drm/i915: Rename block_size()/block_offset() + - drm/i915/bios: Validate fp_timing terminator presence + - drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers + - Linux 5.19.17 + * Kinetic update: v5.19.16 upstream stable release (LP: #1994164) + - nilfs2: fix use-after-free bug of struct nilfs_root + - nilfs2: fix leak of nilfs_root in case of writer thread creation failure + - nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure + - ceph: don't truncate file in atomic_open + - nvme-pci: set min_align_mask before calculating max_hw_sectors + - random: restore O_NONBLOCK support + - random: clamp credited irq bits to maximum mixed + - ALSA: hda: Fix position reporting on Poulsbo + - ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model + - efi: Correct Macmini DMI match in uefi cert quirk + - USB: serial: qcserial: add new usb-id for Dell branded EM7455 + - Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> + peripheral if extcon is present"" + - Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" + - Revert "powerpc/rtas: Implement reentrant rtas call" + - Revert "crypto: qat - reduce size of mapped region" + - random: avoid reading two cache lines on irq randomness + - random: use expired timer rather than wq for mixing fast pool + - mctp: prevent double key removal and unref + - Input: xpad - add supported devices as contributed on github + - Input: xpad - fix wireless 360 controller breaking after suspend + - misc: pci_endpoint_test: Aggregate params checking for xfer + - misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic + - Linux 5.19.16 + * Kinetic update: v5.19.15 upstream stable release (LP: #1994078) + - sparc: Unbreak the build + - Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 + - [Config] updateconfigs for CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + - hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero + - docs: update mediator information in CoC docs + - xsk: Inherit need_wakeup flag for shared sockets + - firmware: arm_scmi: Improve checks in the info_get operations + - firmware: arm_scmi: Harden accesses to the sensor domains + - firmware: arm_scmi: Add SCMI PM driver remove routine + - arm64: dts: rockchip: fix upper usb port on BPI-R2-Pro + - dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling + - dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property + - dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API + failure + - wifi: iwlwifi: don't spam logs with NSS>2 messages + - ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer + - drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1 + - scsi: qedf: Fix a UAF bug in __qedf_probe() + - net/ieee802154: fix uninit value bug in dgram_sendmsg + - net: marvell: prestera: add support for for Aldrin2 + - ALSA: hda/hdmi: Fix the converter reuse for the silent stream + - um: Cleanup syscall_handler_t cast in syscalls_32.h + - um: Cleanup compiler warning in arch/x86/um/tls_32.c + - gpio: ftgpio010: Make irqchip immutable + - arch: um: Mark the stack non-executable to fix a binutils warning + - net: atlantic: fix potential memory leak in aq_ndev_close() + - KVM: s390: Pass initialized arg even if unused + - drm/amd/display: Fix double cursor on non-video RGB MPO + - drm/amd/display: Assume an LTTPR is always present on fixed_vs links + - drm/amd/display: update gamut remap if plane has changed + - drm/amd/display: skip audio setup when audio stream is enabled + - drm/amd/display: Fix DP MST timeslot issue when fallback happened + - drm/amd/display: increase dcn315 pstate change latency + - perf/x86/intel: Fix unchecked MSR access error for Alder Lake N + - don't use __kernel_write() on kmap_local_page() + - i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe + - usb: mon: make mmapped memory read only + - USB: serial: ftdi_sio: fix 300 bps rate for SIO + - gpiolib: acpi: Add support to ignore programming an interrupt + - gpiolib: acpi: Add a quirk for Asus UM325UAZ + - mmc: core: Replace with already defined values for readability + - mmc: core: Terminate infinite loop in SD-UHS voltage switch + - rpmsg: qcom: glink: replace strncpy() with strscpy_pad() + - bpf: Gate dynptr API behind CAP_BPF + - net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear + - bpf: Fix resetting logic for unreferenced kptrs + - Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works + - Revert "clk: ti: Stop using legacy clkctrl names for omap4 and 5" + - Linux 5.19.15 + * Kinetic update: v5.19.14 upstream stable release (LP: #1994076) + - riscv: make t-head erratas depend on MMU + - tools/perf: Fix out of bound access to cpu mask array + - perf record: Fix cpu mask bit setting for mixed mmaps + - counter: 104-quad-8: Utilize iomap interface + - counter: 104-quad-8: Implement and utilize register structures + - counter: 104-quad-8: Fix skipped IRQ lines during events configuration + - uas: add no-uas quirk for Hiksemi usb_disk + - usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS + - uas: ignore UAS for Thinkplus chips + - usb: typec: ucsi: Remove incorrect warning + - thunderbolt: Explicitly reset plug events delay back to USB4 spec value + - net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 + - Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address + - can: c_can: don't cache TX messages for C_CAN cores + - clk: ingenic-tcu: Properly enable registers before accessing timers + - wifi: mac80211: ensure vif queues are operational after start + - x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd + - frontswap: don't call ->init if no ops are registered + - ARM: dts: integrator: Tag PCI host with device_type + - ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() + - x86/uaccess: avoid check_object_size() in copy_from_user_nmi() + - mm/damon/dbgfs: fix memory leak when using debugfs_lookup() + - net: mt7531: only do PLL once after the reset + - Revert "firmware: arm_scmi: Add clock management to the SCMI power domain" + - powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush + - drm/i915/gt: Restrict forced preemption to the active context + - drm/amdgpu: Add amdgpu suspend-resume code path under SRIOV + - vduse: prevent uninitialized memory accesses + - libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 + - mm: fix BUG splat with kvmalloc + GFP_ATOMIC + - mptcp: factor out __mptcp_close() without socket lock + - mptcp: fix unreleased socket in accept queue + - mmc: moxart: fix 4-bit bus width and remove 8-bit bus width + - mmc: hsq: Fix data stomping during mmc recovery + - mm: gup: fix the fast GUP race against THP collapse + - mm/page_alloc: fix race condition between build_all_zonelists and page + allocation + - mm: prevent page_frag_alloc() from corrupting the memory + - mm/page_isolation: fix isolate_single_pageblock() isolation behavior + - mm: fix dereferencing possible ERR_PTR + - mm/migrate_device.c: flush TLB while holding PTL + - mm/migrate_device.c: add missing flush_cache_page() + - mm/migrate_device.c: copy pte dirty bit to page + - mm: fix madivse_pageout mishandling on non-LRU page + - mm: bring back update_mmu_cache() to finish_fault() + - mm/hugetlb: correct demote page offset logic + - mm,hwpoison: check mm when killing accessing process + - media: dvb_vb2: fix possible out of bound access + - media: rkvdec: Disable H.264 error detection + - media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ) + - media: v4l2-compat-ioctl32.c: zero buffer passed to + v4l2_compat_get_array_args() + - ARM: dts: am33xx: Fix MMCHS0 dma properties + - reset: imx7: Fix the iMX8MP PCIe PHY PERST support + - ARM: dts: am5748: keep usb4_tm disabled + - soc: sunxi: sram: Actually claim SRAM regions + - soc: sunxi: sram: Prevent the driver from being unbound + - soc: sunxi: sram: Fix probe function ordering issues + - soc: sunxi: sram: Fix debugfs info for A64 SRAM C + - ASoC: imx-card: Fix refcount issue with of_node_put + - clk: microchip: mpfs: fix clk_cfg array bounds violation + - clk: microchip: mpfs: make the rtc's ahb clock critical + - arm64: dts: qcom: sm8350: fix UFS PHY serdes size + - ASoC: tas2770: Reinit regcache on reset + - drm/bridge: lt8912b: add vsync hsync + - drm/bridge: lt8912b: set hdmi or dvi mode + - drm/bridge: lt8912b: fix corrupted image output + - net: macb: Fix ZynqMP SGMII non-wakeup source resume failure + - Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in + suspend/resume time" + - Input: melfas_mip4 - fix return value check in mip4_probe() + - gpio: mvebu: Fix check for pwm support on non-A8K platforms + - perf parse-events: Break out tracepoint and printing + - perf print-events: Fix "perf list" can not display the PMU prefix for some + hybrid cache events + - perf parse-events: Remove "not supported" hybrid cache events + - usbnet: Fix memory leak in usbnet_disconnect() + - net: sched: act_ct: fix possible refcount leak in tcf_ct_init() + - cxgb4: fix missing unlock on ETHOFLD desc collect fail path + - net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe + - nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices + - wifi: cfg80211: fix MCS divisor value + - wifi: mac80211: fix regression with non-QoS drivers + - wifi: mac80211: fix memory corruption in minstrel_ht_update_rates() + - net: stmmac: power up/down serdes in stmmac_open/release + - net: phy: Don't WARN for PHY_UP state in mdio_bus_phy_resume() + - selftests: Fix the if conditions of in test_extra_filter() + - ice: xsk: change batched Tx descriptor cleaning + - ice: xsk: drop power of 2 ring size restriction for AF_XDP + - vdpa/ifcvf: fix the calculation of queuepair + - virtio-blk: Fix WARN_ON_ONCE in virtio_queue_rq() + - vdpa/mlx5: Fix MQ to support non power of two num queues + - clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks + - drm/i915/gt: Perf_limit_reasons are only available for Gen11+ + - clk: iproc: Do not rely on node name for correct PLL setup + - clk: imx93: drop of_match_ptr + - net: mscc: ocelot: fix tagged VLAN refusal while under a VLAN-unaware bridge + - net: ethernet: mtk_eth_soc: fix mask of RX_DMA_GET_SPORT{,_V2} + - perf test: Fix test case 87 ("perf record tests") for hybrid systems + - perf tests record: Fail the test if the 'errs' counter is not zero + - KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest + - x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant + - x86/alternative: Fix race in try_get_desc() + - damon/sysfs: fix possible memleak on damon_sysfs_add_target + - Linux 5.19.14 + * Kinetic update: v5.19.13 upstream stable release (LP: #1994075) + - Linux 5.19.13 + * Kinetic update: v5.19.12 upstream stable release (LP: #1994074) + - smb3: Move the flush out of smb2_copychunk_range() into its callers + - smb3: fix temporary data corruption in collapse range + - smb3: fix temporary data corruption in insert range + - usb: add quirks for Lenovo OneLink+ Dock + - usb: gadget: udc-xilinx: replace memcpy with memcpy_toio + - smb3: use filemap_write_and_wait_range instead of filemap_write_and_wait + - Revert "usb: add quirks for Lenovo OneLink+ Dock" + - Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" + - xfrm: fix XFRMA_LASTUSED comment + - block: remove QUEUE_FLAG_DEAD + - block: stop setting the nomerges flags in blk_cleanup_queue + - block: simplify disk shutdown + - scsi: core: Fix a use-after-free + - drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES + - USB: core: Fix RST error in hub.c + - USB: serial: option: add Quectel BG95 0x0203 composition + - USB: serial: option: add Quectel RM520N + - ALSA: core: Fix double-free at snd_card_new() + - ALSA: hda/tegra: set depop delay for tegra + - ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation + - ALSA: hda: Fix Nvidia dp infoframe + - ALSA: hda: add Intel 5 Series / 3400 PCI DID + - ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop + - ALSA: hda/realtek: Re-arrange quirk table entries + - ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack + - ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack + - ALSA: hda/realtek: Add quirk for ASUS GA503R laptop + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop + - ALSA: hda/realtek: Add a quirk for HP OMEN 16 (8902) mute LED + - iommu/vt-d: Check correct capability for sagaw determination + - exfat: fix overflow for large capacity partition + - btrfs: fix hang during unmount when stopping block group reclaim worker + - btrfs: fix hang during unmount when stopping a space reclaim worker + - btrfs: zoned: wait for extent buffer IOs before finishing a zone + - libperf evlist: Fix polling of system-wide events + - media: flexcop-usb: fix endpoint type check + - usb: dwc3: core: leave default DMA if the controller does not support 64-bit + DMA + - thunderbolt: Add support for Intel Maple Ridge single port controller + - efi: x86: Wipe setup_data on pure EFI boot + - efi: libstub: check Shim mode using MokSBStateRT + - wifi: mt76: fix reading current per-tid starting sequence number for + aggregation + - gpio: mockup: fix NULL pointer dereference when removing debugfs + - gpio: mockup: Fix potential resource leakage when register a chip + - gpiolib: cdev: Set lineevent_state::irq after IRQ register successfully + - riscv: fix a nasty sigreturn bug... + - riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning + - drm/i915/gem: Flush contexts on driver release + - drm/i915/gem: Really move i915_gem_context.link under ref protection + - xen/xenbus: fix xenbus_setup_ring() + - kasan: call kasan_malloc() from __kmalloc_*track_caller() + - can: flexcan: flexcan_mailbox_read() fix return value for drop = true + - net: mana: Add rmb after checking owner bits + - mm/slub: fix to return errno if kmalloc() fails + - mm: slub: fix flush_cpu_slab()/__free_slab() invocations in task context. + - KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0 + - KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES + - KVM: x86: Inject #UD on emulated XSETBV if XSAVES isn't enabled + - perf/arm-cmn: Add more bits to child node address offset field + - arm64: topology: fix possible overflow in amu_fie_setup() + - vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment + - batman-adv: Fix hang up with small MTU hard-interface + - firmware: arm_scmi: Harden accesses to the reset domains + - firmware: arm_scmi: Fix the asynchronous reset requests + - arm64: dts: rockchip: Lower sd speed on quartz64-b + - arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob + - arm64: dts: rockchip: Fix typo in lisense text for PX30.Core + - drm/mediatek: dsi: Add atomic {destroy,duplicate}_state, reset callbacks + - arm64: dts: imx8mm: Reverse CPLD_Dn GPIO label mapping on MX8Menlo + - arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz + - arm64: dts: imx8mn: remove GPU power domain reset + - arm64: dts: imx8ulp: add #reset-cells for pcc + - dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get() + - arm64: dts: rockchip: fix property for usb2 phy supply on rock-3a + - arm64: dts: rockchip: fix property for usb2 phy supply on rk3568-evb1-v10 + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3566-quartz64-a + - arm64: dts: imx8mm-verdin: extend pmic voltages + - netfilter: nf_conntrack_sip: fix ct_sip_walk_headers + - netfilter: nf_conntrack_irc: Tighten matching on DCC message + - netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() + - ice: Don't double unplug aux on peer initiated reset + - ice: Fix crash by keep old cfg when update TCs more than queues + - iavf: Fix cached head and tail value for iavf_get_tx_pending + - ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header + - net: core: fix flow symmetric hash + - wifi: iwlwifi: Mark IWLMEI as broken + - [Config] updateconfigs for IWLMEI + - arm64: dts: tqma8mqml: Include phy-imx8-pcie.h header + - drm/mediatek: Fix wrong dither settings + - arm64: dts: imx8mp-venice-gw74xx: fix CAN STBY polarity + - arm64: dts: imx8mp-venice-gw74xx: fix ksz9477 cpu port + - ARM: dts: lan966x: Fix the interrupt number for internal PHYs + - net: phy: aquantia: wait for the suspend/resume operations to finish + - arm64: dts: imx8mp-venice-gw74xx: fix port/phy validation + - scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts() + - scsi: mpt3sas: Fix return value check of dma_get_required_mask() + - net: bonding: Share lacpdu_mcast_addr definition + - net: bonding: Unsync device addresses on ndo_stop + - net: team: Unsync device addresses on ndo_stop + - drm/panel: simple: Fix innolux_g121i1_l01 bus_format + - mm/slab_common: fix possible double free of kmem_cache + - MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko + - MIPS: Loongson32: Fix PHY-mode being left unspecified + - um: fix default console kernel parameter + - iavf: Fix bad page state + - mlxbf_gige: clear MDIO gateway lock after read + - i40e: Fix set max_tx_rate when it is lower than 1 Mbps + - netdevsim: Fix hwstats debugfs file permissions + - sfc: fix TX channel offset when using legacy interrupts + - sfc: fix null pointer dereference in efx_hard_start_xmit + - bnxt_en: fix flags to check for supported fw version + - gve: Fix GFP flags when allocing pages + - drm/hisilicon: Add depends on MMU + - of: mdio: Add of_node_put() when breaking out of for_each_xx + - net: ipa: properly limit modem routing table use + - sfc/siena: fix TX channel offset when using legacy interrupts + - sfc/siena: fix null pointer dereference in efx_hard_start_xmit + - wireguard: ratelimiter: disable timings test by default + - wireguard: netlink: avoid variable-sized memcpy on sockaddr + - net: enetc: move enetc_set_psfp() out of the common enetc_set_features() + - net: enetc: deny offload of tc-based TSN features on VF interfaces + - ipv6: Fix crash when IPv6 is administratively disabled + - net/sched: taprio: avoid disabling offload when it was never enabled + - net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child + qdiscs + - ice: config netdev tc before setting queues number + - ice: Fix interface being down after reset with link-down-on-close flag on + - netfilter: nf_tables: fix nft_counters_enabled underflow at + nf_tables_addchain() + - netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain() + - netfilter: ebtables: fix memory leak when blob is malformed + - netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed + - net: ravb: Fix PHY state warning splat during system resume + - net: sh_eth: Fix PHY state warning splat during system resume + - gpio: tqmx86: fix uninitialized variable girq + - can: gs_usb: gs_can_open(): fix race dev->can.state condition + - perf stat: Fix BPF program section name + - perf stat: Fix cpu map index in bperf cgroup code + - perf jit: Include program header in ELF files + - perf kcore_copy: Do not check /proc/modules is unchanged + - perf tools: Honor namespace when synthesizing build-ids + - drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff() + - ice: Fix ice_xdp_xmit() when XDP TX queue number is not sufficient + - net/smc: Stop the CLC flow if no link to map buffers on + - net: phy: micrel: fix shared interrupt on LAN8814 + - bonding: fix NULL deref in bond_rr_gen_slave_id + - net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD + - net: sched: fix possible refcount leak in tc_new_tfilter() + - bnxt: prevent skb UAF after handing over to PTP worker + - selftests: forwarding: add shebang for sch_red.sh + - io_uring: ensure that cached task references are always put on exit + - serial: fsl_lpuart: Reset prior to registration + - serial: Create uart_xmit_advance() + - serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting + - serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting + - cgroup: cgroup_get_from_id() must check the looked-up kn is a directory + - phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset support + - s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup + - blk-mq: fix error handling in __blk_mq_alloc_disk + - block: call blk_mq_exit_queue from disk_release for never added disks + - block: Do not call blk_put_queue() if gendisk allocation fails + - Drivers: hv: Never allocate anything besides framebuffer from framebuffer + memory region + - drm/gma500: Fix BUG: sleeping function called from invalid context errors + - drm/gma500: Fix WARN_ON(lock->magic != lock) error + - drm/gma500: Fix (vblank) IRQs not working after suspend/resume + - gpio: ixp4xx: Make irqchip immutable + - drm/amd/pm: disable BACO entry/exit completely on several sienna cichlid + cards + - drm/amdgpu: change the alignment size of TMR BO to 1M + - drm/amdgpu: add HDP remap functionality to nbio 7.7 + - drm/amdgpu: Skip reset error status for psp v13_0_0 + - drm/amd/display: Limit user regamma to a valid value + - drm/amd/display: Reduce number of arguments of dml31's + CalculateWatermarksAndDRAMSpeedChangeSupport() + - drm/amd/display: Reduce number of arguments of dml31's + CalculateFlipSchedule() + - drm/amd/display: Mark dml30's UseMinimumDCFCLK() as noinline for stack usage + - drm/rockchip: Fix return type of cdn_dp_connector_mode_valid + - gpio: mt7621: Make the irqchip immutable + - pmem: fix a name collision + - fsdax: Fix infinite loop in dax_iomap_rw() + - workqueue: don't skip lockdep work dependency in cancel_work_sync() + - i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible + - i2c: mlxbf: incorrect base address passed during io write + - i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction() + - i2c: mlxbf: Fix frequency calculation + - i2c: mux: harden i2c_mux_alloc() against integer overflows + - drm/amdgpu: don't register a dirty callback for non-atomic + - certs: make system keyring depend on built-in x509 parser + - Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT + - Makefile.debug: re-enable debug info for .S files + - devdax: Fix soft-reservation memory description + - ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 + - ext4: limit the number of retries after discarding preallocations blocks + - ext4: make mballoc try target group first even with mb_optimize_scan + - ext4: avoid unnecessary spreading of allocations among groups + - ext4: use locality group preallocation for small closed files + - ext4: use buckets for cr 1 block scan instead of rbtree + - Revert "block: freeze the queue earlier in del_gendisk" + - ext4: fixup possible uninitialized variable access in + ext4_mb_choose_next_group_cr1() + - ext4: make directory inode spreading reflect flexbg size + - Linux 5.19.12 + * Kinetic update: v5.19.11 upstream stable release (LP: #1994070) + - of: fdt: fix off-by-one error in unflatten_dt_nodes() + - pinctrl: qcom: sc8180x: Fix gpio_wakeirq_map + - pinctrl: qcom: sc8180x: Fix wrong pin numbers + - pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH + - pinctrl: sunxi: Fix name for A100 R_PIO + - SUNRPC: Fix call completion races with call_decode() + - NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0 + - gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx + - NFSv4.2: Update mode bits after ALLOCATE and DEALLOCATE + - Revert "SUNRPC: Remove unreachable error condition" + - drm/panel-edp: Fix delays for Innolux N116BCA-EA1 + - drm/meson: Correct OSD1 global alpha value + - drm/meson: Fix OSD1 RGB to YCbCr coefficient + - drm/rockchip: vop2: Fix eDP/HDMI sync polarities + - drm/i915/vdsc: Set VDSC PIC_HEIGHT before using for DP DSC + - drm/i915/guc: Don't update engine busyness stats too frequently + - drm/i915/guc: Cancel GuC engine busyness worker synchronously + - block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for + nowait + - parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() + - of/device: Fix up of_dma_configure_id() stub + - io_uring/msg_ring: check file type before putting + - cifs: revalidate mapping when doing direct writes + - cifs: don't send down the destination address to sendmsg for a SOCK_STREAM + - cifs: always initialize struct msghdr smb_msg completely + - blk-lib: fix blkdev_issue_secure_erase + - parisc: Allow CONFIG_64BIT with ARCH=parisc + - tools/include/uapi: Fix for parisc and xtensa + - drm/i915/gt: Fix perf limit reasons bit positions + - drm/i915: Set correct domains values at _i915_vma_move_to_active + - drm/amdgpu: make sure to init common IP before gmc + - drm/amdgpu: Don't enable LTR if not supported + - drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega + - drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega + - net: Find dst with sk's xfrm policy not ctl_sk + - dt-bindings: apple,aic: Fix required item "apple,fiq-index" in affinity + description + - cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() + - ALSA: hda/sigmatel: Keep power up while beep is enabled + - ALSA: hda/sigmatel: Fix unused variable warning for beep power change + - Linux 5.19.11 + * Kinetic update: v5.19.10 upstream stable release (LP: #1994069) + - iommu/vt-d: Fix kdump kernels boot failure with scalable mode + - net/mlx5: Introduce ifc bits for using software vhca id + - net/mlx5: Use software VHCA id when it's supported + - RDMA/mlx5: Rely on RoCE fw cap instead of devlink when setting profile + - RDMA/mlx5: Add a umr recovery flow + - RDMA/mlx5: Fix UMR cleanup on error flow of driver init + - ACPI: resource: skip IRQ override on AMD Zen platforms + - Input: goodix - add support for GT1158 + - platform/surface: aggregator_registry: Add support for Surface Laptop Go 2 + - drm/msm/rd: Fix FIFO-full deadlock + - peci: cpu: Fix use-after-free in adev_release() + - kvm: x86: mmu: Always flush TLBs when enabling dirty logging + - dt-bindings: iio: gyroscope: bosch,bmg160: correct number of pins + - HID: ishtp-hid-clientHID: ishtp-hid-client: Fix comment typo + - hid: intel-ish-hid: ishtp: Fix ishtp client sending disordered message + - Bluetooth: MGMT: Fix Get Device Flags + - tg3: Disable tg3 device on system reboot to avoid triggering AER + - r8152: add PID for the Lenovo OneLink+ Dock + - gpio: mockup: remove gpio debugfs when remove device + - ieee802154: cc2520: add rc code in cc2520_tx() + - Input: iforce - add support for Boeder Force Feedback Wheel + - drm/amdgpu: disable FRU access on special SIENNA CICHLID card + - drm/amd/pm: use vbios carried pptable for all SMU13.0.7 SKUs + - nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM610 + - nvmet-tcp: fix unhandled tcp states in nvmet_tcp_state_change() + - drm/amd/amdgpu: skip ucode loading if ucode_size == 0 + - net: dsa: hellcreek: Print warning only once + - perf/arm_pmu_platform: fix tests for platform_get_irq() failure + - platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes + - usb: storage: Add ASUS <0x0b05:0x1932> to IGNORE_UAS + - platform/x86: asus-wmi: Increase FAN_CURVE_BUF_LEN to 32 + - LoongArch: Fix section mismatch due to acpi_os_ioremap() + - LoongArch: Fix arch_remove_memory() undefined build error + - gpio: 104-dio-48e: Make irq_chip immutable + - gpio: 104-idio-16: Make irq_chip immutable + - RDMA/irdma: Use s/g array in post send only when its valid + - Input: goodix - add compatible string for GT1158 + - Linux 5.19.10 + * Kinetic update: v5.19.9 upstream stable release (LP: #1994068) + - efi: libstub: Disable struct randomization + - efi: capsule-loader: Fix use-after-free in efi_capsule_write + - wifi: mt76: mt7921e: fix crash in chip reset fail + - wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in + il4965_rs_fill_link_cmd() + - fs: only do a memory barrier for the first set_buffer_uptodate() + - soc: fsl: select FSL_GUTS driver for DPIO + - Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" + - scsi: qla2xxx: Disable ATIO interrupt coalesce for quad port ISP27XX + - scsi: core: Allow the ALUA transitioning state enough time + - scsi: megaraid_sas: Fix double kfree() + - drm/gem: Fix GEM handle release errors + - drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to + psp_hw_fini + - drm/amdgpu: fix hive reference leak when adding xgmi device + - drm/amdgpu: Check num_gfx_rings for gfx v9_0 rb setup. + - drm/amdgpu: Remove the additional kfd pre reset call for sriov + - drm/radeon: add a force flush to delay work when radeon + - scsi: ufs: core: Reduce the power mode change timeout + - Revert "parisc: Show error if wrong 32/64-bit compiler is being used" + - parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() + - parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines + - [Config] updateconfigs for ARM64_ERRATUM_2457168 + - arm64: errata: add detection for AMEVCNTR01 incrementing incorrectly + - netfilter: conntrack: work around exceeded receive window + - thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR + - cpufreq: check only freq_table in __resolve_freq() + - net/core/skbuff: Check the return value of skb_copy_bits() + - md: Flush workqueue md_rdev_misc_wq in md_alloc() + - fbdev: omapfb: Fix tests for platform_get_irq() failure + - fbdev: fbcon: Destroy mutex on freeing struct fb_info + - fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() + - x86/sev: Mark snp_abort() noreturn + - drm/amdgpu: add sdma instance check for gfx11 CGCG + - drm/amdgpu: mmVM_L2_CNTL3 register not initialized correctly + - ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC + - ALSA: emu10k1: Fix out of bounds access in snd_emu10k1_pcm_channel_alloc() + - ALSA: hda: Once again fix regression of page allocations with IOMMU + - ALSA: aloop: Fix random zeros in capture data when using jiffies timer + - ALSA: usb-audio: Clear fixed clock rate at closing EP + - ALSA: usb-audio: Fix an out-of-bounds bug in + __snd_usb_parse_audio_interface() + - tracefs: Only clobber mode/uid/gid on remount if asked + - tracing: hold caller_addr to hardirq_{enable,disable}_ip + - tracing: Fix to check event_mutex is held while accessing trigger list + - btrfs: zoned: set pseudo max append zone limit in zone emulation mode + - btrfs: zoned: fix API misuse of zone finish waiting + - vfio/type1: Unpin zero pages + - kprobes: Prohibit probes in gate area + - perf: RISC-V: fix access beyond allocated array + - debugfs: add debugfs_lookup_and_remove() + - sched/debug: fix dentry leak in update_sched_domain_debugfs + - drm/amd/display: fix memory leak when using debugfs_lookup() + - driver core: fix driver_set_override() issue with empty strings + - nvmet: fix a use-after-free + - drm/i915/bios: Copy the whole MIPI sequence block + - drm/i915/slpc: Let's fix the PCODE min freq table setup for SLPC + - scsi: mpt3sas: Fix use-after-free warning + - scsi: lpfc: Add missing destroy_workqueue() in error path + - cgroup: Elide write-locking threadgroup_rwsem when updating csses on an + empty subtree + - cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock + - cifs: remove useless parameter 'is_fsctl' from SMB2_ioctl() + - smb3: missing inode locks in zero range + - spi: bitbang: Fix lsb-first Rx + - ASoC: cs42l42: Only report button state if there was a button interrupt + - Revert "soc: imx: imx8m-blk-ctrl: set power device name" + - arm64: dts: imx8mm-verdin: update CAN clock to 40MHz + - arm64: dts: imx8mm-verdin: use level interrupt for mcp251xfd + - ASoC: qcom: sm8250: add missing module owner + - regmap: spi: Reserve space for register address/padding + - arm64: dts: imx8mp-venice-gw74xx: fix sai2 pin settings + - arm64: dts: imx8mq-tqma8mq: Remove superfluous interrupt-names + - RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg + - RDMA/rtrs-srv: Pass the correct number of entries for dma mapped SGL + - ARM: dts: imx6qdl-vicut1.dtsi: Fix node name backlight_led + - ARM: dts: imx6qdl-kontron-samx6i: remove duplicated node + - ARM: dts: imx6qdl-kontron-samx6i: fix spi-flash compatible + - arm64: dts: ls1028a-qds-65bb: don't use in-band autoneg for 2500base-x + - soc: imx: gpcv2: Assert reset before ungating clock + - arm64: dts: verdin-imx8mm: add otg2 pd to usbphy + - arm64: dts: imx8mm-venice-gw7901: fix port/phy validation + - arm64: dts: freescale: verdin-imx8mm: fix atmel_mxt_ts reset polarity + - arm64: dts: freescale: verdin-imx8mp: fix atmel_mxt_ts reset polarity + - regulator: core: Clean up on enable failure + - ASoC: SOF: Kconfig: Make IPC_FLOOD_TEST depend on SND_SOC_SOF + - ASoC: SOF: Kconfig: Make IPC_MESSAGE_INJECTOR depend on SND_SOC_SOF + - tee: fix compiler warning in tee_shm_register() + - RDMA/irdma: Fix drain SQ hang with no completion + - arm64: dts: renesas: r8a779g0: Fix HSCIF0 interrupt number + - RDMA/cma: Fix arguments order in net device validation + - soc: brcmstb: pm-arm: Fix refcount leak and __iomem leak bugs + - RDMA/hns: Fix supported page size + - RDMA/hns: Fix wrong fixed value of qp->rq.wqe_shift + - RDMA/hns: Remove the num_qpc_timer variable + - wifi: wilc1000: fix DMA on stack objects + - ARM: at91: pm: fix self-refresh for sama7g5 + - ARM: at91: pm: fix DDR recalibration when resuming from backup and self- + refresh + - ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges + - ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges + - ARM: dts: at91: sama7g5ek: specify proper regulator output ranges + - ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time + - ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time + - netfilter: br_netfilter: Drop dst references before setting. + - netfilter: nf_tables: clean up hook list when offload flags check fails + - riscv: dts: microchip: use an mpfs specific l2 compatible + - netfilter: nf_conntrack_irc: Fix forged IP logic + - RDMA/srp: Set scmnd->result only when scmnd is not NULL + - ALSA: usb-audio: Inform the delayed registration more properly + - ALSA: usb-audio: Register card again for iface over delayed_register option + - rxrpc: Fix ICMP/ICMP6 error handling + - rxrpc: Fix an insufficiently large sglist in rxkad_verify_packet_2() + - afs: Use the operation issue time instead of the reply time for callbacks + - kunit: fix assert_type for comparison macros + - Revert "net: phy: meson-gxl: improve link-up behavior" + - sch_sfb: Don't assume the skb is still around after enqueueing to child + - tipc: fix shift wrapping bug in map_get() + - net: introduce __skb_fill_page_desc_noacc + - tcp: TX zerocopy should not sense pfmemalloc status + - ice: Fix DMA mappings leak + - ice: use bitmap_free instead of devm_kfree + - i40e: Fix kernel crash during module removal + - iavf: Detach device during reset task + - xen-netback: only remove 'hotplug-status' when the vif is actually destroyed + - block: don't add partitions if GD_SUPPRESS_PART_SCAN is set + - RDMA/siw: Pass a pointer to virt_to_page() + - bonding: use unspecified address if no available link local address + - bonding: add all node mcast address when slave up + - ipv6: sr: fix out-of-bounds read when setting HMAC data. + - IB/core: Fix a nested dead lock as part of ODP flow + - RDMA/mlx5: Set local port to one when accessing counters + - btrfs: zoned: fix mounting with conventional zones + - erofs: fix error return code in erofs_fscache_{meta_,}read_folio + - erofs: fix pcluster use-after-free on UP platforms + - nvme-tcp: fix UAF when detecting digest errors + - nvme-tcp: fix regression that causes sporadic requests to time out + - tcp: fix early ETIMEDOUT after spurious non-SACK RTO + - btrfs: fix the max chunk size and stripe length calculation + - nvmet: fix mar and mor off-by-one errors + - RDMA/irdma: Report the correct max cqes from query device + - RDMA/irdma: Return error on MR deregister CQP failure + - RDMA/irdma: Return correct WC error for bind operation failure + - RDMA/irdma: Report RNR NAK generation in device caps + - net: dsa: felix: disable cut-through forwarding for frames oversized for tc- + taprio + - net: dsa: felix: access QSYS_TAG_CONFIG under tas_lock in + vsc9959_sched_speed_set + - net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear + - net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb + - net/smc: Fix possible access to freed memory in link clear + - io_uring: recycle kbuf recycle on tw requeue + - net: phy: lan87xx: change interrupt src of link_up to comm_ready + - sch_sfb: Also store skb len before calling child enqueue + - libperf evlist: Fix per-thread mmaps for multi-threaded targets + - perf dlfilter dlfilter-show-cycles: Fix types for print format + - perf script: Fix Cannot print 'iregs' field for hybrid systems + - perf record: Fix synthesis failure warnings + - hwmon: (tps23861) fix byte order in resistance register + - ASoC: mchp-spdiftx: remove references to mchp_i2s_caps + - ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion + - MIPS: loongson32: ls1c: Fix hang during startup + - kbuild: disable header exports for UML in a straightforward way + - i40e: Refactor tc mqprio checks + - i40e: Fix ADQ rate limiting for PF + - net: bonding: replace dev_trans_start() with the jiffies of the last ARP/NS + - bonding: accept unsolicited NA message + - swiotlb: avoid potential left shift overflow + - iommu/amd: use full 64-bit value in build_completion_wait() + - s390/boot: fix absolute zero lowcore corruption on boot + - time64.h: consolidate uses of PSEC_PER_NSEC + - net: dsa: felix: tc-taprio intervals smaller than MTU should send at least + one packet + - hwmon: (mr75203) fix VM sensor allocation when "intel,vm-map" not defined + - hwmon: (mr75203) update pvt->v_num and vm_num to the actual number of used + sensors + - hwmon: (mr75203) fix voltage equation for negative source input + - hwmon: (mr75203) fix multi-channel voltage reading + - hwmon: (mr75203) enable polling for all VM channels + - perf evlist: Always use arch_evlist__add_default_attrs() + - perf stat: Fix L2 Topdown metrics disappear for raw events + - Revert "arm64: kasan: Revert "arm64: mte: reset the page tag in + page->flags"" + - hwmon: (asus-ec-sensors) add support for Strix Z690-a D4 + - hwmon: (asus-ec-sensors) add support for Maximus XI Hero + - hwmon: (asus-ec-sensors) add missing sensors for X570-I GAMING + - hwmon: (asus-ec-sensors) add definitions for ROG ZENITH II EXTREME + - hwmon: (asus-ec-sensors) autoload module via DMI data + - arm64/bti: Disable in kernel BTI when cross section thunks are broken + - [Config] updateconfigs for ARM64_BTI_KERNEL + - iommu/vt-d: Correctly calculate sagaw value of IOMMU + - iommu/virtio: Fix interaction with VFIO + - iommu: Fix false ownership failure on AMD systems with PASID activated + - drm/amd/display: Add SMU logging code + - drm/amd/display: Removing assert statements for Linux + - Linux 5.19.9 + * Kinetic update: v5.19.8 upstream stable release (LP: #1994061) + - drm/msm/dp: make eDP panel as the first connected connector + - drm/msm/dsi: fix the inconsistent indenting + - drm/msm/dpu: populate wb or intf before reset_intf_cfg + - drm/msm/dp: delete DP_RECOVERED_CLOCK_OUT_EN to fix tps4 + - drm/msm/dsi: Fix number of regulators for msm8996_dsi_cfg + - drm/msm/dsi: Fix number of regulators for SDM660 + - platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask + - platform/x86: x86-android-tablets: Fix broken touchscreen on Chuwi Hi8 with + Windows BIOS + - xsk: Fix corrupted packets for XDP_SHARED_UMEM + - drm/msm/gpu: Drop qos request if devm_devfreq_add_device() fails + - peci: aspeed: fix error check return value of platform_get_irq() + - iio: adc: mcp3911: make use of the sign bit + - skmsg: Fix wrong last sg check in sk_msg_recvmsg() + - bpf: Restrict bpf_sys_bpf to CAP_PERFMON + - ip_tunnel: Respect tunnel key's "flow_flags" in IP tunnels + - bpf, cgroup: Fix kernel BUG in purge_effective_progs + - drm/i915/gvt: Fix Comet Lake + - ieee802154/adf7242: defer destroy_workqueue call + - bpf: Fix a data-race around bpf_jit_limit. + - drm/i915/ttm: fix CCS handling + - drm/i915/display: avoid warnings when registering dual panel backlight + - ALSA: hda: intel-nhlt: Correct the handling of fmt_config flexible array + - wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() + - xhci: Fix null pointer dereference in remove if xHC has only one roothub + - Revert "xhci: turn off port power in shutdown" + - bpf: Allow helpers to accept pointers with a fixed size + - bpf: Tidy up verifier check_func_arg() + - bpf: Do mark_chain_precision for ARG_CONST_ALLOC_SIZE_OR_ZERO + - Bluetooth: hci_event: Fix vendor (unknown) opcode status handling + - Bluetooth: hci_sync: Fix suspend performance regression + - Bluetooth: hci_event: Fix checking conn for le_conn_complete_evt + - Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn + - net: sparx5: fix handling uneven length packets in manual extraction + - net: smsc911x: Stop and start PHY during suspend and resume + - openvswitch: fix memory leak at failed datapath creation + - nfp: flower: fix ingress police using matchall filter + - net: dsa: xrs700x: Use irqsave variant for u64 stats update + - net: sched: tbf: don't call qdisc_put() while holding tree lock + - net/sched: fix netdevice reference leaks in attach_default_qdiscs() + - net: phy: micrel: Make the GPIO to be non-exclusive + - net: lan966x: improve error handle in lan966x_fdma_rx_get_frame() + - ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler + - cachefiles: fix error return code in cachefiles_ondemand_copen() + - cachefiles: make on-demand request distribution fairer + - mlxbf_gige: compute MDIO period based on i1clk + - kcm: fix strp_init() order and cleanup + - sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb + - tcp: annotate data-race around challenge_timestamp + - Revert "sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb" + - net/smc: Remove redundant refcount increase + - soundwire: qcom: fix device status array range + - mm/slab_common: Deleting kobject in kmem_cache_destroy() without holding + slab_mutex/cpu_hotplug_lock + - platform/mellanox: mlxreg-lc: Fix coverity warning + - platform/mellanox: mlxreg-lc: Fix locking issue + - serial: fsl_lpuart: RS485 RTS polariy is inverse + - tty: serial: atmel: Preserve previous USART mode if RS485 disabled + - staging: rtl8712: fix use after free bugs + - staging: r8188eu: Add Rosewill USB-N150 Nano to device tables + - staging: r8188eu: add firmware dependency + - Revert "powerpc: Remove unused FW_FEATURE_NATIVE references" + - powerpc: align syscall table for ppc32 + - powerpc/rtas: Fix RTAS MSR[HV] handling for Cell + - vt: Clear selection before changing the font + - musb: fix USB_MUSB_TUSB6010 dependency + - tty: serial: lpuart: disable flow control while waiting for the transmit + engine to complete + - Input: iforce - wake up after clearing IFORCE_XMIT_RUNNING flag + - iio: light: cm3605: Fix an error handling path in cm3605_probe() + - iio: ad7292: Prevent regulator double disable + - iio: adc: mcp3911: correct "microchip,device-addr" property + - iio: adc: mcp3911: use correct formula for AD conversion + - misc: fastrpc: fix memory corruption on probe + - misc: fastrpc: fix memory corruption on open + - firmware_loader: Fix use-after-free during unregister + - firmware_loader: Fix memory leak in firmware upload + - USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id + - landlock: Fix file reparenting without explicit LANDLOCK_ACCESS_FS_REFER + - mmc: core: Fix UHS-I SD 1.8V workaround branch + - mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure + - binder: fix UAF of ref->proc caused by race condition + - binder: fix alloc->vma_vm_mm null-ptr dereference + - cifs: fix small mempool leak in SMB2_negotiate() + - KVM: VMX: Heed the 'msr' argument in msr_write_intercepted() + - riscv: kvm: move extern sbi_ext declarations to a header + - clk: ti: Fix missing of_node_get() ti_find_clock_provider() + - drm/i915/reg: Fix spelling mistake "Unsupport" -> "Unsupported" + - clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops + - Revert "clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops" + - clk: core: Fix runtime PM sequence in clk_core_unprepare() + - Input: rk805-pwrkey - fix module autoloading + - powerpc/papr_scm: Fix nvdimm event mappings + - clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate + - clk: bcm: rpi: Prevent out-of-bounds access + - clk: bcm: rpi: Add missing newline + - hwmon: (gpio-fan) Fix array out of bounds access + - gpio: pca953x: Add mutex_lock for regcache sync in PM + - gpio: realtek-otto: switch to 32-bit I/O + - KVM: x86: Mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES + - powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register() + - xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() + - mm: pagewalk: Fix race between unmap and page walker + - xen-blkback: Advertise feature-persistent as user requested + - xen-blkfront: Advertise feature-persistent as user requested + - xen-blkfront: Cache feature_persistent value before advertisement + - thunderbolt: Use the actual buffer in tb_async_error() + - thunderbolt: Check router generation before connecting xHCI + - usb: dwc3: pci: Add support for Intel Raptor Lake + - media: mceusb: Use new usb_control_msg_*() routines + - xhci: Add grace period after xHC start to prevent premature runtime suspend. + - usb: dwc3: disable USB core PHY management + - usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop + - usb: dwc3: fix PHY disable sequence + - USB: serial: ch341: fix lost character on LCR updates + - USB: serial: ch341: fix disabled rx timer on older devices + - USB: serial: cp210x: add Decagon UCA device id + - USB: serial: option: add support for OPPO R11 diag port + - USB: serial: option: add Quectel EM060K modem + - USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode + - Revert "usb: typec: ucsi: add a common function + ucsi_unregister_connectors()" + - usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles + - usb: typec: intel_pmc_mux: Add new ACPI ID for Meteor Lake IOM device + - usb: typec: tcpm: Return ENOTSUPP for power supply prop writes + - usb: dwc2: fix wrong order of phy_power_on and phy_init + - usb: cdns3: fix issue with rearming ISO OUT endpoint + - usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer + - USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) + - usb-storage: Add ignore-residue quirk for NXP PN7462AU + - s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages + - s390: fix nospec table alignments + - USB: core: Prevent nested device-reset calls + - usb: xhci-mtk: relax TT periodic bandwidth allocation + - usb: xhci-mtk: fix bandwidth release issue + - usb: gadget: f_uac2: fix superspeed transfer + - usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS + - USB: gadget: Fix obscure lockdep violation for udc_mutex + - dma-buf/dma-resv: check if the new fence is really later + - arm64/kexec: Fix missing extra range for crashkres_low. + - driver core: Don't probe devices after bus_type.match() probe deferral + - wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected + - wifi: mac80211: Fix UAF in ieee80211_scan_rx() + - ip: fix triggering of 'icmp redirect' + - net: Use u64_stats_fetch_begin_irq() for stats fetch. + - net: mac802154: Fix a condition in the receive path + - ALSA: memalloc: Revive x86-specific WC page allocations again + - ALSA: hda/realtek: Add speaker AMP init for Samsung laptops with ALC298 + - ALSA: seq: oss: Fix data-race for max_midi_devs access + - ALSA: seq: Fix data-race at module auto-loading + - drm/i915/backlight: Disable pps power hook for aux based backlight + - drm/i915/guc: clear stalled request after a reset + - drm/i915/glk: ECS Liva Q2 needs GLK HDMI port timing quirk + - drm/i915: Skip wm/ddb readout for disabled pipes + - tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf() + - tty: n_gsm: initialize more members at gsm_alloc_mux() + - tty: n_gsm: replace kicktimer with delayed_work + - tty: n_gsm: avoid call of sleeping functions from atomic context + - Linux 5.19.8 + * md: Replace snprintf with scnprintf (LP: #1993315) + - md: Replace snprintf with scnprintf + * ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems (LP: #1990985) + - ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems + * iavf: SR-IOV VFs error with no traffic flow when MTU greater than 1500 + (LP: #1983656) + - iavf: Fix set max MTU size with port VLAN and jumbo frames + - i40e: Fix VF set max MTU size + * Fix resume on AMD platforms when TBT monitor is plugged (LP: #1990920) + - drm/amd/display: Detect dpcd_rev when hotplug mst monitor + - drm/amd/display: Release remote dc_sink under mst scenario + * [SRU][J/OEM-5.17][PATCH 0/1] Fix oled brightness set above frame-average + luminance (LP: #1978986) + - drm: New function to get luminance range based on static hdr metadata + - drm/amdgpu_dm: Rely on split out luminance calculation function + - drm/i915: Use luminance range calculated during edid parsing + * Update Broadcom Emulex FC HBA lpfc driver to 14.2.0.5 for Ubuntu 22.04 + (LP: #1988711) + - scsi: lpfc: Fix uninitialized cqe field in lpfc_nvme_cancel_iocb() + - scsi: lpfc: Set PU field when providing D_ID in XMIT_ELS_RSP64_CX iocb + - scsi: lpfc: Fix lost NVMe paths during LIF bounce stress test + - scsi: lpfc: Refactor lpfc_nvmet_prep_abort_wqe() into + lpfc_sli_prep_abort_xri() + - scsi: lpfc: Update lpfc version to 14.2.0.5 + - scsi: lpfc: Copyright updates for 14.2.0.5 patches + * input/keyboard: the keyboard on some Asus laptops can't work (LP: #1992266) + - ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA + - ACPI: resource: Add ASUS model S5402ZA to quirks + * pcieport 0000:00:1b.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), + type=Transaction Layer, (Requester ID) (LP: #1988797) + - PCI/PTM: Cache PTM Capability offset + - PCI/PTM: Add pci_upstream_ptm() helper + - PCI/PTM: Separate configuration and enable + - PCI/PTM: Add pci_suspend_ptm() and pci_resume_ptm() + - PCI/PTM: Move pci_ptm_info() body into its only caller + - PCI/PTM: Preserve RsvdP bits in PTM Control register + - PCI/PTM: Reorder functions in logical order + - PCI/PTM: Consolidate PTM interface declarations + - PCI/PM: Always disable PTM for all devices during suspend + - PCI/PM: Simplify pci_pm_suspend_noirq() [ Ubuntu: 5.19.0-26.27 ] @@ -29,7 +1718,7 @@ - NFSD: Remove "inline" directives on op_rsize_bop helpers - NFSD: Cap rsize_bop result based on send buffer size - -- Thadeu Lima de Souza Cascardo Thu, 24 Nov 2022 05:53:27 -0300 + -- Tim Gardner Mon, 28 Nov 2022 09:35:39 -0700 linux-aws (5.19.0-1011.12) kinetic; urgency=medium diff -Nru linux-aws-5.19.0/debian/control linux-aws-5.19.0/debian/control --- linux-aws-5.19.0/debian/control 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/control 2022-11-29 07:06:46.000000000 +0000 @@ -61,7 +61,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-aws-headers-5.19.0-1014 +Package: linux-aws-headers-5.19.0-1015 Build-Profiles: Architecture: all Multi-Arch: foreign @@ -72,46 +72,46 @@ Description: Header files related to Linux kernel version 5.19.0 This package provides kernel header files for version 5.19.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-aws-headers-5.19.0-1014/debian.README.gz for details + /usr/share/doc/linux-aws-headers-5.19.0-1015/debian.README.gz for details -Package: linux-aws-tools-5.19.0-1014 +Package: linux-aws-tools-5.19.0-1015 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.19.0-1014 +Description: Linux kernel version specific tools for version 5.19.0-1015 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.19.0-1014 on + version 5.19.0-1015 on 64 bit x86. - You probably want to install linux-tools-5.19.0-1014-. + You probably want to install linux-tools-5.19.0-1015-. -Package: linux-aws-cloud-tools-5.19.0-1014 +Package: linux-aws-cloud-tools-5.19.0-1015 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.19.0-1014 +Description: Linux kernel version specific cloud tools for version 5.19.0-1015 This package provides the architecture dependant parts for kernel - version locked tools for cloud tools for version 5.19.0-1014 on + version locked tools for cloud tools for version 5.19.0-1015 on 64 bit x86. - You probably want to install linux-cloud-tools-5.19.0-1014-. + You probably want to install linux-cloud-tools-5.19.0-1015-. -Package: linux-image-unsigned-5.19.0-1014-aws +Package: linux-image-unsigned-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional Provides: linux-image, fuse-module, ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.19.0-1014-aws +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.19.0-1015-aws Recommends: grub-pc [amd64] | grub-efi-amd64 [amd64] | grub-efi-ia32 [amd64] | grub [amd64] | lilo [amd64] | grub-efi-arm64 [arm64], initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.19.0-1014-aws -Suggests: fdutils, linux-aws-doc-5.19.0 | linux-aws-source-5.19.0, linux-aws-tools, linux-headers-5.19.0-1014-aws +Conflicts: linux-image-5.19.0-1015-aws +Suggests: fdutils, linux-aws-doc-5.19.0 | linux-aws-source-5.19.0, linux-aws-tools, linux-headers-5.19.0-1015-aws Description: Linux kernel image for version 5.19.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.19.0 on 64 bit x86 SMP. @@ -124,12 +124,12 @@ the linux-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.19.0-1014-aws +Package: linux-modules-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1014-aws | linux-image-unsigned-5.19.0-1014-aws +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1015-aws | linux-image-unsigned-5.19.0-1015-aws Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -144,12 +144,12 @@ the linux-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.19.0-1014-aws +Package: linux-modules-extra-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1014-aws | linux-image-unsigned-5.19.0-1014-aws, wireless-regdb +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1015-aws | linux-image-unsigned-5.19.0-1015-aws, wireless-regdb Description: Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP. @@ -162,21 +162,21 @@ the linux-modules-extra-aws meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.19.0-1014-aws +Package: linux-headers-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-headers-5.19.0-1014, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-aws-headers-5.19.0-1015, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.19.0 on 64 bit x86 SMP This package provides kernel header files for version 5.19.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.19.0-1014/debian.README.gz for details. + /usr/share/doc/linux-headers-5.19.0-1015/debian.README.gz for details. -Package: linux-image-unsigned-5.19.0-1014-aws-dbgsym +Package: linux-image-unsigned-5.19.0-1015-aws-dbgsym Build-Profiles: Architecture: amd64 arm64 Section: devel @@ -193,27 +193,27 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.19.0-1014-aws +Package: linux-tools-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-tools-5.19.0-1014 -Description: Linux kernel version specific tools for version 5.19.0-1014 +Depends: ${misc:Depends}, linux-aws-tools-5.19.0-1015 +Description: Linux kernel version specific tools for version 5.19.0-1015 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.19.0-1014 on + version 5.19.0-1015 on 64 bit x86. -Package: linux-cloud-tools-5.19.0-1014-aws +Package: linux-cloud-tools-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-aws-cloud-tools-5.19.0-1014 -Description: Linux kernel version specific cloud tools for version 5.19.0-1014 +Depends: ${misc:Depends}, linux-aws-cloud-tools-5.19.0-1015 +Description: Linux kernel version specific cloud tools for version 5.19.0-1015 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.19.0-1014 on + version locked tools for cloud for version 5.19.0-1015 on 64 bit x86. Package: linux-udebs-aws @@ -227,7 +227,7 @@ for easier version and migration tracking. -Package: linux-buildinfo-5.19.0-1014-aws +Package: linux-buildinfo-5.19.0-1015-aws Build-Profiles: Architecture: amd64 arm64 Section: kernel diff -Nru linux-aws-5.19.0/debian/dkms-versions linux-aws-5.19.0/debian/dkms-versions --- linux-aws-5.19.0/debian/dkms-versions 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/dkms-versions 2022-11-29 07:06:46.000000000 +0000 @@ -1,2 +1,2 @@ zfs-linux 2.1.5-1ubuntu6 modulename=zfs debpath=pool/universe/z/%package%/zfs-dkms_%version%_all.deb arch=amd64 arch=arm64 arch=ppc64el arch=s390x rprovides=spl-modules rprovides=spl-dkms rprovides=zfs-modules rprovides=zfs-dkms -v4l2loopback 0.12.7-2ubuntu1 modulename=v4l2loopback debpath=pool/universe/v/%package%/v4l2loopback-dkms_%version%_all.deb arch=amd64 rprovides=v4l2loopback-modules rprovides=v4l2loopback-dkms +v4l2loopback 0.12.7-2ubuntu2 modulename=v4l2loopback debpath=pool/universe/v/%package%/v4l2loopback-dkms_%version%_all.deb arch=amd64 rprovides=v4l2loopback-modules rprovides=v4l2loopback-dkms diff -Nru linux-aws-5.19.0/debian/rules.d/1-maintainer.mk linux-aws-5.19.0/debian/rules.d/1-maintainer.mk --- linux-aws-5.19.0/debian/rules.d/1-maintainer.mk 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/rules.d/1-maintainer.mk 2022-11-29 07:06:46.000000000 +0000 @@ -136,7 +136,7 @@ dh_testdir @[ -f "$(DEBIAN)/etc/update.conf" ] && . "$(DEBIAN)/etc/update.conf"; \ if [ -n "$$BACKPORT_SUFFIX" ]; then \ - ver="$$(dpkg-parsechangelog -l"$$DEBIAN_MASTER/changelog" -SVersion)$${BACKPORT_SUFFIX}.1"; \ + ver="$$(dpkg-parsechangelog -l"$$DEBIAN_MASTER/changelog" -SVersion)$${BACKPORT_SUFFIX/--/}.1"; \ prev_ver="$$(dpkg-parsechangelog -l"$(DEBIAN)/changelog" -SVersion)"; \ if [ "$${ver%.*}" = "$${prev_ver%.*}" ]; then \ ver="$${ver%.*}.$$(( $${prev_ver##*.} +1 ))"; \ diff -Nru linux-aws-5.19.0/debian/rules.d/2-binary-arch.mk linux-aws-5.19.0/debian/rules.d/2-binary-arch.mk --- linux-aws-5.19.0/debian/rules.d/2-binary-arch.mk 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/rules.d/2-binary-arch.mk 2022-11-29 07:06:46.000000000 +0000 @@ -530,6 +530,8 @@ install -m644 $(abidir)/$*.fwinfo.builtin \ $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/fwinfo.builtin; \ fi + install -m644 $(DROOT)/canonical-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-certs.pem + install -m644 $(DROOT)/canonical-revoked-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-revoked-certs.pem ifneq ($(full_build),false) # Clean out this flavours build directory. diff -Nru linux-aws-5.19.0/debian/scripts/misc/kernelconfig linux-aws-5.19.0/debian/scripts/misc/kernelconfig --- linux-aws-5.19.0/debian/scripts/misc/kernelconfig 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian/scripts/misc/kernelconfig 2022-11-29 07:06:46.000000000 +0000 @@ -67,12 +67,15 @@ # Determine cross toolchain to use for Kconfig compiler tests cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-" + # Arch-specific compiler, if any + archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc) + # Environment variables for 'make *config'. We omit CROSS_COMPILE # for i386 since it is no longer supported after 19.04, however # we maintain the configs for hwe. modify_config=true env="ARCH=$kernarch DEB_ARCH=$arch" - compiler_path=$(which "${cross_compile}${gcc}" || true) + compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true) if [ "$compiler_path" != '' ]; then env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path" else diff -Nru linux-aws-5.19.0/debian.aws/changelog linux-aws-5.19.0/debian.aws/changelog --- linux-aws-5.19.0/debian.aws/changelog 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.aws/changelog 2022-11-29 07:06:46.000000000 +0000 @@ -1,6 +1,1695 @@ -linux-aws (5.19.0-1014.15) kinetic; urgency=medium +linux-aws (5.19.0-1015.16) kinetic; urgency=medium - * kinetic/linux-aws: 5.19.0-1014.15 -proposed tracker (LP: #1997421) + * kinetic/linux-aws: 5.19.0-1015.16 -proposed tracker (LP: #1997781) + + * Kinetic update: v5.19.9 upstream stable release (LP: #1994068) // Kinetic + update: v5.19.12 upstream stable release (LP: #1994074) // Kinetic update: + v5.19.15 upstream stable release (LP: #1994078) // Kinetic update: v5.19.17 + upstream stable release (LP: #1994179) + - [Config] Updates after rebase + + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/master) + + [ Ubuntu: 5.19.0-27.28 ] + + * kinetic/linux: 5.19.0-27.28 -proposed tracker (LP: #1997794) + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/2022.11.14) + * selftests/.../nat6to4 breaks the selftests build (LP: #1996536) + - [Config] Disable selftests/net/bpf/nat6to4 + * Expose built-in trusted and revoked certificates (LP: #1996892) + - [Packaging] Expose built-in trusted and revoked certificates + * support for same series backports versioning numbers (LP: #1993563) + - [Packaging] sameport -- add support for sameport versioning + * Add cs35l41 firmware loading support (LP: #1995957) + - ASoC: cs35l41: Move cs35l41 exit hibernate function into shared code + - ASoC: cs35l41: Add common cs35l41 enter hibernate function + - ASoC: cs35l41: Do not print error when waking from hibernation + - ALSA: hda: cs35l41: Don't dereference fwnode handle + - ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations + - ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() + - ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 + - ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls + - ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly + - ALSA: hda: cs35l41: Save codec object inside component struct + - ALSA: hda: cs35l41: Add initial DSP support and firmware loading + - ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver + - ALSA: hda: cs35l41: Support reading subsystem id from ACPI + - ALSA: hda: cs35l41: Support multiple load paths for firmware + - ALSA: hda: cs35l41: Support Speaker ID for laptops + - ALSA: hda: cs35l41: Support Hibernation during Suspend + - ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables + - ALSA: hda: hda_cs_dsp_ctl: Add fw id strings + - ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence + - ALSA: hda: cs35l41: Support Firmware switching and reloading + - ALSA: hda: cs35l41: Add module parameter to control firmware load + - Revert "ALSA: hda: cs35l41: Allow compilation test on non-ACPI + configurations" + - ALSA: hda/realtek: More robust component matching for CS35L41 + - [Config] updateconfigs for SND_HDA_CS_DSP_CONTROLS + * Fibocom WWAN FM350-GL suspend error (notebook not suspend) (LP: #1990700) + - net: wwan: t7xx: Add AP CLDMA + * Screen cannot turn on after screen off with Matrox G200eW3 [102b:0536] + (LP: #1995573) + - drm/mgag200: Optimize damage clips + - drm/mgag200: Add FB_DAMAGE_CLIPS support + - drm/mgag200: Enable atomic gamma lut update + * TEE Support for CCP driver (LP: #1991608) + - crypto: ccp: Add support for TEE for PCI ID 0x14CA + * AMD Cezanne takes 5 minutes to wake up from suspend (LP: #1993715) + - platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems + * Fix ath11k deadlock on WCN6855 (LP: #1995041) + - wifi: ath11k: avoid deadlock during regulatory update in + ath11k_regd_update() + * intel_pmc_core not load on Raptor Lake (LP: #1988461) + - x86/cpu: Add new Raptor Lake CPU model number + - platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver + * [UBUNTU 20.04] boot: Add s390x secure boot trailer (LP: #1996071) + - s390/boot: add secure boot trailer + * Fix rfkill causing soft blocked wifi (LP: #1996198) + - platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi + * Support Icicle Kit reference design v2022.10 (LP: #1993148) + - riscv: dts: microchip: icicle: re-jig fabric peripheral addresses + - riscv: dts: microchip: reduce the fic3 clock rate + - riscv: dts: microchip: update memory configuration for v2022.10 + - riscv: dts: microchip: fix fabric i2c reg size + - SAUCE: riscv: dts: microchip: Disable PCIe on the Icicle Kit + * Fix Turbostat is not working for fam: 6 model: 191: stepping: 2 CPU + (LP: #1991365) + - tools/power turbostat: Add support for RPL-S + * armhf kernel compiled with gcc-12 fails to boot on pi 3/2 (LP: #1993120) + - [Packaging] Support arch-specific compilers in updateconfigs + * Kinetic update: v5.19.17 upstream stable release (LP: #1994179) + - Revert "fs: check FMODE_LSEEK to control internal pipe splicing" + - ALSA: oss: Fix potential deadlock at unregistration + - ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() + - ALSA: usb-audio: Fix potential memory leaks + - ALSA: usb-audio: Fix NULL dererence at error path + - ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 + - ALSA: hda/realtek: Correct pin configs for ASUS G533Z + - ALSA: hda/realtek: Add quirk for ASUS GV601R laptop + - ALSA: hda/realtek: Add Intel Reference SSID to support headset keys + - mtd: rawnand: atmel: Unmap streaming DMA mappings + - io_uring/rw: fix unexpected link breakage + - io_uring/net: fix fast_iov assignment in io_setup_async_msg() + - io_uring/net: don't update msg_name if not provided + - io_uring: correct pinned_vm accounting + - hv_netvsc: Fix race between VF offering and VF association message from host + - cifs: destage dirty pages before re-reading them for cache=none + - cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message + - iio: dac: ad5593r: Fix i2c read protocol requirements + - iio: ltc2497: Fix reading conversion results + - iio: adc: ad7923: fix channel readings for some variants + - iio: pressure: dps310: Refactor startup procedure + - iio: pressure: dps310: Reset chip after timeout + - xhci: dbc: Fix memory leak in xhci_alloc_dbc() + - usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video() + - usb: add quirks for Lenovo OneLink+ Dock + - mmc: core: Add SD card quirk for broken discard + - can: kvaser_usb: Fix use of uninitialized completion + - can: kvaser_usb_leaf: Fix overread with an invalid command + - can: kvaser_usb_leaf: Fix TX queue out of sync after restart + - can: kvaser_usb_leaf: Fix CAN state after restart + - mmc: renesas_sdhi: Fix rounding errors + - mmc: sdhci-tegra: Use actual clock rate for SW tuning correction + - mmc: sdhci-sprd: Fix minimum clock limit + - i2c: designware: Fix handling of real but unexpected device interrupts + - fs: dlm: fix race between test_bit() and queue_work() + - fs: dlm: handle -EBUSY first in lock arg validation + - fs: dlm: fix invalid derefence of sb_lvbptr + - btf: Export bpf_dynptr definition + - HID: multitouch: Add memory barriers + - quota: Check next/prev free block number after reading from quota file + - platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure + - arm64: dts: qcom: sdm845-mtp: correct ADC settle time + - ASoC: wcd9335: fix order of Slimbus unprepare/disable + - ASoC: wcd934x: fix order of Slimbus unprepare/disable + - hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API + - net: thunderbolt: Enable DMA paths only after rings are enabled + - regulator: qcom_rpm: Fix circular deferral regression + - arm64: topology: move store_cpu_topology() to shared code + - riscv: topology: fix default topology reporting + - RISC-V: Re-enable counter access from userspace + - RISC-V: Make port I/O string accessors actually work + - parisc: fbdev/stifb: Align graphics memory size to 4MB + - parisc: Fix userspace graphics card breakage due to pgtable special bit + - riscv: vdso: fix NULL deference in vdso_join_timens() when vfork + - riscv: Make VM_WRITE imply VM_READ + - riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb + - riscv: Pass -mno-relax only on lld < 15.0.0 + - UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK + - nvmem: core: Fix memleak in nvmem_register() + - nvme-multipath: fix possible hang in live ns resize with ANA access + - dmaengine: mxs: use platform_driver_register + - dmaengine: qcom-adm: fix wrong sizeof config in slave_config + - dmaengine: qcom-adm: fix wrong calling convention for prep_slave_sg + - drm/virtio: Check whether transferred 2D BO is shmem + - drm/virtio: Unlock reservations on virtio_gpu_object_shmem_init() error + - drm/virtio: Unlock reservations on dma_resv_reserve_fences() error + - drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb() + - drm/udl: Restore display mode on resume + - arm64: mte: move register initialization to C + - [Config] updateconfigs for ARM64_ERRATUM_2441007 + - arm64: errata: Add Cortex-A55 to the repeat tlbi list + - clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value + - mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page + - mm/damon: validate if the pmd entry is present before accessing + - mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in + - mm/mmap: undo ->mmap() when arch_validate_flags() fails + - xen/gntdev: Prevent leaking grants + - xen/gntdev: Accommodate VMA splitting + - PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge + - serial: cpm_uart: Don't request IRQ too early for console port + - serial: stm32: Deassert Transmit Enable on ->rs485_config() + - serial: 8250: Let drivers request full 16550A feature probing + - serial: 8250: Request full 16550A feature probing for OxSemi PCIe devices + - cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning + - powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain + - powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE + - powerpc/boot: Explicitly disable usage of SPE instructions + - slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure + - slimbus: qcom-ngd: cleanup in probe error path + - scsi: lpfc: Rework MIB Rx Monitor debug info logic + - scsi: qedf: Populate sysfs attributes for vport + - gpio: rockchip: request GPIO mux to pinctrl when setting direction + - pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback + - fbdev: smscufx: Fix use-after-free in ufx_ops_open() + - hwrng: core - let sleep be interrupted when unregistering hwrng + - smb3: do not log confusing message when server returns no network interfaces + - ksmbd: fix incorrect handling of iterate_dir + - ksmbd: fix endless loop when encryption for response fails + - ksmbd: Fix wrong return value and message length check in smb2_ioctl() + - ksmbd: Fix user namespace mapping + - fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE + - btrfs: fix alignment of VMA for memory mapped files on THP + - btrfs: enhance unsupported compat RO flags handling + - btrfs: fix race between quota enable and quota rescan ioctl + - btrfs: fix missed extent on fsync after dropping extent maps + - btrfs: set generation before calling btrfs_clean_tree_block in + btrfs_init_new_buffer + - f2fs: fix wrong continue condition in GC + - f2fs: complete checkpoints during remount + - f2fs: flush pending checkpoints when freezing super + - f2fs: increase the limit for reserve_root + - f2fs: fix to do sanity check on destination blkaddr during recovery + - f2fs: fix to do sanity check on summary info + - jbd2: wake up journal waiters in FIFO order, not LIFO + - jbd2: fix potential buffer head reference count leak + - jbd2: fix potential use-after-free in jbd2_fc_wait_bufs + - jbd2: add miss release buffer head in fc_do_one_pass() + - ext2: Add sanity checks for group and filesystem size + - ext4: avoid crash when inline data creation follows DIO write + - ext4: fix null-ptr-deref in ext4_write_info + - ext4: make ext4_lazyinit_thread freezable + - ext4: fix check for block being out of directory size + - ext4: don't increase iversion counter for ea_inodes + - ext4: unconditionally enable the i_version counter + - ext4: ext4_read_bh_lock() should submit IO if the buffer isn't uptodate + - ext4: place buffer head allocation before handle start + - ext4: fix i_version handling in ext4 + - ext4: fix dir corruption when ext4_dx_add_entry() fails + - ext4: fix miss release buffer head in ext4_fc_write_inode + - ext4: fix potential memory leak in ext4_fc_record_modified_inode() + - ext4: fix potential memory leak in ext4_fc_record_regions() + - ext4: update 'state->fc_regions_size' after successful memory allocation + - livepatch: fix race between fork and KLP transition + - ftrace: Properly unset FTRACE_HASH_FL_MOD + - ftrace: Still disable enabled records marked as disabled + - ring-buffer: Allow splice to read previous partially read pages + - ring-buffer: Have the shortest_full queue be the shortest not longest + - ring-buffer: Check pending waiters when doing wake ups as well + - ring-buffer: Add ring_buffer_wake_waiters() + - ring-buffer: Fix race between reset page and reading page + - tracing: Disable interrupt or preemption before acquiring arch_spinlock_t + - tracing: Wake up ring buffer waiters on closing of the file + - tracing: Wake up waiters when tracing is disabled + - tracing: Add ioctl() to force ring buffer waiters to wake up + - tracing: Do not free snapshot if tracer is on cmdline + - tracing: Move duplicate code of trace_kprobe/eprobe.c into header + - tracing: Add "(fault)" name injection to kernel probes + - tracing: Fix reading strings from synthetic events + - rpmsg: char: Avoid double destroy of default endpoint + - thunderbolt: Explicitly enable lane adapter hotplug events at startup + - efi: libstub: drop pointless get_memory_map() call + - media: cedrus: Set the platform driver data earlier + - media: cedrus: Fix endless loop in cedrus_h265_skip_bits() + - blk-throttle: fix that io throttle can only work for single bio + - blk-wbt: call rq_qos_add() after wb_normal is initialized + - KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility + - KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" + - KVM: nVMX: Don't propagate vmcs12's PERF_GLOBAL_CTRL settings to vmcs02 + - KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS + - staging: greybus: audio_helper: remove unused and wrong debugfs usage + - drm/nouveau/kms/nv140-: Disable interlacing + - drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() + - drm/i915/gt: Use i915_vm_put on ppgtt_create error paths + - drm/i915: Fix watermark calculations for gen12+ RC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ MC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier + - drm/i915: Fix watermark calculations for DG2 CCS modifiers + - drm/i915: Fix watermark calculations for DG2 CCS+CC modifier + - drm/amd/display: Fix vblank refcount in vrr transition + - drm/amd/display: explicitly disable psr_feature_enable appropriately + - smb3: must initialize two ACL struct fields to zero + - selinux: use "grep -E" instead of "egrep" + - ima: fix blocking of security.ima xattrs of unsupported algorithms + - userfaultfd: open userfaultfds with O_RDONLY + - ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers + - thermal: cpufreq_cooling: Check the policy first in + cpufreq_cooling_register() + - cpufreq: amd-pstate: Fix initial highest_perf value + - sh: machvec: Use char[] for section boundaries + - MIPS: SGI-IP30: Fix platform-device leak in bridge_platform_create() + - MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() + - erofs: fix order >= MAX_ORDER warning due to crafted negative i_size + - erofs: use kill_anon_super() to kill super in fscache mode + - ARM: 9243/1: riscpc: Unbreak the build + - ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() + - ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE + - ACPI: PCC: Release resources on address space setup failure path + - ACPI: PCC: replace wait_for_completion() + - ACPI: PCC: Fix Tx acknowledge in the PCC address space handler + - objtool: Preserve special st_shndx indexes in elf_update_symbol + - nfsd: Fix a memory leak in an error handling path + - NFSD: Fix handling of oversized NFSv4 COMPOUND requests + - x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled + - wifi: rtlwifi: 8192de: correct checking of IQK reload + - wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() + - bpf: Fix non-static bpf_func_proto struct definitions + - bpf: convert cgroup_bpf.progs to hlist + - bpf: Cleanup check_refcount_ok + - leds: lm3601x: Don't use mutex after it was destroyed + - tsnep: Fix TSNEP_INFO_TX_TIME register define + - bpf: Fix reference state management for synchronous callbacks + - wifi: cfg80211: get correct AP link chandef + - wifi: mac80211: allow bw change during channel switch in mesh + - bpftool: Fix a wrong type cast in btf_dumper_int + - audit: explicitly check audit_context->context enum value + - audit: free audit_proctitle only on task exit + - esp: choose the correct inner protocol for GSO on inter address family + tunnels + - spi: mt7621: Fix an error message in mt7621_spi_probe() + - x86/resctrl: Fix to restore to original value when re-enabling hardware + prefetch register + - xsk: Fix backpressure mechanism on Tx + - selftests/xsk: Add missing close() on netns fd + - bpf: Disable preemption when increasing per-cpu map_locked + - bpf: Propagate error from htab_lock_bucket() to userspace + - wifi: ath11k: Fix incorrect QMI message ID mappings + - bpf: Use this_cpu_{inc|dec|inc_return} for bpf_task_storage_busy + - bpf: Use this_cpu_{inc_return|dec} for prog->active + - Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend + - wifi: rtw89: pci: fix interrupt stuck after leaving low power mode + - wifi: rtw89: pci: correct TX resource checking in low power mode + - wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() + - wifi: wfx: prevent underflow in wfx_send_pds() + - wifi: rtw88: add missing destroy_workqueue() on error path in + rtw_core_init() + - selftests/xsk: Avoid use-after-free on ctx + - spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() + - spi: qup: add missing clk_disable_unprepare on error in + spi_qup_pm_resume_runtime() + - wifi: rtl8xxxu: Fix skb misuse in TX queue selection + - spi: meson-spicc: do not rely on busy flag in pow2 clk ops + - bpf: btf: fix truncated last_member_type_id in btf_struct_resolve + - wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration + - wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask + - wifi: mt76: mt7921e: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921s: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921u: fix race issue between reset and suspend/resume + - wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work + - wifi: mt76: sdio: poll sta stat when device transmits data + - wifi: mt76: sdio: fix transmitting packet hangs + - wifi: mt76: mt7615: add mt7615_mutex_acquire/release in + mt7615_sta_set_decap_offload + - wifi: mt76: mt7915: fix possible unaligned access in + mt7915_mac_add_twt_setup + - wifi: mt76: connac: fix possible unaligned access in + mt76_connac_mcu_add_nested_tlv + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload + - wifi: mt76: mt7915: fix mcs value in ht mode + - wifi: mt76: mt7915: do not check state before configuring implicit beamform + - wifi: mt76: mt7921e: fix rmmod crash in driver reload test + - Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release + - net: fs_enet: Fix wrong check in do_pd_setup + - bpf: Ensure correct locking around vulnerable function find_vpid() + - wifi: ath11k: Include STA_KEEPALIVE_ARP_RESPONSE TLV header by default + - Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure + - netfilter: conntrack: fix the gc rescheduling delay + - netfilter: conntrack: revisit the gc initial rescheduling bias + - flow_dissector: Do not count vlan tags inside tunnel payload + - wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected + - wifi: ath11k: fix number of VHT beamformee spatial streams + - mips: dts: ralink: mt7621: fix external phy on GB-PC2 + - x86/microcode/AMD: Track patch allocation size explicitly + - wifi: ath11k: fix peer addition/deletion error on sta band migration + - x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype + - spi: cadence-quadspi: Fix PM disable depth imbalance in cqspi_probe + - spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe + - spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe + - skmsg: Schedule psock work if the cached skb exists on the psock + - cw1200: fix incorrect check to determine if no element is found in list + - i2c: mlxbf: support lock mechanism + - Bluetooth: hci_core: Fix not handling link timeouts propertly + - xfrm: Reinject transport-mode packets through workqueue + - netfilter: nft_fib: Fix for rpath check with VRF devices + - spi: s3c64xx: Fix large transfers with DMA + - wifi: rtl8xxxu: gen2: Enable 40 MHz channel width + - wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM + - vhost/vsock: Use kvmalloc/kvfree for larger packets. + - eth: alx: take rtnl_lock on resume + - sctp: handle the error returned from sctp_auth_asoc_init_active_key + - tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited + - spi: Ensure that sg_table won't be used after being freed + - Bluetooth: hci_sync: Fix not indicating power state + - hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 + controller + - net: rds: don't hold sock lock when cancelling work from + rds_tcp_reset_callbacks() + - af_unix: Fix memory leaks of the whole sk due to OOB skb. + - net: prestera: acl: Add check for kmemdup + - eth: lan743x: reject extts for non-pci11x1x devices + - bnx2x: fix potential memory leak in bnx2x_tpa_stop() + - eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address + - net: wwan: iosm: Call mutex_init before locking it + - net/ieee802154: reject zero-sized raw_sendmsg() + - once: add DO_ONCE_SLOW() for sleepable contexts + - net: mvpp2: fix mvpp2 debugfs leak + - drm: bridge: adv7511: fix CEC power down control register offset + - drm: bridge: adv7511: unregister cec i2c device after cec adapter + - drm/bridge: Avoid uninitialized variable warning + - drm/mipi-dsi: Detach devices when removing the host + - drm/bridge: it6505: Power on downstream device in .atomic_enable + - drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling + - drm/bridge: tc358767: Add of_node_put() when breaking out of loop + - drm/bridge: parade-ps8640: Fix regulator supply order + - drm/dp_mst: fix drm_dp_dpcd_read return value checks + - drm:pl111: Add of_node_put() when breaking out of + for_each_available_child_of_node() + - ASoC: mt6359: fix tests for platform_get_irq() failure + - drm/msm: Make .remove and .shutdown HW shutdown consistent + - platform/chrome: fix double-free in chromeos_laptop_prepare() + - platform/chrome: fix memory corruption in ioctl + - drm/virtio: Fix same-context optimization + - ASoC: soc-pcm.c: call __soc_pcm_close() in soc_pcm_close() + - ASoC: tas2764: Allow mono streams + - ASoC: tas2764: Drop conflicting set_bias_level power setting + - ASoC: tas2764: Fix mute/unmute + - platform/x86: msi-laptop: Fix old-ec check for backlight registering + - platform/x86: msi-laptop: Fix resource cleanup + - platform/chrome: cros_ec_typec: Correct alt mode index + - drm/amdgpu: add missing pci_disable_device() in + amdgpu_pmops_runtime_resume() + - drm/bridge: megachips: Fix a null pointer dereference bug + - drm/bridge: it6505: Fix the order of DP_SET_POWER commands + - ASoC: rsnd: Add check for rsnd_mod_power_on + - ASoC: wm_adsp: Handle optional legacy support + - ALSA: hda: beep: Simplify keep-power-at-enable behavior + - drm/virtio: set fb_modifiers_not_supported + - drm/bochs: fix blanking + - ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON + - drm/omap: dss: Fix refcount leak bugs + - drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue() + - mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() + - ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API + - drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices + - drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx + - drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() + - ALSA: usb-audio: Properly refcounting clock rate + - drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() + - virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() + - ASoC: codecs: tx-macro: fix kcontrol put + - ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() + - ALSA: dmaengine: increment buffer pointer atomically + - mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() + - ASoC: stm32: dfsdm: Fix PM disable depth imbalance in stm32_adfsdm_probe + - ASoC: stm32: spdifrx: Fix PM disable depth imbalance in stm32_spdifrx_probe + - ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe + - ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe + - ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe + - ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe + - ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe + - ALSA: hda/hdmi: Don't skip notification handling during PM operation + - memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() + - memory: of: Fix refcount leak bug in of_get_ddr_timings() + - memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() + - locks: fix TOCTOU race when granting write lease + - soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() + - soc: qcom: smem_state: Add refcounting for the 'state->of_node' + - ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus + - arm64: dts: renesas: r9a07g044: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types + - dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1 + - ARM: dts: turris-omnia: Fix mpp26 pin name and comment + - ARM: dts: kirkwood: lsxl: fix serial line + - ARM: dts: kirkwood: lsxl: remove first ethernet port + - ia64: export memory_add_physaddr_to_nid to fix cxl build error + - soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA + - arm64: dts: ti: k3-j7200: fix main pinmux range + - ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family + - ARM: Drop CMDLINE_* dependency on ATAGS + - ext4: don't run ext4lazyinit for read-only filesystems + - arm64: ftrace: fix module PLTs with mcount + - ARM: dts: exynos: fix polarity of VBUS GPIO of Origen + - iomap: iomap: fix memory corruption when recording errors during writeback + - iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX + - iio: adc: at91-sama5d2_adc: check return status for pressure and touch + - iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq + - iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume + - iio: inkern: only release the device node when done with it + - iio: inkern: fix return value in devm_of_iio_channel_get_by_name() + - iio: ABI: Fix wrong format of differential capacitance channel ABI. + - iio: magnetometer: yas530: Change data type of hard_offsets to signed + - RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey + - usb: common: debug: Check non-standard control requests + - clk: meson: Hold reference returned by of_get_parent() + - clk: st: Hold reference returned by of_get_parent() + - clk: oxnas: Hold reference returned by of_get_parent() + - clk: qoriq: Hold reference returned by of_get_parent() + - clk: berlin: Add of_node_put() for of_get_parent() + - clk: sprd: Hold reference returned by of_get_parent() + - clk: tegra: Fix refcount leak in tegra210_clock_init + - clk: tegra: Fix refcount leak in tegra114_clock_init + - clk: tegra20: Fix refcount leak in tegra20_clock_init + - clk: samsung: exynosautov9: correct register offsets of peric0/c1 + - HSI: omap_ssi: Fix refcount leak in ssi_probe + - HSI: omap_ssi_port: Fix dma_map_sg error check + - clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock + - media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop + - tty: xilinx_uartps: Fix the ignore_status + - media: amphion: insert picture startcode after seek for vc1g format + - media: amphion: adjust the encoder's value range of gop size + - media: amphion: don't change the colorspace reported by decoder. + - media: amphion: fix a bug that vpu core may not resume after suspend + - media: meson: vdec: add missing clk_disable_unprepare on error in + vdec_hevc_start() + - media: uvcvideo: Fix memory leak in uvc_gpio_parse + - media: uvcvideo: Use entity get_cur in uvc_ctrl_set + - media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init + - RDMA/rxe: Fix "kernel NULL pointer dereference" error + - RDMA/rxe: Fix the error caused by qp->sk + - clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intf's parent + - clk: mediatek: clk-mt8195-vdo1: Reparent and set rate on vdo1_dpintf's + parent + - clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical + - misc: ocxl: fix possible refcount leak in afu_ioctl() + - fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() + - phy: rockchip-inno-usb2: Return zero after otg sync + - dmaengine: idxd: avoid deadlock in process_misc_interrupts() + - dmaengine: hisilicon: Disable channels when unregister hisi_dma + - dmaengine: hisilicon: Fix CQ head update + - dmaengine: hisilicon: Add multi-thread support for a DMA channel + - usb: gadget: f_fs: stricter integer overflow checks + - dyndbg: fix static_branch manipulation + - dyndbg: fix module.dyndbg handling + - dyndbg: let query-modname override actual module name + - dyndbg: drop EXPORTed dynamic_debug_exec_queries + - clk: qcom: sm6115: Select QCOM_GDSC + - mtd: devices: docg3: check the return value of devm_ioremap() in the probe + - remoteproc: Harden rproc_handle_vdev() against integer overflow + - phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by + of_get_parent() + - phy: phy-mtk-tphy: fix the phy type setting issue + - mtd: rawnand: intel: Read the chip-select line from the correct OF node + - mtd: rawnand: intel: Remove undocumented compatible string + - mtd: rawnand: fsl_elbc: Fix none ECC mode + - RDMA/irdma: Align AE id codes to correct flush code and event + - RDMA/irdma: Validate udata inlen and outlen + - RDMA/srp: Fix srp_abort() + - RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. + - RDMA/siw: Fix QP destroy to wait for all references dropped. + - ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() + - ata: fix ata_id_has_devslp() + - ata: fix ata_id_has_ncq_autosense() + - ata: fix ata_id_has_dipm() + - mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() + - md/raid5: Ensure stripe_fill happens on non-read IO with journal + - md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() + - RDMA/cm: Use SLID in the work completion as the DLID in responder side + - IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers + - xhci: Don't show warning for reinit on known broken suspend + - usb: gadget: function: fix dangling pnp_string in f_printer.c + - usb: dwc3: core: fix some leaks in probe + - drivers: serial: jsm: fix some leaks in probe + - serial: 8250: Toggle IER bits on only after irq has been set up + - tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown + - phy: qualcomm: call clk_disable_unprepare in the error handling + - staging: vt6655: fix some erroneous memory clean-up loops + - slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON + - slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register + - firmware: google: Test spinlock on panic path to avoid lockups + - serial: 8250: Fix restoring termios speed after suspend + - scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() + - scsi: pm8001: Fix running_req for internal abort commands + - scsi: iscsi: Rename iscsi_conn_queue_work() + - scsi: iscsi: Add recv workqueue helpers + - scsi: iscsi: Run recv path from workqueue + - scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() + - clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical + - clk: qcom: gcc-sm6115: Override default Alpha PLL regs + - RDMA/rxe: Fix resize_finish() in rxe_queue.c + - fsi: core: Check error number after calling ida_simple_get + - mfd: intel_soc_pmic: Fix an error handling path in + intel_soc_pmic_i2c_probe() + - mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() + - mfd: lp8788: Fix an error handling path in lp8788_probe() + - mfd: lp8788: Fix an error handling path in lp8788_irq_init() and + lp8788_irq_init() + - mfd: fsl-imx25: Fix check for platform_get_irq() errors + - mfd: sm501: Add check for platform_driver_register() + - mfd: da9061: Fix Failed to set Two-Wire Bus Mode. + - clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent + - clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes + - clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup + - clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() + - dmaengine: ioat: stop mod_timer from resurrecting deleted timer in + __cleanup() + - usb: mtu3: fix failed runtime suspend in host only mode + - spmi: pmic-arb: correct duplicate APID to PPID mapping logic + - clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD + - clk: baikal-t1: Fix invalid xGMAC PTP clock divider + - clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent + - clk: baikal-t1: Add SATA internal ref clock buffer + - clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration + - clk: imx: scu: fix memleak on platform_device_add() fails + - clk: ti: Balance of_node_get() calls for of_find_node_by_name() + - clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe + - clk: ast2600: BCLK comes from EPLL + - mailbox: mpfs: fix handling of the reg property + - mailbox: mpfs: account for mbox offsets while sending + - mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg + - ipc: mqueue: fix possible memory leak in init_mqueue_fs() + - powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig + - powerpc/math_emu/efp: Include module.h + - powerpc/sysdev/fsl_msi: Add missing of_node_put() + - powerpc/pci_dn: Add missing of_node_put() + - powerpc/powernv: add missing of_node_put() in opal_export_attrs() + - cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage + - powerpc: Fix fallocate and fadvise64_64 compat parameter combination + - x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition + - powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 + - powerpc/64: mark irqs hard disabled in boot paca + - powerpc/64/interrupt: Fix return to masked context after hard-mask irq + becomes pending + - powerpc: Fix SPE Power ISA properties for e500v1 platforms + - powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe() + - powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL + - crypto: sahara - don't sleep when in softirq + - crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr + - hwrng: arm-smccc-trng - fix NO_ENTROPY handling + - crypto: ccp - Fail the PSP initialization when writing psp data file failed + - cgroup: Honor caller's cgroup NS when resolving path + - hwrng: imx-rngc - Moving IRQ handler registering after + imx_rngc_irq_mask_clear() + - crypto: qat - fix default value of WDT timer + - crypto: hisilicon/qm - fix missing put dfx access + - cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset + - iommu/omap: Fix buffer overflow in debugfs + - crypto: akcipher - default implementation for setting a private key + - crypto: ccp - Release dma channels before dmaengine unrgister + - crypto: inside-secure - Change swab to swab32 + - crypto: qat - fix DMA transfer direction + - clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921 + - clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe + - cifs: return correct error in ->calc_signature() + - iommu/iova: Fix module config properly + - tracing: kprobe: Fix kprobe event gen test module on exit + - tracing: kprobe: Make gen test module work in arm and riscv + - tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads + - kbuild: remove the target in signal traps when interrupted + - linux/export: use inline assembler to populate symbol CRCs + - kbuild: rpm-pkg: fix breakage when V=1 is used + - crypto: marvell/octeontx - prevent integer overflows + - crypto: cavium - prevent integer overflow loading firmware + - random: schedule jitter credit for next jiffy, not in two jiffies + - thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id + - ACPI: APEI: do not add task_work to kernel thread to avoid memory leak + - f2fs: fix race condition on setting FI_NO_EXTENT flag + - f2fs: fix to account FS_CP_DATA_IO correctly + - selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle + - module: tracking: Keep a record of tainted unloaded modules only + - fs: dlm: fix race in lowcomms + - rcu: Avoid triggering strict-GP irq-work when RCU is idle + - rcu: Back off upon fill_page_cache_func() allocation failure + - cpufreq: amd_pstate: fix wrong lowest perf fetch + - ACPI: video: Add Toshiba Satellite/Portege Z830 quirk + - fortify: Fix __compiletime_strlen() under UBSAN_BOUNDS_LOCAL + - ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address + - cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode + - MIPS: BCM47XX: Cast memcmp() of function to (void *) + - powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue + - thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to + avoid crash + - ARM: decompressor: Include .data.rel.ro.local + - ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable + - x86/entry: Work around Clang __bdos() bug + - NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data + - NFSD: fix use-after-free on source server when doing inter-server copy + - wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices + - wifi: brcmfmac: fix invalid address access when enabling SCAN log level + - bpftool: Clear errno after libcap's checks + - ice: set tx_tstamps when creating new Tx rings via ethtool + - net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 + - openvswitch: Fix double reporting of drops in dropwatch + - openvswitch: Fix overreporting of drops in dropwatch + - tcp: annotate data-race around tcp_md5sig_pool_populated + - x86/mce: Retrieve poison range from hardware + - wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() + - thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround + - x86/apic: Don't disable x2APIC if locked + - net: axienet: Switch to 64-bit RX/TX statistics + - net-next: Fix IP_UNICAST_IF option behavior for connected sockets + - xfrm: Update ipcomp_scratches with NULL when freed + - wifi: ath11k: Register shutdown handler for WCN6750 + - rtw89: ser: leave lps with mutex + - iavf: Fix race between iavf_close and iavf_reset_task + - wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() + - Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk + - regulator: core: Prevent integer underflow + - wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register() + - wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value + - wifi: rtw89: free unused skb to prevent memory leak + - wifi: rtw89: fix rx filter after scan + - Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() + - Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times + - bnxt_en: replace reset with config timestamps + - selftests/bpf: Free the allocated resources after test case succeeds + - can: bcm: check the result of can_send() in bcm_can_tx() + - wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620 + - wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 + - wifi: rt2x00: set VGC gain for both chains of MT7620 + - wifi: rt2x00: set SoC wmac clock register + - wifi: rt2x00: correctly set BBP register 86 for MT7620 + - hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms + - net: If sock is dead don't access sock's sk_wq in sk_stream_wait_memory + - bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT + - bpf: use bpf_prog_pack for bpf_dispatcher + - Bluetooth: L2CAP: Fix user-after-free + - i2c: designware-pci: Group AMD NAVI quirk parts together + - drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() + - drm: Use size_t type for len variable in drm_copy_field() + - drm: Prevent drm_copy_field() to attempt copying a NULL pointer + - drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook + - gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() + - drm/amd/display: fix overflow on MIN_I64 definition + - udmabuf: Set ubuf->sg = NULL if the creation of sg table fails + - platform/x86: pmc_atom: Improve quirk message to be less cryptic + - drm: bridge: dw_hdmi: only trigger hotplug event on link change + - drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 + - drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF + - ALSA: usb-audio: Register card at the last interface + - drm/vc4: vec: Fix timings for VEC modes + - drm: panel-orientation-quirks: Add quirk for Anbernic Win600 + - drm: panel-orientation-quirks: Add quirk for Aya Neo Air + - platform/chrome: cros_ec: Notify the PM of wake events during resume + - platform/x86: hp-wmi: Setting thermal profile fails with 0x06 + - platform/x86: msi-laptop: Change DMI match / alias strings to fix module + autoloading + - ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS + - ASoC: SOF: pci: Change DMI match info to support all Chrome platforms + - ASoC: SOF: add quirk to override topology mclk_id + - drm/amdgpu: SDMA update use unlocked iterator + - drm/amd/display: correct hostvm flag + - drm/amdgpu: fix initial connector audio value + - drm/meson: reorder driver deinit sequence to fix use-after-free bug + - drm/meson: explicitly remove aggregate driver at module unload time + - drm/meson: remove drm bridges at aggregate driver unbind time + - drm/dp: Don't rewrite link config when setting phy test pattern + - drm/amd/display: Remove interface for periodic interrupt 1 + - drm/amd/display: polling vid stream status in hpo dp blank + - drm/amdkfd: Fix UBSAN shift-out-of-bounds warning + - ARM: dts: imx6: delete interrupts property if interrupts-extended is set + - ARM: dts: imx7d-sdb: config the max pressure for tsc2046 + - ARM: dts: imx6q: add missing properties for sram + - ARM: dts: imx6dl: add missing properties for sram + - ARM: dts: imx6qp: add missing properties for sram + - ARM: dts: imx6sl: add missing properties for sram + - ARM: dts: imx6sll: add missing properties for sram + - ARM: dts: imx6sx: add missing properties for sram + - ARM: dts: imx6sl: use tabs for code indent + - ARM: dts: imx6sx-udoo-neo: don't use multiple blank lines + - kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT + - arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO + voltage + - arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply + - btrfs: dump extra info if one free space cache has more bitmaps than it + should + - btrfs: scrub: properly report super block errors in system log + - btrfs: scrub: try to fix super block errors + - btrfs: don't print information about space cache or tree every remount + - btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure + - ARM: 9233/1: stacktrace: Skip frame pointer boundary check for + call_with_stack() + - ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value + - ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n + - clk: zynqmp: Fix stack-out-of-bounds in strncpy` + - media: cx88: Fix a null-ptr-deref bug in buffer_prepare() + - media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc + - clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate + - RDMA/rxe: Delete error messages triggered by incoming Read requests + - usb: host: xhci-plat: suspend and resume clocks + - usb: host: xhci-plat: suspend/resume clks for brcm + - scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID + - dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow + - scsi: 3w-9xxx: Avoid disabling device if failing to enable it + - nbd: Fix hung when signal interrupts nbd_start_device_ioctl() + - iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to + identity + - usb: gadget: uvc: increase worker prio to WQ_HIGHPRI + - power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() + - staging: vt6655: fix potential memory leak + - blk-throttle: prevent overflow while calculating wait time + - ata: libahci_platform: Sanity check the DT child nodes number + - bcache: fix set_at_max_writeback_rate() for multiple attached devices + - soundwire: cadence: Don't overwrite msg->buf during write commands + - soundwire: intel: fix error handling on dai registration issues + - HID: roccat: Fix use-after-free in roccat_read() + - HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() + - HID: nintendo: check analog user calibration for plausibility + - eventfd: guard wake_up in eventfd fs calls as well + - md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d + - usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() + - usb: musb: Fix musb_gadget.c rxstate overflow bug + - usb: dwc3: core: add gfladj_refclk_lpm_sel quirk + - arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes + - usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after + resume bug + - Revert "usb: storage: Add quirk for Samsung Fit flash" + - staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() + - staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() + - scsi: tracing: Fix compile error in trace_array calls when TRACING is + disabled + - ext2: Use kvmalloc() for group descriptor array + - nvme: handle effects after freeing the request + - nvme: copy firmware_rev on each init + - nvmet-tcp: add bounds check on Transfer Tag + - usb: idmouse: fix an uninit-value in idmouse_open + - blk-mq: use quiesced elevator switch when reinitializing queues + - hwmon (occ): Retry for checksum failure + - fsi: occ: Prevent use after free + - usb: typec: ucsi: Don't warn on probe deferral + - clk: bcm2835: Make peripheral PLLC critical + - clk: bcm2835: Round UART input clock up + - perf: Skip and warn on unknown format 'configN' attrs + - perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc + - perf intel-pt: Fix system_wide dummy event for hybrid + - mm: hugetlb: fix UAF in hugetlb_handle_userfault + - net: ieee802154: return -EINVAL for unknown addr type + - ALSA: usb-audio: Fix last interface check for registration + - blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() + - [Config] updateconfigs for MDIO_BITBANG + - net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses + - Revert "drm/amd/display: correct hostvm flag" + - Revert "net/ieee802154: reject zero-sized raw_sendmsg()" + - net/ieee802154: don't warn zero-sized raw_sendmsg() + - powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked + context + - drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n + - kbuild: Add skip_encoding_btf_enum64 option to pahole + - Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5 + - Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT + - [Config] updateconfigs for AS_HAS_NON_CONST_LEB128 + - lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 + - HID: uclogic: Add missing suffix for digitalizers + - ext4: continue to expand file system when the target size doesn't reach + - drm/i915: Rename block_size()/block_offset() + - drm/i915/bios: Validate fp_timing terminator presence + - drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers + - Linux 5.19.17 + * Kinetic update: v5.19.16 upstream stable release (LP: #1994164) + - nilfs2: fix use-after-free bug of struct nilfs_root + - nilfs2: fix leak of nilfs_root in case of writer thread creation failure + - nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure + - ceph: don't truncate file in atomic_open + - nvme-pci: set min_align_mask before calculating max_hw_sectors + - random: restore O_NONBLOCK support + - random: clamp credited irq bits to maximum mixed + - ALSA: hda: Fix position reporting on Poulsbo + - ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model + - efi: Correct Macmini DMI match in uefi cert quirk + - USB: serial: qcserial: add new usb-id for Dell branded EM7455 + - Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> + peripheral if extcon is present"" + - Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" + - Revert "powerpc/rtas: Implement reentrant rtas call" + - Revert "crypto: qat - reduce size of mapped region" + - random: avoid reading two cache lines on irq randomness + - random: use expired timer rather than wq for mixing fast pool + - mctp: prevent double key removal and unref + - Input: xpad - add supported devices as contributed on github + - Input: xpad - fix wireless 360 controller breaking after suspend + - misc: pci_endpoint_test: Aggregate params checking for xfer + - misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic + - Linux 5.19.16 + * Kinetic update: v5.19.15 upstream stable release (LP: #1994078) + - sparc: Unbreak the build + - Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 + - [Config] updateconfigs for CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + - hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero + - docs: update mediator information in CoC docs + - xsk: Inherit need_wakeup flag for shared sockets + - firmware: arm_scmi: Improve checks in the info_get operations + - firmware: arm_scmi: Harden accesses to the sensor domains + - firmware: arm_scmi: Add SCMI PM driver remove routine + - arm64: dts: rockchip: fix upper usb port on BPI-R2-Pro + - dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling + - dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property + - dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API + failure + - wifi: iwlwifi: don't spam logs with NSS>2 messages + - ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer + - drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1 + - scsi: qedf: Fix a UAF bug in __qedf_probe() + - net/ieee802154: fix uninit value bug in dgram_sendmsg + - net: marvell: prestera: add support for for Aldrin2 + - ALSA: hda/hdmi: Fix the converter reuse for the silent stream + - um: Cleanup syscall_handler_t cast in syscalls_32.h + - um: Cleanup compiler warning in arch/x86/um/tls_32.c + - gpio: ftgpio010: Make irqchip immutable + - arch: um: Mark the stack non-executable to fix a binutils warning + - net: atlantic: fix potential memory leak in aq_ndev_close() + - KVM: s390: Pass initialized arg even if unused + - drm/amd/display: Fix double cursor on non-video RGB MPO + - drm/amd/display: Assume an LTTPR is always present on fixed_vs links + - drm/amd/display: update gamut remap if plane has changed + - drm/amd/display: skip audio setup when audio stream is enabled + - drm/amd/display: Fix DP MST timeslot issue when fallback happened + - drm/amd/display: increase dcn315 pstate change latency + - perf/x86/intel: Fix unchecked MSR access error for Alder Lake N + - don't use __kernel_write() on kmap_local_page() + - i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe + - usb: mon: make mmapped memory read only + - USB: serial: ftdi_sio: fix 300 bps rate for SIO + - gpiolib: acpi: Add support to ignore programming an interrupt + - gpiolib: acpi: Add a quirk for Asus UM325UAZ + - mmc: core: Replace with already defined values for readability + - mmc: core: Terminate infinite loop in SD-UHS voltage switch + - rpmsg: qcom: glink: replace strncpy() with strscpy_pad() + - bpf: Gate dynptr API behind CAP_BPF + - net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear + - bpf: Fix resetting logic for unreferenced kptrs + - Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works + - Revert "clk: ti: Stop using legacy clkctrl names for omap4 and 5" + - Linux 5.19.15 + * Kinetic update: v5.19.14 upstream stable release (LP: #1994076) + - riscv: make t-head erratas depend on MMU + - tools/perf: Fix out of bound access to cpu mask array + - perf record: Fix cpu mask bit setting for mixed mmaps + - counter: 104-quad-8: Utilize iomap interface + - counter: 104-quad-8: Implement and utilize register structures + - counter: 104-quad-8: Fix skipped IRQ lines during events configuration + - uas: add no-uas quirk for Hiksemi usb_disk + - usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS + - uas: ignore UAS for Thinkplus chips + - usb: typec: ucsi: Remove incorrect warning + - thunderbolt: Explicitly reset plug events delay back to USB4 spec value + - net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 + - Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address + - can: c_can: don't cache TX messages for C_CAN cores + - clk: ingenic-tcu: Properly enable registers before accessing timers + - wifi: mac80211: ensure vif queues are operational after start + - x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd + - frontswap: don't call ->init if no ops are registered + - ARM: dts: integrator: Tag PCI host with device_type + - ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() + - x86/uaccess: avoid check_object_size() in copy_from_user_nmi() + - mm/damon/dbgfs: fix memory leak when using debugfs_lookup() + - net: mt7531: only do PLL once after the reset + - Revert "firmware: arm_scmi: Add clock management to the SCMI power domain" + - powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush + - drm/i915/gt: Restrict forced preemption to the active context + - drm/amdgpu: Add amdgpu suspend-resume code path under SRIOV + - vduse: prevent uninitialized memory accesses + - libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 + - mm: fix BUG splat with kvmalloc + GFP_ATOMIC + - mptcp: factor out __mptcp_close() without socket lock + - mptcp: fix unreleased socket in accept queue + - mmc: moxart: fix 4-bit bus width and remove 8-bit bus width + - mmc: hsq: Fix data stomping during mmc recovery + - mm: gup: fix the fast GUP race against THP collapse + - mm/page_alloc: fix race condition between build_all_zonelists and page + allocation + - mm: prevent page_frag_alloc() from corrupting the memory + - mm/page_isolation: fix isolate_single_pageblock() isolation behavior + - mm: fix dereferencing possible ERR_PTR + - mm/migrate_device.c: flush TLB while holding PTL + - mm/migrate_device.c: add missing flush_cache_page() + - mm/migrate_device.c: copy pte dirty bit to page + - mm: fix madivse_pageout mishandling on non-LRU page + - mm: bring back update_mmu_cache() to finish_fault() + - mm/hugetlb: correct demote page offset logic + - mm,hwpoison: check mm when killing accessing process + - media: dvb_vb2: fix possible out of bound access + - media: rkvdec: Disable H.264 error detection + - media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ) + - media: v4l2-compat-ioctl32.c: zero buffer passed to + v4l2_compat_get_array_args() + - ARM: dts: am33xx: Fix MMCHS0 dma properties + - reset: imx7: Fix the iMX8MP PCIe PHY PERST support + - ARM: dts: am5748: keep usb4_tm disabled + - soc: sunxi: sram: Actually claim SRAM regions + - soc: sunxi: sram: Prevent the driver from being unbound + - soc: sunxi: sram: Fix probe function ordering issues + - soc: sunxi: sram: Fix debugfs info for A64 SRAM C + - ASoC: imx-card: Fix refcount issue with of_node_put + - clk: microchip: mpfs: fix clk_cfg array bounds violation + - clk: microchip: mpfs: make the rtc's ahb clock critical + - arm64: dts: qcom: sm8350: fix UFS PHY serdes size + - ASoC: tas2770: Reinit regcache on reset + - drm/bridge: lt8912b: add vsync hsync + - drm/bridge: lt8912b: set hdmi or dvi mode + - drm/bridge: lt8912b: fix corrupted image output + - net: macb: Fix ZynqMP SGMII non-wakeup source resume failure + - Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in + suspend/resume time" + - Input: melfas_mip4 - fix return value check in mip4_probe() + - gpio: mvebu: Fix check for pwm support on non-A8K platforms + - perf parse-events: Break out tracepoint and printing + - perf print-events: Fix "perf list" can not display the PMU prefix for some + hybrid cache events + - perf parse-events: Remove "not supported" hybrid cache events + - usbnet: Fix memory leak in usbnet_disconnect() + - net: sched: act_ct: fix possible refcount leak in tcf_ct_init() + - cxgb4: fix missing unlock on ETHOFLD desc collect fail path + - net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe + - nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices + - wifi: cfg80211: fix MCS divisor value + - wifi: mac80211: fix regression with non-QoS drivers + - wifi: mac80211: fix memory corruption in minstrel_ht_update_rates() + - net: stmmac: power up/down serdes in stmmac_open/release + - net: phy: Don't WARN for PHY_UP state in mdio_bus_phy_resume() + - selftests: Fix the if conditions of in test_extra_filter() + - ice: xsk: change batched Tx descriptor cleaning + - ice: xsk: drop power of 2 ring size restriction for AF_XDP + - vdpa/ifcvf: fix the calculation of queuepair + - virtio-blk: Fix WARN_ON_ONCE in virtio_queue_rq() + - vdpa/mlx5: Fix MQ to support non power of two num queues + - clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks + - drm/i915/gt: Perf_limit_reasons are only available for Gen11+ + - clk: iproc: Do not rely on node name for correct PLL setup + - clk: imx93: drop of_match_ptr + - net: mscc: ocelot: fix tagged VLAN refusal while under a VLAN-unaware bridge + - net: ethernet: mtk_eth_soc: fix mask of RX_DMA_GET_SPORT{,_V2} + - perf test: Fix test case 87 ("perf record tests") for hybrid systems + - perf tests record: Fail the test if the 'errs' counter is not zero + - KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest + - x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant + - x86/alternative: Fix race in try_get_desc() + - damon/sysfs: fix possible memleak on damon_sysfs_add_target + - Linux 5.19.14 + * Kinetic update: v5.19.13 upstream stable release (LP: #1994075) + - Linux 5.19.13 + * Kinetic update: v5.19.12 upstream stable release (LP: #1994074) + - smb3: Move the flush out of smb2_copychunk_range() into its callers + - smb3: fix temporary data corruption in collapse range + - smb3: fix temporary data corruption in insert range + - usb: add quirks for Lenovo OneLink+ Dock + - usb: gadget: udc-xilinx: replace memcpy with memcpy_toio + - smb3: use filemap_write_and_wait_range instead of filemap_write_and_wait + - Revert "usb: add quirks for Lenovo OneLink+ Dock" + - Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" + - xfrm: fix XFRMA_LASTUSED comment + - block: remove QUEUE_FLAG_DEAD + - block: stop setting the nomerges flags in blk_cleanup_queue + - block: simplify disk shutdown + - scsi: core: Fix a use-after-free + - drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES + - USB: core: Fix RST error in hub.c + - USB: serial: option: add Quectel BG95 0x0203 composition + - USB: serial: option: add Quectel RM520N + - ALSA: core: Fix double-free at snd_card_new() + - ALSA: hda/tegra: set depop delay for tegra + - ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation + - ALSA: hda: Fix Nvidia dp infoframe + - ALSA: hda: add Intel 5 Series / 3400 PCI DID + - ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop + - ALSA: hda/realtek: Re-arrange quirk table entries + - ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack + - ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack + - ALSA: hda/realtek: Add quirk for ASUS GA503R laptop + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop + - ALSA: hda/realtek: Add a quirk for HP OMEN 16 (8902) mute LED + - iommu/vt-d: Check correct capability for sagaw determination + - exfat: fix overflow for large capacity partition + - btrfs: fix hang during unmount when stopping block group reclaim worker + - btrfs: fix hang during unmount when stopping a space reclaim worker + - btrfs: zoned: wait for extent buffer IOs before finishing a zone + - libperf evlist: Fix polling of system-wide events + - media: flexcop-usb: fix endpoint type check + - usb: dwc3: core: leave default DMA if the controller does not support 64-bit + DMA + - thunderbolt: Add support for Intel Maple Ridge single port controller + - efi: x86: Wipe setup_data on pure EFI boot + - efi: libstub: check Shim mode using MokSBStateRT + - wifi: mt76: fix reading current per-tid starting sequence number for + aggregation + - gpio: mockup: fix NULL pointer dereference when removing debugfs + - gpio: mockup: Fix potential resource leakage when register a chip + - gpiolib: cdev: Set lineevent_state::irq after IRQ register successfully + - riscv: fix a nasty sigreturn bug... + - riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning + - drm/i915/gem: Flush contexts on driver release + - drm/i915/gem: Really move i915_gem_context.link under ref protection + - xen/xenbus: fix xenbus_setup_ring() + - kasan: call kasan_malloc() from __kmalloc_*track_caller() + - can: flexcan: flexcan_mailbox_read() fix return value for drop = true + - net: mana: Add rmb after checking owner bits + - mm/slub: fix to return errno if kmalloc() fails + - mm: slub: fix flush_cpu_slab()/__free_slab() invocations in task context. + - KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0 + - KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES + - KVM: x86: Inject #UD on emulated XSETBV if XSAVES isn't enabled + - perf/arm-cmn: Add more bits to child node address offset field + - arm64: topology: fix possible overflow in amu_fie_setup() + - vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment + - batman-adv: Fix hang up with small MTU hard-interface + - firmware: arm_scmi: Harden accesses to the reset domains + - firmware: arm_scmi: Fix the asynchronous reset requests + - arm64: dts: rockchip: Lower sd speed on quartz64-b + - arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob + - arm64: dts: rockchip: Fix typo in lisense text for PX30.Core + - drm/mediatek: dsi: Add atomic {destroy,duplicate}_state, reset callbacks + - arm64: dts: imx8mm: Reverse CPLD_Dn GPIO label mapping on MX8Menlo + - arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz + - arm64: dts: imx8mn: remove GPU power domain reset + - arm64: dts: imx8ulp: add #reset-cells for pcc + - dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get() + - arm64: dts: rockchip: fix property for usb2 phy supply on rock-3a + - arm64: dts: rockchip: fix property for usb2 phy supply on rk3568-evb1-v10 + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3566-quartz64-a + - arm64: dts: imx8mm-verdin: extend pmic voltages + - netfilter: nf_conntrack_sip: fix ct_sip_walk_headers + - netfilter: nf_conntrack_irc: Tighten matching on DCC message + - netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() + - ice: Don't double unplug aux on peer initiated reset + - ice: Fix crash by keep old cfg when update TCs more than queues + - iavf: Fix cached head and tail value for iavf_get_tx_pending + - ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header + - net: core: fix flow symmetric hash + - wifi: iwlwifi: Mark IWLMEI as broken + - [Config] updateconfigs for IWLMEI + - arm64: dts: tqma8mqml: Include phy-imx8-pcie.h header + - drm/mediatek: Fix wrong dither settings + - arm64: dts: imx8mp-venice-gw74xx: fix CAN STBY polarity + - arm64: dts: imx8mp-venice-gw74xx: fix ksz9477 cpu port + - ARM: dts: lan966x: Fix the interrupt number for internal PHYs + - net: phy: aquantia: wait for the suspend/resume operations to finish + - arm64: dts: imx8mp-venice-gw74xx: fix port/phy validation + - scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts() + - scsi: mpt3sas: Fix return value check of dma_get_required_mask() + - net: bonding: Share lacpdu_mcast_addr definition + - net: bonding: Unsync device addresses on ndo_stop + - net: team: Unsync device addresses on ndo_stop + - drm/panel: simple: Fix innolux_g121i1_l01 bus_format + - mm/slab_common: fix possible double free of kmem_cache + - MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko + - MIPS: Loongson32: Fix PHY-mode being left unspecified + - um: fix default console kernel parameter + - iavf: Fix bad page state + - mlxbf_gige: clear MDIO gateway lock after read + - i40e: Fix set max_tx_rate when it is lower than 1 Mbps + - netdevsim: Fix hwstats debugfs file permissions + - sfc: fix TX channel offset when using legacy interrupts + - sfc: fix null pointer dereference in efx_hard_start_xmit + - bnxt_en: fix flags to check for supported fw version + - gve: Fix GFP flags when allocing pages + - drm/hisilicon: Add depends on MMU + - of: mdio: Add of_node_put() when breaking out of for_each_xx + - net: ipa: properly limit modem routing table use + - sfc/siena: fix TX channel offset when using legacy interrupts + - sfc/siena: fix null pointer dereference in efx_hard_start_xmit + - wireguard: ratelimiter: disable timings test by default + - wireguard: netlink: avoid variable-sized memcpy on sockaddr + - net: enetc: move enetc_set_psfp() out of the common enetc_set_features() + - net: enetc: deny offload of tc-based TSN features on VF interfaces + - ipv6: Fix crash when IPv6 is administratively disabled + - net/sched: taprio: avoid disabling offload when it was never enabled + - net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child + qdiscs + - ice: config netdev tc before setting queues number + - ice: Fix interface being down after reset with link-down-on-close flag on + - netfilter: nf_tables: fix nft_counters_enabled underflow at + nf_tables_addchain() + - netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain() + - netfilter: ebtables: fix memory leak when blob is malformed + - netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed + - net: ravb: Fix PHY state warning splat during system resume + - net: sh_eth: Fix PHY state warning splat during system resume + - gpio: tqmx86: fix uninitialized variable girq + - can: gs_usb: gs_can_open(): fix race dev->can.state condition + - perf stat: Fix BPF program section name + - perf stat: Fix cpu map index in bperf cgroup code + - perf jit: Include program header in ELF files + - perf kcore_copy: Do not check /proc/modules is unchanged + - perf tools: Honor namespace when synthesizing build-ids + - drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff() + - ice: Fix ice_xdp_xmit() when XDP TX queue number is not sufficient + - net/smc: Stop the CLC flow if no link to map buffers on + - net: phy: micrel: fix shared interrupt on LAN8814 + - bonding: fix NULL deref in bond_rr_gen_slave_id + - net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD + - net: sched: fix possible refcount leak in tc_new_tfilter() + - bnxt: prevent skb UAF after handing over to PTP worker + - selftests: forwarding: add shebang for sch_red.sh + - io_uring: ensure that cached task references are always put on exit + - serial: fsl_lpuart: Reset prior to registration + - serial: Create uart_xmit_advance() + - serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting + - serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting + - cgroup: cgroup_get_from_id() must check the looked-up kn is a directory + - phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset support + - s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup + - blk-mq: fix error handling in __blk_mq_alloc_disk + - block: call blk_mq_exit_queue from disk_release for never added disks + - block: Do not call blk_put_queue() if gendisk allocation fails + - Drivers: hv: Never allocate anything besides framebuffer from framebuffer + memory region + - drm/gma500: Fix BUG: sleeping function called from invalid context errors + - drm/gma500: Fix WARN_ON(lock->magic != lock) error + - drm/gma500: Fix (vblank) IRQs not working after suspend/resume + - gpio: ixp4xx: Make irqchip immutable + - drm/amd/pm: disable BACO entry/exit completely on several sienna cichlid + cards + - drm/amdgpu: change the alignment size of TMR BO to 1M + - drm/amdgpu: add HDP remap functionality to nbio 7.7 + - drm/amdgpu: Skip reset error status for psp v13_0_0 + - drm/amd/display: Limit user regamma to a valid value + - drm/amd/display: Reduce number of arguments of dml31's + CalculateWatermarksAndDRAMSpeedChangeSupport() + - drm/amd/display: Reduce number of arguments of dml31's + CalculateFlipSchedule() + - drm/amd/display: Mark dml30's UseMinimumDCFCLK() as noinline for stack usage + - drm/rockchip: Fix return type of cdn_dp_connector_mode_valid + - gpio: mt7621: Make the irqchip immutable + - pmem: fix a name collision + - fsdax: Fix infinite loop in dax_iomap_rw() + - workqueue: don't skip lockdep work dependency in cancel_work_sync() + - i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible + - i2c: mlxbf: incorrect base address passed during io write + - i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction() + - i2c: mlxbf: Fix frequency calculation + - i2c: mux: harden i2c_mux_alloc() against integer overflows + - drm/amdgpu: don't register a dirty callback for non-atomic + - certs: make system keyring depend on built-in x509 parser + - Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT + - Makefile.debug: re-enable debug info for .S files + - devdax: Fix soft-reservation memory description + - ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 + - ext4: limit the number of retries after discarding preallocations blocks + - ext4: make mballoc try target group first even with mb_optimize_scan + - ext4: avoid unnecessary spreading of allocations among groups + - ext4: use locality group preallocation for small closed files + - ext4: use buckets for cr 1 block scan instead of rbtree + - Revert "block: freeze the queue earlier in del_gendisk" + - ext4: fixup possible uninitialized variable access in + ext4_mb_choose_next_group_cr1() + - ext4: make directory inode spreading reflect flexbg size + - Linux 5.19.12 + * Kinetic update: v5.19.11 upstream stable release (LP: #1994070) + - of: fdt: fix off-by-one error in unflatten_dt_nodes() + - pinctrl: qcom: sc8180x: Fix gpio_wakeirq_map + - pinctrl: qcom: sc8180x: Fix wrong pin numbers + - pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH + - pinctrl: sunxi: Fix name for A100 R_PIO + - SUNRPC: Fix call completion races with call_decode() + - NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0 + - gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx + - NFSv4.2: Update mode bits after ALLOCATE and DEALLOCATE + - Revert "SUNRPC: Remove unreachable error condition" + - drm/panel-edp: Fix delays for Innolux N116BCA-EA1 + - drm/meson: Correct OSD1 global alpha value + - drm/meson: Fix OSD1 RGB to YCbCr coefficient + - drm/rockchip: vop2: Fix eDP/HDMI sync polarities + - drm/i915/vdsc: Set VDSC PIC_HEIGHT before using for DP DSC + - drm/i915/guc: Don't update engine busyness stats too frequently + - drm/i915/guc: Cancel GuC engine busyness worker synchronously + - block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for + nowait + - parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() + - of/device: Fix up of_dma_configure_id() stub + - io_uring/msg_ring: check file type before putting + - cifs: revalidate mapping when doing direct writes + - cifs: don't send down the destination address to sendmsg for a SOCK_STREAM + - cifs: always initialize struct msghdr smb_msg completely + - blk-lib: fix blkdev_issue_secure_erase + - parisc: Allow CONFIG_64BIT with ARCH=parisc + - tools/include/uapi: Fix for parisc and xtensa + - drm/i915/gt: Fix perf limit reasons bit positions + - drm/i915: Set correct domains values at _i915_vma_move_to_active + - drm/amdgpu: make sure to init common IP before gmc + - drm/amdgpu: Don't enable LTR if not supported + - drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega + - drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega + - net: Find dst with sk's xfrm policy not ctl_sk + - dt-bindings: apple,aic: Fix required item "apple,fiq-index" in affinity + description + - cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() + - ALSA: hda/sigmatel: Keep power up while beep is enabled + - ALSA: hda/sigmatel: Fix unused variable warning for beep power change + - Linux 5.19.11 + * Kinetic update: v5.19.10 upstream stable release (LP: #1994069) + - iommu/vt-d: Fix kdump kernels boot failure with scalable mode + - net/mlx5: Introduce ifc bits for using software vhca id + - net/mlx5: Use software VHCA id when it's supported + - RDMA/mlx5: Rely on RoCE fw cap instead of devlink when setting profile + - RDMA/mlx5: Add a umr recovery flow + - RDMA/mlx5: Fix UMR cleanup on error flow of driver init + - ACPI: resource: skip IRQ override on AMD Zen platforms + - Input: goodix - add support for GT1158 + - platform/surface: aggregator_registry: Add support for Surface Laptop Go 2 + - drm/msm/rd: Fix FIFO-full deadlock + - peci: cpu: Fix use-after-free in adev_release() + - kvm: x86: mmu: Always flush TLBs when enabling dirty logging + - dt-bindings: iio: gyroscope: bosch,bmg160: correct number of pins + - HID: ishtp-hid-clientHID: ishtp-hid-client: Fix comment typo + - hid: intel-ish-hid: ishtp: Fix ishtp client sending disordered message + - Bluetooth: MGMT: Fix Get Device Flags + - tg3: Disable tg3 device on system reboot to avoid triggering AER + - r8152: add PID for the Lenovo OneLink+ Dock + - gpio: mockup: remove gpio debugfs when remove device + - ieee802154: cc2520: add rc code in cc2520_tx() + - Input: iforce - add support for Boeder Force Feedback Wheel + - drm/amdgpu: disable FRU access on special SIENNA CICHLID card + - drm/amd/pm: use vbios carried pptable for all SMU13.0.7 SKUs + - nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM610 + - nvmet-tcp: fix unhandled tcp states in nvmet_tcp_state_change() + - drm/amd/amdgpu: skip ucode loading if ucode_size == 0 + - net: dsa: hellcreek: Print warning only once + - perf/arm_pmu_platform: fix tests for platform_get_irq() failure + - platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes + - usb: storage: Add ASUS <0x0b05:0x1932> to IGNORE_UAS + - platform/x86: asus-wmi: Increase FAN_CURVE_BUF_LEN to 32 + - LoongArch: Fix section mismatch due to acpi_os_ioremap() + - LoongArch: Fix arch_remove_memory() undefined build error + - gpio: 104-dio-48e: Make irq_chip immutable + - gpio: 104-idio-16: Make irq_chip immutable + - RDMA/irdma: Use s/g array in post send only when its valid + - Input: goodix - add compatible string for GT1158 + - Linux 5.19.10 + * Kinetic update: v5.19.9 upstream stable release (LP: #1994068) + - efi: libstub: Disable struct randomization + - efi: capsule-loader: Fix use-after-free in efi_capsule_write + - wifi: mt76: mt7921e: fix crash in chip reset fail + - wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in + il4965_rs_fill_link_cmd() + - fs: only do a memory barrier for the first set_buffer_uptodate() + - soc: fsl: select FSL_GUTS driver for DPIO + - Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" + - scsi: qla2xxx: Disable ATIO interrupt coalesce for quad port ISP27XX + - scsi: core: Allow the ALUA transitioning state enough time + - scsi: megaraid_sas: Fix double kfree() + - drm/gem: Fix GEM handle release errors + - drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to + psp_hw_fini + - drm/amdgpu: fix hive reference leak when adding xgmi device + - drm/amdgpu: Check num_gfx_rings for gfx v9_0 rb setup. + - drm/amdgpu: Remove the additional kfd pre reset call for sriov + - drm/radeon: add a force flush to delay work when radeon + - scsi: ufs: core: Reduce the power mode change timeout + - Revert "parisc: Show error if wrong 32/64-bit compiler is being used" + - parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() + - parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines + - [Config] updateconfigs for ARM64_ERRATUM_2457168 + - arm64: errata: add detection for AMEVCNTR01 incrementing incorrectly + - netfilter: conntrack: work around exceeded receive window + - thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR + - cpufreq: check only freq_table in __resolve_freq() + - net/core/skbuff: Check the return value of skb_copy_bits() + - md: Flush workqueue md_rdev_misc_wq in md_alloc() + - fbdev: omapfb: Fix tests for platform_get_irq() failure + - fbdev: fbcon: Destroy mutex on freeing struct fb_info + - fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() + - x86/sev: Mark snp_abort() noreturn + - drm/amdgpu: add sdma instance check for gfx11 CGCG + - drm/amdgpu: mmVM_L2_CNTL3 register not initialized correctly + - ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC + - ALSA: emu10k1: Fix out of bounds access in snd_emu10k1_pcm_channel_alloc() + - ALSA: hda: Once again fix regression of page allocations with IOMMU + - ALSA: aloop: Fix random zeros in capture data when using jiffies timer + - ALSA: usb-audio: Clear fixed clock rate at closing EP + - ALSA: usb-audio: Fix an out-of-bounds bug in + __snd_usb_parse_audio_interface() + - tracefs: Only clobber mode/uid/gid on remount if asked + - tracing: hold caller_addr to hardirq_{enable,disable}_ip + - tracing: Fix to check event_mutex is held while accessing trigger list + - btrfs: zoned: set pseudo max append zone limit in zone emulation mode + - btrfs: zoned: fix API misuse of zone finish waiting + - vfio/type1: Unpin zero pages + - kprobes: Prohibit probes in gate area + - perf: RISC-V: fix access beyond allocated array + - debugfs: add debugfs_lookup_and_remove() + - sched/debug: fix dentry leak in update_sched_domain_debugfs + - drm/amd/display: fix memory leak when using debugfs_lookup() + - driver core: fix driver_set_override() issue with empty strings + - nvmet: fix a use-after-free + - drm/i915/bios: Copy the whole MIPI sequence block + - drm/i915/slpc: Let's fix the PCODE min freq table setup for SLPC + - scsi: mpt3sas: Fix use-after-free warning + - scsi: lpfc: Add missing destroy_workqueue() in error path + - cgroup: Elide write-locking threadgroup_rwsem when updating csses on an + empty subtree + - cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock + - cifs: remove useless parameter 'is_fsctl' from SMB2_ioctl() + - smb3: missing inode locks in zero range + - spi: bitbang: Fix lsb-first Rx + - ASoC: cs42l42: Only report button state if there was a button interrupt + - Revert "soc: imx: imx8m-blk-ctrl: set power device name" + - arm64: dts: imx8mm-verdin: update CAN clock to 40MHz + - arm64: dts: imx8mm-verdin: use level interrupt for mcp251xfd + - ASoC: qcom: sm8250: add missing module owner + - regmap: spi: Reserve space for register address/padding + - arm64: dts: imx8mp-venice-gw74xx: fix sai2 pin settings + - arm64: dts: imx8mq-tqma8mq: Remove superfluous interrupt-names + - RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg + - RDMA/rtrs-srv: Pass the correct number of entries for dma mapped SGL + - ARM: dts: imx6qdl-vicut1.dtsi: Fix node name backlight_led + - ARM: dts: imx6qdl-kontron-samx6i: remove duplicated node + - ARM: dts: imx6qdl-kontron-samx6i: fix spi-flash compatible + - arm64: dts: ls1028a-qds-65bb: don't use in-band autoneg for 2500base-x + - soc: imx: gpcv2: Assert reset before ungating clock + - arm64: dts: verdin-imx8mm: add otg2 pd to usbphy + - arm64: dts: imx8mm-venice-gw7901: fix port/phy validation + - arm64: dts: freescale: verdin-imx8mm: fix atmel_mxt_ts reset polarity + - arm64: dts: freescale: verdin-imx8mp: fix atmel_mxt_ts reset polarity + - regulator: core: Clean up on enable failure + - ASoC: SOF: Kconfig: Make IPC_FLOOD_TEST depend on SND_SOC_SOF + - ASoC: SOF: Kconfig: Make IPC_MESSAGE_INJECTOR depend on SND_SOC_SOF + - tee: fix compiler warning in tee_shm_register() + - RDMA/irdma: Fix drain SQ hang with no completion + - arm64: dts: renesas: r8a779g0: Fix HSCIF0 interrupt number + - RDMA/cma: Fix arguments order in net device validation + - soc: brcmstb: pm-arm: Fix refcount leak and __iomem leak bugs + - RDMA/hns: Fix supported page size + - RDMA/hns: Fix wrong fixed value of qp->rq.wqe_shift + - RDMA/hns: Remove the num_qpc_timer variable + - wifi: wilc1000: fix DMA on stack objects + - ARM: at91: pm: fix self-refresh for sama7g5 + - ARM: at91: pm: fix DDR recalibration when resuming from backup and self- + refresh + - ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges + - ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges + - ARM: dts: at91: sama7g5ek: specify proper regulator output ranges + - ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time + - ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time + - netfilter: br_netfilter: Drop dst references before setting. + - netfilter: nf_tables: clean up hook list when offload flags check fails + - riscv: dts: microchip: use an mpfs specific l2 compatible + - netfilter: nf_conntrack_irc: Fix forged IP logic + - RDMA/srp: Set scmnd->result only when scmnd is not NULL + - ALSA: usb-audio: Inform the delayed registration more properly + - ALSA: usb-audio: Register card again for iface over delayed_register option + - rxrpc: Fix ICMP/ICMP6 error handling + - rxrpc: Fix an insufficiently large sglist in rxkad_verify_packet_2() + - afs: Use the operation issue time instead of the reply time for callbacks + - kunit: fix assert_type for comparison macros + - Revert "net: phy: meson-gxl: improve link-up behavior" + - sch_sfb: Don't assume the skb is still around after enqueueing to child + - tipc: fix shift wrapping bug in map_get() + - net: introduce __skb_fill_page_desc_noacc + - tcp: TX zerocopy should not sense pfmemalloc status + - ice: Fix DMA mappings leak + - ice: use bitmap_free instead of devm_kfree + - i40e: Fix kernel crash during module removal + - iavf: Detach device during reset task + - xen-netback: only remove 'hotplug-status' when the vif is actually destroyed + - block: don't add partitions if GD_SUPPRESS_PART_SCAN is set + - RDMA/siw: Pass a pointer to virt_to_page() + - bonding: use unspecified address if no available link local address + - bonding: add all node mcast address when slave up + - ipv6: sr: fix out-of-bounds read when setting HMAC data. + - IB/core: Fix a nested dead lock as part of ODP flow + - RDMA/mlx5: Set local port to one when accessing counters + - btrfs: zoned: fix mounting with conventional zones + - erofs: fix error return code in erofs_fscache_{meta_,}read_folio + - erofs: fix pcluster use-after-free on UP platforms + - nvme-tcp: fix UAF when detecting digest errors + - nvme-tcp: fix regression that causes sporadic requests to time out + - tcp: fix early ETIMEDOUT after spurious non-SACK RTO + - btrfs: fix the max chunk size and stripe length calculation + - nvmet: fix mar and mor off-by-one errors + - RDMA/irdma: Report the correct max cqes from query device + - RDMA/irdma: Return error on MR deregister CQP failure + - RDMA/irdma: Return correct WC error for bind operation failure + - RDMA/irdma: Report RNR NAK generation in device caps + - net: dsa: felix: disable cut-through forwarding for frames oversized for tc- + taprio + - net: dsa: felix: access QSYS_TAG_CONFIG under tas_lock in + vsc9959_sched_speed_set + - net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear + - net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb + - net/smc: Fix possible access to freed memory in link clear + - io_uring: recycle kbuf recycle on tw requeue + - net: phy: lan87xx: change interrupt src of link_up to comm_ready + - sch_sfb: Also store skb len before calling child enqueue + - libperf evlist: Fix per-thread mmaps for multi-threaded targets + - perf dlfilter dlfilter-show-cycles: Fix types for print format + - perf script: Fix Cannot print 'iregs' field for hybrid systems + - perf record: Fix synthesis failure warnings + - hwmon: (tps23861) fix byte order in resistance register + - ASoC: mchp-spdiftx: remove references to mchp_i2s_caps + - ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion + - MIPS: loongson32: ls1c: Fix hang during startup + - kbuild: disable header exports for UML in a straightforward way + - i40e: Refactor tc mqprio checks + - i40e: Fix ADQ rate limiting for PF + - net: bonding: replace dev_trans_start() with the jiffies of the last ARP/NS + - bonding: accept unsolicited NA message + - swiotlb: avoid potential left shift overflow + - iommu/amd: use full 64-bit value in build_completion_wait() + - s390/boot: fix absolute zero lowcore corruption on boot + - time64.h: consolidate uses of PSEC_PER_NSEC + - net: dsa: felix: tc-taprio intervals smaller than MTU should send at least + one packet + - hwmon: (mr75203) fix VM sensor allocation when "intel,vm-map" not defined + - hwmon: (mr75203) update pvt->v_num and vm_num to the actual number of used + sensors + - hwmon: (mr75203) fix voltage equation for negative source input + - hwmon: (mr75203) fix multi-channel voltage reading + - hwmon: (mr75203) enable polling for all VM channels + - perf evlist: Always use arch_evlist__add_default_attrs() + - perf stat: Fix L2 Topdown metrics disappear for raw events + - Revert "arm64: kasan: Revert "arm64: mte: reset the page tag in + page->flags"" + - hwmon: (asus-ec-sensors) add support for Strix Z690-a D4 + - hwmon: (asus-ec-sensors) add support for Maximus XI Hero + - hwmon: (asus-ec-sensors) add missing sensors for X570-I GAMING + - hwmon: (asus-ec-sensors) add definitions for ROG ZENITH II EXTREME + - hwmon: (asus-ec-sensors) autoload module via DMI data + - arm64/bti: Disable in kernel BTI when cross section thunks are broken + - [Config] updateconfigs for ARM64_BTI_KERNEL + - iommu/vt-d: Correctly calculate sagaw value of IOMMU + - iommu/virtio: Fix interaction with VFIO + - iommu: Fix false ownership failure on AMD systems with PASID activated + - drm/amd/display: Add SMU logging code + - drm/amd/display: Removing assert statements for Linux + - Linux 5.19.9 + * Kinetic update: v5.19.8 upstream stable release (LP: #1994061) + - drm/msm/dp: make eDP panel as the first connected connector + - drm/msm/dsi: fix the inconsistent indenting + - drm/msm/dpu: populate wb or intf before reset_intf_cfg + - drm/msm/dp: delete DP_RECOVERED_CLOCK_OUT_EN to fix tps4 + - drm/msm/dsi: Fix number of regulators for msm8996_dsi_cfg + - drm/msm/dsi: Fix number of regulators for SDM660 + - platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask + - platform/x86: x86-android-tablets: Fix broken touchscreen on Chuwi Hi8 with + Windows BIOS + - xsk: Fix corrupted packets for XDP_SHARED_UMEM + - drm/msm/gpu: Drop qos request if devm_devfreq_add_device() fails + - peci: aspeed: fix error check return value of platform_get_irq() + - iio: adc: mcp3911: make use of the sign bit + - skmsg: Fix wrong last sg check in sk_msg_recvmsg() + - bpf: Restrict bpf_sys_bpf to CAP_PERFMON + - ip_tunnel: Respect tunnel key's "flow_flags" in IP tunnels + - bpf, cgroup: Fix kernel BUG in purge_effective_progs + - drm/i915/gvt: Fix Comet Lake + - ieee802154/adf7242: defer destroy_workqueue call + - bpf: Fix a data-race around bpf_jit_limit. + - drm/i915/ttm: fix CCS handling + - drm/i915/display: avoid warnings when registering dual panel backlight + - ALSA: hda: intel-nhlt: Correct the handling of fmt_config flexible array + - wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() + - xhci: Fix null pointer dereference in remove if xHC has only one roothub + - Revert "xhci: turn off port power in shutdown" + - bpf: Allow helpers to accept pointers with a fixed size + - bpf: Tidy up verifier check_func_arg() + - bpf: Do mark_chain_precision for ARG_CONST_ALLOC_SIZE_OR_ZERO + - Bluetooth: hci_event: Fix vendor (unknown) opcode status handling + - Bluetooth: hci_sync: Fix suspend performance regression + - Bluetooth: hci_event: Fix checking conn for le_conn_complete_evt + - Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn + - net: sparx5: fix handling uneven length packets in manual extraction + - net: smsc911x: Stop and start PHY during suspend and resume + - openvswitch: fix memory leak at failed datapath creation + - nfp: flower: fix ingress police using matchall filter + - net: dsa: xrs700x: Use irqsave variant for u64 stats update + - net: sched: tbf: don't call qdisc_put() while holding tree lock + - net/sched: fix netdevice reference leaks in attach_default_qdiscs() + - net: phy: micrel: Make the GPIO to be non-exclusive + - net: lan966x: improve error handle in lan966x_fdma_rx_get_frame() + - ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler + - cachefiles: fix error return code in cachefiles_ondemand_copen() + - cachefiles: make on-demand request distribution fairer + - mlxbf_gige: compute MDIO period based on i1clk + - kcm: fix strp_init() order and cleanup + - sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb + - tcp: annotate data-race around challenge_timestamp + - Revert "sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb" + - net/smc: Remove redundant refcount increase + - soundwire: qcom: fix device status array range + - mm/slab_common: Deleting kobject in kmem_cache_destroy() without holding + slab_mutex/cpu_hotplug_lock + - platform/mellanox: mlxreg-lc: Fix coverity warning + - platform/mellanox: mlxreg-lc: Fix locking issue + - serial: fsl_lpuart: RS485 RTS polariy is inverse + - tty: serial: atmel: Preserve previous USART mode if RS485 disabled + - staging: rtl8712: fix use after free bugs + - staging: r8188eu: Add Rosewill USB-N150 Nano to device tables + - staging: r8188eu: add firmware dependency + - Revert "powerpc: Remove unused FW_FEATURE_NATIVE references" + - powerpc: align syscall table for ppc32 + - powerpc/rtas: Fix RTAS MSR[HV] handling for Cell + - vt: Clear selection before changing the font + - musb: fix USB_MUSB_TUSB6010 dependency + - tty: serial: lpuart: disable flow control while waiting for the transmit + engine to complete + - Input: iforce - wake up after clearing IFORCE_XMIT_RUNNING flag + - iio: light: cm3605: Fix an error handling path in cm3605_probe() + - iio: ad7292: Prevent regulator double disable + - iio: adc: mcp3911: correct "microchip,device-addr" property + - iio: adc: mcp3911: use correct formula for AD conversion + - misc: fastrpc: fix memory corruption on probe + - misc: fastrpc: fix memory corruption on open + - firmware_loader: Fix use-after-free during unregister + - firmware_loader: Fix memory leak in firmware upload + - USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id + - landlock: Fix file reparenting without explicit LANDLOCK_ACCESS_FS_REFER + - mmc: core: Fix UHS-I SD 1.8V workaround branch + - mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure + - binder: fix UAF of ref->proc caused by race condition + - binder: fix alloc->vma_vm_mm null-ptr dereference + - cifs: fix small mempool leak in SMB2_negotiate() + - KVM: VMX: Heed the 'msr' argument in msr_write_intercepted() + - riscv: kvm: move extern sbi_ext declarations to a header + - clk: ti: Fix missing of_node_get() ti_find_clock_provider() + - drm/i915/reg: Fix spelling mistake "Unsupport" -> "Unsupported" + - clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops + - Revert "clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops" + - clk: core: Fix runtime PM sequence in clk_core_unprepare() + - Input: rk805-pwrkey - fix module autoloading + - powerpc/papr_scm: Fix nvdimm event mappings + - clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate + - clk: bcm: rpi: Prevent out-of-bounds access + - clk: bcm: rpi: Add missing newline + - hwmon: (gpio-fan) Fix array out of bounds access + - gpio: pca953x: Add mutex_lock for regcache sync in PM + - gpio: realtek-otto: switch to 32-bit I/O + - KVM: x86: Mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES + - powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register() + - xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() + - mm: pagewalk: Fix race between unmap and page walker + - xen-blkback: Advertise feature-persistent as user requested + - xen-blkfront: Advertise feature-persistent as user requested + - xen-blkfront: Cache feature_persistent value before advertisement + - thunderbolt: Use the actual buffer in tb_async_error() + - thunderbolt: Check router generation before connecting xHCI + - usb: dwc3: pci: Add support for Intel Raptor Lake + - media: mceusb: Use new usb_control_msg_*() routines + - xhci: Add grace period after xHC start to prevent premature runtime suspend. + - usb: dwc3: disable USB core PHY management + - usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop + - usb: dwc3: fix PHY disable sequence + - USB: serial: ch341: fix lost character on LCR updates + - USB: serial: ch341: fix disabled rx timer on older devices + - USB: serial: cp210x: add Decagon UCA device id + - USB: serial: option: add support for OPPO R11 diag port + - USB: serial: option: add Quectel EM060K modem + - USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode + - Revert "usb: typec: ucsi: add a common function + ucsi_unregister_connectors()" + - usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles + - usb: typec: intel_pmc_mux: Add new ACPI ID for Meteor Lake IOM device + - usb: typec: tcpm: Return ENOTSUPP for power supply prop writes + - usb: dwc2: fix wrong order of phy_power_on and phy_init + - usb: cdns3: fix issue with rearming ISO OUT endpoint + - usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer + - USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) + - usb-storage: Add ignore-residue quirk for NXP PN7462AU + - s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages + - s390: fix nospec table alignments + - USB: core: Prevent nested device-reset calls + - usb: xhci-mtk: relax TT periodic bandwidth allocation + - usb: xhci-mtk: fix bandwidth release issue + - usb: gadget: f_uac2: fix superspeed transfer + - usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS + - USB: gadget: Fix obscure lockdep violation for udc_mutex + - dma-buf/dma-resv: check if the new fence is really later + - arm64/kexec: Fix missing extra range for crashkres_low. + - driver core: Don't probe devices after bus_type.match() probe deferral + - wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected + - wifi: mac80211: Fix UAF in ieee80211_scan_rx() + - ip: fix triggering of 'icmp redirect' + - net: Use u64_stats_fetch_begin_irq() for stats fetch. + - net: mac802154: Fix a condition in the receive path + - ALSA: memalloc: Revive x86-specific WC page allocations again + - ALSA: hda/realtek: Add speaker AMP init for Samsung laptops with ALC298 + - ALSA: seq: oss: Fix data-race for max_midi_devs access + - ALSA: seq: Fix data-race at module auto-loading + - drm/i915/backlight: Disable pps power hook for aux based backlight + - drm/i915/guc: clear stalled request after a reset + - drm/i915/glk: ECS Liva Q2 needs GLK HDMI port timing quirk + - drm/i915: Skip wm/ddb readout for disabled pipes + - tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf() + - tty: n_gsm: initialize more members at gsm_alloc_mux() + - tty: n_gsm: replace kicktimer with delayed_work + - tty: n_gsm: avoid call of sleeping functions from atomic context + - Linux 5.19.8 + * md: Replace snprintf with scnprintf (LP: #1993315) + - md: Replace snprintf with scnprintf + * ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems (LP: #1990985) + - ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems + * iavf: SR-IOV VFs error with no traffic flow when MTU greater than 1500 + (LP: #1983656) + - iavf: Fix set max MTU size with port VLAN and jumbo frames + - i40e: Fix VF set max MTU size + * Fix resume on AMD platforms when TBT monitor is plugged (LP: #1990920) + - drm/amd/display: Detect dpcd_rev when hotplug mst monitor + - drm/amd/display: Release remote dc_sink under mst scenario + * [SRU][J/OEM-5.17][PATCH 0/1] Fix oled brightness set above frame-average + luminance (LP: #1978986) + - drm: New function to get luminance range based on static hdr metadata + - drm/amdgpu_dm: Rely on split out luminance calculation function + - drm/i915: Use luminance range calculated during edid parsing + * Update Broadcom Emulex FC HBA lpfc driver to 14.2.0.5 for Ubuntu 22.04 + (LP: #1988711) + - scsi: lpfc: Fix uninitialized cqe field in lpfc_nvme_cancel_iocb() + - scsi: lpfc: Set PU field when providing D_ID in XMIT_ELS_RSP64_CX iocb + - scsi: lpfc: Fix lost NVMe paths during LIF bounce stress test + - scsi: lpfc: Refactor lpfc_nvmet_prep_abort_wqe() into + lpfc_sli_prep_abort_xri() + - scsi: lpfc: Update lpfc version to 14.2.0.5 + - scsi: lpfc: Copyright updates for 14.2.0.5 patches + * input/keyboard: the keyboard on some Asus laptops can't work (LP: #1992266) + - ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA + - ACPI: resource: Add ASUS model S5402ZA to quirks + * pcieport 0000:00:1b.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), + type=Transaction Layer, (Requester ID) (LP: #1988797) + - PCI/PTM: Cache PTM Capability offset + - PCI/PTM: Add pci_upstream_ptm() helper + - PCI/PTM: Separate configuration and enable + - PCI/PTM: Add pci_suspend_ptm() and pci_resume_ptm() + - PCI/PTM: Move pci_ptm_info() body into its only caller + - PCI/PTM: Preserve RsvdP bits in PTM Control register + - PCI/PTM: Reorder functions in logical order + - PCI/PTM: Consolidate PTM interface declarations + - PCI/PM: Always disable PTM for all devices during suspend + - PCI/PM: Simplify pci_pm_suspend_noirq() [ Ubuntu: 5.19.0-26.27 ] @@ -29,7 +1718,7 @@ - NFSD: Remove "inline" directives on op_rsize_bop helpers - NFSD: Cap rsize_bop result based on send buffer size - -- Thadeu Lima de Souza Cascardo Thu, 24 Nov 2022 05:53:27 -0300 + -- Tim Gardner Mon, 28 Nov 2022 09:35:39 -0700 linux-aws (5.19.0-1011.12) kinetic; urgency=medium diff -Nru linux-aws-5.19.0/debian.aws/config/amd64/config.common.amd64 linux-aws-5.19.0/debian.aws/config/amd64/config.common.amd64 --- linux-aws-5.19.0/debian.aws/config/amd64/config.common.amd64 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.aws/config/amd64/config.common.amd64 2022-11-29 07:06:46.000000000 +0000 @@ -26,6 +26,7 @@ # CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set # CONFIG_KEYBOARD_CYPRESS_SF is not set CONFIG_KVM=m +CONFIG_MDIO_BITBANG=m CONFIG_MII=m CONFIG_MMC_BLOCK=m # CONFIG_MMC_HSQ is not set diff -Nru linux-aws-5.19.0/debian.aws/config/arm64/config.common.arm64 linux-aws-5.19.0/debian.aws/config/arm64/config.common.arm64 --- linux-aws-5.19.0/debian.aws/config/arm64/config.common.arm64 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.aws/config/arm64/config.common.arm64 2022-11-29 07:06:46.000000000 +0000 @@ -26,6 +26,7 @@ CONFIG_IOMMU_DEFAULT_DMA_STRICT=y CONFIG_KEYBOARD_CYPRESS_SF=m CONFIG_KVM=y +CONFIG_MDIO_BITBANG=y CONFIG_MII=y CONFIG_MMC_BLOCK=y CONFIG_MMC_HSQ=m diff -Nru linux-aws-5.19.0/debian.aws/config/config.common.ubuntu linux-aws-5.19.0/debian.aws/config/config.common.ubuntu --- linux-aws-5.19.0/debian.aws/config/config.common.ubuntu 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.aws/config/config.common.ubuntu 2022-11-29 07:06:46.000000000 +0000 @@ -563,7 +563,6 @@ CONFIG_ARM64_AMU_EXTN=y CONFIG_ARM64_AS_HAS_MTE=y CONFIG_ARM64_BTI=y -CONFIG_ARM64_BTI_KERNEL=y CONFIG_ARM64_CNP=y CONFIG_ARM64_CONT_PMD_SHIFT=4 CONFIG_ARM64_CONT_PTE_SHIFT=4 @@ -585,7 +584,9 @@ CONFIG_ARM64_ERRATUM_2054223=y CONFIG_ARM64_ERRATUM_2067961=y CONFIG_ARM64_ERRATUM_2077057=y +CONFIG_ARM64_ERRATUM_2441007=y CONFIG_ARM64_ERRATUM_2441009=y +CONFIG_ARM64_ERRATUM_2457168=y CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_826319=y @@ -738,6 +739,7 @@ CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y CONFIG_AS_HAS_LDAPR=y CONFIG_AS_HAS_LSE_ATOMICS=y +CONFIG_AS_HAS_NON_CONST_LEB128=y CONFIG_AS_HAS_PAC=y CONFIG_AS_HAS_SHA3=y CONFIG_AS_IS_GNU=y @@ -1331,6 +1333,7 @@ CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y CONFIG_CC_HAS_BRANCH_PROT_PAC_RET=y CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI=y CONFIG_CC_HAS_IBT=y @@ -5109,7 +5112,6 @@ CONFIG_IWLEGACY=m # CONFIG_IWLEGACY_DEBUG is not set CONFIG_IWLEGACY_DEBUGFS=y -# CONFIG_IWLMEI is not set CONFIG_IWLMVM=m CONFIG_IWLWIFI=m # CONFIG_IWLWIFI_DEBUG is not set @@ -5635,7 +5637,6 @@ CONFIG_MDIO=m # CONFIG_MDIO_BCM_IPROC is not set CONFIG_MDIO_BCM_UNIMAC=m -CONFIG_MDIO_BITBANG=m CONFIG_MDIO_BUS=y CONFIG_MDIO_BUS_MUX=y CONFIG_MDIO_BUS_MUX_BCM_IPROC=y diff -Nru linux-aws-5.19.0/debian.aws/tracking-bug linux-aws-5.19.0/debian.aws/tracking-bug --- linux-aws-5.19.0/debian.aws/tracking-bug 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.aws/tracking-bug 2022-11-29 07:06:46.000000000 +0000 @@ -1 +1 @@ -1997421 2022.10.10-6 +1997781 2022.11.14-3 diff -Nru linux-aws-5.19.0/debian.master/abi/abiname linux-aws-5.19.0/debian.master/abi/abiname --- linux-aws-5.19.0/debian.master/abi/abiname 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/abi/abiname 2022-11-29 07:06:46.000000000 +0000 @@ -1 +1 @@ -23 +26 diff -Nru linux-aws-5.19.0/debian.master/abi/version linux-aws-5.19.0/debian.master/abi/version --- linux-aws-5.19.0/debian.master/abi/version 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/abi/version 2022-11-29 07:06:46.000000000 +0000 @@ -1 +1 @@ -5.19.0-23.24 +5.19.0-26.27 diff -Nru linux-aws-5.19.0/debian.master/changelog linux-aws-5.19.0/debian.master/changelog --- linux-aws-5.19.0/debian.master/changelog 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/changelog 2022-11-29 07:06:46.000000000 +0000 @@ -1,3 +1,1719 @@ +linux (5.19.0-27.28) kinetic; urgency=medium + + * kinetic/linux: 5.19.0-27.28 -proposed tracker (LP: #1997794) + + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/2022.11.14) + + * selftests/.../nat6to4 breaks the selftests build (LP: #1996536) + - [Config] Disable selftests/net/bpf/nat6to4 + + * Expose built-in trusted and revoked certificates (LP: #1996892) + - [Packaging] Expose built-in trusted and revoked certificates + + * support for same series backports versioning numbers (LP: #1993563) + - [Packaging] sameport -- add support for sameport versioning + + * Add cs35l41 firmware loading support (LP: #1995957) + - ASoC: cs35l41: Move cs35l41 exit hibernate function into shared code + - ASoC: cs35l41: Add common cs35l41 enter hibernate function + - ASoC: cs35l41: Do not print error when waking from hibernation + - ALSA: hda: cs35l41: Don't dereference fwnode handle + - ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations + - ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() + - ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 + - ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls + - ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly + - ALSA: hda: cs35l41: Save codec object inside component struct + - ALSA: hda: cs35l41: Add initial DSP support and firmware loading + - ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver + - ALSA: hda: cs35l41: Support reading subsystem id from ACPI + - ALSA: hda: cs35l41: Support multiple load paths for firmware + - ALSA: hda: cs35l41: Support Speaker ID for laptops + - ALSA: hda: cs35l41: Support Hibernation during Suspend + - ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables + - ALSA: hda: hda_cs_dsp_ctl: Add fw id strings + - ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence + - ALSA: hda: cs35l41: Support Firmware switching and reloading + - ALSA: hda: cs35l41: Add module parameter to control firmware load + - Revert "ALSA: hda: cs35l41: Allow compilation test on non-ACPI + configurations" + - ALSA: hda/realtek: More robust component matching for CS35L41 + - [Config] updateconfigs for SND_HDA_CS_DSP_CONTROLS + + * Fibocom WWAN FM350-GL suspend error (notebook not suspend) (LP: #1990700) + - net: wwan: t7xx: Add AP CLDMA + + * Screen cannot turn on after screen off with Matrox G200eW3 [102b:0536] + (LP: #1995573) + - drm/mgag200: Optimize damage clips + - drm/mgag200: Add FB_DAMAGE_CLIPS support + - drm/mgag200: Enable atomic gamma lut update + + * TEE Support for CCP driver (LP: #1991608) + - crypto: ccp: Add support for TEE for PCI ID 0x14CA + + * AMD Cezanne takes 5 minutes to wake up from suspend (LP: #1993715) + - platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems + + * Fix ath11k deadlock on WCN6855 (LP: #1995041) + - wifi: ath11k: avoid deadlock during regulatory update in + ath11k_regd_update() + + * intel_pmc_core not load on Raptor Lake (LP: #1988461) + - x86/cpu: Add new Raptor Lake CPU model number + - platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver + + * [UBUNTU 20.04] boot: Add s390x secure boot trailer (LP: #1996071) + - s390/boot: add secure boot trailer + + * Fix rfkill causing soft blocked wifi (LP: #1996198) + - platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi + + * Support Icicle Kit reference design v2022.10 (LP: #1993148) + - riscv: dts: microchip: icicle: re-jig fabric peripheral addresses + - riscv: dts: microchip: reduce the fic3 clock rate + - riscv: dts: microchip: update memory configuration for v2022.10 + - riscv: dts: microchip: fix fabric i2c reg size + - SAUCE: riscv: dts: microchip: Disable PCIe on the Icicle Kit + + * Fix Turbostat is not working for fam: 6 model: 191: stepping: 2 CPU + (LP: #1991365) + - tools/power turbostat: Add support for RPL-S + + * armhf kernel compiled with gcc-12 fails to boot on pi 3/2 (LP: #1993120) + - [Packaging] Support arch-specific compilers in updateconfigs + + * Kinetic update: v5.19.17 upstream stable release (LP: #1994179) + - Revert "fs: check FMODE_LSEEK to control internal pipe splicing" + - ALSA: oss: Fix potential deadlock at unregistration + - ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() + - ALSA: usb-audio: Fix potential memory leaks + - ALSA: usb-audio: Fix NULL dererence at error path + - ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 + - ALSA: hda/realtek: Correct pin configs for ASUS G533Z + - ALSA: hda/realtek: Add quirk for ASUS GV601R laptop + - ALSA: hda/realtek: Add Intel Reference SSID to support headset keys + - mtd: rawnand: atmel: Unmap streaming DMA mappings + - io_uring/rw: fix unexpected link breakage + - io_uring/net: fix fast_iov assignment in io_setup_async_msg() + - io_uring/net: don't update msg_name if not provided + - io_uring: correct pinned_vm accounting + - hv_netvsc: Fix race between VF offering and VF association message from host + - cifs: destage dirty pages before re-reading them for cache=none + - cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message + - iio: dac: ad5593r: Fix i2c read protocol requirements + - iio: ltc2497: Fix reading conversion results + - iio: adc: ad7923: fix channel readings for some variants + - iio: pressure: dps310: Refactor startup procedure + - iio: pressure: dps310: Reset chip after timeout + - xhci: dbc: Fix memory leak in xhci_alloc_dbc() + - usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video() + - usb: add quirks for Lenovo OneLink+ Dock + - mmc: core: Add SD card quirk for broken discard + - can: kvaser_usb: Fix use of uninitialized completion + - can: kvaser_usb_leaf: Fix overread with an invalid command + - can: kvaser_usb_leaf: Fix TX queue out of sync after restart + - can: kvaser_usb_leaf: Fix CAN state after restart + - mmc: renesas_sdhi: Fix rounding errors + - mmc: sdhci-tegra: Use actual clock rate for SW tuning correction + - mmc: sdhci-sprd: Fix minimum clock limit + - i2c: designware: Fix handling of real but unexpected device interrupts + - fs: dlm: fix race between test_bit() and queue_work() + - fs: dlm: handle -EBUSY first in lock arg validation + - fs: dlm: fix invalid derefence of sb_lvbptr + - btf: Export bpf_dynptr definition + - HID: multitouch: Add memory barriers + - quota: Check next/prev free block number after reading from quota file + - platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure + - arm64: dts: qcom: sdm845-mtp: correct ADC settle time + - ASoC: wcd9335: fix order of Slimbus unprepare/disable + - ASoC: wcd934x: fix order of Slimbus unprepare/disable + - hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API + - net: thunderbolt: Enable DMA paths only after rings are enabled + - regulator: qcom_rpm: Fix circular deferral regression + - arm64: topology: move store_cpu_topology() to shared code + - riscv: topology: fix default topology reporting + - RISC-V: Re-enable counter access from userspace + - RISC-V: Make port I/O string accessors actually work + - parisc: fbdev/stifb: Align graphics memory size to 4MB + - parisc: Fix userspace graphics card breakage due to pgtable special bit + - riscv: vdso: fix NULL deference in vdso_join_timens() when vfork + - riscv: Make VM_WRITE imply VM_READ + - riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb + - riscv: Pass -mno-relax only on lld < 15.0.0 + - UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK + - nvmem: core: Fix memleak in nvmem_register() + - nvme-multipath: fix possible hang in live ns resize with ANA access + - dmaengine: mxs: use platform_driver_register + - dmaengine: qcom-adm: fix wrong sizeof config in slave_config + - dmaengine: qcom-adm: fix wrong calling convention for prep_slave_sg + - drm/virtio: Check whether transferred 2D BO is shmem + - drm/virtio: Unlock reservations on virtio_gpu_object_shmem_init() error + - drm/virtio: Unlock reservations on dma_resv_reserve_fences() error + - drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb() + - drm/udl: Restore display mode on resume + - arm64: mte: move register initialization to C + - [Config] updateconfigs for ARM64_ERRATUM_2441007 + - arm64: errata: Add Cortex-A55 to the repeat tlbi list + - clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value + - mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page + - mm/damon: validate if the pmd entry is present before accessing + - mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in + - mm/mmap: undo ->mmap() when arch_validate_flags() fails + - xen/gntdev: Prevent leaking grants + - xen/gntdev: Accommodate VMA splitting + - PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge + - serial: cpm_uart: Don't request IRQ too early for console port + - serial: stm32: Deassert Transmit Enable on ->rs485_config() + - serial: 8250: Let drivers request full 16550A feature probing + - serial: 8250: Request full 16550A feature probing for OxSemi PCIe devices + - cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning + - powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain + - powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE + - powerpc/boot: Explicitly disable usage of SPE instructions + - slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure + - slimbus: qcom-ngd: cleanup in probe error path + - scsi: lpfc: Rework MIB Rx Monitor debug info logic + - scsi: qedf: Populate sysfs attributes for vport + - gpio: rockchip: request GPIO mux to pinctrl when setting direction + - pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback + - fbdev: smscufx: Fix use-after-free in ufx_ops_open() + - hwrng: core - let sleep be interrupted when unregistering hwrng + - smb3: do not log confusing message when server returns no network interfaces + - ksmbd: fix incorrect handling of iterate_dir + - ksmbd: fix endless loop when encryption for response fails + - ksmbd: Fix wrong return value and message length check in smb2_ioctl() + - ksmbd: Fix user namespace mapping + - fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE + - btrfs: fix alignment of VMA for memory mapped files on THP + - btrfs: enhance unsupported compat RO flags handling + - btrfs: fix race between quota enable and quota rescan ioctl + - btrfs: fix missed extent on fsync after dropping extent maps + - btrfs: set generation before calling btrfs_clean_tree_block in + btrfs_init_new_buffer + - f2fs: fix wrong continue condition in GC + - f2fs: complete checkpoints during remount + - f2fs: flush pending checkpoints when freezing super + - f2fs: increase the limit for reserve_root + - f2fs: fix to do sanity check on destination blkaddr during recovery + - f2fs: fix to do sanity check on summary info + - jbd2: wake up journal waiters in FIFO order, not LIFO + - jbd2: fix potential buffer head reference count leak + - jbd2: fix potential use-after-free in jbd2_fc_wait_bufs + - jbd2: add miss release buffer head in fc_do_one_pass() + - ext2: Add sanity checks for group and filesystem size + - ext4: avoid crash when inline data creation follows DIO write + - ext4: fix null-ptr-deref in ext4_write_info + - ext4: make ext4_lazyinit_thread freezable + - ext4: fix check for block being out of directory size + - ext4: don't increase iversion counter for ea_inodes + - ext4: unconditionally enable the i_version counter + - ext4: ext4_read_bh_lock() should submit IO if the buffer isn't uptodate + - ext4: place buffer head allocation before handle start + - ext4: fix i_version handling in ext4 + - ext4: fix dir corruption when ext4_dx_add_entry() fails + - ext4: fix miss release buffer head in ext4_fc_write_inode + - ext4: fix potential memory leak in ext4_fc_record_modified_inode() + - ext4: fix potential memory leak in ext4_fc_record_regions() + - ext4: update 'state->fc_regions_size' after successful memory allocation + - livepatch: fix race between fork and KLP transition + - ftrace: Properly unset FTRACE_HASH_FL_MOD + - ftrace: Still disable enabled records marked as disabled + - ring-buffer: Allow splice to read previous partially read pages + - ring-buffer: Have the shortest_full queue be the shortest not longest + - ring-buffer: Check pending waiters when doing wake ups as well + - ring-buffer: Add ring_buffer_wake_waiters() + - ring-buffer: Fix race between reset page and reading page + - tracing: Disable interrupt or preemption before acquiring arch_spinlock_t + - tracing: Wake up ring buffer waiters on closing of the file + - tracing: Wake up waiters when tracing is disabled + - tracing: Add ioctl() to force ring buffer waiters to wake up + - tracing: Do not free snapshot if tracer is on cmdline + - tracing: Move duplicate code of trace_kprobe/eprobe.c into header + - tracing: Add "(fault)" name injection to kernel probes + - tracing: Fix reading strings from synthetic events + - rpmsg: char: Avoid double destroy of default endpoint + - thunderbolt: Explicitly enable lane adapter hotplug events at startup + - efi: libstub: drop pointless get_memory_map() call + - media: cedrus: Set the platform driver data earlier + - media: cedrus: Fix endless loop in cedrus_h265_skip_bits() + - blk-throttle: fix that io throttle can only work for single bio + - blk-wbt: call rq_qos_add() after wb_normal is initialized + - KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility + - KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" + - KVM: nVMX: Don't propagate vmcs12's PERF_GLOBAL_CTRL settings to vmcs02 + - KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS + - staging: greybus: audio_helper: remove unused and wrong debugfs usage + - drm/nouveau/kms/nv140-: Disable interlacing + - drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() + - drm/i915/gt: Use i915_vm_put on ppgtt_create error paths + - drm/i915: Fix watermark calculations for gen12+ RC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ MC CCS modifier + - drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier + - drm/i915: Fix watermark calculations for DG2 CCS modifiers + - drm/i915: Fix watermark calculations for DG2 CCS+CC modifier + - drm/amd/display: Fix vblank refcount in vrr transition + - drm/amd/display: explicitly disable psr_feature_enable appropriately + - smb3: must initialize two ACL struct fields to zero + - selinux: use "grep -E" instead of "egrep" + - ima: fix blocking of security.ima xattrs of unsupported algorithms + - userfaultfd: open userfaultfds with O_RDONLY + - ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers + - thermal: cpufreq_cooling: Check the policy first in + cpufreq_cooling_register() + - cpufreq: amd-pstate: Fix initial highest_perf value + - sh: machvec: Use char[] for section boundaries + - MIPS: SGI-IP30: Fix platform-device leak in bridge_platform_create() + - MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() + - erofs: fix order >= MAX_ORDER warning due to crafted negative i_size + - erofs: use kill_anon_super() to kill super in fscache mode + - ARM: 9243/1: riscpc: Unbreak the build + - ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() + - ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE + - ACPI: PCC: Release resources on address space setup failure path + - ACPI: PCC: replace wait_for_completion() + - ACPI: PCC: Fix Tx acknowledge in the PCC address space handler + - objtool: Preserve special st_shndx indexes in elf_update_symbol + - nfsd: Fix a memory leak in an error handling path + - NFSD: Fix handling of oversized NFSv4 COMPOUND requests + - x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled + - wifi: rtlwifi: 8192de: correct checking of IQK reload + - wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() + - bpf: Fix non-static bpf_func_proto struct definitions + - bpf: convert cgroup_bpf.progs to hlist + - bpf: Cleanup check_refcount_ok + - leds: lm3601x: Don't use mutex after it was destroyed + - tsnep: Fix TSNEP_INFO_TX_TIME register define + - bpf: Fix reference state management for synchronous callbacks + - wifi: cfg80211: get correct AP link chandef + - wifi: mac80211: allow bw change during channel switch in mesh + - bpftool: Fix a wrong type cast in btf_dumper_int + - audit: explicitly check audit_context->context enum value + - audit: free audit_proctitle only on task exit + - esp: choose the correct inner protocol for GSO on inter address family + tunnels + - spi: mt7621: Fix an error message in mt7621_spi_probe() + - x86/resctrl: Fix to restore to original value when re-enabling hardware + prefetch register + - xsk: Fix backpressure mechanism on Tx + - selftests/xsk: Add missing close() on netns fd + - bpf: Disable preemption when increasing per-cpu map_locked + - bpf: Propagate error from htab_lock_bucket() to userspace + - wifi: ath11k: Fix incorrect QMI message ID mappings + - bpf: Use this_cpu_{inc|dec|inc_return} for bpf_task_storage_busy + - bpf: Use this_cpu_{inc_return|dec} for prog->active + - Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend + - wifi: rtw89: pci: fix interrupt stuck after leaving low power mode + - wifi: rtw89: pci: correct TX resource checking in low power mode + - wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() + - wifi: wfx: prevent underflow in wfx_send_pds() + - wifi: rtw88: add missing destroy_workqueue() on error path in + rtw_core_init() + - selftests/xsk: Avoid use-after-free on ctx + - spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() + - spi: qup: add missing clk_disable_unprepare on error in + spi_qup_pm_resume_runtime() + - wifi: rtl8xxxu: Fix skb misuse in TX queue selection + - spi: meson-spicc: do not rely on busy flag in pow2 clk ops + - bpf: btf: fix truncated last_member_type_id in btf_struct_resolve + - wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration + - wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask + - wifi: mt76: mt7921e: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921s: fix race issue between reset and suspend/resume + - wifi: mt76: mt7921u: fix race issue between reset and suspend/resume + - wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work + - wifi: mt76: sdio: poll sta stat when device transmits data + - wifi: mt76: sdio: fix transmitting packet hangs + - wifi: mt76: mt7615: add mt7615_mutex_acquire/release in + mt7615_sta_set_decap_offload + - wifi: mt76: mt7915: fix possible unaligned access in + mt7915_mac_add_twt_setup + - wifi: mt76: connac: fix possible unaligned access in + mt76_connac_mcu_add_nested_tlv + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap + - wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload + - wifi: mt76: mt7915: fix mcs value in ht mode + - wifi: mt76: mt7915: do not check state before configuring implicit beamform + - wifi: mt76: mt7921e: fix rmmod crash in driver reload test + - Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release + - net: fs_enet: Fix wrong check in do_pd_setup + - bpf: Ensure correct locking around vulnerable function find_vpid() + - wifi: ath11k: Include STA_KEEPALIVE_ARP_RESPONSE TLV header by default + - Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure + - netfilter: conntrack: fix the gc rescheduling delay + - netfilter: conntrack: revisit the gc initial rescheduling bias + - flow_dissector: Do not count vlan tags inside tunnel payload + - wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected + - wifi: ath11k: fix number of VHT beamformee spatial streams + - mips: dts: ralink: mt7621: fix external phy on GB-PC2 + - x86/microcode/AMD: Track patch allocation size explicitly + - wifi: ath11k: fix peer addition/deletion error on sta band migration + - x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype + - spi: cadence-quadspi: Fix PM disable depth imbalance in cqspi_probe + - spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe + - spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe + - skmsg: Schedule psock work if the cached skb exists on the psock + - cw1200: fix incorrect check to determine if no element is found in list + - i2c: mlxbf: support lock mechanism + - Bluetooth: hci_core: Fix not handling link timeouts propertly + - xfrm: Reinject transport-mode packets through workqueue + - netfilter: nft_fib: Fix for rpath check with VRF devices + - spi: s3c64xx: Fix large transfers with DMA + - wifi: rtl8xxxu: gen2: Enable 40 MHz channel width + - wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM + - vhost/vsock: Use kvmalloc/kvfree for larger packets. + - eth: alx: take rtnl_lock on resume + - sctp: handle the error returned from sctp_auth_asoc_init_active_key + - tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited + - spi: Ensure that sg_table won't be used after being freed + - Bluetooth: hci_sync: Fix not indicating power state + - hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 + controller + - net: rds: don't hold sock lock when cancelling work from + rds_tcp_reset_callbacks() + - af_unix: Fix memory leaks of the whole sk due to OOB skb. + - net: prestera: acl: Add check for kmemdup + - eth: lan743x: reject extts for non-pci11x1x devices + - bnx2x: fix potential memory leak in bnx2x_tpa_stop() + - eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address + - net: wwan: iosm: Call mutex_init before locking it + - net/ieee802154: reject zero-sized raw_sendmsg() + - once: add DO_ONCE_SLOW() for sleepable contexts + - net: mvpp2: fix mvpp2 debugfs leak + - drm: bridge: adv7511: fix CEC power down control register offset + - drm: bridge: adv7511: unregister cec i2c device after cec adapter + - drm/bridge: Avoid uninitialized variable warning + - drm/mipi-dsi: Detach devices when removing the host + - drm/bridge: it6505: Power on downstream device in .atomic_enable + - drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling + - drm/bridge: tc358767: Add of_node_put() when breaking out of loop + - drm/bridge: parade-ps8640: Fix regulator supply order + - drm/dp_mst: fix drm_dp_dpcd_read return value checks + - drm:pl111: Add of_node_put() when breaking out of + for_each_available_child_of_node() + - ASoC: mt6359: fix tests for platform_get_irq() failure + - drm/msm: Make .remove and .shutdown HW shutdown consistent + - platform/chrome: fix double-free in chromeos_laptop_prepare() + - platform/chrome: fix memory corruption in ioctl + - drm/virtio: Fix same-context optimization + - ASoC: soc-pcm.c: call __soc_pcm_close() in soc_pcm_close() + - ASoC: tas2764: Allow mono streams + - ASoC: tas2764: Drop conflicting set_bias_level power setting + - ASoC: tas2764: Fix mute/unmute + - platform/x86: msi-laptop: Fix old-ec check for backlight registering + - platform/x86: msi-laptop: Fix resource cleanup + - platform/chrome: cros_ec_typec: Correct alt mode index + - drm/amdgpu: add missing pci_disable_device() in + amdgpu_pmops_runtime_resume() + - drm/bridge: megachips: Fix a null pointer dereference bug + - drm/bridge: it6505: Fix the order of DP_SET_POWER commands + - ASoC: rsnd: Add check for rsnd_mod_power_on + - ASoC: wm_adsp: Handle optional legacy support + - ALSA: hda: beep: Simplify keep-power-at-enable behavior + - drm/virtio: set fb_modifiers_not_supported + - drm/bochs: fix blanking + - ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON + - drm/omap: dss: Fix refcount leak bugs + - drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue() + - mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() + - ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API + - drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices + - drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx + - drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() + - ALSA: usb-audio: Properly refcounting clock rate + - drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() + - virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() + - ASoC: codecs: tx-macro: fix kcontrol put + - ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() + - ALSA: dmaengine: increment buffer pointer atomically + - mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() + - ASoC: stm32: dfsdm: Fix PM disable depth imbalance in stm32_adfsdm_probe + - ASoC: stm32: spdifrx: Fix PM disable depth imbalance in stm32_spdifrx_probe + - ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe + - ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe + - ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe + - ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe + - ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe + - ALSA: hda/hdmi: Don't skip notification handling during PM operation + - memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() + - memory: of: Fix refcount leak bug in of_get_ddr_timings() + - memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() + - locks: fix TOCTOU race when granting write lease + - soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() + - soc: qcom: smem_state: Add refcounting for the 'state->of_node' + - ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus + - arm64: dts: renesas: r9a07g044: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types + - arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types + - dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1 + - ARM: dts: turris-omnia: Fix mpp26 pin name and comment + - ARM: dts: kirkwood: lsxl: fix serial line + - ARM: dts: kirkwood: lsxl: remove first ethernet port + - ia64: export memory_add_physaddr_to_nid to fix cxl build error + - soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA + - arm64: dts: ti: k3-j7200: fix main pinmux range + - ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family + - ARM: Drop CMDLINE_* dependency on ATAGS + - ext4: don't run ext4lazyinit for read-only filesystems + - arm64: ftrace: fix module PLTs with mcount + - ARM: dts: exynos: fix polarity of VBUS GPIO of Origen + - iomap: iomap: fix memory corruption when recording errors during writeback + - iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX + - iio: adc: at91-sama5d2_adc: check return status for pressure and touch + - iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq + - iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume + - iio: inkern: only release the device node when done with it + - iio: inkern: fix return value in devm_of_iio_channel_get_by_name() + - iio: ABI: Fix wrong format of differential capacitance channel ABI. + - iio: magnetometer: yas530: Change data type of hard_offsets to signed + - RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey + - usb: common: debug: Check non-standard control requests + - clk: meson: Hold reference returned by of_get_parent() + - clk: st: Hold reference returned by of_get_parent() + - clk: oxnas: Hold reference returned by of_get_parent() + - clk: qoriq: Hold reference returned by of_get_parent() + - clk: berlin: Add of_node_put() for of_get_parent() + - clk: sprd: Hold reference returned by of_get_parent() + - clk: tegra: Fix refcount leak in tegra210_clock_init + - clk: tegra: Fix refcount leak in tegra114_clock_init + - clk: tegra20: Fix refcount leak in tegra20_clock_init + - clk: samsung: exynosautov9: correct register offsets of peric0/c1 + - HSI: omap_ssi: Fix refcount leak in ssi_probe + - HSI: omap_ssi_port: Fix dma_map_sg error check + - clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock + - media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop + - tty: xilinx_uartps: Fix the ignore_status + - media: amphion: insert picture startcode after seek for vc1g format + - media: amphion: adjust the encoder's value range of gop size + - media: amphion: don't change the colorspace reported by decoder. + - media: amphion: fix a bug that vpu core may not resume after suspend + - media: meson: vdec: add missing clk_disable_unprepare on error in + vdec_hevc_start() + - media: uvcvideo: Fix memory leak in uvc_gpio_parse + - media: uvcvideo: Use entity get_cur in uvc_ctrl_set + - media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init + - RDMA/rxe: Fix "kernel NULL pointer dereference" error + - RDMA/rxe: Fix the error caused by qp->sk + - clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intf's parent + - clk: mediatek: clk-mt8195-vdo1: Reparent and set rate on vdo1_dpintf's + parent + - clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical + - misc: ocxl: fix possible refcount leak in afu_ioctl() + - fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() + - phy: rockchip-inno-usb2: Return zero after otg sync + - dmaengine: idxd: avoid deadlock in process_misc_interrupts() + - dmaengine: hisilicon: Disable channels when unregister hisi_dma + - dmaengine: hisilicon: Fix CQ head update + - dmaengine: hisilicon: Add multi-thread support for a DMA channel + - usb: gadget: f_fs: stricter integer overflow checks + - dyndbg: fix static_branch manipulation + - dyndbg: fix module.dyndbg handling + - dyndbg: let query-modname override actual module name + - dyndbg: drop EXPORTed dynamic_debug_exec_queries + - clk: qcom: sm6115: Select QCOM_GDSC + - mtd: devices: docg3: check the return value of devm_ioremap() in the probe + - remoteproc: Harden rproc_handle_vdev() against integer overflow + - phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by + of_get_parent() + - phy: phy-mtk-tphy: fix the phy type setting issue + - mtd: rawnand: intel: Read the chip-select line from the correct OF node + - mtd: rawnand: intel: Remove undocumented compatible string + - mtd: rawnand: fsl_elbc: Fix none ECC mode + - RDMA/irdma: Align AE id codes to correct flush code and event + - RDMA/irdma: Validate udata inlen and outlen + - RDMA/srp: Fix srp_abort() + - RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. + - RDMA/siw: Fix QP destroy to wait for all references dropped. + - ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() + - ata: fix ata_id_has_devslp() + - ata: fix ata_id_has_ncq_autosense() + - ata: fix ata_id_has_dipm() + - mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() + - md/raid5: Ensure stripe_fill happens on non-read IO with journal + - md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() + - RDMA/cm: Use SLID in the work completion as the DLID in responder side + - IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers + - xhci: Don't show warning for reinit on known broken suspend + - usb: gadget: function: fix dangling pnp_string in f_printer.c + - usb: dwc3: core: fix some leaks in probe + - drivers: serial: jsm: fix some leaks in probe + - serial: 8250: Toggle IER bits on only after irq has been set up + - tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown + - phy: qualcomm: call clk_disable_unprepare in the error handling + - staging: vt6655: fix some erroneous memory clean-up loops + - slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON + - slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register + - firmware: google: Test spinlock on panic path to avoid lockups + - serial: 8250: Fix restoring termios speed after suspend + - scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() + - scsi: pm8001: Fix running_req for internal abort commands + - scsi: iscsi: Rename iscsi_conn_queue_work() + - scsi: iscsi: Add recv workqueue helpers + - scsi: iscsi: Run recv path from workqueue + - scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() + - clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical + - clk: qcom: gcc-sm6115: Override default Alpha PLL regs + - RDMA/rxe: Fix resize_finish() in rxe_queue.c + - fsi: core: Check error number after calling ida_simple_get + - mfd: intel_soc_pmic: Fix an error handling path in + intel_soc_pmic_i2c_probe() + - mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() + - mfd: lp8788: Fix an error handling path in lp8788_probe() + - mfd: lp8788: Fix an error handling path in lp8788_irq_init() and + lp8788_irq_init() + - mfd: fsl-imx25: Fix check for platform_get_irq() errors + - mfd: sm501: Add check for platform_driver_register() + - mfd: da9061: Fix Failed to set Two-Wire Bus Mode. + - clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent + - clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes + - clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup + - clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() + - dmaengine: ioat: stop mod_timer from resurrecting deleted timer in + __cleanup() + - usb: mtu3: fix failed runtime suspend in host only mode + - spmi: pmic-arb: correct duplicate APID to PPID mapping logic + - clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD + - clk: baikal-t1: Fix invalid xGMAC PTP clock divider + - clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent + - clk: baikal-t1: Add SATA internal ref clock buffer + - clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration + - clk: imx: scu: fix memleak on platform_device_add() fails + - clk: ti: Balance of_node_get() calls for of_find_node_by_name() + - clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe + - clk: ast2600: BCLK comes from EPLL + - mailbox: mpfs: fix handling of the reg property + - mailbox: mpfs: account for mbox offsets while sending + - mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg + - ipc: mqueue: fix possible memory leak in init_mqueue_fs() + - powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig + - powerpc/math_emu/efp: Include module.h + - powerpc/sysdev/fsl_msi: Add missing of_node_put() + - powerpc/pci_dn: Add missing of_node_put() + - powerpc/powernv: add missing of_node_put() in opal_export_attrs() + - cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage + - powerpc: Fix fallocate and fadvise64_64 compat parameter combination + - x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition + - powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 + - powerpc/64: mark irqs hard disabled in boot paca + - powerpc/64/interrupt: Fix return to masked context after hard-mask irq + becomes pending + - powerpc: Fix SPE Power ISA properties for e500v1 platforms + - powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe() + - powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL + - crypto: sahara - don't sleep when in softirq + - crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr + - hwrng: arm-smccc-trng - fix NO_ENTROPY handling + - crypto: ccp - Fail the PSP initialization when writing psp data file failed + - cgroup: Honor caller's cgroup NS when resolving path + - hwrng: imx-rngc - Moving IRQ handler registering after + imx_rngc_irq_mask_clear() + - crypto: qat - fix default value of WDT timer + - crypto: hisilicon/qm - fix missing put dfx access + - cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset + - iommu/omap: Fix buffer overflow in debugfs + - crypto: akcipher - default implementation for setting a private key + - crypto: ccp - Release dma channels before dmaengine unrgister + - crypto: inside-secure - Change swab to swab32 + - crypto: qat - fix DMA transfer direction + - clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921 + - clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe + - cifs: return correct error in ->calc_signature() + - iommu/iova: Fix module config properly + - tracing: kprobe: Fix kprobe event gen test module on exit + - tracing: kprobe: Make gen test module work in arm and riscv + - tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads + - kbuild: remove the target in signal traps when interrupted + - linux/export: use inline assembler to populate symbol CRCs + - kbuild: rpm-pkg: fix breakage when V=1 is used + - crypto: marvell/octeontx - prevent integer overflows + - crypto: cavium - prevent integer overflow loading firmware + - random: schedule jitter credit for next jiffy, not in two jiffies + - thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id + - ACPI: APEI: do not add task_work to kernel thread to avoid memory leak + - f2fs: fix race condition on setting FI_NO_EXTENT flag + - f2fs: fix to account FS_CP_DATA_IO correctly + - selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle + - module: tracking: Keep a record of tainted unloaded modules only + - fs: dlm: fix race in lowcomms + - rcu: Avoid triggering strict-GP irq-work when RCU is idle + - rcu: Back off upon fill_page_cache_func() allocation failure + - cpufreq: amd_pstate: fix wrong lowest perf fetch + - ACPI: video: Add Toshiba Satellite/Portege Z830 quirk + - fortify: Fix __compiletime_strlen() under UBSAN_BOUNDS_LOCAL + - ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address + - cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode + - MIPS: BCM47XX: Cast memcmp() of function to (void *) + - powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue + - thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to + avoid crash + - ARM: decompressor: Include .data.rel.ro.local + - ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable + - x86/entry: Work around Clang __bdos() bug + - NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data + - NFSD: fix use-after-free on source server when doing inter-server copy + - wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices + - wifi: brcmfmac: fix invalid address access when enabling SCAN log level + - bpftool: Clear errno after libcap's checks + - ice: set tx_tstamps when creating new Tx rings via ethtool + - net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 + - openvswitch: Fix double reporting of drops in dropwatch + - openvswitch: Fix overreporting of drops in dropwatch + - tcp: annotate data-race around tcp_md5sig_pool_populated + - x86/mce: Retrieve poison range from hardware + - wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() + - thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround + - x86/apic: Don't disable x2APIC if locked + - net: axienet: Switch to 64-bit RX/TX statistics + - net-next: Fix IP_UNICAST_IF option behavior for connected sockets + - xfrm: Update ipcomp_scratches with NULL when freed + - wifi: ath11k: Register shutdown handler for WCN6750 + - rtw89: ser: leave lps with mutex + - iavf: Fix race between iavf_close and iavf_reset_task + - wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() + - Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk + - regulator: core: Prevent integer underflow + - wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register() + - wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value + - wifi: rtw89: free unused skb to prevent memory leak + - wifi: rtw89: fix rx filter after scan + - Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() + - Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times + - bnxt_en: replace reset with config timestamps + - selftests/bpf: Free the allocated resources after test case succeeds + - can: bcm: check the result of can_send() in bcm_can_tx() + - wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620 + - wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 + - wifi: rt2x00: set VGC gain for both chains of MT7620 + - wifi: rt2x00: set SoC wmac clock register + - wifi: rt2x00: correctly set BBP register 86 for MT7620 + - hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms + - net: If sock is dead don't access sock's sk_wq in sk_stream_wait_memory + - bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT + - bpf: use bpf_prog_pack for bpf_dispatcher + - Bluetooth: L2CAP: Fix user-after-free + - i2c: designware-pci: Group AMD NAVI quirk parts together + - drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() + - drm: Use size_t type for len variable in drm_copy_field() + - drm: Prevent drm_copy_field() to attempt copying a NULL pointer + - drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook + - gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() + - drm/amd/display: fix overflow on MIN_I64 definition + - udmabuf: Set ubuf->sg = NULL if the creation of sg table fails + - platform/x86: pmc_atom: Improve quirk message to be less cryptic + - drm: bridge: dw_hdmi: only trigger hotplug event on link change + - drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 + - drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF + - ALSA: usb-audio: Register card at the last interface + - drm/vc4: vec: Fix timings for VEC modes + - drm: panel-orientation-quirks: Add quirk for Anbernic Win600 + - drm: panel-orientation-quirks: Add quirk for Aya Neo Air + - platform/chrome: cros_ec: Notify the PM of wake events during resume + - platform/x86: hp-wmi: Setting thermal profile fails with 0x06 + - platform/x86: msi-laptop: Change DMI match / alias strings to fix module + autoloading + - ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS + - ASoC: SOF: pci: Change DMI match info to support all Chrome platforms + - ASoC: SOF: add quirk to override topology mclk_id + - drm/amdgpu: SDMA update use unlocked iterator + - drm/amd/display: correct hostvm flag + - drm/amdgpu: fix initial connector audio value + - drm/meson: reorder driver deinit sequence to fix use-after-free bug + - drm/meson: explicitly remove aggregate driver at module unload time + - drm/meson: remove drm bridges at aggregate driver unbind time + - drm/dp: Don't rewrite link config when setting phy test pattern + - drm/amd/display: Remove interface for periodic interrupt 1 + - drm/amd/display: polling vid stream status in hpo dp blank + - drm/amdkfd: Fix UBSAN shift-out-of-bounds warning + - ARM: dts: imx6: delete interrupts property if interrupts-extended is set + - ARM: dts: imx7d-sdb: config the max pressure for tsc2046 + - ARM: dts: imx6q: add missing properties for sram + - ARM: dts: imx6dl: add missing properties for sram + - ARM: dts: imx6qp: add missing properties for sram + - ARM: dts: imx6sl: add missing properties for sram + - ARM: dts: imx6sll: add missing properties for sram + - ARM: dts: imx6sx: add missing properties for sram + - ARM: dts: imx6sl: use tabs for code indent + - ARM: dts: imx6sx-udoo-neo: don't use multiple blank lines + - kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT + - arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO + voltage + - arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply + - btrfs: dump extra info if one free space cache has more bitmaps than it + should + - btrfs: scrub: properly report super block errors in system log + - btrfs: scrub: try to fix super block errors + - btrfs: don't print information about space cache or tree every remount + - btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure + - ARM: 9233/1: stacktrace: Skip frame pointer boundary check for + call_with_stack() + - ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value + - ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n + - clk: zynqmp: Fix stack-out-of-bounds in strncpy` + - media: cx88: Fix a null-ptr-deref bug in buffer_prepare() + - media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc + - clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate + - RDMA/rxe: Delete error messages triggered by incoming Read requests + - usb: host: xhci-plat: suspend and resume clocks + - usb: host: xhci-plat: suspend/resume clks for brcm + - scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID + - dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow + - scsi: 3w-9xxx: Avoid disabling device if failing to enable it + - nbd: Fix hung when signal interrupts nbd_start_device_ioctl() + - iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to + identity + - usb: gadget: uvc: increase worker prio to WQ_HIGHPRI + - power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() + - staging: vt6655: fix potential memory leak + - blk-throttle: prevent overflow while calculating wait time + - ata: libahci_platform: Sanity check the DT child nodes number + - bcache: fix set_at_max_writeback_rate() for multiple attached devices + - soundwire: cadence: Don't overwrite msg->buf during write commands + - soundwire: intel: fix error handling on dai registration issues + - HID: roccat: Fix use-after-free in roccat_read() + - HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() + - HID: nintendo: check analog user calibration for plausibility + - eventfd: guard wake_up in eventfd fs calls as well + - md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d + - usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() + - usb: musb: Fix musb_gadget.c rxstate overflow bug + - usb: dwc3: core: add gfladj_refclk_lpm_sel quirk + - arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes + - usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after + resume bug + - Revert "usb: storage: Add quirk for Samsung Fit flash" + - staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() + - staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() + - scsi: tracing: Fix compile error in trace_array calls when TRACING is + disabled + - ext2: Use kvmalloc() for group descriptor array + - nvme: handle effects after freeing the request + - nvme: copy firmware_rev on each init + - nvmet-tcp: add bounds check on Transfer Tag + - usb: idmouse: fix an uninit-value in idmouse_open + - blk-mq: use quiesced elevator switch when reinitializing queues + - hwmon (occ): Retry for checksum failure + - fsi: occ: Prevent use after free + - usb: typec: ucsi: Don't warn on probe deferral + - clk: bcm2835: Make peripheral PLLC critical + - clk: bcm2835: Round UART input clock up + - perf: Skip and warn on unknown format 'configN' attrs + - perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc + - perf intel-pt: Fix system_wide dummy event for hybrid + - mm: hugetlb: fix UAF in hugetlb_handle_userfault + - net: ieee802154: return -EINVAL for unknown addr type + - ALSA: usb-audio: Fix last interface check for registration + - blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() + - [Config] updateconfigs for MDIO_BITBANG + - net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses + - Revert "drm/amd/display: correct hostvm flag" + - Revert "net/ieee802154: reject zero-sized raw_sendmsg()" + - net/ieee802154: don't warn zero-sized raw_sendmsg() + - powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked + context + - drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n + - kbuild: Add skip_encoding_btf_enum64 option to pahole + - Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5 + - Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT + - [Config] updateconfigs for AS_HAS_NON_CONST_LEB128 + - lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 + - HID: uclogic: Add missing suffix for digitalizers + - ext4: continue to expand file system when the target size doesn't reach + - drm/i915: Rename block_size()/block_offset() + - drm/i915/bios: Validate fp_timing terminator presence + - drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers + - Linux 5.19.17 + + * Kinetic update: v5.19.16 upstream stable release (LP: #1994164) + - nilfs2: fix use-after-free bug of struct nilfs_root + - nilfs2: fix leak of nilfs_root in case of writer thread creation failure + - nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure + - ceph: don't truncate file in atomic_open + - nvme-pci: set min_align_mask before calculating max_hw_sectors + - random: restore O_NONBLOCK support + - random: clamp credited irq bits to maximum mixed + - ALSA: hda: Fix position reporting on Poulsbo + - ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model + - efi: Correct Macmini DMI match in uefi cert quirk + - USB: serial: qcserial: add new usb-id for Dell branded EM7455 + - Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -> + peripheral if extcon is present"" + - Revert "usb: dwc3: Don't switch OTG -> peripheral if extcon is present" + - Revert "powerpc/rtas: Implement reentrant rtas call" + - Revert "crypto: qat - reduce size of mapped region" + - random: avoid reading two cache lines on irq randomness + - random: use expired timer rather than wq for mixing fast pool + - mctp: prevent double key removal and unref + - Input: xpad - add supported devices as contributed on github + - Input: xpad - fix wireless 360 controller breaking after suspend + - misc: pci_endpoint_test: Aggregate params checking for xfer + - misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic + - Linux 5.19.16 + + * Kinetic update: v5.19.15 upstream stable release (LP: #1994078) + - sparc: Unbreak the build + - Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 + - [Config] updateconfigs for CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + - hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero + - docs: update mediator information in CoC docs + - xsk: Inherit need_wakeup flag for shared sockets + - firmware: arm_scmi: Improve checks in the info_get operations + - firmware: arm_scmi: Harden accesses to the sensor domains + - firmware: arm_scmi: Add SCMI PM driver remove routine + - arm64: dts: rockchip: fix upper usb port on BPI-R2-Pro + - dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling + - dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property + - dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API + failure + - wifi: iwlwifi: don't spam logs with NSS>2 messages + - ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer + - drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1 + - scsi: qedf: Fix a UAF bug in __qedf_probe() + - net/ieee802154: fix uninit value bug in dgram_sendmsg + - net: marvell: prestera: add support for for Aldrin2 + - ALSA: hda/hdmi: Fix the converter reuse for the silent stream + - um: Cleanup syscall_handler_t cast in syscalls_32.h + - um: Cleanup compiler warning in arch/x86/um/tls_32.c + - gpio: ftgpio010: Make irqchip immutable + - arch: um: Mark the stack non-executable to fix a binutils warning + - net: atlantic: fix potential memory leak in aq_ndev_close() + - KVM: s390: Pass initialized arg even if unused + - drm/amd/display: Fix double cursor on non-video RGB MPO + - drm/amd/display: Assume an LTTPR is always present on fixed_vs links + - drm/amd/display: update gamut remap if plane has changed + - drm/amd/display: skip audio setup when audio stream is enabled + - drm/amd/display: Fix DP MST timeslot issue when fallback happened + - drm/amd/display: increase dcn315 pstate change latency + - perf/x86/intel: Fix unchecked MSR access error for Alder Lake N + - don't use __kernel_write() on kmap_local_page() + - i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe + - usb: mon: make mmapped memory read only + - USB: serial: ftdi_sio: fix 300 bps rate for SIO + - gpiolib: acpi: Add support to ignore programming an interrupt + - gpiolib: acpi: Add a quirk for Asus UM325UAZ + - mmc: core: Replace with already defined values for readability + - mmc: core: Terminate infinite loop in SD-UHS voltage switch + - rpmsg: qcom: glink: replace strncpy() with strscpy_pad() + - bpf: Gate dynptr API behind CAP_BPF + - net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear + - bpf: Fix resetting logic for unreferenced kptrs + - Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works + - Revert "clk: ti: Stop using legacy clkctrl names for omap4 and 5" + - Linux 5.19.15 + + * Kinetic update: v5.19.14 upstream stable release (LP: #1994076) + - riscv: make t-head erratas depend on MMU + - tools/perf: Fix out of bound access to cpu mask array + - perf record: Fix cpu mask bit setting for mixed mmaps + - counter: 104-quad-8: Utilize iomap interface + - counter: 104-quad-8: Implement and utilize register structures + - counter: 104-quad-8: Fix skipped IRQ lines during events configuration + - uas: add no-uas quirk for Hiksemi usb_disk + - usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS + - uas: ignore UAS for Thinkplus chips + - usb: typec: ucsi: Remove incorrect warning + - thunderbolt: Explicitly reset plug events delay back to USB4 spec value + - net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 + - Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address + - can: c_can: don't cache TX messages for C_CAN cores + - clk: ingenic-tcu: Properly enable registers before accessing timers + - wifi: mac80211: ensure vif queues are operational after start + - x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd + - frontswap: don't call ->init if no ops are registered + - ARM: dts: integrator: Tag PCI host with device_type + - ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() + - x86/uaccess: avoid check_object_size() in copy_from_user_nmi() + - mm/damon/dbgfs: fix memory leak when using debugfs_lookup() + - net: mt7531: only do PLL once after the reset + - Revert "firmware: arm_scmi: Add clock management to the SCMI power domain" + - powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush + - drm/i915/gt: Restrict forced preemption to the active context + - drm/amdgpu: Add amdgpu suspend-resume code path under SRIOV + - vduse: prevent uninitialized memory accesses + - libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 + - mm: fix BUG splat with kvmalloc + GFP_ATOMIC + - mptcp: factor out __mptcp_close() without socket lock + - mptcp: fix unreleased socket in accept queue + - mmc: moxart: fix 4-bit bus width and remove 8-bit bus width + - mmc: hsq: Fix data stomping during mmc recovery + - mm: gup: fix the fast GUP race against THP collapse + - mm/page_alloc: fix race condition between build_all_zonelists and page + allocation + - mm: prevent page_frag_alloc() from corrupting the memory + - mm/page_isolation: fix isolate_single_pageblock() isolation behavior + - mm: fix dereferencing possible ERR_PTR + - mm/migrate_device.c: flush TLB while holding PTL + - mm/migrate_device.c: add missing flush_cache_page() + - mm/migrate_device.c: copy pte dirty bit to page + - mm: fix madivse_pageout mishandling on non-LRU page + - mm: bring back update_mmu_cache() to finish_fault() + - mm/hugetlb: correct demote page offset logic + - mm,hwpoison: check mm when killing accessing process + - media: dvb_vb2: fix possible out of bound access + - media: rkvdec: Disable H.264 error detection + - media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ) + - media: v4l2-compat-ioctl32.c: zero buffer passed to + v4l2_compat_get_array_args() + - ARM: dts: am33xx: Fix MMCHS0 dma properties + - reset: imx7: Fix the iMX8MP PCIe PHY PERST support + - ARM: dts: am5748: keep usb4_tm disabled + - soc: sunxi: sram: Actually claim SRAM regions + - soc: sunxi: sram: Prevent the driver from being unbound + - soc: sunxi: sram: Fix probe function ordering issues + - soc: sunxi: sram: Fix debugfs info for A64 SRAM C + - ASoC: imx-card: Fix refcount issue with of_node_put + - clk: microchip: mpfs: fix clk_cfg array bounds violation + - clk: microchip: mpfs: make the rtc's ahb clock critical + - arm64: dts: qcom: sm8350: fix UFS PHY serdes size + - ASoC: tas2770: Reinit regcache on reset + - drm/bridge: lt8912b: add vsync hsync + - drm/bridge: lt8912b: set hdmi or dvi mode + - drm/bridge: lt8912b: fix corrupted image output + - net: macb: Fix ZynqMP SGMII non-wakeup source resume failure + - Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in + suspend/resume time" + - Input: melfas_mip4 - fix return value check in mip4_probe() + - gpio: mvebu: Fix check for pwm support on non-A8K platforms + - perf parse-events: Break out tracepoint and printing + - perf print-events: Fix "perf list" can not display the PMU prefix for some + hybrid cache events + - perf parse-events: Remove "not supported" hybrid cache events + - usbnet: Fix memory leak in usbnet_disconnect() + - net: sched: act_ct: fix possible refcount leak in tcf_ct_init() + - cxgb4: fix missing unlock on ETHOFLD desc collect fail path + - net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe + - nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices + - wifi: cfg80211: fix MCS divisor value + - wifi: mac80211: fix regression with non-QoS drivers + - wifi: mac80211: fix memory corruption in minstrel_ht_update_rates() + - net: stmmac: power up/down serdes in stmmac_open/release + - net: phy: Don't WARN for PHY_UP state in mdio_bus_phy_resume() + - selftests: Fix the if conditions of in test_extra_filter() + - ice: xsk: change batched Tx descriptor cleaning + - ice: xsk: drop power of 2 ring size restriction for AF_XDP + - vdpa/ifcvf: fix the calculation of queuepair + - virtio-blk: Fix WARN_ON_ONCE in virtio_queue_rq() + - vdpa/mlx5: Fix MQ to support non power of two num queues + - clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks + - drm/i915/gt: Perf_limit_reasons are only available for Gen11+ + - clk: iproc: Do not rely on node name for correct PLL setup + - clk: imx93: drop of_match_ptr + - net: mscc: ocelot: fix tagged VLAN refusal while under a VLAN-unaware bridge + - net: ethernet: mtk_eth_soc: fix mask of RX_DMA_GET_SPORT{,_V2} + - perf test: Fix test case 87 ("perf record tests") for hybrid systems + - perf tests record: Fail the test if the 'errs' counter is not zero + - KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest + - x86/cacheinfo: Add a cpu_llc_shared_mask() UP variant + - x86/alternative: Fix race in try_get_desc() + - damon/sysfs: fix possible memleak on damon_sysfs_add_target + - Linux 5.19.14 + + * Kinetic update: v5.19.13 upstream stable release (LP: #1994075) + - Linux 5.19.13 + + * Kinetic update: v5.19.12 upstream stable release (LP: #1994074) + - smb3: Move the flush out of smb2_copychunk_range() into its callers + - smb3: fix temporary data corruption in collapse range + - smb3: fix temporary data corruption in insert range + - usb: add quirks for Lenovo OneLink+ Dock + - usb: gadget: udc-xilinx: replace memcpy with memcpy_toio + - smb3: use filemap_write_and_wait_range instead of filemap_write_and_wait + - Revert "usb: add quirks for Lenovo OneLink+ Dock" + - Revert "usb: gadget: udc-xilinx: replace memcpy with memcpy_toio" + - xfrm: fix XFRMA_LASTUSED comment + - block: remove QUEUE_FLAG_DEAD + - block: stop setting the nomerges flags in blk_cleanup_queue + - block: simplify disk shutdown + - scsi: core: Fix a use-after-free + - drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES + - USB: core: Fix RST error in hub.c + - USB: serial: option: add Quectel BG95 0x0203 composition + - USB: serial: option: add Quectel RM520N + - ALSA: core: Fix double-free at snd_card_new() + - ALSA: hda/tegra: set depop delay for tegra + - ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation + - ALSA: hda: Fix Nvidia dp infoframe + - ALSA: hda: add Intel 5 Series / 3400 PCI DID + - ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop + - ALSA: hda/realtek: Re-arrange quirk table entries + - ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack + - ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack + - ALSA: hda/realtek: Add quirk for ASUS GA503R laptop + - ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop + - ALSA: hda/realtek: Add a quirk for HP OMEN 16 (8902) mute LED + - iommu/vt-d: Check correct capability for sagaw determination + - exfat: fix overflow for large capacity partition + - btrfs: fix hang during unmount when stopping block group reclaim worker + - btrfs: fix hang during unmount when stopping a space reclaim worker + - btrfs: zoned: wait for extent buffer IOs before finishing a zone + - libperf evlist: Fix polling of system-wide events + - media: flexcop-usb: fix endpoint type check + - usb: dwc3: core: leave default DMA if the controller does not support 64-bit + DMA + - thunderbolt: Add support for Intel Maple Ridge single port controller + - efi: x86: Wipe setup_data on pure EFI boot + - efi: libstub: check Shim mode using MokSBStateRT + - wifi: mt76: fix reading current per-tid starting sequence number for + aggregation + - gpio: mockup: fix NULL pointer dereference when removing debugfs + - gpio: mockup: Fix potential resource leakage when register a chip + - gpiolib: cdev: Set lineevent_state::irq after IRQ register successfully + - riscv: fix a nasty sigreturn bug... + - riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning + - drm/i915/gem: Flush contexts on driver release + - drm/i915/gem: Really move i915_gem_context.link under ref protection + - xen/xenbus: fix xenbus_setup_ring() + - kasan: call kasan_malloc() from __kmalloc_*track_caller() + - can: flexcan: flexcan_mailbox_read() fix return value for drop = true + - net: mana: Add rmb after checking owner bits + - mm/slub: fix to return errno if kmalloc() fails + - mm: slub: fix flush_cpu_slab()/__free_slab() invocations in task context. + - KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0 + - KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES + - KVM: x86: Inject #UD on emulated XSETBV if XSAVES isn't enabled + - perf/arm-cmn: Add more bits to child node address offset field + - arm64: topology: fix possible overflow in amu_fie_setup() + - vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment + - batman-adv: Fix hang up with small MTU hard-interface + - firmware: arm_scmi: Harden accesses to the reset domains + - firmware: arm_scmi: Fix the asynchronous reset requests + - arm64: dts: rockchip: Lower sd speed on quartz64-b + - arm64: dts: rockchip: Pull up wlan wake# on Gru-Bob + - arm64: dts: rockchip: Fix typo in lisense text for PX30.Core + - drm/mediatek: dsi: Add atomic {destroy,duplicate}_state, reset callbacks + - arm64: dts: imx8mm: Reverse CPLD_Dn GPIO label mapping on MX8Menlo + - arm64: dts: rockchip: Set RK3399-Gru PCLK_EDP to 24 MHz + - arm64: dts: imx8mn: remove GPU power domain reset + - arm64: dts: imx8ulp: add #reset-cells for pcc + - dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get() + - arm64: dts: rockchip: fix property for usb2 phy supply on rock-3a + - arm64: dts: rockchip: fix property for usb2 phy supply on rk3568-evb1-v10 + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3399-puma + - arm64: dts: rockchip: Remove 'enable-active-low' from rk3566-quartz64-a + - arm64: dts: imx8mm-verdin: extend pmic voltages + - netfilter: nf_conntrack_sip: fix ct_sip_walk_headers + - netfilter: nf_conntrack_irc: Tighten matching on DCC message + - netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find() + - ice: Don't double unplug aux on peer initiated reset + - ice: Fix crash by keep old cfg when update TCs more than queues + - iavf: Fix cached head and tail value for iavf_get_tx_pending + - ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header + - net: core: fix flow symmetric hash + - wifi: iwlwifi: Mark IWLMEI as broken + - [Config] updateconfigs for IWLMEI + - arm64: dts: tqma8mqml: Include phy-imx8-pcie.h header + - drm/mediatek: Fix wrong dither settings + - arm64: dts: imx8mp-venice-gw74xx: fix CAN STBY polarity + - arm64: dts: imx8mp-venice-gw74xx: fix ksz9477 cpu port + - ARM: dts: lan966x: Fix the interrupt number for internal PHYs + - net: phy: aquantia: wait for the suspend/resume operations to finish + - arm64: dts: imx8mp-venice-gw74xx: fix port/phy validation + - scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts() + - scsi: mpt3sas: Fix return value check of dma_get_required_mask() + - net: bonding: Share lacpdu_mcast_addr definition + - net: bonding: Unsync device addresses on ndo_stop + - net: team: Unsync device addresses on ndo_stop + - drm/panel: simple: Fix innolux_g121i1_l01 bus_format + - mm/slab_common: fix possible double free of kmem_cache + - MIPS: lantiq: export clk_get_io() for lantiq_wdt.ko + - MIPS: Loongson32: Fix PHY-mode being left unspecified + - um: fix default console kernel parameter + - iavf: Fix bad page state + - mlxbf_gige: clear MDIO gateway lock after read + - i40e: Fix set max_tx_rate when it is lower than 1 Mbps + - netdevsim: Fix hwstats debugfs file permissions + - sfc: fix TX channel offset when using legacy interrupts + - sfc: fix null pointer dereference in efx_hard_start_xmit + - bnxt_en: fix flags to check for supported fw version + - gve: Fix GFP flags when allocing pages + - drm/hisilicon: Add depends on MMU + - of: mdio: Add of_node_put() when breaking out of for_each_xx + - net: ipa: properly limit modem routing table use + - sfc/siena: fix TX channel offset when using legacy interrupts + - sfc/siena: fix null pointer dereference in efx_hard_start_xmit + - wireguard: ratelimiter: disable timings test by default + - wireguard: netlink: avoid variable-sized memcpy on sockaddr + - net: enetc: move enetc_set_psfp() out of the common enetc_set_features() + - net: enetc: deny offload of tc-based TSN features on VF interfaces + - ipv6: Fix crash when IPv6 is administratively disabled + - net/sched: taprio: avoid disabling offload when it was never enabled + - net/sched: taprio: make qdisc_leaf() see the per-netdev-queue pfifo child + qdiscs + - ice: config netdev tc before setting queues number + - ice: Fix interface being down after reset with link-down-on-close flag on + - netfilter: nf_tables: fix nft_counters_enabled underflow at + nf_tables_addchain() + - netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain() + - netfilter: ebtables: fix memory leak when blob is malformed + - netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed + - net: ravb: Fix PHY state warning splat during system resume + - net: sh_eth: Fix PHY state warning splat during system resume + - gpio: tqmx86: fix uninitialized variable girq + - can: gs_usb: gs_can_open(): fix race dev->can.state condition + - perf stat: Fix BPF program section name + - perf stat: Fix cpu map index in bperf cgroup code + - perf jit: Include program header in ELF files + - perf kcore_copy: Do not check /proc/modules is unchanged + - perf tools: Honor namespace when synthesizing build-ids + - drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff() + - ice: Fix ice_xdp_xmit() when XDP TX queue number is not sufficient + - net/smc: Stop the CLC flow if no link to map buffers on + - net: phy: micrel: fix shared interrupt on LAN8814 + - bonding: fix NULL deref in bond_rr_gen_slave_id + - net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD + - net: sched: fix possible refcount leak in tc_new_tfilter() + - bnxt: prevent skb UAF after handing over to PTP worker + - selftests: forwarding: add shebang for sch_red.sh + - io_uring: ensure that cached task references are always put on exit + - serial: fsl_lpuart: Reset prior to registration + - serial: Create uart_xmit_advance() + - serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting + - serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting + - cgroup: cgroup_get_from_id() must check the looked-up kn is a directory + - phy: marvell: phy-mvebu-a3700-comphy: Remove broken reset support + - s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup + - blk-mq: fix error handling in __blk_mq_alloc_disk + - block: call blk_mq_exit_queue from disk_release for never added disks + - block: Do not call blk_put_queue() if gendisk allocation fails + - Drivers: hv: Never allocate anything besides framebuffer from framebuffer + memory region + - drm/gma500: Fix BUG: sleeping function called from invalid context errors + - drm/gma500: Fix WARN_ON(lock->magic != lock) error + - drm/gma500: Fix (vblank) IRQs not working after suspend/resume + - gpio: ixp4xx: Make irqchip immutable + - drm/amd/pm: disable BACO entry/exit completely on several sienna cichlid + cards + - drm/amdgpu: change the alignment size of TMR BO to 1M + - drm/amdgpu: add HDP remap functionality to nbio 7.7 + - drm/amdgpu: Skip reset error status for psp v13_0_0 + - drm/amd/display: Limit user regamma to a valid value + - drm/amd/display: Reduce number of arguments of dml31's + CalculateWatermarksAndDRAMSpeedChangeSupport() + - drm/amd/display: Reduce number of arguments of dml31's + CalculateFlipSchedule() + - drm/amd/display: Mark dml30's UseMinimumDCFCLK() as noinline for stack usage + - drm/rockchip: Fix return type of cdn_dp_connector_mode_valid + - gpio: mt7621: Make the irqchip immutable + - pmem: fix a name collision + - fsdax: Fix infinite loop in dax_iomap_rw() + - workqueue: don't skip lockdep work dependency in cancel_work_sync() + - i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible + - i2c: mlxbf: incorrect base address passed during io write + - i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction() + - i2c: mlxbf: Fix frequency calculation + - i2c: mux: harden i2c_mux_alloc() against integer overflows + - drm/amdgpu: don't register a dirty callback for non-atomic + - certs: make system keyring depend on built-in x509 parser + - Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT + - Makefile.debug: re-enable debug info for .S files + - devdax: Fix soft-reservation memory description + - ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 + - ext4: limit the number of retries after discarding preallocations blocks + - ext4: make mballoc try target group first even with mb_optimize_scan + - ext4: avoid unnecessary spreading of allocations among groups + - ext4: use locality group preallocation for small closed files + - ext4: use buckets for cr 1 block scan instead of rbtree + - Revert "block: freeze the queue earlier in del_gendisk" + - ext4: fixup possible uninitialized variable access in + ext4_mb_choose_next_group_cr1() + - ext4: make directory inode spreading reflect flexbg size + - Linux 5.19.12 + + * Kinetic update: v5.19.11 upstream stable release (LP: #1994070) + - of: fdt: fix off-by-one error in unflatten_dt_nodes() + - pinctrl: qcom: sc8180x: Fix gpio_wakeirq_map + - pinctrl: qcom: sc8180x: Fix wrong pin numbers + - pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH + - pinctrl: sunxi: Fix name for A100 R_PIO + - SUNRPC: Fix call completion races with call_decode() + - NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0 + - gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx + - NFSv4.2: Update mode bits after ALLOCATE and DEALLOCATE + - Revert "SUNRPC: Remove unreachable error condition" + - drm/panel-edp: Fix delays for Innolux N116BCA-EA1 + - drm/meson: Correct OSD1 global alpha value + - drm/meson: Fix OSD1 RGB to YCbCr coefficient + - drm/rockchip: vop2: Fix eDP/HDMI sync polarities + - drm/i915/vdsc: Set VDSC PIC_HEIGHT before using for DP DSC + - drm/i915/guc: Don't update engine busyness stats too frequently + - drm/i915/guc: Cancel GuC engine busyness worker synchronously + - block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for + nowait + - parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() + - of/device: Fix up of_dma_configure_id() stub + - io_uring/msg_ring: check file type before putting + - cifs: revalidate mapping when doing direct writes + - cifs: don't send down the destination address to sendmsg for a SOCK_STREAM + - cifs: always initialize struct msghdr smb_msg completely + - blk-lib: fix blkdev_issue_secure_erase + - parisc: Allow CONFIG_64BIT with ARCH=parisc + - tools/include/uapi: Fix for parisc and xtensa + - drm/i915/gt: Fix perf limit reasons bit positions + - drm/i915: Set correct domains values at _i915_vma_move_to_active + - drm/amdgpu: make sure to init common IP before gmc + - drm/amdgpu: Don't enable LTR if not supported + - drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega + - drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega + - net: Find dst with sk's xfrm policy not ctl_sk + - dt-bindings: apple,aic: Fix required item "apple,fiq-index" in affinity + description + - cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() + - ALSA: hda/sigmatel: Keep power up while beep is enabled + - ALSA: hda/sigmatel: Fix unused variable warning for beep power change + - Linux 5.19.11 + + * Kinetic update: v5.19.10 upstream stable release (LP: #1994069) + - iommu/vt-d: Fix kdump kernels boot failure with scalable mode + - net/mlx5: Introduce ifc bits for using software vhca id + - net/mlx5: Use software VHCA id when it's supported + - RDMA/mlx5: Rely on RoCE fw cap instead of devlink when setting profile + - RDMA/mlx5: Add a umr recovery flow + - RDMA/mlx5: Fix UMR cleanup on error flow of driver init + - ACPI: resource: skip IRQ override on AMD Zen platforms + - Input: goodix - add support for GT1158 + - platform/surface: aggregator_registry: Add support for Surface Laptop Go 2 + - drm/msm/rd: Fix FIFO-full deadlock + - peci: cpu: Fix use-after-free in adev_release() + - kvm: x86: mmu: Always flush TLBs when enabling dirty logging + - dt-bindings: iio: gyroscope: bosch,bmg160: correct number of pins + - HID: ishtp-hid-clientHID: ishtp-hid-client: Fix comment typo + - hid: intel-ish-hid: ishtp: Fix ishtp client sending disordered message + - Bluetooth: MGMT: Fix Get Device Flags + - tg3: Disable tg3 device on system reboot to avoid triggering AER + - r8152: add PID for the Lenovo OneLink+ Dock + - gpio: mockup: remove gpio debugfs when remove device + - ieee802154: cc2520: add rc code in cc2520_tx() + - Input: iforce - add support for Boeder Force Feedback Wheel + - drm/amdgpu: disable FRU access on special SIENNA CICHLID card + - drm/amd/pm: use vbios carried pptable for all SMU13.0.7 SKUs + - nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM610 + - nvmet-tcp: fix unhandled tcp states in nvmet_tcp_state_change() + - drm/amd/amdgpu: skip ucode loading if ucode_size == 0 + - net: dsa: hellcreek: Print warning only once + - perf/arm_pmu_platform: fix tests for platform_get_irq() failure + - platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes + - usb: storage: Add ASUS <0x0b05:0x1932> to IGNORE_UAS + - platform/x86: asus-wmi: Increase FAN_CURVE_BUF_LEN to 32 + - LoongArch: Fix section mismatch due to acpi_os_ioremap() + - LoongArch: Fix arch_remove_memory() undefined build error + - gpio: 104-dio-48e: Make irq_chip immutable + - gpio: 104-idio-16: Make irq_chip immutable + - RDMA/irdma: Use s/g array in post send only when its valid + - Input: goodix - add compatible string for GT1158 + - Linux 5.19.10 + + * Kinetic update: v5.19.9 upstream stable release (LP: #1994068) + - efi: libstub: Disable struct randomization + - efi: capsule-loader: Fix use-after-free in efi_capsule_write + - wifi: mt76: mt7921e: fix crash in chip reset fail + - wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in + il4965_rs_fill_link_cmd() + - fs: only do a memory barrier for the first set_buffer_uptodate() + - soc: fsl: select FSL_GUTS driver for DPIO + - Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" + - scsi: qla2xxx: Disable ATIO interrupt coalesce for quad port ISP27XX + - scsi: core: Allow the ALUA transitioning state enough time + - scsi: megaraid_sas: Fix double kfree() + - drm/gem: Fix GEM handle release errors + - drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to + psp_hw_fini + - drm/amdgpu: fix hive reference leak when adding xgmi device + - drm/amdgpu: Check num_gfx_rings for gfx v9_0 rb setup. + - drm/amdgpu: Remove the additional kfd pre reset call for sriov + - drm/radeon: add a force flush to delay work when radeon + - scsi: ufs: core: Reduce the power mode change timeout + - Revert "parisc: Show error if wrong 32/64-bit compiler is being used" + - parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() + - parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines + - [Config] updateconfigs for ARM64_ERRATUM_2457168 + - arm64: errata: add detection for AMEVCNTR01 incrementing incorrectly + - netfilter: conntrack: work around exceeded receive window + - thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR + - cpufreq: check only freq_table in __resolve_freq() + - net/core/skbuff: Check the return value of skb_copy_bits() + - md: Flush workqueue md_rdev_misc_wq in md_alloc() + - fbdev: omapfb: Fix tests for platform_get_irq() failure + - fbdev: fbcon: Destroy mutex on freeing struct fb_info + - fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() + - x86/sev: Mark snp_abort() noreturn + - drm/amdgpu: add sdma instance check for gfx11 CGCG + - drm/amdgpu: mmVM_L2_CNTL3 register not initialized correctly + - ALSA: pcm: oss: Fix race at SNDCTL_DSP_SYNC + - ALSA: emu10k1: Fix out of bounds access in snd_emu10k1_pcm_channel_alloc() + - ALSA: hda: Once again fix regression of page allocations with IOMMU + - ALSA: aloop: Fix random zeros in capture data when using jiffies timer + - ALSA: usb-audio: Clear fixed clock rate at closing EP + - ALSA: usb-audio: Fix an out-of-bounds bug in + __snd_usb_parse_audio_interface() + - tracefs: Only clobber mode/uid/gid on remount if asked + - tracing: hold caller_addr to hardirq_{enable,disable}_ip + - tracing: Fix to check event_mutex is held while accessing trigger list + - btrfs: zoned: set pseudo max append zone limit in zone emulation mode + - btrfs: zoned: fix API misuse of zone finish waiting + - vfio/type1: Unpin zero pages + - kprobes: Prohibit probes in gate area + - perf: RISC-V: fix access beyond allocated array + - debugfs: add debugfs_lookup_and_remove() + - sched/debug: fix dentry leak in update_sched_domain_debugfs + - drm/amd/display: fix memory leak when using debugfs_lookup() + - driver core: fix driver_set_override() issue with empty strings + - nvmet: fix a use-after-free + - drm/i915/bios: Copy the whole MIPI sequence block + - drm/i915/slpc: Let's fix the PCODE min freq table setup for SLPC + - scsi: mpt3sas: Fix use-after-free warning + - scsi: lpfc: Add missing destroy_workqueue() in error path + - cgroup: Elide write-locking threadgroup_rwsem when updating csses on an + empty subtree + - cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock + - cifs: remove useless parameter 'is_fsctl' from SMB2_ioctl() + - smb3: missing inode locks in zero range + - spi: bitbang: Fix lsb-first Rx + - ASoC: cs42l42: Only report button state if there was a button interrupt + - Revert "soc: imx: imx8m-blk-ctrl: set power device name" + - arm64: dts: imx8mm-verdin: update CAN clock to 40MHz + - arm64: dts: imx8mm-verdin: use level interrupt for mcp251xfd + - ASoC: qcom: sm8250: add missing module owner + - regmap: spi: Reserve space for register address/padding + - arm64: dts: imx8mp-venice-gw74xx: fix sai2 pin settings + - arm64: dts: imx8mq-tqma8mq: Remove superfluous interrupt-names + - RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg + - RDMA/rtrs-srv: Pass the correct number of entries for dma mapped SGL + - ARM: dts: imx6qdl-vicut1.dtsi: Fix node name backlight_led + - ARM: dts: imx6qdl-kontron-samx6i: remove duplicated node + - ARM: dts: imx6qdl-kontron-samx6i: fix spi-flash compatible + - arm64: dts: ls1028a-qds-65bb: don't use in-band autoneg for 2500base-x + - soc: imx: gpcv2: Assert reset before ungating clock + - arm64: dts: verdin-imx8mm: add otg2 pd to usbphy + - arm64: dts: imx8mm-venice-gw7901: fix port/phy validation + - arm64: dts: freescale: verdin-imx8mm: fix atmel_mxt_ts reset polarity + - arm64: dts: freescale: verdin-imx8mp: fix atmel_mxt_ts reset polarity + - regulator: core: Clean up on enable failure + - ASoC: SOF: Kconfig: Make IPC_FLOOD_TEST depend on SND_SOC_SOF + - ASoC: SOF: Kconfig: Make IPC_MESSAGE_INJECTOR depend on SND_SOC_SOF + - tee: fix compiler warning in tee_shm_register() + - RDMA/irdma: Fix drain SQ hang with no completion + - arm64: dts: renesas: r8a779g0: Fix HSCIF0 interrupt number + - RDMA/cma: Fix arguments order in net device validation + - soc: brcmstb: pm-arm: Fix refcount leak and __iomem leak bugs + - RDMA/hns: Fix supported page size + - RDMA/hns: Fix wrong fixed value of qp->rq.wqe_shift + - RDMA/hns: Remove the num_qpc_timer variable + - wifi: wilc1000: fix DMA on stack objects + - ARM: at91: pm: fix self-refresh for sama7g5 + - ARM: at91: pm: fix DDR recalibration when resuming from backup and self- + refresh + - ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges + - ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges + - ARM: dts: at91: sama7g5ek: specify proper regulator output ranges + - ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time + - ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time + - netfilter: br_netfilter: Drop dst references before setting. + - netfilter: nf_tables: clean up hook list when offload flags check fails + - riscv: dts: microchip: use an mpfs specific l2 compatible + - netfilter: nf_conntrack_irc: Fix forged IP logic + - RDMA/srp: Set scmnd->result only when scmnd is not NULL + - ALSA: usb-audio: Inform the delayed registration more properly + - ALSA: usb-audio: Register card again for iface over delayed_register option + - rxrpc: Fix ICMP/ICMP6 error handling + - rxrpc: Fix an insufficiently large sglist in rxkad_verify_packet_2() + - afs: Use the operation issue time instead of the reply time for callbacks + - kunit: fix assert_type for comparison macros + - Revert "net: phy: meson-gxl: improve link-up behavior" + - sch_sfb: Don't assume the skb is still around after enqueueing to child + - tipc: fix shift wrapping bug in map_get() + - net: introduce __skb_fill_page_desc_noacc + - tcp: TX zerocopy should not sense pfmemalloc status + - ice: Fix DMA mappings leak + - ice: use bitmap_free instead of devm_kfree + - i40e: Fix kernel crash during module removal + - iavf: Detach device during reset task + - xen-netback: only remove 'hotplug-status' when the vif is actually destroyed + - block: don't add partitions if GD_SUPPRESS_PART_SCAN is set + - RDMA/siw: Pass a pointer to virt_to_page() + - bonding: use unspecified address if no available link local address + - bonding: add all node mcast address when slave up + - ipv6: sr: fix out-of-bounds read when setting HMAC data. + - IB/core: Fix a nested dead lock as part of ODP flow + - RDMA/mlx5: Set local port to one when accessing counters + - btrfs: zoned: fix mounting with conventional zones + - erofs: fix error return code in erofs_fscache_{meta_,}read_folio + - erofs: fix pcluster use-after-free on UP platforms + - nvme-tcp: fix UAF when detecting digest errors + - nvme-tcp: fix regression that causes sporadic requests to time out + - tcp: fix early ETIMEDOUT after spurious non-SACK RTO + - btrfs: fix the max chunk size and stripe length calculation + - nvmet: fix mar and mor off-by-one errors + - RDMA/irdma: Report the correct max cqes from query device + - RDMA/irdma: Return error on MR deregister CQP failure + - RDMA/irdma: Return correct WC error for bind operation failure + - RDMA/irdma: Report RNR NAK generation in device caps + - net: dsa: felix: disable cut-through forwarding for frames oversized for tc- + taprio + - net: dsa: felix: access QSYS_TAG_CONFIG under tas_lock in + vsc9959_sched_speed_set + - net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear + - net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb + - net/smc: Fix possible access to freed memory in link clear + - io_uring: recycle kbuf recycle on tw requeue + - net: phy: lan87xx: change interrupt src of link_up to comm_ready + - sch_sfb: Also store skb len before calling child enqueue + - libperf evlist: Fix per-thread mmaps for multi-threaded targets + - perf dlfilter dlfilter-show-cycles: Fix types for print format + - perf script: Fix Cannot print 'iregs' field for hybrid systems + - perf record: Fix synthesis failure warnings + - hwmon: (tps23861) fix byte order in resistance register + - ASoC: mchp-spdiftx: remove references to mchp_i2s_caps + - ASoC: mchp-spdiftx: Fix clang -Wbitfield-constant-conversion + - MIPS: loongson32: ls1c: Fix hang during startup + - kbuild: disable header exports for UML in a straightforward way + - i40e: Refactor tc mqprio checks + - i40e: Fix ADQ rate limiting for PF + - net: bonding: replace dev_trans_start() with the jiffies of the last ARP/NS + - bonding: accept unsolicited NA message + - swiotlb: avoid potential left shift overflow + - iommu/amd: use full 64-bit value in build_completion_wait() + - s390/boot: fix absolute zero lowcore corruption on boot + - time64.h: consolidate uses of PSEC_PER_NSEC + - net: dsa: felix: tc-taprio intervals smaller than MTU should send at least + one packet + - hwmon: (mr75203) fix VM sensor allocation when "intel,vm-map" not defined + - hwmon: (mr75203) update pvt->v_num and vm_num to the actual number of used + sensors + - hwmon: (mr75203) fix voltage equation for negative source input + - hwmon: (mr75203) fix multi-channel voltage reading + - hwmon: (mr75203) enable polling for all VM channels + - perf evlist: Always use arch_evlist__add_default_attrs() + - perf stat: Fix L2 Topdown metrics disappear for raw events + - Revert "arm64: kasan: Revert "arm64: mte: reset the page tag in + page->flags"" + - hwmon: (asus-ec-sensors) add support for Strix Z690-a D4 + - hwmon: (asus-ec-sensors) add support for Maximus XI Hero + - hwmon: (asus-ec-sensors) add missing sensors for X570-I GAMING + - hwmon: (asus-ec-sensors) add definitions for ROG ZENITH II EXTREME + - hwmon: (asus-ec-sensors) autoload module via DMI data + - arm64/bti: Disable in kernel BTI when cross section thunks are broken + - [Config] updateconfigs for ARM64_BTI_KERNEL + - iommu/vt-d: Correctly calculate sagaw value of IOMMU + - iommu/virtio: Fix interaction with VFIO + - iommu: Fix false ownership failure on AMD systems with PASID activated + - drm/amd/display: Add SMU logging code + - drm/amd/display: Removing assert statements for Linux + - Linux 5.19.9 + + * Kinetic update: v5.19.8 upstream stable release (LP: #1994061) + - drm/msm/dp: make eDP panel as the first connected connector + - drm/msm/dsi: fix the inconsistent indenting + - drm/msm/dpu: populate wb or intf before reset_intf_cfg + - drm/msm/dp: delete DP_RECOVERED_CLOCK_OUT_EN to fix tps4 + - drm/msm/dsi: Fix number of regulators for msm8996_dsi_cfg + - drm/msm/dsi: Fix number of regulators for SDM660 + - platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask + - platform/x86: x86-android-tablets: Fix broken touchscreen on Chuwi Hi8 with + Windows BIOS + - xsk: Fix corrupted packets for XDP_SHARED_UMEM + - drm/msm/gpu: Drop qos request if devm_devfreq_add_device() fails + - peci: aspeed: fix error check return value of platform_get_irq() + - iio: adc: mcp3911: make use of the sign bit + - skmsg: Fix wrong last sg check in sk_msg_recvmsg() + - bpf: Restrict bpf_sys_bpf to CAP_PERFMON + - ip_tunnel: Respect tunnel key's "flow_flags" in IP tunnels + - bpf, cgroup: Fix kernel BUG in purge_effective_progs + - drm/i915/gvt: Fix Comet Lake + - ieee802154/adf7242: defer destroy_workqueue call + - bpf: Fix a data-race around bpf_jit_limit. + - drm/i915/ttm: fix CCS handling + - drm/i915/display: avoid warnings when registering dual panel backlight + - ALSA: hda: intel-nhlt: Correct the handling of fmt_config flexible array + - wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() + - xhci: Fix null pointer dereference in remove if xHC has only one roothub + - Revert "xhci: turn off port power in shutdown" + - bpf: Allow helpers to accept pointers with a fixed size + - bpf: Tidy up verifier check_func_arg() + - bpf: Do mark_chain_precision for ARG_CONST_ALLOC_SIZE_OR_ZERO + - Bluetooth: hci_event: Fix vendor (unknown) opcode status handling + - Bluetooth: hci_sync: Fix suspend performance regression + - Bluetooth: hci_event: Fix checking conn for le_conn_complete_evt + - Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn + - net: sparx5: fix handling uneven length packets in manual extraction + - net: smsc911x: Stop and start PHY during suspend and resume + - openvswitch: fix memory leak at failed datapath creation + - nfp: flower: fix ingress police using matchall filter + - net: dsa: xrs700x: Use irqsave variant for u64 stats update + - net: sched: tbf: don't call qdisc_put() while holding tree lock + - net/sched: fix netdevice reference leaks in attach_default_qdiscs() + - net: phy: micrel: Make the GPIO to be non-exclusive + - net: lan966x: improve error handle in lan966x_fdma_rx_get_frame() + - ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler + - cachefiles: fix error return code in cachefiles_ondemand_copen() + - cachefiles: make on-demand request distribution fairer + - mlxbf_gige: compute MDIO period based on i1clk + - kcm: fix strp_init() order and cleanup + - sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb + - tcp: annotate data-race around challenge_timestamp + - Revert "sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb" + - net/smc: Remove redundant refcount increase + - soundwire: qcom: fix device status array range + - mm/slab_common: Deleting kobject in kmem_cache_destroy() without holding + slab_mutex/cpu_hotplug_lock + - platform/mellanox: mlxreg-lc: Fix coverity warning + - platform/mellanox: mlxreg-lc: Fix locking issue + - serial: fsl_lpuart: RS485 RTS polariy is inverse + - tty: serial: atmel: Preserve previous USART mode if RS485 disabled + - staging: rtl8712: fix use after free bugs + - staging: r8188eu: Add Rosewill USB-N150 Nano to device tables + - staging: r8188eu: add firmware dependency + - Revert "powerpc: Remove unused FW_FEATURE_NATIVE references" + - powerpc: align syscall table for ppc32 + - powerpc/rtas: Fix RTAS MSR[HV] handling for Cell + - vt: Clear selection before changing the font + - musb: fix USB_MUSB_TUSB6010 dependency + - tty: serial: lpuart: disable flow control while waiting for the transmit + engine to complete + - Input: iforce - wake up after clearing IFORCE_XMIT_RUNNING flag + - iio: light: cm3605: Fix an error handling path in cm3605_probe() + - iio: ad7292: Prevent regulator double disable + - iio: adc: mcp3911: correct "microchip,device-addr" property + - iio: adc: mcp3911: use correct formula for AD conversion + - misc: fastrpc: fix memory corruption on probe + - misc: fastrpc: fix memory corruption on open + - firmware_loader: Fix use-after-free during unregister + - firmware_loader: Fix memory leak in firmware upload + - USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id + - landlock: Fix file reparenting without explicit LANDLOCK_ACCESS_FS_REFER + - mmc: core: Fix UHS-I SD 1.8V workaround branch + - mmc: core: Fix inconsistent sd3_bus_mode at UHS-I SD voltage switch failure + - binder: fix UAF of ref->proc caused by race condition + - binder: fix alloc->vma_vm_mm null-ptr dereference + - cifs: fix small mempool leak in SMB2_negotiate() + - KVM: VMX: Heed the 'msr' argument in msr_write_intercepted() + - riscv: kvm: move extern sbi_ext declarations to a header + - clk: ti: Fix missing of_node_get() ti_find_clock_provider() + - drm/i915/reg: Fix spelling mistake "Unsupport" -> "Unsupported" + - clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops + - Revert "clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops" + - clk: core: Fix runtime PM sequence in clk_core_unprepare() + - Input: rk805-pwrkey - fix module autoloading + - powerpc/papr_scm: Fix nvdimm event mappings + - clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate + - clk: bcm: rpi: Prevent out-of-bounds access + - clk: bcm: rpi: Add missing newline + - hwmon: (gpio-fan) Fix array out of bounds access + - gpio: pca953x: Add mutex_lock for regcache sync in PM + - gpio: realtek-otto: switch to 32-bit I/O + - KVM: x86: Mask off unsupported and unknown bits of IA32_ARCH_CAPABILITIES + - powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register() + - xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() + - mm: pagewalk: Fix race between unmap and page walker + - xen-blkback: Advertise feature-persistent as user requested + - xen-blkfront: Advertise feature-persistent as user requested + - xen-blkfront: Cache feature_persistent value before advertisement + - thunderbolt: Use the actual buffer in tb_async_error() + - thunderbolt: Check router generation before connecting xHCI + - usb: dwc3: pci: Add support for Intel Raptor Lake + - media: mceusb: Use new usb_control_msg_*() routines + - xhci: Add grace period after xHC start to prevent premature runtime suspend. + - usb: dwc3: disable USB core PHY management + - usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop + - usb: dwc3: fix PHY disable sequence + - USB: serial: ch341: fix lost character on LCR updates + - USB: serial: ch341: fix disabled rx timer on older devices + - USB: serial: cp210x: add Decagon UCA device id + - USB: serial: option: add support for OPPO R11 diag port + - USB: serial: option: add Quectel EM060K modem + - USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode + - Revert "usb: typec: ucsi: add a common function + ucsi_unregister_connectors()" + - usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles + - usb: typec: intel_pmc_mux: Add new ACPI ID for Meteor Lake IOM device + - usb: typec: tcpm: Return ENOTSUPP for power supply prop writes + - usb: dwc2: fix wrong order of phy_power_on and phy_init + - usb: cdns3: fix issue with rearming ISO OUT endpoint + - usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer + - USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) + - usb-storage: Add ignore-residue quirk for NXP PN7462AU + - s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages + - s390: fix nospec table alignments + - USB: core: Prevent nested device-reset calls + - usb: xhci-mtk: relax TT periodic bandwidth allocation + - usb: xhci-mtk: fix bandwidth release issue + - usb: gadget: f_uac2: fix superspeed transfer + - usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS + - USB: gadget: Fix obscure lockdep violation for udc_mutex + - dma-buf/dma-resv: check if the new fence is really later + - arm64/kexec: Fix missing extra range for crashkres_low. + - driver core: Don't probe devices after bus_type.match() probe deferral + - wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected + - wifi: mac80211: Fix UAF in ieee80211_scan_rx() + - ip: fix triggering of 'icmp redirect' + - net: Use u64_stats_fetch_begin_irq() for stats fetch. + - net: mac802154: Fix a condition in the receive path + - ALSA: memalloc: Revive x86-specific WC page allocations again + - ALSA: hda/realtek: Add speaker AMP init for Samsung laptops with ALC298 + - ALSA: seq: oss: Fix data-race for max_midi_devs access + - ALSA: seq: Fix data-race at module auto-loading + - drm/i915/backlight: Disable pps power hook for aux based backlight + - drm/i915/guc: clear stalled request after a reset + - drm/i915/glk: ECS Liva Q2 needs GLK HDMI port timing quirk + - drm/i915: Skip wm/ddb readout for disabled pipes + - tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf() + - tty: n_gsm: initialize more members at gsm_alloc_mux() + - tty: n_gsm: replace kicktimer with delayed_work + - tty: n_gsm: avoid call of sleeping functions from atomic context + - Linux 5.19.8 + + * md: Replace snprintf with scnprintf (LP: #1993315) + - md: Replace snprintf with scnprintf + + * ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems (LP: #1990985) + - ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel + systems + + * iavf: SR-IOV VFs error with no traffic flow when MTU greater than 1500 + (LP: #1983656) + - iavf: Fix set max MTU size with port VLAN and jumbo frames + - i40e: Fix VF set max MTU size + + * Fix resume on AMD platforms when TBT monitor is plugged (LP: #1990920) + - drm/amd/display: Detect dpcd_rev when hotplug mst monitor + - drm/amd/display: Release remote dc_sink under mst scenario + + * [SRU][J/OEM-5.17][PATCH 0/1] Fix oled brightness set above frame-average + luminance (LP: #1978986) + - drm: New function to get luminance range based on static hdr metadata + - drm/amdgpu_dm: Rely on split out luminance calculation function + - drm/i915: Use luminance range calculated during edid parsing + + * Update Broadcom Emulex FC HBA lpfc driver to 14.2.0.5 for Ubuntu 22.04 + (LP: #1988711) + - scsi: lpfc: Fix uninitialized cqe field in lpfc_nvme_cancel_iocb() + - scsi: lpfc: Set PU field when providing D_ID in XMIT_ELS_RSP64_CX iocb + - scsi: lpfc: Fix lost NVMe paths during LIF bounce stress test + - scsi: lpfc: Refactor lpfc_nvmet_prep_abort_wqe() into + lpfc_sli_prep_abort_xri() + - scsi: lpfc: Update lpfc version to 14.2.0.5 + - scsi: lpfc: Copyright updates for 14.2.0.5 patches + + * input/keyboard: the keyboard on some Asus laptops can't work (LP: #1992266) + - ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA + - ACPI: resource: Add ASUS model S5402ZA to quirks + + * pcieport 0000:00:1b.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), + type=Transaction Layer, (Requester ID) (LP: #1988797) + - PCI/PTM: Cache PTM Capability offset + - PCI/PTM: Add pci_upstream_ptm() helper + - PCI/PTM: Separate configuration and enable + - PCI/PTM: Add pci_suspend_ptm() and pci_resume_ptm() + - PCI/PTM: Move pci_ptm_info() body into its only caller + - PCI/PTM: Preserve RsvdP bits in PTM Control register + - PCI/PTM: Reorder functions in logical order + - PCI/PTM: Consolidate PTM interface declarations + - PCI/PM: Always disable PTM for all devices during suspend + - PCI/PM: Simplify pci_pm_suspend_noirq() + + -- Stefan Bader Thu, 24 Nov 2022 17:16:15 +0100 + linux (5.19.0-26.27) kinetic; urgency=medium * kinetic/linux: 5.19.0-26.27 -proposed tracker (LP: #1997434) diff -Nru linux-aws-5.19.0/debian.master/config/annotations linux-aws-5.19.0/debian.master/config/annotations --- linux-aws-5.19.0/debian.master/config/annotations 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/config/annotations 2022-11-29 07:06:46.000000000 +0000 @@ -6387,7 +6387,7 @@ CONFIG_MDIO_ASPEED policy<{'armhf': 'm'}> CONFIG_MDIO_BCM_IPROC policy<{'arm64': 'n'}> CONFIG_MDIO_BCM_UNIMAC policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'n'}> -CONFIG_MDIO_BITBANG policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'n'}> +CONFIG_MDIO_BITBANG policy<{'amd64': 'm', 'arm64': 'y', 'armhf': 'y', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'n'}> CONFIG_MDIO_BUS_MUX_BCM_IPROC policy<{'arm64': 'y'}> CONFIG_MDIO_BUS_MUX_GPIO policy<{'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> CONFIG_MDIO_BUS_MUX_MESON_G12A policy<{'arm64': 'm', 'armhf': 'm'}> @@ -6769,9 +6769,7 @@ # Menu: Device Drivers >> Network device support >> Wireless LAN >> Intel devices >> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) CONFIG_IWLWIFI policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> CONFIG_IWLDVM policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> -CONFIG_IWLMEI policy<{'amd64': 'n'}> CONFIG_IWLMVM policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> -CONFIG_IWLMEI mark note # Menu: Device Drivers >> Network device support >> Wireless LAN >> Intel devices >> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) >> Debugging Options CONFIG_IWLWIFI_DEBUG policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n'}> @@ -13511,7 +13509,6 @@ # Menu: Processor type and features >> ARMv8.5 architectural features >> Architecture: arm64 CONFIG_ARM64_BTI policy<{'arm64': 'y'}> -CONFIG_ARM64_BTI_KERNEL policy<{'arm64': 'y'}> CONFIG_ARM64_E0PD policy<{'arm64': 'y'}> CONFIG_ARM64_MTE policy<{'arm64': 'y'}> diff -Nru linux-aws-5.19.0/debian.master/config/arm64/config.common.arm64 linux-aws-5.19.0/debian.master/config/arm64/config.common.arm64 --- linux-aws-5.19.0/debian.master/config/arm64/config.common.arm64 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/config/arm64/config.common.arm64 2022-11-29 07:06:46.000000000 +0000 @@ -324,7 +324,7 @@ CONFIG_MCB=m CONFIG_MCTP=y CONFIG_MDIO_BCM_UNIMAC=m -CONFIG_MDIO_BITBANG=m +CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=y CONFIG_MDIO_THUNDER=m CONFIG_MD_MULTIPATH=m diff -Nru linux-aws-5.19.0/debian.master/config/armhf/config.common.armhf linux-aws-5.19.0/debian.master/config/armhf/config.common.armhf --- linux-aws-5.19.0/debian.master/config/armhf/config.common.armhf 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/config/armhf/config.common.armhf 2022-11-29 07:06:46.000000000 +0000 @@ -314,7 +314,7 @@ CONFIG_MCB=m CONFIG_MCTP=y CONFIG_MDIO_BCM_UNIMAC=m -CONFIG_MDIO_BITBANG=m +CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS_MUX=m CONFIG_MD_MULTIPATH=m CONFIG_MEDIATEK_GE_PHY=m diff -Nru linux-aws-5.19.0/debian.master/config/config.common.ubuntu linux-aws-5.19.0/debian.master/config/config.common.ubuntu --- linux-aws-5.19.0/debian.master/config/config.common.ubuntu 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/config/config.common.ubuntu 2022-11-29 07:06:46.000000000 +0000 @@ -670,7 +670,6 @@ CONFIG_ARM64_AMU_EXTN=y CONFIG_ARM64_AS_HAS_MTE=y CONFIG_ARM64_BTI=y -CONFIG_ARM64_BTI_KERNEL=y CONFIG_ARM64_CNP=y CONFIG_ARM64_CRYPTO=y # CONFIG_ARM64_DEBUG_PRIORITY_MASKING is not set @@ -690,7 +689,9 @@ CONFIG_ARM64_ERRATUM_2054223=y CONFIG_ARM64_ERRATUM_2067961=y # CONFIG_ARM64_ERRATUM_2077057 is not set +CONFIG_ARM64_ERRATUM_2441007=y CONFIG_ARM64_ERRATUM_2441009=y +CONFIG_ARM64_ERRATUM_2457168=y CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_826319=y @@ -925,6 +926,7 @@ CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y CONFIG_AS_HAS_LDAPR=y CONFIG_AS_HAS_LSE_ATOMICS=y +CONFIG_AS_HAS_NON_CONST_LEB128=y CONFIG_AS_HAS_PAC=y CONFIG_AS_HAS_SHA3=y CONFIG_AS_IS_GNU=y @@ -1580,6 +1582,7 @@ CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y CONFIG_CC_HAS_BRANCH_PROT_PAC_RET=y CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI=y CONFIG_CC_HAS_IBT=y @@ -5584,7 +5587,6 @@ CONFIG_IWLEGACY=m # CONFIG_IWLEGACY_DEBUG is not set CONFIG_IWLEGACY_DEBUGFS=y -# CONFIG_IWLMEI is not set CONFIG_IWLMVM=m CONFIG_IWLWIFI=m # CONFIG_IWLWIFI_DEBUG is not set @@ -10314,6 +10316,7 @@ CONFIG_SND_HDA_CODEC_VIA=m CONFIG_SND_HDA_COMPONENT=y CONFIG_SND_HDA_CORE=m +CONFIG_SND_HDA_CS_DSP_CONTROLS=m CONFIG_SND_HDA_DSP_LOADER=y CONFIG_SND_HDA_EXT_CORE=m CONFIG_SND_HDA_GENERIC=m diff -Nru linux-aws-5.19.0/debian.master/etc/getabis linux-aws-5.19.0/debian.master/etc/getabis --- linux-aws-5.19.0/debian.master/etc/getabis 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/etc/getabis 2022-11-29 07:06:46.000000000 +0000 @@ -4,6 +4,7 @@ "http://archive.ubuntu.com/ubuntu/pool/universe/l/linux" "http://ports.ubuntu.com/ubuntu-ports/pool/universe/l/linux" "http://ppa.launchpad.net/canonical-kernel-team/ppa/ubuntu/pool/main/l/linux" + "http://ppa.launchpad.net/canonical-kernel-team/ppa2/ubuntu/pool/main/l/linux" "http://ppa.launchpad.net/canonical-kernel-team/unstable/ubuntu/pool/main/l/linux" "http://ppa.launchpad.net/canonical-kernel-team/bootstrap/ubuntu/pool/main/l/linux" ) diff -Nru linux-aws-5.19.0/debian.master/tracking-bug linux-aws-5.19.0/debian.master/tracking-bug --- linux-aws-5.19.0/debian.master/tracking-bug 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/tracking-bug 2022-11-29 07:06:46.000000000 +0000 @@ -1 +1 @@ -1997434 2022.10.10-6 +1997794 2022.11.14-3 diff -Nru linux-aws-5.19.0/debian.master/upstream-stable linux-aws-5.19.0/debian.master/upstream-stable --- linux-aws-5.19.0/debian.master/upstream-stable 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/debian.master/upstream-stable 2022-11-29 07:06:46.000000000 +0000 @@ -1,3 +1,3 @@ # The following upstream stable releases have been ported: [upstream-stable] - linux-5.19.y = v5.19.7 + linux-5.19.y = v5.19.17 diff -Nru linux-aws-5.19.0/Documentation/ABI/testing/sysfs-bus-iio linux-aws-5.19.0/Documentation/ABI/testing/sysfs-bus-iio --- linux-aws-5.19.0/Documentation/ABI/testing/sysfs-bus-iio 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/ABI/testing/sysfs-bus-iio 2022-11-29 07:06:46.000000000 +0000 @@ -188,7 +188,7 @@ Raw capacitance measurement from channel Y. Units after application of scale and offset are nanofarads. -What: /sys/.../iio:deviceX/in_capacitanceY-in_capacitanceZ_raw +What: /sys/.../iio:deviceX/in_capacitanceY-capacitanceZ_raw KernelVersion: 3.2 Contact: linux-iio@vger.kernel.org Description: diff -Nru linux-aws-5.19.0/Documentation/admin-guide/kernel-parameters.txt linux-aws-5.19.0/Documentation/admin-guide/kernel-parameters.txt --- linux-aws-5.19.0/Documentation/admin-guide/kernel-parameters.txt 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/Documentation/admin-guide/kernel-parameters.txt 2022-11-29 07:06:46.000000000 +0000 @@ -3769,6 +3769,10 @@ nox2apic [X86-64,APIC] Do not enable x2APIC mode. + NOTE: this parameter will be ignored on systems with the + LEGACY_XAPIC_DISABLED bit set in the + IA32_XAPIC_DISABLE_STATUS MSR. + nps_mtm_hs_ctr= [KNL,ARC] This parameter sets the maximum duration, in cycles, each HW thread of the CTOP can run diff -Nru linux-aws-5.19.0/Documentation/arm64/silicon-errata.rst linux-aws-5.19.0/Documentation/arm64/silicon-errata.rst --- linux-aws-5.19.0/Documentation/arm64/silicon-errata.rst 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/Documentation/arm64/silicon-errata.rst 2022-11-29 07:06:46.000000000 +0000 @@ -52,6 +52,8 @@ | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | +----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A510 | #2457168 | ARM64_ERRATUM_2457168 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 | @@ -74,6 +76,8 @@ +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A55 | #1530923 | ARM64_ERRATUM_1530923 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A55 | #2441007 | ARM64_ERRATUM_2441007 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #852523 | N/A | diff -Nru linux-aws-5.19.0/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt linux-aws-5.19.0/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt --- linux-aws-5.19.0/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt 2022-11-29 07:06:46.000000000 +0000 @@ -34,8 +34,8 @@ Use specific request line passing from dma For example, MMC request line is 5 - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 0>; clocks = <&clk_apb>; diff -Nru linux-aws-5.19.0/Documentation/devicetree/bindings/iio/gyroscope/bosch,bmg160.yaml linux-aws-5.19.0/Documentation/devicetree/bindings/iio/gyroscope/bosch,bmg160.yaml --- linux-aws-5.19.0/Documentation/devicetree/bindings/iio/gyroscope/bosch,bmg160.yaml 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/devicetree/bindings/iio/gyroscope/bosch,bmg160.yaml 2022-11-29 07:06:46.000000000 +0000 @@ -24,8 +24,10 @@ interrupts: minItems: 1 + maxItems: 2 description: Should be configured with type IRQ_TYPE_EDGE_RISING. + If two interrupts are provided, expected order is INT1 and INT2. required: - compatible diff -Nru linux-aws-5.19.0/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml linux-aws-5.19.0/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml --- linux-aws-5.19.0/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml 2022-11-29 07:06:46.000000000 +0000 @@ -96,7 +96,7 @@ Documentation/devicetree/bindings/arm/cpus.yaml). required: - - fiq-index + - apple,fiq-index - cpus required: diff -Nru linux-aws-5.19.0/Documentation/filesystems/vfs.rst linux-aws-5.19.0/Documentation/filesystems/vfs.rst --- linux-aws-5.19.0/Documentation/filesystems/vfs.rst 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/filesystems/vfs.rst 2022-11-29 07:06:46.000000000 +0000 @@ -274,6 +274,9 @@ This is specifically for the inode itself being marked dirty, not its data. If the update needs to be persisted by fdatasync(), then I_DIRTY_DATASYNC will be set in the flags argument. + I_DIRTY_TIME will be set in the flags in case lazytime is enabled + and struct inode has times updated since the last ->dirty_inode + call. ``write_inode`` this method is called when the VFS needs to write an inode to diff -Nru linux-aws-5.19.0/Documentation/hwmon/asus_ec_sensors.rst linux-aws-5.19.0/Documentation/hwmon/asus_ec_sensors.rst --- linux-aws-5.19.0/Documentation/hwmon/asus_ec_sensors.rst 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/hwmon/asus_ec_sensors.rst 2022-11-29 07:06:46.000000000 +0000 @@ -13,12 +13,16 @@ * ROG CROSSHAIR VIII FORMULA * ROG CROSSHAIR VIII HERO * ROG CROSSHAIR VIII IMPACT + * ROG MAXIMUS XI HERO + * ROG MAXIMUS XI HERO (WI-FI) * ROG STRIX B550-E GAMING * ROG STRIX B550-I GAMING * ROG STRIX X570-E GAMING * ROG STRIX X570-E GAMING WIFI II * ROG STRIX X570-F GAMING * ROG STRIX X570-I GAMING + * ROG STRIX Z690-A GAMING WIFI D4 + * ROG ZENITH II EXTREME Authors: - Eugene Shalygin diff -Nru linux-aws-5.19.0/Documentation/input/joydev/joystick.rst linux-aws-5.19.0/Documentation/input/joydev/joystick.rst --- linux-aws-5.19.0/Documentation/input/joydev/joystick.rst 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/input/joydev/joystick.rst 2022-11-29 07:06:46.000000000 +0000 @@ -517,6 +517,7 @@ * AVB Mag Turbo Force * AVB Top Shot Pegasus * AVB Top Shot Force Feedback Racing Wheel +* Boeder Force Feedback Wheel * Logitech WingMan Force * Logitech WingMan Force Wheel * Guillemot Race Leader Force Feedback diff -Nru linux-aws-5.19.0/Documentation/process/code-of-conduct-interpretation.rst linux-aws-5.19.0/Documentation/process/code-of-conduct-interpretation.rst --- linux-aws-5.19.0/Documentation/process/code-of-conduct-interpretation.rst 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/Documentation/process/code-of-conduct-interpretation.rst 2022-11-29 07:06:46.000000000 +0000 @@ -51,7 +51,7 @@ uncertain how to handle situations that come up. It will not be considered a violation report unless you want it to be. If you are uncertain about approaching the TAB or any other maintainers, please -reach out to our conflict mediator, Mishi Choudhary . +reach out to our conflict mediator, Joanna Lee . In the end, "be kind to each other" is really what the end goal is for everybody. We know everyone is human and we all fail at times, but the diff -Nru linux-aws-5.19.0/drivers/acpi/acpi_fpdt.c linux-aws-5.19.0/drivers/acpi/acpi_fpdt.c --- linux-aws-5.19.0/drivers/acpi/acpi_fpdt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/acpi_fpdt.c 2022-11-29 07:06:46.000000000 +0000 @@ -143,6 +143,23 @@ static struct kobject *fpdt_kobj; +#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT +#include +static bool fpdt_address_valid(u64 address) +{ + /* + * On some systems the table contains invalid addresses + * with unsuppored high address bits set, check for this. + */ + return !(address >> boot_cpu_data.x86_phys_bits); +} +#else +static bool fpdt_address_valid(u64 address) +{ + return true; +} +#endif + static int fpdt_process_subtable(u64 address, u32 subtable_type) { struct fpdt_subtable_header *subtable_header; @@ -151,6 +168,11 @@ u32 length, offset; int result; + if (!fpdt_address_valid(address)) { + pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address); + return -EINVAL; + } + subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header)); if (!subtable_header) return -ENOMEM; diff -Nru linux-aws-5.19.0/drivers/acpi/acpi_pcc.c linux-aws-5.19.0/drivers/acpi/acpi_pcc.c --- linux-aws-5.19.0/drivers/acpi/acpi_pcc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/acpi_pcc.c 2022-11-29 07:06:46.000000000 +0000 @@ -23,6 +23,12 @@ #include +/* + * Arbitrary retries in case the remote processor is slow to respond + * to PCC commands + */ +#define PCC_CMD_WAIT_RETRIES_NUM 500 + struct pcc_data { struct pcc_mbox_chan *pcc_chan; void __iomem *pcc_comm_addr; @@ -63,6 +69,7 @@ if (IS_ERR(data->pcc_chan)) { pr_err("Failed to find PCC channel for subspace %d\n", ctx->subspace_id); + kfree(data); return AE_NOT_FOUND; } @@ -72,6 +79,8 @@ if (!data->pcc_comm_addr) { pr_err("Failed to ioremap PCC comm region mem for %d\n", ctx->subspace_id); + pcc_mbox_free_channel(data->pcc_chan); + kfree(data); return AE_NO_MEMORY; } @@ -86,6 +95,7 @@ { int ret; struct pcc_data *data = region_context; + u64 usecs_lat; reinit_completion(&data->done); @@ -96,10 +106,22 @@ if (ret < 0) return AE_ERROR; - if (data->pcc_chan->mchan->mbox->txdone_irq) - wait_for_completion(&data->done); + if (data->pcc_chan->mchan->mbox->txdone_irq) { + /* + * pcc_chan->latency is just a Nominal value. In reality the remote + * processor could be much slower to reply. So add an arbitrary + * amount of wait on top of Nominal. + */ + usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; + ret = wait_for_completion_timeout(&data->done, + usecs_to_jiffies(usecs_lat)); + if (ret == 0) { + pr_err("PCC command executed timeout!\n"); + return AE_TIME; + } + } - mbox_client_txdone(data->pcc_chan->mchan, ret); + mbox_chan_txdone(data->pcc_chan->mchan, ret); memcpy_fromio(value, data->pcc_comm_addr, data->ctx.length); diff -Nru linux-aws-5.19.0/drivers/acpi/acpi_video.c linux-aws-5.19.0/drivers/acpi/acpi_video.c --- linux-aws-5.19.0/drivers/acpi/acpi_video.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/acpi_video.c 2022-11-29 07:06:46.000000000 +0000 @@ -496,6 +496,22 @@ DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme. diff -Nru linux-aws-5.19.0/drivers/acpi/apei/ghes.c linux-aws-5.19.0/drivers/acpi/apei/ghes.c --- linux-aws-5.19.0/drivers/acpi/apei/ghes.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/apei/ghes.c 2022-11-29 07:06:46.000000000 +0000 @@ -985,7 +985,7 @@ ghes_estatus_cache_add(generic, estatus); } - if (task_work_pending && current->mm != &init_mm) { + if (task_work_pending && current->mm) { estatus_node->task_work.func = ghes_kick_task_work; estatus_node->task_work_cpu = smp_processor_id(); ret = task_work_add(current, &estatus_node->task_work, diff -Nru linux-aws-5.19.0/drivers/acpi/processor_idle.c linux-aws-5.19.0/drivers/acpi/processor_idle.c --- linux-aws-5.19.0/drivers/acpi/processor_idle.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/processor_idle.c 2022-11-29 07:06:46.000000000 +0000 @@ -530,10 +530,27 @@ /* No delay is needed if we are in guest */ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) return; + /* + * Modern (>=Nehalem) Intel systems use ACPI via intel_idle, + * not this code. Assume that any Intel systems using this + * are ancient and may need the dummy wait. This also assumes + * that the motivating chipset issue was Intel-only. + */ + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) + return; #endif - /* Dummy wait op - must do something useless after P_LVL2 read - because chipsets cannot guarantee that STPCLK# signal - gets asserted in time to freeze execution properly. */ + /* + * Dummy wait op - must do something useless after P_LVL2 read + * because chipsets cannot guarantee that STPCLK# signal gets + * asserted in time to freeze execution properly + * + * This workaround has been in place since the original ACPI + * implementation was merged, circa 2002. + * + * If a profile is pointing to this instruction, please first + * consider moving your system to a more modern idle + * mechanism. + */ inl(acpi_gbl_FADT.xpm_timer_block.address); } diff -Nru linux-aws-5.19.0/drivers/acpi/resource.c linux-aws-5.19.0/drivers/acpi/resource.c --- linux-aws-5.19.0/drivers/acpi/resource.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/resource.c 2022-11-29 07:06:46.000000000 +0000 @@ -399,6 +399,31 @@ { } }; +static const struct dmi_system_id asus_laptop[] = { + { + .ident = "Asus Vivobook K3402ZA", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"), + }, + }, + { + .ident = "Asus Vivobook K3502ZA", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"), + }, + }, + { + .ident = "Asus Vivobook S5402ZA", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"), + }, + }, + { } +}; + struct irq_override_cmp { const struct dmi_system_id *system; unsigned char irq; @@ -409,6 +434,7 @@ static const struct irq_override_cmp skip_override_table[] = { { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 }, + { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 }, }; static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, @@ -416,6 +442,16 @@ { int i; +#ifdef CONFIG_X86 + /* + * IRQ override isn't needed on modern AMD Zen systems and + * this override breaks active low IRQs on AMD Ryzen 6000 and + * newer systems. Skip it. + */ + if (boot_cpu_has(X86_FEATURE_ZEN)) + return false; +#endif + for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) { const struct irq_override_cmp *entry = &skip_override_table[i]; diff -Nru linux-aws-5.19.0/drivers/acpi/x86/utils.c linux-aws-5.19.0/drivers/acpi/x86/utils.c --- linux-aws-5.19.0/drivers/acpi/x86/utils.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/acpi/x86/utils.c 2022-11-29 07:06:46.000000000 +0000 @@ -207,9 +207,26 @@ {} }; +static const struct dmi_system_id force_storage_d3_dmi[] = { + { + /* + * _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME + * but .NVME is needed to get StorageD3Enable node + * https://bugzilla.kernel.org/show_bug.cgi?id=216440 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"), + } + }, + {} +}; + bool force_storage_d3(void) { - return x86_match_cpu(storage_d3_cpu_ids); + const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi); + + return dmi_id || x86_match_cpu(storage_d3_cpu_ids); } /* diff -Nru linux-aws-5.19.0/drivers/android/binder_alloc.c linux-aws-5.19.0/drivers/android/binder_alloc.c --- linux-aws-5.19.0/drivers/android/binder_alloc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/android/binder_alloc.c 2022-11-29 07:06:46.000000000 +0000 @@ -321,7 +321,6 @@ */ if (vma) { vm_start = vma->vm_start; - alloc->vma_vm_mm = vma->vm_mm; mmap_assert_write_locked(alloc->vma_vm_mm); } else { mmap_assert_locked(alloc->vma_vm_mm); @@ -794,7 +793,6 @@ binder_insert_free_buffer(alloc, buffer); alloc->free_async_space = alloc->buffer_size / 2; binder_alloc_set_vma(alloc, vma); - mmgrab(alloc->vma_vm_mm); return 0; @@ -1090,6 +1088,8 @@ void binder_alloc_init(struct binder_alloc *alloc) { alloc->pid = current->group_leader->pid; + alloc->vma_vm_mm = current->mm; + mmgrab(alloc->vma_vm_mm); mutex_init(&alloc->mutex); INIT_LIST_HEAD(&alloc->buffers); } diff -Nru linux-aws-5.19.0/drivers/android/binder.c linux-aws-5.19.0/drivers/android/binder.c --- linux-aws-5.19.0/drivers/android/binder.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/android/binder.c 2022-11-29 07:06:46.000000000 +0000 @@ -1385,6 +1385,18 @@ } ret = binder_inc_ref_olocked(ref, strong, target_list); *rdata = ref->data; + if (ret && ref == new_ref) { + /* + * Cleanup the failed reference here as the target + * could now be dead and have already released its + * references by now. Calling on the new reference + * with strong=0 and a tmp_refs will not decrement + * the node. The new_ref gets kfree'd below. + */ + binder_cleanup_ref_olocked(new_ref); + ref = NULL; + } + binder_proc_unlock(proc); if (new_ref && ref != new_ref) /* diff -Nru linux-aws-5.19.0/drivers/ata/libahci_platform.c linux-aws-5.19.0/drivers/ata/libahci_platform.c --- linux-aws-5.19.0/drivers/ata/libahci_platform.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/ata/libahci_platform.c 2022-11-29 07:06:46.000000000 +0000 @@ -451,14 +451,24 @@ } } - hpriv->nports = child_nodes = of_get_child_count(dev->of_node); + /* + * Too many sub-nodes most likely means having something wrong with + * the firmware. + */ + child_nodes = of_get_child_count(dev->of_node); + if (child_nodes > AHCI_MAX_PORTS) { + rc = -EINVAL; + goto err_out; + } /* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ - if (!child_nodes) + if (child_nodes) + hpriv->nports = child_nodes; + else hpriv->nports = 1; hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); diff -Nru linux-aws-5.19.0/drivers/ata/libata-core.c linux-aws-5.19.0/drivers/ata/libata-core.c --- linux-aws-5.19.0/drivers/ata/libata-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/ata/libata-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -3988,6 +3988,10 @@ { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, + /* These specific Pioneer models have LPM issues */ + { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM }, + { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, + /* Crucial BX100 SSD 500GB has broken LPM support */ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, diff -Nru linux-aws-5.19.0/drivers/base/arch_topology.c linux-aws-5.19.0/drivers/base/arch_topology.c --- linux-aws-5.19.0/drivers/base/arch_topology.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/arch_topology.c 2022-11-29 07:06:46.000000000 +0000 @@ -791,4 +791,23 @@ else if (of_have_populated_dt() && parse_dt_topology()) reset_cpu_topology(); } + +void store_cpu_topology(unsigned int cpuid) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; + + if (cpuid_topo->package_id != -1) + goto topology_populated; + + cpuid_topo->thread_id = -1; + cpuid_topo->core_id = cpuid; + cpuid_topo->package_id = cpu_to_node(cpuid); + + pr_debug("CPU%u: package %d core %d thread %d\n", + cpuid, cpuid_topo->package_id, cpuid_topo->core_id, + cpuid_topo->thread_id); + +topology_populated: + update_siblings_masks(cpuid); +} #endif diff -Nru linux-aws-5.19.0/drivers/base/dd.c linux-aws-5.19.0/drivers/base/dd.c --- linux-aws-5.19.0/drivers/base/dd.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/dd.c 2022-11-29 07:06:46.000000000 +0000 @@ -897,6 +897,11 @@ dev_dbg(dev, "Device match requests probe deferral\n"); dev->can_match = true; driver_deferred_probe_add(dev); + /* + * Device can't match with a driver right now, so don't attempt + * to match or bind with other drivers on the bus. + */ + return ret; } else if (ret < 0) { dev_dbg(dev, "Bus failed to match device: %d\n", ret); return ret; @@ -1136,6 +1141,11 @@ dev_dbg(dev, "Device match requests probe deferral\n"); dev->can_match = true; driver_deferred_probe_add(dev); + /* + * Driver could not match with device, but may match with + * another device on the bus. + */ + return 0; } else if (ret < 0) { dev_dbg(dev, "Bus failed to match device: %d\n", ret); return ret; diff -Nru linux-aws-5.19.0/drivers/base/driver.c linux-aws-5.19.0/drivers/base/driver.c --- linux-aws-5.19.0/drivers/base/driver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/driver.c 2022-11-29 07:06:46.000000000 +0000 @@ -63,6 +63,12 @@ if (len >= (PAGE_SIZE - 1)) return -EINVAL; + /* + * Compute the real length of the string in case userspace sends us a + * bunch of \0 characters like python likes to do. + */ + len = strlen(s); + if (!len) { /* Empty string passed - clear override */ device_lock(dev); diff -Nru linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.c linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.c --- linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -93,10 +93,9 @@ { struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev); - if (fw_sysfs->fw_upload_priv) { - free_fw_priv(fw_sysfs->fw_priv); - kfree(fw_sysfs->fw_upload_priv); - } + if (fw_sysfs->fw_upload_priv) + fw_upload_free(fw_sysfs); + kfree(fw_sysfs); } diff -Nru linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.h linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.h --- linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/firmware_loader/sysfs.h 2022-11-29 07:06:46.000000000 +0000 @@ -106,12 +106,17 @@ extern struct device_attribute dev_attr_remaining_size; int fw_upload_start(struct fw_sysfs *fw_sysfs); +void fw_upload_free(struct fw_sysfs *fw_sysfs); umode_t fw_upload_is_visible(struct kobject *kobj, struct attribute *attr, int n); #else static inline int fw_upload_start(struct fw_sysfs *fw_sysfs) { return 0; } + +static inline void fw_upload_free(struct fw_sysfs *fw_sysfs) +{ +} #endif #endif /* __FIRMWARE_SYSFS_H */ diff -Nru linux-aws-5.19.0/drivers/base/firmware_loader/sysfs_upload.c linux-aws-5.19.0/drivers/base/firmware_loader/sysfs_upload.c --- linux-aws-5.19.0/drivers/base/firmware_loader/sysfs_upload.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/firmware_loader/sysfs_upload.c 2022-11-29 07:06:46.000000000 +0000 @@ -264,6 +264,15 @@ return 0; } +void fw_upload_free(struct fw_sysfs *fw_sysfs) +{ + struct fw_upload_priv *fw_upload_priv = fw_sysfs->fw_upload_priv; + + free_fw_priv(fw_sysfs->fw_priv); + kfree(fw_upload_priv->fw_upload); + kfree(fw_upload_priv); +} + /** * firmware_upload_register() - register for the firmware upload sysfs API * @module: kernel module of this device @@ -377,6 +386,7 @@ { struct fw_sysfs *fw_sysfs = fw_upload->priv; struct fw_upload_priv *fw_upload_priv = fw_sysfs->fw_upload_priv; + struct module *module = fw_upload_priv->module; mutex_lock(&fw_upload_priv->lock); if (fw_upload_priv->progress == FW_UPLOAD_PROG_IDLE) { @@ -392,6 +402,6 @@ unregister: device_unregister(&fw_sysfs->dev); - module_put(fw_upload_priv->module); + module_put(module); } EXPORT_SYMBOL_GPL(firmware_upload_unregister); diff -Nru linux-aws-5.19.0/drivers/base/regmap/regmap-spi.c linux-aws-5.19.0/drivers/base/regmap/regmap-spi.c --- linux-aws-5.19.0/drivers/base/regmap/regmap-spi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/base/regmap/regmap-spi.c 2022-11-29 07:06:46.000000000 +0000 @@ -113,6 +113,7 @@ const struct regmap_config *config) { size_t max_size = spi_max_transfer_size(spi); + size_t max_msg_size, reg_reserve_size; struct regmap_bus *bus; if (max_size != SIZE_MAX) { @@ -120,9 +121,16 @@ if (!bus) return ERR_PTR(-ENOMEM); + max_msg_size = spi_max_message_size(spi); + reg_reserve_size = config->reg_bits / BITS_PER_BYTE + + config->pad_bits / BITS_PER_BYTE; + if (max_size + reg_reserve_size > max_msg_size) + max_size -= reg_reserve_size; + bus->free_on_exit = true; bus->max_raw_read = max_size; bus->max_raw_write = max_size; + return bus; } diff -Nru linux-aws-5.19.0/drivers/block/ataflop.c linux-aws-5.19.0/drivers/block/ataflop.c --- linux-aws-5.19.0/drivers/block/ataflop.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/ataflop.c 2022-11-29 07:06:46.000000000 +0000 @@ -2045,7 +2045,6 @@ if (!unit[i].disk[type]) continue; del_gendisk(unit[i].disk[type]); - blk_cleanup_queue(unit[i].disk[type]->queue); put_disk(unit[i].disk[type]); } blk_mq_free_tag_set(&unit[i].tag_set); diff -Nru linux-aws-5.19.0/drivers/block/loop.c linux-aws-5.19.0/drivers/block/loop.c --- linux-aws-5.19.0/drivers/block/loop.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/loop.c 2022-11-29 07:06:46.000000000 +0000 @@ -2062,7 +2062,6 @@ { /* Make this loop device unreachable from pathname. */ del_gendisk(lo->lo_disk); - blk_cleanup_queue(lo->lo_disk->queue); blk_mq_free_tag_set(&lo->tag_set); mutex_lock(&loop_ctl_mutex); diff -Nru linux-aws-5.19.0/drivers/block/mtip32xx/mtip32xx.c linux-aws-5.19.0/drivers/block/mtip32xx/mtip32xx.c --- linux-aws-5.19.0/drivers/block/mtip32xx/mtip32xx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/mtip32xx/mtip32xx.c 2022-11-29 07:06:46.000000000 +0000 @@ -3677,7 +3677,6 @@ if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag)) del_gendisk(dd->disk); - blk_cleanup_queue(dd->queue); blk_mq_free_tag_set(&dd->tags); put_disk(dd->disk); return 0; @@ -4040,7 +4039,6 @@ dev_info(&dd->pdev->dev, "device %s surprise removal\n", dd->disk->disk_name); - blk_cleanup_queue(dd->queue); blk_mq_free_tag_set(&dd->tags); /* De-initialize the protocol layer. */ diff -Nru linux-aws-5.19.0/drivers/block/nbd.c linux-aws-5.19.0/drivers/block/nbd.c --- linux-aws-5.19.0/drivers/block/nbd.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/nbd.c 2022-11-29 07:06:46.000000000 +0000 @@ -1414,10 +1414,12 @@ mutex_unlock(&nbd->config_lock); ret = wait_event_interruptible(config->recv_wq, atomic_read(&config->recv_threads) == 0); - if (ret) + if (ret) { sock_shutdown(nbd); - flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + } + flush_workqueue(nbd->recv_workq); mutex_lock(&nbd->config_lock); nbd_bdev_reset(nbd); /* user requested, ignore socket errors */ diff -Nru linux-aws-5.19.0/drivers/block/rnbd/rnbd-clt.c linux-aws-5.19.0/drivers/block/rnbd/rnbd-clt.c --- linux-aws-5.19.0/drivers/block/rnbd/rnbd-clt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/rnbd/rnbd-clt.c 2022-11-29 07:06:46.000000000 +0000 @@ -1755,7 +1755,7 @@ list_for_each_entry_safe(dev, tn, &sess->devs_list, list) { /* * Here unmap happens in parallel for only one reason: - * blk_cleanup_queue() takes around half a second, so + * del_gendisk() takes around half a second, so * on huge amount of devices the whole module unload * procedure takes minutes. */ diff -Nru linux-aws-5.19.0/drivers/block/sx8.c linux-aws-5.19.0/drivers/block/sx8.c --- linux-aws-5.19.0/drivers/block/sx8.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/sx8.c 2022-11-29 07:06:46.000000000 +0000 @@ -1536,7 +1536,7 @@ clear_bit(0, &carm_major_alloc); else if (host->major == 161) clear_bit(1, &carm_major_alloc); - blk_cleanup_queue(host->oob_q); + blk_mq_destroy_queue(host->oob_q); blk_mq_free_tag_set(&host->tag_set); err_out_dma_free: dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); @@ -1570,7 +1570,7 @@ clear_bit(0, &carm_major_alloc); else if (host->major == 161) clear_bit(1, &carm_major_alloc); - blk_cleanup_queue(host->oob_q); + blk_mq_destroy_queue(host->oob_q); blk_mq_free_tag_set(&host->tag_set); dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); iounmap(host->mmio); diff -Nru linux-aws-5.19.0/drivers/block/virtio_blk.c linux-aws-5.19.0/drivers/block/virtio_blk.c --- linux-aws-5.19.0/drivers/block/virtio_blk.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/virtio_blk.c 2022-11-29 07:06:46.000000000 +0000 @@ -322,14 +322,14 @@ if (unlikely(status)) return status; - blk_mq_start_request(req); - vbr->sg_table.nents = virtblk_map_data(hctx, req, vbr); if (unlikely(vbr->sg_table.nents < 0)) { virtblk_cleanup_cmd(req); return BLK_STS_RESOURCE; } + blk_mq_start_request(req); + return BLK_STS_OK; } @@ -391,8 +391,7 @@ } static bool virtblk_add_req_batch(struct virtio_blk_vq *vq, - struct request **rqlist, - struct request **requeue_list) + struct request **rqlist) { unsigned long flags; int err; @@ -408,7 +407,7 @@ if (err) { virtblk_unmap_data(req, vbr); virtblk_cleanup_cmd(req); - rq_list_add(requeue_list, req); + blk_mq_requeue_request(req, true); } } @@ -436,7 +435,7 @@ if (!next || req->mq_hctx != next->mq_hctx) { req->rq_next = NULL; - kick = virtblk_add_req_batch(vq, rqlist, &requeue_list); + kick = virtblk_add_req_batch(vq, rqlist); if (kick) virtqueue_notify(vq->vq); @@ -1107,7 +1106,6 @@ flush_work(&vblk->config_work); del_gendisk(vblk->disk); - blk_cleanup_queue(vblk->disk->queue); blk_mq_free_tag_set(&vblk->tag_set); mutex_lock(&vblk->vdev_mutex); diff -Nru linux-aws-5.19.0/drivers/block/xen-blkback/common.h linux-aws-5.19.0/drivers/block/xen-blkback/common.h --- linux-aws-5.19.0/drivers/block/xen-blkback/common.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/xen-blkback/common.h 2022-11-29 07:06:46.000000000 +0000 @@ -226,6 +226,9 @@ sector_t size; unsigned int flush_support:1; unsigned int discard_secure:1; + /* Connect-time cached feature_persistent parameter value */ + unsigned int feature_gnt_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_gnt_persistent:1; unsigned int overflow_max_grants:1; }; diff -Nru linux-aws-5.19.0/drivers/block/xen-blkback/xenbus.c linux-aws-5.19.0/drivers/block/xen-blkback/xenbus.c --- linux-aws-5.19.0/drivers/block/xen-blkback/xenbus.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/xen-blkback/xenbus.c 2022-11-29 07:06:46.000000000 +0000 @@ -907,7 +907,7 @@ xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - be->blkif->vbd.feature_gnt_persistent); + be->blkif->vbd.feature_gnt_persistent_parm); if (err) { xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", dev->nodename); @@ -1085,7 +1085,9 @@ return -ENOSYS; } - blkif->vbd.feature_gnt_persistent = feature_persistent && + blkif->vbd.feature_gnt_persistent_parm = feature_persistent; + blkif->vbd.feature_gnt_persistent = + blkif->vbd.feature_gnt_persistent_parm && xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); blkif->vbd.overflow_max_grants = 0; diff -Nru linux-aws-5.19.0/drivers/block/xen-blkfront.c linux-aws-5.19.0/drivers/block/xen-blkfront.c --- linux-aws-5.19.0/drivers/block/xen-blkfront.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/xen-blkfront.c 2022-11-29 07:06:46.000000000 +0000 @@ -217,6 +217,9 @@ unsigned int feature_fua:1; unsigned int feature_discard:1; unsigned int feature_secdiscard:1; + /* Connect-time cached feature_persistent parameter */ + unsigned int feature_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_persistent:1; unsigned int bounce:1; unsigned int discard_granularity; @@ -1781,6 +1784,12 @@ return err; } +/* Enable the persistent grants feature. */ +static bool feature_persistent = true; +module_param(feature_persistent, bool, 0644); +MODULE_PARM_DESC(feature_persistent, + "Enables the persistent grants feature"); + /* Common code used when first setting up, and when resuming. */ static int talk_to_blkback(struct xenbus_device *dev, struct blkfront_info *info) @@ -1872,8 +1881,9 @@ message = "writing protocol"; goto abort_transaction; } + info->feature_persistent_parm = feature_persistent; err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - info->feature_persistent); + info->feature_persistent_parm); if (err) dev_warn(&dev->dev, "writing persistent grants feature to xenbus"); @@ -1941,12 +1951,6 @@ return 0; } -/* Enable the persistent grants feature. */ -static bool feature_persistent = true; -module_param(feature_persistent, bool, 0644); -MODULE_PARM_DESC(feature_persistent, - "Enables the persistent grants feature"); - /* * Entry point to this code when a new device is created. Allocate the basic * structures and the ring buffer for communication with the backend, and @@ -2310,7 +2314,7 @@ if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) blkfront_setup_discard(info); - if (feature_persistent) + if (info->feature_persistent_parm) info->feature_persistent = !!xenbus_read_unsigned(info->xbdev->otherend, "feature-persistent", 0); diff -Nru linux-aws-5.19.0/drivers/block/z2ram.c linux-aws-5.19.0/drivers/block/z2ram.c --- linux-aws-5.19.0/drivers/block/z2ram.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/block/z2ram.c 2022-11-29 07:06:46.000000000 +0000 @@ -384,7 +384,6 @@ for (i = 0; i < Z2MINOR_COUNT; i++) { del_gendisk(z2ram_gendisk[i]); - blk_cleanup_queue(z2ram_gendisk[i]->queue); put_disk(z2ram_gendisk[i]); } blk_mq_free_tag_set(&tag_set); diff -Nru linux-aws-5.19.0/drivers/bluetooth/btintel.c linux-aws-5.19.0/drivers/bluetooth/btintel.c --- linux-aws-5.19.0/drivers/bluetooth/btintel.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/bluetooth/btintel.c 2022-11-29 07:06:46.000000000 +0000 @@ -2439,15 +2439,20 @@ INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + if (ver.hw_variant == 0x08 && ver.fw_variant == 0x22) + set_bit(HCI_QUIRK_VALID_LE_STATES, + &hdev->quirks); err = btintel_legacy_rom_setup(hdev, &ver); break; case 0x0b: /* SfP */ - case 0x0c: /* WsP */ case 0x11: /* JfP */ case 0x12: /* ThP */ case 0x13: /* HrP */ case 0x14: /* CcP */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + fallthrough; + case 0x0c: /* WsP */ /* Apply the device specific HCI quirks * * All Legacy bootloader devices support WBS @@ -2455,11 +2460,6 @@ set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, - &hdev->quirks); - /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); @@ -2530,9 +2530,8 @@ */ set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + /* Set Valid LE States quirk */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); diff -Nru linux-aws-5.19.0/drivers/bluetooth/btusb.c linux-aws-5.19.0/drivers/bluetooth/btusb.c --- linux-aws-5.19.0/drivers/bluetooth/btusb.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/bluetooth/btusb.c 2022-11-29 07:06:46.000000000 +0000 @@ -2463,15 +2463,29 @@ set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + /* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, + * it needs constantly polling control pipe until the host received the + * WMT event, thus, we should require to specifically acquire PM counter + * on the USB to prevent the interface from entering auto suspended + * while WMT cmd/event in progress. + */ + err = usb_autopm_get_interface(data->intf); + if (err < 0) + goto err_free_wc; + err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + usb_autopm_put_interface(data->intf); goto err_free_wc; } /* Submit control IN URB on demand to process the WMT event */ err = btusb_mtk_submit_wmt_recv_urb(hdev); + + usb_autopm_put_interface(data->intf); + if (err < 0) goto err_free_wc; diff -Nru linux-aws-5.19.0/drivers/bluetooth/hci_ldisc.c linux-aws-5.19.0/drivers/bluetooth/hci_ldisc.c --- linux-aws-5.19.0/drivers/bluetooth/hci_ldisc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/bluetooth/hci_ldisc.c 2022-11-29 07:06:46.000000000 +0000 @@ -493,6 +493,11 @@ BT_ERR("Can't allocate control structure"); return -ENFILE; } + if (percpu_init_rwsem(&hu->proto_lock)) { + BT_ERR("Can't allocate semaphore structure"); + kfree(hu); + return -ENOMEM; + } tty->disc_data = hu; hu->tty = tty; @@ -505,8 +510,6 @@ INIT_WORK(&hu->init_ready, hci_uart_init_work); INIT_WORK(&hu->write_work, hci_uart_write_work); - percpu_init_rwsem(&hu->proto_lock); - /* Flush any pending characters in the driver */ tty_driver_flush_buffer(tty); diff -Nru linux-aws-5.19.0/drivers/bluetooth/hci_serdev.c linux-aws-5.19.0/drivers/bluetooth/hci_serdev.c --- linux-aws-5.19.0/drivers/bluetooth/hci_serdev.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/bluetooth/hci_serdev.c 2022-11-29 07:06:46.000000000 +0000 @@ -310,11 +310,12 @@ serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops); + if (percpu_init_rwsem(&hu->proto_lock)) + return -ENOMEM; + err = serdev_device_open(hu->serdev); if (err) - return err; - - percpu_init_rwsem(&hu->proto_lock); + goto err_rwsem; err = p->open(hu); if (err) @@ -389,6 +390,8 @@ p->close(hu); err_open: serdev_device_close(hu->serdev); +err_rwsem: + percpu_free_rwsem(&hu->proto_lock); return err; } EXPORT_SYMBOL_GPL(hci_uart_register_device); @@ -410,5 +413,6 @@ clear_bit(HCI_UART_PROTO_READY, &hu->flags); serdev_device_close(hu->serdev); } + percpu_free_rwsem(&hu->proto_lock); } EXPORT_SYMBOL_GPL(hci_uart_unregister_device); diff -Nru linux-aws-5.19.0/drivers/cdrom/gdrom.c linux-aws-5.19.0/drivers/cdrom/gdrom.c --- linux-aws-5.19.0/drivers/cdrom/gdrom.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/cdrom/gdrom.c 2022-11-29 07:06:46.000000000 +0000 @@ -831,7 +831,6 @@ static int remove_gdrom(struct platform_device *devptr) { - blk_cleanup_queue(gd.gdrom_rq); blk_mq_free_tag_set(&gd.tag_set); free_irq(HW_EVENT_GDROM_CMD, &gd); free_irq(HW_EVENT_GDROM_DMA, &gd); diff -Nru linux-aws-5.19.0/drivers/char/hw_random/arm_smccc_trng.c linux-aws-5.19.0/drivers/char/hw_random/arm_smccc_trng.c --- linux-aws-5.19.0/drivers/char/hw_random/arm_smccc_trng.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/char/hw_random/arm_smccc_trng.c 2022-11-29 07:06:46.000000000 +0000 @@ -71,8 +71,6 @@ MAX_BITS_PER_CALL); arm_smccc_1_1_invoke(ARM_SMCCC_TRNG_RND, bits, &res); - if ((int)res.a0 < 0) - return (int)res.a0; switch ((int)res.a0) { case SMCCC_RET_SUCCESS: @@ -88,6 +86,8 @@ return copied; cond_resched(); break; + default: + return -EIO; } } diff -Nru linux-aws-5.19.0/drivers/char/hw_random/core.c linux-aws-5.19.0/drivers/char/hw_random/core.c --- linux-aws-5.19.0/drivers/char/hw_random/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/char/hw_random/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -507,16 +507,17 @@ rng->quality = current_quality; /* obsolete */ quality = rng->quality; mutex_unlock(&reading_mutex); + + if (rc <= 0) + hwrng_msleep(rng, 10000); + put_rng(rng); if (!quality) break; - if (rc <= 0) { - pr_warn("hwrng: no data available\n"); - msleep_interruptible(10000); + if (rc <= 0) continue; - } /* If we cannot credit at least one bit of entropy, * keep track of the remainder for the next iteration @@ -570,6 +571,7 @@ init_completion(&rng->cleanup_done); complete(&rng->cleanup_done); + init_completion(&rng->dying); if (!current_rng || (!cur_rng_set_by_user && rng->quality > current_rng->quality)) { @@ -617,6 +619,7 @@ old_rng = current_rng; list_del(&rng->list); + complete_all(&rng->dying); if (current_rng == rng) { err = enable_best_rng(); if (err) { @@ -685,6 +688,14 @@ } EXPORT_SYMBOL_GPL(devm_hwrng_unregister); +long hwrng_msleep(struct hwrng *rng, unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs) + 1; + + return wait_for_completion_interruptible_timeout(&rng->dying, timeout); +} +EXPORT_SYMBOL_GPL(hwrng_msleep); + static int __init hwrng_modinit(void) { int ret; diff -Nru linux-aws-5.19.0/drivers/char/hw_random/imx-rngc.c linux-aws-5.19.0/drivers/char/hw_random/imx-rngc.c --- linux-aws-5.19.0/drivers/char/hw_random/imx-rngc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/char/hw_random/imx-rngc.c 2022-11-29 07:06:46.000000000 +0000 @@ -270,13 +270,6 @@ goto err; } - ret = devm_request_irq(&pdev->dev, - irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; - } - init_completion(&rngc->rng_op_done); rngc->rng.name = pdev->name; @@ -290,6 +283,13 @@ imx_rngc_irq_mask_clear(rngc); + ret = devm_request_irq(&pdev->dev, + irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); + if (ret) { + dev_err(rngc->dev, "Can't get interrupt working.\n"); + return ret; + } + if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) { diff -Nru linux-aws-5.19.0/drivers/char/mem.c linux-aws-5.19.0/drivers/char/mem.c --- linux-aws-5.19.0/drivers/char/mem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/char/mem.c 2022-11-29 07:06:46.000000000 +0000 @@ -706,8 +706,8 @@ #endif [5] = { "zero", 0666, &zero_fops, FMODE_NOWAIT }, [7] = { "full", 0666, &full_fops, 0 }, - [8] = { "random", 0666, &random_fops, 0 }, - [9] = { "urandom", 0666, &urandom_fops, 0 }, + [8] = { "random", 0666, &random_fops, FMODE_NOWAIT }, + [9] = { "urandom", 0666, &urandom_fops, FMODE_NOWAIT }, #ifdef CONFIG_PRINTK [11] = { "kmsg", 0644, &kmsg_fops, 0 }, #endif diff -Nru linux-aws-5.19.0/drivers/char/random.c linux-aws-5.19.0/drivers/char/random.c --- linux-aws-5.19.0/drivers/char/random.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/char/random.c 2022-11-29 07:06:46.000000000 +0000 @@ -903,20 +903,23 @@ #endif struct fast_pool { - struct work_struct mix; unsigned long pool[4]; unsigned long last; unsigned int count; + struct timer_list mix; }; +static void mix_interrupt_randomness(struct timer_list *work); + static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { #ifdef CONFIG_64BIT #define FASTMIX_PERM SIPHASH_PERMUTATION - .pool = { SIPHASH_CONST_0, SIPHASH_CONST_1, SIPHASH_CONST_2, SIPHASH_CONST_3 } + .pool = { SIPHASH_CONST_0, SIPHASH_CONST_1, SIPHASH_CONST_2, SIPHASH_CONST_3 }, #else #define FASTMIX_PERM HSIPHASH_PERMUTATION - .pool = { HSIPHASH_CONST_0, HSIPHASH_CONST_1, HSIPHASH_CONST_2, HSIPHASH_CONST_3 } + .pool = { HSIPHASH_CONST_0, HSIPHASH_CONST_1, HSIPHASH_CONST_2, HSIPHASH_CONST_3 }, #endif + .mix = __TIMER_INITIALIZER(mix_interrupt_randomness, 0) }; /* @@ -958,7 +961,7 @@ } #endif -static void mix_interrupt_randomness(struct work_struct *work) +static void mix_interrupt_randomness(struct timer_list *work) { struct fast_pool *fast_pool = container_of(work, struct fast_pool, mix); /* @@ -989,7 +992,7 @@ local_irq_enable(); mix_pool_bytes(pool, sizeof(pool)); - credit_init_bits(max(1u, (count & U16_MAX) / 64)); + credit_init_bits(clamp_t(unsigned int, (count & U16_MAX) / 64, 1, sizeof(pool) * 8)); memzero_explicit(pool, sizeof(pool)); } @@ -1012,10 +1015,11 @@ if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ)) return; - if (unlikely(!fast_pool->mix.func)) - INIT_WORK(&fast_pool->mix, mix_interrupt_randomness); fast_pool->count |= MIX_INFLIGHT; - queue_work_on(raw_smp_processor_id(), system_highpri_wq, &fast_pool->mix); + if (!timer_pending(&fast_pool->mix)) { + fast_pool->mix.expires = jiffies; + add_timer_on(&fast_pool->mix, raw_smp_processor_id()); + } } EXPORT_SYMBOL_GPL(add_interrupt_randomness); @@ -1174,7 +1178,7 @@ */ static void __cold try_to_generate_entropy(void) { - enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 30 }; + enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 15 }; struct entropy_timer_state stack; unsigned int i, num_different = 0; unsigned long last = random_get_entropy(); @@ -1193,7 +1197,7 @@ timer_setup_on_stack(&stack.timer, entropy_timer, 0); while (!crng_ready() && !signal_pending(current)) { if (!timer_pending(&stack.timer)) - mod_timer(&stack.timer, jiffies + 1); + mod_timer(&stack.timer, jiffies); mix_pool_bytes(&stack.entropy, sizeof(stack.entropy)); schedule(); stack.entropy = random_get_entropy(); @@ -1330,6 +1334,11 @@ { int ret; + if (!crng_ready() && + ((kiocb->ki_flags & (IOCB_NOWAIT | IOCB_NOIO)) || + (kiocb->ki_filp->f_flags & O_NONBLOCK))) + return -EAGAIN; + ret = wait_for_random_bytes(); if (ret != 0) return ret; diff -Nru linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.c linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.c --- linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.c 2022-11-29 07:06:46.000000000 +0000 @@ -34,6 +34,7 @@ #define CCU_DIV_CTL_CLKDIV_MASK(_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD) #define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28) #define CCU_DIV_CTL_LOCK_NORMAL BIT(31) #define CCU_DIV_RST_DELAY_US 1 @@ -170,6 +171,40 @@ return !!(val & CCU_DIV_CTL_EN); } +static int ccu_div_buf_enable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, 0); + spin_unlock_irqrestore(&div->lock, flags); + + return 0; +} + +static void ccu_div_buf_disable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, CCU_DIV_CTL_GATE_REF_BUF); + spin_unlock_irqrestore(&div->lock, flags); +} + +static int ccu_div_buf_is_enabled(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + u32 val = 0; + + regmap_read(div->sys_regs, div->reg_ctl, &val); + + return !(val & CCU_DIV_CTL_GATE_REF_BUF); +} + static unsigned long ccu_div_var_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -323,6 +358,7 @@ CCU_DIV_DBGFS_BIT_ATTR("div_en", CCU_DIV_CTL_EN), CCU_DIV_DBGFS_BIT_ATTR("div_rst", CCU_DIV_CTL_RST), CCU_DIV_DBGFS_BIT_ATTR("div_bypass", CCU_DIV_CTL_SET_CLKDIV), + CCU_DIV_DBGFS_BIT_ATTR("div_buf", CCU_DIV_CTL_GATE_REF_BUF), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) }; @@ -441,6 +477,9 @@ continue; } + if (!strcmp("div_buf", name)) + continue; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div; @@ -477,6 +516,21 @@ &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) +{ + struct ccu_div *div = to_ccu_div(hw); + struct ccu_div_dbgfs_bit *bit; + + bit = kmalloc(sizeof(*bit), GFP_KERNEL); + if (!bit) + return; + + *bit = ccu_div_bits[3]; + bit->div = div; + debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} + static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) { struct ccu_div *div = to_ccu_div(hw); @@ -489,6 +543,7 @@ #define ccu_div_var_debug_init NULL #define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL #define ccu_div_fixed_debug_init NULL #endif /* !CONFIG_DEBUG_FS */ @@ -520,6 +575,13 @@ .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; + static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate, @@ -566,6 +628,8 @@ } else if (div_init->type == CCU_DIV_GATE) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + } else if (div_init->type == CCU_DIV_BUF) { + hw_init.ops = &ccu_div_buf_ops; } else if (div_init->type == CCU_DIV_FIXED) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider; @@ -579,6 +643,7 @@ goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents = 1; diff -Nru linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.h linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.h --- linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/baikal-t1/ccu-div.h 2022-11-29 07:06:46.000000000 +0000 @@ -14,6 +14,14 @@ #include /* + * CCU Divider private clock IDs + * @CCU_SYS_SATA_CLK: CCU SATA internal clock + * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock + */ +#define CCU_SYS_SATA_CLK -1 +#define CCU_SYS_XGMAC_CLK -2 + +/* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1. * It can be 0 though, which is functionally the same. @@ -31,11 +39,13 @@ * enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. + * @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type { CCU_DIV_VAR, CCU_DIV_GATE, + CCU_DIV_BUF, CCU_DIV_FIXED }; diff -Nru linux-aws-5.19.0/drivers/clk/baikal-t1/clk-ccu-div.c linux-aws-5.19.0/drivers/clk/baikal-t1/clk-ccu-div.c --- linux-aws-5.19.0/drivers/clk/baikal-t1/clk-ccu-div.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/baikal-t1/clk-ccu-div.c 2022-11-29 07:06:46.000000000 +0000 @@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO(_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } + #define CCU_DIV_FIXED_INFO(_id, _name, _pname, _divider) \ { \ .id = _id, \ @@ -188,11 +198,14 @@ * for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { - CCU_DIV_VAR_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + CCU_DIV_VAR_INFO(CCU_SYS_SATA_CLK, "sys_sata_clk", "sata_clk", CCU_SYS_SATA_REF_BASE, 4, CLK_SET_RATE_GATE, CCU_DIV_SKIP_ONE | CCU_DIV_LOCK_SHIFTED | CCU_DIV_RESET_DOMAIN), + CCU_DIV_BUF_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + "sys_sata_clk", CCU_SYS_SATA_REF_BASE, + CLK_SET_RATE_PARENT), CCU_DIV_VAR_INFO(CCU_SYS_APB_CLK, "sys_apb_clk", "pcie_clk", CCU_SYS_APB_BASE, 5, CLK_IS_CRITICAL, CCU_DIV_RESET_DOMAIN), @@ -204,10 +217,12 @@ "eth_clk", CCU_SYS_GMAC1_BASE, 5), CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk", "eth_clk", 10), - CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", - "eth_clk", CCU_SYS_XGMAC_BASE, 8), + CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk", + "eth_clk", CCU_SYS_XGMAC_BASE, 1), + CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", + "sys_xgmac_clk", 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 10), + "sys_xgmac_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", @@ -396,6 +411,9 @@ init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + } else if (init.type == CCU_DIV_BUF) { + init.base = info->base; + init.sys_regs = data->sys_regs; } else { init.divider = info->divider; } diff -Nru linux-aws-5.19.0/drivers/clk/bcm/clk-bcm2835.c linux-aws-5.19.0/drivers/clk/bcm/clk-bcm2835.c --- linux-aws-5.19.0/drivers/clk/bcm/clk-bcm2835.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/bcm/clk-bcm2835.c 2022-11-29 07:06:46.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -502,6 +503,8 @@ bool low_jitter; u32 tcnt_mux; + + bool round_up; }; struct bcm2835_gate_data { @@ -966,9 +969,9 @@ return div; } -static long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, - unsigned long parent_rate, - u32 div) +static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, + unsigned long parent_rate, + u32 div) { const struct bcm2835_clock_data *data = clock->data; u64 temp; @@ -993,12 +996,34 @@ return temp; } +static unsigned long bcm2835_round_rate(unsigned long rate) +{ + unsigned long scaler; + unsigned long limit; + + limit = rate / 100000; + + scaler = 1; + while (scaler < limit) + scaler *= 10; + + /* + * If increasing a clock by less than 0.1% changes it + * from ..999.. to ..000.., round up. + */ + if ((rate + scaler - 1) / scaler % 1000 == 0) + rate = roundup(rate, scaler); + + return rate; +} + static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, unsigned long parent_rate) { struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman = clock->cprman; const struct bcm2835_clock_data *data = clock->data; + unsigned long rate; u32 div; if (data->int_bits == 0 && data->frac_bits == 0) @@ -1006,7 +1031,12 @@ div = cprman_read(cprman, data->div_reg); - return bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + rate = bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + + if (data->round_up) + rate = bcm2835_round_rate(rate); + + return rate; } static void bcm2835_clock_wait_busy(struct bcm2835_clock *clock) @@ -1784,7 +1814,7 @@ .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), /* * PLLD is the display PLL, used to drive DSI display panels. @@ -2143,7 +2173,8 @@ .div_reg = CM_UARTDIV, .int_bits = 10, .frac_bits = 12, - .tcnt_mux = 28), + .tcnt_mux = 28, + .round_up = true), /* TV encoder clock. Only operating frequency is 108Mhz. */ [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK( diff -Nru linux-aws-5.19.0/drivers/clk/bcm/clk-iproc-pll.c linux-aws-5.19.0/drivers/clk/bcm/clk-iproc-pll.c --- linux-aws-5.19.0/drivers/clk/bcm/clk-iproc-pll.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/bcm/clk-iproc-pll.c 2022-11-29 07:06:46.000000000 +0000 @@ -736,6 +736,7 @@ const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -783,7 +784,12 @@ iclk = &iclk_array[0]; iclk->pll = pll; - init.name = node->name; + ret = of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name = clk_name; init.ops = &iproc_pll_ops; init.flags = 0; parent_name = of_clk_get_parent_name(node, 0); @@ -803,13 +809,11 @@ goto err_pll_register; clk_data->hws[0] = &iclk->hw; + parent_name = clk_name; /* now initialize and register all leaf clocks */ for (i = 1; i < num_clks; i++) { - const char *clk_name; - memset(&init, 0, sizeof(init)); - parent_name = node->name; ret = of_property_read_string_index(node, "clock-output-names", i, &clk_name); diff -Nru linux-aws-5.19.0/drivers/clk/bcm/clk-raspberrypi.c linux-aws-5.19.0/drivers/clk/bcm/clk-raspberrypi.c --- linux-aws-5.19.0/drivers/clk/bcm/clk-raspberrypi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/bcm/clk-raspberrypi.c 2022-11-29 07:06:46.000000000 +0000 @@ -203,7 +203,7 @@ ret = raspberrypi_clock_property(rpi->firmware, data, RPI_FIRMWARE_GET_CLOCK_RATE, &val); if (ret) - return ret; + return 0; return val; } @@ -220,7 +220,7 @@ ret = raspberrypi_clock_property(rpi->firmware, data, RPI_FIRMWARE_SET_CLOCK_RATE, &_rate); if (ret) - dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d", + dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d\n", clk_hw_get_name(hw), ret); return ret; @@ -288,7 +288,7 @@ RPI_FIRMWARE_GET_MIN_CLOCK_RATE, &min_rate); if (ret) { - dev_err(rpi->dev, "Failed to get clock %d min freq: %d", + dev_err(rpi->dev, "Failed to get clock %d min freq: %d\n", id, ret); return ERR_PTR(ret); } @@ -344,8 +344,13 @@ struct rpi_firmware_get_clocks_response *clks; int ret; + /* + * The firmware doesn't guarantee that the last element of + * RPI_FIRMWARE_GET_CLOCKS is zeroed. So allocate an additional + * zero element as sentinel. + */ clks = devm_kcalloc(rpi->dev, - RPI_FIRMWARE_NUM_CLK_ID, sizeof(*clks), + RPI_FIRMWARE_NUM_CLK_ID + 1, sizeof(*clks), GFP_KERNEL); if (!clks) return -ENOMEM; @@ -360,7 +365,7 @@ struct raspberrypi_clk_variant *variant; if (clks->id > RPI_FIRMWARE_NUM_CLK_ID) { - dev_err(rpi->dev, "Unknown clock id: %u", clks->id); + dev_err(rpi->dev, "Unknown clock id: %u\n", clks->id); return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/clk/berlin/bg2.c linux-aws-5.19.0/drivers/clk/berlin/bg2.c --- linux-aws-5.19.0/drivers/clk/berlin/bg2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/berlin/bg2.c 2022-11-29 07:06:46.000000000 +0000 @@ -500,12 +500,15 @@ int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!gbase) return; diff -Nru linux-aws-5.19.0/drivers/clk/berlin/bg2q.c linux-aws-5.19.0/drivers/clk/berlin/bg2q.c --- linux-aws-5.19.0/drivers/clk/berlin/bg2q.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/berlin/bg2q.c 2022-11-29 07:06:46.000000000 +0000 @@ -286,19 +286,23 @@ int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); if (!gbase) { + of_node_put(parent_np); pr_err("%pOF: Unable to map global base\n", np); return; } /* BG2Q CPU PLL is not part of global registers */ cpupll_base = of_iomap(parent_np, 1); + of_node_put(parent_np); if (!cpupll_base) { pr_err("%pOF: Unable to map cpupll base\n", np); iounmap(gbase); diff -Nru linux-aws-5.19.0/drivers/clk/clk-ast2600.c linux-aws-5.19.0/drivers/clk/clk-ast2600.c --- linux-aws-5.19.0/drivers/clk/clk-ast2600.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/clk-ast2600.c 2022-11-29 07:06:46.000000000 +0000 @@ -622,7 +622,7 @@ regmap_write(map, 0x308, 0x12000); /* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw = clk_hw_register_divider_table(dev, "bclk", "hpll", 0, + hw = clk_hw_register_divider_table(dev, "bclk", "epll", 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, 20, 3, 0, ast2600_div_table, &aspeed_g6_clk_lock); diff -Nru linux-aws-5.19.0/drivers/clk/clk.c linux-aws-5.19.0/drivers/clk/clk.c --- linux-aws-5.19.0/drivers/clk/clk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/clk.c 2022-11-29 07:06:46.000000000 +0000 @@ -840,10 +840,9 @@ if (core->ops->unprepare) core->ops->unprepare(core->hw); - clk_pm_runtime_put(core); - trace_clk_unprepare_complete(core); clk_core_unprepare(core->parent); + clk_pm_runtime_put(core); } static void clk_core_unprepare_lock(struct clk_core *core) diff -Nru linux-aws-5.19.0/drivers/clk/clk-oxnas.c linux-aws-5.19.0/drivers/clk/clk-oxnas.c --- linux-aws-5.19.0/drivers/clk/clk-oxnas.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/clk-oxnas.c 2022-11-29 07:06:46.000000000 +0000 @@ -207,7 +207,7 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node, *parent_np; const struct oxnas_stdclk_data *data; struct regmap *regmap; int ret; @@ -215,7 +215,9 @@ data = of_device_get_match_data(&pdev->dev); - regmap = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "failed to have parent regmap\n"); return PTR_ERR(regmap); diff -Nru linux-aws-5.19.0/drivers/clk/clk-qoriq.c linux-aws-5.19.0/drivers/clk/clk-qoriq.c --- linux-aws-5.19.0/drivers/clk/clk-qoriq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/clk-qoriq.c 2022-11-29 07:06:46.000000000 +0000 @@ -1063,8 +1063,13 @@ */ static void __init legacy_init_clockgen(struct device_node *np) { - if (!clockgen.node) - _clockgen_init(of_get_parent(np), true); + if (!clockgen.node) { + struct device_node *parent_np; + + parent_np = of_get_parent(np); + _clockgen_init(parent_np, true); + of_node_put(parent_np); + } } /* Legacy node */ @@ -1159,6 +1164,7 @@ sysclk = of_get_child_by_name(clockgen.node, "sysclk"); if (sysclk) { clk = sysclk_from_fixed(sysclk, name); + of_node_put(sysclk); if (!IS_ERR(clk)) return clk; } diff -Nru linux-aws-5.19.0/drivers/clk/clk-versaclock5.c linux-aws-5.19.0/drivers/clk/clk-versaclock5.c --- linux-aws-5.19.0/drivers/clk/clk-versaclock5.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/clk-versaclock5.c 2022-11-29 07:06:46.000000000 +0000 @@ -1204,7 +1204,7 @@ .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, }; static const struct vc5_chip_info idt_5p49v6965_info = { diff -Nru linux-aws-5.19.0/drivers/clk/imx/clk-imx6sx.c linux-aws-5.19.0/drivers/clk/imx/clk-imx6sx.c --- linux-aws-5.19.0/drivers/clk/imx/clk-imx6sx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/imx/clk-imx6sx.c 2022-11-29 07:06:46.000000000 +0000 @@ -280,13 +280,13 @@ hws[IMX6SX_CLK_SSI3_SEL] = imx_clk_hw_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); hws[IMX6SX_CLK_SSI2_SEL] = imx_clk_hw_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); hws[IMX6SX_CLK_SSI1_SEL] = imx_clk_hw_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); - hws[IMX6SX_CLK_QSPI1_SEL] = imx_clk_hw_mux_flags("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels), CLK_SET_RATE_PARENT); + hws[IMX6SX_CLK_QSPI1_SEL] = imx_clk_hw_mux("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels)); hws[IMX6SX_CLK_PERCLK_SEL] = imx_clk_hw_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); hws[IMX6SX_CLK_VID_SEL] = imx_clk_hw_mux("vid_sel", base + 0x20, 21, 3, vid_sels, ARRAY_SIZE(vid_sels)); hws[IMX6SX_CLK_ESAI_SEL] = imx_clk_hw_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_CAN_SEL] = imx_clk_hw_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); hws[IMX6SX_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); - hws[IMX6SX_CLK_QSPI2_SEL] = imx_clk_hw_mux_flags("qspi2_sel", base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels), CLK_SET_RATE_PARENT); + hws[IMX6SX_CLK_QSPI2_SEL] = imx_clk_hw_mux("qspi2_sel", base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels)); hws[IMX6SX_CLK_SPDIF_SEL] = imx_clk_hw_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_AUDIO_SEL] = imx_clk_hw_mux("audio_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_ENET_PRE_SEL] = imx_clk_hw_mux("enet_pre_sel", base + 0x34, 15, 3, enet_pre_sels, ARRAY_SIZE(enet_pre_sels)); diff -Nru linux-aws-5.19.0/drivers/clk/imx/clk-imx93.c linux-aws-5.19.0/drivers/clk/imx/clk-imx93.c --- linux-aws-5.19.0/drivers/clk/imx/clk-imx93.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/imx/clk-imx93.c 2022-11-29 07:06:46.000000000 +0000 @@ -332,7 +332,7 @@ .driver = { .name = "imx93-ccm", .suppress_bind_attrs = true, - .of_match_table = of_match_ptr(imx93_clk_of_match), + .of_match_table = imx93_clk_of_match, }, }; module_platform_driver(imx93_clk_driver); diff -Nru linux-aws-5.19.0/drivers/clk/imx/clk-scu.c linux-aws-5.19.0/drivers/clk/imx/clk-scu.c --- linux-aws-5.19.0/drivers/clk/imx/clk-scu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/imx/clk-scu.c 2022-11-29 07:06:46.000000000 +0000 @@ -695,7 +695,11 @@ pr_warn("%s: failed to attached the power domain %d\n", name, ret); - platform_device_add(pdev); + ret = platform_device_add(pdev); + if (ret) { + platform_device_put(pdev); + return ERR_PTR(ret); + } /* For API backwards compatiblilty, simply return NULL for success */ return NULL; diff -Nru linux-aws-5.19.0/drivers/clk/ingenic/tcu.c linux-aws-5.19.0/drivers/clk/ingenic/tcu.c --- linux-aws-5.19.0/drivers/clk/ingenic/tcu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ingenic/tcu.c 2022-11-29 07:06:46.000000000 +0000 @@ -101,15 +101,11 @@ bool enabled = false; /* - * If the SoC has no global TCU clock, we must ungate the channel's - * clock to be able to access its registers. - * If we have a TCU clock, it will be enabled automatically as it has - * been attached to the regmap. + * According to the programming manual, a timer channel's registers can + * only be accessed when the channel's stop bit is clear. */ - if (!tcu->clk) { - enabled = !!ingenic_tcu_is_enabled(hw); - regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit)); - } + enabled = !!ingenic_tcu_is_enabled(hw); + regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit)); return enabled; } @@ -120,8 +116,7 @@ const struct ingenic_tcu_clk_info *info = tcu_clk->info; struct ingenic_tcu *tcu = tcu_clk->tcu; - if (!tcu->clk) - regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit)); + regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit)); } static u8 ingenic_tcu_get_parent(struct clk_hw *hw) diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8183-mfgcfg.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8183-mfgcfg.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8183-mfgcfg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8183-mfgcfg.c 2022-11-29 07:06:46.000000000 +0000 @@ -18,9 +18,9 @@ .sta_ofs = 0x0, }; -#define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \ - &mtk_clk_gate_ops_setclr) +#define GATE_MFG(_id, _name, _parent, _shift) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0) diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-infra_ao.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-infra_ao.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-infra_ao.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-infra_ao.c 2022-11-29 07:06:46.000000000 +0000 @@ -54,8 +54,12 @@ #define GATE_INFRA_AO1(_id, _name, _parent, _shift) \ GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag) \ + GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flag) + #define GATE_INFRA_AO2(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0) #define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag) \ GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \ @@ -135,8 +139,11 @@ GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_SYS, "infra_ao_unipro_sys", "top_ufs", 11), GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_TICK, "infra_ao_unipro_tick", "top_ufs_tick1us", 12), GATE_INFRA_AO2(CLK_INFRA_AO_UFS_MP_SAP_B, "infra_ao_ufs_mp_sap_b", "top_ufs_mp_sap_cfg", 13), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17), + /* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15, + CLK_IS_CRITICAL), + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17, + CLK_IS_CRITICAL), GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_B, "infra_ao_apdma_b", "top_axi", 18), GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25), GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26), diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-mfg.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-mfg.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-mfg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-mfg.c 2022-11-29 07:06:46.000000000 +0000 @@ -17,10 +17,12 @@ }; #define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, \ + _shift, &mtk_clk_gate_ops_setclr, \ + CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { - GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "top_mfg_core_tmp", 0), + GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_ck_fast_ref", 0), }; static const struct mtk_clk_desc mfg_desc = { diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo0.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo0.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo0.c 2022-11-29 07:06:46.000000000 +0000 @@ -37,6 +37,10 @@ #define GATE_VDO0_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO0_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + static const struct mtk_gate vdo0_clks[] = { /* VDO0_0 */ GATE_VDO0_0(CLK_VDO0_DISP_OVL0, "vdo0_disp_ovl0", "top_vpp", 0), @@ -85,7 +89,8 @@ /* VDO0_2 */ GATE_VDO0_2(CLK_VDO0_DSI0_DSI, "vdo0_dsi0_dsi", "top_dsi_occ", 0), GATE_VDO0_2(CLK_VDO0_DSI1_DSI, "vdo0_dsi1_dsi", "top_dsi_occ", 8), - GATE_VDO0_2(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", "top_edp", 16), + GATE_VDO0_2_FLAGS(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", + "top_edp", 16, CLK_SET_RATE_PARENT), }; static int clk_mt8195_vdo0_probe(struct platform_device *pdev) diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo1.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo1.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mt8195-vdo1.c 2022-11-29 07:06:46.000000000 +0000 @@ -43,6 +43,10 @@ #define GATE_VDO1_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO1_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo1_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + #define GATE_VDO1_3(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_3_cg_regs, _shift, &mtk_clk_gate_ops_setclr) @@ -99,7 +103,7 @@ GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI0, "vdo1_disp_monitor_dpi0", "top_vpp", 1), GATE_VDO1_2(CLK_VDO1_DPI1, "vdo1_dpi1", "top_vpp", 8), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI1, "vdo1_disp_monitor_dpi1", "top_vpp", 9), - GATE_VDO1_2(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_vpp", 16), + GATE_VDO1_2_FLAGS(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_dp", 16, CLK_SET_RATE_PARENT), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPINTF, "vdo1_disp_monitor_dpintf", "top_vpp", 17), /* VDO1_3 */ GATE_VDO1_3(CLK_VDO1_26M_SLOW, "vdo1_26m_slow", "clk26m", 8), diff -Nru linux-aws-5.19.0/drivers/clk/mediatek/clk-mtk.c linux-aws-5.19.0/drivers/clk/mediatek/clk-mtk.c --- linux-aws-5.19.0/drivers/clk/mediatek/clk-mtk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/mediatek/clk-mtk.c 2022-11-29 07:06:46.000000000 +0000 @@ -80,7 +80,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } @@ -102,7 +102,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } } @@ -146,7 +146,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } @@ -168,7 +168,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } } @@ -393,7 +393,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - mtk_clk_unregister_composite(clk_data->hws[mcd->id]); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } @@ -414,7 +414,7 @@ if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - clk_unregister_divider(clk_data->hws[mcd->id]->clk); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } } diff -Nru linux-aws-5.19.0/drivers/clk/meson/meson8b.c linux-aws-5.19.0/drivers/clk/meson/meson8b.c --- linux-aws-5.19.0/drivers/clk/meson/meson8b.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/meson/meson8b.c 2022-11-29 07:06:46.000000000 +0000 @@ -3792,12 +3792,15 @@ struct clk_hw_onecell_data *clk_hw_onecell_data) { struct meson8b_clk_reset *rstc; + struct device_node *parent_np; const char *notifier_clk_name; struct clk *notifier_clk; struct regmap *map; int i, ret; - map = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { pr_err("failed to get HHI regmap - Trying obsolete regs\n"); return; diff -Nru linux-aws-5.19.0/drivers/clk/meson/meson-aoclk.c linux-aws-5.19.0/drivers/clk/meson/meson-aoclk.c --- linux-aws-5.19.0/drivers/clk/meson/meson-aoclk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/meson/meson-aoclk.c 2022-11-29 07:06:46.000000000 +0000 @@ -38,6 +38,7 @@ struct meson_aoclk_reset_controller *rstc; struct meson_aoclk_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *regmap; int ret, clkid; @@ -49,7 +50,9 @@ if (!rstc) return -ENOMEM; - regmap = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + regmap = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap\n"); return PTR_ERR(regmap); diff -Nru linux-aws-5.19.0/drivers/clk/meson/meson-eeclk.c linux-aws-5.19.0/drivers/clk/meson/meson-eeclk.c --- linux-aws-5.19.0/drivers/clk/meson/meson-eeclk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/meson/meson-eeclk.c 2022-11-29 07:06:46.000000000 +0000 @@ -18,6 +18,7 @@ { const struct meson_eeclkc_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *map; int ret, i; @@ -26,7 +27,9 @@ return -EINVAL; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); diff -Nru linux-aws-5.19.0/drivers/clk/microchip/clk-mpfs.c linux-aws-5.19.0/drivers/clk/microchip/clk-mpfs.c --- linux-aws-5.19.0/drivers/clk/microchip/clk-mpfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/microchip/clk-mpfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -239,6 +239,11 @@ .hw.init = CLK_HW_INIT(_name, _parent, &mpfs_clk_cfg_ops, 0), \ } +#define CLK_CPU_OFFSET 0u +#define CLK_AXI_OFFSET 1u +#define CLK_AHB_OFFSET 2u +#define CLK_RTCREF_OFFSET 3u + static struct mpfs_cfg_hw_clock mpfs_cfg_clks[] = { CLK_CFG(CLK_CPU, "clk_cpu", "clk_msspll", 0, 2, mpfs_div_cpu_axi_table, 0, REG_CLOCK_CONFIG_CR), @@ -362,7 +367,7 @@ _flags), \ } -#define PARENT_CLK(PARENT) (&mpfs_cfg_clks[CLK_##PARENT].hw) +#define PARENT_CLK(PARENT) (&mpfs_cfg_clks[CLK_##PARENT##_OFFSET].hw) /* * Critical clocks: @@ -370,6 +375,8 @@ * trap handler * - CLK_MMUART0: reserved by the hss * - CLK_DDRC: provides clock to the ddr subsystem + * - CLK_RTC: the onboard RTC's AHB bus clock must be kept running as the rtc will stop + * if the AHB interface clock is disabled * - CLK_FICx: these provide the processor side clocks to the "FIC" (Fabric InterConnect) * clock domain crossers which provide the interface to the FPGA fabric. Disabling them * causes the FPGA fabric to go into reset. @@ -394,7 +401,7 @@ CLK_PERIPH(CLK_CAN0, "clk_periph_can0", PARENT_CLK(AHB), 14, 0), CLK_PERIPH(CLK_CAN1, "clk_periph_can1", PARENT_CLK(AHB), 15, 0), CLK_PERIPH(CLK_USB, "clk_periph_usb", PARENT_CLK(AHB), 16, 0), - CLK_PERIPH(CLK_RTC, "clk_periph_rtc", PARENT_CLK(AHB), 18, 0), + CLK_PERIPH(CLK_RTC, "clk_periph_rtc", PARENT_CLK(AHB), 18, CLK_IS_CRITICAL), CLK_PERIPH(CLK_QSPI, "clk_periph_qspi", PARENT_CLK(AHB), 19, 0), CLK_PERIPH(CLK_GPIO0, "clk_periph_gpio0", PARENT_CLK(AHB), 20, 0), CLK_PERIPH(CLK_GPIO1, "clk_periph_gpio1", PARENT_CLK(AHB), 21, 0), diff -Nru linux-aws-5.19.0/drivers/clk/qcom/apss-ipq6018.c linux-aws-5.19.0/drivers/clk/qcom/apss-ipq6018.c --- linux-aws-5.19.0/drivers/clk/qcom/apss-ipq6018.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/qcom/apss-ipq6018.c 2022-11-29 07:06:46.000000000 +0000 @@ -57,7 +57,7 @@ .parent_hws = (const struct clk_hw *[]){ &apcs_alias0_clk_src.clkr.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, }, diff -Nru linux-aws-5.19.0/drivers/clk/qcom/gcc-sdm660.c linux-aws-5.19.0/drivers/clk/qcom/gcc-sdm660.c --- linux-aws-5.19.0/drivers/clk/qcom/gcc-sdm660.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/qcom/gcc-sdm660.c 2022-11-29 07:06:46.000000000 +0000 @@ -757,7 +757,7 @@ .name = "sdcc1_apps_clk_src", .parent_data = gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div, .num_parents = ARRAY_SIZE(gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, }; diff -Nru linux-aws-5.19.0/drivers/clk/qcom/gcc-sm6115.c linux-aws-5.19.0/drivers/clk/qcom/gcc-sm6115.c --- linux-aws-5.19.0/drivers/clk/qcom/gcc-sm6115.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/qcom/gcc-sm6115.c 2022-11-29 07:06:46.000000000 +0000 @@ -53,11 +53,25 @@ { 750000000, 1500000000, 1 }, }; +static const u8 clk_alpha_pll_regs_offset[][PLL_OFF_MAX_REGS] = { + [CLK_ALPHA_PLL_TYPE_DEFAULT] = { + [PLL_OFF_L_VAL] = 0x04, + [PLL_OFF_ALPHA_VAL] = 0x08, + [PLL_OFF_ALPHA_VAL_U] = 0x0c, + [PLL_OFF_TEST_CTL] = 0x10, + [PLL_OFF_TEST_CTL_U] = 0x14, + [PLL_OFF_USER_CTL] = 0x18, + [PLL_OFF_USER_CTL_U] = 0x1c, + [PLL_OFF_CONFIG_CTL] = 0x20, + [PLL_OFF_STATUS] = 0x24, + }, +}; + static struct clk_alpha_pll gpll0 = { .offset = 0x0, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(0), @@ -83,7 +97,7 @@ .post_div_table = post_div_table_gpll0_out_aux2, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_aux2), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_aux2", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -115,7 +129,7 @@ .post_div_table = post_div_table_gpll0_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -137,7 +151,7 @@ .offset = 0xa000, .vco_table = gpll10_vco, .num_vco = ARRAY_SIZE(gpll10_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(10), @@ -163,7 +177,7 @@ .post_div_table = post_div_table_gpll10_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll10_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll10_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll10.clkr.hw }, @@ -189,7 +203,7 @@ .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), .flags = SUPPORTS_DYNAMIC_UPDATE, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(11), @@ -215,7 +229,7 @@ .post_div_table = post_div_table_gpll11_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll11_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll11_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll11.clkr.hw }, @@ -229,7 +243,7 @@ .offset = 0x3000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(3), @@ -248,7 +262,7 @@ .offset = 0x4000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(4), @@ -274,7 +288,7 @@ .post_div_table = post_div_table_gpll4_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll4_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll4_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll4.clkr.hw }, @@ -287,7 +301,7 @@ .offset = 0x6000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(6), @@ -313,7 +327,7 @@ .post_div_table = post_div_table_gpll6_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll6_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll6_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll6.clkr.hw }, @@ -326,7 +340,7 @@ .offset = 0x7000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(7), @@ -352,7 +366,7 @@ .post_div_table = post_div_table_gpll7_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll7_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll7_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll7.clkr.hw }, @@ -380,7 +394,7 @@ .offset = 0x8000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .flags = SUPPORTS_DYNAMIC_UPDATE, .clkr = { .enable_reg = 0x79000, @@ -407,7 +421,7 @@ .post_div_table = post_div_table_gpll8_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll8_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll8_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll8.clkr.hw }, diff -Nru linux-aws-5.19.0/drivers/clk/qcom/Kconfig linux-aws-5.19.0/drivers/clk/qcom/Kconfig --- linux-aws-5.19.0/drivers/clk/qcom/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/qcom/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -637,6 +637,7 @@ config SM_GCC_6115 tristate "SM6115 and SM4250 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SM6115 and SM4250 devices. Say Y if you want to use peripheral devices such as UART, SPI, diff -Nru linux-aws-5.19.0/drivers/clk/samsung/clk-exynosautov9.c linux-aws-5.19.0/drivers/clk/samsung/clk-exynosautov9.c --- linux-aws-5.19.0/drivers/clk/samsung/clk-exynosautov9.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/samsung/clk-exynosautov9.c 2022-11-29 07:06:46.000000000 +0000 @@ -1170,9 +1170,9 @@ #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_2 0x2058 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_3 0x205c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_5 0x2064 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_6 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_8 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_9 0x2074 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_10 0x204c @@ -1418,14 +1418,14 @@ #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_IPCLK_11 0x2020 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_0 0x2044 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_1 0x2048 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2058 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x205c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x206c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2064 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2068 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x2070 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2074 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2054 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x2058 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x205c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2060 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2064 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x206c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10 0x204c #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_11 0x2050 @@ -1463,9 +1463,9 @@ CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4, - CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6, + CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10, diff -Nru linux-aws-5.19.0/drivers/clk/sprd/common.c linux-aws-5.19.0/drivers/clk/sprd/common.c --- linux-aws-5.19.0/drivers/clk/sprd/common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/sprd/common.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,7 +41,7 @@ { void __iomem *base; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *node = dev->of_node, *np; struct regmap *regmap; if (of_find_property(node, "sprd,syscon", NULL)) { @@ -50,9 +50,10 @@ pr_err("%s: failed to get syscon regmap\n", __func__); return PTR_ERR(regmap); } - } else if (of_device_is_compatible(of_get_parent(dev->of_node), - "syscon")) { - regmap = device_node_to_regmap(of_get_parent(dev->of_node)); + } else if (of_device_is_compatible(np = of_get_parent(node), "syscon") || + (of_node_put(np), 0)) { + regmap = device_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap from its parent.\n"); return PTR_ERR(regmap); diff -Nru linux-aws-5.19.0/drivers/clk/st/clkgen-fsyn.c linux-aws-5.19.0/drivers/clk/st/clkgen-fsyn.c --- linux-aws-5.19.0/drivers/clk/st/clkgen-fsyn.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/st/clkgen-fsyn.c 2022-11-29 07:06:46.000000000 +0000 @@ -987,6 +987,7 @@ const char *pll_name, *clk_parent_name; void __iomem *reg; spinlock_t *lock; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -994,7 +995,9 @@ */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; diff -Nru linux-aws-5.19.0/drivers/clk/st/clkgen-mux.c linux-aws-5.19.0/drivers/clk/st/clkgen-mux.c --- linux-aws-5.19.0/drivers/clk/st/clkgen-mux.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/st/clkgen-mux.c 2022-11-29 07:06:46.000000000 +0000 @@ -56,6 +56,7 @@ void __iomem *reg; const char **parents; int num_parents = 0; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -63,7 +64,9 @@ */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; diff -Nru linux-aws-5.19.0/drivers/clk/tegra/clk-tegra114.c linux-aws-5.19.0/drivers/clk/tegra/clk-tegra114.c --- linux-aws-5.19.0/drivers/clk/tegra/clk-tegra114.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/tegra/clk-tegra114.c 2022-11-29 07:06:46.000000000 +0000 @@ -1317,6 +1317,7 @@ } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); diff -Nru linux-aws-5.19.0/drivers/clk/tegra/clk-tegra20.c linux-aws-5.19.0/drivers/clk/tegra/clk-tegra20.c --- linux-aws-5.19.0/drivers/clk/tegra/clk-tegra20.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/tegra/clk-tegra20.c 2022-11-29 07:06:46.000000000 +0000 @@ -1131,6 +1131,7 @@ } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); BUG(); diff -Nru linux-aws-5.19.0/drivers/clk/tegra/clk-tegra210.c linux-aws-5.19.0/drivers/clk/tegra/clk-tegra210.c --- linux-aws-5.19.0/drivers/clk/tegra/clk-tegra210.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/tegra/clk-tegra210.c 2022-11-29 07:06:46.000000000 +0000 @@ -3748,6 +3748,7 @@ } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); diff -Nru linux-aws-5.19.0/drivers/clk/ti/clk-44xx.c linux-aws-5.19.0/drivers/clk/ti/clk-44xx.c --- linux-aws-5.19.0/drivers/clk/ti/clk-44xx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ti/clk-44xx.c 2022-07-31 21:03:01.000000000 +0000 @@ -56,7 +56,7 @@ }; static const char * const omap4_func_dmic_abe_gfclk_parents[] __initconst = { - "abe-clkctrl:0018:26", + "abe_cm:clk:0018:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -76,7 +76,7 @@ }; static const char * const omap4_func_mcasp_abe_gfclk_parents[] __initconst = { - "abe-clkctrl:0020:26", + "abe_cm:clk:0020:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -89,7 +89,7 @@ }; static const char * const omap4_func_mcbsp1_gfclk_parents[] __initconst = { - "abe-clkctrl:0028:26", + "abe_cm:clk:0028:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -102,7 +102,7 @@ }; static const char * const omap4_func_mcbsp2_gfclk_parents[] __initconst = { - "abe-clkctrl:0030:26", + "abe_cm:clk:0030:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -115,7 +115,7 @@ }; static const char * const omap4_func_mcbsp3_gfclk_parents[] __initconst = { - "abe-clkctrl:0038:26", + "abe_cm:clk:0038:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -183,18 +183,18 @@ static const struct omap_clkctrl_reg_data omap4_abe_clkctrl_regs[] __initconst = { { OMAP4_L4_ABE_CLKCTRL, NULL, 0, "ocp_abe_iclk" }, - { OMAP4_AESS_CLKCTRL, omap4_aess_bit_data, CLKF_SW_SUP, "abe-clkctrl:0008:24" }, + { OMAP4_AESS_CLKCTRL, omap4_aess_bit_data, CLKF_SW_SUP, "abe_cm:clk:0008:24" }, { OMAP4_MCPDM_CLKCTRL, NULL, CLKF_SW_SUP, "pad_clks_ck" }, - { OMAP4_DMIC_CLKCTRL, omap4_dmic_bit_data, CLKF_SW_SUP, "abe-clkctrl:0018:24" }, - { OMAP4_MCASP_CLKCTRL, omap4_mcasp_bit_data, CLKF_SW_SUP, "abe-clkctrl:0020:24" }, - { OMAP4_MCBSP1_CLKCTRL, omap4_mcbsp1_bit_data, CLKF_SW_SUP, "abe-clkctrl:0028:24" }, - { OMAP4_MCBSP2_CLKCTRL, omap4_mcbsp2_bit_data, CLKF_SW_SUP, "abe-clkctrl:0030:24" }, - { OMAP4_MCBSP3_CLKCTRL, omap4_mcbsp3_bit_data, CLKF_SW_SUP, "abe-clkctrl:0038:24" }, - { OMAP4_SLIMBUS1_CLKCTRL, omap4_slimbus1_bit_data, CLKF_SW_SUP, "abe-clkctrl:0040:8" }, - { OMAP4_TIMER5_CLKCTRL, omap4_timer5_bit_data, CLKF_SW_SUP, "abe-clkctrl:0048:24" }, - { OMAP4_TIMER6_CLKCTRL, omap4_timer6_bit_data, CLKF_SW_SUP, "abe-clkctrl:0050:24" }, - { OMAP4_TIMER7_CLKCTRL, omap4_timer7_bit_data, CLKF_SW_SUP, "abe-clkctrl:0058:24" }, - { OMAP4_TIMER8_CLKCTRL, omap4_timer8_bit_data, CLKF_SW_SUP, "abe-clkctrl:0060:24" }, + { OMAP4_DMIC_CLKCTRL, omap4_dmic_bit_data, CLKF_SW_SUP, "abe_cm:clk:0018:24" }, + { OMAP4_MCASP_CLKCTRL, omap4_mcasp_bit_data, CLKF_SW_SUP, "abe_cm:clk:0020:24" }, + { OMAP4_MCBSP1_CLKCTRL, omap4_mcbsp1_bit_data, CLKF_SW_SUP, "abe_cm:clk:0028:24" }, + { OMAP4_MCBSP2_CLKCTRL, omap4_mcbsp2_bit_data, CLKF_SW_SUP, "abe_cm:clk:0030:24" }, + { OMAP4_MCBSP3_CLKCTRL, omap4_mcbsp3_bit_data, CLKF_SW_SUP, "abe_cm:clk:0038:24" }, + { OMAP4_SLIMBUS1_CLKCTRL, omap4_slimbus1_bit_data, CLKF_SW_SUP, "abe_cm:clk:0040:8" }, + { OMAP4_TIMER5_CLKCTRL, omap4_timer5_bit_data, CLKF_SW_SUP, "abe_cm:clk:0048:24" }, + { OMAP4_TIMER6_CLKCTRL, omap4_timer6_bit_data, CLKF_SW_SUP, "abe_cm:clk:0050:24" }, + { OMAP4_TIMER7_CLKCTRL, omap4_timer7_bit_data, CLKF_SW_SUP, "abe_cm:clk:0058:24" }, + { OMAP4_TIMER8_CLKCTRL, omap4_timer8_bit_data, CLKF_SW_SUP, "abe_cm:clk:0060:24" }, { OMAP4_WD_TIMER3_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, }; @@ -287,7 +287,7 @@ static const struct omap_clkctrl_reg_data omap4_iss_clkctrl_regs[] __initconst = { { OMAP4_ISS_CLKCTRL, omap4_iss_bit_data, CLKF_SW_SUP, "ducati_clk_mux_ck" }, - { OMAP4_FDIF_CLKCTRL, omap4_fdif_bit_data, CLKF_SW_SUP, "iss-clkctrl:0008:24" }, + { OMAP4_FDIF_CLKCTRL, omap4_fdif_bit_data, CLKF_SW_SUP, "iss_cm:clk:0008:24" }, { 0 }, }; @@ -320,7 +320,7 @@ }; static const struct omap_clkctrl_reg_data omap4_l3_dss_clkctrl_regs[] __initconst = { - { OMAP4_DSS_CORE_CLKCTRL, omap4_dss_core_bit_data, CLKF_SW_SUP, "l3-dss-clkctrl:0000:8" }, + { OMAP4_DSS_CORE_CLKCTRL, omap4_dss_core_bit_data, CLKF_SW_SUP, "l3_dss_cm:clk:0000:8" }, { 0 }, }; @@ -336,7 +336,7 @@ }; static const struct omap_clkctrl_reg_data omap4_l3_gfx_clkctrl_regs[] __initconst = { - { OMAP4_GPU_CLKCTRL, omap4_gpu_bit_data, CLKF_SW_SUP, "l3-gfx-clkctrl:0000:24" }, + { OMAP4_GPU_CLKCTRL, omap4_gpu_bit_data, CLKF_SW_SUP, "l3_gfx_cm:clk:0000:24" }, { 0 }, }; @@ -372,12 +372,12 @@ }; static const char * const omap4_usb_host_hs_utmi_p1_clk_parents[] __initconst = { - "l3-init-clkctrl:0038:24", + "l3_init_cm:clk:0038:24", NULL, }; static const char * const omap4_usb_host_hs_utmi_p2_clk_parents[] __initconst = { - "l3-init-clkctrl:0038:25", + "l3_init_cm:clk:0038:25", NULL, }; @@ -418,7 +418,7 @@ }; static const char * const omap4_usb_otg_hs_xclk_parents[] __initconst = { - "l3-init-clkctrl:0040:24", + "l3_init_cm:clk:0040:24", NULL, }; @@ -452,14 +452,14 @@ }; static const struct omap_clkctrl_reg_data omap4_l3_init_clkctrl_regs[] __initconst = { - { OMAP4_MMC1_CLKCTRL, omap4_mmc1_bit_data, CLKF_SW_SUP, "l3-init-clkctrl:0008:24" }, - { OMAP4_MMC2_CLKCTRL, omap4_mmc2_bit_data, CLKF_SW_SUP, "l3-init-clkctrl:0010:24" }, - { OMAP4_HSI_CLKCTRL, omap4_hsi_bit_data, CLKF_HW_SUP, "l3-init-clkctrl:0018:24" }, + { OMAP4_MMC1_CLKCTRL, omap4_mmc1_bit_data, CLKF_SW_SUP, "l3_init_cm:clk:0008:24" }, + { OMAP4_MMC2_CLKCTRL, omap4_mmc2_bit_data, CLKF_SW_SUP, "l3_init_cm:clk:0010:24" }, + { OMAP4_HSI_CLKCTRL, omap4_hsi_bit_data, CLKF_HW_SUP, "l3_init_cm:clk:0018:24" }, { OMAP4_USB_HOST_HS_CLKCTRL, omap4_usb_host_hs_bit_data, CLKF_SW_SUP, "init_60m_fclk" }, { OMAP4_USB_OTG_HS_CLKCTRL, omap4_usb_otg_hs_bit_data, CLKF_HW_SUP, "l3_div_ck" }, { OMAP4_USB_TLL_HS_CLKCTRL, omap4_usb_tll_hs_bit_data, CLKF_HW_SUP, "l4_div_ck" }, { OMAP4_USB_HOST_FS_CLKCTRL, NULL, CLKF_SW_SUP, "func_48mc_fclk" }, - { OMAP4_OCP2SCP_USB_PHY_CLKCTRL, omap4_ocp2scp_usb_phy_bit_data, CLKF_HW_SUP, "l3-init-clkctrl:00c0:8" }, + { OMAP4_OCP2SCP_USB_PHY_CLKCTRL, omap4_ocp2scp_usb_phy_bit_data, CLKF_HW_SUP, "l3_init_cm:clk:00c0:8" }, { 0 }, }; @@ -530,7 +530,7 @@ }; static const char * const omap4_per_mcbsp4_gfclk_parents[] __initconst = { - "l4-per-clkctrl:00c0:26", + "l4_per_cm:clk:00c0:26", "pad_clks_ck", NULL, }; @@ -570,12 +570,12 @@ }; static const struct omap_clkctrl_reg_data omap4_l4_per_clkctrl_regs[] __initconst = { - { OMAP4_TIMER10_CLKCTRL, omap4_timer10_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0008:24" }, - { OMAP4_TIMER11_CLKCTRL, omap4_timer11_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0010:24" }, - { OMAP4_TIMER2_CLKCTRL, omap4_timer2_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0018:24" }, - { OMAP4_TIMER3_CLKCTRL, omap4_timer3_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0020:24" }, - { OMAP4_TIMER4_CLKCTRL, omap4_timer4_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0028:24" }, - { OMAP4_TIMER9_CLKCTRL, omap4_timer9_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0030:24" }, + { OMAP4_TIMER10_CLKCTRL, omap4_timer10_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0008:24" }, + { OMAP4_TIMER11_CLKCTRL, omap4_timer11_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0010:24" }, + { OMAP4_TIMER2_CLKCTRL, omap4_timer2_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0018:24" }, + { OMAP4_TIMER3_CLKCTRL, omap4_timer3_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0020:24" }, + { OMAP4_TIMER4_CLKCTRL, omap4_timer4_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0028:24" }, + { OMAP4_TIMER9_CLKCTRL, omap4_timer9_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0030:24" }, { OMAP4_ELM_CLKCTRL, NULL, 0, "l4_div_ck" }, { OMAP4_GPIO2_CLKCTRL, omap4_gpio2_bit_data, CLKF_HW_SUP, "l4_div_ck" }, { OMAP4_GPIO3_CLKCTRL, omap4_gpio3_bit_data, CLKF_HW_SUP, "l4_div_ck" }, @@ -588,14 +588,14 @@ { OMAP4_I2C3_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_I2C4_CLKCTRL, NULL, CLKF_SW_SUP, "func_96m_fclk" }, { OMAP4_L4_PER_CLKCTRL, NULL, 0, "l4_div_ck" }, - { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:00c0:24" }, + { OMAP4_MCBSP4_CLKCTRL, omap4_mcbsp4_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:00c0:24" }, { OMAP4_MCSPI1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MCSPI4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_MMC4_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, - { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4-per-clkctrl:0118:8" }, + { OMAP4_SLIMBUS2_CLKCTRL, omap4_slimbus2_bit_data, CLKF_SW_SUP, "l4_per_cm:clk:0118:8" }, { OMAP4_UART1_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART2_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, { OMAP4_UART3_CLKCTRL, NULL, CLKF_SW_SUP, "func_48m_fclk" }, @@ -630,7 +630,7 @@ { OMAP4_L4_WKUP_CLKCTRL, NULL, 0, "l4_wkup_clk_mux_ck" }, { OMAP4_WD_TIMER2_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { OMAP4_GPIO1_CLKCTRL, omap4_gpio1_bit_data, CLKF_HW_SUP, "l4_wkup_clk_mux_ck" }, - { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4-wkup-clkctrl:0020:24" }, + { OMAP4_TIMER1_CLKCTRL, omap4_timer1_bit_data, CLKF_SW_SUP, "l4_wkup_cm:clk:0020:24" }, { OMAP4_COUNTER_32K_CLKCTRL, NULL, 0, "sys_32k_ck" }, { OMAP4_KBD_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, @@ -644,7 +644,7 @@ }; static const char * const omap4_trace_clk_div_div_ck_parents[] __initconst = { - "emu-sys-clkctrl:0000:22", + "emu_sys_cm:clk:0000:22", NULL, }; @@ -662,7 +662,7 @@ }; static const char * const omap4_stm_clk_div_ck_parents[] __initconst = { - "emu-sys-clkctrl:0000:20", + "emu_sys_cm:clk:0000:20", NULL, }; @@ -716,73 +716,73 @@ * hwmod support. Once hwmod is removed, these can be removed * also. */ - DT_CLK(NULL, "aess_fclk", "abe-clkctrl:0008:24"), - DT_CLK(NULL, "cm2_dm10_mux", "l4-per-clkctrl:0008:24"), - DT_CLK(NULL, "cm2_dm11_mux", "l4-per-clkctrl:0010:24"), - DT_CLK(NULL, "cm2_dm2_mux", "l4-per-clkctrl:0018:24"), - DT_CLK(NULL, "cm2_dm3_mux", "l4-per-clkctrl:0020:24"), - DT_CLK(NULL, "cm2_dm4_mux", "l4-per-clkctrl:0028:24"), - DT_CLK(NULL, "cm2_dm9_mux", "l4-per-clkctrl:0030:24"), - DT_CLK(NULL, "dmic_sync_mux_ck", "abe-clkctrl:0018:26"), - DT_CLK(NULL, "dmt1_clk_mux", "l4-wkup-clkctrl:0020:24"), - DT_CLK(NULL, "dss_48mhz_clk", "l3-dss-clkctrl:0000:9"), - DT_CLK(NULL, "dss_dss_clk", "l3-dss-clkctrl:0000:8"), - DT_CLK(NULL, "dss_sys_clk", "l3-dss-clkctrl:0000:10"), - DT_CLK(NULL, "dss_tv_clk", "l3-dss-clkctrl:0000:11"), - DT_CLK(NULL, "fdif_fck", "iss-clkctrl:0008:24"), - DT_CLK(NULL, "func_dmic_abe_gfclk", "abe-clkctrl:0018:24"), - DT_CLK(NULL, "func_mcasp_abe_gfclk", "abe-clkctrl:0020:24"), - DT_CLK(NULL, "func_mcbsp1_gfclk", "abe-clkctrl:0028:24"), - DT_CLK(NULL, "func_mcbsp2_gfclk", "abe-clkctrl:0030:24"), - DT_CLK(NULL, "func_mcbsp3_gfclk", "abe-clkctrl:0038:24"), - DT_CLK(NULL, "gpio1_dbclk", "l4-wkup-clkctrl:0018:8"), - DT_CLK(NULL, "gpio2_dbclk", "l4-per-clkctrl:0040:8"), - DT_CLK(NULL, "gpio3_dbclk", "l4-per-clkctrl:0048:8"), - DT_CLK(NULL, "gpio4_dbclk", "l4-per-clkctrl:0050:8"), - DT_CLK(NULL, "gpio5_dbclk", "l4-per-clkctrl:0058:8"), - DT_CLK(NULL, "gpio6_dbclk", "l4-per-clkctrl:0060:8"), - DT_CLK(NULL, "hsi_fck", "l3-init-clkctrl:0018:24"), - DT_CLK(NULL, "hsmmc1_fclk", "l3-init-clkctrl:0008:24"), - DT_CLK(NULL, "hsmmc2_fclk", "l3-init-clkctrl:0010:24"), - DT_CLK(NULL, "iss_ctrlclk", "iss-clkctrl:0000:8"), - DT_CLK(NULL, "mcasp_sync_mux_ck", "abe-clkctrl:0020:26"), - DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), - DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), - DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), - DT_CLK(NULL, "mcbsp4_sync_mux_ck", "l4-per-clkctrl:00c0:26"), - DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "l3-init-clkctrl:00c0:8"), - DT_CLK(NULL, "otg_60m_gfclk", "l3-init-clkctrl:0040:24"), - DT_CLK(NULL, "per_mcbsp4_gfclk", "l4-per-clkctrl:00c0:24"), - DT_CLK(NULL, "pmd_stm_clock_mux_ck", "emu-sys-clkctrl:0000:20"), - DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu-sys-clkctrl:0000:22"), - DT_CLK(NULL, "sgx_clk_mux", "l3-gfx-clkctrl:0000:24"), - DT_CLK(NULL, "slimbus1_fclk_0", "abe-clkctrl:0040:8"), - DT_CLK(NULL, "slimbus1_fclk_1", "abe-clkctrl:0040:9"), - DT_CLK(NULL, "slimbus1_fclk_2", "abe-clkctrl:0040:10"), - DT_CLK(NULL, "slimbus1_slimbus_clk", "abe-clkctrl:0040:11"), - DT_CLK(NULL, "slimbus2_fclk_0", "l4-per-clkctrl:0118:8"), - DT_CLK(NULL, "slimbus2_fclk_1", "l4-per-clkctrl:0118:9"), - DT_CLK(NULL, "slimbus2_slimbus_clk", "l4-per-clkctrl:0118:10"), - DT_CLK(NULL, "stm_clk_div_ck", "emu-sys-clkctrl:0000:27"), - DT_CLK(NULL, "timer5_sync_mux", "abe-clkctrl:0048:24"), - DT_CLK(NULL, "timer6_sync_mux", "abe-clkctrl:0050:24"), - DT_CLK(NULL, "timer7_sync_mux", "abe-clkctrl:0058:24"), - DT_CLK(NULL, "timer8_sync_mux", "abe-clkctrl:0060:24"), - DT_CLK(NULL, "trace_clk_div_div_ck", "emu-sys-clkctrl:0000:24"), - DT_CLK(NULL, "usb_host_hs_func48mclk", "l3-init-clkctrl:0038:15"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3-init-clkctrl:0038:13"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3-init-clkctrl:0038:14"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3-init-clkctrl:0038:11"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3-init-clkctrl:0038:12"), - DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3-init-clkctrl:0038:8"), - DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3-init-clkctrl:0038:9"), - DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3_init-clkctrl:0038:10"), - DT_CLK(NULL, "usb_otg_hs_xclk", "l3-init-clkctrl:0040:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3-init-clkctrl:0048:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3-init-clkctrl:0048:9"), - DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3-init-clkctrl:0048:10"), - DT_CLK(NULL, "utmi_p1_gfclk", "l3-init-clkctrl:0038:24"), - DT_CLK(NULL, "utmi_p2_gfclk", "l3-init-clkctrl:0038:25"), + DT_CLK(NULL, "aess_fclk", "abe_cm:0008:24"), + DT_CLK(NULL, "cm2_dm10_mux", "l4_per_cm:0008:24"), + DT_CLK(NULL, "cm2_dm11_mux", "l4_per_cm:0010:24"), + DT_CLK(NULL, "cm2_dm2_mux", "l4_per_cm:0018:24"), + DT_CLK(NULL, "cm2_dm3_mux", "l4_per_cm:0020:24"), + DT_CLK(NULL, "cm2_dm4_mux", "l4_per_cm:0028:24"), + DT_CLK(NULL, "cm2_dm9_mux", "l4_per_cm:0030:24"), + DT_CLK(NULL, "dmic_sync_mux_ck", "abe_cm:0018:26"), + DT_CLK(NULL, "dmt1_clk_mux", "l4_wkup_cm:0020:24"), + DT_CLK(NULL, "dss_48mhz_clk", "l3_dss_cm:0000:9"), + DT_CLK(NULL, "dss_dss_clk", "l3_dss_cm:0000:8"), + DT_CLK(NULL, "dss_sys_clk", "l3_dss_cm:0000:10"), + DT_CLK(NULL, "dss_tv_clk", "l3_dss_cm:0000:11"), + DT_CLK(NULL, "fdif_fck", "iss_cm:0008:24"), + DT_CLK(NULL, "func_dmic_abe_gfclk", "abe_cm:0018:24"), + DT_CLK(NULL, "func_mcasp_abe_gfclk", "abe_cm:0020:24"), + DT_CLK(NULL, "func_mcbsp1_gfclk", "abe_cm:0028:24"), + DT_CLK(NULL, "func_mcbsp2_gfclk", "abe_cm:0030:24"), + DT_CLK(NULL, "func_mcbsp3_gfclk", "abe_cm:0038:24"), + DT_CLK(NULL, "gpio1_dbclk", "l4_wkup_cm:0018:8"), + DT_CLK(NULL, "gpio2_dbclk", "l4_per_cm:0040:8"), + DT_CLK(NULL, "gpio3_dbclk", "l4_per_cm:0048:8"), + DT_CLK(NULL, "gpio4_dbclk", "l4_per_cm:0050:8"), + DT_CLK(NULL, "gpio5_dbclk", "l4_per_cm:0058:8"), + DT_CLK(NULL, "gpio6_dbclk", "l4_per_cm:0060:8"), + DT_CLK(NULL, "hsi_fck", "l3_init_cm:0018:24"), + DT_CLK(NULL, "hsmmc1_fclk", "l3_init_cm:0008:24"), + DT_CLK(NULL, "hsmmc2_fclk", "l3_init_cm:0010:24"), + DT_CLK(NULL, "iss_ctrlclk", "iss_cm:0000:8"), + DT_CLK(NULL, "mcasp_sync_mux_ck", "abe_cm:0020:26"), + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe_cm:0028:26"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe_cm:0030:26"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe_cm:0038:26"), + DT_CLK(NULL, "mcbsp4_sync_mux_ck", "l4_per_cm:00c0:26"), + DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "l3_init_cm:00c0:8"), + DT_CLK(NULL, "otg_60m_gfclk", "l3_init_cm:0040:24"), + DT_CLK(NULL, "per_mcbsp4_gfclk", "l4_per_cm:00c0:24"), + DT_CLK(NULL, "pmd_stm_clock_mux_ck", "emu_sys_cm:0000:20"), + DT_CLK(NULL, "pmd_trace_clk_mux_ck", "emu_sys_cm:0000:22"), + DT_CLK(NULL, "sgx_clk_mux", "l3_gfx_cm:0000:24"), + DT_CLK(NULL, "slimbus1_fclk_0", "abe_cm:0040:8"), + DT_CLK(NULL, "slimbus1_fclk_1", "abe_cm:0040:9"), + DT_CLK(NULL, "slimbus1_fclk_2", "abe_cm:0040:10"), + DT_CLK(NULL, "slimbus1_slimbus_clk", "abe_cm:0040:11"), + DT_CLK(NULL, "slimbus2_fclk_0", "l4_per_cm:0118:8"), + DT_CLK(NULL, "slimbus2_fclk_1", "l4_per_cm:0118:9"), + DT_CLK(NULL, "slimbus2_slimbus_clk", "l4_per_cm:0118:10"), + DT_CLK(NULL, "stm_clk_div_ck", "emu_sys_cm:0000:27"), + DT_CLK(NULL, "timer5_sync_mux", "abe_cm:0048:24"), + DT_CLK(NULL, "timer6_sync_mux", "abe_cm:0050:24"), + DT_CLK(NULL, "timer7_sync_mux", "abe_cm:0058:24"), + DT_CLK(NULL, "timer8_sync_mux", "abe_cm:0060:24"), + DT_CLK(NULL, "trace_clk_div_div_ck", "emu_sys_cm:0000:24"), + DT_CLK(NULL, "usb_host_hs_func48mclk", "l3_init_cm:0038:15"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3_init_cm:0038:13"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3_init_cm:0038:14"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3_init_cm:0038:11"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3_init_cm:0038:12"), + DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3_init_cm:0038:8"), + DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3_init_cm:0038:9"), + DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3_init_cm:0038:10"), + DT_CLK(NULL, "usb_otg_hs_xclk", "l3_init_cm:0040:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3_init_cm:0048:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3_init_cm:0048:9"), + DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3_init_cm:0048:10"), + DT_CLK(NULL, "utmi_p1_gfclk", "l3_init_cm:0038:24"), + DT_CLK(NULL, "utmi_p2_gfclk", "l3_init_cm:0038:25"), { .node_name = NULL }, }; diff -Nru linux-aws-5.19.0/drivers/clk/ti/clk-54xx.c linux-aws-5.19.0/drivers/clk/ti/clk-54xx.c --- linux-aws-5.19.0/drivers/clk/ti/clk-54xx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ti/clk-54xx.c 2022-07-31 21:03:01.000000000 +0000 @@ -50,7 +50,7 @@ }; static const char * const omap5_dmic_gfclk_parents[] __initconst = { - "abe-clkctrl:0018:26", + "abe_cm:clk:0018:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -70,7 +70,7 @@ }; static const char * const omap5_mcbsp1_gfclk_parents[] __initconst = { - "abe-clkctrl:0028:26", + "abe_cm:clk:0028:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -83,7 +83,7 @@ }; static const char * const omap5_mcbsp2_gfclk_parents[] __initconst = { - "abe-clkctrl:0030:26", + "abe_cm:clk:0030:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -96,7 +96,7 @@ }; static const char * const omap5_mcbsp3_gfclk_parents[] __initconst = { - "abe-clkctrl:0038:26", + "abe_cm:clk:0038:26", "pad_clks_ck", "slimbus_clk", NULL, @@ -136,16 +136,16 @@ static const struct omap_clkctrl_reg_data omap5_abe_clkctrl_regs[] __initconst = { { OMAP5_L4_ABE_CLKCTRL, NULL, 0, "abe_iclk" }, - { OMAP5_AESS_CLKCTRL, omap5_aess_bit_data, CLKF_SW_SUP, "abe-clkctrl:0008:24" }, + { OMAP5_AESS_CLKCTRL, omap5_aess_bit_data, CLKF_SW_SUP, "abe_cm:clk:0008:24" }, { OMAP5_MCPDM_CLKCTRL, NULL, CLKF_SW_SUP, "pad_clks_ck" }, - { OMAP5_DMIC_CLKCTRL, omap5_dmic_bit_data, CLKF_SW_SUP, "abe-clkctrl:0018:24" }, - { OMAP5_MCBSP1_CLKCTRL, omap5_mcbsp1_bit_data, CLKF_SW_SUP, "abe-clkctrl:0028:24" }, - { OMAP5_MCBSP2_CLKCTRL, omap5_mcbsp2_bit_data, CLKF_SW_SUP, "abe-clkctrl:0030:24" }, - { OMAP5_MCBSP3_CLKCTRL, omap5_mcbsp3_bit_data, CLKF_SW_SUP, "abe-clkctrl:0038:24" }, - { OMAP5_TIMER5_CLKCTRL, omap5_timer5_bit_data, CLKF_SW_SUP, "abe-clkctrl:0048:24" }, - { OMAP5_TIMER6_CLKCTRL, omap5_timer6_bit_data, CLKF_SW_SUP, "abe-clkctrl:0050:24" }, - { OMAP5_TIMER7_CLKCTRL, omap5_timer7_bit_data, CLKF_SW_SUP, "abe-clkctrl:0058:24" }, - { OMAP5_TIMER8_CLKCTRL, omap5_timer8_bit_data, CLKF_SW_SUP, "abe-clkctrl:0060:24" }, + { OMAP5_DMIC_CLKCTRL, omap5_dmic_bit_data, CLKF_SW_SUP, "abe_cm:clk:0018:24" }, + { OMAP5_MCBSP1_CLKCTRL, omap5_mcbsp1_bit_data, CLKF_SW_SUP, "abe_cm:clk:0028:24" }, + { OMAP5_MCBSP2_CLKCTRL, omap5_mcbsp2_bit_data, CLKF_SW_SUP, "abe_cm:clk:0030:24" }, + { OMAP5_MCBSP3_CLKCTRL, omap5_mcbsp3_bit_data, CLKF_SW_SUP, "abe_cm:clk:0038:24" }, + { OMAP5_TIMER5_CLKCTRL, omap5_timer5_bit_data, CLKF_SW_SUP, "abe_cm:clk:0048:24" }, + { OMAP5_TIMER6_CLKCTRL, omap5_timer6_bit_data, CLKF_SW_SUP, "abe_cm:clk:0050:24" }, + { OMAP5_TIMER7_CLKCTRL, omap5_timer7_bit_data, CLKF_SW_SUP, "abe_cm:clk:0058:24" }, + { OMAP5_TIMER8_CLKCTRL, omap5_timer8_bit_data, CLKF_SW_SUP, "abe_cm:clk:0060:24" }, { 0 }, }; @@ -268,12 +268,12 @@ }; static const struct omap_clkctrl_reg_data omap5_l4per_clkctrl_regs[] __initconst = { - { OMAP5_TIMER10_CLKCTRL, omap5_timer10_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0008:24" }, - { OMAP5_TIMER11_CLKCTRL, omap5_timer11_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0010:24" }, - { OMAP5_TIMER2_CLKCTRL, omap5_timer2_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0018:24" }, - { OMAP5_TIMER3_CLKCTRL, omap5_timer3_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0020:24" }, - { OMAP5_TIMER4_CLKCTRL, omap5_timer4_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0028:24" }, - { OMAP5_TIMER9_CLKCTRL, omap5_timer9_bit_data, CLKF_SW_SUP, "l4per-clkctrl:0030:24" }, + { OMAP5_TIMER10_CLKCTRL, omap5_timer10_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0008:24" }, + { OMAP5_TIMER11_CLKCTRL, omap5_timer11_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0010:24" }, + { OMAP5_TIMER2_CLKCTRL, omap5_timer2_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0018:24" }, + { OMAP5_TIMER3_CLKCTRL, omap5_timer3_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0020:24" }, + { OMAP5_TIMER4_CLKCTRL, omap5_timer4_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0028:24" }, + { OMAP5_TIMER9_CLKCTRL, omap5_timer9_bit_data, CLKF_SW_SUP, "l4per_cm:clk:0030:24" }, { OMAP5_GPIO2_CLKCTRL, omap5_gpio2_bit_data, CLKF_HW_SUP, "l4_root_clk_div" }, { OMAP5_GPIO3_CLKCTRL, omap5_gpio3_bit_data, CLKF_HW_SUP, "l4_root_clk_div" }, { OMAP5_GPIO4_CLKCTRL, omap5_gpio4_bit_data, CLKF_HW_SUP, "l4_root_clk_div" }, @@ -345,7 +345,7 @@ }; static const struct omap_clkctrl_reg_data omap5_dss_clkctrl_regs[] __initconst = { - { OMAP5_DSS_CORE_CLKCTRL, omap5_dss_core_bit_data, CLKF_SW_SUP, "dss-clkctrl:0000:8" }, + { OMAP5_DSS_CORE_CLKCTRL, omap5_dss_core_bit_data, CLKF_SW_SUP, "dss_cm:clk:0000:8" }, { 0 }, }; @@ -378,7 +378,7 @@ }; static const struct omap_clkctrl_reg_data omap5_gpu_clkctrl_regs[] __initconst = { - { OMAP5_GPU_CLKCTRL, omap5_gpu_core_bit_data, CLKF_SW_SUP, "gpu-clkctrl:0000:24" }, + { OMAP5_GPU_CLKCTRL, omap5_gpu_core_bit_data, CLKF_SW_SUP, "gpu_cm:clk:0000:24" }, { 0 }, }; @@ -389,7 +389,7 @@ }; static const char * const omap5_mmc1_fclk_parents[] __initconst = { - "l3init-clkctrl:0008:24", + "l3init_cm:clk:0008:24", NULL, }; @@ -405,7 +405,7 @@ }; static const char * const omap5_mmc2_fclk_parents[] __initconst = { - "l3init-clkctrl:0010:24", + "l3init_cm:clk:0010:24", NULL, }; @@ -430,12 +430,12 @@ }; static const char * const omap5_usb_host_hs_utmi_p1_clk_parents[] __initconst = { - "l3init-clkctrl:0038:24", + "l3init_cm:clk:0038:24", NULL, }; static const char * const omap5_usb_host_hs_utmi_p2_clk_parents[] __initconst = { - "l3init-clkctrl:0038:25", + "l3init_cm:clk:0038:25", NULL, }; @@ -494,8 +494,8 @@ }; static const struct omap_clkctrl_reg_data omap5_l3init_clkctrl_regs[] __initconst = { - { OMAP5_MMC1_CLKCTRL, omap5_mmc1_bit_data, CLKF_SW_SUP, "l3init-clkctrl:0008:25" }, - { OMAP5_MMC2_CLKCTRL, omap5_mmc2_bit_data, CLKF_SW_SUP, "l3init-clkctrl:0010:25" }, + { OMAP5_MMC1_CLKCTRL, omap5_mmc1_bit_data, CLKF_SW_SUP, "l3init_cm:clk:0008:25" }, + { OMAP5_MMC2_CLKCTRL, omap5_mmc2_bit_data, CLKF_SW_SUP, "l3init_cm:clk:0010:25" }, { OMAP5_USB_HOST_HS_CLKCTRL, omap5_usb_host_hs_bit_data, CLKF_SW_SUP, "l3init_60m_fclk" }, { OMAP5_USB_TLL_HS_CLKCTRL, omap5_usb_tll_hs_bit_data, CLKF_HW_SUP, "l4_root_clk_div" }, { OMAP5_SATA_CLKCTRL, omap5_sata_bit_data, CLKF_SW_SUP, "func_48m_fclk" }, @@ -519,7 +519,7 @@ { OMAP5_L4_WKUP_CLKCTRL, NULL, 0, "wkupaon_iclk_mux" }, { OMAP5_WD_TIMER2_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { OMAP5_GPIO1_CLKCTRL, omap5_gpio1_bit_data, CLKF_HW_SUP, "wkupaon_iclk_mux" }, - { OMAP5_TIMER1_CLKCTRL, omap5_timer1_bit_data, CLKF_SW_SUP, "wkupaon-clkctrl:0020:24" }, + { OMAP5_TIMER1_CLKCTRL, omap5_timer1_bit_data, CLKF_SW_SUP, "wkupaon_cm:clk:0020:24" }, { OMAP5_COUNTER_32K_CLKCTRL, NULL, 0, "wkupaon_iclk_mux" }, { OMAP5_KBD_CLKCTRL, NULL, CLKF_SW_SUP, "sys_32k_ck" }, { 0 }, @@ -549,58 +549,58 @@ static struct ti_dt_clk omap54xx_clks[] = { DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), DT_CLK(NULL, "sys_clkin_ck", "sys_clkin"), - DT_CLK(NULL, "dmic_gfclk", "abe-clkctrl:0018:24"), - DT_CLK(NULL, "dmic_sync_mux_ck", "abe-clkctrl:0018:26"), - DT_CLK(NULL, "dss_32khz_clk", "dss-clkctrl:0000:11"), - DT_CLK(NULL, "dss_48mhz_clk", "dss-clkctrl:0000:9"), - DT_CLK(NULL, "dss_dss_clk", "dss-clkctrl:0000:8"), - DT_CLK(NULL, "dss_sys_clk", "dss-clkctrl:0000:10"), - DT_CLK(NULL, "gpio1_dbclk", "wkupaon-clkctrl:0018:8"), - DT_CLK(NULL, "gpio2_dbclk", "l4per-clkctrl:0040:8"), - DT_CLK(NULL, "gpio3_dbclk", "l4per-clkctrl:0048:8"), - DT_CLK(NULL, "gpio4_dbclk", "l4per-clkctrl:0050:8"), - DT_CLK(NULL, "gpio5_dbclk", "l4per-clkctrl:0058:8"), - DT_CLK(NULL, "gpio6_dbclk", "l4per-clkctrl:0060:8"), - DT_CLK(NULL, "gpio7_dbclk", "l4per-clkctrl:00f0:8"), - DT_CLK(NULL, "gpio8_dbclk", "l4per-clkctrl:00f8:8"), - DT_CLK(NULL, "mcbsp1_gfclk", "abe-clkctrl:0028:24"), - DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe-clkctrl:0028:26"), - DT_CLK(NULL, "mcbsp2_gfclk", "abe-clkctrl:0030:24"), - DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe-clkctrl:0030:26"), - DT_CLK(NULL, "mcbsp3_gfclk", "abe-clkctrl:0038:24"), - DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe-clkctrl:0038:26"), - DT_CLK(NULL, "mmc1_32khz_clk", "l3init-clkctrl:0008:8"), - DT_CLK(NULL, "mmc1_fclk", "l3init-clkctrl:0008:25"), - DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"), - DT_CLK(NULL, "mmc2_fclk", "l3init-clkctrl:0010:25"), - DT_CLK(NULL, "mmc2_fclk_mux", "l3init-clkctrl:0010:24"), - DT_CLK(NULL, "sata_ref_clk", "l3init-clkctrl:0068:8"), - DT_CLK(NULL, "timer10_gfclk_mux", "l4per-clkctrl:0008:24"), - DT_CLK(NULL, "timer11_gfclk_mux", "l4per-clkctrl:0010:24"), - DT_CLK(NULL, "timer1_gfclk_mux", "wkupaon-clkctrl:0020:24"), - DT_CLK(NULL, "timer2_gfclk_mux", "l4per-clkctrl:0018:24"), - DT_CLK(NULL, "timer3_gfclk_mux", "l4per-clkctrl:0020:24"), - DT_CLK(NULL, "timer4_gfclk_mux", "l4per-clkctrl:0028:24"), - DT_CLK(NULL, "timer5_gfclk_mux", "abe-clkctrl:0048:24"), - DT_CLK(NULL, "timer6_gfclk_mux", "abe-clkctrl:0050:24"), - DT_CLK(NULL, "timer7_gfclk_mux", "abe-clkctrl:0058:24"), - DT_CLK(NULL, "timer8_gfclk_mux", "abe-clkctrl:0060:24"), - DT_CLK(NULL, "timer9_gfclk_mux", "l4per-clkctrl:0030:24"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3init-clkctrl:0038:13"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3init-clkctrl:0038:14"), - DT_CLK(NULL, "usb_host_hs_hsic480m_p3_clk", "l3init-clkctrl:0038:7"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3init-clkctrl:0038:11"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3init-clkctrl:0038:12"), - DT_CLK(NULL, "usb_host_hs_hsic60m_p3_clk", "l3init-clkctrl:0038:6"), - DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3init-clkctrl:0038:8"), - DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3init-clkctrl:0038:9"), - DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3init-clkctrl:0038:10"), - DT_CLK(NULL, "usb_otg_ss_refclk960m", "l3init-clkctrl:00d0:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3init-clkctrl:0048:8"), - DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3init-clkctrl:0048:9"), - DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3init-clkctrl:0048:10"), - DT_CLK(NULL, "utmi_p1_gfclk", "l3init-clkctrl:0038:24"), - DT_CLK(NULL, "utmi_p2_gfclk", "l3init-clkctrl:0038:25"), + DT_CLK(NULL, "dmic_gfclk", "abe_cm:0018:24"), + DT_CLK(NULL, "dmic_sync_mux_ck", "abe_cm:0018:26"), + DT_CLK(NULL, "dss_32khz_clk", "dss_cm:0000:11"), + DT_CLK(NULL, "dss_48mhz_clk", "dss_cm:0000:9"), + DT_CLK(NULL, "dss_dss_clk", "dss_cm:0000:8"), + DT_CLK(NULL, "dss_sys_clk", "dss_cm:0000:10"), + DT_CLK(NULL, "gpio1_dbclk", "wkupaon_cm:0018:8"), + DT_CLK(NULL, "gpio2_dbclk", "l4per_cm:0040:8"), + DT_CLK(NULL, "gpio3_dbclk", "l4per_cm:0048:8"), + DT_CLK(NULL, "gpio4_dbclk", "l4per_cm:0050:8"), + DT_CLK(NULL, "gpio5_dbclk", "l4per_cm:0058:8"), + DT_CLK(NULL, "gpio6_dbclk", "l4per_cm:0060:8"), + DT_CLK(NULL, "gpio7_dbclk", "l4per_cm:00f0:8"), + DT_CLK(NULL, "gpio8_dbclk", "l4per_cm:00f8:8"), + DT_CLK(NULL, "mcbsp1_gfclk", "abe_cm:0028:24"), + DT_CLK(NULL, "mcbsp1_sync_mux_ck", "abe_cm:0028:26"), + DT_CLK(NULL, "mcbsp2_gfclk", "abe_cm:0030:24"), + DT_CLK(NULL, "mcbsp2_sync_mux_ck", "abe_cm:0030:26"), + DT_CLK(NULL, "mcbsp3_gfclk", "abe_cm:0038:24"), + DT_CLK(NULL, "mcbsp3_sync_mux_ck", "abe_cm:0038:26"), + DT_CLK(NULL, "mmc1_32khz_clk", "l3init_cm:0008:8"), + DT_CLK(NULL, "mmc1_fclk", "l3init_cm:0008:25"), + DT_CLK(NULL, "mmc1_fclk_mux", "l3init_cm:0008:24"), + DT_CLK(NULL, "mmc2_fclk", "l3init_cm:0010:25"), + DT_CLK(NULL, "mmc2_fclk_mux", "l3init_cm:0010:24"), + DT_CLK(NULL, "sata_ref_clk", "l3init_cm:0068:8"), + DT_CLK(NULL, "timer10_gfclk_mux", "l4per_cm:0008:24"), + DT_CLK(NULL, "timer11_gfclk_mux", "l4per_cm:0010:24"), + DT_CLK(NULL, "timer1_gfclk_mux", "wkupaon_cm:0020:24"), + DT_CLK(NULL, "timer2_gfclk_mux", "l4per_cm:0018:24"), + DT_CLK(NULL, "timer3_gfclk_mux", "l4per_cm:0020:24"), + DT_CLK(NULL, "timer4_gfclk_mux", "l4per_cm:0028:24"), + DT_CLK(NULL, "timer5_gfclk_mux", "abe_cm:0048:24"), + DT_CLK(NULL, "timer6_gfclk_mux", "abe_cm:0050:24"), + DT_CLK(NULL, "timer7_gfclk_mux", "abe_cm:0058:24"), + DT_CLK(NULL, "timer8_gfclk_mux", "abe_cm:0060:24"), + DT_CLK(NULL, "timer9_gfclk_mux", "l4per_cm:0030:24"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "l3init_cm:0038:13"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "l3init_cm:0038:14"), + DT_CLK(NULL, "usb_host_hs_hsic480m_p3_clk", "l3init_cm:0038:7"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "l3init_cm:0038:11"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "l3init_cm:0038:12"), + DT_CLK(NULL, "usb_host_hs_hsic60m_p3_clk", "l3init_cm:0038:6"), + DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "l3init_cm:0038:8"), + DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "l3init_cm:0038:9"), + DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "l3init_cm:0038:10"), + DT_CLK(NULL, "usb_otg_ss_refclk960m", "l3init_cm:00d0:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "l3init_cm:0048:8"), + DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "l3init_cm:0048:9"), + DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "l3init_cm:0048:10"), + DT_CLK(NULL, "utmi_p1_gfclk", "l3init_cm:0038:24"), + DT_CLK(NULL, "utmi_p2_gfclk", "l3init_cm:0038:25"), { .node_name = NULL }, }; diff -Nru linux-aws-5.19.0/drivers/clk/ti/clk.c linux-aws-5.19.0/drivers/clk/ti/clk.c --- linux-aws-5.19.0/drivers/clk/ti/clk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ti/clk.c 2022-11-29 07:06:46.000000000 +0000 @@ -143,15 +143,17 @@ continue; if (!strncmp(n, tmp, strlen(tmp))) { + of_node_get(np); found = true; break; } } - of_node_put(from); kfree(tmp); - if (found) + if (found) { + of_node_put(from); return np; + } /* Fall back to using old node name base provider name */ return of_find_node_by_name(from, name); diff -Nru linux-aws-5.19.0/drivers/clk/ti/clkctrl.c linux-aws-5.19.0/drivers/clk/ti/clkctrl.c --- linux-aws-5.19.0/drivers/clk/ti/clkctrl.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ti/clkctrl.c 2022-07-31 21:03:01.000000000 +0000 @@ -528,6 +528,10 @@ char *c; u16 soc_mask = 0; + if (!(ti_clk_get_features()->flags & TI_CLK_CLKCTRL_COMPAT) && + of_node_name_eq(node, "clk")) + ti_clk_features.flags |= TI_CLK_CLKCTRL_COMPAT; + addrp = of_get_address(node, 0, NULL, NULL); addr = (u32)of_translate_address(node, addrp); diff -Nru linux-aws-5.19.0/drivers/clk/ti/clk-dra7-atl.c linux-aws-5.19.0/drivers/clk/ti/clk-dra7-atl.c --- linux-aws-5.19.0/drivers/clk/ti/clk-dra7-atl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/ti/clk-dra7-atl.c 2022-11-29 07:06:46.000000000 +0000 @@ -253,14 +253,16 @@ if (rc) { pr_err("%s: failed to lookup atl clock %d\n", __func__, i); - return -EINVAL; + ret = -EINVAL; + goto pm_put; } clk = of_clk_get_from_provider(&clkspec); if (IS_ERR(clk)) { pr_err("%s: failed to get atl clock %d from provider\n", __func__, i); - return PTR_ERR(clk); + ret = PTR_ERR(clk); + goto pm_put; } cdesc = to_atl_desc(__clk_get_hw(clk)); @@ -293,8 +295,9 @@ if (cdesc->enabled) atl_clk_enable(__clk_get_hw(clk)); } - pm_runtime_put_sync(cinfo->dev); +pm_put: + pm_runtime_put_sync(cinfo->dev); return ret; } diff -Nru linux-aws-5.19.0/drivers/clk/zynqmp/clkc.c linux-aws-5.19.0/drivers/clk/zynqmp/clkc.c --- linux-aws-5.19.0/drivers/clk/zynqmp/clkc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/zynqmp/clkc.c 2022-11-29 07:06:46.000000000 +0000 @@ -710,6 +710,13 @@ FIELD_PREP(CLK_ATTR_NODE_INDEX, i); zynqmp_pm_clock_get_name(clock[i].clk_id, &name); + + /* + * Terminate with NULL character in case name provided by firmware + * is longer and truncated due to size limit. + */ + name.name[sizeof(name.name) - 1] = '\0'; + if (!strcmp(name.name, RESERVED_CLK_NAME)) continue; strncpy(clock[i].clk_name, name.name, MAX_NAME_LEN); diff -Nru linux-aws-5.19.0/drivers/clk/zynqmp/pll.c linux-aws-5.19.0/drivers/clk/zynqmp/pll.c --- linux-aws-5.19.0/drivers/clk/zynqmp/pll.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clk/zynqmp/pll.c 2022-11-29 07:06:46.000000000 +0000 @@ -102,26 +102,25 @@ unsigned long *prate) { u32 fbdiv; - long rate_div, f; + u32 mult, div; - /* Enable the fractional mode if needed */ - rate_div = (rate * FRAC_DIV) / *prate; - f = rate_div % FRAC_DIV; - if (f) { - if (rate > PS_PLL_VCO_MAX) { - fbdiv = rate / PS_PLL_VCO_MAX; - rate = rate / (fbdiv + 1); - } - if (rate < PS_PLL_VCO_MIN) { - fbdiv = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); - rate = rate * fbdiv; - } - return rate; + /* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ + if (rate > PS_PLL_VCO_MAX) { + div = DIV_ROUND_UP(rate, PS_PLL_VCO_MAX); + rate = rate / div; + } + if (rate < PS_PLL_VCO_MIN) { + mult = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); + rate = rate * mult; } fbdiv = DIV_ROUND_CLOSEST(rate, *prate); - fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); - return *prate * fbdiv; + if (fbdiv < PLL_FBDIV_MIN || fbdiv > PLL_FBDIV_MAX) { + fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); + rate = *prate * fbdiv; + } + + return rate; } /** diff -Nru linux-aws-5.19.0/drivers/clocksource/arm_arch_timer.c linux-aws-5.19.0/drivers/clocksource/arm_arch_timer.c --- linux-aws-5.19.0/drivers/clocksource/arm_arch_timer.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clocksource/arm_arch_timer.c 2022-11-29 07:06:46.000000000 +0000 @@ -44,8 +44,8 @@ #define CNTACR_RWVT BIT(4) #define CNTACR_RWPT BIT(5) -#define CNTVCT_LO 0x00 -#define CNTPCT_LO 0x08 +#define CNTPCT_LO 0x00 +#define CNTVCT_LO 0x08 #define CNTFRQ 0x10 #define CNTP_CVAL_LO 0x20 #define CNTP_CTL 0x2c @@ -473,6 +473,8 @@ .desc = "ARM erratum 858921", .read_cntpct_el0 = arm64_858921_read_cntpct_el0, .read_cntvct_el0 = arm64_858921_read_cntvct_el0, + .set_next_event_phys = erratum_set_next_event_phys, + .set_next_event_virt = erratum_set_next_event_virt, }, #endif #ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1 diff -Nru linux-aws-5.19.0/drivers/clocksource/timer-gxp.c linux-aws-5.19.0/drivers/clocksource/timer-gxp.c --- linux-aws-5.19.0/drivers/clocksource/timer-gxp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/clocksource/timer-gxp.c 2022-11-29 07:06:46.000000000 +0000 @@ -171,6 +171,7 @@ { struct platform_device *gxp_watchdog_device; struct device *dev = &pdev->dev; + int ret; if (!gxp_timer) { pr_err("Gxp Timer not initialized, cannot create watchdog"); @@ -187,7 +188,11 @@ gxp_watchdog_device->dev.platform_data = gxp_timer->counter; gxp_watchdog_device->dev.parent = dev; - return platform_device_add(gxp_watchdog_device); + ret = platform_device_add(gxp_watchdog_device); + if (ret) + platform_device_put(gxp_watchdog_device); + + return ret; } static const struct of_device_id gxp_timer_of_match[] = { diff -Nru linux-aws-5.19.0/drivers/counter/104-quad-8.c linux-aws-5.19.0/drivers/counter/104-quad-8.c --- linux-aws-5.19.0/drivers/counter/104-quad-8.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/counter/104-quad-8.c 2022-11-29 07:06:46.000000000 +0000 @@ -34,6 +34,36 @@ #define QUAD8_NUM_COUNTERS 8 /** + * struct channel_reg - channel register structure + * @data: Count data + * @control: Channel flags and control + */ +struct channel_reg { + u8 data; + u8 control; +}; + +/** + * struct quad8_reg - device register structure + * @channel: quadrature counter data and control + * @interrupt_status: channel interrupt status + * @channel_oper: enable/reset counters and interrupt functions + * @index_interrupt: enable channel interrupts + * @reserved: reserved for Factory Use + * @index_input_levels: index signal logical input level + * @cable_status: differential encoder cable status + */ +struct quad8_reg { + struct channel_reg channel[QUAD8_NUM_COUNTERS]; + u8 interrupt_status; + u8 channel_oper; + u8 index_interrupt; + u8 reserved[3]; + u8 index_input_levels; + u8 cable_status; +}; + +/** * struct quad8 - device private data structure * @lock: lock to prevent clobbering device states during R/W ops * @counter: instance of the counter_device @@ -48,7 +78,7 @@ * @synchronous_mode: array of index function synchronous mode configurations * @index_polarity: array of index function polarity configurations * @cable_fault_enable: differential encoder cable status enable configurations - * @base: base port address of the device + * @reg: I/O address offset for the device registers */ struct quad8 { spinlock_t lock; @@ -63,14 +93,9 @@ unsigned int synchronous_mode[QUAD8_NUM_COUNTERS]; unsigned int index_polarity[QUAD8_NUM_COUNTERS]; unsigned int cable_fault_enable; - unsigned int base; + struct quad8_reg __iomem *reg; }; -#define QUAD8_REG_INTERRUPT_STATUS 0x10 -#define QUAD8_REG_CHAN_OP 0x11 -#define QUAD8_REG_INDEX_INTERRUPT 0x12 -#define QUAD8_REG_INDEX_INPUT_LEVELS 0x16 -#define QUAD8_DIFF_ENCODER_CABLE_STATUS 0x17 /* Borrow Toggle flip-flop */ #define QUAD8_FLAG_BT BIT(0) /* Carry Toggle flip-flop */ @@ -118,8 +143,7 @@ if (signal->id < 16) return -EINVAL; - state = inb(priv->base + QUAD8_REG_INDEX_INPUT_LEVELS) - & BIT(signal->id - 16); + state = ioread8(&priv->reg->index_input_levels) & BIT(signal->id - 16); *level = (state) ? COUNTER_SIGNAL_LEVEL_HIGH : COUNTER_SIGNAL_LEVEL_LOW; @@ -130,14 +154,14 @@ struct counter_count *count, u64 *val) { struct quad8 *const priv = counter_priv(counter); - const int base_offset = priv->base + 2 * count->id; + struct channel_reg __iomem *const chan = priv->reg->channel + count->id; unsigned int flags; unsigned int borrow; unsigned int carry; unsigned long irqflags; int i; - flags = inb(base_offset + 1); + flags = ioread8(&chan->control); borrow = flags & QUAD8_FLAG_BT; carry = !!(flags & QUAD8_FLAG_CT); @@ -147,11 +171,11 @@ spin_lock_irqsave(&priv->lock, irqflags); /* Reset Byte Pointer; transfer Counter to Output Latch */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, - base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, + &chan->control); for (i = 0; i < 3; i++) - *val |= (unsigned long)inb(base_offset) << (8 * i); + *val |= (unsigned long)ioread8(&chan->data) << (8 * i); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -162,7 +186,7 @@ struct counter_count *count, u64 val) { struct quad8 *const priv = counter_priv(counter); - const int base_offset = priv->base + 2 * count->id; + struct channel_reg __iomem *const chan = priv->reg->channel + count->id; unsigned long irqflags; int i; @@ -173,27 +197,27 @@ spin_lock_irqsave(&priv->lock, irqflags); /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); /* Counter can only be set via Preset Register */ for (i = 0; i < 3; i++) - outb(val >> (8 * i), base_offset); + iowrite8(val >> (8 * i), &chan->data); /* Transfer Preset Register to Counter */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_PRESET_CNTR, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_PRESET_CNTR, &chan->control); /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); /* Set Preset Register back to original value */ val = priv->preset[count->id]; for (i = 0; i < 3; i++) - outb(val >> (8 * i), base_offset); + iowrite8(val >> (8 * i), &chan->data); /* Reset Borrow, Carry, Compare, and Sign flags */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, &chan->control); /* Reset Error flag */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, &chan->control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -246,7 +270,7 @@ unsigned int *const quadrature_mode = priv->quadrature_mode + id; unsigned int *const scale = priv->quadrature_scale + id; unsigned int *const synchronous_mode = priv->synchronous_mode + id; - const int base_offset = priv->base + 2 * id + 1; + u8 __iomem *const control = &priv->reg->channel[id].control; unsigned long irqflags; unsigned int mode_cfg; unsigned int idr_cfg; @@ -266,7 +290,7 @@ if (*synchronous_mode) { *synchronous_mode = 0; /* Disable synchronous function mode */ - outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + iowrite8(QUAD8_CTR_IDR | idr_cfg, control); } } else { *quadrature_mode = 1; @@ -292,7 +316,7 @@ } /* Load mode configuration to Counter Mode Register */ - outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + iowrite8(QUAD8_CTR_CMR | mode_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -305,10 +329,10 @@ { const struct quad8 *const priv = counter_priv(counter); unsigned int ud_flag; - const unsigned int flag_addr = priv->base + 2 * count->id + 1; + u8 __iomem *const flag_addr = &priv->reg->channel[count->id].control; /* U/D flag: nonzero = up, zero = down */ - ud_flag = inb(flag_addr) & QUAD8_FLAG_UD; + ud_flag = ioread8(flag_addr) & QUAD8_FLAG_UD; *direction = (ud_flag) ? COUNTER_COUNT_DIRECTION_FORWARD : COUNTER_COUNT_DIRECTION_BACKWARD; @@ -402,7 +426,6 @@ struct counter_event_node *event_node; unsigned int next_irq_trigger; unsigned long ior_cfg; - unsigned long base_offset; spin_lock_irqsave(&priv->lock, irqflags); @@ -426,6 +449,9 @@ return -EINVAL; } + /* Enable IRQ line */ + irq_enabled |= BIT(event_node->channel); + /* Skip configuration if it is the same as previously set */ if (priv->irq_trigger[event_node->channel] == next_irq_trigger) continue; @@ -437,14 +463,11 @@ ior_cfg = priv->ab_enable[event_node->channel] | priv->preset_enable[event_node->channel] << 1 | priv->irq_trigger[event_node->channel] << 3; - base_offset = priv->base + 2 * event_node->channel + 1; - outb(QUAD8_CTR_IOR | ior_cfg, base_offset); - - /* Enable IRQ line */ - irq_enabled |= BIT(event_node->channel); + iowrite8(QUAD8_CTR_IOR | ior_cfg, + &priv->reg->channel[event_node->channel].control); } - outb(irq_enabled, priv->base + QUAD8_REG_INDEX_INTERRUPT); + iowrite8(irq_enabled, &priv->reg->index_interrupt); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -508,7 +531,7 @@ { struct quad8 *const priv = counter_priv(counter); const size_t channel_id = signal->id - 16; - const int base_offset = priv->base + 2 * channel_id + 1; + u8 __iomem *const control = &priv->reg->channel[channel_id].control; unsigned long irqflags; unsigned int idr_cfg = index_polarity << 1; @@ -519,7 +542,7 @@ priv->index_polarity[channel_id] = index_polarity; /* Load Index Control configuration to Index Control Register */ - outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + iowrite8(QUAD8_CTR_IDR | idr_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -549,7 +572,7 @@ { struct quad8 *const priv = counter_priv(counter); const size_t channel_id = signal->id - 16; - const int base_offset = priv->base + 2 * channel_id + 1; + u8 __iomem *const control = &priv->reg->channel[channel_id].control; unsigned long irqflags; unsigned int idr_cfg = synchronous_mode; @@ -566,7 +589,7 @@ priv->synchronous_mode[channel_id] = synchronous_mode; /* Load Index Control configuration to Index Control Register */ - outb(QUAD8_CTR_IDR | idr_cfg, base_offset); + iowrite8(QUAD8_CTR_IDR | idr_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -614,7 +637,7 @@ struct quad8 *const priv = counter_priv(counter); unsigned int count_mode; unsigned int mode_cfg; - const int base_offset = priv->base + 2 * count->id + 1; + u8 __iomem *const control = &priv->reg->channel[count->id].control; unsigned long irqflags; /* Map Generic Counter count mode to 104-QUAD-8 count mode */ @@ -648,7 +671,7 @@ mode_cfg |= (priv->quadrature_scale[count->id] + 1) << 3; /* Load mode configuration to Counter Mode Register */ - outb(QUAD8_CTR_CMR | mode_cfg, base_offset); + iowrite8(QUAD8_CTR_CMR | mode_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -669,7 +692,7 @@ struct counter_count *count, u8 enable) { struct quad8 *const priv = counter_priv(counter); - const int base_offset = priv->base + 2 * count->id; + u8 __iomem *const control = &priv->reg->channel[count->id].control; unsigned long irqflags; unsigned int ior_cfg; @@ -681,7 +704,7 @@ priv->irq_trigger[count->id] << 3; /* Load I/O control configuration */ - outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); + iowrite8(QUAD8_CTR_IOR | ior_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -697,9 +720,9 @@ struct counter_count *count, u32 *noise_error) { const struct quad8 *const priv = counter_priv(counter); - const int base_offset = priv->base + 2 * count->id + 1; + u8 __iomem *const flag_addr = &priv->reg->channel[count->id].control; - *noise_error = !!(inb(base_offset) & QUAD8_FLAG_E); + *noise_error = !!(ioread8(flag_addr) & QUAD8_FLAG_E); return 0; } @@ -717,17 +740,17 @@ static void quad8_preset_register_set(struct quad8 *const priv, const int id, const unsigned int preset) { - const unsigned int base_offset = priv->base + 2 * id; + struct channel_reg __iomem *const chan = priv->reg->channel + id; int i; priv->preset[id] = preset; /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); /* Set Preset Register */ for (i = 0; i < 3; i++) - outb(preset >> (8 * i), base_offset); + iowrite8(preset >> (8 * i), &chan->data); } static int quad8_count_preset_write(struct counter_device *counter, @@ -816,7 +839,7 @@ u8 preset_enable) { struct quad8 *const priv = counter_priv(counter); - const int base_offset = priv->base + 2 * count->id + 1; + u8 __iomem *const control = &priv->reg->channel[count->id].control; unsigned long irqflags; unsigned int ior_cfg; @@ -831,7 +854,7 @@ priv->irq_trigger[count->id] << 3; /* Load I/O control configuration to Input / Output Control Register */ - outb(QUAD8_CTR_IOR | ior_cfg, base_offset); + iowrite8(QUAD8_CTR_IOR | ior_cfg, control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -858,7 +881,7 @@ } /* Logic 0 = cable fault */ - status = inb(priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS); + status = ioread8(&priv->reg->cable_status); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -899,7 +922,7 @@ /* Enable is active low in Differential Encoder Cable Status register */ cable_fault_enable = ~priv->cable_fault_enable; - outb(cable_fault_enable, priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS); + iowrite8(cable_fault_enable, &priv->reg->cable_status); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -923,7 +946,7 @@ { struct quad8 *const priv = counter_priv(counter); const size_t channel_id = signal->id / 2; - const int base_offset = priv->base + 2 * channel_id; + struct channel_reg __iomem *const chan = priv->reg->channel + channel_id; unsigned long irqflags; spin_lock_irqsave(&priv->lock, irqflags); @@ -931,12 +954,12 @@ priv->fck_prescaler[channel_id] = prescaler; /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); /* Set filter clock factor */ - outb(prescaler, base_offset); - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC, - base_offset + 1); + iowrite8(prescaler, &chan->data); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC, + &chan->control); spin_unlock_irqrestore(&priv->lock, irqflags); @@ -1084,12 +1107,11 @@ { struct counter_device *counter = private; struct quad8 *const priv = counter_priv(counter); - const unsigned long base = priv->base; unsigned long irq_status; unsigned long channel; u8 event; - irq_status = inb(base + QUAD8_REG_INTERRUPT_STATUS); + irq_status = ioread8(&priv->reg->interrupt_status); if (!irq_status) return IRQ_NONE; @@ -1118,17 +1140,43 @@ } /* Clear pending interrupts on device */ - outb(QUAD8_CHAN_OP_ENABLE_INTERRUPT_FUNC, base + QUAD8_REG_CHAN_OP); + iowrite8(QUAD8_CHAN_OP_ENABLE_INTERRUPT_FUNC, &priv->reg->channel_oper); return IRQ_HANDLED; } +static void quad8_init_counter(struct channel_reg __iomem *const chan) +{ + unsigned long i; + + /* Reset Byte Pointer */ + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); + /* Reset filter clock factor */ + iowrite8(0, &chan->data); + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC, + &chan->control); + /* Reset Byte Pointer */ + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, &chan->control); + /* Reset Preset Register */ + for (i = 0; i < 3; i++) + iowrite8(0x00, &chan->data); + /* Reset Borrow, Carry, Compare, and Sign flags */ + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, &chan->control); + /* Reset Error flag */ + iowrite8(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, &chan->control); + /* Binary encoding; Normal count; non-quadrature mode */ + iowrite8(QUAD8_CTR_CMR, &chan->control); + /* Disable A and B inputs; preset on index; FLG1 as Carry */ + iowrite8(QUAD8_CTR_IOR, &chan->control); + /* Disable index function; negative index polarity */ + iowrite8(QUAD8_CTR_IDR, &chan->control); +} + static int quad8_probe(struct device *dev, unsigned int id) { struct counter_device *counter; struct quad8 *priv; - int i, j; - unsigned int base_offset; + unsigned long i; int err; if (!devm_request_region(dev, base[id], QUAD8_EXTENT, dev_name(dev))) { @@ -1142,6 +1190,10 @@ return -ENOMEM; priv = counter_priv(counter); + priv->reg = devm_ioport_map(dev, base[id], QUAD8_EXTENT); + if (!priv->reg) + return -ENOMEM; + /* Initialize Counter device and driver data */ counter->name = dev_name(dev); counter->parent = dev; @@ -1150,43 +1202,20 @@ counter->num_counts = ARRAY_SIZE(quad8_counts); counter->signals = quad8_signals; counter->num_signals = ARRAY_SIZE(quad8_signals); - priv->base = base[id]; spin_lock_init(&priv->lock); /* Reset Index/Interrupt Register */ - outb(0x00, base[id] + QUAD8_REG_INDEX_INTERRUPT); + iowrite8(0x00, &priv->reg->index_interrupt); /* Reset all counters and disable interrupt function */ - outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP); + iowrite8(QUAD8_CHAN_OP_RESET_COUNTERS, &priv->reg->channel_oper); /* Set initial configuration for all counters */ - for (i = 0; i < QUAD8_NUM_COUNTERS; i++) { - base_offset = base[id] + 2 * i; - /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); - /* Reset filter clock factor */ - outb(0, base_offset); - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC, - base_offset + 1); - /* Reset Byte Pointer */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); - /* Reset Preset Register */ - for (j = 0; j < 3; j++) - outb(0x00, base_offset); - /* Reset Borrow, Carry, Compare, and Sign flags */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1); - /* Reset Error flag */ - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); - /* Binary encoding; Normal count; non-quadrature mode */ - outb(QUAD8_CTR_CMR, base_offset + 1); - /* Disable A and B inputs; preset on index; FLG1 as Carry */ - outb(QUAD8_CTR_IOR, base_offset + 1); - /* Disable index function; negative index polarity */ - outb(QUAD8_CTR_IDR, base_offset + 1); - } + for (i = 0; i < QUAD8_NUM_COUNTERS; i++) + quad8_init_counter(priv->reg->channel + i); /* Disable Differential Encoder Cable Status for all channels */ - outb(0xFF, base[id] + QUAD8_DIFF_ENCODER_CABLE_STATUS); + iowrite8(0xFF, &priv->reg->cable_status); /* Enable all counters and enable interrupt function */ - outb(QUAD8_CHAN_OP_ENABLE_INTERRUPT_FUNC, base[id] + QUAD8_REG_CHAN_OP); + iowrite8(QUAD8_CHAN_OP_ENABLE_INTERRUPT_FUNC, &priv->reg->channel_oper); err = devm_request_irq(&counter->dev, irq[id], quad8_irq_handler, IRQF_SHARED, counter->name, counter); diff -Nru linux-aws-5.19.0/drivers/cpufreq/amd-pstate.c linux-aws-5.19.0/drivers/cpufreq/amd-pstate.c --- linux-aws-5.19.0/drivers/cpufreq/amd-pstate.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/cpufreq/amd-pstate.c 2022-11-29 07:06:46.000000000 +0000 @@ -152,6 +152,7 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; + u32 highest_perf; int ret = rdmsrl_safe_on_cpu(cpudata->cpu, MSR_AMD_CPPC_CAP1, &cap1); @@ -163,7 +164,11 @@ * * CPPC entry doesn't indicate the highest performance in some ASICs. */ - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) + highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); @@ -175,12 +180,17 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; + u32 highest_perf; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > cppc_perf.highest_perf) + highest_perf = cppc_perf.highest_perf; + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, cppc_perf.nominal_perf); WRITE_ONCE(cpudata->lowest_nonlinear_perf, @@ -312,7 +322,7 @@ return -ENODEV; cap_perf = READ_ONCE(cpudata->highest_perf); - min_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); + min_perf = READ_ONCE(cpudata->lowest_perf); max_perf = cap_perf; freqs.old = policy->cur; diff -Nru linux-aws-5.19.0/drivers/cpufreq/cpufreq.c linux-aws-5.19.0/drivers/cpufreq/cpufreq.c --- linux-aws-5.19.0/drivers/cpufreq/cpufreq.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/cpufreq/cpufreq.c 2022-11-29 07:06:46.000000000 +0000 @@ -532,7 +532,7 @@ target_freq = clamp_val(target_freq, policy->min, policy->max); - if (!cpufreq_driver->target_index) + if (!policy->freq_table) return target_freq; idx = cpufreq_frequency_table_target(policy, target_freq, relation); diff -Nru linux-aws-5.19.0/drivers/cpufreq/intel_pstate.c linux-aws-5.19.0/drivers/cpufreq/intel_pstate.c --- linux-aws-5.19.0/drivers/cpufreq/intel_pstate.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/cpufreq/intel_pstate.c 2022-11-29 07:06:46.000000000 +0000 @@ -2416,6 +2416,7 @@ X86_MATCH(SKYLAKE_X, core_funcs), X86_MATCH(COMETLAKE, core_funcs), X86_MATCH(ICELAKE_X, core_funcs), + X86_MATCH(TIGERLAKE, core_funcs), {} }; MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); diff -Nru linux-aws-5.19.0/drivers/cpufreq/qcom-cpufreq-hw.c linux-aws-5.19.0/drivers/cpufreq/qcom-cpufreq-hw.c --- linux-aws-5.19.0/drivers/cpufreq/qcom-cpufreq-hw.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/cpufreq/qcom-cpufreq-hw.c 2022-11-29 07:06:46.000000000 +0000 @@ -317,14 +317,14 @@ if (IS_ERR(opp)) { dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp); } else { - throttled_freq = freq_hz / HZ_PER_KHZ; - - /* Update thermal pressure (the boost frequencies are accepted) */ - arch_update_thermal_pressure(policy->related_cpus, throttled_freq); - dev_pm_opp_put(opp); } + throttled_freq = freq_hz / HZ_PER_KHZ; + + /* Update thermal pressure (the boost frequencies are accepted) */ + arch_update_thermal_pressure(policy->related_cpus, throttled_freq); + /* * In the unlikely case policy is unregistered do not enable * polling or h/w interrupt diff -Nru linux-aws-5.19.0/drivers/cpuidle/cpuidle-riscv-sbi.c linux-aws-5.19.0/drivers/cpuidle/cpuidle-riscv-sbi.c --- linux-aws-5.19.0/drivers/cpuidle/cpuidle-riscv-sbi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/cpuidle/cpuidle-riscv-sbi.c 2022-11-29 07:06:46.000000000 +0000 @@ -97,8 +97,13 @@ struct cpuidle_driver *drv, int idx) { u32 *states = __this_cpu_read(sbi_cpuidle_data.states); + u32 state = states[idx]; - return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, states[idx]); + if (state & SBI_HSM_SUSP_NON_RET_BIT) + return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, state); + else + return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(sbi_suspend, + idx, state); } static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev, diff -Nru linux-aws-5.19.0/drivers/crypto/cavium/cpt/cptpf_main.c linux-aws-5.19.0/drivers/crypto/cavium/cpt/cptpf_main.c --- linux-aws-5.19.0/drivers/crypto/cavium/cpt/cptpf_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/cavium/cpt/cptpf_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -253,6 +253,7 @@ const struct firmware *fw_entry; struct device *dev = &cpt->pdev->dev; struct ucode_header *ucode; + unsigned int code_length; struct microcode *mcode; int j, ret = 0; @@ -263,11 +264,12 @@ ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx]; memcpy(mcode->version, (u8 *)fw_entry->data, CPT_UCODE_VERSION_SZ); - mcode->code_size = ntohl(ucode->code_length) * 2; - if (!mcode->code_size) { + code_length = ntohl(ucode->code_length); + if (code_length == 0 || code_length >= INT_MAX / 2) { ret = -EINVAL; goto fw_release; } + mcode->code_size = code_length * 2; mcode->is_ae = is_ae; mcode->core_mask = 0ULL; diff -Nru linux-aws-5.19.0/drivers/crypto/ccp/ccp-dmaengine.c linux-aws-5.19.0/drivers/crypto/ccp/ccp-dmaengine.c --- linux-aws-5.19.0/drivers/crypto/ccp/ccp-dmaengine.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/ccp/ccp-dmaengine.c 2022-11-29 07:06:46.000000000 +0000 @@ -641,6 +641,10 @@ for (i = 0; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + + if (dma_chan->client_count) + dma_release_channel(dma_chan); + tasklet_kill(&chan->cleanup_tasklet); list_del_rcu(&dma_chan->device_node); } @@ -766,8 +770,8 @@ if (!dmaengine) return; - dma_async_device_unregister(dma_dev); ccp_dma_release(ccp); + dma_async_device_unregister(dma_dev); kmem_cache_destroy(ccp->dma_desc_cache); kmem_cache_destroy(ccp->dma_cmd_cache); diff -Nru linux-aws-5.19.0/drivers/crypto/ccp/sev-dev.c linux-aws-5.19.0/drivers/crypto/ccp/sev-dev.c --- linux-aws-5.19.0/drivers/crypto/ccp/sev-dev.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/ccp/sev-dev.c 2022-11-29 07:06:46.000000000 +0000 @@ -231,7 +231,7 @@ return 0; } -static void sev_write_init_ex_file(void) +static int sev_write_init_ex_file(void) { struct sev_device *sev = psp_master->sev_data; struct file *fp; @@ -241,14 +241,16 @@ lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; fp = open_file_as_root(init_ex_path, O_CREAT | O_WRONLY, 0600); if (IS_ERR(fp)) { + int ret = PTR_ERR(fp); + dev_err(sev->dev, - "SEV: could not open file for write, error %ld\n", - PTR_ERR(fp)); - return; + "SEV: could not open file for write, error %d\n", + ret); + return ret; } nwrite = kernel_write(fp, sev_init_ex_buffer, NV_LENGTH, &offset); @@ -259,18 +261,20 @@ dev_err(sev->dev, "SEV: failed to write %u bytes to non volatile memory area, ret %ld\n", NV_LENGTH, nwrite); - return; + return -EIO; } dev_dbg(sev->dev, "SEV: write successful to NV file\n"); + + return 0; } -static void sev_write_init_ex_file_if_required(int cmd_id) +static int sev_write_init_ex_file_if_required(int cmd_id) { lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; /* * Only a few platform commands modify the SPI/NV area, but none of the @@ -285,10 +289,10 @@ case SEV_CMD_PEK_GEN: break; default: - return; + return 0; } - sev_write_init_ex_file(); + return sev_write_init_ex_file(); } static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) @@ -361,7 +365,7 @@ cmd, reg & PSP_CMDRESP_ERR_MASK); ret = -EIO; } else { - sev_write_init_ex_file_if_required(cmd); + ret = sev_write_init_ex_file_if_required(cmd); } print_hex_dump_debug("(out): ", DUMP_PREFIX_OFFSET, 16, 2, data, diff -Nru linux-aws-5.19.0/drivers/crypto/ccp/sp-pci.c linux-aws-5.19.0/drivers/crypto/ccp/sp-pci.c --- linux-aws-5.19.0/drivers/crypto/ccp/sp-pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/ccp/sp-pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -381,6 +381,15 @@ .inten_reg = 0x10690, .intsts_reg = 0x10694, }; + +static const struct psp_vdata pspv4 = { + .sev = &sevv2, + .tee = &teev1, + .feature_reg = 0x109fc, + .inten_reg = 0x10690, + .intsts_reg = 0x10694, +}; + #endif static const struct sp_dev_vdata dev_vdata[] = { @@ -426,7 +435,7 @@ { /* 5 */ .bar = 2, #ifdef CONFIG_CRYPTO_DEV_SP_PSP - .psp_vdata = &pspv2, + .psp_vdata = &pspv4, #endif }, }; diff -Nru linux-aws-5.19.0/drivers/crypto/hisilicon/qm.c linux-aws-5.19.0/drivers/crypto/hisilicon/qm.c --- linux-aws-5.19.0/drivers/crypto/hisilicon/qm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/hisilicon/qm.c 2022-11-29 07:06:46.000000000 +0000 @@ -2229,8 +2229,10 @@ return ret; /* Judge if the instance is being reset. */ - if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) - return 0; + if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) { + ret = 0; + goto put_dfx_access; + } if (count > QM_DBG_WRITE_LEN) { ret = -ENOSPC; diff -Nru linux-aws-5.19.0/drivers/crypto/hisilicon/zip/zip_crypto.c linux-aws-5.19.0/drivers/crypto/hisilicon/zip/zip_crypto.c --- linux-aws-5.19.0/drivers/crypto/hisilicon/zip/zip_crypto.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/hisilicon/zip/zip_crypto.c 2022-11-29 07:06:46.000000000 +0000 @@ -122,12 +122,12 @@ if (ret || n == 0 || n > HISI_ACC_SGL_SGE_NR_MAX) return -EINVAL; - return param_set_int(val, kp); + return param_set_ushort(val, kp); } static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, }; static u16 sgl_sge_nr = HZIP_SGL_SGE_NR; diff -Nru linux-aws-5.19.0/drivers/crypto/inside-secure/safexcel_hash.c linux-aws-5.19.0/drivers/crypto/inside-secure/safexcel_hash.c --- linux-aws-5.19.0/drivers/crypto/inside-secure/safexcel_hash.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/inside-secure/safexcel_hash.c 2022-11-29 07:06:46.000000000 +0000 @@ -383,7 +383,7 @@ u32 x; x = ipad[i] ^ ipad[i + 4]; - cache[i] ^= swab(x); + cache[i] ^= swab32(x); } } cache_len = AES_BLOCK_SIZE; @@ -821,7 +821,7 @@ u32 *result = (void *)areq->result; /* K3 */ - result[i] = swab(ctx->base.ipad.word[i + 4]); + result[i] = swab32(ctx->base.ipad.word[i + 4]); } areq->result[0] ^= 0x80; // 10- padding crypto_cipher_encrypt_one(ctx->kaes, areq->result, areq->result); @@ -2106,7 +2106,7 @@ crypto_cipher_encrypt_one(ctx->kaes, (u8 *)key_tmp + AES_BLOCK_SIZE, "\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3"); for (i = 0; i < 3 * AES_BLOCK_SIZE / sizeof(u32); i++) - ctx->base.ipad.word[i] = swab(key_tmp[i]); + ctx->base.ipad.word[i] = swab32(key_tmp[i]); crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) & @@ -2189,7 +2189,7 @@ return ret; for (i = 0; i < len / sizeof(u32); i++) - ctx->base.ipad.word[i + 8] = swab(aes.key_enc[i]); + ctx->base.ipad.word[i + 8] = swab32(aes.key_enc[i]); /* precompute the CMAC key material */ crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); diff -Nru linux-aws-5.19.0/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c linux-aws-5.19.0/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c --- linux-aws-5.19.0/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c 2022-11-29 07:06:46.000000000 +0000 @@ -286,6 +286,7 @@ struct tar_ucode_info_t *tar_info; struct otx_cpt_ucode_hdr *ucode_hdr; int ucode_type, ucode_size; + unsigned int code_length; /* * If size is less than microcode header size then don't report @@ -303,7 +304,13 @@ if (get_ucode_type(ucode_hdr, &ucode_type)) return 0; - ucode_size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Invalid code_length %u\n", code_length); + return -EINVAL; + } + + ucode_size = code_length * 2; if (!ucode_size || (size < round_up(ucode_size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", filename); @@ -886,6 +893,7 @@ { struct otx_cpt_ucode_hdr *ucode_hdr; const struct firmware *fw; + unsigned int code_length; int ret; set_ucode_filename(ucode, ucode_filename); @@ -896,7 +904,13 @@ ucode_hdr = (struct otx_cpt_ucode_hdr *) fw->data; memcpy(ucode->ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ); ucode->ver_num = ucode_hdr->ver_num; - ucode->size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Ucode invalid code_length %u\n", code_length); + ret = -EINVAL; + goto release_fw; + } + ucode->size = code_length * 2; if (!ucode->size || (fw->size < round_up(ucode->size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", ucode_filename); diff -Nru linux-aws-5.19.0/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h linux-aws-5.19.0/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h --- linux-aws-5.19.0/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h 2022-11-29 07:06:46.000000000 +0000 @@ -107,7 +107,7 @@ * Timeout is in cycles. Clock speed may vary across products but this * value should be a few milli-seconds. */ -#define ADF_SSM_WDT_DEFAULT_VALUE 0x200000 +#define ADF_SSM_WDT_DEFAULT_VALUE 0x7000000ULL #define ADF_SSM_WDT_PKE_DEFAULT_VALUE 0x8000000 #define ADF_SSMWDTL_OFFSET 0x54 #define ADF_SSMWDTH_OFFSET 0x5C diff -Nru linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_algs.c linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_algs.c --- linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_algs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_algs.c 2022-11-29 07:06:46.000000000 +0000 @@ -673,11 +673,14 @@ dma_addr_t blpout = qat_req->buf.bloutp; size_t sz = qat_req->buf.sz; size_t sz_out = qat_req->buf.sz_out; + int bl_dma_dir; int i; + bl_dma_dir = blp != blpout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for (i = 0; i < bl->num_bufs; i++) dma_unmap_single(dev, bl->bufers[i].addr, - bl->bufers[i].len, DMA_BIDIRECTIONAL); + bl->bufers[i].len, bl_dma_dir); dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); @@ -691,7 +694,7 @@ for (i = bufless; i < blout->num_bufs; i++) { dma_unmap_single(dev, blout->bufers[i].addr, blout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); } dma_unmap_single(dev, blpout, sz_out, DMA_TO_DEVICE); @@ -716,6 +719,7 @@ struct scatterlist *sg; size_t sz_out, sz = struct_size(bufl, bufers, n); int node = dev_to_node(&GET_DEV(inst->accel_dev)); + int bufl_dma_dir; if (unlikely(!n)) return -EINVAL; @@ -733,6 +737,8 @@ qat_req->buf.sgl_src_valid = true; } + bufl_dma_dir = sgl != sglout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; @@ -744,7 +750,7 @@ bufl->bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + bufl_dma_dir); bufl->bufers[y].len = sg->length; if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) goto err_in; @@ -787,7 +793,7 @@ bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(dev, bufers[y].addr))) goto err_out; bufers[y].len = sg->length; @@ -817,7 +823,7 @@ if (!dma_mapping_error(dev, buflout->bufers[i].addr)) dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (!qat_req->buf.sgl_dst_valid) kfree(buflout); @@ -831,7 +837,7 @@ if (!dma_mapping_error(dev, bufl->bufers[i].addr)) dma_unmap_single(dev, bufl->bufers[i].addr, bufl->bufers[i].len, - DMA_BIDIRECTIONAL); + bufl_dma_dir); if (!qat_req->buf.sgl_src_valid) kfree(bufl); diff -Nru linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_asym_algs.c linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_asym_algs.c --- linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_asym_algs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/qat/qat_common/qat_asym_algs.c 2022-11-29 07:06:46.000000000 +0000 @@ -333,13 +333,13 @@ qat_req->out.dh.out_tab[1] = 0; /* Mapping in.in.b or in.in_g2.xa is the same */ qat_req->phy_in = dma_map_single(dev, &qat_req->in.dh.in.b, - sizeof(qat_req->in.dh.in.b), + sizeof(struct qat_dh_input_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_in))) goto unmap_dst; qat_req->phy_out = dma_map_single(dev, &qat_req->out.dh.r, - sizeof(qat_req->out.dh.r), + sizeof(struct qat_dh_output_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_out))) goto unmap_in_params; @@ -730,13 +730,13 @@ qat_req->in.rsa.in_tab[3] = 0; qat_req->out.rsa.out_tab[1] = 0; qat_req->phy_in = dma_map_single(dev, &qat_req->in.rsa.enc.m, - sizeof(qat_req->in.rsa.enc.m), + sizeof(struct qat_rsa_input_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_in))) goto unmap_dst; qat_req->phy_out = dma_map_single(dev, &qat_req->out.rsa.enc.c, - sizeof(qat_req->out.rsa.enc.c), + sizeof(struct qat_rsa_output_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_out))) goto unmap_in_params; @@ -876,13 +876,13 @@ qat_req->in.rsa.in_tab[3] = 0; qat_req->out.rsa.out_tab[1] = 0; qat_req->phy_in = dma_map_single(dev, &qat_req->in.rsa.dec.c, - sizeof(qat_req->in.rsa.dec.c), + sizeof(struct qat_rsa_input_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_in))) goto unmap_dst; qat_req->phy_out = dma_map_single(dev, &qat_req->out.rsa.dec.m, - sizeof(qat_req->out.rsa.dec.m), + sizeof(struct qat_rsa_output_params), DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev, qat_req->phy_out))) goto unmap_in_params; diff -Nru linux-aws-5.19.0/drivers/crypto/sahara.c linux-aws-5.19.0/drivers/crypto/sahara.c --- linux-aws-5.19.0/drivers/crypto/sahara.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/crypto/sahara.c 2022-11-29 07:06:46.000000000 +0000 @@ -26,10 +26,10 @@ #include #include #include -#include #include #include #include +#include #define SHA_BUFFER_LEN PAGE_SIZE #define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE @@ -196,7 +196,7 @@ void __iomem *regs_base; struct clk *clk_ipg; struct clk *clk_ahb; - struct mutex queue_mutex; + spinlock_t queue_spinlock; struct task_struct *kthread; struct completion dma_completion; @@ -642,9 +642,9 @@ rctx->mode = mode; - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); err = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1043,10 +1043,10 @@ do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS); @@ -1092,9 +1092,9 @@ rctx->first = 1; } - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); ret = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1449,7 +1449,7 @@ crypto_init_queue(&dev->queue, SAHARA_QUEUE_LENGTH); - mutex_init(&dev->queue_mutex); + spin_lock_init(&dev->queue_spinlock); dev_ptr = dev; diff -Nru linux-aws-5.19.0/drivers/dax/hmem/device.c linux-aws-5.19.0/drivers/dax/hmem/device.c --- linux-aws-5.19.0/drivers/dax/hmem/device.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dax/hmem/device.c 2022-11-29 07:06:46.000000000 +0000 @@ -15,6 +15,7 @@ .start = r->start, .end = r->end, .flags = IORESOURCE_MEM, + .desc = IORES_DESC_SOFT_RESERVED, }; struct platform_device *pdev; struct memregion_info info; diff -Nru linux-aws-5.19.0/drivers/dma/hisi_dma.c linux-aws-5.19.0/drivers/dma/hisi_dma.c --- linux-aws-5.19.0/drivers/dma/hisi_dma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/hisi_dma.c 2022-11-29 07:06:46.000000000 +0000 @@ -180,7 +180,8 @@ hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, index, 0); } -static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, + bool disable) { struct hisi_dma_dev *hdma_dev = chan->hdma_dev; u32 index = chan->qp_num, tmp; @@ -201,8 +202,11 @@ hisi_dma_do_reset(hdma_dev, index); hisi_dma_reset_qp_point(hdma_dev, index); hisi_dma_pause_dma(hdma_dev, index, false); - hisi_dma_enable_dma(hdma_dev, index, true); - hisi_dma_unmask_irq(hdma_dev, index); + + if (!disable) { + hisi_dma_enable_dma(hdma_dev, index, true); + hisi_dma_unmask_irq(hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, @@ -218,7 +222,7 @@ struct hisi_dma_chan *chan = to_hisi_dma_chan(c); struct hisi_dma_dev *hdma_dev = chan->hdma_dev; - hisi_dma_reset_hw_chan(chan); + hisi_dma_reset_or_disable_hw_chan(chan, false); vchan_free_chan_resources(&chan->vc); memset(chan->sq, 0, sizeof(struct hisi_dma_sqe) * hdma_dev->chan_depth); @@ -267,7 +271,6 @@ vd = vchan_next_desc(&chan->vc); if (!vd) { - dev_err(&hdma_dev->pdev->dev, "no issued task!\n"); chan->desc = NULL; return; } @@ -299,7 +302,7 @@ spin_lock_irqsave(&chan->vc.lock, flags); - if (vchan_issue_pending(&chan->vc)) + if (vchan_issue_pending(&chan->vc) && !chan->desc) hisi_dma_start_transfer(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -394,7 +397,7 @@ static void hisi_dma_disable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) { - hisi_dma_reset_hw_chan(&hdma_dev->chan[qp_index]); + hisi_dma_reset_or_disable_hw_chan(&hdma_dev->chan[qp_index], true); } static void hisi_dma_enable_qps(struct hisi_dma_dev *hdma_dev) @@ -432,18 +435,15 @@ desc = chan->desc; cqe = chan->cq + chan->cq_head; if (desc) { + chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth; + hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, + chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { - chan->cq_head = (chan->cq_head + 1) % - hdma_dev->chan_depth; - hisi_dma_chan_write(hdma_dev->base, - HISI_DMA_CQ_HEAD_PTR, chan->qp_num, - chan->cq_head); vchan_cookie_complete(&desc->vd); + hisi_dma_start_transfer(chan); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); } - - chan->desc = NULL; } spin_unlock(&chan->vc.lock); diff -Nru linux-aws-5.19.0/drivers/dma/idxd/irq.c linux-aws-5.19.0/drivers/dma/idxd/irq.c --- linux-aws-5.19.0/drivers/dma/idxd/irq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/idxd/irq.c 2022-11-29 07:06:46.000000000 +0000 @@ -324,13 +324,11 @@ idxd->state = IDXD_DEV_HALTED; idxd_wqs_quiesce(idxd); idxd_wqs_unmap_portal(idxd); - spin_lock(&idxd->dev_lock); idxd_device_clear_state(idxd); dev_err(&idxd->pdev->dev, "idxd halted, need %s.\n", gensts.reset_type == IDXD_DEVICE_RESET_FLR ? "FLR" : "system reset"); - spin_unlock(&idxd->dev_lock); return -ENXIO; } } diff -Nru linux-aws-5.19.0/drivers/dma/ioat/dma.c linux-aws-5.19.0/drivers/dma/ioat/dma.c --- linux-aws-5.19.0/drivers/dma/ioat/dma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/ioat/dma.c 2022-11-29 07:06:46.000000000 +0000 @@ -656,7 +656,7 @@ if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -682,7 +682,7 @@ if (chanerr & (IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) { - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); ioat_eh(ioat_chan); } } @@ -879,7 +879,7 @@ } if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state)) - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan) diff -Nru linux-aws-5.19.0/drivers/dma/mxs-dma.c linux-aws-5.19.0/drivers/dma/mxs-dma.c --- linux-aws-5.19.0/drivers/dma/mxs-dma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/mxs-dma.c 2022-11-29 07:06:46.000000000 +0000 @@ -670,7 +670,7 @@ return mxs_chan->status; } -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) { int ret; @@ -741,7 +741,7 @@ ofdma->of_node); } -static int __init mxs_dma_probe(struct platform_device *pdev) +static int mxs_dma_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; const struct mxs_dma_type *dma_type; @@ -839,10 +839,7 @@ .name = "mxs-dma", .of_match_table = mxs_dma_dt_ids, }, + .probe = mxs_dma_probe, }; -static int __init mxs_dma_module_init(void) -{ - return platform_driver_probe(&mxs_dma_driver, mxs_dma_probe); -} -subsys_initcall(mxs_dma_module_init); +builtin_platform_driver(mxs_dma_driver); diff -Nru linux-aws-5.19.0/drivers/dma/qcom/qcom_adm.c linux-aws-5.19.0/drivers/dma/qcom/qcom_adm.c --- linux-aws-5.19.0/drivers/dma/qcom/qcom_adm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/qcom/qcom_adm.c 2022-11-29 07:06:46.000000000 +0000 @@ -379,13 +379,13 @@ if (blk_size < 0) { dev_err(adev->dev, "invalid burst value: %d\n", burst); - return ERR_PTR(-EINVAL); + return NULL; } crci = achan->crci & 0xf; if (!crci || achan->crci > 0x1f) { dev_err(adev->dev, "invalid crci value\n"); - return ERR_PTR(-EINVAL); + return NULL; } } @@ -403,8 +403,10 @@ } async_desc = kzalloc(sizeof(*async_desc), GFP_NOWAIT); - if (!async_desc) - return ERR_PTR(-ENOMEM); + if (!async_desc) { + dev_err(adev->dev, "not enough memory for async_desc struct\n"); + return NULL; + } async_desc->mux = achan->mux ? ADM_CRCI_CTL_MUX_SEL : 0; async_desc->crci = crci; @@ -414,8 +416,10 @@ sizeof(*cple) + 2 * ADM_DESC_ALIGN; async_desc->cpl = kzalloc(async_desc->dma_len, GFP_NOWAIT); - if (!async_desc->cpl) + if (!async_desc->cpl) { + dev_err(adev->dev, "not enough memory for cpl struct\n"); goto free; + } async_desc->adev = adev; @@ -437,8 +441,10 @@ async_desc->dma_addr = dma_map_single(adev->dev, async_desc->cpl, async_desc->dma_len, DMA_TO_DEVICE); - if (dma_mapping_error(adev->dev, async_desc->dma_addr)) + if (dma_mapping_error(adev->dev, async_desc->dma_addr)) { + dev_err(adev->dev, "dma mapping error for cpl\n"); goto free; + } cple_addr = async_desc->dma_addr + ((void *)cple - async_desc->cpl); @@ -454,7 +460,7 @@ free: kfree(async_desc); - return ERR_PTR(-ENOMEM); + return NULL; } /** @@ -494,7 +500,7 @@ spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); - if (cfg->peripheral_size == sizeof(config)) + if (cfg->peripheral_size == sizeof(*config)) achan->crci = config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag); diff -Nru linux-aws-5.19.0/drivers/dma/ti/k3-udma.c linux-aws-5.19.0/drivers/dma/ti/k3-udma.c --- linux-aws-5.19.0/drivers/dma/ti/k3-udma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/ti/k3-udma.c 2022-11-29 07:06:46.000000000 +0000 @@ -300,8 +300,6 @@ struct udma_tx_drain tx_drain; - u32 bcnt; /* number of bytes completed since the start of the channel */ - /* Channel configuration parameters */ struct udma_chan_config config; @@ -757,6 +755,20 @@ } } +static void udma_decrement_byte_counters(struct udma_chan *uc, u32 val) +{ + if (uc->desc->dir == DMA_DEV_TO_MEM) { + udma_rchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } else { + udma_tchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_tchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + if (!uc->bchan) + udma_tchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } +} + static void udma_reset_counters(struct udma_chan *uc) { u32 val; @@ -790,8 +802,6 @@ val = udma_rchanrt_read(uc, UDMA_CHAN_RT_PEER_BCNT_REG); udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); } - - uc->bcnt = 0; } static int udma_reset_chan(struct udma_chan *uc, bool hard) @@ -1115,7 +1125,7 @@ if (uc->desc) { struct udma_desc *d = uc->desc; - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); break; @@ -1168,7 +1178,7 @@ vchan_cyclic_callback(&d->vd); } else { if (udma_is_desc_really_done(uc, d)) { - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } else { @@ -1204,7 +1214,7 @@ vchan_cyclic_callback(&d->vd); } else { /* TODO: figure out the real amount of data */ - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } @@ -3809,7 +3819,6 @@ bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_BCNT_REG); } - bcnt -= uc->bcnt; if (bcnt && !(bcnt % uc->desc->residue)) residue = 0; else diff -Nru linux-aws-5.19.0/drivers/dma/ti/k3-udma-private.c linux-aws-5.19.0/drivers/dma/ti/k3-udma-private.c --- linux-aws-5.19.0/drivers/dma/ti/k3-udma-private.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/ti/k3-udma-private.c 2022-11-29 07:06:46.000000000 +0000 @@ -31,14 +31,14 @@ } pdev = of_find_device_by_node(udma_node); + if (np != udma_node) + of_node_put(udma_node); + if (!pdev) { pr_debug("UDMA device not found\n"); return ERR_PTR(-EPROBE_DEFER); } - if (np != udma_node) - of_node_put(udma_node); - ud = platform_get_drvdata(pdev); if (!ud) { pr_debug("UDMA has not been probed\n"); diff -Nru linux-aws-5.19.0/drivers/dma/xilinx/xilinx_dma.c linux-aws-5.19.0/drivers/dma/xilinx/xilinx_dma.c --- linux-aws-5.19.0/drivers/dma/xilinx/xilinx_dma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma/xilinx/xilinx_dma.c 2022-11-29 07:06:46.000000000 +0000 @@ -3160,9 +3160,10 @@ /* Request and map I/O memory */ xdev->regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(xdev->regs)) - return PTR_ERR(xdev->regs); - + if (IS_ERR(xdev->regs)) { + err = PTR_ERR(xdev->regs); + goto disable_clks; + } /* Retrieve the DMA engine properties from the device tree */ xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2; @@ -3190,7 +3191,7 @@ if (err < 0) { dev_err(xdev->dev, "missing xlnx,num-fstores property\n"); - return err; + goto disable_clks; } err = of_property_read_u32(node, "xlnx,flush-fsync", @@ -3210,7 +3211,11 @@ xdev->ext_addr = false; /* Set the dma mask bits */ - dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + if (err < 0) { + dev_err(xdev->dev, "DMA mask error %d\n", err); + goto disable_clks; + } /* Initialize the DMA engine */ xdev->common.dev = &pdev->dev; @@ -3259,7 +3264,7 @@ for_each_child_of_node(node, child) { err = xilinx_dma_child_probe(xdev, child); if (err < 0) - goto disable_clks; + goto error; } if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { @@ -3294,12 +3299,12 @@ return 0; -disable_clks: - xdma_disable_allclks(xdev); error: for (i = 0; i < xdev->dma_config->max_channels; i++) if (xdev->chan[i]) xilinx_dma_chan_remove(xdev->chan[i]); +disable_clks: + xdma_disable_allclks(xdev); return err; } diff -Nru linux-aws-5.19.0/drivers/dma-buf/dma-resv.c linux-aws-5.19.0/drivers/dma-buf/dma-resv.c --- linux-aws-5.19.0/drivers/dma-buf/dma-resv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma-buf/dma-resv.c 2022-11-29 07:06:46.000000000 +0000 @@ -295,7 +295,8 @@ enum dma_resv_usage old_usage; dma_resv_list_entry(fobj, i, obj, &old, &old_usage); - if ((old->context == fence->context && old_usage >= usage) || + if ((old->context == fence->context && old_usage >= usage && + dma_fence_is_later(fence, old)) || dma_fence_is_signaled(old)) { dma_resv_list_set(fobj, i, fence, usage); dma_fence_put(old); diff -Nru linux-aws-5.19.0/drivers/dma-buf/udmabuf.c linux-aws-5.19.0/drivers/dma-buf/udmabuf.c --- linux-aws-5.19.0/drivers/dma-buf/udmabuf.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/dma-buf/udmabuf.c 2022-11-29 07:06:46.000000000 +0000 @@ -124,17 +124,20 @@ { struct udmabuf *ubuf = buf->priv; struct device *dev = ubuf->device->this_device; + int ret = 0; if (!ubuf->sg) { ubuf->sg = get_sg_table(dev, buf, direction); - if (IS_ERR(ubuf->sg)) - return PTR_ERR(ubuf->sg); + if (IS_ERR(ubuf->sg)) { + ret = PTR_ERR(ubuf->sg); + ubuf->sg = NULL; + } } else { dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } - return 0; + return ret; } static int end_cpu_udmabuf(struct dma_buf *buf, diff -Nru linux-aws-5.19.0/drivers/firmware/arm_scmi/clock.c linux-aws-5.19.0/drivers/firmware/arm_scmi/clock.c --- linux-aws-5.19.0/drivers/firmware/arm_scmi/clock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/arm_scmi/clock.c 2022-11-29 07:06:46.000000000 +0000 @@ -450,9 +450,13 @@ static const struct scmi_clock_info * scmi_clock_info_get(const struct scmi_protocol_handle *ph, u32 clk_id) { + struct scmi_clock_info *clk; struct clock_info *ci = ph->get_priv(ph); - struct scmi_clock_info *clk = ci->clk + clk_id; + if (clk_id >= ci->num_clocks) + return NULL; + + clk = ci->clk + clk_id; if (!clk->name[0]) return NULL; diff -Nru linux-aws-5.19.0/drivers/firmware/arm_scmi/reset.c linux-aws-5.19.0/drivers/firmware/arm_scmi/reset.c --- linux-aws-5.19.0/drivers/firmware/arm_scmi/reset.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/arm_scmi/reset.c 2022-11-29 07:06:46.000000000 +0000 @@ -166,9 +166,13 @@ struct scmi_xfer *t; struct scmi_msg_reset_domain_reset *dom; struct scmi_reset_info *pi = ph->get_priv(ph); - struct reset_dom_info *rdom = pi->dom_info + domain; + struct reset_dom_info *rdom; - if (rdom->async_reset) + if (domain >= pi->num_domains) + return -EINVAL; + + rdom = pi->dom_info + domain; + if (rdom->async_reset && flags & AUTONOMOUS_RESET) flags |= ASYNCHRONOUS_RESET; ret = ph->xops->xfer_get_init(ph, RESET, sizeof(*dom), 0, &t); @@ -180,7 +184,7 @@ dom->flags = cpu_to_le32(flags); dom->reset_state = cpu_to_le32(state); - if (rdom->async_reset) + if (flags & ASYNCHRONOUS_RESET) ret = ph->xops->do_xfer_with_response(ph, t); else ret = ph->xops->do_xfer(ph, t); diff -Nru linux-aws-5.19.0/drivers/firmware/arm_scmi/scmi_pm_domain.c linux-aws-5.19.0/drivers/firmware/arm_scmi/scmi_pm_domain.c --- linux-aws-5.19.0/drivers/firmware/arm_scmi/scmi_pm_domain.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/arm_scmi/scmi_pm_domain.c 2022-11-29 07:06:46.000000000 +0000 @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -53,27 +52,6 @@ return scmi_pd_power(domain, false); } -static int scmi_pd_attach_dev(struct generic_pm_domain *pd, struct device *dev) -{ - int ret; - - ret = pm_clk_create(dev); - if (ret) - return ret; - - ret = of_pm_clk_add_clks(dev); - if (ret >= 0) - return 0; - - pm_clk_destroy(dev); - return ret; -} - -static void scmi_pd_detach_dev(struct generic_pm_domain *pd, struct device *dev) -{ - pm_clk_destroy(dev); -} - static int scmi_pm_domain_probe(struct scmi_device *sdev) { int num_domains, i; @@ -124,10 +102,6 @@ scmi_pd->genpd.name = scmi_pd->name; scmi_pd->genpd.power_off = scmi_pd_power_off; scmi_pd->genpd.power_on = scmi_pd_power_on; - scmi_pd->genpd.attach_dev = scmi_pd_attach_dev; - scmi_pd->genpd.detach_dev = scmi_pd_detach_dev; - scmi_pd->genpd.flags = GENPD_FLAG_PM_CLK | - GENPD_FLAG_ACTIVE_WAKEUP; pm_genpd_init(&scmi_pd->genpd, NULL, state == SCMI_POWER_STATE_GENERIC_OFF); @@ -138,9 +112,28 @@ scmi_pd_data->domains = domains; scmi_pd_data->num_domains = num_domains; + dev_set_drvdata(dev, scmi_pd_data); + return of_genpd_add_provider_onecell(np, scmi_pd_data); } +static void scmi_pm_domain_remove(struct scmi_device *sdev) +{ + int i; + struct genpd_onecell_data *scmi_pd_data; + struct device *dev = &sdev->dev; + struct device_node *np = dev->of_node; + + of_genpd_del_provider(np); + + scmi_pd_data = dev_get_drvdata(dev); + for (i = 0; i < scmi_pd_data->num_domains; i++) { + if (!scmi_pd_data->domains[i]) + continue; + pm_genpd_remove(scmi_pd_data->domains[i]); + } +} + static const struct scmi_device_id scmi_id_table[] = { { SCMI_PROTOCOL_POWER, "genpd" }, { }, @@ -150,6 +143,7 @@ static struct scmi_driver scmi_power_domain_driver = { .name = "scmi-power-domain", .probe = scmi_pm_domain_probe, + .remove = scmi_pm_domain_remove, .id_table = scmi_id_table, }; module_scmi_driver(scmi_power_domain_driver); diff -Nru linux-aws-5.19.0/drivers/firmware/arm_scmi/sensors.c linux-aws-5.19.0/drivers/firmware/arm_scmi/sensors.c --- linux-aws-5.19.0/drivers/firmware/arm_scmi/sensors.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/arm_scmi/sensors.c 2022-11-29 07:06:46.000000000 +0000 @@ -762,6 +762,10 @@ { int ret; struct scmi_xfer *t; + struct sensors_info *si = ph->get_priv(ph); + + if (sensor_id >= si->num_sensors) + return -EINVAL; ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_GET, sizeof(__le32), sizeof(__le32), &t); @@ -771,7 +775,6 @@ put_unaligned_le32(sensor_id, t->tx.buf); ret = ph->xops->do_xfer(ph, t); if (!ret) { - struct sensors_info *si = ph->get_priv(ph); struct scmi_sensor_info *s = si->sensors + sensor_id; *sensor_config = get_unaligned_le64(t->rx.buf); @@ -788,6 +791,10 @@ int ret; struct scmi_xfer *t; struct scmi_msg_sensor_config_set *msg; + struct sensors_info *si = ph->get_priv(ph); + + if (sensor_id >= si->num_sensors) + return -EINVAL; ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_SET, sizeof(*msg), 0, &t); @@ -800,7 +807,6 @@ ret = ph->xops->do_xfer(ph, t); if (!ret) { - struct sensors_info *si = ph->get_priv(ph); struct scmi_sensor_info *s = si->sensors + sensor_id; s->sensor_config = sensor_config; @@ -831,8 +837,11 @@ int ret; struct scmi_xfer *t; struct scmi_msg_sensor_reading_get *sensor; + struct scmi_sensor_info *s; struct sensors_info *si = ph->get_priv(ph); - struct scmi_sensor_info *s = si->sensors + sensor_id; + + if (sensor_id >= si->num_sensors) + return -EINVAL; ret = ph->xops->xfer_get_init(ph, SENSOR_READING_GET, sizeof(*sensor), 0, &t); @@ -841,6 +850,7 @@ sensor = t->tx.buf; sensor->id = cpu_to_le32(sensor_id); + s = si->sensors + sensor_id; if (s->async) { sensor->flags = cpu_to_le32(SENSOR_READ_ASYNC); ret = ph->xops->do_xfer_with_response(ph, t); @@ -895,9 +905,13 @@ int ret; struct scmi_xfer *t; struct scmi_msg_sensor_reading_get *sensor; + struct scmi_sensor_info *s; struct sensors_info *si = ph->get_priv(ph); - struct scmi_sensor_info *s = si->sensors + sensor_id; + if (sensor_id >= si->num_sensors) + return -EINVAL; + + s = si->sensors + sensor_id; if (!count || !readings || (!s->num_axis && count > 1) || (s->num_axis && count > s->num_axis)) return -EINVAL; @@ -948,6 +962,9 @@ { struct sensors_info *si = ph->get_priv(ph); + if (sensor_id >= si->num_sensors) + return NULL; + return si->sensors + sensor_id; } diff -Nru linux-aws-5.19.0/drivers/firmware/efi/capsule-loader.c linux-aws-5.19.0/drivers/firmware/efi/capsule-loader.c --- linux-aws-5.19.0/drivers/firmware/efi/capsule-loader.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/efi/capsule-loader.c 2022-11-29 07:06:46.000000000 +0000 @@ -243,29 +243,6 @@ } /** - * efi_capsule_flush - called by file close or file flush - * @file: file pointer - * @id: not used - * - * If a capsule is being partially uploaded then calling this function - * will be treated as upload termination and will free those completed - * buffer pages and -ECANCELED will be returned. - **/ -static int efi_capsule_flush(struct file *file, fl_owner_t id) -{ - int ret = 0; - struct capsule_info *cap_info = file->private_data; - - if (cap_info->index > 0) { - pr_err("capsule upload not complete\n"); - efi_free_all_buff_pages(cap_info); - ret = -ECANCELED; - } - - return ret; -} - -/** * efi_capsule_release - called by file close * @inode: not used * @file: file pointer @@ -277,6 +254,13 @@ { struct capsule_info *cap_info = file->private_data; + if (cap_info->index > 0 && + (cap_info->header.headersize == 0 || + cap_info->count < cap_info->total_size)) { + pr_err("capsule upload not complete\n"); + efi_free_all_buff_pages(cap_info); + } + kfree(cap_info->pages); kfree(cap_info->phys); kfree(file->private_data); @@ -324,7 +308,6 @@ .owner = THIS_MODULE, .open = efi_capsule_open, .write = efi_capsule_write, - .flush = efi_capsule_flush, .release = efi_capsule_release, .llseek = no_llseek, }; diff -Nru linux-aws-5.19.0/drivers/firmware/efi/libstub/fdt.c linux-aws-5.19.0/drivers/firmware/efi/libstub/fdt.c --- linux-aws-5.19.0/drivers/firmware/efi/libstub/fdt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/efi/libstub/fdt.c 2022-11-29 07:06:46.000000000 +0000 @@ -286,14 +286,6 @@ goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(&map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt((void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); diff -Nru linux-aws-5.19.0/drivers/firmware/efi/libstub/Makefile linux-aws-5.19.0/drivers/firmware/efi/libstub/Makefile --- linux-aws-5.19.0/drivers/firmware/efi/libstub/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/efi/libstub/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -37,6 +37,13 @@ $(call cc-option,-fno-addrsig) \ -D__DISABLE_EXPORTS +# +# struct randomization only makes sense for Linux internal types, which the EFI +# stub code never touches, so let's turn off struct randomization for the stub +# altogether +# +KBUILD_CFLAGS := $(filter-out $(RANDSTRUCT_CFLAGS), $(KBUILD_CFLAGS)) + # remove SCS flags from all objects in this directory KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) # disable LTO diff -Nru linux-aws-5.19.0/drivers/firmware/efi/libstub/secureboot.c linux-aws-5.19.0/drivers/firmware/efi/libstub/secureboot.c --- linux-aws-5.19.0/drivers/firmware/efi/libstub/secureboot.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/efi/libstub/secureboot.c 2022-11-29 07:06:46.000000000 +0000 @@ -14,7 +14,7 @@ /* SHIM variables */ static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID; -static const efi_char16_t shim_MokSBState_name[] = L"MokSBState"; +static const efi_char16_t shim_MokSBState_name[] = L"MokSBStateRT"; static efi_status_t get_var(efi_char16_t *name, efi_guid_t *vendor, u32 *attr, unsigned long *data_size, void *data) @@ -43,8 +43,8 @@ /* * See if a user has put the shim into insecure mode. If so, and if the - * variable doesn't have the runtime attribute set, we might as well - * honor that. + * variable doesn't have the non-volatile attribute set, we might as + * well honor that. */ size = sizeof(moksbstate); status = get_efi_var(shim_MokSBState_name, &shim_guid, @@ -53,7 +53,7 @@ /* If it fails, we don't care why. Default to secure */ if (status != EFI_SUCCESS) goto secure_boot_enabled; - if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate == 1) + if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate == 1) return efi_secureboot_mode_disabled; secure_boot_enabled: diff -Nru linux-aws-5.19.0/drivers/firmware/efi/libstub/x86-stub.c linux-aws-5.19.0/drivers/firmware/efi/libstub/x86-stub.c --- linux-aws-5.19.0/drivers/firmware/efi/libstub/x86-stub.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/efi/libstub/x86-stub.c 2022-11-29 07:06:46.000000000 +0000 @@ -517,6 +517,13 @@ hdr->ramdisk_image = 0; hdr->ramdisk_size = 0; + /* + * Disregard any setup data that was provided by the bootloader: + * setup_data could be pointing anywhere, and we have no way of + * authenticating or validating the payload. + */ + hdr->setup_data = 0; + efi_stub_entry(handle, sys_table_arg, boot_params); /* not reached */ diff -Nru linux-aws-5.19.0/drivers/firmware/google/gsmi.c linux-aws-5.19.0/drivers/firmware/google/gsmi.c --- linux-aws-5.19.0/drivers/firmware/google/gsmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/firmware/google/gsmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -681,6 +681,15 @@ static int gsmi_panic_callback(struct notifier_block *nb, unsigned long reason, void *arg) { + + /* + * Panic callbacks are executed with all other CPUs stopped, + * so we must not attempt to spin waiting for gsmi_dev.lock + * to be released. + */ + if (spin_is_locked(&gsmi_dev.lock)) + return NOTIFY_DONE; + gsmi_shutdown_reason(GSMI_SHUTDOWN_PANIC); return NOTIFY_DONE; } diff -Nru linux-aws-5.19.0/drivers/fpga/dfl.c linux-aws-5.19.0/drivers/fpga/dfl.c --- linux-aws-5.19.0/drivers/fpga/dfl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/fpga/dfl.c 2022-11-29 07:06:46.000000000 +0000 @@ -1866,7 +1866,7 @@ return -EINVAL; fds = memdup_user((void __user *)(arg + sizeof(hdr)), - hdr.count * sizeof(s32)); + array_size(hdr.count, sizeof(s32))); if (IS_ERR(fds)) return PTR_ERR(fds); diff -Nru linux-aws-5.19.0/drivers/fsi/fsi-core.c linux-aws-5.19.0/drivers/fsi/fsi-core.c --- linux-aws-5.19.0/drivers/fsi/fsi-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/fsi/fsi-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1314,6 +1314,9 @@ mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); master->dev.class = &fsi_master_class; diff -Nru linux-aws-5.19.0/drivers/fsi/fsi-occ.c linux-aws-5.19.0/drivers/fsi/fsi-occ.c --- linux-aws-5.19.0/drivers/fsi/fsi-occ.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/fsi/fsi-occ.c 2022-11-29 07:06:46.000000000 +0000 @@ -94,6 +94,7 @@ client->occ = occ; mutex_init(&client->lock); file->private_data = client; + get_device(occ->dev); /* We allocate a 1-page buffer, make sure it all fits */ BUILD_BUG_ON((OCC_CMD_DATA_BYTES + 3) > PAGE_SIZE); @@ -197,6 +198,7 @@ { struct occ_client *client = file->private_data; + put_device(client->occ->dev); free_page((unsigned long)client->buffer); kfree(client); @@ -493,12 +495,19 @@ for (i = 1; i < req_len - 2; ++i) checksum += byte_request[i]; - mutex_lock(&occ->occ_lock); + rc = mutex_lock_interruptible(&occ->occ_lock); + if (rc) + return rc; occ->client_buffer = response; occ->client_buffer_size = user_resp_len; occ->client_response_size = 0; + if (!occ->buffer) { + rc = -ENOENT; + goto done; + } + /* * Get a sequence number and update the counter. Avoid a sequence * number of 0 which would pass the response check below even if the @@ -671,10 +680,13 @@ { struct occ *occ = platform_get_drvdata(pdev); - kvfree(occ->buffer); - misc_deregister(&occ->mdev); + mutex_lock(&occ->occ_lock); + kvfree(occ->buffer); + occ->buffer = NULL; + mutex_unlock(&occ->occ_lock); + device_for_each_child(&pdev->dev, NULL, occ_unregister_child); ida_simple_remove(&occ_ida, occ->idx); diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-104-dio-48e.c linux-aws-5.19.0/drivers/gpio/gpio-104-dio-48e.c --- linux-aws-5.19.0/drivers/gpio/gpio-104-dio-48e.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-104-dio-48e.c 2022-11-29 07:06:46.000000000 +0000 @@ -271,6 +271,7 @@ dio48egpio->irq_mask &= ~BIT(0); else dio48egpio->irq_mask &= ~BIT(1); + gpiochip_disable_irq(chip, offset); if (!dio48egpio->irq_mask) /* disable interrupts */ @@ -298,6 +299,7 @@ iowrite8(0x00, dio48egpio->base + 0xB); } + gpiochip_enable_irq(chip, offset); if (offset == 19) dio48egpio->irq_mask |= BIT(0); else @@ -320,12 +322,14 @@ return 0; } -static struct irq_chip dio48e_irqchip = { +static const struct irq_chip dio48e_irqchip = { .name = "104-dio-48e", .irq_ack = dio48e_irq_ack, .irq_mask = dio48e_irq_mask, .irq_unmask = dio48e_irq_unmask, - .irq_set_type = dio48e_irq_set_type + .irq_set_type = dio48e_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t dio48e_irq_handler(int irq, void *dev_id) @@ -414,7 +418,7 @@ dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple; girq = &dio48egpio->chip.irq; - girq->chip = &dio48e_irqchip; + gpio_irq_chip_set_chip(girq, &dio48e_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-104-idio-16.c linux-aws-5.19.0/drivers/gpio/gpio-104-idio-16.c --- linux-aws-5.19.0/drivers/gpio/gpio-104-idio-16.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-104-idio-16.c 2022-11-29 07:06:46.000000000 +0000 @@ -150,10 +150,11 @@ { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); - const unsigned long mask = BIT(irqd_to_hwirq(data)); + const unsigned long offset = irqd_to_hwirq(data); unsigned long flags; - idio16gpio->irq_mask &= ~mask; + idio16gpio->irq_mask &= ~BIT(offset); + gpiochip_disable_irq(chip, offset); if (!idio16gpio->irq_mask) { raw_spin_lock_irqsave(&idio16gpio->lock, flags); @@ -168,11 +169,12 @@ { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); - const unsigned long mask = BIT(irqd_to_hwirq(data)); + const unsigned long offset = irqd_to_hwirq(data); const unsigned long prev_irq_mask = idio16gpio->irq_mask; unsigned long flags; - idio16gpio->irq_mask |= mask; + gpiochip_enable_irq(chip, offset); + idio16gpio->irq_mask |= BIT(offset); if (!prev_irq_mask) { raw_spin_lock_irqsave(&idio16gpio->lock, flags); @@ -193,12 +195,14 @@ return 0; } -static struct irq_chip idio_16_irqchip = { +static const struct irq_chip idio_16_irqchip = { .name = "104-idio-16", .irq_ack = idio_16_irq_ack, .irq_mask = idio_16_irq_mask, .irq_unmask = idio_16_irq_unmask, - .irq_set_type = idio_16_irq_set_type + .irq_set_type = idio_16_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idio_16_irq_handler(int irq, void *dev_id) @@ -275,7 +279,7 @@ idio16gpio->out_state = 0xFFFF; girq = &idio16gpio->chip.irq; - girq->chip = &idio_16_irqchip; + gpio_irq_chip_set_chip(girq, &idio_16_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-ftgpio010.c linux-aws-5.19.0/drivers/gpio/gpio-ftgpio010.c --- linux-aws-5.19.0/drivers/gpio/gpio-ftgpio010.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-ftgpio010.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,14 +41,12 @@ * struct ftgpio_gpio - Gemini GPIO state container * @dev: containing device for this instance * @gc: gpiochip for this instance - * @irq: irqchip for this instance * @base: remapped I/O-memory base * @clk: silicon clock */ struct ftgpio_gpio { struct device *dev; struct gpio_chip gc; - struct irq_chip irq; void __iomem *base; struct clk *clk; }; @@ -70,6 +68,7 @@ val = readl(g->base + GPIO_INT_EN); val &= ~BIT(irqd_to_hwirq(d)); writel(val, g->base + GPIO_INT_EN); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } static void ftgpio_gpio_unmask_irq(struct irq_data *d) @@ -78,6 +77,7 @@ struct ftgpio_gpio *g = gpiochip_get_data(gc); u32 val; + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); val = readl(g->base + GPIO_INT_EN); val |= BIT(irqd_to_hwirq(d)); writel(val, g->base + GPIO_INT_EN); @@ -221,6 +221,16 @@ return 0; } +static const struct irq_chip ftgpio_irq_chip = { + .name = "FTGPIO010", + .irq_ack = ftgpio_gpio_ack_irq, + .irq_mask = ftgpio_gpio_mask_irq, + .irq_unmask = ftgpio_gpio_unmask_irq, + .irq_set_type = ftgpio_gpio_set_irq_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int ftgpio_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -277,14 +287,8 @@ if (!IS_ERR(g->clk)) g->gc.set_config = ftgpio_gpio_set_config; - g->irq.name = "FTGPIO010"; - g->irq.irq_ack = ftgpio_gpio_ack_irq; - g->irq.irq_mask = ftgpio_gpio_mask_irq; - g->irq.irq_unmask = ftgpio_gpio_unmask_irq; - g->irq.irq_set_type = ftgpio_gpio_set_irq_type; - girq = &g->gc.irq; - girq->chip = &g->irq; + gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip); girq->parent_handler = ftgpio_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-ixp4xx.c linux-aws-5.19.0/drivers/gpio/gpio-ixp4xx.c --- linux-aws-5.19.0/drivers/gpio/gpio-ixp4xx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-ixp4xx.c 2022-11-29 07:06:46.000000000 +0000 @@ -63,6 +63,14 @@ __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); } +static void ixp4xx_gpio_mask_irq(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + + irq_chip_mask_parent(d); + gpiochip_disable_irq(gc, d->hwirq); +} + static void ixp4xx_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); @@ -72,6 +80,7 @@ if (!(g->irq_edge & BIT(d->hwirq))) ixp4xx_gpio_irq_ack(d); + gpiochip_enable_irq(gc, d->hwirq); irq_chip_unmask_parent(d); } @@ -149,12 +158,14 @@ return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); } -static struct irq_chip ixp4xx_gpio_irqchip = { +static const struct irq_chip ixp4xx_gpio_irqchip = { .name = "IXP4GPIO", .irq_ack = ixp4xx_gpio_irq_ack, - .irq_mask = irq_chip_mask_parent, + .irq_mask = ixp4xx_gpio_mask_irq, .irq_unmask = ixp4xx_gpio_irq_unmask, .irq_set_type = ixp4xx_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, @@ -263,7 +274,7 @@ g->gc.owner = THIS_MODULE; girq = &g->gc.irq; - girq->chip = &ixp4xx_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); girq->fwnode = g->fwnode; girq->parent_domain = parent; girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq; diff -Nru linux-aws-5.19.0/drivers/gpio/gpiolib-acpi.c linux-aws-5.19.0/drivers/gpio/gpiolib-acpi.c --- linux-aws-5.19.0/drivers/gpio/gpiolib-acpi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpiolib-acpi.c 2022-11-29 07:06:46.000000000 +0000 @@ -32,9 +32,16 @@ "controller@pin combos on which to ignore the ACPI wake flag " "ignore_wake=controller@pin[,controller@pin[,...]]"); +static char *ignore_interrupt; +module_param(ignore_interrupt, charp, 0444); +MODULE_PARM_DESC(ignore_interrupt, + "controller@pin combos on which to ignore interrupt " + "ignore_interrupt=controller@pin[,controller@pin[,...]]"); + struct acpi_gpiolib_dmi_quirk { bool no_edge_events_on_boot; char *ignore_wake; + char *ignore_interrupt; }; /** @@ -317,14 +324,15 @@ return desc; } -static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin_in) +static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *controller_in, + unsigned int pin_in) { const char *controller, *pin_str; unsigned int pin; char *endp; int len; - controller = ignore_wake; + controller = ignore_list; while (controller) { pin_str = strchr(controller, '@'); if (!pin_str) @@ -348,7 +356,7 @@ return false; err: - pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_wake: %s\n", ignore_wake); + pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_...: %s\n", ignore_list); return false; } @@ -360,7 +368,7 @@ if (agpio->wake_capable != ACPI_WAKE_CAPABLE) return false; - if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) { + if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) { dev_info(parent, "Ignoring wakeup on pin %u\n", pin); return false; } @@ -427,6 +435,11 @@ goto fail_unlock_irq; } + if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) { + dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin); + return AE_OK; + } + event = kzalloc(sizeof(*event), GFP_KERNEL); if (!event) goto fail_unlock_irq; @@ -1560,6 +1573,20 @@ .ignore_wake = "INT33FF:01@0", }, }, + { + /* + * Interrupt storm caused from edge triggered floating pin + * Found in BIOS UX325UAZ.300 + * https://bugzilla.kernel.org/show_bug.cgi?id=216208 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UAZ_UM325UAZ"), + }, + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { + .ignore_interrupt = "AMDI0030:00@18", + }, + }, {} /* Terminating entry */ }; @@ -1582,6 +1609,9 @@ if (ignore_wake == NULL && quirk && quirk->ignore_wake) ignore_wake = quirk->ignore_wake; + if (ignore_interrupt == NULL && quirk && quirk->ignore_interrupt) + ignore_interrupt = quirk->ignore_interrupt; + return 0; } diff -Nru linux-aws-5.19.0/drivers/gpio/gpiolib-cdev.c linux-aws-5.19.0/drivers/gpio/gpiolib-cdev.c --- linux-aws-5.19.0/drivers/gpio/gpiolib-cdev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpiolib-cdev.c 2022-11-29 07:06:46.000000000 +0000 @@ -1975,7 +1975,6 @@ ret = -ENODEV; goto out_free_le; } - le->irq = irq; if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? @@ -1989,7 +1988,7 @@ init_waitqueue_head(&le->wait); /* Request a thread to read the events */ - ret = request_threaded_irq(le->irq, + ret = request_threaded_irq(irq, lineevent_irq_handler, lineevent_irq_thread, irqflags, @@ -1998,6 +1997,8 @@ if (ret) goto out_free_le; + le->irq = irq; + fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC); if (fd < 0) { ret = fd; diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-mockup.c linux-aws-5.19.0/drivers/gpio/gpio-mockup.c --- linux-aws-5.19.0/drivers/gpio/gpio-mockup.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-mockup.c 2022-11-29 07:06:46.000000000 +0000 @@ -373,6 +373,13 @@ } } +static void gpio_mockup_debugfs_cleanup(void *data) +{ + struct gpio_mockup_chip *chip = data; + + debugfs_remove_recursive(chip->dbg_dir); +} + static void gpio_mockup_dispose_mappings(void *data) { struct gpio_mockup_chip *chip = data; @@ -455,7 +462,7 @@ gpio_mockup_debugfs_setup(dev, chip); - return 0; + return devm_add_action_or_reset(dev, gpio_mockup_debugfs_cleanup, chip); } static const struct of_device_id gpio_mockup_of_match[] = { @@ -526,8 +533,10 @@ } fwnode = fwnode_create_software_node(properties, NULL); - if (IS_ERR(fwnode)) + if (IS_ERR(fwnode)) { + kfree_strarray(line_names, ngpio); return PTR_ERR(fwnode); + } pdevinfo.name = "gpio-mockup"; pdevinfo.id = idx; @@ -590,9 +599,9 @@ static void __exit gpio_mockup_exit(void) { + gpio_mockup_unregister_pdevs(); debugfs_remove_recursive(gpio_mockup_dbg_dir); platform_driver_unregister(&gpio_mockup_driver); - gpio_mockup_unregister_pdevs(); } module_init(gpio_mockup_init); diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-mpc8xxx.c linux-aws-5.19.0/drivers/gpio/gpio-mpc8xxx.c --- linux-aws-5.19.0/drivers/gpio/gpio-mpc8xxx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-mpc8xxx.c 2022-11-29 07:06:46.000000000 +0000 @@ -172,6 +172,7 @@ switch (flow_type) { case IRQ_TYPE_EDGE_FALLING: + case IRQ_TYPE_LEVEL_LOW: raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags); gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR, gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR) diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-mt7621.c linux-aws-5.19.0/drivers/gpio/gpio-mt7621.c --- linux-aws-5.19.0/drivers/gpio/gpio-mt7621.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-mt7621.c 2022-11-29 07:06:46.000000000 +0000 @@ -112,6 +112,8 @@ unsigned long flags; u32 rise, fall, high, low; + gpiochip_enable_irq(gc, d->hwirq); + spin_lock_irqsave(&rg->lock, flags); rise = mtk_gpio_r32(rg, GPIO_REG_REDGE); fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE); @@ -143,6 +145,8 @@ mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin)); mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin)); spin_unlock_irqrestore(&rg->lock, flags); + + gpiochip_disable_irq(gc, d->hwirq); } static int @@ -204,6 +208,16 @@ return gpio % MTK_BANK_WIDTH; } +static const struct irq_chip mt7621_irq_chip = { + .name = "mt7621-gpio", + .irq_mask_ack = mediatek_gpio_irq_mask, + .irq_mask = mediatek_gpio_irq_mask, + .irq_unmask = mediatek_gpio_irq_unmask, + .irq_set_type = mediatek_gpio_irq_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int mediatek_gpio_bank_probe(struct device *dev, int bank) { @@ -238,11 +252,6 @@ return -ENOMEM; rg->chip.offset = bank * MTK_BANK_WIDTH; - rg->irq_chip.name = dev_name(dev); - rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask; - rg->irq_chip.irq_mask = mediatek_gpio_irq_mask; - rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask; - rg->irq_chip.irq_set_type = mediatek_gpio_irq_type; if (mtk->gpio_irq) { struct gpio_irq_chip *girq; @@ -262,7 +271,7 @@ } girq = &rg->chip.irq; - girq->chip = &rg->irq_chip; + gpio_irq_chip_set_chip(girq, &mt7621_irq_chip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-mvebu.c linux-aws-5.19.0/drivers/gpio/gpio-mvebu.c --- linux-aws-5.19.0/drivers/gpio/gpio-mvebu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-mvebu.c 2022-11-29 07:06:46.000000000 +0000 @@ -793,8 +793,12 @@ u32 offset; u32 set; - if (of_device_is_compatible(mvchip->chip.of_node, - "marvell,armada-370-gpio")) { + if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) { + int ret = of_property_read_u32(dev->of_node, + "marvell,pwm-offset", &offset); + if (ret < 0) + return 0; + } else { /* * There are only two sets of PWM configuration registers for * all the GPIO lines on those SoCs which this driver reserves @@ -804,13 +808,6 @@ if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm")) return 0; offset = 0; - } else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) { - int ret = of_property_read_u32(dev->of_node, - "marvell,pwm-offset", &offset); - if (ret < 0) - return 0; - } else { - return 0; } if (IS_ERR(mvchip->clk)) diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-pca953x.c linux-aws-5.19.0/drivers/gpio/gpio-pca953x.c --- linux-aws-5.19.0/drivers/gpio/gpio-pca953x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-pca953x.c 2022-11-29 07:06:46.000000000 +0000 @@ -1175,7 +1175,9 @@ { struct pca953x_chip *chip = dev_get_drvdata(dev); + mutex_lock(&chip->i2c_lock); regcache_cache_only(chip->regmap, true); + mutex_unlock(&chip->i2c_lock); if (atomic_read(&chip->wakeup_path)) device_set_wakeup_path(dev); @@ -1198,13 +1200,17 @@ } } + mutex_lock(&chip->i2c_lock); regcache_cache_only(chip->regmap, false); regcache_mark_dirty(chip->regmap); ret = pca953x_regcache_sync(dev); - if (ret) + if (ret) { + mutex_unlock(&chip->i2c_lock); return ret; + } ret = regcache_sync(chip->regmap); + mutex_unlock(&chip->i2c_lock); if (ret) { dev_err(dev, "Failed to restore register map: %d\n", ret); return ret; diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-realtek-otto.c linux-aws-5.19.0/drivers/gpio/gpio-realtek-otto.c --- linux-aws-5.19.0/drivers/gpio/gpio-realtek-otto.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-realtek-otto.c 2022-11-29 07:06:46.000000000 +0000 @@ -46,10 +46,20 @@ * @lock: Lock for accessing the IRQ registers and values * @intr_mask: Mask for interrupts lines * @intr_type: Interrupt type selection + * @bank_read: Read a bank setting as a single 32-bit value + * @bank_write: Write a bank setting as a single 32-bit value + * @imr_line_pos: Bit shift of an IRQ line's IMR value. + * + * The DIR, DATA, and ISR registers consist of four 8-bit port values, packed + * into a single 32-bit register. Use @bank_read (@bank_write) to get (assign) + * a value from (to) these registers. The IMR register consists of four 16-bit + * port values, packed into two 32-bit registers. Use @imr_line_pos to get the + * bit shift of the 2-bit field for a line's IMR settings. Shifts larger than + * 32 overflow into the second register. * * Because the interrupt mask register (IMR) combines the function of IRQ type * selection and masking, two extra values are stored. @intr_mask is used to - * mask/unmask the interrupts for a GPIO port, and @intr_type is used to store + * mask/unmask the interrupts for a GPIO line, and @intr_type is used to store * the selected interrupt types. The logical AND of these values is written to * IMR on changes. */ @@ -59,10 +69,11 @@ void __iomem *cpumask_base; struct cpumask cpu_irq_maskable; raw_spinlock_t lock; - u16 intr_mask[REALTEK_GPIO_PORTS_PER_BANK]; - u16 intr_type[REALTEK_GPIO_PORTS_PER_BANK]; - unsigned int (*port_offset_u8)(unsigned int port); - unsigned int (*port_offset_u16)(unsigned int port); + u8 intr_mask[REALTEK_GPIO_MAX]; + u8 intr_type[REALTEK_GPIO_MAX]; + u32 (*bank_read)(void __iomem *reg); + void (*bank_write)(void __iomem *reg, u32 value); + unsigned int (*line_imr_pos)(unsigned int line); }; /* Expand with more flags as devices with other quirks are added */ @@ -101,14 +112,22 @@ * port. The two interrupt mask registers store two bits per GPIO, so use u16 * values. */ -static unsigned int realtek_gpio_port_offset_u8(unsigned int port) +static u32 realtek_gpio_bank_read_swapped(void __iomem *reg) { - return port; + return ioread32be(reg); } -static unsigned int realtek_gpio_port_offset_u16(unsigned int port) +static void realtek_gpio_bank_write_swapped(void __iomem *reg, u32 value) { - return 2 * port; + iowrite32be(value, reg); +} + +static unsigned int realtek_gpio_line_imr_pos_swapped(unsigned int line) +{ + unsigned int port_pin = line % 8; + unsigned int port = line / 8; + + return 2 * (8 * (port ^ 1) + port_pin); } /* @@ -119,66 +138,67 @@ * per GPIO, so use u16 values. The first register contains ports 1 and 0, the * second ports 3 and 2. */ -static unsigned int realtek_gpio_port_offset_u8_rev(unsigned int port) +static u32 realtek_gpio_bank_read(void __iomem *reg) { - return 3 - port; + return ioread32(reg); } -static unsigned int realtek_gpio_port_offset_u16_rev(unsigned int port) +static void realtek_gpio_bank_write(void __iomem *reg, u32 value) { - return 2 * (port ^ 1); + iowrite32(value, reg); } -static void realtek_gpio_write_imr(struct realtek_gpio_ctrl *ctrl, - unsigned int port, u16 irq_type, u16 irq_mask) +static unsigned int realtek_gpio_line_imr_pos(unsigned int line) { - iowrite16(irq_type & irq_mask, - ctrl->base + REALTEK_GPIO_REG_IMR + ctrl->port_offset_u16(port)); + return 2 * line; } -static void realtek_gpio_clear_isr(struct realtek_gpio_ctrl *ctrl, - unsigned int port, u8 mask) +static void realtek_gpio_clear_isr(struct realtek_gpio_ctrl *ctrl, u32 mask) { - iowrite8(mask, ctrl->base + REALTEK_GPIO_REG_ISR + ctrl->port_offset_u8(port)); + ctrl->bank_write(ctrl->base + REALTEK_GPIO_REG_ISR, mask); } -static u8 realtek_gpio_read_isr(struct realtek_gpio_ctrl *ctrl, unsigned int port) +static u32 realtek_gpio_read_isr(struct realtek_gpio_ctrl *ctrl) { - return ioread8(ctrl->base + REALTEK_GPIO_REG_ISR + ctrl->port_offset_u8(port)); + return ctrl->bank_read(ctrl->base + REALTEK_GPIO_REG_ISR); } -/* Set the rising and falling edge mask bits for a GPIO port pin */ -static u16 realtek_gpio_imr_bits(unsigned int pin, u16 value) +/* Set the rising and falling edge mask bits for a GPIO pin */ +static void realtek_gpio_update_line_imr(struct realtek_gpio_ctrl *ctrl, unsigned int line) { - return (value & REALTEK_GPIO_IMR_LINE_MASK) << 2 * pin; + void __iomem *reg = ctrl->base + REALTEK_GPIO_REG_IMR; + unsigned int line_shift = ctrl->line_imr_pos(line); + unsigned int shift = line_shift % 32; + u32 irq_type = ctrl->intr_type[line]; + u32 irq_mask = ctrl->intr_mask[line]; + u32 reg_val; + + reg += 4 * (line_shift / 32); + reg_val = ioread32(reg); + reg_val &= ~(REALTEK_GPIO_IMR_LINE_MASK << shift); + reg_val |= (irq_type & irq_mask & REALTEK_GPIO_IMR_LINE_MASK) << shift; + iowrite32(reg_val, reg); } static void realtek_gpio_irq_ack(struct irq_data *data) { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); irq_hw_number_t line = irqd_to_hwirq(data); - unsigned int port = line / 8; - unsigned int port_pin = line % 8; - realtek_gpio_clear_isr(ctrl, port, BIT(port_pin)); + realtek_gpio_clear_isr(ctrl, BIT(line)); } static void realtek_gpio_irq_unmask(struct irq_data *data) { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); unsigned int line = irqd_to_hwirq(data); - unsigned int port = line / 8; - unsigned int port_pin = line % 8; unsigned long flags; - u16 m; gpiochip_enable_irq(&ctrl->gc, line); raw_spin_lock_irqsave(&ctrl->lock, flags); - m = ctrl->intr_mask[port]; - m |= realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); - ctrl->intr_mask[port] = m; - realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m); + ctrl->intr_mask[line] = REALTEK_GPIO_IMR_LINE_MASK; + realtek_gpio_update_line_imr(ctrl, line); raw_spin_unlock_irqrestore(&ctrl->lock, flags); } @@ -186,16 +206,11 @@ { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); unsigned int line = irqd_to_hwirq(data); - unsigned int port = line / 8; - unsigned int port_pin = line % 8; unsigned long flags; - u16 m; raw_spin_lock_irqsave(&ctrl->lock, flags); - m = ctrl->intr_mask[port]; - m &= ~realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); - ctrl->intr_mask[port] = m; - realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m); + ctrl->intr_mask[line] = 0; + realtek_gpio_update_line_imr(ctrl, line); raw_spin_unlock_irqrestore(&ctrl->lock, flags); gpiochip_disable_irq(&ctrl->gc, line); @@ -205,10 +220,8 @@ { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); unsigned int line = irqd_to_hwirq(data); - unsigned int port = line / 8; - unsigned int port_pin = line % 8; unsigned long flags; - u16 type, t; + u8 type; switch (flow_type & IRQ_TYPE_SENSE_MASK) { case IRQ_TYPE_EDGE_FALLING: @@ -227,11 +240,8 @@ irq_set_handler_locked(data, handle_edge_irq); raw_spin_lock_irqsave(&ctrl->lock, flags); - t = ctrl->intr_type[port]; - t &= ~realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); - t |= realtek_gpio_imr_bits(port_pin, type); - ctrl->intr_type[port] = t; - realtek_gpio_write_imr(ctrl, port, t, ctrl->intr_mask[port]); + ctrl->intr_type[line] = type; + realtek_gpio_update_line_imr(ctrl, line); raw_spin_unlock_irqrestore(&ctrl->lock, flags); return 0; @@ -242,28 +252,21 @@ struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); struct irq_chip *irq_chip = irq_desc_get_chip(desc); - unsigned int lines_done; - unsigned int port_pin_count; unsigned long status; int offset; chained_irq_enter(irq_chip, desc); - for (lines_done = 0; lines_done < gc->ngpio; lines_done += 8) { - status = realtek_gpio_read_isr(ctrl, lines_done / 8); - port_pin_count = min(gc->ngpio - lines_done, 8U); - for_each_set_bit(offset, &status, port_pin_count) - generic_handle_domain_irq(gc->irq.domain, offset + lines_done); - } + status = realtek_gpio_read_isr(ctrl); + for_each_set_bit(offset, &status, gc->ngpio) + generic_handle_domain_irq(gc->irq.domain, offset); chained_irq_exit(irq_chip, desc); } -static inline void __iomem *realtek_gpio_irq_cpu_mask(struct realtek_gpio_ctrl *ctrl, - unsigned int port, int cpu) +static inline void __iomem *realtek_gpio_irq_cpu_mask(struct realtek_gpio_ctrl *ctrl, int cpu) { - return ctrl->cpumask_base + ctrl->port_offset_u8(port) + - REALTEK_GPIO_PORTS_PER_BANK * cpu; + return ctrl->cpumask_base + REALTEK_GPIO_PORTS_PER_BANK * cpu; } static int realtek_gpio_irq_set_affinity(struct irq_data *data, @@ -271,12 +274,10 @@ { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); unsigned int line = irqd_to_hwirq(data); - unsigned int port = line / 8; - unsigned int port_pin = line % 8; void __iomem *irq_cpu_mask; unsigned long flags; int cpu; - u8 v; + u32 v; if (!ctrl->cpumask_base) return -ENXIO; @@ -284,15 +285,15 @@ raw_spin_lock_irqsave(&ctrl->lock, flags); for_each_cpu(cpu, &ctrl->cpu_irq_maskable) { - irq_cpu_mask = realtek_gpio_irq_cpu_mask(ctrl, port, cpu); - v = ioread8(irq_cpu_mask); + irq_cpu_mask = realtek_gpio_irq_cpu_mask(ctrl, cpu); + v = ctrl->bank_read(irq_cpu_mask); if (cpumask_test_cpu(cpu, dest)) - v |= BIT(port_pin); + v |= BIT(line); else - v &= ~BIT(port_pin); + v &= ~BIT(line); - iowrite8(v, irq_cpu_mask); + ctrl->bank_write(irq_cpu_mask, v); } raw_spin_unlock_irqrestore(&ctrl->lock, flags); @@ -305,16 +306,17 @@ static int realtek_gpio_irq_init(struct gpio_chip *gc) { struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); - unsigned int port; + u32 mask_all = GENMASK(gc->ngpio - 1, 0); + unsigned int line; int cpu; - for (port = 0; (port * 8) < gc->ngpio; port++) { - realtek_gpio_write_imr(ctrl, port, 0, 0); - realtek_gpio_clear_isr(ctrl, port, GENMASK(7, 0)); + for (line = 0; line < gc->ngpio; line++) + realtek_gpio_update_line_imr(ctrl, line); - for_each_cpu(cpu, &ctrl->cpu_irq_maskable) - iowrite8(GENMASK(7, 0), realtek_gpio_irq_cpu_mask(ctrl, port, cpu)); - } + realtek_gpio_clear_isr(ctrl, mask_all); + + for_each_cpu(cpu, &ctrl->cpu_irq_maskable) + ctrl->bank_write(realtek_gpio_irq_cpu_mask(ctrl, cpu), mask_all); return 0; } @@ -387,12 +389,14 @@ if (dev_flags & GPIO_PORTS_REVERSED) { bgpio_flags = 0; - ctrl->port_offset_u8 = realtek_gpio_port_offset_u8_rev; - ctrl->port_offset_u16 = realtek_gpio_port_offset_u16_rev; + ctrl->bank_read = realtek_gpio_bank_read; + ctrl->bank_write = realtek_gpio_bank_write; + ctrl->line_imr_pos = realtek_gpio_line_imr_pos; } else { bgpio_flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; - ctrl->port_offset_u8 = realtek_gpio_port_offset_u8; - ctrl->port_offset_u16 = realtek_gpio_port_offset_u16; + ctrl->bank_read = realtek_gpio_bank_read_swapped; + ctrl->bank_write = realtek_gpio_bank_write_swapped; + ctrl->line_imr_pos = realtek_gpio_line_imr_pos_swapped; } err = bgpio_init(&ctrl->gc, dev, 4, diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-rockchip.c linux-aws-5.19.0/drivers/gpio/gpio-rockchip.c --- linux-aws-5.19.0/drivers/gpio/gpio-rockchip.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-rockchip.c 2022-11-29 07:06:46.000000000 +0000 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -155,6 +156,12 @@ unsigned long flags; u32 data = input ? 0 : 1; + + if (input) + pinctrl_gpio_direction_input(bank->pin_base + offset); + else + pinctrl_gpio_direction_output(bank->pin_base + offset); + raw_spin_lock_irqsave(&bank->slock, flags); rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr); raw_spin_unlock_irqrestore(&bank->slock, flags); @@ -418,11 +425,11 @@ goto out; } else { bank->toggle_edge_mode |= mask; - level |= mask; + level &= ~mask; /* * Determine gpio state. If 1 next interrupt should be - * falling otherwise rising. + * low otherwise high. */ data = readl(bank->reg_base + bank->gpio_regs->ext_port); if (data & mask) diff -Nru linux-aws-5.19.0/drivers/gpio/gpio-tqmx86.c linux-aws-5.19.0/drivers/gpio/gpio-tqmx86.c --- linux-aws-5.19.0/drivers/gpio/gpio-tqmx86.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpio/gpio-tqmx86.c 2022-11-29 07:06:46.000000000 +0000 @@ -307,6 +307,8 @@ girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_simple_irq; girq->init_valid_mask = tqmx86_init_irq_valid_mask; + + irq_domain_set_pm_device(girq->domain, dev); } ret = devm_gpiochip_add_data(dev, chip, gpio); @@ -315,8 +317,6 @@ goto out_pm_dis; } - irq_domain_set_pm_device(girq->domain, dev); - dev_info(dev, "GPIO functionality initialized with %d pins\n", chip->ngpio); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1056,6 +1056,10 @@ { if (adev->flags & AMD_IS_APU) return false; + + if (amdgpu_sriov_vf(adev)) + return false; + return pm_suspend_target_state != PM_SUSPEND_TO_IDLE; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 2022-11-29 07:06:46.000000000 +0000 @@ -1674,10 +1674,12 @@ adev->mode_info.dither_property, AMDGPU_FMT_DITHER_DISABLE); - if (amdgpu_audio != 0) + if (amdgpu_audio != 0) { drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; + } subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = true; @@ -1799,6 +1801,7 @@ drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1852,6 +1855,7 @@ drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1902,6 +1906,7 @@ drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -2391,8 +2391,16 @@ } adev->ip_blocks[i].status.sw = true; - /* need to do gmc hw init early so we can allocate gpu mem */ - if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { + if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) { + /* need to do common hw init early so everything is set up for gmc */ + r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); + if (r) { + DRM_ERROR("hw_init %d failed %d\n", i, r); + goto init_failed; + } + adev->ip_blocks[i].status.hw = true; + } else if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { + /* need to do gmc hw init early so we can allocate gpu mem */ /* Try to reserve bad pages early */ if (amdgpu_sriov_vf(adev)) amdgpu_virt_exchange_data(adev); @@ -2482,12 +2490,14 @@ if (!hive->reset_domain || !amdgpu_reset_get_reset_domain(hive->reset_domain)) { r = -ENOENT; + amdgpu_put_xgmi_hive(hive); goto init_failed; } /* Drop the early temporary reset domain we created for device */ amdgpu_reset_put_reset_domain(adev->reset_domain); adev->reset_domain = hive->reset_domain; + amdgpu_put_xgmi_hive(hive); } } @@ -3076,8 +3086,8 @@ int i, r; static enum amd_ip_block_type ip_order[] = { - AMD_IP_BLOCK_TYPE_GMC, AMD_IP_BLOCK_TYPE_COMMON, + AMD_IP_BLOCK_TYPE_GMC, AMD_IP_BLOCK_TYPE_PSP, AMD_IP_BLOCK_TYPE_IH, }; @@ -3168,7 +3178,8 @@ continue; if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON || adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC || - adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH) { + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH || + (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP && amdgpu_sriov_vf(adev))) { r = adev->ip_blocks[i].version->funcs->resume(adev); if (r) { @@ -4114,12 +4125,20 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) { struct amdgpu_device *adev = drm_to_adev(dev); + int r = 0; if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) return 0; adev->in_suspend = true; + if (amdgpu_sriov_vf(adev)) { + amdgpu_virt_fini_data_exchange(adev); + r = amdgpu_virt_request_full_gpu(adev, false); + if (r) + return r; + } + if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D3)) DRM_WARN("smart shift update failed\n"); @@ -4143,6 +4162,9 @@ amdgpu_device_ip_suspend_phase2(adev); + if (amdgpu_sriov_vf(adev)) + amdgpu_virt_release_full_gpu(adev, false); + return 0; } @@ -4161,6 +4183,12 @@ struct amdgpu_device *adev = drm_to_adev(dev); int r = 0; + if (amdgpu_sriov_vf(adev)) { + r = amdgpu_virt_request_full_gpu(adev, true); + if (r) + return r; + } + if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) return 0; @@ -4175,6 +4203,13 @@ } r = amdgpu_device_ip_resume(adev); + + /* no matter what r is, always need to properly release full GPU */ + if (amdgpu_sriov_vf(adev)) { + amdgpu_virt_init_data_exchange(adev); + amdgpu_virt_release_full_gpu(adev, true); + } + if (r) { dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r); return r; @@ -4473,8 +4508,6 @@ retry: amdgpu_amdkfd_pre_reset(adev); - amdgpu_amdkfd_pre_reset(adev); - if (from_hypervisor) r = amdgpu_virt_request_full_gpu(adev, true); else diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 2022-11-29 07:06:46.000000000 +0000 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -495,6 +496,11 @@ .create_handle = drm_gem_fb_create_handle, }; +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, +}; + uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1069,7 +1075,10 @@ if (ret) goto err; - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + if (drm_drv_uses_atomic_modeset(dev)) + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic); + else + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); if (ret) goto err; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -2548,8 +2548,11 @@ amdgpu_device_baco_exit(drm_dev); } ret = amdgpu_device_resume(drm_dev, false); - if (ret) + if (ret) { + if (amdgpu_device_supports_px(drm_dev)) + pci_disable_device(pdev); return ret; + } if (amdgpu_device_supports_px(drm_dev)) drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c 2022-11-29 07:06:46.000000000 +0000 @@ -66,10 +66,15 @@ return true; case CHIP_SIENNA_CICHLID: if (strnstr(atom_ctx->vbios_version, "D603", + sizeof(atom_ctx->vbios_version))) { + if (strnstr(atom_ctx->vbios_version, "D603GLXE", sizeof(atom_ctx->vbios_version))) - return true; - else + return false; + else + return true; + } else { return false; + } default: return false; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c 2022-11-29 07:06:46.000000000 +0000 @@ -169,6 +169,9 @@ for (i = 0; i < AMDGPU_MES_MAX_SDMA_PIPES; i++) { if (adev->ip_versions[SDMA0_HWIP][0] < IP_VERSION(6, 0, 0)) adev->mes.sdma_hqd_mask[i] = i ? 0 : 0x3fc; + /* zero sdma_hqd_mask for non-existent engine */ + else if (adev->sdma.num_instances == 1) + adev->mes.sdma_hqd_mask[i] = i ? 0 : 0xfc; else adev->mes.sdma_hqd_mask[i] = 0xfc; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 2022-11-29 07:06:46.000000000 +0000 @@ -748,7 +748,7 @@ } pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; - ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->adev), + ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, AMDGPU_GEM_DOMAIN_VRAM, &psp->tmr_bo, &psp->tmr_mc_addr, pptr); @@ -2372,7 +2372,7 @@ static bool fw_load_skip_check(struct psp_context *psp, struct amdgpu_firmware_info *ucode) { - if (!ucode->fw) + if (!ucode->fw || !ucode->ucode_size) return true; if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC && @@ -2612,6 +2612,9 @@ psp_rap_terminate(psp); psp_dtm_terminate(psp); psp_hdcp_terminate(psp); + + if (adev->gmc.xgmi.num_physical_nodes > 1) + psp_xgmi_terminate(psp); } psp_asd_terminate(psp); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 2022-11-29 07:06:46.000000000 +0000 @@ -36,6 +36,7 @@ #define PSP_CMD_BUFFER_SIZE 0x1000 #define PSP_1_MEG 0x100000 #define PSP_TMR_SIZE(adev) ((adev)->asic_type == CHIP_ALDEBARAN ? 0x800000 : 0x400000) +#define PSP_TMR_ALIGNMENT 0x100000 #define PSP_FW_NAME_LEN 0x24 enum psp_shared_mem_size { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 2022-11-29 07:06:46.000000000 +0000 @@ -1805,7 +1805,8 @@ amdgpu_ras_query_error_status(adev, &info); if (adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 2) && - adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4)) { + adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4) && + adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 0)) { if (amdgpu_ras_reset_error_status(adev, info.head.block)) dev_warn(adev->dev, "Failed to reset error counter and error status"); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c 2022-11-29 07:06:46.000000000 +0000 @@ -211,12 +211,15 @@ int r; /* Wait for PD/PT moves to be completed */ - dma_resv_for_each_fence(&cursor, bo->tbo.base.resv, - DMA_RESV_USAGE_KERNEL, fence) { + dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL); + dma_resv_for_each_fence_unlocked(&cursor, fence) { r = amdgpu_sync_fence(&p->job->sync, fence); - if (r) + if (r) { + dma_resv_iter_end(&cursor); return r; + } } + dma_resv_iter_end(&cursor); do { ndw = p->num_dw_left; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -742,7 +742,7 @@ amdgpu_put_xgmi_hive(hive); } - return psp_xgmi_terminate(&adev->psp); + return 0; } static int amdgpu_xgmi_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 2022-11-29 07:06:46.000000000 +0000 @@ -5090,9 +5090,12 @@ data = REG_SET_FIELD(data, SDMA0_RLC_CGCG_CTRL, CGCG_INT_ENABLE, 1); WREG32_SOC15(GC, 0, regSDMA0_RLC_CGCG_CTRL, data); - data = RREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL); - data = REG_SET_FIELD(data, SDMA1_RLC_CGCG_CTRL, CGCG_INT_ENABLE, 1); - WREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL, data); + /* Some ASICs only have one SDMA instance, not need to configure SDMA1 */ + if (adev->sdma.num_instances > 1) { + data = RREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL); + data = REG_SET_FIELD(data, SDMA1_RLC_CGCG_CTRL, CGCG_INT_ENABLE, 1); + WREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL, data); + } } else { /* Program RLC_CGCG_CGLS_CTRL */ def = data = RREG32_SOC15(GC, 0, regRLC_CGCG_CGLS_CTRL); @@ -5121,9 +5124,12 @@ data &= ~SDMA0_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK; WREG32_SOC15(GC, 0, regSDMA0_RLC_CGCG_CTRL, data); - data = RREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL); - data &= ~SDMA1_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK; - WREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL, data); + /* Some ASICs only have one SDMA instance, not need to configure SDMA1 */ + if (adev->sdma.num_instances > 1) { + data = RREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL); + data &= ~SDMA1_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK; + WREG32_SOC15(GC, 0, regSDMA1_RLC_CGCG_CTRL, data); + } } } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 2022-11-29 07:06:46.000000000 +0000 @@ -2587,7 +2587,8 @@ gfx_v9_0_tiling_mode_table_init(adev); - gfx_v9_0_setup_rb(adev); + if (adev->gfx.num_gfx_rings) + gfx_v9_0_setup_rb(adev); gfx_v9_0_get_cu_info(adev, &adev->gfx.cu_info); adev->gfx.config.db_debug2 = RREG32_SOC15(GC, 0, mmDB_DEBUG2); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c 2022-11-29 07:06:46.000000000 +0000 @@ -176,6 +176,7 @@ tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2, tmp); + tmp = mmVM_L2_CNTL3_DEFAULT; if (adev->gmc.translate_further) { tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12); tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c 2022-11-29 07:06:46.000000000 +0000 @@ -169,17 +169,17 @@ uint64_t value; uint32_t tmp; - /* Disable AGP. */ - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); - if (!amdgpu_sriov_vf(adev)) { /* * the new L1 policy will block SRIOV guest from writing * these regs, and they will be programed at host. * so skip programing these regs. */ + /* Disable AGP. */ + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); + /* Program the system aperture low logical page number. */ WREG32_SOC15(MMHUB, 0, regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.vram_start >> 18); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c 2022-11-29 07:06:46.000000000 +0000 @@ -380,6 +380,7 @@ WREG32_PCIE(smnPCIE_LC_CNTL, data); } +#ifdef CONFIG_PCIEASPM static void nbio_v2_3_program_ltr(struct amdgpu_device *adev) { uint32_t def, data; @@ -401,9 +402,11 @@ if (def != data) WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); } +#endif static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) { +#ifdef CONFIG_PCIEASPM uint32_t def, data; def = data = RREG32_PCIE(smnPCIE_LC_CNTL); @@ -459,7 +462,10 @@ if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL6, data); - nbio_v2_3_program_ltr(adev); + /* Don't bother about LTR if LTR is not enabled + * in the path */ + if (adev->pdev->ltr_path) + nbio_v2_3_program_ltr(adev); def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3); data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; @@ -483,6 +489,7 @@ data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL3, data); +#endif } static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c 2022-11-29 07:06:46.000000000 +0000 @@ -282,6 +282,7 @@ mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; } +#ifdef CONFIG_PCIEASPM static void nbio_v6_1_program_ltr(struct amdgpu_device *adev) { uint32_t def, data; @@ -303,9 +304,11 @@ if (def != data) WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); } +#endif static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) { +#ifdef CONFIG_PCIEASPM uint32_t def, data; def = data = RREG32_PCIE(smnPCIE_LC_CNTL); @@ -361,7 +364,10 @@ if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL6, data); - nbio_v6_1_program_ltr(adev); + /* Don't bother about LTR if LTR is not enabled + * in the path */ + if (adev->pdev->ltr_path) + nbio_v6_1_program_ltr(adev); def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; @@ -385,6 +391,7 @@ data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL3, data); +#endif } const struct amdgpu_nbio_funcs nbio_v6_1_funcs = { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c 2022-11-29 07:06:46.000000000 +0000 @@ -673,6 +673,7 @@ }; +#ifdef CONFIG_PCIEASPM static void nbio_v7_4_program_ltr(struct amdgpu_device *adev) { uint32_t def, data; @@ -694,9 +695,11 @@ if (def != data) WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); } +#endif static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) { +#ifdef CONFIG_PCIEASPM uint32_t def, data; if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4)) @@ -755,7 +758,10 @@ if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL6, data); - nbio_v7_4_program_ltr(adev); + /* Don't bother about LTR if LTR is not enabled + * in the path */ + if (adev->pdev->ltr_path) + nbio_v7_4_program_ltr(adev); def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; @@ -779,6 +785,7 @@ data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; if (def != data) WREG32_PCIE(smnPCIE_LC_CNTL3, data); +#endif } const struct amdgpu_nbio_funcs nbio_v7_4_funcs = { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c 2022-11-29 07:06:46.000000000 +0000 @@ -28,6 +28,14 @@ #include "nbio/nbio_7_7_0_sh_mask.h" #include +static void nbio_v7_7_remap_hdp_registers(struct amdgpu_device *adev) +{ + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL, + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL); + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL, + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL); +} + static u32 nbio_v7_7_get_rev_id(struct amdgpu_device *adev) { u32 tmp; @@ -237,4 +245,5 @@ .ih_doorbell_range = nbio_v7_7_ih_doorbell_range, .ih_control = nbio_v7_7_ih_control, .init_registers = nbio_v7_7_init_registers, + .remap_hdp_registers = nbio_v7_7_remap_hdp_registers, }; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 2022-11-29 07:06:46.000000000 +0000 @@ -1504,6 +1504,11 @@ WREG32_SDMA(i, mmSDMA0_CNTL, temp); if (!amdgpu_sriov_vf(adev)) { + ring = &adev->sdma.instance[i].ring; + adev->nbio.funcs->sdma_doorbell_range(adev, i, + ring->use_doorbell, ring->doorbell_index, + adev->doorbell_index.sdma_doorbell_range); + /* unhalt engine */ temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c 2022-11-29 07:06:46.000000000 +0000 @@ -1211,25 +1211,6 @@ return 0; } -static void soc15_doorbell_range_init(struct amdgpu_device *adev) -{ - int i; - struct amdgpu_ring *ring; - - /* sdma/ih doorbell range are programed by hypervisor */ - if (!amdgpu_sriov_vf(adev)) { - for (i = 0; i < adev->sdma.num_instances; i++) { - ring = &adev->sdma.instance[i].ring; - adev->nbio.funcs->sdma_doorbell_range(adev, i, - ring->use_doorbell, ring->doorbell_index, - adev->doorbell_index.sdma_doorbell_range); - } - - adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, - adev->irq.ih.doorbell_index); - } -} - static int soc15_common_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1249,12 +1230,6 @@ /* enable the doorbell aperture */ soc15_enable_doorbell_aperture(adev, true); - /* HW doorbell routing policy: doorbell writing not - * in SDMA/IH/MM/ACV range will be routed to CP. So - * we need to init SDMA/IH/MM/ACV doorbell range prior - * to CP ip block init and ring test. - */ - soc15_doorbell_range_init(adev); return 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc21.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc21.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc21.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/soc21.c 2022-11-29 07:06:46.000000000 +0000 @@ -551,6 +551,10 @@ AMD_PG_SUPPORT_JPEG | AMD_PG_SUPPORT_ATHUB | AMD_PG_SUPPORT_MMHUB; + if (amdgpu_sriov_vf(adev)) { + adev->cg_flags = 0; + adev->pg_flags = 0; + } adev->external_rev_id = adev->rev_id + 0x1; // TODO: need update break; case IP_VERSION(11, 0, 2): diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega10_ih.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega10_ih.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega10_ih.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega10_ih.c 2022-11-29 07:06:46.000000000 +0000 @@ -289,6 +289,10 @@ } } + if (!amdgpu_sriov_vf(adev)) + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, + adev->irq.ih.doorbell_index); + pci_set_master(adev->pdev); /* enable interrupts */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega20_ih.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega20_ih.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega20_ih.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdgpu/vega20_ih.c 2022-11-29 07:06:46.000000000 +0000 @@ -340,6 +340,10 @@ } } + if (!amdgpu_sriov_vf(adev)) + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, + adev->irq.ih.doorbell_index); + pci_set_master(adev->pdev); /* enable interrupts */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c linux-aws-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 2022-11-29 07:06:46.000000000 +0000 @@ -1232,6 +1232,24 @@ dqm->dev->kfd2kgd->init_interrupts(dqm->dev->adev, i); } +static void init_sdma_bitmaps(struct device_queue_manager *dqm) +{ + unsigned int num_sdma_queues = + min_t(unsigned int, sizeof(dqm->sdma_bitmap)*8, + get_num_sdma_queues(dqm)); + unsigned int num_xgmi_sdma_queues = + min_t(unsigned int, sizeof(dqm->xgmi_sdma_bitmap)*8, + get_num_xgmi_sdma_queues(dqm)); + + if (num_sdma_queues) + dqm->sdma_bitmap = GENMASK_ULL(num_sdma_queues-1, 0); + if (num_xgmi_sdma_queues) + dqm->xgmi_sdma_bitmap = GENMASK_ULL(num_xgmi_sdma_queues-1, 0); + + dqm->sdma_bitmap &= ~get_reserved_sdma_queues_bitmap(dqm); + pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); +} + static int initialize_nocpsch(struct device_queue_manager *dqm) { int pipe, queue; @@ -1260,11 +1278,7 @@ memset(dqm->vmid_pasid, 0, sizeof(dqm->vmid_pasid)); - dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm)); - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm)); + init_sdma_bitmaps(dqm); return 0; } @@ -1442,9 +1456,6 @@ static int initialize_cpsch(struct device_queue_manager *dqm) { - uint64_t num_sdma_queues; - uint64_t num_xgmi_sdma_queues; - pr_debug("num of pipes: %d\n", get_pipes_per_mec(dqm)); mutex_init(&dqm->lock_hidden); @@ -1453,24 +1464,10 @@ dqm->active_cp_queue_count = 0; dqm->gws_queue_count = 0; dqm->active_runlist = false; - - num_sdma_queues = get_num_sdma_queues(dqm); - if (num_sdma_queues >= BITS_PER_TYPE(dqm->sdma_bitmap)) - dqm->sdma_bitmap = ULLONG_MAX; - else - dqm->sdma_bitmap = (BIT_ULL(num_sdma_queues) - 1); - - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - num_xgmi_sdma_queues = get_num_xgmi_sdma_queues(dqm); - if (num_xgmi_sdma_queues >= BITS_PER_TYPE(dqm->xgmi_sdma_bitmap)) - dqm->xgmi_sdma_bitmap = ULLONG_MAX; - else - dqm->xgmi_sdma_bitmap = (BIT_ULL(num_xgmi_sdma_queues) - 1); - INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception); + init_sdma_bitmaps(dqm); + return 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 2022-11-29 07:06:46.000000000 +0000 @@ -1363,13 +1363,21 @@ if (hpd_rx_offload_wq[i].wq == NULL) { DRM_ERROR("create amdgpu_dm_hpd_rx_offload_wq fail!"); - return NULL; + goto out_err; } spin_lock_init(&hpd_rx_offload_wq[i].offload_lock); } return hpd_rx_offload_wq; + +out_err: + for (i = 0; i < max_caps; i++) { + if (hpd_rx_offload_wq[i].wq) + destroy_workqueue(hpd_rx_offload_wq[i].wq); + } + kfree(hpd_rx_offload_wq); + return NULL; } struct amdgpu_stutter_quirk { @@ -2238,7 +2246,8 @@ } else { ret = drm_dp_mst_topology_mgr_resume(mgr, true); if (ret < 0) { - drm_dp_mst_topology_mgr_set_mst(mgr, false); + dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx, + aconnector->dc_link); need_hotplug = true; } } @@ -2884,15 +2893,12 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) { - u32 max_avg, min_cll, max, min, q, r; struct amdgpu_dm_backlight_caps *caps; struct amdgpu_display_manager *dm; struct drm_connector *conn_base; struct amdgpu_device *adev; struct dc_link *link = NULL; - static const u8 pre_computed_values[] = { - 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 65, 66, 68, 69, - 71, 72, 74, 75, 77, 79, 81, 82, 84, 86, 88, 90, 92, 94, 96, 98}; + struct drm_luminance_range_info *luminance_range; int i; if (!aconnector || !aconnector->dc_link) @@ -2914,8 +2920,6 @@ caps = &dm->backlight_caps[i]; caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps; caps->aux_support = false; - max_avg = conn_base->hdr_sink_metadata.hdmi_type1.max_fall; - min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll; if (caps->ext_caps->bits.oled == 1 /*|| caps->ext_caps->bits.sdr_aux_backlight_control == 1 || @@ -2927,31 +2931,9 @@ else if (amdgpu_backlight == 1) caps->aux_support = true; - /* From the specification (CTA-861-G), for calculating the maximum - * luminance we need to use: - * Luminance = 50*2**(CV/32) - * Where CV is a one-byte value. - * For calculating this expression we may need float point precision; - * to avoid this complexity level, we take advantage that CV is divided - * by a constant. From the Euclids division algorithm, we know that CV - * can be written as: CV = 32*q + r. Next, we replace CV in the - * Luminance expression and get 50*(2**q)*(2**(r/32)), hence we just - * need to pre-compute the value of r/32. For pre-computing the values - * We just used the following Ruby line: - * (0...32).each {|cv| puts (50*2**(cv/32.0)).round} - * The results of the above expressions can be verified at - * pre_computed_values. - */ - q = max_avg >> 5; - r = max_avg % 32; - max = (1 << q) * pre_computed_values[r]; - - // min luminance: maxLum * (CV/255)^2 / 100 - q = DIV_ROUND_CLOSEST(min_cll, 255); - min = max * DIV_ROUND_CLOSEST((q * q), 100); - - caps->aux_max_input_signal = max; - caps->aux_min_input_signal = min; + luminance_range = &conn_base->display_info.luminance_range; + caps->aux_min_input_signal = luminance_range->min_luminance; + caps->aux_max_input_signal = luminance_range->max_luminance; } void amdgpu_dm_update_connector_after_detect( @@ -5627,7 +5609,7 @@ plane_info->visible = true; plane_info->stereo_format = PLANE_STEREO_FORMAT_NONE; - plane_info->layer_index = 0; + plane_info->layer_index = plane_state->normalized_zpos; ret = fill_plane_color_attributes(plane_state, plane_info->format, &plane_info->color_space); @@ -5695,7 +5677,7 @@ dc_plane_state->global_alpha = plane_info.global_alpha; dc_plane_state->global_alpha_value = plane_info.global_alpha_value; dc_plane_state->dcc = plane_info.dcc; - dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0 + dc_plane_state->layer_index = plane_info.layer_index; dc_plane_state->flip_int_enabled = true; /* @@ -9155,15 +9137,15 @@ * We also need vupdate irq for the actual core vblank handling * at end of vblank. */ - dm_set_vupdate_irq(new_state->base.crtc, true); - drm_crtc_vblank_get(new_state->base.crtc); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, true) != 0); + WARN_ON(drm_crtc_vblank_get(new_state->base.crtc) != 0); DRM_DEBUG_DRIVER("%s: crtc=%u VRR off->on: Get vblank ref\n", __func__, new_state->base.crtc->base.id); } else if (old_vrr_active && !new_vrr_active) { /* Transition VRR active -> inactive: * Allow vblank irq disable again for fixed refresh rate. */ - dm_set_vupdate_irq(new_state->base.crtc, false); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, false) != 0); drm_crtc_vblank_put(new_state->base.crtc); DRM_DEBUG_DRIVER("%s: crtc=%u VRR on->off: Drop vblank ref\n", __func__, new_state->base.crtc->base.id); @@ -9914,23 +9896,6 @@ mutex_unlock(&dm->dc_lock); } - /* Count number of newly disabled CRTCs for dropping PM refs later. */ - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { - if (old_crtc_state->active && !new_crtc_state->active) - crtc_disable_count++; - - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); - - /* For freesync config update on crtc state and params for irq */ - update_stream_irq_parameters(dm, dm_new_crtc_state); - - /* Handle vrr on->off / off->on transitions */ - amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, - dm_new_crtc_state); - } - /** * Enable interrupts for CRTCs that are newly enabled or went through * a modeset. It was intentionally deferred until after the front end @@ -9940,16 +9905,29 @@ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); #ifdef CONFIG_DEBUG_FS - bool configure_crc = false; enum amdgpu_dm_pipe_crc_source cur_crc_src; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) - struct crc_rd_work *crc_rd_wrk = dm->crc_rd_wrk; + struct crc_rd_work *crc_rd_wrk; +#endif +#endif + /* Count number of newly disabled CRTCs for dropping PM refs later. */ + if (old_crtc_state->active && !new_crtc_state->active) + crtc_disable_count++; + + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); + dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); + + /* For freesync config update on crtc state and params for irq */ + update_stream_irq_parameters(dm, dm_new_crtc_state); + +#ifdef CONFIG_DEBUG_FS +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) + crc_rd_wrk = dm->crc_rd_wrk; #endif spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); cur_crc_src = acrtc->dm_irq_params.crc_src; spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); #endif - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); if (new_crtc_state->active && (!old_crtc_state->active || @@ -9957,16 +9935,19 @@ dc_stream_retain(dm_new_crtc_state->stream); acrtc->dm_irq_params.stream = dm_new_crtc_state->stream; manage_dm_interrupts(adev, acrtc, true); + } + /* Handle vrr on->off / off->on transitions */ + amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, dm_new_crtc_state); #ifdef CONFIG_DEBUG_FS + if (new_crtc_state->active && + (!old_crtc_state->active || + drm_atomic_crtc_needs_modeset(new_crtc_state))) { /** * Frontend may have changed so reapply the CRC capture * settings for the stream. */ - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { - configure_crc = true; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) if (amdgpu_dm_crc_window_is_activated(crtc)) { spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); @@ -9978,14 +9959,12 @@ spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); } #endif - } - - if (configure_crc) if (amdgpu_dm_crtc_configure_crc_source( crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); -#endif + } } +#endif } for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) @@ -10460,7 +10439,7 @@ * added MST connectors not found in existing crtc_state in the chained mode * TODO: need to dig out the root cause of that */ - if (!aconnector || (!aconnector->dc_sink && aconnector->mst_port)) + if (!aconnector) goto skip_modeset; if (modereset_required(new_crtc_state)) @@ -11145,6 +11124,14 @@ } } + /* + * DC consults the zpos (layer_index in DC terminology) to determine the + * hw plane on which to enable the hw cursor (see + * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in + * atomic state, so call drm helper to normalize zpos. + */ + drm_atomic_normalize_zpos(dev, state); + /* Remove exiting planes if they are modified */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { ret = dm_update_plane_state(dc, state, plane, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -3188,7 +3188,7 @@ &crc_win_y_end_fops); debugfs_create_file_unsafe("crc_win_update", 0644, dir, crtc, &crc_win_update_fops); - + dput(dir); } #endif /* diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 2022-11-29 07:06:46.000000000 +0000 @@ -451,7 +451,6 @@ struct dc_link *link) { struct amdgpu_dm_connector *aconnector = link->priv; - uint8_t i; if (!aconnector) { DRM_ERROR("Failed to find connector for link!"); @@ -463,22 +462,7 @@ if (aconnector->mst_mgr.mst_state == true) { drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, false); - - for (i = 0; i < MAX_SINKS_PER_LINK; i++) { - if (link->remote_sinks[i] == NULL) - continue; - - if (link->remote_sinks[i]->sink_signal == - SIGNAL_TYPE_DISPLAY_PORT_MST) { - dc_link_remove_remote_sink(link, link->remote_sinks[i]); - - if (aconnector->dc_sink) { - dc_sink_release(aconnector->dc_sink); - aconnector->dc_sink = NULL; - aconnector->dc_link->cur_link_settings.lane_count = 0; - } - } - } + link->cur_link_settings.lane_count = 0; } return false; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,11 +157,28 @@ static void amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector) { - struct amdgpu_dm_connector *amdgpu_dm_connector = + struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); - struct drm_dp_mst_port *port = amdgpu_dm_connector->port; + struct drm_dp_mst_port *port = aconnector->port; + struct amdgpu_dm_connector *root = aconnector->mst_port; + struct dc_link *dc_link = aconnector->dc_link; + struct dc_sink *dc_sink = aconnector->dc_sink; drm_dp_mst_connector_early_unregister(connector, port); + + /* + * Release dc_sink for connector which its attached port is + * no longer in the mst topology + */ + drm_modeset_lock(&root->mst_mgr.base.lock, NULL); + if (dc_sink) { + if (dc_link->sink_count) + dc_link_remove_remote_sink(dc_link, dc_sink); + + dc_sink_release(dc_sink); + aconnector->dc_sink = NULL; + } + drm_modeset_unlock(&root->mst_mgr.base.lock); } static const struct drm_connector_funcs dm_dp_mst_connector_funcs = { @@ -361,12 +378,59 @@ { struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); struct amdgpu_dm_connector *master = aconnector->mst_port; + struct drm_dp_mst_port *port = aconnector->port; + int connection_status; if (drm_connector_is_unregistered(connector)) return connector_status_disconnected; - return drm_dp_mst_detect_port(connector, ctx, &master->mst_mgr, - aconnector->port); + connection_status = drm_dp_mst_detect_port(connector, ctx, &master->mst_mgr, + aconnector->port); + + if (port->pdt != DP_PEER_DEVICE_NONE && !port->dpcd_rev) { + uint8_t dpcd_rev; + int ret; + + ret = drm_dp_dpcd_readb(&port->aux, DP_DP13_DPCD_REV, &dpcd_rev); + + if (ret == 1) { + port->dpcd_rev = dpcd_rev; + + /* Could be DP1.2 DP Rx case*/ + if (!dpcd_rev) { + ret = drm_dp_dpcd_readb(&port->aux, DP_DPCD_REV, &dpcd_rev); + + if (ret == 1) + port->dpcd_rev = dpcd_rev; + } + + if (!dpcd_rev) + DRM_DEBUG_KMS("Can't decide DPCD revision number!"); + } + + /* + * Could be legacy sink, logical port etc on DP1.2. + * Will get Nack under these cases when issue remote + * DPCD read. + */ + if (ret != 1) + DRM_DEBUG_KMS("Can't access DPCD"); + } else if (port->pdt == DP_PEER_DEVICE_NONE) { + port->dpcd_rev = 0; + } + + /* + * Release dc_sink for connector which unplug event is notified by CSN msg + */ + if (connection_status == connector_status_disconnected && aconnector->dc_sink) { + if (aconnector->dc_link->sink_count) + dc_link_remove_remote_sink(aconnector->dc_link, aconnector->dc_sink); + + dc_sink_release(aconnector->dc_sink); + aconnector->dc_sink = NULL; + } + + return connection_status; } static int dm_dp_mst_atomic_check(struct drm_connector *connector, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c 2022-11-29 07:06:46.000000000 +0000 @@ -60,11 +60,15 @@ */ void amdgpu_dm_set_psr_caps(struct dc_link *link) { - if (!(link->connector_signal & SIGNAL_TYPE_EDP)) + if (!(link->connector_signal & SIGNAL_TYPE_EDP)) { + link->psr_settings.psr_feature_enabled = false; return; + } - if (link->type == dc_connection_none) + if (link->type == dc_connection_none) { + link->psr_settings.psr_feature_enabled = false; return; + } if (link->dpcd_caps.psr_info.psr_version == 0) { link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,6 +41,12 @@ #define FN(reg_name, field) \ FD(reg_name##__##field) +#include "logger_types.h" +#undef DC_LOGGER +#define DC_LOGGER \ + CTX->logger +#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); } + #define VBIOSSMC_MSG_TestMessage 0x1 #define VBIOSSMC_MSG_GetSmuVersion 0x2 #define VBIOSSMC_MSG_PowerUpGfx 0x3 @@ -95,7 +101,13 @@ uint32_t result; result = rn_smu_wait_for_response(clk_mgr, 10, 200000); - ASSERT(result == VBIOSSMC_Result_OK); + + if (result != VBIOSSMC_Result_OK) + smu_print("SMU Response was not OK. SMU response after wait received is: %d\n", result); + + if (result == VBIOSSMC_Status_BUSY) { + return -1; + } /* First clear response register */ REG_WRITE(MP1_SMN_C2PMSG_91, VBIOSSMC_Status_BUSY); @@ -176,6 +188,10 @@ VBIOSSMC_MSG_SetHardMinDcfclkByFreq, khz_to_mhz_ceil(requested_dcfclk_khz)); +#ifdef DBG + smu_print("actual_dcfclk_set_mhz %d is set to : %d\n", actual_dcfclk_set_mhz, actual_dcfclk_set_mhz * 1000); +#endif + return actual_dcfclk_set_mhz * 1000; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,6 +41,12 @@ #define FN(reg_name, field) \ FD(reg_name##__##field) +#include "logger_types.h" +#undef DC_LOGGER +#define DC_LOGGER \ + CTX->logger +#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); } + #define VBIOSSMC_MSG_GetSmuVersion 0x2 #define VBIOSSMC_MSG_SetDispclkFreq 0x4 #define VBIOSSMC_MSG_SetDprefclkFreq 0x5 @@ -96,6 +102,13 @@ result = dcn301_smu_wait_for_response(clk_mgr, 10, 200000); + if (result != VBIOSSMC_Result_OK) + smu_print("SMU Response was not OK. SMU response after wait received is: %d\n", result); + + if (result == VBIOSSMC_Status_BUSY) { + return -1; + } + /* First clear response register */ REG_WRITE(MP1_SMN_C2PMSG_91, VBIOSSMC_Status_BUSY); @@ -167,6 +180,10 @@ VBIOSSMC_MSG_SetHardMinDcfclkByFreq, khz_to_mhz_ceil(requested_dcfclk_khz)); +#ifdef DBG + smu_print("actual_dcfclk_set_mhz %d is set to : %d\n", actual_dcfclk_set_mhz, actual_dcfclk_set_mhz * 1000); +#endif + return actual_dcfclk_set_mhz * 1000; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c 2022-11-29 07:06:46.000000000 +0000 @@ -40,6 +40,12 @@ #define FN(reg_name, field) \ FD(reg_name##__##field) +#include "logger_types.h" +#undef DC_LOGGER +#define DC_LOGGER \ + CTX->logger +#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); } + #define VBIOSSMC_MSG_TestMessage 0x1 #define VBIOSSMC_MSG_GetSmuVersion 0x2 #define VBIOSSMC_MSG_PowerUpGfx 0x3 @@ -102,7 +108,9 @@ uint32_t result; result = dcn31_smu_wait_for_response(clk_mgr, 10, 200000); - ASSERT(result == VBIOSSMC_Result_OK); + + if (result != VBIOSSMC_Result_OK) + smu_print("SMU Response was not OK. SMU response after wait received is: %d\n", result); if (result == VBIOSSMC_Status_BUSY) { return -1; @@ -194,6 +202,10 @@ VBIOSSMC_MSG_SetHardMinDcfclkByFreq, khz_to_mhz_ceil(requested_dcfclk_khz)); +#ifdef DBG + smu_print("actual_dcfclk_set_mhz %d is set to : %d\n", actual_dcfclk_set_mhz, actual_dcfclk_set_mhz * 1000); +#endif + return actual_dcfclk_set_mhz * 1000; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c 2022-11-29 07:06:46.000000000 +0000 @@ -46,6 +46,9 @@ #define TO_CLK_MGR_DCN315(clk_mgr)\ container_of(clk_mgr, struct clk_mgr_dcn315, base) +#define UNSUPPORTED_DCFCLK 10000000 +#define MIN_DPP_DISP_CLK 100000 + static int dcn315_get_active_display_cnt_wa( struct dc *dc, struct dc_state *context) @@ -146,6 +149,9 @@ } } + /* Lock pstate by requesting unsupported dcfclk if change is unsupported */ + if (!new_clocks->p_state_change_support) + new_clocks->dcfclk_khz = UNSUPPORTED_DCFCLK; if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) { clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz; dcn315_smu_set_hard_min_dcfclk(clk_mgr, clk_mgr_base->clks.dcfclk_khz); @@ -159,10 +165,10 @@ // workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. if (!IS_DIAG_DC(dc->ctx->dce_environment)) { - if (new_clocks->dppclk_khz < 100000) - new_clocks->dppclk_khz = 100000; - if (new_clocks->dispclk_khz < 100000) - new_clocks->dispclk_khz = 100000; + if (new_clocks->dppclk_khz < MIN_DPP_DISP_CLK) + new_clocks->dppclk_khz = MIN_DPP_DISP_CLK; + if (new_clocks->dispclk_khz < MIN_DPP_DISP_CLK) + new_clocks->dispclk_khz = MIN_DPP_DISP_CLK; } if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) { @@ -272,7 +278,7 @@ { .wm_inst = WM_A, .wm_type = WM_TYPE_PSTATE_CHG, - .pstate_latency_us = 64.0, + .pstate_latency_us = 129.0, .sr_exit_time_us = 11.5, .sr_enter_plus_exit_time_us = 14.5, .valid = true, @@ -280,7 +286,7 @@ { .wm_inst = WM_B, .wm_type = WM_TYPE_PSTATE_CHG, - .pstate_latency_us = 64.0, + .pstate_latency_us = 129.0, .sr_exit_time_us = 11.5, .sr_enter_plus_exit_time_us = 14.5, .valid = true, @@ -288,7 +294,7 @@ { .wm_inst = WM_C, .wm_type = WM_TYPE_PSTATE_CHG, - .pstate_latency_us = 64.0, + .pstate_latency_us = 129.0, .sr_exit_time_us = 11.5, .sr_enter_plus_exit_time_us = 14.5, .valid = true, @@ -296,7 +302,7 @@ { .wm_inst = WM_D, .wm_type = WM_TYPE_PSTATE_CHG, - .pstate_latency_us = 64.0, + .pstate_latency_us = 129.0, .sr_exit_time_us = 11.5, .sr_enter_plus_exit_time_us = 14.5, .valid = true, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c 2022-11-29 07:06:46.000000000 +0000 @@ -70,6 +70,12 @@ #define REG_NBIO(reg_name) \ (NBIO_BASE.instance[0].segment[regBIF_BX_PF2_ ## reg_name ## _BASE_IDX] + regBIF_BX_PF2_ ## reg_name) +#include "logger_types.h" +#undef DC_LOGGER +#define DC_LOGGER \ + CTX->logger +#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); } + #define mmMP1_C2PMSG_3 0x3B1050C #define VBIOSSMC_MSG_TestMessage 0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team @@ -130,7 +136,9 @@ uint32_t result; result = dcn315_smu_wait_for_response(clk_mgr, 10, 200000); - ASSERT(result == VBIOSSMC_Result_OK); + + if (result != VBIOSSMC_Result_OK) + smu_print("SMU Response was not OK. SMU response after wait received is: %d\n", result); if (result == VBIOSSMC_Status_BUSY) { return -1; @@ -197,6 +205,10 @@ VBIOSSMC_MSG_SetHardMinDcfclkByFreq, khz_to_mhz_ceil(requested_dcfclk_khz)); +#ifdef DBG + smu_print("actual_dcfclk_set_mhz %d is set to : %d\n", actual_dcfclk_set_mhz, actual_dcfclk_set_mhz * 1000); +#endif + return actual_dcfclk_set_mhz * 1000; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c 2022-11-29 07:06:46.000000000 +0000 @@ -58,6 +58,12 @@ #define FN(reg_name, field) \ FD(reg_name##__##field) +#include "logger_types.h" +#undef DC_LOGGER +#define DC_LOGGER \ + CTX->logger +#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); } + #define VBIOSSMC_MSG_TestMessage 0x01 ///< To check if PMFW is alive and responding. Requirement specified by PMFW team #define VBIOSSMC_MSG_GetPmfwVersion 0x02 ///< Get PMFW version #define VBIOSSMC_MSG_Spare0 0x03 ///< Spare0 @@ -118,7 +124,9 @@ uint32_t result; result = dcn316_smu_wait_for_response(clk_mgr, 10, 200000); - ASSERT(result == VBIOSSMC_Result_OK); + + if (result != VBIOSSMC_Result_OK) + smu_print("SMU Response was not OK. SMU response after wait received is: %d\n", result); if (result == VBIOSSMC_Status_BUSY) { return -1; @@ -183,6 +191,10 @@ VBIOSSMC_MSG_SetHardMinDcfclkByFreq, khz_to_mhz_ceil(requested_dcfclk_khz)); +#ifdef DBG + smu_print("actual_dcfclk_set_mhz %d is set to : %d\n", actual_dcfclk_set_mhz, actual_dcfclk_set_mhz * 1000); +#endif + return actual_dcfclk_set_mhz * 1000; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc.c 2022-11-29 07:06:46.000000000 +0000 @@ -2632,11 +2632,8 @@ if (update->abm_level) stream->abm_level = *update->abm_level; - if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - - if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; + if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt; if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap; @@ -2723,13 +2720,8 @@ if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { - if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE0); - - if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE1); + if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt(dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket || diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 2022-11-29 07:06:46.000000000 +0000 @@ -2857,8 +2857,14 @@ skip_video_pattern); /* Transmit idle pattern once training successful. */ - if (status == LINK_TRAINING_SUCCESS && !is_link_bw_low) + if (status == LINK_TRAINING_SUCCESS && !is_link_bw_low) { dp_set_hw_test_pattern(link, &pipe_ctx->link_res, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); + /* Update verified link settings to current one + * Because DPIA LT might fallback to lower link setting. + */ + link->verified_link_cap.link_rate = link->cur_link_settings.link_rate; + link->verified_link_cap.lane_count = link->cur_link_settings.lane_count; + } } else { status = dc_link_dp_perform_link_training(link, &pipe_ctx->link_res, @@ -5211,6 +5217,14 @@ lttpr_dpcd_data[DP_PHY_REPEATER_128B132B_RATES - DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV]; + /* If this chip cap is set, at least one retimer must exist in the chain + * Override count to 1 if we receive a known bad count (0 or an invalid value) */ + if (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN && + (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) == 0)) { + ASSERT(0); + link->dpcd_caps.lttpr_caps.phy_repeater_cnt = 0x80; + } + /* Attempt to train in LTTPR transparent mode if repeater count exceeds 8. */ is_lttpr_present = (link->dpcd_caps.lttpr_caps.max_lane_count > 0 && link->dpcd_caps.lttpr_caps.max_lane_count <= 4 && diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 2022-11-29 07:06:46.000000000 +0000 @@ -2165,7 +2165,8 @@ continue; if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A) continue; - if (pipe_ctx->stream_res.audio != NULL) { + if (pipe_ctx->stream_res.audio != NULL && + pipe_ctx->stream_res.audio->enabled == false) { struct audio_output audio_output; build_audio_output(context, pipe_ctx, &audio_output); @@ -2207,7 +2208,8 @@ if (!dc_is_dp_signal(pipe_ctx->stream->signal)) continue; - if (pipe_ctx->stream_res.audio != NULL) { + if (pipe_ctx->stream_res.audio != NULL && + pipe_ctx->stream_res.audio->enabled == false) { struct audio_output audio_output; build_audio_output(context, pipe_ctx, &audio_output); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 2022-11-29 07:06:46.000000000 +0000 @@ -3623,7 +3623,7 @@ { const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing; int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset; int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx); int start_position; @@ -3648,18 +3648,10 @@ static void dcn10_cal_vline_position( struct dc *dc, struct pipe_ctx *pipe_ctx, - enum vline_select vline, uint32_t *start_line, uint32_t *end_line) { - enum vertical_interrupt_ref_point ref_point = INVALID_POINT; - - if (vline == VLINE0) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; - else if (vline == VLINE1) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - - switch (ref_point) { + switch (pipe_ctx->stream->periodic_interrupt.ref_point) { case START_V_UPDATE: dcn10_calc_vupdate_position( dc, @@ -3668,7 +3660,9 @@ end_line); break; case START_V_SYNC: - // Suppose to do nothing because vsync is 0; + // vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line + 2; break; default: ASSERT(0); @@ -3678,24 +3672,15 @@ void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline) + struct pipe_ctx *pipe_ctx) { struct timing_generator *tg = pipe_ctx->stream_res.tg; + uint32_t start_line = 0; + uint32_t end_line = 0; - if (vline == VLINE0) { - uint32_t start_line = 0; - uint32_t end_line = 0; - - dcn10_cal_vline_position(dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); - - } else if (vline == VLINE1) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + dcn10_cal_vline_position(dc, pipe_ctx, &start_line, &end_line); + + tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); } void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h 2022-11-29 07:06:46.000000000 +0000 @@ -175,8 +175,7 @@ void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx); void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c 2022-11-29 07:06:46.000000000 +0000 @@ -1520,6 +1520,7 @@ /* Any updates are handled in dc interface, just need * to apply existing for plane enable / opp change */ if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed + || pipe_ctx->update_flags.bits.plane_changed || pipe_ctx->stream->update_flags.bits.gamut_remap || pipe_ctx->stream->update_flags.bits.out_csc) { /* dpp/cm gamut remap*/ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c 2022-11-29 07:06:46.000000000 +0000 @@ -150,9 +150,9 @@ * 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + * a little more because we may not trust delay accuracy. */ - //REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, - // VID_STREAM_STATUS, 0, - // 10, 5000); + REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, + VID_STREAM_STATUS, 0, + 10, 5000); /* Disable SDP tranmission */ REG_UPDATE(DP_SYM32_ENC_SDP_CONTROL, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dc_stream.h linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dc_stream.h --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dc_stream.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dc_stream.h 2022-11-29 07:06:46.000000000 +0000 @@ -200,8 +200,7 @@ /* DMCU info */ unsigned int abm_level; - struct periodic_interrupt_config periodic_interrupt0; - struct periodic_interrupt_config periodic_interrupt1; + struct periodic_interrupt_config periodic_interrupt; /* from core_stream struct */ struct dc_context *ctx; @@ -268,8 +267,7 @@ struct dc_info_packet *hdr_static_metadata; unsigned int *abm_level; - struct periodic_interrupt_config *periodic_interrupt0; - struct periodic_interrupt_config *periodic_interrupt1; + struct periodic_interrupt_config *periodic_interrupt; struct dc_info_packet *vrr_infopacket; struct dc_info_packet *vsc_infopacket; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c 2022-11-29 07:06:46.000000000 +0000 @@ -26,12 +26,12 @@ #include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) - #define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) + #define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c 2022-11-29 07:06:46.000000000 +0000 @@ -6651,8 +6651,7 @@ return ret; } - -static void UseMinimumDCFCLK( +static noinline_for_stack void UseMinimumDCFCLK( struct display_mode_lib *mode_lib, int MaxInterDCNTileRepeaters, int MaxPrefetchMode, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c 2022-11-29 07:06:46.000000000 +0000 @@ -261,33 +261,13 @@ static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe); + double DPTEBytesPerRow); static double CalculateWriteBackDelay( enum source_format_class WritebackPixelFormat, double WritebackHRatio, @@ -321,64 +301,28 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport( struct display_mode_lib *mode_lib, unsigned int PrefetchMode, - unsigned int NumberOfActivePlanes, - unsigned int MaxLineBufferLines, - unsigned int LineBufferSize, - unsigned int WritebackInterfaceBufferSize, double DCFCLK, double ReturnBW, - bool SynchronizedVBlank, - unsigned int dpte_group_bytes[], - unsigned int MetaChunkSize, double UrgentLatency, double ExtraLatency, - double WritebackLatency, - double WritebackChunkSize, double SOCCLK, - double DRAMClockChangeLatency, - double SRExitTime, - double SREnterPlusExitTime, - double SRExitZ8Time, - double SREnterPlusExitZ8Time, double DCFCLKDeepSleep, unsigned int DETBufferSizeY[], unsigned int DETBufferSizeC[], unsigned int SwathHeightY[], unsigned int SwathHeightC[], - unsigned int LBBitPerPixel[], double SwathWidthY[], double SwathWidthC[], - double HRatio[], - double HRatioChroma[], - unsigned int vtaps[], - unsigned int VTAPsChroma[], - double VRatio[], - double VRatioChroma[], - unsigned int HTotal[], - double PixelClock[], - unsigned int BlendingAndTiming[], unsigned int DPPPerPlane[], double BytePerPixelDETY[], double BytePerPixelDETC[], - double DSTXAfterScaler[], - double DSTYAfterScaler[], - bool WritebackEnable[], - enum source_format_class WritebackPixelFormat[], - double WritebackDestinationWidth[], - double WritebackDestinationHeight[], - double WritebackSourceHeight[], bool UnboundedRequestEnabled, int unsigned CompressedBufferSizeInkByte, enum clock_change_support *DRAMClockChangeSupport, - double *UrgentWatermark, - double *WritebackUrgentWatermark, - double *DRAMClockChangeWatermark, - double *WritebackDRAMClockChangeWatermark, double *StutterExitWatermark, double *StutterEnterPlusExitWatermark, double *Z8StutterExitWatermark, - double *Z8StutterEnterPlusExitWatermark, - double *MinActiveDRAMClockChangeLatencySupported); + double *Z8StutterEnterPlusExitWatermark); static void CalculateDCFCLKDeepSleep( struct display_mode_lib *mode_lib, @@ -2914,33 +2858,13 @@ for (k = 0; k < v->NumberOfActivePlanes; ++k) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->UrgentExtraLatency, v->UrgentLatency, - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesFrame[k], v->MetaRowByte[k], - v->PixelPTEBytesPerRow[k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->PixelPTEBytesPerRow[k]); } v->total_dcn_read_bw_with_flip = 0.0; @@ -3027,64 +2951,28 @@ CalculateWatermarksAndDRAMSpeedChangeSupport( mode_lib, PrefetchMode, - v->NumberOfActivePlanes, - v->MaxLineBufferLines, - v->LineBufferSize, - v->WritebackInterfaceBufferSize, v->DCFCLK, v->ReturnBW, - v->SynchronizedVBlank, - v->dpte_group_bytes, - v->MetaChunkSize, v->UrgentLatency, v->UrgentExtraLatency, - v->WritebackLatency, - v->WritebackChunkSize, v->SOCCLK, - v->DRAMClockChangeLatency, - v->SRExitTime, - v->SREnterPlusExitTime, - v->SRExitZ8Time, - v->SREnterPlusExitZ8Time, v->DCFCLKDeepSleep, v->DETBufferSizeY, v->DETBufferSizeC, v->SwathHeightY, v->SwathHeightC, - v->LBBitPerPixel, v->SwathWidthY, v->SwathWidthC, - v->HRatio, - v->HRatioChroma, - v->vtaps, - v->VTAPsChroma, - v->VRatio, - v->VRatioChroma, - v->HTotal, - v->PixelClock, - v->BlendingAndTiming, v->DPPPerPlane, v->BytePerPixelDETY, v->BytePerPixelDETC, - v->DSTXAfterScaler, - v->DSTYAfterScaler, - v->WritebackEnable, - v->WritebackPixelFormat, - v->WritebackDestinationWidth, - v->WritebackDestinationHeight, - v->WritebackSourceHeight, v->UnboundedRequestEnabled, v->CompressedBufferSizeInkByte, &DRAMClockChangeSupport, - &v->UrgentWatermark, - &v->WritebackUrgentWatermark, - &v->DRAMClockChangeWatermark, - &v->WritebackDRAMClockChangeWatermark, &v->StutterExitWatermark, &v->StutterEnterPlusExitWatermark, &v->Z8StutterExitWatermark, - &v->Z8StutterEnterPlusExitWatermark, - &v->MinActiveDRAMClockChangeLatencySupported); + &v->Z8StutterEnterPlusExitWatermark); for (k = 0; k < v->NumberOfActivePlanes; ++k) { if (v->WritebackEnable[k] == true) { @@ -3696,61 +3584,43 @@ static void CalculateFlipSchedule( struct display_mode_lib *mode_lib, + unsigned int k, double HostVMInefficiencyFactor, double UrgentExtraLatency, double UrgentLatency, - unsigned int GPUVMMaxPageTableLevels, - bool HostVMEnable, - unsigned int HostVMMaxNonCachedPageTableLevels, - bool GPUVMEnable, - double HostVMMinPageSize, double PDEAndMetaPTEBytesPerFrame, double MetaRowBytes, - double DPTEBytesPerRow, - double BandwidthAvailableForImmediateFlip, - unsigned int TotImmediateFlipBytes, - enum source_format_class SourcePixelFormat, - double LineTime, - double VRatio, - double VRatioChroma, - double Tno_bw, - bool DCCEnable, - unsigned int dpte_row_height, - unsigned int meta_row_height, - unsigned int dpte_row_height_chroma, - unsigned int meta_row_height_chroma, - double *DestinationLinesToRequestVMInImmediateFlip, - double *DestinationLinesToRequestRowInImmediateFlip, - double *final_flip_bw, - bool *ImmediateFlipSupportedForPipe) + double DPTEBytesPerRow) { + struct vba_vars_st *v = &mode_lib->vba; double min_row_time = 0.0; unsigned int HostVMDynamicLevelsTrips; double TimeForFetchingMetaPTEImmediateFlip; double TimeForFetchingRowInVBlankImmediateFlip; double ImmediateFlipBW; + double LineTime = v->HTotal[k] / v->PixelClock[k]; - if (GPUVMEnable == true && HostVMEnable == true) { - HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; + if (v->GPUVMEnable == true && v->HostVMEnable == true) { + HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels; } else { HostVMDynamicLevelsTrips = 0; } - if (GPUVMEnable == true || DCCEnable == true) { - ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; + if (v->GPUVMEnable == true || v->DCCEnable[k] == true) { + ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes; } - if (GPUVMEnable == true) { + if (v->GPUVMEnable == true) { TimeForFetchingMetaPTEImmediateFlip = dml_max3( - Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, - UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), + v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, + UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), LineTime / 4.0); } else { TimeForFetchingMetaPTEImmediateFlip = 0; } - *DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; - if ((GPUVMEnable == true || DCCEnable == true)) { + v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; + if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { TimeForFetchingRowInVBlankImmediateFlip = dml_max3( (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW, UrgentLatency * (HostVMDynamicLevelsTrips + 1), @@ -3759,54 +3629,54 @@ TimeForFetchingRowInVBlankImmediateFlip = 0; } - *DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; - - if (GPUVMEnable == true) { - *final_flip_bw = dml_max( - PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime), - (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime)); - } else if ((GPUVMEnable == true || DCCEnable == true)) { - *final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); - } else { - *final_flip_bw = 0; - } + v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; - if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) { - if (GPUVMEnable == true && DCCEnable != true) { - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma); - } else if (GPUVMEnable != true && DCCEnable == true) { - min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma); + if (v->GPUVMEnable == true) { + v->final_flip_bw[k] = dml_max( + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime), + (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime)); + } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { + v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime); + } else { + v->final_flip_bw[k] = 0; + } + + if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) { + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { + min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } else { min_row_time = dml_min4( - dpte_row_height * LineTime / VRatio, - meta_row_height * LineTime / VRatio, - dpte_row_height_chroma * LineTime / VRatioChroma, - meta_row_height_chroma * LineTime / VRatioChroma); + v->dpte_row_height[k] * LineTime / v->VRatio[k], + v->meta_row_height[k] * LineTime / v->VRatio[k], + v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k], + v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); } } else { - if (GPUVMEnable == true && DCCEnable != true) { - min_row_time = dpte_row_height * LineTime / VRatio; - } else if (GPUVMEnable != true && DCCEnable == true) { - min_row_time = meta_row_height * LineTime / VRatio; + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { + min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k]; + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { + min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k]; } else { - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio); + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]); } } - if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16 + if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16 || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) { - *ImmediateFlipSupportedForPipe = false; + v->ImmediateFlipSupportedForPipe[k] = false; } else { - *ImmediateFlipSupportedForPipe = true; + v->ImmediateFlipSupportedForPipe[k] = true; } #ifdef __DML_VBA_DEBUG__ - dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip); - dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip); + dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]); + dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]); dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip); dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip); dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time); - dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe); + dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]); #endif } @@ -5397,33 +5267,13 @@ for (k = 0; k < v->NumberOfActivePlanes; k++) { CalculateFlipSchedule( mode_lib, + k, HostVMInefficiencyFactor, v->ExtraLatency, v->UrgLatency[i], - v->GPUVMMaxPageTableLevels, - v->HostVMEnable, - v->HostVMMaxNonCachedPageTableLevels, - v->GPUVMEnable, - v->HostVMMinPageSize, v->PDEAndMetaPTEBytesPerFrame[i][j][k], v->MetaRowBytes[i][j][k], - v->DPTEBytesPerRow[i][j][k], - v->BandwidthAvailableForImmediateFlip, - v->TotImmediateFlipBytes, - v->SourcePixelFormat[k], - v->HTotal[k] / v->PixelClock[k], - v->VRatio[k], - v->VRatioChroma[k], - v->Tno_bw[k], - v->DCCEnable[k], - v->dpte_row_height[k], - v->meta_row_height[k], - v->dpte_row_height_chroma[k], - v->meta_row_height_chroma[k], - &v->DestinationLinesToRequestVMInImmediateFlip[k], - &v->DestinationLinesToRequestRowInImmediateFlip[k], - &v->final_flip_bw[k], - &v->ImmediateFlipSupportedForPipe[k]); + v->DPTEBytesPerRow[i][j][k]); } v->total_dcn_read_bw_with_flip = 0.0; for (k = 0; k < v->NumberOfActivePlanes; k++) { @@ -5481,64 +5331,28 @@ CalculateWatermarksAndDRAMSpeedChangeSupport( mode_lib, v->PrefetchModePerState[i][j], - v->NumberOfActivePlanes, - v->MaxLineBufferLines, - v->LineBufferSize, - v->WritebackInterfaceBufferSize, v->DCFCLKState[i][j], v->ReturnBWPerState[i][j], - v->SynchronizedVBlank, - v->dpte_group_bytes, - v->MetaChunkSize, v->UrgLatency[i], v->ExtraLatency, - v->WritebackLatency, - v->WritebackChunkSize, v->SOCCLKPerState[i], - v->DRAMClockChangeLatency, - v->SRExitTime, - v->SREnterPlusExitTime, - v->SRExitZ8Time, - v->SREnterPlusExitZ8Time, v->ProjectedDCFCLKDeepSleep[i][j], v->DETBufferSizeYThisState, v->DETBufferSizeCThisState, v->SwathHeightYThisState, v->SwathHeightCThisState, - v->LBBitPerPixel, v->SwathWidthYThisState, v->SwathWidthCThisState, - v->HRatio, - v->HRatioChroma, - v->vtaps, - v->VTAPsChroma, - v->VRatio, - v->VRatioChroma, - v->HTotal, - v->PixelClock, - v->BlendingAndTiming, v->NoOfDPPThisState, v->BytePerPixelInDETY, v->BytePerPixelInDETC, - v->DSTXAfterScaler, - v->DSTYAfterScaler, - v->WritebackEnable, - v->WritebackPixelFormat, - v->WritebackDestinationWidth, - v->WritebackDestinationHeight, - v->WritebackSourceHeight, UnboundedRequestEnabledThisState, CompressedBufferSizeInkByteThisState, &v->DRAMClockChangeSupport[i][j], - &v->UrgentWatermark, - &v->WritebackUrgentWatermark, - &v->DRAMClockChangeWatermark, - &v->WritebackDRAMClockChangeWatermark, - &dummy, &dummy, &dummy, &dummy, - &v->MinActiveDRAMClockChangeLatencySupported); + &dummy); } } @@ -5663,64 +5477,28 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport( struct display_mode_lib *mode_lib, unsigned int PrefetchMode, - unsigned int NumberOfActivePlanes, - unsigned int MaxLineBufferLines, - unsigned int LineBufferSize, - unsigned int WritebackInterfaceBufferSize, double DCFCLK, double ReturnBW, - bool SynchronizedVBlank, - unsigned int dpte_group_bytes[], - unsigned int MetaChunkSize, double UrgentLatency, double ExtraLatency, - double WritebackLatency, - double WritebackChunkSize, double SOCCLK, - double DRAMClockChangeLatency, - double SRExitTime, - double SREnterPlusExitTime, - double SRExitZ8Time, - double SREnterPlusExitZ8Time, double DCFCLKDeepSleep, unsigned int DETBufferSizeY[], unsigned int DETBufferSizeC[], unsigned int SwathHeightY[], unsigned int SwathHeightC[], - unsigned int LBBitPerPixel[], double SwathWidthY[], double SwathWidthC[], - double HRatio[], - double HRatioChroma[], - unsigned int vtaps[], - unsigned int VTAPsChroma[], - double VRatio[], - double VRatioChroma[], - unsigned int HTotal[], - double PixelClock[], - unsigned int BlendingAndTiming[], unsigned int DPPPerPlane[], double BytePerPixelDETY[], double BytePerPixelDETC[], - double DSTXAfterScaler[], - double DSTYAfterScaler[], - bool WritebackEnable[], - enum source_format_class WritebackPixelFormat[], - double WritebackDestinationWidth[], - double WritebackDestinationHeight[], - double WritebackSourceHeight[], bool UnboundedRequestEnabled, int unsigned CompressedBufferSizeInkByte, enum clock_change_support *DRAMClockChangeSupport, - double *UrgentWatermark, - double *WritebackUrgentWatermark, - double *DRAMClockChangeWatermark, - double *WritebackDRAMClockChangeWatermark, double *StutterExitWatermark, double *StutterEnterPlusExitWatermark, double *Z8StutterExitWatermark, - double *Z8StutterEnterPlusExitWatermark, - double *MinActiveDRAMClockChangeLatencySupported) + double *Z8StutterEnterPlusExitWatermark) { struct vba_vars_st *v = &mode_lib->vba; double EffectiveLBLatencyHidingY; @@ -5740,103 +5518,103 @@ double TotalPixelBW = 0.0; int k, j; - *UrgentWatermark = UrgentLatency + ExtraLatency; + v->UrgentWatermark = UrgentLatency + ExtraLatency; #ifdef __DML_VBA_DEBUG__ dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency); dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency); - dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark); + dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark); #endif - *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark; + v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark; #ifdef __DML_VBA_DEBUG__ - dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency); - dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark); + dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency); + dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark); #endif v->TotalActiveWriteback = 0; - for (k = 0; k < NumberOfActivePlanes; ++k) { - if (WritebackEnable[k] == true) { + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->WritebackEnable[k] == true) { v->TotalActiveWriteback = v->TotalActiveWriteback + 1; } } if (v->TotalActiveWriteback <= 1) { - *WritebackUrgentWatermark = WritebackLatency; + v->WritebackUrgentWatermark = v->WritebackLatency; } else { - *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; + v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; } if (v->TotalActiveWriteback <= 1) { - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency; + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency; } else { - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; } - for (k = 0; k < NumberOfActivePlanes; ++k) { + for (k = 0; k < v->NumberOfActivePlanes; ++k) { TotalPixelBW = TotalPixelBW - + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) - / (HTotal[k] / PixelClock[k]); + + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) + / (v->HTotal[k] / v->PixelClock[k]); } - for (k = 0; k < NumberOfActivePlanes; ++k) { + for (k = 0; k < v->NumberOfActivePlanes; ++k) { double EffectiveDETBufferSizeY = DETBufferSizeY[k]; v->LBLatencyHidingSourceLinesY = dml_min( - (double) MaxLineBufferLines, - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1); + (double) v->MaxLineBufferLines, + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1); v->LBLatencyHidingSourceLinesC = dml_min( - (double) MaxLineBufferLines, - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1); + (double) v->MaxLineBufferLines, + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1); - EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]); + EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]); - EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]); + EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]); if (UnboundedRequestEnabled) { EffectiveDETBufferSizeY = EffectiveDETBufferSizeY - + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW; + + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW; } LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k]; LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]); - FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k]; + FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k]; if (BytePerPixelDETC[k] > 0) { LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k]; LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]); - FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k]; + FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k]; } else { LinesInDETC = 0; FullDETBufferingTimeC = 999999; } ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; - if (NumberOfActivePlanes > 1) { + if (v->NumberOfActivePlanes > 1) { ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k]; + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k]; } if (BytePerPixelDETC[k] > 0) { ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; - if (NumberOfActivePlanes > 1) { + if (v->NumberOfActivePlanes > 1) { ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k]; + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k]; } v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC); } else { v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY; } - if (WritebackEnable[k] == true) { - WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024 - / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4); - if (WritebackPixelFormat[k] == dm_444_64) { + if (v->WritebackEnable[k] == true) { + WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024 + / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4); + if (v->WritebackPixelFormat[k] == dm_444_64) { WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2; } WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark; @@ -5846,14 +5624,14 @@ v->MinActiveDRAMClockChangeMargin = 999999; PlaneWithMinActiveDRAMClockChangeMargin = 0; - for (k = 0; k < NumberOfActivePlanes; ++k) { + for (k = 0; k < v->NumberOfActivePlanes; ++k) { if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) { v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k]; - if (BlendingAndTiming[k] == k) { + if (v->BlendingAndTiming[k] == k) { PlaneWithMinActiveDRAMClockChangeMargin = k; } else { - for (j = 0; j < NumberOfActivePlanes; ++j) { - if (BlendingAndTiming[k] == j) { + for (j = 0; j < v->NumberOfActivePlanes; ++j) { + if (v->BlendingAndTiming[k] == j) { PlaneWithMinActiveDRAMClockChangeMargin = j; } } @@ -5861,11 +5639,11 @@ } } - *MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency; + v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ; SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999; - for (k = 0; k < NumberOfActivePlanes; ++k) { - if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) { SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k]; } @@ -5873,25 +5651,25 @@ v->TotalNumberOfActiveOTG = 0; - for (k = 0; k < NumberOfActivePlanes; ++k) { - if (BlendingAndTiming[k] == k) { + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->BlendingAndTiming[k] == k) { v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1; } } if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) { *DRAMClockChangeSupport = dm_dram_clock_change_vactive; - } else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 + } else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) { *DRAMClockChangeSupport = dm_dram_clock_change_vblank; } else { *DRAMClockChangeSupport = dm_dram_clock_change_unsupported; } - *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; - *StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); - *Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; - *Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; + *StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; + *StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); + *Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; + *Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; #ifdef __DML_VBA_DEBUG__ dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h 2022-11-29 07:06:46.000000000 +0000 @@ -32,11 +32,6 @@ #include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { - VLINE0, - VLINE1 -}; - struct pipe_ctx; struct dc_state; struct dc_stream_status; @@ -116,8 +111,7 @@ int group_index, int group_size, struct pipe_ctx *grouped_pipes[]); void (*setup_periodic_interrupt)(struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, struct dc_crtc_timing_adjust adjust); void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/display/modules/color/color_gamma.c linux-aws-5.19.0/drivers/gpu/drm/amd/display/modules/color/color_gamma.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/display/modules/color/color_gamma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/display/modules/color/color_gamma.c 2022-11-29 07:06:46.000000000 +0000 @@ -1603,6 +1603,7 @@ struct fixed31_32 lut2; struct fixed31_32 delta_lut; struct fixed31_32 delta_index; + const struct fixed31_32 one = dc_fixpt_from_int(1); i = 0; /* fixed_pt library has problems handling too small values */ @@ -1631,6 +1632,9 @@ } else hw_x = coordinates_x[i].x; + if (dc_fixpt_le(one, hw_x)) + hw_x = one; + norm_x = dc_fixpt_mul(norm_factor, hw_x); index = dc_fixpt_floor(norm_x); if (index < 0 || index > 255) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c 2022-11-29 07:06:46.000000000 +0000 @@ -368,6 +368,17 @@ smu_baco->platform_support = (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false; + + /* + * Disable BACO entry/exit completely on below SKUs to + * avoid hardware intermittent failures. + */ + if (((adev->pdev->device == 0x73A1) && + (adev->pdev->revision == 0x00)) || + ((adev->pdev->device == 0x73BF) && + (adev->pdev->revision == 0xCF))) + smu_baco->platform_support = false; + } } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c --- linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c 2022-11-29 07:06:46.000000000 +0000 @@ -382,11 +382,27 @@ return 0; } +static int smu_v13_0_7_get_pptable_from_pmfw(struct smu_context *smu, + void **table, + uint32_t *size) +{ + struct smu_table_context *smu_table = &smu->smu_table; + void *combo_pptable = smu_table->combo_pptable; + int ret = 0; + + ret = smu_cmn_get_combo_pptable(smu); + if (ret) + return ret; + + *table = combo_pptable; + *size = sizeof(struct smu_13_0_7_powerplay_table); + + return 0; +} static int smu_v13_0_7_setup_pptable(struct smu_context *smu) { struct smu_table_context *smu_table = &smu->smu_table; - void *combo_pptable = smu_table->combo_pptable; struct amdgpu_device *adev = smu->adev; int ret = 0; @@ -395,18 +411,11 @@ * be used directly by driver. To get the raw pptable, we need to * rely on the combo pptable(and its revelant SMU message). */ - if (adev->scpm_enabled) { - ret = smu_cmn_get_combo_pptable(smu); - if (ret) - return ret; - - smu->smu_table.power_play_table = combo_pptable; - smu->smu_table.power_play_table_size = sizeof(struct smu_13_0_7_powerplay_table); - } else { - ret = smu_v13_0_setup_pptable(smu); - if (ret) - return ret; - } + ret = smu_v13_0_7_get_pptable_from_pmfw(smu, + &smu_table->power_play_table, + &smu_table->power_play_table_size); + if (ret) + return ret; ret = smu_v13_0_7_store_powerplay_table(smu); if (ret) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c --- linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c 2022-11-29 07:06:46.000000000 +0000 @@ -235,7 +235,7 @@ crtc->state->event = NULL; drm_crtc_send_vblank_event(crtc, event); } else { - DRM_WARN("CRTC[%d]: FLIP happen but no pending commit.\n", + DRM_WARN("CRTC[%d]: FLIP happened but no pending commit.\n", drm_crtc_index(&kcrtc->base)); } spin_unlock_irqrestore(&crtc->dev->event_lock, flags); @@ -286,7 +286,7 @@ komeda_crtc_do_flush(crtc, old); } -static void +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, struct completion *input_flip_done) { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.c linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.c --- linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.c 2022-11-29 07:06:46.000000000 +0000 @@ -69,6 +69,25 @@ .minor = 1, }; +static void komeda_kms_atomic_commit_hw_done(struct drm_atomic_state *state) +{ + struct drm_device *dev = state->dev; + struct komeda_kms_dev *kms = to_kdev(dev); + int i; + + for (i = 0; i < kms->n_crtcs; i++) { + struct komeda_crtc *kcrtc = &kms->crtcs[i]; + + if (kcrtc->base.state->active) { + struct completion *flip_done = NULL; + if (kcrtc->base.state->event) + flip_done = kcrtc->base.state->event->base.completion; + komeda_crtc_flush_and_wait_for_flip_done(kcrtc, flip_done); + } + } + drm_atomic_helper_commit_hw_done(state); +} + static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; @@ -81,7 +100,7 @@ drm_atomic_helper_commit_modeset_enables(dev, old_state); - drm_atomic_helper_commit_hw_done(old_state); + komeda_kms_atomic_commit_hw_done(old_state); drm_atomic_helper_wait_for_flip_done(dev, old_state); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.h linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.h --- linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/arm/display/komeda/komeda_kms.h 2022-11-29 07:06:46.000000000 +0000 @@ -182,6 +182,8 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_events *evts); +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, + struct completion *input_flip_done); struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev); void komeda_kms_detach(struct komeda_kms_dev *kms); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c 2022-11-29 07:06:46.000000000 +0000 @@ -359,7 +359,7 @@ goto err_cec_alloc; } - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, 0); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, 0); /* cec soft reset */ regmap_write(adv7511->regmap_cec, ADV7511_REG_CEC_SOFT_RESET + offset, 0x01); @@ -386,7 +386,7 @@ dev_info(dev, "Initializing CEC failed with error %d, disabling CEC\n", ret); err_cec_parse_dt: - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return ret == -EPROBE_DEFER ? ret : 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -1340,9 +1340,6 @@ { struct adv7511 *adv7511 = i2c_get_clientdata(i2c); - i2c_unregister_device(adv7511->i2c_cec); - clk_disable_unprepare(adv7511->cec_clk); - adv7511_uninit_regulators(adv7511); drm_bridge_remove(&adv7511->bridge); @@ -1350,6 +1347,8 @@ adv7511_audio_exit(adv7511); cec_unregister_adapter(adv7511->cec_adap); + i2c_unregister_device(adv7511->i2c_cec); + clk_disable_unprepare(adv7511->cec_clk); i2c_unregister_device(adv7511->i2c_packet); i2c_unregister_device(adv7511->i2c_edid); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511.h linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511.h --- linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/adv7511/adv7511.h 2022-11-29 07:06:46.000000000 +0000 @@ -394,10 +394,7 @@ #else static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) { - unsigned int offset = adv7511->type == ADV7533 ? - ADV7533_REG_CEC_OFFSET : 0; - - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c linux-aws-5.19.0/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1863,12 +1863,6 @@ int analogix_dp_suspend(struct analogix_dp_device *dp) { clk_disable_unprepare(dp->clock); - - if (dp->plat_data->panel) { - if (drm_panel_unprepare(dp->plat_data->panel)) - DRM_ERROR("failed to turnoff the panel\n"); - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_suspend); @@ -1883,13 +1877,6 @@ return ret; } - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_resume); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/ite-it6505.c linux-aws-5.19.0/drivers/gpu/drm/bridge/ite-it6505.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/ite-it6505.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/ite-it6505.c 2022-11-29 07:06:46.000000000 +0000 @@ -2954,6 +2954,9 @@ it6505_int_mask_enable(it6505); it6505_video_reset(it6505); + + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D0); } static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, @@ -2965,9 +2968,9 @@ DRM_DEV_DEBUG_DRIVER(dev, "start"); if (it6505->powered) { - it6505_video_disable(it6505); it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, DP_SET_POWER_D3); + it6505_video_disable(it6505); } } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt8912b.c linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt8912b.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt8912b.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt8912b.c 2022-11-29 07:06:46.000000000 +0000 @@ -186,7 +186,7 @@ {0x03, 0xff}, }; - return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(seq)); + return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq)); }; static inline struct lt8912 *bridge_to_lt8912(struct drm_bridge *b) @@ -266,7 +266,7 @@ u32 hactive, h_total, hpw, hfp, hbp; u32 vactive, v_total, vpw, vfp, vbp; u8 settle = 0x08; - int ret; + int ret, hsync_activehigh, vsync_activehigh; if (!lt) return -EINVAL; @@ -276,12 +276,14 @@ hpw = lt->mode.hsync_len; hbp = lt->mode.hback_porch; h_total = hactive + hfp + hpw + hbp; + hsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH; vactive = lt->mode.vactive; vfp = lt->mode.vfront_porch; vpw = lt->mode.vsync_len; vbp = lt->mode.vback_porch; v_total = vactive + vfp + vpw + vbp; + vsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH; if (vactive <= 600) settle = 0x04; @@ -315,6 +317,13 @@ ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff); ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8); + ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0), + vsync_activehigh ? BIT(0) : 0); + ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), + hsync_activehigh ? BIT(1) : 0); + ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xb2, BIT(0), + lt->connector.display_info.is_hdmi ? BIT(0) : 0); + return ret; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt9611.c linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt9611.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt9611.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/lontium-lt9611.c 2022-11-29 07:06:46.000000000 +0000 @@ -807,13 +807,14 @@ drm_connector_helper_add(<9611->connector, <9611_bridge_connector_helper_funcs); - drm_connector_attach_encoder(<9611->connector, bridge->encoder); if (!bridge->encoder) { DRM_ERROR("Parent encoder object not found"); return -ENODEV; } + drm_connector_attach_encoder(<9611->connector, bridge->encoder); + return 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c linux-aws-5.19.0/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c 2022-11-29 07:06:46.000000000 +0000 @@ -296,7 +296,9 @@ * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/parade-ps8640.c linux-aws-5.19.0/drivers/gpu/drm/bridge/parade-ps8640.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/parade-ps8640.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/parade-ps8640.c 2022-11-29 07:06:46.000000000 +0000 @@ -596,8 +596,8 @@ if (!ps_bridge) return -ENOMEM; - ps_bridge->supplies[0].supply = "vdd33"; - ps_bridge->supplies[1].supply = "vdd12"; + ps_bridge->supplies[0].supply = "vdd12"; + ps_bridge->supplies[1].supply = "vdd33"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), ps_bridge->supplies); if (ret) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c linux-aws-5.19.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -3095,6 +3095,7 @@ { struct dw_hdmi *hdmi = dev_id; u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; + enum drm_connector_status status = connector_status_unknown; intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); @@ -3133,13 +3134,15 @@ cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); mutex_unlock(&hdmi->cec_notifier_mutex); } - } - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; + if (phy_stat & HDMI_PHY_HPD) + status = connector_status_connected; + + if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) + status = connector_status_disconnected; + } + if (status != connector_status_unknown) { dev_dbg(hdmi->dev, "EVENT=%s\n", status == connector_status_connected ? "plugin" : "plugout"); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/bridge/tc358767.c linux-aws-5.19.0/drivers/gpu/drm/bridge/tc358767.c --- linux-aws-5.19.0/drivers/gpu/drm/bridge/tc358767.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/bridge/tc358767.c 2022-11-29 07:06:46.000000000 +0000 @@ -1986,9 +1986,10 @@ for_each_endpoint_of_node(dev->of_node, node) { of_graph_parse_endpoint(node, &endpoint); - if (endpoint.port > 2) + if (endpoint.port > 2) { + of_node_put(node); return -EINVAL; - + } mode |= BIT(endpoint.port); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_helper.c linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_helper.c --- linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_helper.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_helper.c 2022-11-29 07:06:46.000000000 +0000 @@ -2636,17 +2636,8 @@ struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; - u8 link_config[2]; u8 test_pattern; - link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); - link_config[1] = data->num_lanes; - if (data->enhanced_frame_cap) - link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; - err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); - if (err < 0) - return err; - test_pattern = data->phy_pattern; if (dp_rev < 0x12) { test_pattern = (test_pattern << 2) & diff -Nru linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_mst_topology.c linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_mst_topology.c --- linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_mst_topology.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/display/drm_dp_mst_topology.c 2022-11-29 07:06:46.000000000 +0000 @@ -4916,14 +4916,14 @@ seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4931,7 +4931,7 @@ /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_bridge.c linux-aws-5.19.0/drivers/gpu/drm/drm_bridge.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_bridge.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_bridge.c 2022-11-29 07:06:46.000000000 +0000 @@ -823,8 +823,8 @@ struct drm_connector_state *conn_state, u32 out_bus_fmt) { + unsigned int i, num_in_bus_fmts = 0; struct drm_bridge_state *cur_state; - unsigned int num_in_bus_fmts, i; struct drm_bridge *prev_bridge; u32 *in_bus_fmts; int ret; @@ -945,7 +945,7 @@ struct drm_connector *conn = conn_state->connector; struct drm_encoder *encoder = bridge->encoder; struct drm_bridge_state *last_bridge_state; - unsigned int i, num_out_bus_fmts; + unsigned int i, num_out_bus_fmts = 0; struct drm_bridge *last_bridge; u32 *out_bus_fmts; int ret = 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_edid.c linux-aws-5.19.0/drivers/gpu/drm/drm_edid.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_edid.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_edid.c 2022-11-29 07:06:46.000000000 +0000 @@ -4577,6 +4577,51 @@ return true; } +static void drm_calculate_luminance_range(struct drm_connector *connector) +{ + struct hdr_static_metadata *hdr_metadata = &connector->hdr_sink_metadata.hdmi_type1; + struct drm_luminance_range_info *luminance_range = + &connector->display_info.luminance_range; + static const u8 pre_computed_values[] = { + 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 65, 66, 68, 69, + 71, 72, 74, 75, 77, 79, 81, 82, 84, 86, 88, 90, 92, 94, 96, 98 + }; + u32 max_avg, min_cll, max, min, q, r; + + if (!(hdr_metadata->metadata_type & BIT(HDMI_STATIC_METADATA_TYPE1))) + return; + + max_avg = hdr_metadata->max_fall; + min_cll = hdr_metadata->min_cll; + + /* + * From the specification (CTA-861-G), for calculating the maximum + * luminance we need to use: + * Luminance = 50*2**(CV/32) + * Where CV is a one-byte value. + * For calculating this expression we may need float point precision; + * to avoid this complexity level, we take advantage that CV is divided + * by a constant. From the Euclids division algorithm, we know that CV + * can be written as: CV = 32*q + r. Next, we replace CV in the + * Luminance expression and get 50*(2**q)*(2**(r/32)), hence we just + * need to pre-compute the value of r/32. For pre-computing the values + * We just used the following Ruby line: + * (0...32).each {|cv| puts (50*2**(cv/32.0)).round} + * The results of the above expressions can be verified at + * pre_computed_values. + */ + q = max_avg >> 5; + r = max_avg % 32; + max = (1 << q) * pre_computed_values[r]; + + /* min luminance: maxLum * (CV/255)^2 / 100 */ + q = DIV_ROUND_CLOSEST(min_cll, 255); + min = max * DIV_ROUND_CLOSEST((q * q), 100); + + luminance_range->min_luminance = min; + luminance_range->max_luminance = max; +} + static uint8_t eotf_supported(const u8 *edid_ext) { return edid_ext[2] & @@ -4608,8 +4653,12 @@ connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4]; if (len >= 5) connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5]; - if (len >= 6) + if (len >= 6) { connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6]; + + /* Calculate only when all values are available */ + drm_calculate_luminance_range(connector); + } } static void @@ -5508,6 +5557,7 @@ info->non_desktop = 0; memset(&info->monitor_range, 0, sizeof(info->monitor_range)); + memset(&info->luminance_range, 0, sizeof(info->luminance_range)); info->mso_stream_count = 0; info->mso_pixel_overlap = 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_gem.c linux-aws-5.19.0/drivers/gpu/drm/drm_gem.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_gem.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_gem.c 2022-11-29 07:06:46.000000000 +0000 @@ -168,21 +168,6 @@ } EXPORT_SYMBOL(drm_gem_private_object_init); -static void -drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp) -{ - /* - * Note: obj->dma_buf can't disappear as long as we still hold a - * handle reference in obj->handle_count. - */ - mutex_lock(&filp->prime.lock); - if (obj->dma_buf) { - drm_prime_remove_buf_handle_locked(&filp->prime, - obj->dma_buf); - } - mutex_unlock(&filp->prime.lock); -} - /** * drm_gem_object_handle_free - release resources bound to userspace handles * @obj: GEM object to clean up. @@ -253,7 +238,7 @@ if (obj->funcs->close) obj->funcs->close(obj, file_priv); - drm_gem_remove_prime_handles(obj, file_priv); + drm_prime_remove_buf_handle(&file_priv->prime, id); drm_vma_node_revoke(&obj->vma_node, file_priv); drm_gem_object_handle_put_unlocked(obj); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_internal.h linux-aws-5.19.0/drivers/gpu/drm/drm_internal.h --- linux-aws-5.19.0/drivers/gpu/drm/drm_internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -74,8 +74,8 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); -void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, - struct dma_buf *dma_buf); +void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, + uint32_t handle); /* drm_drv.c */ struct drm_minor *drm_minor_acquire(unsigned int minor_id); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_ioctl.c linux-aws-5.19.0/drivers/gpu/drm/drm_ioctl.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_ioctl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_ioctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -472,7 +472,13 @@ */ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { - int len; + size_t len; + + /* don't attempt to copy a NULL pointer */ + if (WARN_ONCE(!value, "BUG: the value to copy was not set!")) { + *buf_len = 0; + return 0; + } /* don't overflow userbuf */ len = strlen(value); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_mipi_dsi.c linux-aws-5.19.0/drivers/gpu/drm/drm_mipi_dsi.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_mipi_dsi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_mipi_dsi.c 2022-11-29 07:06:46.000000000 +0000 @@ -346,6 +346,7 @@ { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + mipi_dsi_detach(dsi); mipi_dsi_device_unregister(dsi); return 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_panel_orientation_quirks.c linux-aws-5.19.0/drivers/gpu/drm/drm_panel_orientation_quirks.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_panel_orientation_quirks.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_panel_orientation_quirks.c 2022-11-29 07:06:46.000000000 +0000 @@ -103,6 +103,12 @@ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = { + .width = 1080, + .height = 1920, + .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, +}; + static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width = 1200, .height = 1920, @@ -128,6 +134,12 @@ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Anbernic Win600 */ + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"), + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* Asus T100HA */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), @@ -152,6 +164,12 @@ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AIR */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"), + DMI_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"), diff -Nru linux-aws-5.19.0/drivers/gpu/drm/drm_prime.c linux-aws-5.19.0/drivers/gpu/drm/drm_prime.c --- linux-aws-5.19.0/drivers/gpu/drm/drm_prime.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/drm_prime.c 2022-11-29 07:06:46.000000000 +0000 @@ -190,29 +190,33 @@ return -ENOENT; } -void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, - struct dma_buf *dma_buf) +void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, + uint32_t handle) { struct rb_node *rb; - rb = prime_fpriv->dmabufs.rb_node; + mutex_lock(&prime_fpriv->lock); + + rb = prime_fpriv->handles.rb_node; while (rb) { struct drm_prime_member *member; - member = rb_entry(rb, struct drm_prime_member, dmabuf_rb); - if (member->dma_buf == dma_buf) { + member = rb_entry(rb, struct drm_prime_member, handle_rb); + if (member->handle == handle) { rb_erase(&member->handle_rb, &prime_fpriv->handles); rb_erase(&member->dmabuf_rb, &prime_fpriv->dmabufs); - dma_buf_put(dma_buf); + dma_buf_put(member->dma_buf); kfree(member); - return; - } else if (member->dma_buf < dma_buf) { + break; + } else if (member->handle < handle) { rb = rb->rb_right; } else { rb = rb->rb_left; } } + + mutex_unlock(&prime_fpriv->lock); } void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/cdv_device.c linux-aws-5.19.0/drivers/gpu/drm/gma500/cdv_device.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/cdv_device.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/cdv_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -581,11 +581,9 @@ static int cdv_chip_setup(struct drm_device *dev) { struct drm_psb_private *dev_priv = to_drm_psb_private(dev); - struct pci_dev *pdev = to_pci_dev(dev->dev); INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func); - if (pci_enable_msi(pdev)) - dev_warn(dev->dev, "Enabling MSI failed!\n"); + dev_priv->use_msi = true; dev_priv->regmap = cdv_regmap; gma_get_core_freq(dev); psb_intel_opregion_init(dev); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/gem.c linux-aws-5.19.0/drivers/gpu/drm/gma500/gem.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/gem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/gem.c 2022-11-29 07:06:46.000000000 +0000 @@ -112,12 +112,12 @@ { struct psb_gem_object *pobj = to_psb_gem_object(obj); - drm_gem_object_release(obj); - /* Undo the mmap pin if we are destroying the object */ if (pobj->mmapping) psb_gem_unpin(pobj); + drm_gem_object_release(obj); + WARN_ON(pobj->in_gart && !pobj->stolen); release_resource(&pobj->resource); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/gma_display.c linux-aws-5.19.0/drivers/gpu/drm/gma500/gma_display.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/gma_display.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/gma_display.c 2022-11-29 07:06:46.000000000 +0000 @@ -531,15 +531,18 @@ WARN_ON(drm_crtc_vblank_get(crtc) != 0); gma_crtc->page_flip_event = event; + spin_unlock_irqrestore(&dev->event_lock, flags); /* Call this locked if we want an event at vblank interrupt. */ ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); if (ret) { - gma_crtc->page_flip_event = NULL; - drm_crtc_vblank_put(crtc); + spin_lock_irqsave(&dev->event_lock, flags); + if (gma_crtc->page_flip_event) { + gma_crtc->page_flip_event = NULL; + drm_crtc_vblank_put(crtc); + } + spin_unlock_irqrestore(&dev->event_lock, flags); } - - spin_unlock_irqrestore(&dev->event_lock, flags); } else { ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/oaktrail_device.c linux-aws-5.19.0/drivers/gpu/drm/gma500/oaktrail_device.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/oaktrail_device.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/oaktrail_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -501,12 +501,9 @@ static int oaktrail_chip_setup(struct drm_device *dev) { struct drm_psb_private *dev_priv = to_drm_psb_private(dev); - struct pci_dev *pdev = to_pci_dev(dev->dev); int ret; - if (pci_enable_msi(pdev)) - dev_warn(dev->dev, "Enabling MSI failed!\n"); - + dev_priv->use_msi = true; dev_priv->regmap = oaktrail_regmap; ret = mid_chip_setup(dev); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/power.c linux-aws-5.19.0/drivers/gpu/drm/gma500/power.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/power.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/power.c 2022-11-29 07:06:46.000000000 +0000 @@ -139,8 +139,6 @@ dev_priv->regs.saveBSM = bsm; pci_read_config_dword(pdev, 0xFC, &vbt); dev_priv->regs.saveVBT = vbt; - pci_read_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, &dev_priv->msi_addr); - pci_read_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, &dev_priv->msi_data); pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); @@ -168,9 +166,6 @@ pci_restore_state(pdev); pci_write_config_dword(pdev, 0x5c, dev_priv->regs.saveBSM); pci_write_config_dword(pdev, 0xFC, dev_priv->regs.saveVBT); - /* restoring MSI address and data in PCIx space */ - pci_write_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, dev_priv->msi_addr); - pci_write_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, dev_priv->msi_data); ret = pci_enable_device(pdev); if (ret != 0) @@ -223,8 +218,7 @@ mutex_lock(&power_mutex); gma_resume_pci(pdev); gma_resume_display(pdev); - gma_irq_preinstall(dev); - gma_irq_postinstall(dev); + gma_irq_install(dev); mutex_unlock(&power_mutex); return 0; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.c linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -383,7 +383,7 @@ PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); - gma_irq_install(dev, pdev->irq); + gma_irq_install(dev); dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.h linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.h --- linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_drv.h 2022-11-29 07:06:46.000000000 +0000 @@ -490,6 +490,7 @@ int rpm_enabled; /* MID specific */ + bool use_msi; bool has_gct; struct oaktrail_gct_data gct_data; @@ -499,10 +500,6 @@ /* Register state */ struct psb_save_area regs; - /* MSI reg save */ - uint32_t msi_addr; - uint32_t msi_data; - /* Hotplug handling */ struct work_struct hotplug_work; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.c linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.c --- linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.c 2022-11-29 07:06:46.000000000 +0000 @@ -316,17 +316,24 @@ spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); } -int gma_irq_install(struct drm_device *dev, unsigned int irq) +int gma_irq_install(struct drm_device *dev) { + struct drm_psb_private *dev_priv = to_drm_psb_private(dev); + struct pci_dev *pdev = to_pci_dev(dev->dev); int ret; - if (irq == IRQ_NOTCONNECTED) + if (dev_priv->use_msi && pci_enable_msi(pdev)) { + dev_warn(dev->dev, "Enabling MSI failed!\n"); + dev_priv->use_msi = false; + } + + if (pdev->irq == IRQ_NOTCONNECTED) return -ENOTCONN; gma_irq_preinstall(dev); /* PCI devices require shared interrupts. */ - ret = request_irq(irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev); + ret = request_irq(pdev->irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev); if (ret) return ret; @@ -369,6 +376,8 @@ spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); free_irq(pdev->irq, dev); + if (dev_priv->use_msi) + pci_disable_msi(pdev); } int gma_crtc_enable_vblank(struct drm_crtc *crtc) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.h linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.h --- linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/gma500/psb_irq.h 2022-11-29 07:06:46.000000000 +0000 @@ -17,7 +17,7 @@ void gma_irq_preinstall(struct drm_device *dev); void gma_irq_postinstall(struct drm_device *dev); -int gma_irq_install(struct drm_device *dev, unsigned int irq); +int gma_irq_install(struct drm_device *dev); void gma_irq_uninstall(struct drm_device *dev); int gma_crtc_enable_vblank(struct drm_crtc *crtc); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/hisilicon/hibmc/Kconfig linux-aws-5.19.0/drivers/gpu/drm/hisilicon/hibmc/Kconfig --- linux-aws-5.19.0/drivers/gpu/drm/hisilicon/hibmc/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/hisilicon/hibmc/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -2,6 +2,7 @@ config DRM_HISI_HIBMC tristate "DRM Support for Hisilicon Hibmc" depends on DRM && PCI && (ARM64 || COMPILE_TEST) + depends on MMU select DRM_KMS_HELPER select DRM_VRAM_HELPER select DRM_TTM diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/icl_dsi.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/icl_dsi.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/icl_dsi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/icl_dsi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1629,6 +1629,8 @@ /* FIXME: initialize from VBT */ vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; + vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay; + ret = intel_dsc_compute_params(crtc_state); if (ret) return ret; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_backlight.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_backlight.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_backlight.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_backlight.c 2022-11-29 07:06:46.000000000 +0000 @@ -15,6 +15,7 @@ #include "intel_dsi_dcs_backlight.h" #include "intel_panel.h" #include "intel_pci_config.h" +#include "intel_pps.h" /** * scale - scale values from one range to another @@ -970,26 +971,24 @@ if (!name) return -ENOMEM; - bd = backlight_device_register(name, connector->base.kdev, connector, - &intel_backlight_device_ops, &props); - - /* - * Using the same name independent of the drm device or connector - * prevents registration of multiple backlight devices in the - * driver. However, we need to use the default name for backward - * compatibility. Use unique names for subsequent backlight devices as a - * fallback when the default name already exists. - */ - if (IS_ERR(bd) && PTR_ERR(bd) == -EEXIST) { + bd = backlight_device_get_by_name(name); + if (bd) { + put_device(&bd->dev); + /* + * Using the same name independent of the drm device or connector + * prevents registration of multiple backlight devices in the + * driver. However, we need to use the default name for backward + * compatibility. Use unique names for subsequent backlight devices as a + * fallback when the default name already exists. + */ kfree(name); name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", i915->drm.primary->index, connector->base.name); if (!name) return -ENOMEM; - - bd = backlight_device_register(name, connector->base.kdev, connector, - &intel_backlight_device_ops, &props); } + bd = backlight_device_register(name, connector->base.kdev, connector, + &intel_backlight_device_ops, &props); if (IS_ERR(bd)) { drm_err(&i915->drm, @@ -1771,9 +1770,13 @@ panel->backlight.pwm_funcs = &i9xx_pwm_funcs; } - if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP && - intel_dp_aux_init_backlight_funcs(connector) == 0) - return; + if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) { + if (intel_dp_aux_init_backlight_funcs(connector) == 0) + return; + + if (!(dev_priv->quirks & QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK)) + connector->panel.backlight.power = intel_pps_backlight_power; + } /* We're using a standard PWM backlight interface */ panel->backlight.funcs = &pwm_bl_funcs; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_bios.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_bios.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_bios.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_bios.c 2022-11-29 07:06:46.000000000 +0000 @@ -123,7 +123,7 @@ * Offset from the start of BDB to the start of the * block data (just past the block header). */ -static u32 block_offset(const void *bdb, enum bdb_block_id section_id) +static u32 raw_block_offset(const void *bdb, enum bdb_block_id section_id) { const void *block; @@ -134,18 +134,6 @@ return block - bdb; } -/* size of the block excluding the header */ -static u32 block_size(const void *bdb, enum bdb_block_id section_id) -{ - const void *block; - - block = find_raw_section(bdb, section_id); - if (!block) - return 0; - - return get_blocksize(block); -} - struct bdb_block_entry { struct list_head node; enum bdb_block_id section_id; @@ -230,9 +218,14 @@ { int fp_timing_size, dvo_timing_size, panel_pnp_id_size, panel_name_size; int data_block_size, lfp_data_size; + const void *data_block; int i; - data_block_size = block_size(bdb, BDB_LVDS_LFP_DATA); + data_block = find_raw_section(bdb, BDB_LVDS_LFP_DATA); + if (!data_block) + return false; + + data_block_size = get_blocksize(data_block); if (data_block_size == 0) return false; @@ -260,21 +253,6 @@ if (16 * lfp_data_size > data_block_size) return false; - /* - * Except for vlv/chv machines all real VBTs seem to have 6 - * unaccounted bytes in the fp_timing table. And it doesn't - * appear to be a really intentional hole as the fp_timing - * 0xffff terminator is always within those 6 missing bytes. - */ - if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size && - fp_timing_size + 6 + dvo_timing_size + panel_pnp_id_size != lfp_data_size) - return false; - - if (ptrs->ptr[0].fp_timing.offset + fp_timing_size > ptrs->ptr[0].dvo_timing.offset || - ptrs->ptr[0].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0].panel_pnp_id.offset || - ptrs->ptr[0].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) - return false; - /* make sure the table entries have uniform size */ for (i = 1; i < 16; i++) { if (ptrs->ptr[i].fp_timing.table_size != fp_timing_size || @@ -288,6 +266,23 @@ return false; } + /* + * Except for vlv/chv machines all real VBTs seem to have 6 + * unaccounted bytes in the fp_timing table. And it doesn't + * appear to be a really intentional hole as the fp_timing + * 0xffff terminator is always within those 6 missing bytes. + */ + if (fp_timing_size + 6 + dvo_timing_size + panel_pnp_id_size == lfp_data_size) + fp_timing_size += 6; + + if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size) + return false; + + if (ptrs->ptr[0].fp_timing.offset + fp_timing_size != ptrs->ptr[0].dvo_timing.offset || + ptrs->ptr[0].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0].panel_pnp_id.offset || + ptrs->ptr[0].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) + return false; + /* make sure the tables fit inside the data block */ for (i = 0; i < 16; i++) { if (ptrs->ptr[i].fp_timing.offset + fp_timing_size > data_block_size || @@ -299,6 +294,15 @@ if (ptrs->panel_name.offset + 16 * panel_name_size > data_block_size) return false; + /* make sure fp_timing terminators are present at expected locations */ + for (i = 0; i < 16; i++) { + const u16 *t = data_block + ptrs->ptr[i].fp_timing.offset + + fp_timing_size - 2; + + if (*t != 0xffff) + return false; + } + return true; } @@ -309,7 +313,7 @@ u32 offset; int i; - offset = block_offset(bdb, BDB_LVDS_LFP_DATA); + offset = raw_block_offset(bdb, BDB_LVDS_LFP_DATA); for (i = 0; i < 16; i++) { if (ptrs->ptr[i].fp_timing.offset < offset || @@ -332,18 +336,6 @@ return validate_lfp_data_ptrs(bdb, ptrs); } -static const void *find_fp_timing_terminator(const u8 *data, int size) -{ - int i; - - for (i = 0; i < size - 1; i++) { - if (data[i] == 0xff && data[i+1] == 0xff) - return &data[i]; - } - - return NULL; -} - static int make_lfp_data_ptr(struct lvds_lfp_data_ptr_table *table, int table_size, int total_size) { @@ -367,11 +359,22 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915, const void *bdb) { - int i, size, table_size, block_size, offset; - const void *t0, *t1, *block; + int i, size, table_size, block_size, offset, fp_timing_size; struct bdb_lvds_lfp_data_ptrs *ptrs; + const void *block; void *ptrs_block; + /* + * The hardcoded fp_timing_size is only valid for + * modernish VBTs. All older VBTs definitely should + * include block 41 and thus we don't need to + * generate one. + */ + if (i915->vbt.version < 155) + return NULL; + + fp_timing_size = 38; + block = find_raw_section(bdb, BDB_LVDS_LFP_DATA); if (!block) return NULL; @@ -380,17 +383,8 @@ block_size = get_blocksize(block); - size = block_size; - t0 = find_fp_timing_terminator(block, size); - if (!t0) - return NULL; - - size -= t0 - block - 2; - t1 = find_fp_timing_terminator(t0 + 2, size); - if (!t1) - return NULL; - - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); if (size * 16 > block_size) return NULL; @@ -408,7 +402,7 @@ table_size = sizeof(struct lvds_dvo_timing); size = make_lfp_data_ptr(&ptrs->ptr[0].dvo_timing, table_size, size); - table_size = t0 - block + 2; + table_size = fp_timing_size; size = make_lfp_data_ptr(&ptrs->ptr[0].fp_timing, table_size, size); if (ptrs->ptr[0].fp_timing.table_size) @@ -423,14 +417,14 @@ return NULL; } - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); for (i = 1; i < 16; i++) { next_lfp_data_ptr(&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1].fp_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1].dvo_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1].panel_pnp_id, size); } - size = t1 - t0; table_size = sizeof(struct lvds_lfp_panel_name); if (16 * (size + table_size) <= block_size) { @@ -478,6 +472,13 @@ block_size = get_blocksize(block); + /* + * Version number and new block size are considered + * part of the header for MIPI sequenece block v3+. + */ + if (section_id == BDB_MIPI_SEQUENCE && *(const u8 *)block >= 3) + block_size += 5; + entry = kzalloc(struct_size(entry, data, max(min_size, block_size) + 3), GFP_KERNEL); if (!entry) { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2022-11-29 07:06:46.000000000 +0000 @@ -278,6 +278,8 @@ { struct drm_i915_private *i915 = to_i915(connector->base.dev); struct intel_panel *panel = &connector->panel; + struct drm_luminance_range_info *luminance_range = + &connector->base.display_info.luminance_range; int ret; if (panel->backlight.edp.intel.sdr_uses_aux) { @@ -293,8 +295,17 @@ } } - panel->backlight.max = 512; - panel->backlight.min = 0; + if (luminance_range->max_luminance) { + panel->backlight.max = luminance_range->max_luminance; + panel->backlight.min = luminance_range->min_luminance; + } else { + panel->backlight.max = 512; + panel->backlight.min = 0; + } + + drm_dbg_kms(&i915->drm, "Using backlight range %d..%d\n", panel->backlight.min, + panel->backlight.max); + panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe); panel->backlight.enabled = panel->backlight.level != 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1353,6 +1353,7 @@ * DP_DSC_RC_BUF_SIZE for this. */ vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; + vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay; /* * Slice Height of 8 works for all currently available panels. So start @@ -5222,8 +5223,6 @@ intel_panel_init(intel_connector); - if (!(dev_priv->quirks & QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK)) - intel_connector->panel.backlight.power = intel_pps_backlight_power; intel_backlight_setup(intel_connector, pipe); intel_edp_add_properties(intel_dp); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_quirks.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_quirks.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_quirks.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_quirks.c 2022-11-29 07:06:46.000000000 +0000 @@ -191,6 +191,9 @@ /* ASRock ITX*/ { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, + /* ECS Liva Q2 */ + { 0x3185, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, + { 0x3184, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, }; void intel_init_quirks(struct drm_i915_private *i915) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_vdsc.c linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_vdsc.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_vdsc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/display/intel_vdsc.c 2022-11-29 07:06:46.000000000 +0000 @@ -460,7 +460,6 @@ u8 i = 0; vdsc_cfg->pic_width = pipe_config->hw.adjusted_mode.crtc_hdisplay; - vdsc_cfg->pic_height = pipe_config->hw.adjusted_mode.crtc_vdisplay; vdsc_cfg->slice_width = DIV_ROUND_UP(vdsc_cfg->pic_width, pipe_config->dsc.slice_count); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_context.c linux-aws-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_context.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_context.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_context.c 2022-11-29 07:06:46.000000000 +0000 @@ -1269,6 +1269,10 @@ trace_i915_context_free(ctx); GEM_BUG_ON(!i915_gem_context_is_closed(ctx)); + spin_lock(&ctx->i915->gem.contexts.lock); + list_del(&ctx->link); + spin_unlock(&ctx->i915->gem.contexts.lock); + if (ctx->syncobj) drm_syncobj_put(ctx->syncobj); @@ -1514,10 +1518,6 @@ ctx->file_priv = ERR_PTR(-EBADF); - spin_lock(&ctx->i915->gem.contexts.lock); - list_del(&ctx->link); - spin_unlock(&ctx->i915->gem.contexts.lock); - client = ctx->client; if (client) { spin_lock(&client->ctx_lock); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen6_ppgtt.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen6_ppgtt.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen6_ppgtt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen6_ppgtt.c 2022-11-29 07:06:46.000000000 +0000 @@ -247,6 +247,7 @@ i915_gem_object_put(vm->scratch[1]); err_scratch0: i915_gem_object_put(vm->scratch[0]); + vm->scratch[0] = NULL; return ret; } @@ -268,9 +269,10 @@ gen6_ppgtt_free_pd(ppgtt); free_scratch(vm); - mutex_destroy(&ppgtt->flush); + if (ppgtt->base.pd) + free_pd(&ppgtt->base.vm, ppgtt->base.pd); - free_pd(&ppgtt->base.vm, ppgtt->base.pd); + mutex_destroy(&ppgtt->flush); } static void pd_vma_bind(struct i915_address_space *vm, @@ -449,19 +451,17 @@ err = gen6_ppgtt_init_scratch(ppgtt); if (err) - goto err_free; + goto err_put; ppgtt->base.pd = gen6_alloc_top_pd(ppgtt); if (IS_ERR(ppgtt->base.pd)) { err = PTR_ERR(ppgtt->base.pd); - goto err_scratch; + goto err_put; } return &ppgtt->base; -err_scratch: - free_scratch(&ppgtt->base.vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->base.vm); return ERR_PTR(err); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen8_ppgtt.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen8_ppgtt.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen8_ppgtt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/gen8_ppgtt.c 2022-11-29 07:06:46.000000000 +0000 @@ -196,7 +196,10 @@ if (intel_vgpu_active(vm->i915)) gen8_ppgtt_notify_vgt(ppgtt, false); - __gen8_ppgtt_cleanup(vm, ppgtt->pd, gen8_pd_top_count(vm), vm->top); + if (ppgtt->pd) + __gen8_ppgtt_cleanup(vm, ppgtt->pd, + gen8_pd_top_count(vm), vm->top); + free_scratch(vm); } @@ -803,8 +806,10 @@ struct drm_i915_gem_object *obj; obj = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K); - if (IS_ERR(obj)) + if (IS_ERR(obj)) { + ret = PTR_ERR(obj); goto free_scratch; + } ret = map_pt_dma(vm, obj); if (ret) { @@ -823,7 +828,8 @@ free_scratch: while (i--) i915_gem_object_put(vm->scratch[i]); - return -ENOMEM; + vm->scratch[0] = NULL; + return ret; } static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt) @@ -901,6 +907,7 @@ struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt, unsigned long lmem_pt_obj_flags) { + struct i915_page_directory *pd; struct i915_ppgtt *ppgtt; int err; @@ -946,21 +953,7 @@ ppgtt->vm.alloc_scratch_dma = alloc_pt_dma; } - err = gen8_init_scratch(&ppgtt->vm); - if (err) - goto err_free; - - ppgtt->pd = gen8_alloc_top_pd(&ppgtt->vm); - if (IS_ERR(ppgtt->pd)) { - err = PTR_ERR(ppgtt->pd); - goto err_free_scratch; - } - - if (!i915_vm_is_4lvl(&ppgtt->vm)) { - err = gen8_preallocate_top_level_pdp(ppgtt); - if (err) - goto err_free_pd; - } + ppgtt->vm.pte_encode = gen8_pte_encode; ppgtt->vm.bind_async_flags = I915_VMA_LOCAL_BIND; ppgtt->vm.insert_entries = gen8_ppgtt_insert; @@ -971,22 +964,31 @@ ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc; ppgtt->vm.clear_range = gen8_ppgtt_clear; ppgtt->vm.foreach = gen8_ppgtt_foreach; + ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - ppgtt->vm.pte_encode = gen8_pte_encode; + err = gen8_init_scratch(&ppgtt->vm); + if (err) + goto err_put; + + pd = gen8_alloc_top_pd(&ppgtt->vm); + if (IS_ERR(pd)) { + err = PTR_ERR(pd); + goto err_put; + } + ppgtt->pd = pd; + + if (!i915_vm_is_4lvl(&ppgtt->vm)) { + err = gen8_preallocate_top_level_pdp(ppgtt); + if (err) + goto err_put; + } if (intel_vgpu_active(gt->i915)) gen8_ppgtt_notify_vgt(ppgtt, true); - ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - return ppgtt; -err_free_pd: - __gen8_ppgtt_cleanup(&ppgtt->vm, ppgtt->pd, - gen8_pd_top_count(&ppgtt->vm), ppgtt->vm.top); -err_free_scratch: - free_scratch(&ppgtt->vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->vm); return ERR_PTR(err); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_engine_types.h linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_engine_types.h --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_engine_types.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_engine_types.h 2022-11-29 07:06:46.000000000 +0000 @@ -156,6 +156,21 @@ struct timer_list preempt; /** + * @preempt_target: active request at the time of the preemption request + * + * We force a preemption to occur if the pending contexts have not + * been promoted to active upon receipt of the CS ack event within + * the timeout. This timeout maybe chosen based on the target, + * using a very short timeout if the context is no longer schedulable. + * That short timeout may not be applicable to other contexts, so + * if a context switch should happen within before the preemption + * timeout, we may shoot early at an innocent context. To prevent this, + * we record which context was active at the time of the preemption + * request and only reset that context upon the timeout. + */ + const struct i915_request *preempt_target; + + /** * @ccid: identifier for contexts submitted to this engine */ u32 ccid; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_execlists_submission.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_execlists_submission.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_execlists_submission.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_execlists_submission.c 2022-11-29 07:06:46.000000000 +0000 @@ -1241,6 +1241,9 @@ if (!rq) return 0; + /* Only allow ourselves to force reset the currently active context */ + engine->execlists.preempt_target = rq; + /* Force a fast reset for terminated contexts (ignoring sysfs!) */ if (unlikely(intel_context_is_banned(rq->context) || bad_request(rq))) return 1; @@ -2427,8 +2430,24 @@ GEM_BUG_ON(inactive - post > ARRAY_SIZE(post)); if (unlikely(preempt_timeout(engine))) { + const struct i915_request *rq = *engine->execlists.active; + + /* + * If after the preempt-timeout expired, we are still on the + * same active request/context as before we initiated the + * preemption, reset the engine. + * + * However, if we have processed a CS event to switch contexts, + * but not yet processed the CS event for the pending + * preemption, reset the timer allowing the new context to + * gracefully exit. + */ cancel_timer(&engine->execlists.preempt); - engine->execlists.error_interrupt |= ERROR_PREEMPT; + if (rq == engine->execlists.preempt_target) + engine->execlists.error_interrupt |= ERROR_PREEMPT; + else + set_timer_ms(&engine->execlists.preempt, + active_preempt_timeout(engine, rq)); } if (unlikely(READ_ONCE(engine->execlists.error_interrupt))) { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 2022-11-29 07:06:46.000000000 +0000 @@ -544,8 +544,7 @@ static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_thermalert, VR_THERMALERT_MASK); static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_tdc, VR_TDC_MASK); -static const struct attribute *freq_attrs[] = { - &dev_attr_punit_req_freq_mhz.attr, +static const struct attribute *throttle_reason_attrs[] = { &attr_throttle_reason_status.attr, &attr_throttle_reason_pl1.attr, &attr_throttle_reason_pl2.attr, @@ -594,9 +593,17 @@ if (!is_object_gt(kobj)) return; - ret = sysfs_create_files(kobj, freq_attrs); + ret = sysfs_create_file(kobj, &dev_attr_punit_req_freq_mhz.attr); if (ret) drm_warn(>->i915->drm, - "failed to create gt%u throttle sysfs files (%pe)", + "failed to create gt%u punit_req_freq_mhz sysfs (%pe)", gt->info.id, ERR_PTR(ret)); + + if (GRAPHICS_VER(gt->i915) >= 11) { + ret = sysfs_create_files(kobj, throttle_reason_attrs); + if (ret) + drm_warn(>->i915->drm, + "failed to create gt%u throttle sysfs files (%pe)", + gt->info.id, ERR_PTR(ret)); + } } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gtt.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gtt.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gtt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_gtt.c 2022-11-29 07:06:46.000000000 +0000 @@ -405,6 +405,9 @@ { int i; + if (!vm->scratch[0]) + return; + for (i = 0; i <= vm->top; i++) i915_gem_object_put(vm->scratch[i]); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_llc.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_llc.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_llc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_llc.c 2022-11-29 07:06:46.000000000 +0000 @@ -12,6 +12,7 @@ #include "intel_llc.h" #include "intel_mchbar_regs.h" #include "intel_pcode.h" +#include "intel_rps.h" struct ia_constants { unsigned int min_gpu_freq; @@ -55,9 +56,6 @@ if (!HAS_LLC(i915) || IS_DGFX(i915)) return false; - if (rps->max_freq <= rps->min_freq) - return false; - consts->max_ia_freq = cpu_max_MHz(); consts->min_ring_freq = @@ -65,13 +63,8 @@ /* convert DDR frequency from units of 266.6MHz to bandwidth */ consts->min_ring_freq = mult_frac(consts->min_ring_freq, 8, 3); - consts->min_gpu_freq = rps->min_freq; - consts->max_gpu_freq = rps->max_freq; - if (GRAPHICS_VER(i915) >= 9) { - /* Convert GT frequency to 50 HZ units */ - consts->min_gpu_freq /= GEN9_FREQ_SCALER; - consts->max_gpu_freq /= GEN9_FREQ_SCALER; - } + consts->min_gpu_freq = intel_rps_get_min_raw_freq(rps); + consts->max_gpu_freq = intel_rps_get_max_raw_freq(rps); return true; } @@ -132,6 +125,12 @@ return; /* + * Although this is unlikely on any platform during initialization, + * let's ensure we don't get accidentally into infinite loop + */ + if (consts.max_gpu_freq <= consts.min_gpu_freq) + return; + /* * For each potential GPU frequency, load a ring frequency we'd like * to use for memory access. We do this by specifying the IA frequency * the PCU should use as a reference to determine the ring frequency. diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_migrate.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_migrate.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_migrate.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_migrate.c 2022-11-29 07:06:46.000000000 +0000 @@ -638,9 +638,9 @@ return 0; } -static int scatter_list_length(struct scatterlist *sg) +static u64 scatter_list_length(struct scatterlist *sg) { - int len = 0; + u64 len = 0; while (sg && sg_dma_len(sg)) { len += sg_dma_len(sg); @@ -650,28 +650,26 @@ return len; } -static void +static int calculate_chunk_sz(struct drm_i915_private *i915, bool src_is_lmem, - int *src_sz, u32 bytes_to_cpy, u32 ccs_bytes_to_cpy) + u64 bytes_to_cpy, u64 ccs_bytes_to_cpy) { - if (ccs_bytes_to_cpy) { - if (!src_is_lmem) - /* - * When CHUNK_SZ is passed all the pages upto CHUNK_SZ - * will be taken for the blt. in Flat-ccs supported - * platform Smem obj will have more pages than required - * for main meory hence limit it to the required size - * for main memory - */ - *src_sz = min_t(int, bytes_to_cpy, CHUNK_SZ); - } else { /* ccs handling is not required */ - *src_sz = CHUNK_SZ; - } + if (ccs_bytes_to_cpy && !src_is_lmem) + /* + * When CHUNK_SZ is passed all the pages upto CHUNK_SZ + * will be taken for the blt. in Flat-ccs supported + * platform Smem obj will have more pages than required + * for main meory hence limit it to the required size + * for main memory + */ + return min_t(u64, bytes_to_cpy, CHUNK_SZ); + else + return CHUNK_SZ; } -static void get_ccs_sg_sgt(struct sgt_dma *it, u32 bytes_to_cpy) +static void get_ccs_sg_sgt(struct sgt_dma *it, u64 bytes_to_cpy) { - u32 len; + u64 len; do { GEM_BUG_ON(!it->sg || !sg_dma_len(it->sg)); @@ -702,12 +700,12 @@ { struct sgt_dma it_src = sg_sgt(src), it_dst = sg_sgt(dst), it_ccs; struct drm_i915_private *i915 = ce->engine->i915; - u32 ccs_bytes_to_cpy = 0, bytes_to_cpy; + u64 ccs_bytes_to_cpy = 0, bytes_to_cpy; enum i915_cache_level ccs_cache_level; u32 src_offset, dst_offset; u8 src_access, dst_access; struct i915_request *rq; - int src_sz, dst_sz; + u64 src_sz, dst_sz; bool ccs_is_src, overwrite_ccs; int err; @@ -790,8 +788,8 @@ if (err) goto out_rq; - calculate_chunk_sz(i915, src_is_lmem, &src_sz, - bytes_to_cpy, ccs_bytes_to_cpy); + src_sz = calculate_chunk_sz(i915, src_is_lmem, + bytes_to_cpy, ccs_bytes_to_cpy); len = emit_pte(rq, &it_src, src_cache_level, src_is_lmem, src_offset, src_sz); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.c 2022-11-29 07:06:46.000000000 +0000 @@ -2123,6 +2123,31 @@ return intel_gpu_freq(rps, rps->max_freq_softlimit); } +/** + * intel_rps_get_max_raw_freq - returns the max frequency in some raw format. + * @rps: the intel_rps structure + * + * Returns the max frequency in a raw format. In newer platforms raw is in + * units of 50 MHz. + */ +u32 intel_rps_get_max_raw_freq(struct intel_rps *rps) +{ + struct intel_guc_slpc *slpc = rps_to_slpc(rps); + u32 freq; + + if (rps_uses_slpc(rps)) { + return DIV_ROUND_CLOSEST(slpc->rp0_freq, + GT_FREQUENCY_MULTIPLIER); + } else { + freq = rps->max_freq; + if (GRAPHICS_VER(rps_to_i915(rps)) >= 9) { + /* Convert GT frequency to 50 MHz units */ + freq /= GEN9_FREQ_SCALER; + } + return freq; + } +} + u32 intel_rps_get_rp0_frequency(struct intel_rps *rps) { struct intel_guc_slpc *slpc = rps_to_slpc(rps); @@ -2211,6 +2236,31 @@ return intel_gpu_freq(rps, rps->min_freq_softlimit); } +/** + * intel_rps_get_min_raw_freq - returns the min frequency in some raw format. + * @rps: the intel_rps structure + * + * Returns the min frequency in a raw format. In newer platforms raw is in + * units of 50 MHz. + */ +u32 intel_rps_get_min_raw_freq(struct intel_rps *rps) +{ + struct intel_guc_slpc *slpc = rps_to_slpc(rps); + u32 freq; + + if (rps_uses_slpc(rps)) { + return DIV_ROUND_CLOSEST(slpc->min_freq, + GT_FREQUENCY_MULTIPLIER); + } else { + freq = rps->min_freq; + if (GRAPHICS_VER(rps_to_i915(rps)) >= 9) { + /* Convert GT frequency to 50 MHz units */ + freq /= GEN9_FREQ_SCALER; + } + return freq; + } +} + static int set_min_freq(struct intel_rps *rps, u32 val) { int ret = 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.h linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.h --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/intel_rps.h 2022-11-29 07:06:46.000000000 +0000 @@ -37,8 +37,10 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps); u32 intel_rps_get_requested_frequency(struct intel_rps *rps); u32 intel_rps_get_min_frequency(struct intel_rps *rps); +u32 intel_rps_get_min_raw_freq(struct intel_rps *rps); int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val); u32 intel_rps_get_max_frequency(struct intel_rps *rps); +u32 intel_rps_get_max_raw_freq(struct intel_rps *rps); int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val); u32 intel_rps_get_rp0_frequency(struct intel_rps *rps); u32 intel_rps_get_rp1_frequency(struct intel_rps *rps); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc.h linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc.h --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc.h 2022-11-29 07:06:46.000000000 +0000 @@ -235,6 +235,14 @@ * @shift: Right shift value for the gpm timestamp */ u32 shift; + + /** + * @last_stat_jiffies: jiffies at last actual stats collection time + * We use this timestamp to ensure we don't oversample the + * stats because runtime power management events can trigger + * stats collection at much higher rates than required. + */ + unsigned long last_stat_jiffies; } timestamp; #ifdef CONFIG_DRM_I915_SELFTEST diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 2022-11-29 07:06:46.000000000 +0000 @@ -1365,6 +1365,8 @@ unsigned long flags; ktime_t unused; + guc->timestamp.last_stat_jiffies = jiffies; + spin_lock_irqsave(&guc->timestamp.lock, flags); guc_update_pm_timestamp(guc, &unused); @@ -1436,7 +1438,23 @@ if (!guc_submission_initialized(guc)) return; - cancel_delayed_work(&guc->timestamp.work); + /* + * There is a race with suspend flow where the worker runs after suspend + * and causes an unclaimed register access warning. Cancel the worker + * synchronously here. + */ + cancel_delayed_work_sync(&guc->timestamp.work); + + /* + * Before parking, we should sample engine busyness stats if we need to. + * We can skip it if we are less than half a ping from the last time we + * sampled the busyness stats. + */ + if (guc->timestamp.last_stat_jiffies && + !time_after(jiffies, guc->timestamp.last_stat_jiffies + + (guc->timestamp.ping_delay / 2))) + return; + __update_guc_busyness_stats(guc); } @@ -4011,6 +4029,13 @@ xa_destroy(&guc->context_lookup); /* + * A reset might have occurred while we had a pending stalled request, + * so make sure we clean that up. + */ + guc->stalled_request = NULL; + guc->submission_stall_reason = STALL_NONE; + + /* * Some contexts might have been pinned before we enabled GuC * submission, so we need to add them to the GuC bookeeping. * Also, after a reset the of the GuC we want to make sure that the diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/gvt/handlers.c linux-aws-5.19.0/drivers/gpu/drm/i915/gvt/handlers.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/gvt/handlers.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/gvt/handlers.c 2022-11-29 07:06:46.000000000 +0000 @@ -905,7 +905,7 @@ else if (FDI_RX_IMR_TO_PIPE(offset) != INVALID_INDEX) index = FDI_RX_IMR_TO_PIPE(offset); else { - gvt_vgpu_err("Unsupport registers %x\n", offset); + gvt_vgpu_err("Unsupported registers %x\n", offset); return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/i915_gem.c linux-aws-5.19.0/drivers/gpu/drm/i915/i915_gem.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/i915_gem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/i915_gem.c 2022-11-29 07:06:46.000000000 +0000 @@ -1191,7 +1191,8 @@ intel_uc_cleanup_firmwares(&to_gt(dev_priv)->uc); - i915_gem_drain_freed_objects(dev_priv); + /* Flush any outstanding work, including i915_gem_context.release_work. */ + i915_gem_drain_workqueue(dev_priv); drm_WARN_ON(&dev_priv->drm, !list_empty(&dev_priv->gem.contexts.list)); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/i915_reg.h linux-aws-5.19.0/drivers/gpu/drm/i915/i915_reg.h --- linux-aws-5.19.0/drivers/gpu/drm/i915/i915_reg.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/i915_reg.h 2022-11-29 07:06:46.000000000 +0000 @@ -1849,14 +1849,14 @@ #define GT0_PERF_LIMIT_REASONS _MMIO(0x1381a8) #define GT0_PERF_LIMIT_REASONS_MASK 0xde3 -#define PROCHOT_MASK REG_BIT(1) -#define THERMAL_LIMIT_MASK REG_BIT(2) -#define RATL_MASK REG_BIT(6) -#define VR_THERMALERT_MASK REG_BIT(7) -#define VR_TDC_MASK REG_BIT(8) -#define POWER_LIMIT_4_MASK REG_BIT(9) -#define POWER_LIMIT_1_MASK REG_BIT(11) -#define POWER_LIMIT_2_MASK REG_BIT(12) +#define PROCHOT_MASK REG_BIT(0) +#define THERMAL_LIMIT_MASK REG_BIT(1) +#define RATL_MASK REG_BIT(5) +#define VR_THERMALERT_MASK REG_BIT(6) +#define VR_TDC_MASK REG_BIT(7) +#define POWER_LIMIT_4_MASK REG_BIT(8) +#define POWER_LIMIT_1_MASK REG_BIT(10) +#define POWER_LIMIT_2_MASK REG_BIT(11) #define CHV_CLK_CTL1 _MMIO(0x101100) #define VLV_CLK_CTL2 _MMIO(0x101104) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/i915_vma.c linux-aws-5.19.0/drivers/gpu/drm/i915/i915_vma.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/i915_vma.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/i915_vma.c 2022-11-29 07:06:46.000000000 +0000 @@ -1870,12 +1870,13 @@ enum dma_resv_usage usage; int idx; - obj->read_domains = 0; if (flags & EXEC_OBJECT_WRITE) { usage = DMA_RESV_USAGE_WRITE; obj->write_domain = I915_GEM_DOMAIN_RENDER; + obj->read_domains = 0; } else { usage = DMA_RESV_USAGE_READ; + obj->write_domain = 0; } dma_fence_array_for_each(curr, idx, fence) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/intel_gvt_mmio_table.c linux-aws-5.19.0/drivers/gpu/drm/i915/intel_gvt_mmio_table.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/intel_gvt_mmio_table.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/intel_gvt_mmio_table.c 2022-11-29 07:06:46.000000000 +0000 @@ -1074,7 +1074,8 @@ MMIO_D(GEN8_HDC_CHICKEN1); MMIO_D(GEN9_WM_CHICKEN3); - if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) + if (IS_KABYLAKE(dev_priv) || + IS_COFFEELAKE(dev_priv) || IS_COMETLAKE(dev_priv)) MMIO_D(GAMT_CHKN_BIT_REG); if (!IS_BROXTON(dev_priv)) MMIO_D(GEN9_CTX_PREEMPT_REG); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/i915/intel_pm.c linux-aws-5.19.0/drivers/gpu/drm/i915/intel_pm.c --- linux-aws-5.19.0/drivers/gpu/drm/i915/intel_pm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/i915/intel_pm.c 2022-11-29 07:06:46.000000000 +0000 @@ -5307,10 +5307,22 @@ modifier == I915_FORMAT_MOD_4_TILED || modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; @@ -6560,7 +6572,10 @@ enum plane_id plane_id; u8 slices; - skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); + memset(&crtc_state->wm.skl.optimal, 0, + sizeof(crtc_state->wm.skl.optimal)); + if (crtc_state->hw.active) + skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); crtc_state->wm.skl.raw = crtc_state->wm.skl.optimal; memset(&dbuf_state->ddb[pipe], 0, sizeof(dbuf_state->ddb[pipe])); @@ -6571,6 +6586,9 @@ struct skl_ddb_entry *ddb_y = &crtc_state->wm.skl.plane_ddb_y[plane_id]; + if (!crtc_state->hw.active) + continue; + skl_ddb_get_hw_plane_state(dev_priv, crtc->pipe, plane_id, ddb, ddb_y); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c --- linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 2022-11-29 07:06:46.000000000 +0000 @@ -151,7 +151,7 @@ { struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev); - mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE); + mtk_ddp_write(cmdq_pkt, w << 16 | h, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE); mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_CFG); mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, DISP_REG_DITHER_CFG, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_dsi.c linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_dsi.c --- linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_dsi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/mediatek/mtk_dsi.c 2022-11-29 07:06:46.000000000 +0000 @@ -685,6 +685,16 @@ if (--dsi->refcount != 0) return; + /* + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), + * after dsi is fully set. + */ + mtk_dsi_stop(dsi); + + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); @@ -735,17 +745,6 @@ if (!dsi->enabled) return; - /* - * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since - * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), - * which needs irq for vblank, and mtk_dsi_stop() will disable irq. - * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), - * after dsi is fully set. - */ - mtk_dsi_stop(dsi); - - mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); - dsi->enabled = false; } @@ -808,10 +807,13 @@ static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_disable = mtk_dsi_bridge_atomic_disable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_enable = mtk_dsi_bridge_atomic_enable, .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable, .atomic_post_disable = mtk_dsi_bridge_atomic_post_disable, + .atomic_reset = drm_atomic_helper_bridge_reset, .mode_set = mtk_dsi_bridge_mode_set, }; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.c linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.c --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -388,10 +388,14 @@ drm_dev_unregister(drm); drm_kms_helper_poll_fini(drm); drm_atomic_helper_shutdown(drm); - component_unbind_all(dev, drm); free_irq(priv->vsync_irq, drm); drm_dev_put(drm); + meson_encoder_hdmi_remove(priv); + meson_encoder_cvbs_remove(priv); + + component_unbind_all(dev, drm); + if (priv->afbcd.ops) priv->afbcd.ops->exit(priv); } @@ -493,6 +497,13 @@ return 0; }; +static int meson_drv_remove(struct platform_device *pdev) +{ + component_master_del(&pdev->dev, &meson_drv_master_ops); + + return 0; +} + static struct meson_drm_match_data meson_drm_gxbb_data = { .compat = VPU_COMPATIBLE_GXBB, }; @@ -530,6 +541,7 @@ static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name = "meson-drm", diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.h linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.h --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_drv.h 2022-11-29 07:06:46.000000000 +0000 @@ -25,6 +25,12 @@ VPU_COMPATIBLE_G12A = 3, }; +enum { + MESON_ENC_CVBS = 0, + MESON_ENC_HDMI, + MESON_ENC_LAST, +}; + struct meson_drm_match_data { enum vpu_compatible compat; struct meson_afbcd_ops *afbcd_ops; @@ -51,6 +57,7 @@ struct drm_crtc *crtc; struct drm_plane *primary_plane; struct drm_plane *overlay_plane; + void *encoders[MESON_ENC_LAST]; const struct meson_drm_soc_limits *limits; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.c linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.c --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.c 2022-11-29 07:06:46.000000000 +0000 @@ -281,5 +281,18 @@ } drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); + priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; + return 0; } + +void meson_encoder_cvbs_remove(struct meson_drm *priv) +{ + struct meson_encoder_cvbs *meson_encoder_cvbs; + + if (priv->encoders[MESON_ENC_CVBS]) { + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; + drm_bridge_remove(&meson_encoder_cvbs->bridge); + drm_bridge_remove(meson_encoder_cvbs->next_bridge); + } +} diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.h linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.h --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_cvbs.h 2022-11-29 07:06:46.000000000 +0000 @@ -25,5 +25,6 @@ extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT]; int meson_encoder_cvbs_init(struct meson_drm *priv); +void meson_encoder_cvbs_remove(struct meson_drm *priv); #endif /* __MESON_VENC_CVBS_H */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.c linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.c --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -446,6 +446,8 @@ meson_encoder_hdmi->cec_notifier = notifier; } + priv->encoders[MESON_ENC_HDMI] = meson_encoder_hdmi; + dev_dbg(priv->dev, "HDMI encoder initialized\n"); return 0; @@ -454,3 +456,14 @@ of_node_put(remote); return ret; } + +void meson_encoder_hdmi_remove(struct meson_drm *priv) +{ + struct meson_encoder_hdmi *meson_encoder_hdmi; + + if (priv->encoders[MESON_ENC_HDMI]) { + meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI]; + drm_bridge_remove(&meson_encoder_hdmi->bridge); + drm_bridge_remove(meson_encoder_hdmi->next_bridge); + } +} diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.h linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.h --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_encoder_hdmi.h 2022-11-29 07:06:46.000000000 +0000 @@ -8,5 +8,6 @@ #define __MESON_ENCODER_HDMI_H int meson_encoder_hdmi_init(struct meson_drm *priv); +void meson_encoder_hdmi_remove(struct meson_drm *priv); #endif /* __MESON_ENCODER_HDMI_H */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_plane.c linux-aws-5.19.0/drivers/gpu/drm/meson/meson_plane.c --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_plane.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_plane.c 2022-11-29 07:06:46.000000000 +0000 @@ -168,7 +168,7 @@ /* Enable OSD and BLK0, set max global alpha */ priv->viu.osd1_ctrl_stat = OSD_ENABLE | - (0xFF << OSD_GLOBAL_ALPHA_SHIFT) | + (0x100 << OSD_GLOBAL_ALPHA_SHIFT) | OSD_BLK0_ENABLE; priv->viu.osd1_ctrl_stat2 = readl(priv->io_base + diff -Nru linux-aws-5.19.0/drivers/gpu/drm/meson/meson_viu.c linux-aws-5.19.0/drivers/gpu/drm/meson/meson_viu.c --- linux-aws-5.19.0/drivers/gpu/drm/meson/meson_viu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/meson/meson_viu.c 2022-11-29 07:06:46.000000000 +0000 @@ -94,7 +94,7 @@ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12)); writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff), priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21)); - writel((m[11] & 0x1fff) << 16, + writel((m[11] & 0x1fff), priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22)); writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff), diff -Nru linux-aws-5.19.0/drivers/gpu/drm/mgag200/mgag200_mode.c linux-aws-5.19.0/drivers/gpu/drm/mgag200/mgag200_mode.c --- linux-aws-5.19.0/drivers/gpu/drm/mgag200/mgag200_mode.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/mgag200/mgag200_mode.c 2022-11-29 07:06:46.000000000 +0000 @@ -32,57 +32,78 @@ * This file contains setup code for the CRTC. */ -static void mga_crtc_load_lut(struct drm_crtc *crtc) +static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, + const struct drm_format_info *format) { - struct drm_device *dev = crtc->dev; - struct mga_device *mdev = to_mga_device(dev); - struct drm_framebuffer *fb; - u16 *r_ptr, *g_ptr, *b_ptr; int i; - if (!crtc->enabled) - return; - - if (!mdev->display_pipe.plane.state) - return; + WREG8(DAC_INDEX + MGA1064_INDEX, 0); - fb = mdev->display_pipe.plane.state->fb; + switch (format->format) { + case DRM_FORMAT_RGB565: + /* Use better interpolation, to take 32 values from 0 to 255 */ + for (i = 0; i < MGAG200_LUT_SIZE / 8; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, i * 8 + i / 4); + WREG8(DAC_INDEX + MGA1064_COL_PAL, i * 4 + i / 16); + WREG8(DAC_INDEX + MGA1064_COL_PAL, i * 8 + i / 4); + } + /* Green has one more bit, so add padding with 0 for red and blue. */ + for (i = MGAG200_LUT_SIZE / 8; i < MGAG200_LUT_SIZE / 4; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, 0); + WREG8(DAC_INDEX + MGA1064_COL_PAL, i * 4 + i / 16); + WREG8(DAC_INDEX + MGA1064_COL_PAL, 0); + } + break; + case DRM_FORMAT_RGB888: + case DRM_FORMAT_XRGB8888: + for (i = 0; i < MGAG200_LUT_SIZE; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, i); + WREG8(DAC_INDEX + MGA1064_COL_PAL, i); + WREG8(DAC_INDEX + MGA1064_COL_PAL, i); + } + break; + default: + drm_warn_once(&mdev->base, "Unsupported format %p4cc for gamma correction\n", + &format->format); + break; + } +} - r_ptr = crtc->gamma_store; - g_ptr = r_ptr + crtc->gamma_size; - b_ptr = g_ptr + crtc->gamma_size; +static void mgag200_crtc_set_gamma(struct mga_device *mdev, + const struct drm_format_info *format, + struct drm_color_lut *lut) +{ + int i; WREG8(DAC_INDEX + MGA1064_INDEX, 0); - if (fb && fb->format->cpp[0] * 8 == 16) { - int inc = (fb->format->depth == 15) ? 8 : 4; - u8 r, b; - for (i = 0; i < MGAG200_LUT_SIZE; i += inc) { - if (fb->format->depth == 16) { - if (i > (MGAG200_LUT_SIZE >> 1)) { - r = b = 0; - } else { - r = *r_ptr++ >> 8; - b = *b_ptr++ >> 8; - r_ptr++; - b_ptr++; - } - } else { - r = *r_ptr++ >> 8; - b = *b_ptr++ >> 8; - } - /* VGA registers */ - WREG8(DAC_INDEX + MGA1064_COL_PAL, r); - WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8); - WREG8(DAC_INDEX + MGA1064_COL_PAL, b); + switch (format->format) { + case DRM_FORMAT_RGB565: + /* Use better interpolation, to take 32 values from lut[0] to lut[255] */ + for (i = 0; i < MGAG200_LUT_SIZE / 8; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i * 8 + i / 4].red >> 8); + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i * 4 + i / 16].green >> 8); + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i * 8 + i / 4].blue >> 8); } - return; - } - for (i = 0; i < MGAG200_LUT_SIZE; i++) { - /* VGA registers */ - WREG8(DAC_INDEX + MGA1064_COL_PAL, *r_ptr++ >> 8); - WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8); - WREG8(DAC_INDEX + MGA1064_COL_PAL, *b_ptr++ >> 8); + /* Green has one more bit, so add padding with 0 for red and blue. */ + for (i = MGAG200_LUT_SIZE / 8; i < MGAG200_LUT_SIZE / 4; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, 0); + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i * 4 + i / 16].green >> 8); + WREG8(DAC_INDEX + MGA1064_COL_PAL, 0); + } + break; + case DRM_FORMAT_RGB888: + case DRM_FORMAT_XRGB8888: + for (i = 0; i < MGAG200_LUT_SIZE; i++) { + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i].red >> 8); + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i].green >> 8); + WREG8(DAC_INDEX + MGA1064_COL_PAL, lut[i].blue >> 8); + } + break; + default: + drm_warn_once(&mdev->base, "Unsupported format %p4cc for gamma correction\n", + &format->format); + break; } } @@ -865,10 +886,6 @@ dst += drm_fb_clip_offset(fb->pitches[0], fb->format, clip); drm_fb_memcpy_toio(dst, fb->pitches[0], vmap, fb, clip); - - /* Always scanout image at VRAM offset 0 */ - mgag200_set_startadd(mdev, (u32)0); - mgag200_set_offset(mdev, fb); } static void @@ -918,11 +935,19 @@ if (mdev->type == G200_WB || mdev->type == G200_EW3) mgag200_g200wb_release_bmc(mdev); - mga_crtc_load_lut(crtc); + if (crtc_state->gamma_lut) + mgag200_crtc_set_gamma(mdev, fb->format, crtc_state->gamma_lut->data); + else + mgag200_crtc_set_gamma_linear(mdev, fb->format); + mgag200_enable_display(mdev); mgag200_handle_damage(mdev, fb, &fullscreen, &shadow_plane_state->data[0]); + /* Always scanout image at VRAM offset 0 */ + mgag200_set_startadd(mdev, (u32)0); + mgag200_set_offset(mdev, fb); + mutex_unlock(&mdev->rmmio_lock); } @@ -965,6 +990,14 @@ return ret; } + if (crtc_state->color_mgmt_changed && crtc_state->gamma_lut) { + if (crtc_state->gamma_lut->length != + MGAG200_LUT_SIZE * sizeof(struct drm_color_lut)) { + drm_err(dev, "Wrong size for gamma_lut %zu\n", + crtc_state->gamma_lut->length); + return -EINVAL; + } + } return 0; } @@ -973,20 +1006,30 @@ struct drm_plane_state *old_state) { struct drm_plane *plane = &pipe->plane; + struct drm_crtc *crtc = &pipe->crtc; struct drm_device *dev = plane->dev; struct mga_device *mdev = to_mga_device(dev); struct drm_plane_state *state = plane->state; struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state); struct drm_framebuffer *fb = state->fb; struct drm_rect damage; + struct drm_atomic_helper_damage_iter iter; if (!fb) return; mutex_lock(&mdev->rmmio_lock); - if (drm_atomic_helper_damage_merged(old_state, state, &damage)) + if (crtc->state->color_mgmt_changed && crtc->state->gamma_lut) + mgag200_crtc_set_gamma(mdev, fb->format, crtc->state->gamma_lut->data); + + drm_atomic_helper_damage_iter_init(&iter, old_state, state); + drm_atomic_for_each_plane_damage(&iter, &damage) { mgag200_handle_damage(mdev, fb, &damage, &shadow_plane_state->data[0]); + } + /* Always scanout image at VRAM offset 0 */ + mgag200_set_startadd(mdev, (u32)0); + mgag200_set_offset(mdev, fb); mutex_unlock(&mdev->rmmio_lock); } @@ -1131,9 +1174,13 @@ return ret; } - /* FIXME: legacy gamma tables; convert to CRTC state */ + drm_plane_enable_fb_damage_clips(&pipe->plane); + + /* FIXME: legacy gamma tables, but atomic gamma doesn't work without */ drm_mode_crtc_set_gamma_size(&pipe->crtc, MGAG200_LUT_SIZE); + drm_crtc_enable_color_mgmt(&pipe->crtc, 0, false, MGAG200_LUT_SIZE); + drm_mode_config_reset(dev); return 0; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 2022-11-29 07:06:46.000000000 +0000 @@ -1998,6 +1998,12 @@ intf_cfg.stream_sel = 0; /* Don't care value for video mode */ intf_cfg.mode_3d = dpu_encoder_helper_get_3d_blend_mode(phys_enc); + + if (phys_enc->hw_intf) + intf_cfg.intf = phys_enc->hw_intf->idx; + if (phys_enc->hw_wb) + intf_cfg.wb = phys_enc->hw_wb->idx; + if (phys_enc->hw_pp->merge_3d) intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->idx; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 2022-11-29 07:06:46.000000000 +0000 @@ -383,12 +383,9 @@ struct icc_path *path1; struct drm_device *dev = dpu_kms->dev; struct device *dpu_dev = dev->dev; - struct device *mdss_dev = dpu_dev->parent; - /* Interconnects are a part of MDSS device tree binding, not the - * MDP/DPU device. */ - path0 = of_icc_get(mdss_dev, "mdp0-mem"); - path1 = of_icc_get(mdss_dev, "mdp1-mem"); + path0 = msm_icc_get(dpu_dev, "mdp0-mem"); + path1 = msm_icc_get(dpu_dev, "mdp1-mem"); if (IS_ERR_OR_NULL(path0)) return PTR_ERR_OR_ZERO(path0); @@ -828,12 +825,10 @@ _dpu_kms_mmu_destroy(dpu_kms); if (dpu_kms->catalog) { - for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { - u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - - if ((vbif_idx < VBIF_MAX) && dpu_kms->hw_vbif[vbif_idx]) { - dpu_hw_vbif_destroy(dpu_kms->hw_vbif[vbif_idx]); - dpu_kms->hw_vbif[vbif_idx] = NULL; + for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { + if (dpu_kms->hw_vbif[i]) { + dpu_hw_vbif_destroy(dpu_kms->hw_vbif[i]); + dpu_kms->hw_vbif[i] = NULL; } } } @@ -1135,7 +1130,7 @@ for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - dpu_kms->hw_vbif[i] = dpu_hw_vbif_init(vbif_idx, + dpu_kms->hw_vbif[vbif_idx] = dpu_hw_vbif_init(vbif_idx, dpu_kms->vbif[vbif_idx], dpu_kms->catalog); if (IS_ERR_OR_NULL(dpu_kms->hw_vbif[vbif_idx])) { rc = PTR_ERR(dpu_kms->hw_vbif[vbif_idx]); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c 2022-11-29 07:06:46.000000000 +0000 @@ -11,6 +11,14 @@ #include "dpu_hw_vbif.h" #include "dpu_trace.h" +static struct dpu_hw_vbif *dpu_get_vbif(struct dpu_kms *dpu_kms, enum dpu_vbif vbif_idx) +{ + if (vbif_idx < ARRAY_SIZE(dpu_kms->hw_vbif)) + return dpu_kms->hw_vbif[vbif_idx]; + + return NULL; +} + /** * _dpu_vbif_wait_for_xin_halt - wait for the xin to halt * @vbif: Pointer to hardware vbif driver @@ -148,20 +156,15 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, struct dpu_vbif_set_ot_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; u32 ot_lim; - int ret, i; + int ret; mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !mdp) { DRM_DEBUG_ATOMIC("invalid arguments vbif %d mdp %d\n", vbif != NULL, mdp != NULL); @@ -204,7 +207,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, struct dpu_vbif_set_qos_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; const struct dpu_vbif_qos_tbl *qos_tbl; @@ -216,13 +219,7 @@ } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; - break; - } - } + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !vbif->cap) { DPU_ERROR("invalid vbif %d\n", params->vbif_idx); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c linux-aws-5.19.0/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 2022-11-29 07:06:46.000000000 +0000 @@ -921,12 +921,9 @@ static int mdp5_setup_interconnect(struct platform_device *pdev) { - /* Interconnects are a part of MDSS device tree binding, not the - * MDP5 device. */ - struct device *mdss_dev = pdev->dev.parent; - struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem"); - struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem"); - struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem"); + struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem"); + struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem"); + struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem"); if (IS_ERR(path0)) return PTR_ERR(path0); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_catalog.c linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_catalog.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_catalog.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_catalog.c 2022-11-29 07:06:46.000000000 +0000 @@ -431,7 +431,7 @@ if (rate == link_rate_hbr3) pixel_div = 6; - else if (rate == 1620000 || rate == 270000) + else if (rate == 162000 || rate == 270000) pixel_div = 2; else if (rate == link_rate_hbr2) pixel_div = 4; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c 2022-11-29 07:06:46.000000000 +0000 @@ -1214,7 +1214,7 @@ if (ret) return ret; - dp_ctrl_train_pattern_set(ctrl, pattern | DP_RECOVERED_CLOCK_OUT_EN); + dp_ctrl_train_pattern_set(ctrl, pattern); for (tries = 0; tries <= maximum_retries; tries++) { drm_dp_link_train_channel_eq_delay(ctrl->aux, ctrl->panel->dpcd); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/dsi_cfg.c linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/dsi_cfg.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/dsi_cfg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/dsi_cfg.c 2022-11-29 07:06:46.000000000 +0000 @@ -109,7 +109,7 @@ static const struct msm_dsi_config msm8996_dsi_cfg = { .io_offset = DSI_6G_REG_SHIFT, .reg_cfg = { - .num = 2, + .num = 3, .regs = { {"vdda", 18160, 1 }, /* 1.25 V */ {"vcca", 17000, 32 }, /* 0.925 V */ @@ -148,7 +148,7 @@ static const struct msm_dsi_config sdm660_dsi_cfg = { .io_offset = DSI_6G_REG_SHIFT, .reg_cfg = { - .num = 2, + .num = 1, .regs = { {"vdda", 12560, 4 }, /* 1.2 V */ }, diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 2022-11-29 07:06:46.000000000 +0000 @@ -347,7 +347,7 @@ } else { timing->shared_timings.clk_pre = linear_inter(tmax, tmin, pcnt2, 0, false); - timing->shared_timings.clk_pre_inc_by_2 = 0; + timing->shared_timings.clk_pre_inc_by_2 = 0; } timing->ta_go = 3; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.c linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -424,6 +424,8 @@ } } + drm_helper_move_panel_connectors_to_head(ddev); + ddev->mode_config.funcs = &mode_config_funcs; ddev->mode_config.helper_private = &mode_config_helper_funcs; @@ -1167,10 +1169,15 @@ struct msm_drm_private *priv = platform_get_drvdata(pdev); struct drm_device *drm = priv ? priv->dev : NULL; - if (!priv || !priv->kms) - return; - - drm_atomic_helper_shutdown(drm); + /* + * Shutdown the hw if we're far enough along where things might be on. + * If we run this too early, we'll end up panicking in any variety of + * places. Since we don't register the drm device until late in + * msm_drm_init, drm_dev->registered is used as an indicator that the + * shutdown will be successful. + */ + if (drm && drm->registered) + drm_atomic_helper_shutdown(drm); } static struct platform_driver msm_platform_driver = { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.h linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.h --- linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/msm_drv.h 2022-11-29 07:06:46.000000000 +0000 @@ -442,6 +442,8 @@ phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); +struct icc_path *msm_icc_get(struct device *dev, const char *name); + #define msm_writel(data, addr) writel((data), (addr)) #define msm_readl(addr) readl((addr)) diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/msm_gpu_devfreq.c linux-aws-5.19.0/drivers/gpu/drm/msm/msm_gpu_devfreq.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/msm_gpu_devfreq.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/msm_gpu_devfreq.c 2022-11-29 07:06:46.000000000 +0000 @@ -213,6 +213,8 @@ if (IS_ERR(df->devfreq)) { DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); + dev_pm_qos_remove_request(&df->idle_freq); + dev_pm_qos_remove_request(&df->boost_freq); df->devfreq = NULL; return; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/msm_io_utils.c linux-aws-5.19.0/drivers/gpu/drm/msm/msm_io_utils.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/msm_io_utils.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/msm_io_utils.c 2022-11-29 07:06:46.000000000 +0000 @@ -5,6 +5,8 @@ * Author: Rob Clark */ +#include + #include "msm_drv.h" /* @@ -124,3 +126,23 @@ work->worker = worker; kthread_init_work(&work->work, fn); } + +struct icc_path *msm_icc_get(struct device *dev, const char *name) +{ + struct device *mdss_dev = dev->parent; + struct icc_path *path; + + path = of_icc_get(dev, name); + if (path) + return path; + + /* + * If there are no interconnects attached to the corresponding device + * node, of_icc_get() will return NULL. + * + * If the MDP5/DPU device node doesn't have interconnects, lookup the + * path in the parent (MDSS) device. + */ + return of_icc_get(mdss_dev, name); + +} diff -Nru linux-aws-5.19.0/drivers/gpu/drm/msm/msm_rd.c linux-aws-5.19.0/drivers/gpu/drm/msm/msm_rd.c --- linux-aws-5.19.0/drivers/gpu/drm/msm/msm_rd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/msm/msm_rd.c 2022-11-29 07:06:46.000000000 +0000 @@ -196,6 +196,9 @@ file->private_data = rd; rd->open = true; + /* Reset fifo to clear any previously unread data: */ + rd->fifo.head = rd->fifo.tail = 0; + /* the parsing tools need to know gpu-id to know which * register database to load. * diff -Nru linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_bo.c linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_bo.c --- linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_bo.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_bo.c 2022-11-29 07:06:46.000000000 +0000 @@ -281,8 +281,10 @@ break; } - if (WARN_ON(pi < 0)) + if (WARN_ON(pi < 0)) { + kfree(nvbo); return ERR_PTR(-EINVAL); + } /* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_connector.c linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_connector.c --- linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_connector.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_connector.c 2022-11-29 07:06:46.000000000 +0000 @@ -503,7 +503,8 @@ connector->interlace_allowed = nv_encoder->caps.dp_interlace; else - connector->interlace_allowed = true; + connector->interlace_allowed = + drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; connector->doublescan_allowed = true; } else if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || diff -Nru linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_prime.c linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_prime.c --- linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_prime.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/nouveau/nouveau_prime.c 2022-11-29 07:06:46.000000000 +0000 @@ -71,7 +71,6 @@ ret = nouveau_bo_init(nvbo, size, align, NOUVEAU_GEM_DOMAIN_GART, sg, robj); if (ret) { - nouveau_bo_ref(NULL, &nvbo); obj = ERR_PTR(ret); goto unlock; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/omapdrm/dss/dss.c linux-aws-5.19.0/drivers/gpu/drm/omapdrm/dss/dss.c --- linux-aws-5.19.0/drivers/gpu/drm/omapdrm/dss/dss.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/omapdrm/dss/dss.c 2022-11-29 07:06:46.000000000 +0000 @@ -1176,6 +1176,7 @@ default: break; } + of_node_put(port); } } @@ -1208,11 +1209,13 @@ default: break; } + of_node_put(port); } return 0; error: + of_node_put(port); __dss_uninit_ports(dss, i); return r; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/panel/panel-edp.c linux-aws-5.19.0/drivers/gpu/drm/panel/panel-edp.c --- linux-aws-5.19.0/drivers/gpu/drm/panel/panel-edp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/panel/panel-edp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1270,7 +1270,8 @@ }, .delay = { .hpd_absent = 200, - .prepare_to_enable = 80, + .enable = 80, + .disable = 50, .unprepare = 500, }, }; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/panel/panel-simple.c linux-aws-5.19.0/drivers/gpu/drm/panel/panel-simple.c --- linux-aws-5.19.0/drivers/gpu/drm/panel/panel-simple.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/panel/panel-simple.c 2022-11-29 07:06:46.000000000 +0000 @@ -2136,7 +2136,7 @@ .enable = 200, .disable = 20, }, - .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, .connector_type = DRM_MODE_CONNECTOR_LVDS, }; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/pl111/pl111_versatile.c linux-aws-5.19.0/drivers/gpu/drm/pl111/pl111_versatile.c --- linux-aws-5.19.0/drivers/gpu/drm/pl111/pl111_versatile.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/pl111/pl111_versatile.c 2022-11-29 07:06:46.000000000 +0000 @@ -402,6 +402,7 @@ if (of_device_is_compatible(child, "arm,pl111")) { has_coretile_clcd = true; ct_clcd = child; + of_node_put(child); break; } if (of_device_is_compatible(child, "arm,hdlcd")) { diff -Nru linux-aws-5.19.0/drivers/gpu/drm/radeon/radeon_device.c linux-aws-5.19.0/drivers/gpu/drm/radeon/radeon_device.c --- linux-aws-5.19.0/drivers/gpu/drm/radeon/radeon_device.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/radeon/radeon_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -1604,6 +1604,9 @@ if (r) { /* delay GPU reset to resume */ radeon_fence_driver_force_completion(rdev, i); + } else { + /* finish executing delayed work */ + flush_delayed_work(&rdev->fence_drv[i].lockup_work); } } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/rockchip/cdn-dp-core.c linux-aws-5.19.0/drivers/gpu/drm/rockchip/cdn-dp-core.c --- linux-aws-5.19.0/drivers/gpu/drm/rockchip/cdn-dp-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/rockchip/cdn-dp-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -283,8 +283,9 @@ return ret; } -static int cdn_dp_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +cdn_dp_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { struct cdn_dp_device *dp = connector_to_dp(connector); struct drm_display_info *display_info = &dp->connector.display_info; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c linux-aws-5.19.0/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c --- linux-aws-5.19.0/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c 2022-11-29 07:06:46.000000000 +0000 @@ -1436,11 +1436,15 @@ die &= ~RK3568_SYS_DSP_INFACE_EN_HDMI_MUX; die |= RK3568_SYS_DSP_INFACE_EN_HDMI | FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_HDMI_MUX, vp->id); + dip &= ~RK3568_DSP_IF_POL__HDMI_PIN_POL; + dip |= FIELD_PREP(RK3568_DSP_IF_POL__HDMI_PIN_POL, polflags); break; case ROCKCHIP_VOP2_EP_EDP0: die &= ~RK3568_SYS_DSP_INFACE_EN_EDP_MUX; die |= RK3568_SYS_DSP_INFACE_EN_EDP | FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_EDP_MUX, vp->id); + dip &= ~RK3568_DSP_IF_POL__EDP_PIN_POL; + dip |= FIELD_PREP(RK3568_DSP_IF_POL__EDP_PIN_POL, polflags); break; case ROCKCHIP_VOP2_EP_MIPI0: die &= ~RK3568_SYS_DSP_INFACE_EN_MIPI0_MUX; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/tiny/bochs.c linux-aws-5.19.0/drivers/gpu/drm/tiny/bochs.c --- linux-aws-5.19.0/drivers/gpu/drm/tiny/bochs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/tiny/bochs.c 2022-11-29 07:06:46.000000000 +0000 @@ -306,6 +306,8 @@ static void bochs_hw_blank(struct bochs_device *bochs, bool blank) { DRM_DEBUG_DRIVER("hw_blank %d\n", blank); + /* enable color bit (so VGA_IS1_RC access works) */ + bochs_vga_writeb(bochs, VGA_MIS_W, VGA_MIS_COLOR); /* discard ar_flip_flop */ (void)bochs_vga_readb(bochs, VGA_IS1_RC); /* blank or unblank; we need only update index and set 0x20 */ diff -Nru linux-aws-5.19.0/drivers/gpu/drm/udl/udl_modeset.c linux-aws-5.19.0/drivers/gpu/drm/udl/udl_modeset.c --- linux-aws-5.19.0/drivers/gpu/drm/udl/udl_modeset.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/udl/udl_modeset.c 2022-11-29 07:06:46.000000000 +0000 @@ -382,9 +382,6 @@ udl_handle_damage(fb, &shadow_plane_state->data[0], 0, 0, fb->width, fb->height); - if (!crtc_state->mode_changed) - return; - /* enable display */ udl_crtc_write_mode_to_hw(crtc); } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/vc4/vc4_vec.c linux-aws-5.19.0/drivers/gpu/drm/vc4/vc4_vec.c --- linux-aws-5.19.0/drivers/gpu/drm/vc4/vc4_vec.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/vc4/vc4_vec.c 2022-11-29 07:06:46.000000000 +0000 @@ -256,7 +256,7 @@ static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0, + 480, 480 + 7, 480 + 7 + 6, 525, 0, DRM_MODE_FLAG_INTERLACE) }; @@ -278,7 +278,7 @@ static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0, + 576, 576 + 4, 576 + 4 + 6, 625, 0, DRM_MODE_FLAG_INTERLACE) }; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_display.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_display.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_display.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_display.c 2022-11-29 07:06:46.000000000 +0000 @@ -348,6 +348,8 @@ vgdev->ddev->mode_config.max_width = XRES_MAX; vgdev->ddev->mode_config.max_height = YRES_MAX; + vgdev->ddev->mode_config.fb_modifiers_not_supported = true; + for (i = 0 ; i < vgdev->num_scanouts; ++i) vgdev_output_init(vgdev, i); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_gem.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_gem.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_gem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_gem.c 2022-11-29 07:06:46.000000000 +0000 @@ -228,8 +228,10 @@ for (i = 0; i < objs->nents; ++i) { ret = dma_resv_reserve_fences(objs->objs[i]->resv, 1); - if (ret) + if (ret) { + virtio_gpu_array_unlock_resv(objs); return ret; + } } return ret; } diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_ioctl.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_ioctl.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_ioctl.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_ioctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -47,7 +47,7 @@ struct virtio_gpu_fence_event *e = NULL; int ret; - if (!(vfpriv->ring_idx_mask & (1 << ring_idx))) + if (!(vfpriv->ring_idx_mask & BIT_ULL(ring_idx))) return 0; e = kzalloc(sizeof(*e), GFP_KERNEL); @@ -168,7 +168,7 @@ * array contains any fence from a foreign context. */ ret = 0; - if (!dma_fence_match_context(in_fence, vgdev->fence_drv.context)) + if (!dma_fence_match_context(in_fence, fence_ctx + ring_idx)) ret = dma_fence_wait(in_fence, true); dma_fence_put(in_fence); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_object.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_object.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_object.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_object.c 2022-11-29 07:06:46.000000000 +0000 @@ -170,6 +170,7 @@ shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); + shmem->pages = NULL; return PTR_ERR(shmem->pages); } @@ -248,6 +249,8 @@ ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents); if (ret != 0) { + if (fence) + virtio_gpu_array_unlock_resv(objs); virtio_gpu_array_put_free(objs); virtio_gpu_free_object(&shmem_obj->base); return ret; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_plane.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_plane.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_plane.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_plane.c 2022-11-29 07:06:46.000000000 +0000 @@ -266,14 +266,14 @@ } static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane, - struct drm_plane_state *old_state) + struct drm_plane_state *state) { struct virtio_gpu_framebuffer *vgfb; - if (!plane->state->fb) + if (!state->fb) return; - vgfb = to_virtio_gpu_framebuffer(plane->state->fb); + vgfb = to_virtio_gpu_framebuffer(state->fb); if (vgfb->fence) { dma_fence_put(&vgfb->fence->f); vgfb->fence = NULL; diff -Nru linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_vq.c linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_vq.c --- linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_vq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/virtio/virtgpu_vq.c 2022-11-29 07:06:46.000000000 +0000 @@ -595,7 +595,7 @@ bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); - if (use_dma_api) + if (virtio_gpu_is_shmem(bo) && use_dma_api) dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, shmem->pages, DMA_TO_DEVICE); diff -Nru linux-aws-5.19.0/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c linux-aws-5.19.0/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c --- linux-aws-5.19.0/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 2022-11-29 07:06:46.000000000 +0000 @@ -1076,6 +1076,7 @@ if (desc_len < 0) { atomic_set(&dev_priv->mksstat_user_pids[slot], 0); + __free_page(page); return -EFAULT; } diff -Nru linux-aws-5.19.0/drivers/hid/hid-multitouch.c linux-aws-5.19.0/drivers/hid/hid-multitouch.c --- linux-aws-5.19.0/drivers/hid/hid-multitouch.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/hid-multitouch.c 2022-11-29 07:06:46.000000000 +0000 @@ -1186,7 +1186,7 @@ int contact_count = -1; /* sticky fingers release in progress, abort */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; scantime = *app->scantime; @@ -1267,7 +1267,7 @@ del_timer(&td->release_timer); } - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_touch_input_configured(struct hid_device *hdev, @@ -1699,11 +1699,11 @@ * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) diff -Nru linux-aws-5.19.0/drivers/hid/hid-nintendo.c linux-aws-5.19.0/drivers/hid/hid-nintendo.c --- linux-aws-5.19.0/drivers/hid/hid-nintendo.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/hid-nintendo.c 2022-11-29 07:06:46.000000000 +0000 @@ -761,12 +761,31 @@ cal_y->max = cal_y->center + y_max_above; cal_y->min = cal_y->center - y_min_below; - return 0; + /* check if calibration values are plausible */ + if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) + ret = -EINVAL; + + return ret; } static const u16 DFLT_STICK_CAL_CEN = 2000; static const u16 DFLT_STICK_CAL_MAX = 3500; static const u16 DFLT_STICK_CAL_MIN = 500; +static void joycon_use_default_calibration(struct hid_device *hdev, + struct joycon_stick_cal *cal_x, + struct joycon_stick_cal *cal_y, + const char *stick, int ret) +{ + hid_warn(hdev, + "Failed to read %s stick cal, using defaults; e=%d\n", + stick, ret); + + cal_x->center = cal_y->center = DFLT_STICK_CAL_CEN; + cal_x->max = cal_y->max = DFLT_STICK_CAL_MAX; + cal_x->min = cal_y->min = DFLT_STICK_CAL_MIN; +} + static int joycon_request_calibration(struct joycon_ctlr *ctlr) { u16 left_stick_addr = JC_CAL_FCT_DATA_LEFT_ADDR; @@ -794,38 +813,24 @@ &ctlr->left_stick_cal_x, &ctlr->left_stick_cal_y, true); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read left stick cal, using dflts; e=%d\n", - ret); - - ctlr->left_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_x.min = DFLT_STICK_CAL_MIN; - - ctlr->left_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->left_stick_cal_x, + &ctlr->left_stick_cal_y, + "left", ret); /* read the right stick calibration data */ ret = joycon_read_stick_calibration(ctlr, right_stick_addr, &ctlr->right_stick_cal_x, &ctlr->right_stick_cal_y, false); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read right stick cal, using dflts; e=%d\n", - ret); - - ctlr->right_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_x.min = DFLT_STICK_CAL_MIN; - - ctlr->right_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->right_stick_cal_x, + &ctlr->right_stick_cal_y, + "right", ret); hid_dbg(ctlr->hdev, "calibration:\n" "l_x_c=%d l_x_max=%d l_x_min=%d\n" diff -Nru linux-aws-5.19.0/drivers/hid/hid-roccat.c linux-aws-5.19.0/drivers/hid/hid-roccat.c --- linux-aws-5.19.0/drivers/hid/hid-roccat.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/hid-roccat.c 2022-11-29 07:06:46.000000000 +0000 @@ -257,6 +257,8 @@ if (!new_value) return -ENOMEM; + mutex_lock(&device->cbuf_lock); + report = &device->cbuf[device->cbuf_end]; /* passing NULL is safe */ @@ -276,6 +278,8 @@ reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE; } + mutex_unlock(&device->cbuf_lock); + wake_up_interruptible(&device->wait); return 0; } diff -Nru linux-aws-5.19.0/drivers/hid/hid-uclogic-core.c linux-aws-5.19.0/drivers/hid/hid-uclogic-core.c --- linux-aws-5.19.0/drivers/hid/hid-uclogic-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/hid-uclogic-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -153,6 +153,7 @@ suffix = "Pad"; break; case HID_DG_PEN: + case HID_DG_DIGITIZER: suffix = "Pen"; break; case HID_CP_CONSUMER_CONTROL: diff -Nru linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp/client.c linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp/client.c --- linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp/client.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp/client.c 2022-11-29 07:06:46.000000000 +0000 @@ -626,13 +626,14 @@ } /** - * ipc_tx_callback() - IPC tx callback function + * ipc_tx_send() - IPC tx send function * @prm: Pointer to client device instance * - * Send message over IPC either first time or on callback on previous message - * completion + * Send message over IPC. Message will be split into fragments + * if message size is bigger than IPC FIFO size, and all + * fragments will be sent one by one. */ -static void ipc_tx_callback(void *prm) +static void ipc_tx_send(void *prm) { struct ishtp_cl *cl = prm; struct ishtp_cl_tx_ring *cl_msg; @@ -677,32 +678,41 @@ list); rem = cl_msg->send_buf.size - cl->tx_offs; - ishtp_hdr.host_addr = cl->host_client_id; - ishtp_hdr.fw_addr = cl->fw_client_id; - ishtp_hdr.reserved = 0; - pmsg = cl_msg->send_buf.data + cl->tx_offs; - - if (rem <= dev->mtu) { - ishtp_hdr.length = rem; - ishtp_hdr.msg_complete = 1; - cl->sending = 0; - list_del_init(&cl_msg->list); /* Must be before write */ - spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags); - /* Submit to IPC queue with no callback */ - ishtp_write_message(dev, &ishtp_hdr, pmsg); - spin_lock_irqsave(&cl->tx_free_list_spinlock, tx_free_flags); - list_add_tail(&cl_msg->list, &cl->tx_free_list.list); - ++cl->tx_ring_free_size; - spin_unlock_irqrestore(&cl->tx_free_list_spinlock, - tx_free_flags); - } else { - /* Send IPC fragment */ - spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags); - cl->tx_offs += dev->mtu; - ishtp_hdr.length = dev->mtu; - ishtp_hdr.msg_complete = 0; - ishtp_send_msg(dev, &ishtp_hdr, pmsg, ipc_tx_callback, cl); + while (rem > 0) { + ishtp_hdr.host_addr = cl->host_client_id; + ishtp_hdr.fw_addr = cl->fw_client_id; + ishtp_hdr.reserved = 0; + pmsg = cl_msg->send_buf.data + cl->tx_offs; + + if (rem <= dev->mtu) { + /* Last fragment or only one packet */ + ishtp_hdr.length = rem; + ishtp_hdr.msg_complete = 1; + /* Submit to IPC queue with no callback */ + ishtp_write_message(dev, &ishtp_hdr, pmsg); + cl->tx_offs = 0; + cl->sending = 0; + + break; + } else { + /* Send ipc fragment */ + ishtp_hdr.length = dev->mtu; + ishtp_hdr.msg_complete = 0; + /* All fregments submitted to IPC queue with no callback */ + ishtp_write_message(dev, &ishtp_hdr, pmsg); + cl->tx_offs += dev->mtu; + rem = cl_msg->send_buf.size - cl->tx_offs; + } } + + list_del_init(&cl_msg->list); + spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags); + + spin_lock_irqsave(&cl->tx_free_list_spinlock, tx_free_flags); + list_add_tail(&cl_msg->list, &cl->tx_free_list.list); + ++cl->tx_ring_free_size; + spin_unlock_irqrestore(&cl->tx_free_list_spinlock, + tx_free_flags); } /** @@ -720,7 +730,7 @@ return; cl->tx_offs = 0; - ipc_tx_callback(cl); + ipc_tx_send(cl); ++cl->send_msg_cnt_ipc; } diff -Nru linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp-hid.h linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp-hid.h --- linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp-hid.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hid/intel-ish-hid/ishtp-hid.h 2022-11-29 07:06:46.000000000 +0000 @@ -105,7 +105,7 @@ * @multi_packet_cnt: Count of fragmented packet count * * This structure is used to store completion flags and per client data like - * like report description, number of HID devices etc. + * report description, number of HID devices etc. */ struct ishtp_cl_data { /* completion flags */ diff -Nru linux-aws-5.19.0/drivers/hsi/clients/ssi_protocol.c linux-aws-5.19.0/drivers/hsi/clients/ssi_protocol.c --- linux-aws-5.19.0/drivers/hsi/clients/ssi_protocol.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hsi/clients/ssi_protocol.c 2022-11-29 07:06:46.000000000 +0000 @@ -931,6 +931,7 @@ if (err < 0) { dev_err(&cl->device, "Register HSI port event failed (%d)\n", err); + hsi_release_port(cl); return err; } dev_dbg(&cl->device, "Configuring SSI port\n"); diff -Nru linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_core.c linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_core.c --- linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -524,6 +524,7 @@ if (!childpdev) { err = -ENODEV; dev_err(&pd->dev, "failed to create ssi controller port\n"); + of_node_put(child); goto out3; } } diff -Nru linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_port.c linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_port.c --- linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_port.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hsi/controllers/omap_ssi_port.c 2022-11-29 07:06:46.000000000 +0000 @@ -230,10 +230,10 @@ if (msg->ttype == HSI_MSG_READ) { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_FROM_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | @@ -247,10 +247,10 @@ } else { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_TO_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | diff -Nru linux-aws-5.19.0/drivers/hv/vmbus_drv.c linux-aws-5.19.0/drivers/hv/vmbus_drv.c --- linux-aws-5.19.0/drivers/hv/vmbus_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hv/vmbus_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -2309,7 +2309,7 @@ bool fb_overlap_ok) { struct resource *iter, *shadow; - resource_size_t range_min, range_max, start; + resource_size_t range_min, range_max, start, end; const char *dev_n = dev_name(&device_obj->device); int retval; @@ -2344,6 +2344,14 @@ range_max = iter->end; start = (range_min + align - 1) & ~(align - 1); for (; start + size - 1 <= range_max; start += align) { + end = start + size - 1; + + /* Skip the whole fb_mmio region if not fb_overlap_ok */ + if (!fb_overlap_ok && fb_mmio && + (((start >= fb_mmio->start) && (start <= fb_mmio->end)) || + ((end >= fb_mmio->start) && (end <= fb_mmio->end)))) + continue; + shadow = __request_region(iter, start, size, NULL, IORESOURCE_BUSY); if (!shadow) diff -Nru linux-aws-5.19.0/drivers/hwmon/asus-ec-sensors.c linux-aws-5.19.0/drivers/hwmon/asus-ec-sensors.c --- linux-aws-5.19.0/drivers/hwmon/asus-ec-sensors.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/asus-ec-sensors.c 2022-11-29 07:06:46.000000000 +0000 @@ -54,6 +54,10 @@ /* ACPI mutex for locking access to the EC for the firmware */ #define ASUS_HW_ACCESS_MUTEX_ASMX "\\AMW0.ASMX" +#define ASUS_HW_ACCESS_MUTEX_RMTW_ASMX "\\RMTW.ASMX" + +#define ASUS_HW_ACCESS_MUTEX_SB_PCI0_SBRG_SIO1_MUT0 "\\_SB_.PCI0.SBRG.SIO1.MUT0" + #define MAX_IDENTICAL_BOARD_VARIATIONS 3 /* Moniker for the ACPI global lock (':' is not allowed in ASL identifiers) */ @@ -119,6 +123,18 @@ ec_sensor_temp_water_in, /* "Water_Out" temperature sensor reading [℃] */ ec_sensor_temp_water_out, + /* "Water_Block_In" temperature sensor reading [℃] */ + ec_sensor_temp_water_block_in, + /* "Water_Block_Out" temperature sensor reading [℃] */ + ec_sensor_temp_water_block_out, + /* "T_sensor_2" temperature sensor reading [℃] */ + ec_sensor_temp_t_sensor_2, + /* "Extra_1" temperature sensor reading [℃] */ + ec_sensor_temp_sensor_extra_1, + /* "Extra_2" temperature sensor reading [℃] */ + ec_sensor_temp_sensor_extra_2, + /* "Extra_3" temperature sensor reading [℃] */ + ec_sensor_temp_sensor_extra_3, }; #define SENSOR_TEMP_CHIPSET BIT(ec_sensor_temp_chipset) @@ -134,11 +150,19 @@ #define SENSOR_CURR_CPU BIT(ec_sensor_curr_cpu) #define SENSOR_TEMP_WATER_IN BIT(ec_sensor_temp_water_in) #define SENSOR_TEMP_WATER_OUT BIT(ec_sensor_temp_water_out) +#define SENSOR_TEMP_WATER_BLOCK_IN BIT(ec_sensor_temp_water_block_in) +#define SENSOR_TEMP_WATER_BLOCK_OUT BIT(ec_sensor_temp_water_block_out) +#define SENSOR_TEMP_T_SENSOR_2 BIT(ec_sensor_temp_t_sensor_2) +#define SENSOR_TEMP_SENSOR_EXTRA_1 BIT(ec_sensor_temp_sensor_extra_1) +#define SENSOR_TEMP_SENSOR_EXTRA_2 BIT(ec_sensor_temp_sensor_extra_2) +#define SENSOR_TEMP_SENSOR_EXTRA_3 BIT(ec_sensor_temp_sensor_extra_3) enum board_family { family_unknown, family_amd_400_series, family_amd_500_series, + family_intel_300_series, + family_intel_600_series }; /* All the known sensors for ASUS EC controllers */ @@ -195,15 +219,54 @@ EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00), [ec_sensor_temp_water_out] = EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01), + [ec_sensor_temp_water_block_in] = + EC_SENSOR("Water_Block_In", hwmon_temp, 1, 0x01, 0x02), + [ec_sensor_temp_water_block_out] = + EC_SENSOR("Water_Block_Out", hwmon_temp, 1, 0x01, 0x03), + [ec_sensor_temp_sensor_extra_1] = + EC_SENSOR("Extra_1", hwmon_temp, 1, 0x01, 0x09), + [ec_sensor_temp_t_sensor_2] = + EC_SENSOR("T_sensor_2", hwmon_temp, 1, 0x01, 0x0a), + [ec_sensor_temp_sensor_extra_2] = + EC_SENSOR("Extra_2", hwmon_temp, 1, 0x01, 0x0b), + [ec_sensor_temp_sensor_extra_3] = + EC_SENSOR("Extra_3", hwmon_temp, 1, 0x01, 0x0c), +}; + +static const struct ec_sensor_info sensors_family_intel_300[] = { + [ec_sensor_temp_chipset] = + EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a), + [ec_sensor_temp_cpu] = EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x3b), + [ec_sensor_temp_mb] = + EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x3c), + [ec_sensor_temp_t_sensor] = + EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d), + [ec_sensor_temp_vrm] = EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e), + [ec_sensor_fan_cpu_opt] = + EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0), + [ec_sensor_fan_vrm_hs] = EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2), + [ec_sensor_fan_water_flow] = + EC_SENSOR("Water_Flow", hwmon_fan, 2, 0x00, 0xbc), + [ec_sensor_temp_water_in] = + EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00), + [ec_sensor_temp_water_out] = + EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01), +}; + +static const struct ec_sensor_info sensors_family_intel_600[] = { + [ec_sensor_temp_t_sensor] = + EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d), + [ec_sensor_temp_vrm] = EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e), }; /* Shortcuts for common combinations */ #define SENSOR_SET_TEMP_CHIPSET_CPU_MB \ (SENSOR_TEMP_CHIPSET | SENSOR_TEMP_CPU | SENSOR_TEMP_MB) #define SENSOR_SET_TEMP_WATER (SENSOR_TEMP_WATER_IN | SENSOR_TEMP_WATER_OUT) +#define SENSOR_SET_WATER_BLOCK \ + (SENSOR_TEMP_WATER_BLOCK_IN | SENSOR_TEMP_WATER_BLOCK_OUT) struct ec_board_info { - const char *board_names[MAX_IDENTICAL_BOARD_VARIATIONS]; unsigned long sensors; /* * Defines which mutex to use for guarding access to the state and the @@ -216,121 +279,194 @@ enum board_family family; }; -static const struct ec_board_info board_info[] = { - { - .board_names = {"PRIME X470-PRO"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | - SENSOR_FAN_CPU_OPT | - SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, - .mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH, - .family = family_amd_400_series, - }, - { - .board_names = {"PRIME X570-PRO"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | - SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ProArt X570-CREATOR WIFI"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | - SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT | - SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, - }, - { - .board_names = {"Pro WS X570-ACE"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | - SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET | - SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG CROSSHAIR VIII DARK HERO"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | - SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | - SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW | - SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = { - "ROG CROSSHAIR VIII FORMULA", - "ROG CROSSHAIR VIII HERO", - "ROG CROSSHAIR VIII HERO (WI-FI)", - }, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | - SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | - SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | - SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG CROSSHAIR VIII IMPACT"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | - SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX B550-E GAMING"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | - SENSOR_FAN_CPU_OPT, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX B550-I GAMING"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | - SENSOR_FAN_VRM_HS | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX X570-E GAMING"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | - SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX X570-E GAMING WIFI II"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX X570-F GAMING"}, - .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | - SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - { - .board_names = {"ROG STRIX X570-I GAMING"}, - .sensors = SENSOR_TEMP_T_SENSOR | SENSOR_FAN_VRM_HS | - SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | - SENSOR_IN_CPU_CORE, - .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, - .family = family_amd_500_series, - }, - {} +static const struct ec_board_info board_info_prime_x470_pro = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | + SENSOR_FAN_CPU_OPT | + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, + .mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH, + .family = family_amd_400_series, +}; + +static const struct ec_board_info board_info_prime_x570_pro = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_pro_art_x570_creator_wifi = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT | + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_pro_ws_x570_ace = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET | + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_crosshair_viii_dark_hero = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | + SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | + SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW | + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_crosshair_viii_hero = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | + SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | + SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | + SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | + SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_maximus_xi_hero = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | + SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | + SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_intel_300_series, +}; + +static const struct ec_board_info board_info_crosshair_viii_impact = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | + SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_b550_e_gaming = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | + SENSOR_FAN_CPU_OPT, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_b550_i_gaming = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | + SENSOR_FAN_VRM_HS | SENSOR_CURR_CPU | + SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_x570_e_gaming = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM | + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | + SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_x570_e_gaming_wifi_ii = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_CURR_CPU | + SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_x570_f_gaming = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_x570_i_gaming = { + .sensors = SENSOR_TEMP_CHIPSET | SENSOR_TEMP_VRM | + SENSOR_TEMP_T_SENSOR | + SENSOR_FAN_VRM_HS | SENSOR_FAN_CHIPSET | + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE, + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, + .family = family_amd_500_series, +}; + +static const struct ec_board_info board_info_strix_z690_a_gaming_wifi_d4 = { + .sensors = SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM, + .mutex_path = ASUS_HW_ACCESS_MUTEX_RMTW_ASMX, + .family = family_intel_600_series, +}; + +static const struct ec_board_info board_info_zenith_ii_extreme = { + .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | + SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | + SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | SENSOR_FAN_VRM_HS | + SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE | + SENSOR_SET_WATER_BLOCK | + SENSOR_TEMP_T_SENSOR_2 | SENSOR_TEMP_SENSOR_EXTRA_1 | + SENSOR_TEMP_SENSOR_EXTRA_2 | SENSOR_TEMP_SENSOR_EXTRA_3, + .mutex_path = ASUS_HW_ACCESS_MUTEX_SB_PCI0_SBRG_SIO1_MUT0, + .family = family_amd_500_series, +}; + +#define DMI_EXACT_MATCH_ASUS_BOARD_NAME(name, board_info) \ + { \ + .matches = { \ + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, \ + "ASUSTeK COMPUTER INC."), \ + DMI_EXACT_MATCH(DMI_BOARD_NAME, name), \ + }, \ + .driver_data = (void *)board_info, \ + } + +static const struct dmi_system_id dmi_table[] = { + DMI_EXACT_MATCH_ASUS_BOARD_NAME("PRIME X470-PRO", + &board_info_prime_x470_pro), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("PRIME X570-PRO", + &board_info_prime_x570_pro), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ProArt X570-CREATOR WIFI", + &board_info_pro_art_x570_creator_wifi), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("Pro WS X570-ACE", + &board_info_pro_ws_x570_ace), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII DARK HERO", + &board_info_crosshair_viii_dark_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII FORMULA", + &board_info_crosshair_viii_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII HERO", + &board_info_crosshair_viii_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII HERO (WI-FI)", + &board_info_crosshair_viii_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO", + &board_info_maximus_xi_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG MAXIMUS XI HERO (WI-FI)", + &board_info_maximus_xi_hero), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG CROSSHAIR VIII IMPACT", + &board_info_crosshair_viii_impact), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX B550-E GAMING", + &board_info_strix_b550_e_gaming), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX B550-I GAMING", + &board_info_strix_b550_i_gaming), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-E GAMING", + &board_info_strix_x570_e_gaming), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-E GAMING WIFI II", + &board_info_strix_x570_e_gaming_wifi_ii), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-F GAMING", + &board_info_strix_x570_f_gaming), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX X570-I GAMING", + &board_info_strix_x570_i_gaming), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX Z690-A GAMING WIFI D4", + &board_info_strix_z690_a_gaming_wifi_d4), + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG ZENITH II EXTREME", + &board_info_zenith_ii_extreme), + {}, }; struct ec_sensor { @@ -441,12 +577,12 @@ return -ENOENT; } -static int __init bank_compare(const void *a, const void *b) +static int bank_compare(const void *a, const void *b) { return *((const s8 *)a) - *((const s8 *)b); } -static void __init setup_sensor_data(struct ec_sensors_data *ec) +static void setup_sensor_data(struct ec_sensors_data *ec) { struct ec_sensor *s = ec->sensors; bool bank_found; @@ -478,7 +614,7 @@ sort(ec->banks, ec->nr_banks, 1, bank_compare, NULL); } -static void __init fill_ec_registers(struct ec_sensors_data *ec) +static void fill_ec_registers(struct ec_sensors_data *ec) { const struct ec_sensor_info *si; unsigned int i, j, register_idx = 0; @@ -493,7 +629,7 @@ } } -static int __init setup_lock_data(struct device *dev) +static int setup_lock_data(struct device *dev) { const char *mutex_path; int status; @@ -716,7 +852,7 @@ return find_ec_sensor_index(state, type, channel) >= 0 ? S_IRUGO : 0; } -static int __init +static int asus_ec_hwmon_add_chan_info(struct hwmon_channel_info *asus_ec_hwmon_chan, struct device *dev, int num, enum hwmon_sensor_types type, u32 config) @@ -745,27 +881,15 @@ .ops = &asus_ec_hwmon_ops, }; -static const struct ec_board_info * __init get_board_info(void) +static const struct ec_board_info *get_board_info(void) { - const char *dmi_board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); - const char *dmi_board_name = dmi_get_system_info(DMI_BOARD_NAME); - const struct ec_board_info *board; + const struct dmi_system_id *dmi_entry; - if (!dmi_board_vendor || !dmi_board_name || - strcasecmp(dmi_board_vendor, "ASUSTeK COMPUTER INC.")) - return NULL; - - for (board = board_info; board->sensors; board++) { - if (match_string(board->board_names, - MAX_IDENTICAL_BOARD_VARIATIONS, - dmi_board_name) >= 0) - return board; - } - - return NULL; + dmi_entry = dmi_first_match(dmi_table); + return dmi_entry ? dmi_entry->driver_data : NULL; } -static int __init asus_ec_probe(struct platform_device *pdev) +static int asus_ec_probe(struct platform_device *pdev) { const struct hwmon_channel_info **ptr_asus_ec_ci; int nr_count[hwmon_max] = { 0 }, nr_types = 0; @@ -799,6 +923,12 @@ case family_amd_500_series: ec_data->sensors_info = sensors_family_amd_500; break; + case family_intel_300_series: + ec_data->sensors_info = sensors_family_intel_300; + break; + case family_intel_600_series: + ec_data->sensors_info = sensors_family_intel_600; + break; default: dev_err(dev, "Unknown board family: %d", ec_data->board_info->family); @@ -868,29 +998,37 @@ return PTR_ERR_OR_ZERO(hwdev); } - -static const struct acpi_device_id acpi_ec_ids[] = { - /* Embedded Controller Device */ - { "PNP0C09", 0 }, - {} -}; +MODULE_DEVICE_TABLE(dmi, dmi_table); static struct platform_driver asus_ec_sensors_platform_driver = { .driver = { .name = "asus-ec-sensors", - .acpi_match_table = acpi_ec_ids, }, + .probe = asus_ec_probe, }; -MODULE_DEVICE_TABLE(acpi, acpi_ec_ids); -/* - * we use module_platform_driver_probe() rather than module_platform_driver() - * because the probe function (and its dependants) are marked with __init, which - * means we can't put it into the .probe member of the platform_driver struct - * above, and we can't mark the asus_ec_sensors_platform_driver object as __init - * because the object is referenced from the module exit code. - */ -module_platform_driver_probe(asus_ec_sensors_platform_driver, asus_ec_probe); +static struct platform_device *asus_ec_sensors_platform_device; + +static int __init asus_ec_init(void) +{ + asus_ec_sensors_platform_device = + platform_create_bundle(&asus_ec_sensors_platform_driver, + asus_ec_probe, NULL, 0, NULL, 0); + + if (IS_ERR(asus_ec_sensors_platform_device)) + return PTR_ERR(asus_ec_sensors_platform_device); + + return 0; +} + +static void __exit asus_ec_exit(void) +{ + platform_device_unregister(asus_ec_sensors_platform_device); + platform_driver_unregister(&asus_ec_sensors_platform_driver); +} + +module_init(asus_ec_init); +module_exit(asus_ec_exit); module_param_named(mutex_path, mutex_path_override, charp, 0); MODULE_PARM_DESC(mutex_path, diff -Nru linux-aws-5.19.0/drivers/hwmon/gpio-fan.c linux-aws-5.19.0/drivers/hwmon/gpio-fan.c --- linux-aws-5.19.0/drivers/hwmon/gpio-fan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/gpio-fan.c 2022-11-29 07:06:46.000000000 +0000 @@ -391,6 +391,9 @@ if (!fan_data) return -EINVAL; + if (state >= fan_data->num_speed) + return -EINVAL; + set_fan_speed(fan_data, state); return 0; } diff -Nru linux-aws-5.19.0/drivers/hwmon/gsc-hwmon.c linux-aws-5.19.0/drivers/hwmon/gsc-hwmon.c --- linux-aws-5.19.0/drivers/hwmon/gsc-hwmon.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/gsc-hwmon.c 2022-11-29 07:06:46.000000000 +0000 @@ -267,6 +267,7 @@ pdata->nchannels = nchannels; /* fan controller base address */ + of_node_get(dev->parent->of_node); fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan"); if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) { dev_err(dev, "fan node without base\n"); diff -Nru linux-aws-5.19.0/drivers/hwmon/mr75203.c linux-aws-5.19.0/drivers/hwmon/mr75203.c --- linux-aws-5.19.0/drivers/hwmon/mr75203.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/mr75203.c 2022-11-29 07:06:46.000000000 +0000 @@ -68,8 +68,9 @@ /* VM Individual Macro Register */ #define VM_COM_REG_SIZE 0x200 -#define VM_SDIF_DONE(n) (VM_COM_REG_SIZE + 0x34 + 0x200 * (n)) -#define VM_SDIF_DATA(n) (VM_COM_REG_SIZE + 0x40 + 0x200 * (n)) +#define VM_SDIF_DONE(vm) (VM_COM_REG_SIZE + 0x34 + 0x200 * (vm)) +#define VM_SDIF_DATA(vm, ch) \ + (VM_COM_REG_SIZE + 0x40 + 0x200 * (vm) + 0x4 * (ch)) /* SDA Slave Register */ #define IP_CTRL 0x00 @@ -115,6 +116,7 @@ u32 t_num; u32 p_num; u32 v_num; + u32 c_num; u32 ip_freq; u8 *vm_idx; }; @@ -178,14 +180,15 @@ { struct pvt_device *pvt = dev_get_drvdata(dev); struct regmap *v_map = pvt->v_map; + u8 vm_idx, ch_idx; u32 n, stat; - u8 vm_idx; int ret; - if (channel >= pvt->v_num) + if (channel >= pvt->v_num * pvt->c_num) return -EINVAL; - vm_idx = pvt->vm_idx[channel]; + vm_idx = pvt->vm_idx[channel / pvt->c_num]; + ch_idx = channel % pvt->c_num; switch (attr) { case hwmon_in_input: @@ -196,13 +199,23 @@ if (ret) return ret; - ret = regmap_read(v_map, VM_SDIF_DATA(vm_idx), &n); + ret = regmap_read(v_map, VM_SDIF_DATA(vm_idx, ch_idx), &n); if(ret < 0) return ret; n &= SAMPLE_DATA_MSK; - /* Convert the N bitstream count into voltage */ - *val = (PVT_N_CONST * n - PVT_R_CONST) >> PVT_CONV_BITS; + /* + * Convert the N bitstream count into voltage. + * To support negative voltage calculation for 64bit machines + * n must be cast to long, since n and *val differ both in + * signedness and in size. + * Division is used instead of right shift, because for signed + * numbers, the sign bit is used to fill the vacated bit + * positions, and if the number is negative, 1 is used. + * BIT(x) may not be used instead of (1 << x) because it's + * unsigned. + */ + *val = (PVT_N_CONST * (long)n - PVT_R_CONST) / (1 << PVT_CONV_BITS); return 0; default: @@ -375,6 +388,19 @@ if (ret) return ret; + val = (BIT(pvt->c_num) - 1) | VM_CH_INIT | + IP_POLL << SDIF_ADDR_SFT | SDIF_WRN_W | SDIF_PROG; + ret = regmap_write(v_map, SDIF_W, val); + if (ret < 0) + return ret; + + ret = regmap_read_poll_timeout(v_map, SDIF_STAT, + val, !(val & SDIF_BUSY), + PVT_POLL_DELAY_US, + PVT_POLL_TIMEOUT_US); + if (ret) + return ret; + val = CFG1_VOL_MEAS_MODE | CFG1_PARALLEL_OUT | CFG1_14_BIT | IP_CFG << SDIF_ADDR_SFT | SDIF_WRN_W | SDIF_PROG; @@ -489,8 +515,8 @@ static int mr75203_probe(struct platform_device *pdev) { + u32 ts_num, vm_num, pd_num, ch_num, val, index, i; const struct hwmon_channel_info **pvt_info; - u32 ts_num, vm_num, pd_num, val, index, i; struct device *dev = &pdev->dev; u32 *temp_config, *in_config; struct device *hwmon_dev; @@ -531,9 +557,11 @@ ts_num = (val & TS_NUM_MSK) >> TS_NUM_SFT; pd_num = (val & PD_NUM_MSK) >> PD_NUM_SFT; vm_num = (val & VM_NUM_MSK) >> VM_NUM_SFT; + ch_num = (val & CH_NUM_MSK) >> CH_NUM_SFT; pvt->t_num = ts_num; pvt->p_num = pd_num; pvt->v_num = vm_num; + pvt->c_num = ch_num; val = 0; if (ts_num) val++; @@ -570,7 +598,7 @@ } if (vm_num) { - u32 num = vm_num; + u32 total_ch; ret = pvt_get_regmap(pdev, "vm", pvt); if (ret) @@ -584,30 +612,30 @@ ret = device_property_read_u8_array(dev, "intel,vm-map", pvt->vm_idx, vm_num); if (ret) { - num = 0; + /* + * Incase intel,vm-map property is not defined, we + * assume incremental channel numbers. + */ + for (i = 0; i < vm_num; i++) + pvt->vm_idx[i] = i; } else { for (i = 0; i < vm_num; i++) if (pvt->vm_idx[i] >= vm_num || pvt->vm_idx[i] == 0xff) { - num = i; + pvt->v_num = i; + vm_num = i; break; } } - /* - * Incase intel,vm-map property is not defined, we assume - * incremental channel numbers. - */ - for (i = num; i < vm_num; i++) - pvt->vm_idx[i] = i; - - in_config = devm_kcalloc(dev, num + 1, + total_ch = ch_num * vm_num; + in_config = devm_kcalloc(dev, total_ch + 1, sizeof(*in_config), GFP_KERNEL); if (!in_config) return -ENOMEM; - memset32(in_config, HWMON_I_INPUT, num); - in_config[num] = 0; + memset32(in_config, HWMON_I_INPUT, total_ch); + in_config[total_ch] = 0; pvt_in.config = in_config; pvt_info[index++] = &pvt_in; diff -Nru linux-aws-5.19.0/drivers/hwmon/occ/p9_sbe.c linux-aws-5.19.0/drivers/hwmon/occ/p9_sbe.c --- linux-aws-5.19.0/drivers/hwmon/occ/p9_sbe.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/occ/p9_sbe.c 2022-11-29 07:06:46.000000000 +0000 @@ -14,6 +14,8 @@ #include "common.h" +#define OCC_CHECKSUM_RETRIES 3 + struct p9_sbe_occ { struct occ occ; bool sbe_error; @@ -81,18 +83,23 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, void *resp, size_t resp_len) { + size_t original_resp_len = resp_len; struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); - int rc; + int rc, i; - rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); - if (rc < 0) { + for (i = 0; i < OCC_CHECKSUM_RETRIES; ++i) { + rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); + if (rc >= 0) + break; if (resp_len) { if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len)) sysfs_notify(&occ->bus_dev->kobj, NULL, bin_attr_ffdc.attr.name); + return rc; } - - return rc; + if (rc != -EBADE) + return rc; + resp_len = original_resp_len; } switch (((struct occ_response *)resp)->return_status) { diff -Nru linux-aws-5.19.0/drivers/hwmon/pmbus/mp2888.c linux-aws-5.19.0/drivers/hwmon/pmbus/mp2888.c --- linux-aws-5.19.0/drivers/hwmon/pmbus/mp2888.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/pmbus/mp2888.c 2022-11-29 07:06:46.000000000 +0000 @@ -34,7 +34,7 @@ int curr_sense_gain; }; -#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) +#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) static int mp2888_read_byte_data(struct i2c_client *client, int page, int reg) { @@ -109,7 +109,7 @@ * - Kcs is the DrMOS current sense gain of power stage, which is obtained from the * register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS * (data->curr_sense_gain): - * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. + * 00b - 8.5µA/A, 01b - 9.7µA/A, 1b - 10µA/A, 11b - 5µA/A. * - Rcs is the internal phase current sense resistor. This parameter depends on hardware * assembly. By default it is set to 1kΩ. In case of different assembly, user should * scale this parameter by dividing it by Rcs. @@ -118,10 +118,9 @@ * because sampling of current occurrence of bit weight has a big deviation, especially for * light load. */ - ret = DIV_ROUND_CLOSEST(ret * 100 - 9800, data->curr_sense_gain); - ret = (data->phase_curr_resolution) ? ret * 2 : ret; + ret = DIV_ROUND_CLOSEST(ret * 200 - 19600, data->curr_sense_gain); /* Scale according to total current resolution. */ - ret = (data->total_curr_resolution) ? ret * 8 : ret * 4; + ret = (data->total_curr_resolution) ? ret * 2 : ret; return ret; } @@ -212,7 +211,7 @@ ret = pmbus_read_word_data(client, page, phase, reg); if (ret < 0) return ret; - ret = data->total_curr_resolution ? ret * 2 : ret; + ret = data->total_curr_resolution ? ret : DIV_ROUND_CLOSEST(ret, 2); break; case PMBUS_POUT_OP_WARN_LIMIT: ret = pmbus_read_word_data(client, page, phase, reg); @@ -223,7 +222,7 @@ * set 1. Actual power is reported with 0.5W or 1W respectively resolution. Scaling * is needed to match both. */ - ret = data->total_curr_resolution ? ret * 4 : ret * 2; + ret = data->total_curr_resolution ? ret * 2 : ret; break; /* * The below registers are not implemented by device or implemented not according to the diff -Nru linux-aws-5.19.0/drivers/hwmon/sht4x.c linux-aws-5.19.0/drivers/hwmon/sht4x.c --- linux-aws-5.19.0/drivers/hwmon/sht4x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/sht4x.c 2022-11-29 07:06:46.000000000 +0000 @@ -129,7 +129,7 @@ static ssize_t sht4x_interval_write(struct sht4x_data *data, long val) { - data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, UINT_MAX); + data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, INT_MAX); return 0; } diff -Nru linux-aws-5.19.0/drivers/hwmon/tps23861.c linux-aws-5.19.0/drivers/hwmon/tps23861.c --- linux-aws-5.19.0/drivers/hwmon/tps23861.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/hwmon/tps23861.c 2022-11-29 07:06:46.000000000 +0000 @@ -489,18 +489,20 @@ static int tps23861_port_resistance(struct tps23861_data *data, int port) { - u16 regval; + unsigned int raw_val; + __le16 regval; regmap_bulk_read(data->regmap, PORT_1_RESISTANCE_LSB + PORT_N_RESISTANCE_LSB_OFFSET * (port - 1), ®val, 2); - switch (FIELD_GET(PORT_RESISTANCE_RSN_MASK, regval)) { + raw_val = le16_to_cpu(regval); + switch (FIELD_GET(PORT_RESISTANCE_RSN_MASK, raw_val)) { case PORT_RESISTANCE_RSN_OTHER: - return (FIELD_GET(PORT_RESISTANCE_MASK, regval) * RESISTANCE_LSB) / 10000; + return (FIELD_GET(PORT_RESISTANCE_MASK, raw_val) * RESISTANCE_LSB) / 10000; case PORT_RESISTANCE_RSN_LOW: - return (FIELD_GET(PORT_RESISTANCE_MASK, regval) * RESISTANCE_LSB_LOW) / 10000; + return (FIELD_GET(PORT_RESISTANCE_MASK, raw_val) * RESISTANCE_LSB_LOW) / 10000; case PORT_RESISTANCE_RSN_SHORT: case PORT_RESISTANCE_RSN_OPEN: default: diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-davinci.c linux-aws-5.19.0/drivers/i2c/busses/i2c-davinci.c --- linux-aws-5.19.0/drivers/i2c/busses/i2c-davinci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-davinci.c 2022-11-29 07:06:46.000000000 +0000 @@ -823,7 +823,7 @@ r = pm_runtime_resume_and_get(dev->dev); if (r < 0) { dev_err(dev->dev, "failed to runtime_get device: %d\n", r); - return r; + goto err_pm; } i2c_davinci_init(dev); @@ -882,6 +882,7 @@ err_unuse_clocks: pm_runtime_dont_use_autosuspend(dev->dev); pm_runtime_put_sync(dev->dev); +err_pm: pm_runtime_disable(dev->dev); return r; diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-core.h linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-core.h --- linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-core.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-core.h 2022-11-29 07:06:46.000000000 +0000 @@ -126,8 +126,9 @@ * status codes */ #define STATUS_IDLE 0x0 -#define STATUS_WRITE_IN_PROGRESS 0x1 -#define STATUS_READ_IN_PROGRESS 0x2 +#define STATUS_ACTIVE 0x1 +#define STATUS_WRITE_IN_PROGRESS 0x2 +#define STATUS_READ_IN_PROGRESS 0x4 /* * operation modes @@ -334,12 +335,14 @@ static inline void __i2c_dw_enable(struct dw_i2c_dev *dev) { + dev->status |= STATUS_ACTIVE; regmap_write(dev->map, DW_IC_ENABLE, 1); } static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev) { regmap_write(dev->map, DW_IC_ENABLE, 0); + dev->status &= ~STATUS_ACTIVE; } void __i2c_dw_disable(struct dw_i2c_dev *dev); diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-master.c linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-master.c --- linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-master.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-master.c 2022-11-29 07:06:46.000000000 +0000 @@ -716,6 +716,19 @@ u32 stat; stat = i2c_dw_read_clear_intrbits(dev); + + if (!(dev->status & STATUS_ACTIVE)) { + /* + * Unexpected interrupt in driver point of view. State + * variables are either unset or stale so acknowledge and + * disable interrupts for suppressing further interrupts if + * interrupt really came from this HW (E.g. firmware has left + * the HW active). + */ + regmap_write(dev->map, DW_IC_INTR_MASK, 0); + return 0; + } + if (stat & DW_IC_INTR_TX_ABRT) { dev->cmd_err |= DW_IC_ERR_TX_ABRT; dev->status = STATUS_IDLE; diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-pcidrv.c linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-pcidrv.c --- linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-pcidrv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-designware-pcidrv.c 2022-11-29 07:06:46.000000000 +0000 @@ -27,7 +27,6 @@ #include "i2c-ccgx-ucsi.h" #define DRIVER_NAME "i2c-designware-pci" -#define AMD_CLK_RATE_HZ 100000 enum dw_pci_ctl_id_t { medfield, @@ -100,11 +99,6 @@ return 25000; } -static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) -{ - return AMD_CLK_RATE_HZ; -} - static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); @@ -126,15 +120,6 @@ return -ENODEV; } -static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) -{ - struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); - - dev->flags |= MODEL_AMD_NAVI_GPU; - dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; - return 0; -} - static int mrfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { /* @@ -159,6 +144,20 @@ return 100000; } +static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) +{ + return 100000; +} + +static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); + + dev->flags |= MODEL_AMD_NAVI_GPU; + dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; + return 0; +} + static struct dw_pci_controller dw_pci_controllers[] = { [medfield] = { .bus_num = -1, @@ -389,6 +388,7 @@ { PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake }, + /* AMD NAVI */ { PCI_VDEVICE(ATI, 0x7314), navi_amd }, { PCI_VDEVICE(ATI, 0x73a4), navi_amd }, { PCI_VDEVICE(ATI, 0x73e4), navi_amd }, diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-imx.c linux-aws-5.19.0/drivers/i2c/busses/i2c-imx.c --- linux-aws-5.19.0/drivers/i2c/busses/i2c-imx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-imx.c 2022-11-29 07:06:46.000000000 +0000 @@ -1583,7 +1583,7 @@ if (i2c_imx->dma) i2c_imx_dma_free(i2c_imx); - if (ret == 0) { + if (ret >= 0) { /* setup chip registers to defaults */ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); diff -Nru linux-aws-5.19.0/drivers/i2c/busses/i2c-mlxbf.c linux-aws-5.19.0/drivers/i2c/busses/i2c-mlxbf.c --- linux-aws-5.19.0/drivers/i2c/busses/i2c-mlxbf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/busses/i2c-mlxbf.c 2022-11-29 07:06:46.000000000 +0000 @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -63,13 +64,14 @@ */ #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000) /* Reference clock for Bluefield - 156 MHz. */ -#define MLXBF_I2C_PLL_IN_FREQ (156 * 1000 * 1000) +#define MLXBF_I2C_PLL_IN_FREQ 156250000ULL /* Constant used to determine the PLL frequency. */ -#define MLNXBF_I2C_COREPLL_CONST 16384 +#define MLNXBF_I2C_COREPLL_CONST 16384ULL + +#define MLXBF_I2C_FREQUENCY_1GHZ 1000000000ULL /* PLL registers. */ -#define MLXBF_I2C_CORE_PLL_REG0 0x0 #define MLXBF_I2C_CORE_PLL_REG1 0x4 #define MLXBF_I2C_CORE_PLL_REG2 0x8 @@ -181,22 +183,15 @@ #define MLXBF_I2C_COREPLL_FREQ MLXBF_I2C_TYU_PLL_OUT_FREQ /* Core PLL TYU configuration. */ -#define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(12, 0) -#define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(3, 0) -#define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(5, 0) - -#define MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT 3 -#define MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT 16 -#define MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT 20 +#define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(15, 3) +#define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(19, 16) +#define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(25, 20) /* Core PLL YU configuration. */ #define MLXBF_I2C_COREPLL_CORE_F_YU_MASK GENMASK(25, 0) #define MLXBF_I2C_COREPLL_CORE_OD_YU_MASK GENMASK(3, 0) -#define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(5, 0) +#define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(31, 26) -#define MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT 0 -#define MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT 1 -#define MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT 26 /* Core PLL frequency. */ static u64 mlxbf_i2c_corepll_frequency; @@ -311,6 +306,7 @@ * exact. */ #define MLXBF_I2C_SMBUS_TIMEOUT (300 * 1000) /* 300ms */ +#define MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT (300 * 1000) /* 300ms */ /* Encapsulates timing parameters. */ struct mlxbf_i2c_timings { @@ -479,8 +475,6 @@ #define MLXBF_I2C_MASK_8 GENMASK(7, 0) #define MLXBF_I2C_MASK_16 GENMASK(15, 0) -#define MLXBF_I2C_FREQUENCY_1GHZ 1000000000 - /* * Function to poll a set of bits at a specific address; it checks whether * the bits are equal to zero when eq_zero is set to 'true', and not equal @@ -521,6 +515,25 @@ return false; } +/* + * wait for the lock to be released before acquiring it. + */ +static bool mlxbf_i2c_smbus_master_lock(struct mlxbf_i2c_priv *priv) +{ + if (mlxbf_smbus_poll(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, + MLXBF_I2C_MASTER_LOCK_BIT, true, + MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT)) + return true; + + return false; +} + +static void mlxbf_i2c_smbus_master_unlock(struct mlxbf_i2c_priv *priv) +{ + /* Clear the gw to clear the lock */ + writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW); +} + static bool mlxbf_i2c_smbus_transaction_success(u32 master_status, u32 cause_status) { @@ -669,7 +682,7 @@ /* Clear status bits. */ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS); /* Set the cause data. */ - writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR); + writel(~0x0, priv->mst_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); /* Zero PEC byte. */ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC); /* Zero byte count. */ @@ -712,10 +725,19 @@ slave = request->slave & GENMASK(6, 0); addr = slave << 1; - /* First of all, check whether the HW is idle. */ - if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) + /* + * Try to acquire the smbus gw lock before any reads of the GW register since + * a read sets the lock. + */ + if (WARN_ON(!mlxbf_i2c_smbus_master_lock(priv))) return -EBUSY; + /* Check whether the HW is idle */ + if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) { + ret = -EBUSY; + goto out_unlock; + } + /* Set first byte. */ data_desc[data_idx++] = addr; @@ -738,6 +760,11 @@ if (flags & MLXBF_I2C_F_WRITE) { write_en = 1; write_len += operation->length; + if (data_idx + operation->length > + MLXBF_I2C_MASTER_DATA_DESC_SIZE) { + ret = -ENOBUFS; + goto out_unlock; + } memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length; @@ -769,7 +796,7 @@ ret = mlxbf_i2c_smbus_enable(priv, slave, write_len, block_en, pec_en, 0); if (ret) - return ret; + goto out_unlock; } if (read_en) { @@ -796,6 +823,9 @@ priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); } +out_unlock: + mlxbf_i2c_smbus_master_unlock(priv); + return ret; } @@ -1407,24 +1437,19 @@ return 0; } -static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) +static u64 mlxbf_i2c_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) { - u64 core_frequency, pad_frequency; + u64 core_frequency; u8 core_od, core_r; u32 corepll_val; u16 core_f; - pad_frequency = MLXBF_I2C_PLL_IN_FREQ; - corepll_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); /* Get Core PLL configuration bits. */ - core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_F_TYU_MASK; - core_od = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK; - core_r = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_R_TYU_MASK; + core_f = FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_TYU_MASK, corepll_val); + core_od = FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK, corepll_val); + core_r = FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_TYU_MASK, corepll_val); /* * Compute PLL output frequency as follow: @@ -1436,31 +1461,26 @@ * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency * and PadFrequency, respectively. */ - core_frequency = pad_frequency * (++core_f); + core_frequency = MLXBF_I2C_PLL_IN_FREQ * (++core_f); core_frequency /= (++core_r) * (++core_od); return core_frequency; } -static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) +static u64 mlxbf_i2c_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) { u32 corepll_reg1_val, corepll_reg2_val; - u64 corepll_frequency, pad_frequency; + u64 corepll_frequency; u8 core_od, core_r; u32 core_f; - pad_frequency = MLXBF_I2C_PLL_IN_FREQ; - corepll_reg1_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); corepll_reg2_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2); /* Get Core PLL configuration bits */ - core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_F_YU_MASK; - core_r = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_R_YU_MASK; - core_od = rol32(corepll_reg2_val, MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT) & - MLXBF_I2C_COREPLL_CORE_OD_YU_MASK; + core_f = FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_YU_MASK, corepll_reg1_val); + core_r = FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_YU_MASK, corepll_reg1_val); + core_od = FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_YU_MASK, corepll_reg2_val); /* * Compute PLL output frequency as follow: @@ -1472,7 +1492,7 @@ * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency * and PadFrequency, respectively. */ - corepll_frequency = (pad_frequency * core_f) / MLNXBF_I2C_COREPLL_CONST; + corepll_frequency = (MLXBF_I2C_PLL_IN_FREQ * core_f) / MLNXBF_I2C_COREPLL_CONST; corepll_frequency /= (++core_r) * (++core_od); return corepll_frequency; @@ -2180,14 +2200,14 @@ [1] = &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_1], [2] = &mlxbf_i2c_gpio_res[MLXBF_I2C_CHIP_TYPE_1] }, - .calculate_freq = mlxbf_calculate_freq_from_tyu + .calculate_freq = mlxbf_i2c_calculate_freq_from_tyu }, [MLXBF_I2C_CHIP_TYPE_2] = { .type = MLXBF_I2C_CHIP_TYPE_2, .shared_res = { [0] = &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_2] }, - .calculate_freq = mlxbf_calculate_freq_from_yu + .calculate_freq = mlxbf_i2c_calculate_freq_from_yu } }; diff -Nru linux-aws-5.19.0/drivers/i2c/i2c-mux.c linux-aws-5.19.0/drivers/i2c/i2c-mux.c --- linux-aws-5.19.0/drivers/i2c/i2c-mux.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/i2c/i2c-mux.c 2022-11-29 07:06:46.000000000 +0000 @@ -243,9 +243,10 @@ int (*deselect)(struct i2c_mux_core *, u32)) { struct i2c_mux_core *muxc; + size_t mux_size; - muxc = devm_kzalloc(dev, struct_size(muxc, adapter, max_adapters) - + sizeof_priv, GFP_KERNEL); + mux_size = struct_size(muxc, adapter, max_adapters); + muxc = devm_kzalloc(dev, size_add(mux_size, sizeof_priv), GFP_KERNEL); if (!muxc) return NULL; if (sizeof_priv) diff -Nru linux-aws-5.19.0/drivers/iio/adc/ad7292.c linux-aws-5.19.0/drivers/iio/adc/ad7292.c --- linux-aws-5.19.0/drivers/iio/adc/ad7292.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/adc/ad7292.c 2022-11-29 07:06:46.000000000 +0000 @@ -287,10 +287,8 @@ ret = devm_add_action_or_reset(&spi->dev, ad7292_regulator_disable, st); - if (ret) { - regulator_disable(st->reg); + if (ret) return ret; - } ret = regulator_get_voltage(st->reg); if (ret < 0) diff -Nru linux-aws-5.19.0/drivers/iio/adc/ad7923.c linux-aws-5.19.0/drivers/iio/adc/ad7923.c --- linux-aws-5.19.0/drivers/iio/adc/ad7923.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/adc/ad7923.c 2022-11-29 07:06:46.000000000 +0000 @@ -93,6 +93,7 @@ .sign = 'u', \ .realbits = (bits), \ .storagebits = 16, \ + .shift = 12 - (bits), \ .endianness = IIO_BE, \ }, \ } @@ -268,7 +269,8 @@ return ret; if (chan->address == EXTRACT(ret, 12, 4)) - *val = EXTRACT(ret, 0, 12); + *val = EXTRACT(ret, chan->scan_type.shift, + chan->scan_type.realbits); else return -EIO; diff -Nru linux-aws-5.19.0/drivers/iio/adc/at91-sama5d2_adc.c linux-aws-5.19.0/drivers/iio/adc/at91-sama5d2_adc.c --- linux-aws-5.19.0/drivers/iio/adc/at91-sama5d2_adc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/adc/at91-sama5d2_adc.c 2022-11-29 07:06:46.000000000 +0000 @@ -77,7 +77,7 @@ #define AT91_SAMA5D2_MR_ANACH BIT(23) /* Tracking Time */ #define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24) -#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff +#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf /* Transfer Time */ #define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28) #define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3 @@ -1542,10 +1542,12 @@ ret = at91_adc_read_position(st, chan->channel, &tmp_val); *val = tmp_val; + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); - return at91_adc_adjust_val_osr(st, val); + return ret; } if (chan->type == IIO_PRESSURE) { ret = iio_device_claim_direct_mode(indio_dev); @@ -1556,10 +1558,12 @@ ret = at91_adc_read_pressure(st, chan->channel, &tmp_val); *val = tmp_val; + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); - return at91_adc_adjust_val_osr(st, val); + return ret; } /* in this case we have a voltage channel */ @@ -1646,16 +1650,20 @@ /* if no change, optimize out */ if (val == st->oversampling_ratio) return 0; + mutex_lock(&st->lock); st->oversampling_ratio = val; /* update ratio */ at91_adc_config_emr(st); + mutex_unlock(&st->lock); return 0; case IIO_CHAN_INFO_SAMP_FREQ: if (val < st->soc_info.min_sample_rate || val > st->soc_info.max_sample_rate) return -EINVAL; + mutex_lock(&st->lock); at91_adc_setup_samp_freq(indio_dev, val); + mutex_unlock(&st->lock); return 0; default: return -EINVAL; @@ -2108,6 +2116,9 @@ struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + at91_adc_buffer_postdisable(indio_dev); + /* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC @@ -2151,14 +2162,11 @@ if (!iio_buffer_enabled(indio_dev)) return 0; - /* check if we are enabling triggered buffer or the touchscreen */ - if (at91_adc_current_chan_is_touch(indio_dev)) - return at91_adc_configure_touch(st, true); - else - return at91_adc_configure_trigger(st->trig, true); + ret = at91_adc_buffer_prepare(indio_dev); + if (ret) + goto vref_disable_resume; - /* not needed but more explicit */ - return 0; + return at91_adc_configure_trigger(st->trig, true); vref_disable_resume: regulator_disable(st->vref); diff -Nru linux-aws-5.19.0/drivers/iio/adc/ltc2497.c linux-aws-5.19.0/drivers/iio/adc/ltc2497.c --- linux-aws-5.19.0/drivers/iio/adc/ltc2497.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/adc/ltc2497.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,6 +41,19 @@ } *val = (be32_to_cpu(st->buf) >> 14) - (1 << 17); + + /* + * The part started a new conversion at the end of the above i2c + * transfer, so if the address didn't change since the last call + * everything is fine and we can return early. + * If not (which should only happen when some sort of bulk + * conversion is implemented) we have to program the new + * address. Note that this probably fails as the conversion that + * was triggered above is like not complete yet and the two + * operations have to be done in a single transfer. + */ + if (ddata->addr_prev == address) + return 0; } ret = i2c_smbus_write_byte(st->client, diff -Nru linux-aws-5.19.0/drivers/iio/adc/mcp3911.c linux-aws-5.19.0/drivers/iio/adc/mcp3911.c --- linux-aws-5.19.0/drivers/iio/adc/mcp3911.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/adc/mcp3911.c 2022-11-29 07:06:46.000000000 +0000 @@ -40,8 +40,8 @@ #define MCP3911_CHANNEL(x) (MCP3911_REG_CHANNEL0 + x * 3) #define MCP3911_OFFCAL(x) (MCP3911_REG_OFFCAL_CH0 + x * 6) -/* Internal voltage reference in uV */ -#define MCP3911_INT_VREF_UV 1200000 +/* Internal voltage reference in mV */ +#define MCP3911_INT_VREF_MV 1200 #define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff) #define MCP3911_REG_WRITE(reg, id) ((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff) @@ -113,6 +113,8 @@ if (ret) goto out; + *val = sign_extend32(*val, 23); + ret = IIO_VAL_INT; break; @@ -137,11 +139,18 @@ *val = ret / 1000; } else { - *val = MCP3911_INT_VREF_UV; + *val = MCP3911_INT_VREF_MV; } - *val2 = 24; - ret = IIO_VAL_FRACTIONAL_LOG2; + /* + * For 24bit Conversion + * Raw = ((Voltage)/(Vref) * 2^23 * Gain * 1.5 + * Voltage = Raw * (Vref)/(2^23 * Gain * 1.5) + */ + + /* val2 = (2^23 * 1.5) */ + *val2 = 12582912; + ret = IIO_VAL_FRACTIONAL; break; } @@ -208,7 +217,14 @@ u32 configreg; int ret; - device_property_read_u32(dev, "device-addr", &adc->dev_addr); + ret = device_property_read_u32(dev, "microchip,device-addr", &adc->dev_addr); + + /* + * Fallback to "device-addr" due to historical mismatch between + * dt-bindings and implementation + */ + if (ret) + device_property_read_u32(dev, "device-addr", &adc->dev_addr); if (adc->dev_addr > 3) { dev_err(&adc->spi->dev, "invalid device address (%i). Must be in range 0-3.\n", diff -Nru linux-aws-5.19.0/drivers/iio/dac/ad5593r.c linux-aws-5.19.0/drivers/iio/dac/ad5593r.c --- linux-aws-5.19.0/drivers/iio/dac/ad5593r.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/dac/ad5593r.c 2022-11-29 07:06:46.000000000 +0000 @@ -13,6 +13,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -20,6 +22,24 @@ #define AD5593R_MODE_GPIO_READBACK (6 << 4) #define AD5593R_MODE_REG_READBACK (7 << 4) +static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value) +{ + int ret; + u8 buf[2]; + + ret = i2c_smbus_write_byte(i2c, reg); + if (ret < 0) + return ret; + + ret = i2c_master_recv(i2c, buf, sizeof(buf)); + if (ret < 0) + return ret; + + *value = get_unaligned_be16(buf); + + return 0; +} + static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) { struct i2c_client *i2c = to_i2c_client(st->dev); @@ -38,13 +58,7 @@ if (val < 0) return (int) val; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_ADC_READBACK); - if (val < 0) - return (int) val; - - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_ADC_READBACK, value); } static int ad5593r_reg_write(struct ad5592r_state *st, u8 reg, u16 value) @@ -58,25 +72,19 @@ static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; - - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg); - if (val < 0) - return (int) val; - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value); } static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; + u16 val; + int ret; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK); - if (val < 0) - return (int) val; + ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val); + if (ret) + return ret; *value = (u8) val; diff -Nru linux-aws-5.19.0/drivers/iio/inkern.c linux-aws-5.19.0/drivers/iio/inkern.c --- linux-aws-5.19.0/drivers/iio/inkern.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/inkern.c 2022-11-29 07:06:46.000000000 +0000 @@ -165,9 +165,10 @@ idev = bus_find_device(&iio_bus_type, NULL, iiospec.np, iio_dev_node_match); - of_node_put(iiospec.np); - if (idev == NULL) + if (idev == NULL) { + of_node_put(iiospec.np); return -EPROBE_DEFER; + } indio_dev = dev_to_iio_dev(idev); channel->indio_dev = indio_dev; @@ -175,6 +176,7 @@ index = indio_dev->info->of_xlate(indio_dev, &iiospec); else index = __of_iio_simple_xlate(indio_dev, &iiospec); + of_node_put(iiospec.np); if (index < 0) goto err_put; channel->channel = &indio_dev->channels[index]; @@ -410,6 +412,8 @@ channel = of_iio_channel_get_by_name(np, channel_name); if (IS_ERR(channel)) return channel; + if (!channel) + return ERR_PTR(-ENODEV); ret = devm_add_action_or_reset(dev, devm_iio_channel_free, channel); if (ret) diff -Nru linux-aws-5.19.0/drivers/iio/light/cm3605.c linux-aws-5.19.0/drivers/iio/light/cm3605.c --- linux-aws-5.19.0/drivers/iio/light/cm3605.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/light/cm3605.c 2022-11-29 07:06:46.000000000 +0000 @@ -226,8 +226,10 @@ } irq = platform_get_irq(pdev, 0); - if (irq < 0) - return dev_err_probe(dev, irq, "failed to get irq\n"); + if (irq < 0) { + ret = dev_err_probe(dev, irq, "failed to get irq\n"); + goto out_disable_aset; + } ret = devm_request_threaded_irq(dev, irq, cm3605_prox_irq, NULL, 0, "cm3605", indio_dev); diff -Nru linux-aws-5.19.0/drivers/iio/magnetometer/yamaha-yas530.c linux-aws-5.19.0/drivers/iio/magnetometer/yamaha-yas530.c --- linux-aws-5.19.0/drivers/iio/magnetometer/yamaha-yas530.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/magnetometer/yamaha-yas530.c 2022-11-29 07:06:46.000000000 +0000 @@ -132,7 +132,7 @@ unsigned int version; char name[16]; struct yas5xx_calibration calibration; - u8 hard_offsets[3]; + s8 hard_offsets[3]; struct iio_mount_matrix orientation; struct regmap *map; struct regulator_bulk_data regs[2]; diff -Nru linux-aws-5.19.0/drivers/iio/pressure/dps310.c linux-aws-5.19.0/drivers/iio/pressure/dps310.c --- linux-aws-5.19.0/drivers/iio/pressure/dps310.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iio/pressure/dps310.c 2022-11-29 07:06:46.000000000 +0000 @@ -89,6 +89,7 @@ s32 c00, c10, c20, c30, c01, c11, c21; s32 pressure_raw; s32 temp_raw; + bool timeout_recovery_failed; }; static const struct iio_chan_spec dps310_channels[] = { @@ -159,6 +160,102 @@ return 0; } +/* + * Some versions of the chip will read temperatures in the ~60C range when + * it's actually ~20C. This is the manufacturer recommended workaround + * to correct the issue. The registers used below are undocumented. + */ +static int dps310_temp_workaround(struct dps310_data *data) +{ + int rc; + int reg; + + rc = regmap_read(data->regmap, 0x32, ®); + if (rc) + return rc; + + /* + * If bit 1 is set then the device is okay, and the workaround does not + * need to be applied + */ + if (reg & BIT(1)) + return 0; + + rc = regmap_write(data->regmap, 0x0e, 0xA5); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0f, 0x96); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x62, 0x02); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0e, 0x00); + if (rc) + return rc; + + return regmap_write(data->regmap, 0x0f, 0x00); +} + +static int dps310_startup(struct dps310_data *data) +{ + int rc; + int ready; + + /* + * Set up pressure sensor in single sample, one measurement per second + * mode + */ + rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); + if (rc) + return rc; + + /* + * Set up external (MEMS) temperature sensor in single sample, one + * measurement per second mode + */ + rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); + if (rc) + return rc; + + /* Temp and pressure shifts are disabled when PRC <= 8 */ + rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, + DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); + if (rc) + return rc; + + /* MEAS_CFG doesn't update correctly unless first written with 0 */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, 0); + if (rc) + return rc; + + /* Turn on temperature and pressure measurement in the background */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | + DPS310_TEMP_EN | DPS310_BACKGROUND); + if (rc) + return rc; + + /* + * Calibration coefficients required for reporting temperature. + * They are available 40ms after the device has started + */ + rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, + ready & DPS310_COEF_RDY, 10000, 40000); + if (rc) + return rc; + + rc = dps310_get_coefs(data); + if (rc) + return rc; + + return dps310_temp_workaround(data); +} + static int dps310_get_pres_precision(struct dps310_data *data) { int rc; @@ -297,11 +394,69 @@ return scale_factors[ilog2(rc)]; } +static int dps310_reset_wait(struct dps310_data *data) +{ + int rc; + + rc = regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + if (rc) + return rc; + + /* Wait for device chip access: 2.5ms in specification */ + usleep_range(2500, 12000); + return 0; +} + +static int dps310_reset_reinit(struct dps310_data *data) +{ + int rc; + + rc = dps310_reset_wait(data); + if (rc) + return rc; + + return dps310_startup(data); +} + +static int dps310_ready_status(struct dps310_data *data, int ready_bit, int timeout) +{ + int sleep = DPS310_POLL_SLEEP_US(timeout); + int ready; + + return regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, ready & ready_bit, + sleep, timeout); +} + +static int dps310_ready(struct dps310_data *data, int ready_bit, int timeout) +{ + int rc; + + rc = dps310_ready_status(data, ready_bit, timeout); + if (rc) { + if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) { + /* Reset and reinitialize the chip. */ + if (dps310_reset_reinit(data)) { + data->timeout_recovery_failed = true; + } else { + /* Try again to get sensor ready status. */ + if (dps310_ready_status(data, ready_bit, timeout)) + data->timeout_recovery_failed = true; + else + return 0; + } + } + + return rc; + } + + data->timeout_recovery_failed = false; + return 0; +} + static int dps310_read_pres_raw(struct dps310_data *data) { int rc; int rate; - int ready; int timeout; s32 raw; u8 val[3]; @@ -313,9 +468,7 @@ timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_PRS_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); + rc = dps310_ready(data, DPS310_PRS_RDY, timeout); if (rc) goto done; @@ -352,7 +505,6 @@ { int rc; int rate; - int ready; int timeout; if (mutex_lock_interruptible(&data->lock)) @@ -362,10 +514,8 @@ timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_TMP_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); - if (rc < 0) + rc = dps310_ready(data, DPS310_TMP_RDY, timeout); + if (rc) goto done; rc = dps310_read_temp_ready(data); @@ -660,7 +810,7 @@ { struct dps310_data *data = action_data; - regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + dps310_reset_wait(data); } static const struct regmap_config dps310_regmap_config = { @@ -677,52 +827,12 @@ .write_raw = dps310_write_raw, }; -/* - * Some verions of chip will read temperatures in the ~60C range when - * its actually ~20C. This is the manufacturer recommended workaround - * to correct the issue. The registers used below are undocumented. - */ -static int dps310_temp_workaround(struct dps310_data *data) -{ - int rc; - int reg; - - rc = regmap_read(data->regmap, 0x32, ®); - if (rc < 0) - return rc; - - /* - * If bit 1 is set then the device is okay, and the workaround does not - * need to be applied - */ - if (reg & BIT(1)) - return 0; - - rc = regmap_write(data->regmap, 0x0e, 0xA5); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0f, 0x96); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x62, 0x02); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0e, 0x00); - if (rc < 0) - return rc; - - return regmap_write(data->regmap, 0x0f, 0x00); -} - static int dps310_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct dps310_data *data; struct iio_dev *iio; - int rc, ready; + int rc; iio = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!iio) @@ -747,54 +857,8 @@ if (rc) return rc; - /* - * Set up pressure sensor in single sample, one measurement per second - * mode - */ - rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); - - /* - * Set up external (MEMS) temperature sensor in single sample, one - * measurement per second mode - */ - rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); - if (rc < 0) - return rc; - - /* Temp and pressure shifts are disabled when PRC <= 8 */ - rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, - DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); - if (rc < 0) - return rc; - - /* MEAS_CFG doesn't update correctly unless first written with 0 */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, 0); - if (rc < 0) - return rc; - - /* Turn on temperature and pressure measurement in the background */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | - DPS310_TEMP_EN | DPS310_BACKGROUND); - if (rc < 0) - return rc; - - /* - * Calibration coefficients required for reporting temperature. - * They are available 40ms after the device has started - */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_COEF_RDY, 10000, 40000); - if (rc < 0) - return rc; - - rc = dps310_get_coefs(data); - if (rc < 0) - return rc; - - rc = dps310_temp_workaround(data); - if (rc < 0) + rc = dps310_startup(data); + if (rc) return rc; rc = devm_iio_device_register(&client->dev, iio); diff -Nru linux-aws-5.19.0/drivers/infiniband/core/cma.c linux-aws-5.19.0/drivers/infiniband/core/cma.c --- linux-aws-5.19.0/drivers/infiniband/core/cma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/core/cma.c 2022-11-29 07:06:46.000000000 +0000 @@ -1719,8 +1719,8 @@ } if (!validate_net_dev(*net_dev, - (struct sockaddr *)&req->listen_addr_storage, - (struct sockaddr *)&req->src_addr_storage)) { + (struct sockaddr *)&req->src_addr_storage, + (struct sockaddr *)&req->listen_addr_storage)) { id_priv = ERR_PTR(-EHOSTUNREACH); goto err; } diff -Nru linux-aws-5.19.0/drivers/infiniband/core/cm.c linux-aws-5.19.0/drivers/infiniband/core/cm.c --- linux-aws-5.19.0/drivers/infiniband/core/cm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/core/cm.c 2022-11-29 07:06:46.000000000 +0000 @@ -1632,14 +1632,13 @@ static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { u32 lid; if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { - sa_path_set_dlid(primary_path, - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, - req_msg)); + sa_path_set_dlid(primary_path, wc->slid); sa_path_set_slid(primary_path, IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg)); @@ -1676,7 +1675,8 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); @@ -1734,7 +1734,7 @@ if (sa_path_is_roce(alt_path)) alt_path->roce.route_resolved = false; } - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); } static u16 cm_get_bth_pkey(struct cm_work *work) @@ -2148,7 +2148,7 @@ if (cm_req_has_alt_path(req_msg)) work->path[1].rec_type = work->path[0].rec_type; cm_format_paths_from_req(req_msg, &work->path[0], - &work->path[1]); + &work->path[1], work->mad_recv_wc->wc); if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) sa_path_set_dmac(&work->path[0], cm_id_priv->av.ah_attr.roce.dmac); diff -Nru linux-aws-5.19.0/drivers/infiniband/core/umem_odp.c linux-aws-5.19.0/drivers/infiniband/core/umem_odp.c --- linux-aws-5.19.0/drivers/infiniband/core/umem_odp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/core/umem_odp.c 2022-11-29 07:06:46.000000000 +0000 @@ -462,7 +462,7 @@ mutex_unlock(&umem_odp->umem_mutex); out_put_mm: - mmput(owning_mm); + mmput_async(owning_mm); out_put_task: if (owning_process) put_task_struct(owning_process); diff -Nru linux-aws-5.19.0/drivers/infiniband/core/uverbs_cmd.c linux-aws-5.19.0/drivers/infiniband/core/uverbs_cmd.c --- linux-aws-5.19.0/drivers/infiniband/core/uverbs_cmd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/core/uverbs_cmd.c 2022-11-29 07:06:46.000000000 +0000 @@ -739,6 +739,7 @@ mr->uobject = uobj; atomic_inc(&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_set_name(&mr->res, NULL); @@ -861,8 +862,10 @@ mr->pd = new_pd; atomic_inc(&new_pd->usecnt); } - if (cmd.flags & IB_MR_REREG_TRANS) + if (cmd.flags & IB_MR_REREG_TRANS) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } } memset(&resp, 0, sizeof(resp)); diff -Nru linux-aws-5.19.0/drivers/infiniband/core/verbs.c linux-aws-5.19.0/drivers/infiniband/core/verbs.c --- linux-aws-5.19.0/drivers/infiniband/core/verbs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/core/verbs.c 2022-11-29 07:06:46.000000000 +0000 @@ -2149,6 +2149,8 @@ mr->pd = pd; mr->dm = NULL; atomic_inc(&pd->usecnt); + mr->iova = virt_addr; + mr->length = length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_parent_name(&mr->res, &pd->res); diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_device.h linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_device.h --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_device.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_device.h 2022-11-29 07:06:46.000000000 +0000 @@ -730,7 +730,6 @@ u32 num_qps; u32 num_pi_qps; u32 reserved_qps; - int num_qpc_timer; u32 num_srqs; u32 max_wqes; u32 max_srq_wrs; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c 2022-11-29 07:06:46.000000000 +0000 @@ -1941,7 +1941,7 @@ caps->num_mtpts = HNS_ROCE_V2_MAX_MTPT_NUM; caps->num_pds = HNS_ROCE_V2_MAX_PD_NUM; - caps->num_qpc_timer = HNS_ROCE_V2_MAX_QPC_TIMER_NUM; + caps->qpc_timer_bt_num = HNS_ROCE_V2_MAX_QPC_TIMER_BT_NUM; caps->cqc_timer_bt_num = HNS_ROCE_V2_MAX_CQC_TIMER_BT_NUM; caps->max_qp_init_rdma = HNS_ROCE_V2_MAX_QP_INIT_RDMA; @@ -2237,7 +2237,6 @@ caps->max_rq_sg = le16_to_cpu(resp_a->max_rq_sg); caps->max_rq_sg = roundup_pow_of_two(caps->max_rq_sg); caps->max_extend_sg = le32_to_cpu(resp_a->max_extend_sg); - caps->num_qpc_timer = le16_to_cpu(resp_a->num_qpc_timer); caps->max_srq_sges = le16_to_cpu(resp_a->max_srq_sges); caps->max_srq_sges = roundup_pow_of_two(caps->max_srq_sges); caps->num_aeq_vectors = resp_a->num_aeq_vectors; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h 2022-11-29 07:06:46.000000000 +0000 @@ -36,11 +36,11 @@ #include #define HNS_ROCE_V2_MAX_QP_NUM 0x1000 -#define HNS_ROCE_V2_MAX_QPC_TIMER_NUM 0x200 #define HNS_ROCE_V2_MAX_WQE_NUM 0x8000 #define HNS_ROCE_V2_MAX_SRQ_WR 0x8000 #define HNS_ROCE_V2_MAX_SRQ_SGE 64 #define HNS_ROCE_V2_MAX_CQ_NUM 0x100000 +#define HNS_ROCE_V2_MAX_QPC_TIMER_BT_NUM 0x100 #define HNS_ROCE_V2_MAX_CQC_TIMER_BT_NUM 0x100 #define HNS_ROCE_V2_MAX_SRQ_NUM 0x100000 #define HNS_ROCE_V2_MAX_CQE_NUM 0x400000 @@ -83,7 +83,7 @@ #define HNS_ROCE_V2_QPC_TIMER_ENTRY_SZ PAGE_SIZE #define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ PAGE_SIZE -#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFFF000 +#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFF000 #define HNS_ROCE_V2_MAX_INNER_MTPT_NUM 2 #define HNS_ROCE_INVALID_LKEY 0x0 #define HNS_ROCE_INVALID_SGE_LENGTH 0x80000000 diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_main.c linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_main.c --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -725,7 +725,7 @@ ret = hns_roce_init_hem_table(hr_dev, &hr_dev->qpc_timer_table, HEM_TYPE_QPC_TIMER, hr_dev->caps.qpc_timer_entry_sz, - hr_dev->caps.num_qpc_timer, 1); + hr_dev->caps.qpc_timer_bt_num, 1); if (ret) { dev_err(dev, "Failed to init QPC timer memory, aborting.\n"); diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_mr.c linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_mr.c --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_mr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_mr.c 2022-11-29 07:06:46.000000000 +0000 @@ -249,7 +249,6 @@ goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length; return &mr->ibmr; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_qp.c linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_qp.c --- linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_qp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/hns/hns_roce_qp.c 2022-11-29 07:06:46.000000000 +0000 @@ -462,11 +462,8 @@ hr_qp->rq.max_gs = roundup_pow_of_two(max(1U, cap->max_recv_sge) + hr_qp->rq.rsv_sge); - if (hr_dev->caps.max_rq_sg <= HNS_ROCE_SGE_IN_WQE) - hr_qp->rq.wqe_shift = ilog2(hr_dev->caps.max_rq_desc_sz); - else - hr_qp->rq.wqe_shift = ilog2(hr_dev->caps.max_rq_desc_sz * - hr_qp->rq.max_gs); + hr_qp->rq.wqe_shift = ilog2(hr_dev->caps.max_rq_desc_sz * + hr_qp->rq.max_gs); hr_qp->rq.wqe_cnt = cnt; if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RQ_INLINE && diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/defs.h linux-aws-5.19.0/drivers/infiniband/hw/irdma/defs.h --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/defs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/defs.h 2022-11-29 07:06:46.000000000 +0000 @@ -314,6 +314,7 @@ #define IRDMA_AE_IB_REMOTE_ACCESS_ERROR 0x020d #define IRDMA_AE_IB_REMOTE_OP_ERROR 0x020e #define IRDMA_AE_WQE_LSMM_TOO_LONG 0x0220 +#define IRDMA_AE_INVALID_REQUEST 0x0223 #define IRDMA_AE_DDP_INVALID_MSN_GAP_IN_MSN 0x0301 #define IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER 0x0303 #define IRDMA_AE_DDP_UBE_INVALID_DDP_VERSION 0x0304 diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/hw.c linux-aws-5.19.0/drivers/infiniband/hw/irdma/hw.c --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/hw.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/hw.c 2022-11-29 07:06:46.000000000 +0000 @@ -138,59 +138,68 @@ qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; switch (info->ae_id) { - case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BOUNDS_VIOLATION: case IRDMA_AE_AMP_INVALID_STAG: - qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; - fallthrough; + case IRDMA_AE_AMP_RIGHTS_VIOLATION: + case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BAD_PD: - case IRDMA_AE_UDA_XMIT_BAD_PD: + case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_AMP_BAD_STAG_KEY: + case IRDMA_AE_AMP_BAD_STAG_INDEX: + case IRDMA_AE_AMP_TO_WRAP: + case IRDMA_AE_PRIV_OPERATION_DENIED: qp->flush_code = FLUSH_PROT_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_UDA_XMIT_BAD_PD: case IRDMA_AE_WQE_UNEXPECTED_OPCODE: qp->flush_code = FLUSH_LOC_QP_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; + break; + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: + case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_DDP_UBE_INVALID_MO: + case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: + qp->flush_code = FLUSH_LOC_LEN_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_AMP_BAD_STAG_KEY: - case IRDMA_AE_AMP_BAD_STAG_INDEX: - case IRDMA_AE_AMP_TO_WRAP: - case IRDMA_AE_AMP_RIGHTS_VIOLATION: case IRDMA_AE_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS: - case IRDMA_AE_PRIV_OPERATION_DENIED: - case IRDMA_AE_IB_INVALID_REQUEST: case IRDMA_AE_IB_REMOTE_ACCESS_ERROR: qp->flush_code = FLUSH_REM_ACCESS_ERR; qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; case IRDMA_AE_LLP_SEGMENT_TOO_SMALL: - case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: - case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: case IRDMA_AE_ROCE_RSP_LENGTH_ERROR: - qp->flush_code = FLUSH_LOC_LEN_ERR; + case IRDMA_AE_IB_REMOTE_OP_ERROR: + qp->flush_code = FLUSH_REM_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_LCE_QP_CATASTROPHIC: qp->flush_code = FLUSH_FATAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_DDP_UBE_INVALID_MO: case IRDMA_AE_IB_RREQ_AND_Q1_FULL: - case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: qp->flush_code = FLUSH_GENERAL_ERR; break; case IRDMA_AE_LLP_TOO_MANY_RETRIES: qp->flush_code = FLUSH_RETRY_EXC_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_AMP_MWBIND_INVALID_RIGHTS: case IRDMA_AE_AMP_MWBIND_BIND_DISABLED: case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS: qp->flush_code = FLUSH_MW_BIND_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_IB_REMOTE_OP_ERROR: - qp->flush_code = FLUSH_REM_OP_ERR; + case IRDMA_AE_IB_INVALID_REQUEST: + qp->flush_code = FLUSH_REM_INV_REQ_ERR; + qp->event_type = IRDMA_QP_EVENT_REQ_ERR; break; default: - qp->flush_code = FLUSH_FATAL_ERR; + qp->flush_code = FLUSH_GENERAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; } } diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/type.h linux-aws-5.19.0/drivers/infiniband/hw/irdma/type.h --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/type.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/type.h 2022-11-29 07:06:46.000000000 +0000 @@ -98,6 +98,7 @@ enum irdma_qp_event_type { IRDMA_QP_EVENT_CATASTROPHIC, IRDMA_QP_EVENT_ACCESS_ERR, + IRDMA_QP_EVENT_REQ_ERR, }; enum irdma_hw_stats_index_32b { diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/uk.c linux-aws-5.19.0/drivers/infiniband/hw/irdma/uk.c --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/uk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/uk.c 2022-11-29 07:06:46.000000000 +0000 @@ -497,7 +497,8 @@ FIELD_PREP(IRDMAQPSQ_IMMDATA, info->imm_data)); i = 0; } else { - qp->wqe_ops.iw_set_fragment(wqe, 0, op_info->sg_list, + qp->wqe_ops.iw_set_fragment(wqe, 0, + frag_cnt ? op_info->sg_list : NULL, qp->swqe_polarity); i = 1; } @@ -1005,6 +1006,7 @@ int ret_code; bool move_cq_head = true; u8 polarity; + u8 op_type; bool ext_valid; __le64 *ext_cqe; @@ -1187,7 +1189,6 @@ do { __le64 *sw_wqe; u64 wqe_qword; - u8 op_type; u32 tail; tail = qp->sq_ring.tail; @@ -1204,6 +1205,8 @@ break; } } while (1); + if (op_type == IRDMA_OP_TYPE_BIND_MW && info->minor_err == FLUSH_PROT_ERR) + info->minor_err = FLUSH_MW_BIND_ERR; qp->sq_flush_seen = true; if (!IRDMA_RING_MORE_WORK(qp->sq_ring)) qp->sq_flush_complete = true; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/user.h linux-aws-5.19.0/drivers/infiniband/hw/irdma/user.h --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/user.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/user.h 2022-11-29 07:06:46.000000000 +0000 @@ -103,6 +103,7 @@ FLUSH_FATAL_ERR, FLUSH_RETRY_EXC_ERR, FLUSH_MW_BIND_ERR, + FLUSH_REM_INV_REQ_ERR, }; enum irdma_cmpl_status { diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/utils.c linux-aws-5.19.0/drivers/infiniband/hw/irdma/utils.c --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/utils.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/utils.c 2022-11-29 07:06:46.000000000 +0000 @@ -590,11 +590,14 @@ cqp_error = cqp_request->compl_info.error; if (cqp_error) { err_code = -EIO; - if (cqp_request->compl_info.maj_err_code == 0xFFFF && - cqp_request->compl_info.min_err_code == 0x8029) { - if (!rf->reset) { - rf->reset = true; - rf->gen_ops.request_reset(rf); + if (cqp_request->compl_info.maj_err_code == 0xFFFF) { + if (cqp_request->compl_info.min_err_code == 0x8002) + err_code = -EBUSY; + else if (cqp_request->compl_info.min_err_code == 0x8029) { + if (!rf->reset) { + rf->reset = true; + rf->gen_ops.request_reset(rf); + } } } } @@ -2475,6 +2478,9 @@ case IRDMA_QP_EVENT_ACCESS_ERR: ibevent.event = IB_EVENT_QP_ACCESS_ERR; break; + case IRDMA_QP_EVENT_REQ_ERR: + ibevent.event = IB_EVENT_QP_REQ_ERR; + break; } ibevent.device = iwqp->ibqp.device; ibevent.element.qp = &iwqp->ibqp; @@ -2597,7 +2603,7 @@ spin_unlock_irqrestore(&iwqp->lock, flags2); spin_unlock_irqrestore(&iwqp->iwscq->lock, flags1); if (compl_generated) - irdma_comp_handler(iwqp->iwrcq); + irdma_comp_handler(iwqp->iwscq); } else { spin_unlock_irqrestore(&iwqp->iwscq->lock, flags1); mod_delayed_work(iwqp->iwdev->cleanup_wq, &iwqp->dwork_flush, diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/irdma/verbs.c linux-aws-5.19.0/drivers/infiniband/hw/irdma/verbs.c --- linux-aws-5.19.0/drivers/infiniband/hw/irdma/verbs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/irdma/verbs.c 2022-11-29 07:06:46.000000000 +0000 @@ -39,15 +39,18 @@ props->max_send_sge = hw_attrs->uk_attrs.max_hw_wq_frags; props->max_recv_sge = hw_attrs->uk_attrs.max_hw_wq_frags; props->max_cq = rf->max_cq - rf->used_cqs; - props->max_cqe = rf->max_cqe; + props->max_cqe = rf->max_cqe - 1; props->max_mr = rf->max_mr - rf->used_mrs; props->max_mw = props->max_mr; props->max_pd = rf->max_pd - rf->used_pds; props->max_sge_rd = hw_attrs->uk_attrs.max_hw_read_sges; props->max_qp_rd_atom = hw_attrs->max_hw_ird; props->max_qp_init_rd_atom = hw_attrs->max_hw_ord; - if (rdma_protocol_roce(ibdev, 1)) + if (rdma_protocol_roce(ibdev, 1)) { + props->device_cap_flags |= IB_DEVICE_RC_RNR_NAK_GEN; props->max_pkeys = IRDMA_PKEY_TBL_SZ; + } + props->max_ah = rf->max_ah; props->max_mcast_grp = rf->max_mcg; props->max_mcast_qp_attach = IRDMA_MAX_MGS_PER_CTX; @@ -296,13 +299,19 @@ static int irdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) { +#define IRDMA_ALLOC_UCTX_MIN_REQ_LEN offsetofend(struct irdma_alloc_ucontext_req, rsvd8) +#define IRDMA_ALLOC_UCTX_MIN_RESP_LEN offsetofend(struct irdma_alloc_ucontext_resp, rsvd) struct ib_device *ibdev = uctx->device; struct irdma_device *iwdev = to_iwdev(ibdev); - struct irdma_alloc_ucontext_req req; + struct irdma_alloc_ucontext_req req = {}; struct irdma_alloc_ucontext_resp uresp = {}; struct irdma_ucontext *ucontext = to_ucontext(uctx); struct irdma_uk_attrs *uk_attrs; + if (udata->inlen < IRDMA_ALLOC_UCTX_MIN_REQ_LEN || + udata->outlen < IRDMA_ALLOC_UCTX_MIN_RESP_LEN) + return -EINVAL; + if (ib_copy_from_udata(&req, udata, min(sizeof(req), udata->inlen))) return -EINVAL; @@ -314,7 +323,7 @@ uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; /* GEN_1 legacy support with libi40iw */ - if (udata->outlen < sizeof(uresp)) { + if (udata->outlen == IRDMA_ALLOC_UCTX_MIN_RESP_LEN) { if (uk_attrs->hw_rev != IRDMA_GEN_1) return -EOPNOTSUPP; @@ -386,6 +395,7 @@ */ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata) { +#define IRDMA_ALLOC_PD_MIN_RESP_LEN offsetofend(struct irdma_alloc_pd_resp, rsvd) struct irdma_pd *iwpd = to_iwpd(pd); struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -395,6 +405,9 @@ u32 pd_id = 0; int err; + if (udata && udata->outlen < IRDMA_ALLOC_PD_MIN_RESP_LEN) + return -EINVAL; + err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id, &rf->next_pd); if (err) @@ -811,12 +824,14 @@ struct ib_qp_init_attr *init_attr, struct ib_udata *udata) { +#define IRDMA_CREATE_QP_MIN_REQ_LEN offsetofend(struct irdma_create_qp_req, user_compl_ctx) +#define IRDMA_CREATE_QP_MIN_RESP_LEN offsetofend(struct irdma_create_qp_resp, rsvd) struct ib_pd *ibpd = ibqp->pd; struct irdma_pd *iwpd = to_iwpd(ibpd); struct irdma_device *iwdev = to_iwdev(ibpd->device); struct irdma_pci_f *rf = iwdev->rf; struct irdma_qp *iwqp = to_iwqp(ibqp); - struct irdma_create_qp_req req; + struct irdma_create_qp_req req = {}; struct irdma_create_qp_resp uresp = {}; u32 qp_num = 0; int err_code; @@ -833,6 +848,10 @@ if (err_code) return err_code; + if (udata && (udata->inlen < IRDMA_CREATE_QP_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_QP_MIN_RESP_LEN)) + return -EINVAL; + sq_size = init_attr->cap.max_send_wr; rq_size = init_attr->cap.max_recv_wr; @@ -1117,6 +1136,8 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_pd *iwpd = to_iwpd(ibqp->pd); struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; @@ -1135,6 +1156,13 @@ roce_info = &iwqp->roce_info; udp_info = &iwqp->udp_info; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1371,7 +1399,7 @@ if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1423,7 +1451,7 @@ } else { iwqp->ibqp_state = attr->qp_state; } - if (udata && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { + if (udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; ucontext = rdma_udata_to_drv_context(udata, @@ -1463,6 +1491,8 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -1477,6 +1507,13 @@ int err; unsigned long flags; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1562,7 +1599,7 @@ case IB_QPS_RESET: if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1659,7 +1696,7 @@ } } } - if (attr_mask & IB_QP_STATE && udata && + if (attr_mask & IB_QP_STATE && udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; @@ -1794,6 +1831,7 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) { +#define IRDMA_RESIZE_CQ_MIN_REQ_LEN offsetofend(struct irdma_resize_cq_req, user_cq_buffer) struct irdma_cq *iwcq = to_iwcq(ibcq); struct irdma_sc_dev *dev = iwcq->sc_cq.dev; struct irdma_cqp_request *cqp_request; @@ -1816,6 +1854,9 @@ IRDMA_FEATURE_CQ_RESIZE)) return -EOPNOTSUPP; + if (udata && udata->inlen < IRDMA_RESIZE_CQ_MIN_REQ_LEN) + return -EINVAL; + if (entries > rf->max_cqe) return -EINVAL; @@ -1948,6 +1989,8 @@ const struct ib_cq_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_CQ_MIN_REQ_LEN offsetofend(struct irdma_create_cq_req, user_cq_buf) +#define IRDMA_CREATE_CQ_MIN_RESP_LEN offsetofend(struct irdma_create_cq_resp, cq_size) struct ib_device *ibdev = ibcq->device; struct irdma_device *iwdev = to_iwdev(ibdev); struct irdma_pci_f *rf = iwdev->rf; @@ -1966,6 +2009,11 @@ err_code = cq_validate_flags(attr->flags, dev->hw_attrs.uk_attrs.hw_rev); if (err_code) return err_code; + + if (udata && (udata->inlen < IRDMA_CREATE_CQ_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_CQ_MIN_RESP_LEN)) + return -EINVAL; + err_code = irdma_alloc_rsrc(rf, rf->allocated_cqs, rf->max_cq, &cq_num, &rf->next_cq); if (err_code) @@ -2735,6 +2783,7 @@ u64 virt, int access, struct ib_udata *udata) { +#define IRDMA_MEM_REG_MIN_REQ_LEN offsetofend(struct irdma_mem_reg_req, sq_pages) struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_ucontext *ucontext; struct irdma_pble_alloc *palloc; @@ -2752,6 +2801,9 @@ if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) return ERR_PTR(-EINVAL); + if (udata->inlen < IRDMA_MEM_REG_MIN_REQ_LEN) + return ERR_PTR(-EINVAL); + region = ib_umem_get(pd->device, start, len, access); if (IS_ERR(region)) { @@ -3001,6 +3053,7 @@ struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc; struct irdma_cqp_request *cqp_request; struct cqp_cmds_info *cqp_info; + int status; if (iwmr->type != IRDMA_MEMREG_TYPE_MEM) { if (iwmr->region) { @@ -3031,8 +3084,11 @@ cqp_info->post_sq = 1; cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev; cqp_info->in.u.dealloc_stag.scratch = (uintptr_t)cqp_request; - irdma_handle_cqp_op(iwdev->rf, cqp_request); + status = irdma_handle_cqp_op(iwdev->rf, cqp_request); irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request); + if (status) + return status; + irdma_free_stag(iwdev, iwmr->stag); done: if (iwpbl->pbl_allocated) @@ -3300,6 +3356,8 @@ return IB_WC_RETRY_EXC_ERR; case FLUSH_MW_BIND_ERR: return IB_WC_MW_BIND_ERR; + case FLUSH_REM_INV_REQ_ERR: + return IB_WC_REM_INV_REQ_ERR; case FLUSH_FATAL_ERR: default: return IB_WC_FATAL_ERR; @@ -4281,12 +4339,16 @@ struct rdma_ah_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_AH_MIN_RESP_LEN offsetofend(struct irdma_create_ah_resp, rsvd) struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah); struct irdma_device *iwdev = to_iwdev(ibah->pd->device); struct irdma_create_ah_resp uresp; struct irdma_ah *parent_ah; int err; + if (udata && udata->outlen < IRDMA_CREATE_AH_MIN_RESP_LEN) + return -EINVAL; + err = irdma_setup_ah(ibah, attr); if (err) return err; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx4/mr.c linux-aws-5.19.0/drivers/infiniband/hw/mlx4/mr.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx4/mr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx4/mr.c 2022-11-29 07:06:46.000000000 +0000 @@ -439,7 +439,6 @@ goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size = 1U << shift; return &mr->ibmr; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/cq.c linux-aws-5.19.0/drivers/infiniband/hw/mlx5/cq.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/cq.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/cq.c 2022-11-29 07:06:46.000000000 +0000 @@ -523,6 +523,10 @@ "Requestor" : "Responder", cq->mcq.cqn); mlx5_ib_dbg(dev, "syndrome 0x%x, vendor syndrome 0x%x\n", err_cqe->syndrome, err_cqe->vendor_err_synd); + if (wc->status != IB_WC_WR_FLUSH_ERR && + (*cur_qp)->type == MLX5_IB_QPT_REG_UMR) + dev->umrc.state = MLX5_UMR_STATE_RECOVER; + if (opcode == MLX5_CQE_REQ_ERR) { wq = &(*cur_qp)->sq; wqe_ctr = be16_to_cpu(cqe64->wqe_counter); diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mad.c linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mad.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mad.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mad.c 2022-11-29 07:06:46.000000000 +0000 @@ -166,6 +166,12 @@ mdev = dev->mdev; mdev_port_num = 1; } + if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1) { + /* set local port to one for Function-Per-Port HCA. */ + mdev = dev->mdev; + mdev_port_num = 1; + } + /* Declaring support of extended counters */ if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) { struct ib_class_port_info cpi = {}; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/main.c linux-aws-5.19.0/drivers/infiniband/hw/mlx5/main.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1826,6 +1826,9 @@ if (MLX5_CAP_GEN(dev->mdev, drain_sigerr)) resp->comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS; + resp->comp_mask |= + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG; + return 0; } @@ -4336,7 +4339,7 @@ dev->mdev = mdev; dev->num_ports = num_ports; - if (ll == IB_LINK_LAYER_ETHERNET && !mlx5_is_roce_init_enabled(mdev)) + if (ll == IB_LINK_LAYER_ETHERNET && !mlx5_get_roce_state(mdev)) profile = &raw_eth_profile; else profile = &pf_profile; diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mlx5_ib.h linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mlx5_ib.h --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mlx5_ib.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/mlx5_ib.h 2022-11-29 07:06:46.000000000 +0000 @@ -717,13 +717,24 @@ struct completion done; }; +enum { + MLX5_UMR_STATE_UNINIT, + MLX5_UMR_STATE_ACTIVE, + MLX5_UMR_STATE_RECOVER, + MLX5_UMR_STATE_ERR, +}; + struct umr_common { struct ib_pd *pd; struct ib_cq *cq; struct ib_qp *qp; - /* control access to UMR QP + /* Protects from UMR QP overflow */ struct semaphore sem; + /* Protects from using UMR while the UMR is not active + */ + struct mutex lock; + unsigned int state; }; struct mlx5_cache_ent { diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/odp.c linux-aws-5.19.0/drivers/infiniband/hw/mlx5/odp.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/odp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/odp.c 2022-11-29 07:06:46.000000000 +0000 @@ -795,7 +795,8 @@ { if (!mmkey) return false; - if (mmkey->type == MLX5_MKEY_MW) + if (mmkey->type == MLX5_MKEY_MW || + mmkey->type == MLX5_MKEY_INDIRECT_DEVX) return mlx5_base_mkey(mmkey->key) == mlx5_base_mkey(key); return mmkey->key == key; } diff -Nru linux-aws-5.19.0/drivers/infiniband/hw/mlx5/umr.c linux-aws-5.19.0/drivers/infiniband/hw/mlx5/umr.c --- linux-aws-5.19.0/drivers/infiniband/hw/mlx5/umr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/hw/mlx5/umr.c 2022-11-29 07:06:46.000000000 +0000 @@ -176,6 +176,8 @@ dev->umrc.pd = pd; sema_init(&dev->umrc.sem, MAX_UMR_WR); + mutex_init(&dev->umrc.lock); + dev->umrc.state = MLX5_UMR_STATE_ACTIVE; return 0; @@ -190,11 +192,38 @@ void mlx5r_umr_resource_cleanup(struct mlx5_ib_dev *dev) { + if (dev->umrc.state == MLX5_UMR_STATE_UNINIT) + return; ib_destroy_qp(dev->umrc.qp); ib_free_cq(dev->umrc.cq); ib_dealloc_pd(dev->umrc.pd); } +static int mlx5r_umr_recover(struct mlx5_ib_dev *dev) +{ + struct umr_common *umrc = &dev->umrc; + struct ib_qp_attr attr; + int err; + + attr.qp_state = IB_QPS_RESET; + err = ib_modify_qp(umrc->qp, &attr, IB_QP_STATE); + if (err) { + mlx5_ib_dbg(dev, "Couldn't modify UMR QP\n"); + goto err; + } + + err = mlx5r_umr_qp_rst2rts(dev, umrc->qp); + if (err) + goto err; + + umrc->state = MLX5_UMR_STATE_ACTIVE; + return 0; + +err: + umrc->state = MLX5_UMR_STATE_ERR; + return err; +} + static int mlx5r_umr_post_send(struct ib_qp *ibqp, u32 mkey, struct ib_cqe *cqe, struct mlx5r_umr_wqe *wqe, bool with_data) { @@ -231,7 +260,7 @@ id.ib_cqe = cqe; mlx5r_finish_wqe(qp, ctrl, seg, size, cur_edge, idx, id.wr_id, 0, - MLX5_FENCE_MODE_NONE, MLX5_OPCODE_UMR); + MLX5_FENCE_MODE_INITIATOR_SMALL, MLX5_OPCODE_UMR); mlx5r_ring_db(qp, 1, ctrl); @@ -270,17 +299,49 @@ mlx5r_umr_init_context(&umr_context); down(&umrc->sem); - err = mlx5r_umr_post_send(umrc->qp, mkey, &umr_context.cqe, wqe, - with_data); - if (err) - mlx5_ib_warn(dev, "UMR post send failed, err %d\n", err); - else { - wait_for_completion(&umr_context.done); - if (umr_context.status != IB_WC_SUCCESS) { - mlx5_ib_warn(dev, "reg umr failed (%u)\n", - umr_context.status); + while (true) { + mutex_lock(&umrc->lock); + if (umrc->state == MLX5_UMR_STATE_ERR) { + mutex_unlock(&umrc->lock); err = -EFAULT; + break; + } + + if (umrc->state == MLX5_UMR_STATE_RECOVER) { + mutex_unlock(&umrc->lock); + usleep_range(3000, 5000); + continue; + } + + err = mlx5r_umr_post_send(umrc->qp, mkey, &umr_context.cqe, wqe, + with_data); + mutex_unlock(&umrc->lock); + if (err) { + mlx5_ib_warn(dev, "UMR post send failed, err %d\n", + err); + break; } + + wait_for_completion(&umr_context.done); + + if (umr_context.status == IB_WC_SUCCESS) + break; + + if (umr_context.status == IB_WC_WR_FLUSH_ERR) + continue; + + WARN_ON_ONCE(1); + mlx5_ib_warn(dev, + "reg umr failed (%u). Trying to recover and resubmit the flushed WQEs\n", + umr_context.status); + mutex_lock(&umrc->lock); + err = mlx5r_umr_recover(dev); + mutex_unlock(&umrc->lock); + if (err) + mlx5_ib_warn(dev, "couldn't recover UMR, err %d\n", + err); + err = -EFAULT; + break; } up(&umrc->sem); return err; diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_qp.c linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_qp.c --- linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_qp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_qp.c 2022-11-29 07:06:46.000000000 +0000 @@ -794,7 +794,9 @@ rxe_cleanup_task(&qp->comp.task); /* flush out any receive wr's or pending requests */ - __rxe_do_task(&qp->req.task); + if (qp->req.task.func) + __rxe_do_task(&qp->req.task); + if (qp->sq.queue) { __rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->req.task); @@ -830,8 +832,10 @@ free_rd_atomic_resources(qp); - kernel_sock_shutdown(qp->sk, SHUT_RDWR); - sock_release(qp->sk); + if (qp->sk) { + kernel_sock_shutdown(qp->sk, SHUT_RDWR); + sock_release(qp->sk); + } } /* called when the last reference to the qp is dropped */ diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_queue.c linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_queue.c --- linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_queue.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_queue.c 2022-11-29 07:06:46.000000000 +0000 @@ -112,23 +112,25 @@ unsigned int num_elem) { enum queue_type type = q->type; + u32 new_prod; u32 prod; u32 cons; if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) return -EINVAL; - prod = queue_get_producer(new_q, type); + new_prod = queue_get_producer(new_q, type); + prod = queue_get_producer(q, type); cons = queue_get_consumer(q, type); - while (!queue_empty(q, type)) { - memcpy(queue_addr_from_index(new_q, prod), + while ((prod - cons) & q->index_mask) { + memcpy(queue_addr_from_index(new_q, new_prod), queue_addr_from_index(q, cons), new_q->elem_size); - prod = queue_next_index(new_q, prod); + new_prod = queue_next_index(new_q, new_prod); cons = queue_next_index(q, cons); } - new_q->buf->producer_index = prod; + new_q->buf->producer_index = new_prod; q->buf->consumer_index = cons; /* update private index copies */ diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c --- linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c 2022-11-29 07:06:46.000000000 +0000 @@ -787,10 +787,8 @@ if (!skb) return RESPST_ERR_RNR; - err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), - payload, RXE_FROM_MR_OBJ); - if (err) - pr_err("Failed copying memory\n"); + rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), + payload, RXE_FROM_MR_OBJ); if (mr) rxe_put(mr); @@ -801,10 +799,8 @@ } err = rxe_xmit_packet(qp, &ack_pkt, skb); - if (err) { - pr_err("Failed sending RDMA reply.\n"); + if (err) return RESPST_ERR_RNR; - } res->read.va += payload; res->read.resid -= payload; diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/siw/siw.h linux-aws-5.19.0/drivers/infiniband/sw/siw/siw.h --- linux-aws-5.19.0/drivers/infiniband/sw/siw/siw.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/siw/siw.h 2022-11-29 07:06:46.000000000 +0000 @@ -418,6 +418,7 @@ struct ib_qp base_qp; struct siw_device *sdev; struct kref ref; + struct completion qp_free; struct list_head devq; int tx_cpu; struct siw_qp_attrs attrs; diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp.c linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp.c --- linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1342,6 +1342,6 @@ vfree(qp->orq); siw_put_tx_cpu(qp->tx_cpu); - + complete(&qp->qp_free); atomic_dec(&sdev->num_qp); } diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_rx.c linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_rx.c --- linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_rx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_rx.c 2022-11-29 07:06:46.000000000 +0000 @@ -961,27 +961,28 @@ static int siw_get_trailer(struct siw_qp *qp, struct siw_rx_stream *srx) { struct sk_buff *skb = srx->skb; + int avail = min(srx->skb_new, srx->fpdu_part_rem); u8 *tbuf = (u8 *)&srx->trailer.crc - srx->pad; __wsum crc_in, crc_own = 0; siw_dbg_qp(qp, "expected %d, available %d, pad %u\n", srx->fpdu_part_rem, srx->skb_new, srx->pad); - if (srx->skb_new < srx->fpdu_part_rem) - return -EAGAIN; - - skb_copy_bits(skb, srx->skb_offset, tbuf, srx->fpdu_part_rem); + skb_copy_bits(skb, srx->skb_offset, tbuf, avail); - if (srx->mpa_crc_hd && srx->pad) - crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); + srx->skb_new -= avail; + srx->skb_offset += avail; + srx->skb_copied += avail; + srx->fpdu_part_rem -= avail; - srx->skb_new -= srx->fpdu_part_rem; - srx->skb_offset += srx->fpdu_part_rem; - srx->skb_copied += srx->fpdu_part_rem; + if (srx->fpdu_part_rem) + return -EAGAIN; if (!srx->mpa_crc_hd) return 0; + if (srx->pad) + crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); /* * CRC32 is computed, transmitted and received directly in NBO, * so there's never a reason to convert byte order. @@ -1083,10 +1084,9 @@ * completely received. */ if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { - bytes = iwarp_pktinfo[opcode].hdr_len - MIN_DDP_HDR; + int hdrlen = iwarp_pktinfo[opcode].hdr_len; - if (srx->skb_new < bytes) - return -EAGAIN; + bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); skb_copy_bits(skb, srx->skb_offset, (char *)c_hdr + srx->fpdu_part_rcvd, bytes); @@ -1096,6 +1096,9 @@ srx->skb_new -= bytes; srx->skb_offset += bytes; srx->skb_copied += bytes; + + if (srx->fpdu_part_rcvd < hdrlen) + return -EAGAIN; } /* diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_tx.c linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_tx.c --- linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_tx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_qp_tx.c 2022-11-29 07:06:46.000000000 +0000 @@ -29,7 +29,7 @@ dma_addr_t paddr = siw_pbl_get_buffer(pbl, offset, NULL, idx); if (paddr) - return virt_to_page(paddr); + return virt_to_page((void *)paddr); return NULL; } @@ -533,13 +533,23 @@ kunmap_local(kaddr); } } else { - u64 va = sge->laddr + sge_off; - - page_array[seg] = virt_to_page(va & PAGE_MASK); + /* + * Cast to an uintptr_t to preserve all 64 bits + * in sge->laddr. + */ + uintptr_t va = (uintptr_t)(sge->laddr + sge_off); + + /* + * virt_to_page() takes a (void *) pointer + * so cast to a (void *) meaning it will be 64 + * bits on a 64 bit platform and 32 bits on a + * 32 bit platform. + */ + page_array[seg] = virt_to_page((void *)(va & PAGE_MASK)); if (do_crc) crypto_shash_update( c_tx->mpa_crc_hd, - (void *)(uintptr_t)va, + (void *)va, plen); } diff -Nru linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_verbs.c linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_verbs.c --- linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_verbs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/sw/siw/siw_verbs.c 2022-11-29 07:06:46.000000000 +0000 @@ -480,6 +480,8 @@ list_add_tail(&qp->devq, &sdev->qp_list); spin_unlock_irqrestore(&sdev->lock, flags); + init_completion(&qp->qp_free); + return 0; err_out_xa: @@ -624,6 +626,7 @@ qp->scq = qp->rcq = NULL; siw_qp_put(qp); + wait_for_completion(&qp->qp_free); return 0; } diff -Nru linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c --- linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-clt.c 2022-11-29 07:06:46.000000000 +0000 @@ -1004,7 +1004,8 @@ static int rtrs_post_rdma_write_sg(struct rtrs_clt_con *con, struct rtrs_clt_io_req *req, struct rtrs_rbuf *rbuf, bool fr_en, - u32 size, u32 imm, struct ib_send_wr *wr, + u32 count, u32 size, u32 imm, + struct ib_send_wr *wr, struct ib_send_wr *tail) { struct rtrs_clt_path *clt_path = to_clt_path(con->c.path); @@ -1024,12 +1025,12 @@ num_sge = 2; ptail = tail; } else { - for_each_sg(req->sglist, sg, req->sg_cnt, i) { + for_each_sg(req->sglist, sg, count, i) { sge[i].addr = sg_dma_address(sg); sge[i].length = sg_dma_len(sg); sge[i].lkey = clt_path->s.dev->ib_pd->local_dma_lkey; } - num_sge = 1 + req->sg_cnt; + num_sge = 1 + count; } sge[i].addr = req->iu->dma_addr; sge[i].length = size; @@ -1142,7 +1143,7 @@ */ rtrs_clt_update_all_stats(req, WRITE); - ret = rtrs_post_rdma_write_sg(req->con, req, rbuf, fr_en, + ret = rtrs_post_rdma_write_sg(req->con, req, rbuf, fr_en, count, req->usr_len + sizeof(*msg), imm, wr, &inv_wr); if (ret) { diff -Nru linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c --- linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/ulp/rtrs/rtrs-srv.c 2022-11-29 07:06:46.000000000 +0000 @@ -600,7 +600,7 @@ struct sg_table *sgt = &srv_mr->sgt; struct scatterlist *s; struct ib_mr *mr; - int nr, chunks; + int nr, nr_sgt, chunks; chunks = chunks_per_mr * mri; if (!always_invalidate) @@ -615,19 +615,19 @@ sg_set_page(s, srv->chunks[chunks + i], max_chunk_size, 0); - nr = ib_dma_map_sg(srv_path->s.dev->ib_dev, sgt->sgl, + nr_sgt = ib_dma_map_sg(srv_path->s.dev->ib_dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL); - if (nr < sgt->nents) { - err = nr < 0 ? nr : -EINVAL; + if (!nr_sgt) { + err = -EINVAL; goto free_sg; } mr = ib_alloc_mr(srv_path->s.dev->ib_pd, IB_MR_TYPE_MEM_REG, - sgt->nents); + nr_sgt); if (IS_ERR(mr)) { err = PTR_ERR(mr); goto unmap_sg; } - nr = ib_map_mr_sg(mr, sgt->sgl, sgt->nents, + nr = ib_map_mr_sg(mr, sgt->sgl, nr_sgt, NULL, max_chunk_size); if (nr < 0 || nr < sgt->nents) { err = nr < 0 ? nr : -EINVAL; @@ -646,7 +646,7 @@ } } /* Eventually dma addr for each chunk can be cached */ - for_each_sg(sgt->sgl, s, sgt->orig_nents, i) + for_each_sg(sgt->sgl, s, nr_sgt, i) srv_path->dma_addr[chunks + i] = sg_dma_address(s); ib_update_fast_reg_key(mr, ib_inc_rkey(mr->rkey)); diff -Nru linux-aws-5.19.0/drivers/infiniband/ulp/srp/ib_srp.c linux-aws-5.19.0/drivers/infiniband/ulp/srp/ib_srp.c --- linux-aws-5.19.0/drivers/infiniband/ulp/srp/ib_srp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/infiniband/ulp/srp/ib_srp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1962,7 +1962,8 @@ if (scmnd) { req = scsi_cmd_priv(scmnd); scmnd = srp_claim_req(ch, req, NULL, scmnd); - } else { + } + if (!scmnd) { shost_printk(KERN_ERR, target->scsi_host, "Null scmnd for RSP w/tag %#016llx received on ch %td / QP %#x\n", rsp->tag, ch - target->ch, ch->qp->qp_num); @@ -2789,7 +2790,7 @@ static int srp_abort(struct scsi_cmnd *scmnd) { struct srp_target_port *target = host_to_target(scmnd->device->host); - struct srp_request *req = (struct srp_request *) scmnd->host_scribble; + struct srp_request *req = scsi_cmd_priv(scmnd); u32 tag; u16 ch_idx; struct srp_rdma_ch *ch; @@ -2797,8 +2798,6 @@ shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); - if (!req) - return SUCCESS; tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd)); ch_idx = blk_mq_unique_tag_to_hwq(tag); if (WARN_ON_ONCE(ch_idx >= target->ch_count)) diff -Nru linux-aws-5.19.0/drivers/input/joystick/iforce/iforce.h linux-aws-5.19.0/drivers/input/joystick/iforce/iforce.h --- linux-aws-5.19.0/drivers/input/joystick/iforce/iforce.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/joystick/iforce/iforce.h 2022-11-29 07:06:46.000000000 +0000 @@ -119,6 +119,12 @@ response_data, response_len); } +static inline void iforce_clear_xmit_and_wake(struct iforce *iforce) +{ + clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); + wake_up_all(&iforce->wait); +} + /* Public functions */ /* iforce-main.c */ int iforce_init_device(struct device *parent, u16 bustype, diff -Nru linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-main.c linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-main.c --- linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-main.c 2022-11-29 07:06:46.000000000 +0000 @@ -50,6 +50,7 @@ { 0x046d, 0xc291, "Logitech WingMan Formula Force", btn_wheel, abs_wheel, ff_iforce }, { 0x05ef, 0x020a, "AVB Top Shot Pegasus", btn_joystick_avb, abs_avb_pegasus, ff_iforce }, { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_wheel, abs_wheel, ff_iforce }, + { 0x05ef, 0x8886, "Boeder Force Feedback Wheel", btn_wheel, abs_wheel, ff_iforce }, { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, diff -Nru linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-serio.c linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-serio.c --- linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-serio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-serio.c 2022-11-29 07:06:46.000000000 +0000 @@ -39,7 +39,7 @@ again: if (iforce->xmit.head == iforce->xmit.tail) { - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); + iforce_clear_xmit_and_wake(iforce); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return; } @@ -64,7 +64,7 @@ if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags)) goto again; - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); + iforce_clear_xmit_and_wake(iforce); spin_unlock_irqrestore(&iforce->xmit_lock, flags); } @@ -169,7 +169,7 @@ iforce_serio->cmd_response_len = iforce_serio->len; /* Signal that command is done */ - wake_up(&iforce->wait); + wake_up_all(&iforce->wait); } else if (likely(iforce->type)) { iforce_process_packet(iforce, iforce_serio->id, iforce_serio->data_in, diff -Nru linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-usb.c linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-usb.c --- linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-usb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/joystick/iforce/iforce-usb.c 2022-11-29 07:06:46.000000000 +0000 @@ -30,7 +30,7 @@ spin_lock_irqsave(&iforce->xmit_lock, flags); if (iforce->xmit.head == iforce->xmit.tail) { - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); + iforce_clear_xmit_and_wake(iforce); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return; } @@ -58,9 +58,9 @@ XMIT_INC(iforce->xmit.tail, n); if ( (n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC)) ) { - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); dev_warn(&iforce_usb->intf->dev, "usb_submit_urb failed %d\n", n); + iforce_clear_xmit_and_wake(iforce); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -175,15 +175,15 @@ struct iforce *iforce = &iforce_usb->iforce; if (urb->status) { - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); dev_dbg(&iforce_usb->intf->dev, "urb->status %d, exiting\n", urb->status); + iforce_clear_xmit_and_wake(iforce); return; } __iforce_usb_xmit(iforce); - wake_up(&iforce->wait); + wake_up_all(&iforce->wait); } static int iforce_usb_probe(struct usb_interface *intf, diff -Nru linux-aws-5.19.0/drivers/input/joystick/xpad.c linux-aws-5.19.0/drivers/input/joystick/xpad.c --- linux-aws-5.19.0/drivers/input/joystick/xpad.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/joystick/xpad.c 2022-11-29 07:06:46.000000000 +0000 @@ -113,6 +113,8 @@ u8 xtype; } xpad_device[] = { { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 }, { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, @@ -244,6 +246,7 @@ { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX }, { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, @@ -260,6 +263,7 @@ { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 }, { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, + { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, @@ -325,6 +329,7 @@ { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5510, "Hori Fighting Commander ONE (Xbox 360/PC Mode)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE }, @@ -334,6 +339,14 @@ { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x2563, 0x058d, "OneXPlayer Gamepad", 0, XTYPE_XBOX360 }, + { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, + { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1210, "Wooting Lekker", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1220, "Wooting Two HE", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1300, "Wooting 60HE (AVR)", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1310, "Wooting 60HE (ARM)", 0, XTYPE_XBOX360 }, { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, @@ -419,6 +432,7 @@ static const struct usb_device_id xpad_table[] = { { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ 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_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ @@ -429,6 +443,7 @@ { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */ + XPAD_XBOX360_VENDOR(0x0c12), /* Zeroplus X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ @@ -450,8 +465,12 @@ XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */ XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x2563), /* OneXPlayer Gamepad */ + XPAD_XBOX360_VENDOR(0x260d), /* Dareu H101 */ + XPAD_XBOXONE_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller for Xbox */ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ + XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ { } }; @@ -1972,7 +1991,6 @@ .disconnect = xpad_disconnect, .suspend = xpad_suspend, .resume = xpad_resume, - .reset_resume = xpad_resume, .id_table = xpad_table, }; diff -Nru linux-aws-5.19.0/drivers/input/keyboard/snvs_pwrkey.c linux-aws-5.19.0/drivers/input/keyboard/snvs_pwrkey.c --- linux-aws-5.19.0/drivers/input/keyboard/snvs_pwrkey.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/keyboard/snvs_pwrkey.c 2022-11-29 07:06:46.000000000 +0000 @@ -20,7 +20,7 @@ #include #include -#define SNVS_HPVIDR1_REG 0xF8 +#define SNVS_HPVIDR1_REG 0xBF8 #define SNVS_LPSR_REG 0x4C /* LP Status Register */ #define SNVS_LPCR_REG 0x38 /* LP Control Register */ #define SNVS_HPSR_REG 0x14 diff -Nru linux-aws-5.19.0/drivers/input/misc/rk805-pwrkey.c linux-aws-5.19.0/drivers/input/misc/rk805-pwrkey.c --- linux-aws-5.19.0/drivers/input/misc/rk805-pwrkey.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/misc/rk805-pwrkey.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,6 +98,7 @@ }; module_platform_driver(rk805_pwrkey_driver); +MODULE_ALIAS("platform:rk805-pwrkey"); MODULE_AUTHOR("Joseph Chen "); MODULE_DESCRIPTION("RK805 PMIC Power Key driver"); MODULE_LICENSE("GPL"); diff -Nru linux-aws-5.19.0/drivers/input/touchscreen/goodix.c linux-aws-5.19.0/drivers/input/touchscreen/goodix.c --- linux-aws-5.19.0/drivers/input/touchscreen/goodix.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/touchscreen/goodix.c 2022-11-29 07:06:46.000000000 +0000 @@ -95,6 +95,7 @@ static const struct goodix_chip_id goodix_chip_ids[] = { { .id = "1151", .data = >1x_chip_data }, + { .id = "1158", .data = >1x_chip_data }, { .id = "5663", .data = >1x_chip_data }, { .id = "5688", .data = >1x_chip_data }, { .id = "917S", .data = >1x_chip_data }, @@ -1514,6 +1515,7 @@ #ifdef CONFIG_OF static const struct of_device_id goodix_of_match[] = { { .compatible = "goodix,gt1151" }, + { .compatible = "goodix,gt1158" }, { .compatible = "goodix,gt5663" }, { .compatible = "goodix,gt5688" }, { .compatible = "goodix,gt911" }, diff -Nru linux-aws-5.19.0/drivers/input/touchscreen/melfas_mip4.c linux-aws-5.19.0/drivers/input/touchscreen/melfas_mip4.c --- linux-aws-5.19.0/drivers/input/touchscreen/melfas_mip4.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/input/touchscreen/melfas_mip4.c 2022-11-29 07:06:46.000000000 +0000 @@ -1453,7 +1453,7 @@ "ce", GPIOD_OUT_LOW); if (IS_ERR(ts->gpio_ce)) { error = PTR_ERR(ts->gpio_ce); - if (error != EPROBE_DEFER) + if (error != -EPROBE_DEFER) dev_err(&client->dev, "Failed to get gpio: %d\n", error); return error; diff -Nru linux-aws-5.19.0/drivers/iommu/amd/iommu.c linux-aws-5.19.0/drivers/iommu/amd/iommu.c --- linux-aws-5.19.0/drivers/iommu/amd/iommu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/amd/iommu.c 2022-11-29 07:06:46.000000000 +0000 @@ -874,7 +874,8 @@ memset(cmd, 0, sizeof(*cmd)); cmd->data[0] = lower_32_bits(paddr) | CMD_COMPL_WAIT_STORE_MASK; cmd->data[1] = upper_32_bits(paddr); - cmd->data[2] = data; + cmd->data[2] = lower_32_bits(data); + cmd->data[3] = upper_32_bits(data); CMD_SET_TYPE(cmd, CMD_COMPL_WAIT); } diff -Nru linux-aws-5.19.0/drivers/iommu/amd/iommu_v2.c linux-aws-5.19.0/drivers/iommu/amd/iommu_v2.c --- linux-aws-5.19.0/drivers/iommu/amd/iommu_v2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/amd/iommu_v2.c 2022-11-29 07:06:46.000000000 +0000 @@ -786,6 +786,8 @@ if (dev_state->domain == NULL) goto out_free_states; + /* See iommu_is_default_domain() */ + dev_state->domain->type = IOMMU_DOMAIN_IDENTITY; amd_iommu_domain_direct_map(dev_state->domain); ret = amd_iommu_domain_enable_v2(dev_state->domain, pasids); diff -Nru linux-aws-5.19.0/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c linux-aws-5.19.0/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c --- linux-aws-5.19.0/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c 2022-11-29 07:06:46.000000000 +0000 @@ -2839,6 +2839,26 @@ } } +/* + * HiSilicon PCIe tune and trace device can be used to trace TLP headers on the + * PCIe link and save the data to memory by DMA. The hardware is restricted to + * use identity mapping only. + */ +#define IS_HISI_PTT_DEVICE(pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ + (pdev)->device == 0xa12e) + +static int arm_smmu_def_domain_type(struct device *dev) +{ + if (dev_is_pci(dev)) { + struct pci_dev *pdev = to_pci_dev(dev); + + if (IS_HISI_PTT_DEVICE(pdev)) + return IOMMU_DOMAIN_IDENTITY; + } + + return 0; +} + static struct iommu_ops arm_smmu_ops = { .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc, @@ -2856,6 +2876,7 @@ .sva_unbind = arm_smmu_sva_unbind, .sva_get_pasid = arm_smmu_sva_get_pasid, .page_response = arm_smmu_page_response, + .def_domain_type = arm_smmu_def_domain_type, .pgsize_bitmap = -1UL, /* Restricted during device attach */ .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { diff -Nru linux-aws-5.19.0/drivers/iommu/intel/iommu.c linux-aws-5.19.0/drivers/iommu/intel/iommu.c --- linux-aws-5.19.0/drivers/iommu/intel/iommu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/intel/iommu.c 2022-11-29 07:06:46.000000000 +0000 @@ -174,38 +174,6 @@ return re->hi & VTD_PAGE_MASK; } -static inline void context_clear_pasid_enable(struct context_entry *context) -{ - context->lo &= ~(1ULL << 11); -} - -static inline bool context_pasid_enabled(struct context_entry *context) -{ - return !!(context->lo & (1ULL << 11)); -} - -static inline void context_set_copied(struct context_entry *context) -{ - context->hi |= (1ull << 3); -} - -static inline bool context_copied(struct context_entry *context) -{ - return !!(context->hi & (1ULL << 3)); -} - -static inline bool __context_present(struct context_entry *context) -{ - return (context->lo & 1); -} - -bool context_present(struct context_entry *context) -{ - return context_pasid_enabled(context) ? - __context_present(context) : - __context_present(context) && !context_copied(context); -} - static inline void context_set_present(struct context_entry *context) { context->lo |= 1; @@ -253,6 +221,26 @@ context->hi = 0; } +static inline bool context_copied(struct intel_iommu *iommu, u8 bus, u8 devfn) +{ + if (!iommu->copied_tables) + return false; + + return test_bit(((long)bus << 8) | devfn, iommu->copied_tables); +} + +static inline void +set_context_copied(struct intel_iommu *iommu, u8 bus, u8 devfn) +{ + set_bit(((long)bus << 8) | devfn, iommu->copied_tables); +} + +static inline void +clear_context_copied(struct intel_iommu *iommu, u8 bus, u8 devfn) +{ + clear_bit(((long)bus << 8) | devfn, iommu->copied_tables); +} + /* * This domain is a statically identity mapping domain. * 1. This domain creats a static 1:1 mapping to all usable memory. @@ -430,14 +418,36 @@ return !(addr_width < BITS_PER_LONG && pfn >> addr_width); } +/* + * Calculate the Supported Adjusted Guest Address Widths of an IOMMU. + * Refer to 11.4.2 of the VT-d spec for the encoding of each bit of + * the returned SAGAW. + */ +static unsigned long __iommu_calculate_sagaw(struct intel_iommu *iommu) +{ + unsigned long fl_sagaw, sl_sagaw; + + fl_sagaw = BIT(2) | (cap_5lp_support(iommu->cap) ? BIT(3) : 0); + sl_sagaw = cap_sagaw(iommu->cap); + + /* Second level only. */ + if (!sm_supported(iommu) || !ecap_flts(iommu->ecap)) + return sl_sagaw; + + /* First level only. */ + if (!ecap_slts(iommu->ecap)) + return fl_sagaw; + + return fl_sagaw & sl_sagaw; +} + static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw) { unsigned long sagaw; int agaw; - sagaw = cap_sagaw(iommu->cap); - for (agaw = width_to_agaw(max_gaw); - agaw >= 0; agaw--) { + sagaw = __iommu_calculate_sagaw(iommu); + for (agaw = width_to_agaw(max_gaw); agaw >= 0; agaw--) { if (test_bit(agaw, &sagaw)) break; } @@ -630,6 +640,13 @@ struct context_entry *context; u64 *entry; + /* + * Except that the caller requested to allocate a new entry, + * returning a copied context entry makes no sense. + */ + if (!alloc && context_copied(iommu, bus, devfn)) + return NULL; + entry = &root->lo; if (sm_supported(iommu)) { if (devfn >= 0x80) { @@ -1756,6 +1773,11 @@ iommu->domain_ids = NULL; } + if (iommu->copied_tables) { + bitmap_free(iommu->copied_tables); + iommu->copied_tables = NULL; + } + g_iommus[iommu->seq_id] = NULL; /* free context mapping */ @@ -1964,7 +1986,7 @@ goto out_unlock; ret = 0; - if (context_present(context)) + if (context_present(context) && !context_copied(iommu, bus, devfn)) goto out_unlock; /* @@ -1976,7 +1998,7 @@ * in-flight DMA will exist, and we don't need to worry anymore * hereafter. */ - if (context_copied(context)) { + if (context_copied(iommu, bus, devfn)) { u16 did_old = context_domain_id(context); if (did_old < cap_ndoms(iommu->cap)) { @@ -1987,6 +2009,8 @@ iommu->flush.flush_iotlb(iommu, did_old, 0, 0, DMA_TLB_DSI_FLUSH); } + + clear_context_copied(iommu, bus, devfn); } context_clear_entry(context); @@ -2772,32 +2796,14 @@ /* Now copy the context entry */ memcpy(&ce, old_ce + idx, sizeof(ce)); - if (!__context_present(&ce)) + if (!context_present(&ce)) continue; did = context_domain_id(&ce); if (did >= 0 && did < cap_ndoms(iommu->cap)) set_bit(did, iommu->domain_ids); - /* - * We need a marker for copied context entries. This - * marker needs to work for the old format as well as - * for extended context entries. - * - * Bit 67 of the context entry is used. In the old - * format this bit is available to software, in the - * extended format it is the PGE bit, but PGE is ignored - * by HW if PASIDs are disabled (and thus still - * available). - * - * So disable PASIDs first and then mark the entry - * copied. This means that we don't copy PASID - * translations from the old kernel, but this is fine as - * faults there are not fatal. - */ - context_clear_pasid_enable(&ce); - context_set_copied(&ce); - + set_context_copied(iommu, bus, devfn); new_ce[idx] = ce; } @@ -2824,8 +2830,8 @@ bool new_ext, ext; rtaddr_reg = dmar_readq(iommu->reg + DMAR_RTADDR_REG); - ext = !!(rtaddr_reg & DMA_RTADDR_RTT); - new_ext = !!ecap_ecs(iommu->ecap); + ext = !!(rtaddr_reg & DMA_RTADDR_SMT); + new_ext = !!sm_supported(iommu); /* * The RTT bit can only be changed when translation is disabled, @@ -2836,6 +2842,10 @@ if (new_ext != ext) return -EINVAL; + iommu->copied_tables = bitmap_zalloc(BIT_ULL(16), GFP_KERNEL); + if (!iommu->copied_tables) + return -ENOMEM; + old_rt_phys = rtaddr_reg & VTD_PAGE_MASK; if (!old_rt_phys) return -EINVAL; diff -Nru linux-aws-5.19.0/drivers/iommu/iommu.c linux-aws-5.19.0/drivers/iommu/iommu.c --- linux-aws-5.19.0/drivers/iommu/iommu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/iommu.c 2022-11-29 07:06:46.000000000 +0000 @@ -3089,6 +3089,24 @@ return ret; } +static bool iommu_is_default_domain(struct iommu_group *group) +{ + if (group->domain == group->default_domain) + return true; + + /* + * If the default domain was set to identity and it is still an identity + * domain then we consider this a pass. This happens because of + * amd_iommu_init_device() replacing the default idenytity domain with an + * identity domain that has a different configuration for AMDGPU. + */ + if (group->default_domain && + group->default_domain->type == IOMMU_DOMAIN_IDENTITY && + group->domain && group->domain->type == IOMMU_DOMAIN_IDENTITY) + return true; + return false; +} + /** * iommu_device_use_default_domain() - Device driver wants to handle device * DMA through the kernel DMA API. @@ -3107,8 +3125,7 @@ mutex_lock(&group->mutex); if (group->owner_cnt) { - if (group->domain != group->default_domain || - group->owner) { + if (group->owner || !iommu_is_default_domain(group)) { ret = -EBUSY; goto unlock_out; } diff -Nru linux-aws-5.19.0/drivers/iommu/omap-iommu-debug.c linux-aws-5.19.0/drivers/iommu/omap-iommu-debug.c --- linux-aws-5.19.0/drivers/iommu/omap-iommu-debug.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/omap-iommu-debug.c 2022-11-29 07:06:46.000000000 +0000 @@ -32,12 +32,12 @@ ssize_t bytes; \ const char *str = "%20s: %08x\n"; \ const int maxcol = 32; \ - bytes = snprintf(p, maxcol, str, __stringify(name), \ + if (len < maxcol) \ + goto out; \ + bytes = scnprintf(p, maxcol, str, __stringify(name), \ iommu_read_reg(obj, MMU_##name)); \ p += bytes; \ len -= bytes; \ - if (len < maxcol) \ - goto out; \ } while (0) static ssize_t diff -Nru linux-aws-5.19.0/drivers/iommu/virtio-iommu.c linux-aws-5.19.0/drivers/iommu/virtio-iommu.c --- linux-aws-5.19.0/drivers/iommu/virtio-iommu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/iommu/virtio-iommu.c 2022-11-29 07:06:46.000000000 +0000 @@ -1006,7 +1006,18 @@ return iommu_fwspec_add_ids(dev, args->args, 1); } +static bool viommu_capable(enum iommu_cap cap) +{ + switch (cap) { + case IOMMU_CAP_CACHE_COHERENCY: + return true; + default: + return false; + } +} + static struct iommu_ops viommu_ops = { + .capable = viommu_capable, .domain_alloc = viommu_domain_alloc, .probe_device = viommu_probe_device, .probe_finalize = viommu_probe_finalize, diff -Nru linux-aws-5.19.0/drivers/leds/flash/leds-lm3601x.c linux-aws-5.19.0/drivers/leds/flash/leds-lm3601x.c --- linux-aws-5.19.0/drivers/leds/flash/leds-lm3601x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/leds/flash/leds-lm3601x.c 2022-11-29 07:06:46.000000000 +0000 @@ -444,8 +444,6 @@ { struct lm3601x_led *led = i2c_get_clientdata(client); - mutex_destroy(&led->lock); - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); diff -Nru linux-aws-5.19.0/drivers/mailbox/bcm-flexrm-mailbox.c linux-aws-5.19.0/drivers/mailbox/bcm-flexrm-mailbox.c --- linux-aws-5.19.0/drivers/mailbox/bcm-flexrm-mailbox.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mailbox/bcm-flexrm-mailbox.c 2022-11-29 07:06:46.000000000 +0000 @@ -632,15 +632,15 @@ rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - if (rc < 0) - return rc; + if (!rc) + return -EIO; rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst), DMA_FROM_DEVICE); - if (rc < 0) { + if (!rc) { dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - return rc; + return -EIO; } return 0; diff -Nru linux-aws-5.19.0/drivers/mailbox/mailbox-mpfs.c linux-aws-5.19.0/drivers/mailbox/mailbox-mpfs.c --- linux-aws-5.19.0/drivers/mailbox/mailbox-mpfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mailbox/mailbox-mpfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -62,6 +62,7 @@ struct mbox_controller controller; struct device *dev; int irq; + void __iomem *ctrl_base; void __iomem *mbox_base; void __iomem *int_reg; struct mbox_chan chans[1]; @@ -73,7 +74,7 @@ { u32 status; - status = readl_relaxed(mbox->mbox_base + SERVICES_SR_OFFSET); + status = readl_relaxed(mbox->ctrl_base + SERVICES_SR_OFFSET); return status & SCB_STATUS_BUSY_MASK; } @@ -99,29 +100,27 @@ for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + mbox->mbox_base + msg->mbox_offset + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + - MAILBOX_REG_OFFSET + index * 0x4); + val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); val |= (byte_buf[i] << (i * 8u)); } - writel_relaxed(val, - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } opt_sel = ((msg->mbox_offset << 7u) | (msg->cmd_opcode & 0x7fu)); tx_trigger = (opt_sel << SCB_CTRL_POS) & SCB_CTRL_MASK; tx_trigger |= SCB_CTRL_REQ_MASK | SCB_STATUS_NOTIFY_MASK; - writel_relaxed(tx_trigger, mbox->mbox_base + SERVICES_CR_OFFSET); + writel_relaxed(tx_trigger, mbox->ctrl_base + SERVICES_CR_OFFSET); return 0; } @@ -141,7 +140,7 @@ if (!mpfs_mbox_busy(mbox)) { for (i = 0; i < num_words; i++) { response->resp_msg[i] = - readl_relaxed(mbox->mbox_base + MAILBOX_REG_OFFSET + readl_relaxed(mbox->mbox_base + mbox->resp_offset + i * 0x4); } } @@ -200,14 +199,18 @@ if (!mbox) return -ENOMEM; - mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); - if (IS_ERR(mbox->mbox_base)) - return PTR_ERR(mbox->mbox_base); + mbox->ctrl_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); + if (IS_ERR(mbox->ctrl_base)) + return PTR_ERR(mbox->ctrl_base); mbox->int_reg = devm_platform_get_and_ioremap_resource(pdev, 1, ®s); if (IS_ERR(mbox->int_reg)) return PTR_ERR(mbox->int_reg); + mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 2, ®s); + if (IS_ERR(mbox->mbox_base)) // account for the old dt-binding w/ 2 regs + mbox->mbox_base = mbox->ctrl_base + MAILBOX_REG_OFFSET; + mbox->irq = platform_get_irq(pdev, 0); if (mbox->irq < 0) return mbox->irq; diff -Nru linux-aws-5.19.0/drivers/md/bcache/writeback.c linux-aws-5.19.0/drivers/md/bcache/writeback.c --- linux-aws-5.19.0/drivers/md/bcache/writeback.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/md/bcache/writeback.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,6 +157,53 @@ dc->writeback_rate_target = target; } +static bool idle_counter_exceeded(struct cache_set *c) +{ + int counter, dev_nr; + + /* + * If c->idle_counter is overflow (idel for really long time), + * reset as 0 and not set maximum rate this time for code + * simplicity. + */ + counter = atomic_inc_return(&c->idle_counter); + if (counter <= 0) { + atomic_set(&c->idle_counter, 0); + return false; + } + + dev_nr = atomic_read(&c->attached_dev_nr); + if (dev_nr == 0) + return false; + + /* + * c->idle_counter is increased by writeback thread of all + * attached backing devices, in order to represent a rough + * time period, counter should be divided by dev_nr. + * Otherwise the idle time cannot be larger with more backing + * device attached. + * The following calculation equals to checking + * (counter / dev_nr) < (dev_nr * 6) + */ + if (counter < (dev_nr * dev_nr * 6)) + return false; + + return true; +} + +/* + * Idle_counter is increased every time when update_writeback_rate() is + * called. If all backing devices attached to the same cache set have + * identical dc->writeback_rate_update_seconds values, it is about 6 + * rounds of update_writeback_rate() on each backing device before + * c->at_max_writeback_rate is set to 1, and then max wrteback rate set + * to each dc->writeback_rate.rate. + * In order to avoid extra locking cost for counting exact dirty cached + * devices number, c->attached_dev_nr is used to calculate the idle + * throushold. It might be bigger if not all cached device are in write- + * back mode, but it still works well with limited extra rounds of + * update_writeback_rate(). + */ static bool set_at_max_writeback_rate(struct cache_set *c, struct cached_dev *dc) { @@ -167,21 +214,8 @@ /* Don't set max writeback rate if gc is running */ if (!c->gc_mark_valid) return false; - /* - * Idle_counter is increased everytime when update_writeback_rate() is - * called. If all backing devices attached to the same cache set have - * identical dc->writeback_rate_update_seconds values, it is about 6 - * rounds of update_writeback_rate() on each backing device before - * c->at_max_writeback_rate is set to 1, and then max wrteback rate set - * to each dc->writeback_rate.rate. - * In order to avoid extra locking cost for counting exact dirty cached - * devices number, c->attached_dev_nr is used to calculate the idle - * throushold. It might be bigger if not all cached device are in write- - * back mode, but it still works well with limited extra rounds of - * update_writeback_rate(). - */ - if (atomic_inc_return(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) + + if (!idle_counter_exceeded(c)) return false; if (atomic_read(&c->at_max_writeback_rate) != 1) @@ -195,13 +229,10 @@ dc->writeback_rate_change = 0; /* - * Check c->idle_counter and c->at_max_writeback_rate agagain in case - * new I/O arrives during before set_at_max_writeback_rate() returns. - * Then the writeback rate is set to 1, and its new value should be - * decided via __update_writeback_rate(). + * In case new I/O arrives during before + * set_at_max_writeback_rate() returns. */ - if ((atomic_read(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) || + if (!idle_counter_exceeded(c) || !atomic_read(&c->at_max_writeback_rate)) return false; diff -Nru linux-aws-5.19.0/drivers/md/md.c linux-aws-5.19.0/drivers/md/md.c --- linux-aws-5.19.0/drivers/md/md.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/md/md.c 2022-11-29 07:06:46.000000000 +0000 @@ -5647,6 +5647,7 @@ * removed (mddev_delayed_delete). */ flush_workqueue(md_misc_wq); + flush_workqueue(md_rdev_misc_wq); mutex_lock(&disks_mutex); mddev = mddev_alloc(dev); diff -Nru linux-aws-5.19.0/drivers/md/raid0.c linux-aws-5.19.0/drivers/md/raid0.c --- linux-aws-5.19.0/drivers/md/raid0.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/md/raid0.c 2022-11-29 07:06:46.000000000 +0000 @@ -47,7 +47,7 @@ int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%pg", k?"/":"", + len += scnprintf(line+len, 200-len, "%s%pg", k?"/":"", conf->devlist[j * raid_disks + k]->bdev); pr_debug("md: zone%d=[%s]\n", j, line); diff -Nru linux-aws-5.19.0/drivers/md/raid5.c linux-aws-5.19.0/drivers/md/raid5.c --- linux-aws-5.19.0/drivers/md/raid5.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/md/raid5.c 2022-11-29 07:06:46.000000000 +0000 @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -3951,7 +3952,7 @@ * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out; @@ -5446,7 +5447,6 @@ if (is_badblock(rdev, sector, bio_sectors(raid_bio), &first_bad, &bad_sectors)) { - bio_put(raid_bio); rdev_dec_pending(rdev, mddev); return 0; } @@ -6553,7 +6553,18 @@ spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); diff -Nru linux-aws-5.19.0/drivers/media/dvb-core/dvb_vb2.c linux-aws-5.19.0/drivers/media/dvb-core/dvb_vb2.c --- linux-aws-5.19.0/drivers/media/dvb-core/dvb_vb2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/dvb-core/dvb_vb2.c 2022-11-29 07:06:46.000000000 +0000 @@ -354,6 +354,12 @@ int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) { + struct vb2_queue *q = &ctx->vb_q; + + if (b->index >= q->num_buffers) { + dprintk(1, "[%s] buffer index out of range\n", ctx->name); + return -EINVAL; + } vb2_core_querybuf(&ctx->vb_q, b->index, b); dprintk(3, "[%s] index=%d\n", ctx->name, b->index); return 0; @@ -378,8 +384,13 @@ int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) { + struct vb2_queue *q = &ctx->vb_q; int ret; + if (b->index >= q->num_buffers) { + dprintk(1, "[%s] buffer index out of range\n", ctx->name); + return -EINVAL; + } ret = vb2_core_qbuf(&ctx->vb_q, b->index, b, NULL); if (ret) { dprintk(1, "[%s] index=%d errno=%d\n", ctx->name, diff -Nru linux-aws-5.19.0/drivers/media/pci/cx88/cx88-vbi.c linux-aws-5.19.0/drivers/media/pci/cx88/cx88-vbi.c --- linux-aws-5.19.0/drivers/media/pci/cx88/cx88-vbi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/pci/cx88/cx88-vbi.c 2022-11-29 07:06:46.000000000 +0000 @@ -144,11 +144,10 @@ return -EINVAL; vb2_set_plane_payload(vb, 0, size); - cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, - 0, VBI_LINE_LENGTH * lines, - VBI_LINE_LENGTH, 0, - lines); - return 0; + return cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, + 0, VBI_LINE_LENGTH * lines, + VBI_LINE_LENGTH, 0, + lines); } static void buffer_finish(struct vb2_buffer *vb) diff -Nru linux-aws-5.19.0/drivers/media/pci/cx88/cx88-video.c linux-aws-5.19.0/drivers/media/pci/cx88/cx88-video.c --- linux-aws-5.19.0/drivers/media/pci/cx88/cx88-video.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/pci/cx88/cx88-video.c 2022-11-29 07:06:46.000000000 +0000 @@ -431,6 +431,7 @@ static int buffer_prepare(struct vb2_buffer *vb) { + int ret; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct cx8800_dev *dev = vb->vb2_queue->drv_priv; struct cx88_core *core = dev->core; @@ -445,35 +446,35 @@ switch (core->field) { case V4L2_FIELD_TOP: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, UNSET, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, UNSET, + buf->bpl, 0, core->height); break; case V4L2_FIELD_BOTTOM: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, UNSET, 0, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, UNSET, 0, + buf->bpl, 0, core->height); break; case V4L2_FIELD_SEQ_TB: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - 0, buf->bpl * (core->height >> 1), - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + 0, buf->bpl * (core->height >> 1), + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_SEQ_BT: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - buf->bpl * (core->height >> 1), 0, - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + buf->bpl * (core->height >> 1), 0, + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_INTERLACED: default: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, buf->bpl, - buf->bpl, buf->bpl, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, buf->bpl, + buf->bpl, buf->bpl, + core->height >> 1); break; } dprintk(2, @@ -481,7 +482,7 @@ buf, buf->vb.vb2_buf.index, __func__, core->width, core->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) diff -Nru linux-aws-5.19.0/drivers/media/platform/amlogic/meson-ge2d/ge2d.c linux-aws-5.19.0/drivers/media/platform/amlogic/meson-ge2d/ge2d.c --- linux-aws-5.19.0/drivers/media/platform/amlogic/meson-ge2d/ge2d.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amlogic/meson-ge2d/ge2d.c 2022-11-29 07:06:46.000000000 +0000 @@ -1030,7 +1030,6 @@ video_unregister_device(ge2d->vfd); v4l2_m2m_release(ge2d->m2m_dev); - video_device_release(ge2d->vfd); v4l2_device_unregister(&ge2d->v4l2_dev); clk_disable_unprepare(ge2d->clk); diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vdec.c linux-aws-5.19.0/drivers/media/platform/amphion/vdec.c --- linux-aws-5.19.0/drivers/media/platform/amphion/vdec.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vdec.c 2022-11-29 07:06:46.000000000 +0000 @@ -808,14 +808,6 @@ inst->cap_format.field = V4L2_FIELD_NONE; else inst->cap_format.field = V4L2_FIELD_SEQ_TB; - if (vdec->codec_info.color_primaries == V4L2_COLORSPACE_DEFAULT) - vdec->codec_info.color_primaries = V4L2_COLORSPACE_REC709; - if (vdec->codec_info.transfer_chars == V4L2_XFER_FUNC_DEFAULT) - vdec->codec_info.transfer_chars = V4L2_XFER_FUNC_709; - if (vdec->codec_info.matrix_coeffs == V4L2_YCBCR_ENC_DEFAULT) - vdec->codec_info.matrix_coeffs = V4L2_YCBCR_ENC_709; - if (vdec->codec_info.full_range == V4L2_QUANTIZATION_DEFAULT) - vdec->codec_info.full_range = V4L2_QUANTIZATION_LIM_RANGE; } static void vdec_init_crop(struct vpu_inst *inst) @@ -1556,6 +1548,14 @@ vdec->codec_info.frame_rate.numerator, vdec->codec_info.frame_rate.denominator); break; + case 9: + num = scnprintf(str, size, "colorspace: %d, %d, %d, %d (%d)\n", + vdec->codec_info.color_primaries, + vdec->codec_info.transfer_chars, + vdec->codec_info.matrix_coeffs, + vdec->codec_info.full_range, + vdec->codec_info.vui_present); + break; default: break; } diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/venc.c linux-aws-5.19.0/drivers/media/platform/amphion/venc.c --- linux-aws-5.19.0/drivers/media/platform/amphion/venc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/venc.c 2022-11-29 07:06:46.000000000 +0000 @@ -644,7 +644,7 @@ BITRATE_DEFAULT_PEAK); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, - V4L2_CID_MPEG_VIDEO_GOP_SIZE, 0, (1 << 16) - 1, 1, 30); + V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 8000, 1, 30); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_B_FRAMES, 0, 4, 1, 0); diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.c linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.c --- linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -89,7 +89,7 @@ core->supported_instance_count = min(core->supported_instance_count, count); } core->fw_version = fw_version; - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); return 0; } @@ -172,10 +172,26 @@ return __vpu_alloc_dma(core->dev, buf); } -static void vpu_core_check_hang(struct vpu_core *core) +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state) { - if (core->hang_mask) - core->state = VPU_CORE_HANG; + if (state != core->state) + vpu_trace(core->dev, "vpu core state change from %d to %d\n", core->state, state); + core->state = state; + if (core->state == VPU_CORE_DEINIT) + core->hang_mask = 0; +} + +static void vpu_core_update_state(struct vpu_core *core) +{ + if (!vpu_iface_get_power_state(core)) { + if (core->request_count) + vpu_core_set_state(core, VPU_CORE_HANG); + else + vpu_core_set_state(core, VPU_CORE_DEINIT); + + } else if (core->state == VPU_CORE_ACTIVE && core->hang_mask) { + vpu_core_set_state(core, VPU_CORE_HANG); + } } static struct vpu_core *vpu_core_find_proper_by_type(struct vpu_dev *vpu, u32 type) @@ -188,11 +204,13 @@ dev_dbg(c->dev, "instance_mask = 0x%lx, state = %d\n", c->instance_mask, c->state); if (c->type != type) continue; + mutex_lock(&c->lock); + vpu_core_update_state(c); + mutex_unlock(&c->lock); if (c->state == VPU_CORE_DEINIT) { core = c; break; } - vpu_core_check_hang(c); if (c->state != VPU_CORE_ACTIVE) continue; if (c->request_count < request_count) { @@ -412,6 +430,12 @@ } mutex_lock(&core->lock); + if (core->state != VPU_CORE_ACTIVE) { + dev_err(core->dev, "vpu core is not active, state = %d\n", core->state); + ret = -EINVAL; + goto exit; + } + if (inst->id >= 0 && inst->id < core->supported_instance_count) goto exit; @@ -453,7 +477,7 @@ vpu_core_release_instance(core, inst->id); inst->id = VPU_INST_NULL_ID; } - vpu_core_check_hang(core); + vpu_core_update_state(core); if (core->state == VPU_CORE_HANG && !core->instance_mask) { int err; @@ -462,7 +486,7 @@ err = vpu_core_sw_reset(core); mutex_lock(&core->lock); if (!err) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } @@ -612,7 +636,7 @@ mutex_init(&core->cmd_lock); init_completion(&core->cmp); init_waitqueue_head(&core->ack_wq); - core->state = VPU_CORE_DEINIT; + vpu_core_set_state(core, VPU_CORE_DEINIT); core->res = of_device_get_match_data(dev); if (!core->res) @@ -761,33 +785,18 @@ mutex_lock(&core->lock); pm_runtime_resume_and_get(dev); vpu_core_get_vpu(core); - if (core->state != VPU_CORE_SNAPSHOT) - goto exit; - if (!vpu_iface_get_power_state(core)) { - if (!list_empty(&core->instances)) { + if (core->request_count) { + if (!vpu_iface_get_power_state(core)) ret = vpu_core_boot(core, false); - if (ret) { - dev_err(core->dev, "%s boot fail\n", __func__); - core->state = VPU_CORE_DEINIT; - goto exit; - } - } else { - core->state = VPU_CORE_DEINIT; - } - } else { - if (!list_empty(&core->instances)) { + else ret = vpu_core_sw_reset(core); - if (ret) { - dev_err(core->dev, "%s sw_reset fail\n", __func__); - core->state = VPU_CORE_HANG; - goto exit; - } + if (ret) { + dev_err(core->dev, "resume fail\n"); + vpu_core_set_state(core, VPU_CORE_HANG); } - core->state = VPU_CORE_ACTIVE; } - -exit: + vpu_core_update_state(core); pm_runtime_put_sync(dev); mutex_unlock(&core->lock); @@ -801,18 +810,11 @@ int ret = 0; mutex_lock(&core->lock); - if (core->state == VPU_CORE_ACTIVE) { - if (!list_empty(&core->instances)) { - ret = vpu_core_snapshot(core); - if (ret) { - mutex_unlock(&core->lock); - return ret; - } - } - - core->state = VPU_CORE_SNAPSHOT; - } + if (core->request_count) + ret = vpu_core_snapshot(core); mutex_unlock(&core->lock); + if (ret) + return ret; vpu_core_cancel_work(core); diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.h linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.h --- linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vpu_core.h 2022-11-29 07:06:46.000000000 +0000 @@ -11,5 +11,6 @@ int vpu_alloc_dma(struct vpu_core *core, struct vpu_buffer *buf); void vpu_free_dma(struct vpu_buffer *buf); struct vpu_inst *vpu_core_find_instance(struct vpu_core *core, u32 index); +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state); #endif diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vpu_dbg.c linux-aws-5.19.0/drivers/media/platform/amphion/vpu_dbg.c --- linux-aws-5.19.0/drivers/media/platform/amphion/vpu_dbg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vpu_dbg.c 2022-11-29 07:06:46.000000000 +0000 @@ -15,6 +15,7 @@ #include #include "vpu.h" #include "vpu_defs.h" +#include "vpu_core.h" #include "vpu_helpers.h" #include "vpu_cmds.h" #include "vpu_rpc.h" @@ -233,6 +234,10 @@ if (seq_write(s, str, num)) return 0; + num = scnprintf(str, sizeof(str), "power %s\n", + vpu_iface_get_power_state(core) ? "on" : "off"); + if (seq_write(s, str, num)) + return 0; num = scnprintf(str, sizeof(str), "state = %d\n", core->state); if (seq_write(s, str, num)) return 0; @@ -346,10 +351,10 @@ pm_runtime_resume_and_get(core->dev); mutex_lock(&core->lock); - if (core->state != VPU_CORE_DEINIT && !core->instance_mask) { + if (vpu_iface_get_power_state(core) && !core->request_count) { dev_info(core->dev, "reset\n"); if (!vpu_core_sw_reset(core)) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vpu.h linux-aws-5.19.0/drivers/media/platform/amphion/vpu.h --- linux-aws-5.19.0/drivers/media/platform/amphion/vpu.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vpu.h 2022-11-29 07:06:46.000000000 +0000 @@ -119,7 +119,6 @@ enum vpu_core_state { VPU_CORE_DEINIT = 0, VPU_CORE_ACTIVE, - VPU_CORE_SNAPSHOT, VPU_CORE_HANG }; diff -Nru linux-aws-5.19.0/drivers/media/platform/amphion/vpu_malone.c linux-aws-5.19.0/drivers/media/platform/amphion/vpu_malone.c --- linux-aws-5.19.0/drivers/media/platform/amphion/vpu_malone.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/amphion/vpu_malone.c 2022-11-29 07:06:46.000000000 +0000 @@ -1277,7 +1277,7 @@ vbuf = to_vb2_v4l2_buffer(scode->vb); data = vb2_plane_vaddr(scode->vb, 0); - if (vbuf->sequence == 0 || vpu_vb_is_codecconfig(vbuf)) + if (scode->inst->total_input_count == 0 || vpu_vb_is_codecconfig(vbuf)) return 0; if (MALONE_VC1_CONTAIN_NAL(*data)) return 0; diff -Nru linux-aws-5.19.0/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c linux-aws-5.19.0/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c --- linux-aws-5.19.0/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1411,7 +1411,6 @@ pm_runtime_disable(&pdev->dev); video_unregister_device(jpeg->vdev); - video_device_release(jpeg->vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); diff -Nru linux-aws-5.19.0/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c linux-aws-5.19.0/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c --- linux-aws-5.19.0/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -228,7 +228,6 @@ { struct mtk_vcodec_dev *dev; struct video_device *vfd_enc; - struct resource *res; phandle rproc_phandle; enum mtk_vcodec_fw_type fw_type; int ret; @@ -272,14 +271,12 @@ goto err_res; } - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(&pdev->dev, "failed to get irq resource"); - ret = -ENOENT; + dev->enc_irq = platform_get_irq(pdev, 0); + if (dev->enc_irq < 0) { + ret = dev->enc_irq; goto err_res; } - dev->enc_irq = platform_get_irq(pdev, 0); irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->enc_irq, mtk_vcodec_enc_irq_handler, diff -Nru linux-aws-5.19.0/drivers/media/platform/samsung/exynos4-is/fimc-is.c linux-aws-5.19.0/drivers/media/platform/samsung/exynos4-is/fimc-is.c --- linux-aws-5.19.0/drivers/media/platform/samsung/exynos4-is/fimc-is.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/samsung/exynos4-is/fimc-is.c 2022-11-29 07:06:46.000000000 +0000 @@ -213,6 +213,7 @@ if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) { of_node_put(child); + of_node_put(i2c_bus); return ret; } index++; diff -Nru linux-aws-5.19.0/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c linux-aws-5.19.0/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c --- linux-aws-5.19.0/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1399,6 +1399,7 @@ /* Deinit MFC if probe had failed */ err_enc_reg: video_unregister_device(dev->vfd_dec); + dev->vfd_dec = NULL; err_dec_reg: video_device_release(dev->vfd_enc); err_enc_alloc: @@ -1444,8 +1445,6 @@ video_unregister_device(dev->vfd_enc); video_unregister_device(dev->vfd_dec); - video_device_release(dev->vfd_enc); - video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_unconfigure_dma_memory(dev); diff -Nru linux-aws-5.19.0/drivers/media/platform/xilinx/xilinx-vipp.c linux-aws-5.19.0/drivers/media/platform/xilinx/xilinx-vipp.c --- linux-aws-5.19.0/drivers/media/platform/xilinx/xilinx-vipp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/platform/xilinx/xilinx-vipp.c 2022-11-29 07:06:46.000000000 +0000 @@ -471,7 +471,7 @@ { struct device_node *ports; struct device_node *port; - int ret; + int ret = 0; ports = of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports == NULL) { @@ -481,13 +481,14 @@ for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev) diff -Nru linux-aws-5.19.0/drivers/media/rc/mceusb.c linux-aws-5.19.0/drivers/media/rc/mceusb.c --- linux-aws-5.19.0/drivers/media/rc/mceusb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/rc/mceusb.c 2022-11-29 07:06:46.000000000 +0000 @@ -1416,42 +1416,37 @@ { int ret; struct device *dev = ir->dev; - char *data; - - data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL); - if (!data) { - dev_err(dev, "%s: memory allocation failed!", __func__); - return; - } + char data[USB_CTRL_MSG_SZ]; /* * This is a strange one. Windows issues a set address to the device * on the receive control pipe and expect a certain value pair back */ - ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), - USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, - data, USB_CTRL_MSG_SZ, 3000); + ret = usb_control_msg_recv(ir->usbdev, 0, USB_REQ_SET_ADDRESS, + USB_DIR_IN | USB_TYPE_VENDOR, + 0, 0, data, USB_CTRL_MSG_SZ, 3000, + GFP_KERNEL); dev_dbg(dev, "set address - ret = %d", ret); dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", data[0], data[1]); /* set feature: bit rate 38400 bps */ - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), - USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, - 0xc04e, 0x0000, NULL, 0, 3000); + ret = usb_control_msg_send(ir->usbdev, 0, + USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, + 0xc04e, 0x0000, NULL, 0, 3000, GFP_KERNEL); dev_dbg(dev, "set feature - ret = %d", ret); /* bRequest 4: set char length to 8 bits */ - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), - 4, USB_TYPE_VENDOR, - 0x0808, 0x0000, NULL, 0, 3000); + ret = usb_control_msg_send(ir->usbdev, 0, + 4, USB_TYPE_VENDOR, + 0x0808, 0x0000, NULL, 0, 3000, GFP_KERNEL); dev_dbg(dev, "set char length - retB = %d", ret); /* bRequest 2: set handshaking to use DTR/DSR */ - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), - 2, USB_TYPE_VENDOR, - 0x0000, 0x0100, NULL, 0, 3000); + ret = usb_control_msg_send(ir->usbdev, 0, + 2, USB_TYPE_VENDOR, + 0x0000, 0x0100, NULL, 0, 3000, GFP_KERNEL); dev_dbg(dev, "set handshake - retC = %d", ret); /* device resume */ @@ -1459,8 +1454,6 @@ /* get hw/sw revision? */ mce_command_out(ir, GET_REVISION, sizeof(GET_REVISION)); - - kfree(data); } static void mceusb_gen2_init(struct mceusb_dev *ir) diff -Nru linux-aws-5.19.0/drivers/media/usb/b2c2/flexcop-usb.c linux-aws-5.19.0/drivers/media/usb/b2c2/flexcop-usb.c --- linux-aws-5.19.0/drivers/media/usb/b2c2/flexcop-usb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/usb/b2c2/flexcop-usb.c 2022-11-29 07:06:46.000000000 +0000 @@ -511,7 +511,7 @@ if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) return -ENODEV; - if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc)) + if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc)) return -ENODEV; switch (fc_usb->udev->speed) { diff -Nru linux-aws-5.19.0/drivers/media/usb/uvc/uvc_ctrl.c linux-aws-5.19.0/drivers/media/usb/uvc/uvc_ctrl.c --- linux-aws-5.19.0/drivers/media/usb/uvc/uvc_ctrl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/usb/uvc/uvc_ctrl.c 2022-11-29 07:06:46.000000000 +0000 @@ -963,36 +963,56 @@ return value; } -static int __uvc_ctrl_get(struct uvc_video_chain *chain, - struct uvc_control *ctrl, struct uvc_control_mapping *mapping, - s32 *value) +static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, + struct uvc_control *ctrl) { + u8 *data; int ret; - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) - return -EACCES; + if (ctrl->loaded) + return 0; - if (!ctrl->loaded) { - if (ctrl->entity->get_cur) { - ret = ctrl->entity->get_cur(chain->dev, - ctrl->entity, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, - chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } - if (ret < 0) - return ret; + data = uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT); + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { + memset(data, 0, ctrl->info.size); ctrl->loaded = 1; + + return 0; } + if (ctrl->entity->get_cur) + ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, + ctrl->info.selector, data, + ctrl->info.size); + else + ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, + ctrl->entity->id, chain->dev->intfnum, + ctrl->info.selector, data, + ctrl->info.size); + + if (ret < 0) + return ret; + + ctrl->loaded = 1; + + return ret; +} + +static int __uvc_ctrl_get(struct uvc_video_chain *chain, + struct uvc_control *ctrl, + struct uvc_control_mapping *mapping, + s32 *value) +{ + int ret; + + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) + return -EACCES; + + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; + *value = __uvc_ctrl_get_value(mapping, uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT)); @@ -1783,21 +1803,10 @@ * needs to be loaded from the device to perform the read-modify-write * operation. */ - if (!ctrl->loaded && (ctrl->info.size * 8) != mapping->size) { - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { - memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - 0, ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - if (ret < 0) - return ret; - } - - ctrl->loaded = 1; + if ((ctrl->info.size * 8) != mapping->size) { + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; } /* Backup the current value in case we need to rollback later. */ diff -Nru linux-aws-5.19.0/drivers/media/usb/uvc/uvc_driver.c linux-aws-5.19.0/drivers/media/usb/uvc/uvc_driver.c --- linux-aws-5.19.0/drivers/media/usb/uvc/uvc_driver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/usb/uvc/uvc_driver.c 2022-11-29 07:06:46.000000000 +0000 @@ -1538,10 +1538,6 @@ if (IS_ERR_OR_NULL(gpio_privacy)) return PTR_ERR_OR_ZERO(gpio_privacy); - unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); - if (!unit) - return -ENOMEM; - irq = gpiod_to_irq(gpio_privacy); if (irq < 0) { if (irq != EPROBE_DEFER) @@ -1550,6 +1546,10 @@ return irq; } + unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); + if (!unit) + return -ENOMEM; + unit->gpio.gpio_privacy = gpio_privacy; unit->gpio.irq = irq; unit->gpio.bControlSize = 1; diff -Nru linux-aws-5.19.0/drivers/media/v4l2-core/v4l2-compat-ioctl32.c linux-aws-5.19.0/drivers/media/v4l2-core/v4l2-compat-ioctl32.c --- linux-aws-5.19.0/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 2022-11-29 07:06:46.000000000 +0000 @@ -1040,6 +1040,8 @@ { int err = 0; + memset(mbuf, 0, array_size); + switch (cmd) { case VIDIOC_G_FMT32: case VIDIOC_S_FMT32: diff -Nru linux-aws-5.19.0/drivers/memory/of_memory.c linux-aws-5.19.0/drivers/memory/of_memory.c --- linux-aws-5.19.0/drivers/memory/of_memory.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/memory/of_memory.c 2022-11-29 07:06:46.000000000 +0000 @@ -134,6 +134,7 @@ for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; } @@ -284,6 +285,7 @@ if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++; diff -Nru linux-aws-5.19.0/drivers/memory/pl353-smc.c linux-aws-5.19.0/drivers/memory/pl353-smc.c --- linux-aws-5.19.0/drivers/memory/pl353-smc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/memory/pl353-smc.c 2022-11-29 07:06:46.000000000 +0000 @@ -122,6 +122,7 @@ } of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0; diff -Nru linux-aws-5.19.0/drivers/memstick/core/ms_block.c linux-aws-5.19.0/drivers/memstick/core/ms_block.c --- linux-aws-5.19.0/drivers/memstick/core/ms_block.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/memstick/core/ms_block.c 2022-11-29 07:06:46.000000000 +0000 @@ -2188,7 +2188,6 @@ /* Remove the disk */ del_gendisk(msb->disk); - blk_cleanup_queue(msb->queue); blk_mq_free_tag_set(&msb->tag_set); msb->queue = NULL; diff -Nru linux-aws-5.19.0/drivers/memstick/core/mspro_block.c linux-aws-5.19.0/drivers/memstick/core/mspro_block.c --- linux-aws-5.19.0/drivers/memstick/core/mspro_block.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/memstick/core/mspro_block.c 2022-11-29 07:06:46.000000000 +0000 @@ -1294,7 +1294,6 @@ del_gendisk(msb->disk); dev_dbg(&card->dev, "mspro block remove\n"); - blk_cleanup_queue(msb->queue); blk_mq_free_tag_set(&msb->tag_set); msb->queue = NULL; diff -Nru linux-aws-5.19.0/drivers/mfd/da9062-core.c linux-aws-5.19.0/drivers/mfd/da9062-core.c --- linux-aws-5.19.0/drivers/mfd/da9062-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/da9062-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -453,6 +453,7 @@ regmap_reg_range(DA9062AA_VBUCK1_B, DA9062AA_VBUCK4_B), regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B), regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B), + regmap_reg_range(DA9062AA_CONFIG_J, DA9062AA_CONFIG_J), regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19), }; diff -Nru linux-aws-5.19.0/drivers/mfd/fsl-imx25-tsadc.c linux-aws-5.19.0/drivers/mfd/fsl-imx25-tsadc.c --- linux-aws-5.19.0/drivers/mfd/fsl-imx25-tsadc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/fsl-imx25-tsadc.c 2022-11-29 07:06:46.000000000 +0000 @@ -69,7 +69,7 @@ int irq; irq = platform_get_irq(pdev, 0); - if (irq <= 0) + if (irq < 0) return irq; tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops, @@ -84,6 +84,19 @@ return 0; } +static int mx25_tsadc_unset_irq(struct platform_device *pdev) +{ + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + if (irq >= 0) { + irq_set_chained_handler_and_data(irq, NULL, NULL); + irq_domain_remove(tsadc->domain); + } + + return 0; +} + static void mx25_tsadc_setup_clk(struct platform_device *pdev, struct mx25_tsadc *tsadc) { @@ -171,18 +184,21 @@ platform_set_drvdata(pdev, tsadc); - return devm_of_platform_populate(dev); + ret = devm_of_platform_populate(dev); + if (ret) + goto err_irq; + + return 0; + +err_irq: + mx25_tsadc_unset_irq(pdev); + + return ret; } static int mx25_tsadc_remove(struct platform_device *pdev) { - struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); - int irq = platform_get_irq(pdev, 0); - - if (irq) { - irq_set_chained_handler_and_data(irq, NULL, NULL); - irq_domain_remove(tsadc->domain); - } + mx25_tsadc_unset_irq(pdev); return 0; } diff -Nru linux-aws-5.19.0/drivers/mfd/intel_soc_pmic_core.c linux-aws-5.19.0/drivers/mfd/intel_soc_pmic_core.c --- linux-aws-5.19.0/drivers/mfd/intel_soc_pmic_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/intel_soc_pmic_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -77,6 +77,7 @@ return 0; err_del_irq_chip: + pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); return ret; } diff -Nru linux-aws-5.19.0/drivers/mfd/lp8788.c linux-aws-5.19.0/drivers/mfd/lp8788.c --- linux-aws-5.19.0/drivers/mfd/lp8788.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/lp8788.c 2022-11-29 07:06:46.000000000 +0000 @@ -195,8 +195,16 @@ if (ret) return ret; - return mfd_add_devices(lp->dev, -1, lp8788_devs, - ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + ret = mfd_add_devices(lp->dev, -1, lp8788_devs, + ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + if (ret) + goto err_exit_irq; + + return 0; + +err_exit_irq: + lp8788_irq_exit(lp); + return ret; } static int lp8788_remove(struct i2c_client *cl) diff -Nru linux-aws-5.19.0/drivers/mfd/lp8788-irq.c linux-aws-5.19.0/drivers/mfd/lp8788-irq.c --- linux-aws-5.19.0/drivers/mfd/lp8788-irq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/lp8788-irq.c 2022-11-29 07:06:46.000000000 +0000 @@ -175,6 +175,7 @@ IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "lp8788-irq", irqd); if (ret) { + irq_domain_remove(lp->irqdm); dev_err(lp->dev, "failed to create a thread for IRQ_N\n"); return ret; } @@ -188,4 +189,6 @@ { if (lp->irq) free_irq(lp->irq, lp->irqdm); + if (lp->irqdm) + irq_domain_remove(lp->irqdm); } diff -Nru linux-aws-5.19.0/drivers/mfd/sm501.c linux-aws-5.19.0/drivers/mfd/sm501.c --- linux-aws-5.19.0/drivers/mfd/sm501.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mfd/sm501.c 2022-11-29 07:06:46.000000000 +0000 @@ -1720,7 +1720,12 @@ static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } diff -Nru linux-aws-5.19.0/drivers/misc/fastrpc.c linux-aws-5.19.0/drivers/misc/fastrpc.c --- linux-aws-5.19.0/drivers/misc/fastrpc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/misc/fastrpc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1943,7 +1943,12 @@ of_property_read_u32(dev->of_node, "qcom,nsessions", &sessions); spin_lock_irqsave(&cctx->lock, flags); - sess = &cctx->session[cctx->sesscount]; + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { + dev_err(&pdev->dev, "too many sessions\n"); + spin_unlock_irqrestore(&cctx->lock, flags); + return -ENOSPC; + } + sess = &cctx->session[cctx->sesscount++]; sess->used = false; sess->valid = true; sess->dev = dev; @@ -1956,13 +1961,12 @@ struct fastrpc_session_ctx *dup_sess; for (i = 1; i < sessions; i++) { - if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) break; - dup_sess = &cctx->session[cctx->sesscount]; + dup_sess = &cctx->session[cctx->sesscount++]; memcpy(dup_sess, sess, sizeof(*dup_sess)); } } - cctx->sesscount++; spin_unlock_irqrestore(&cctx->lock, flags); rc = dma_set_mask(dev, DMA_BIT_MASK(32)); if (rc) { diff -Nru linux-aws-5.19.0/drivers/misc/ocxl/file.c linux-aws-5.19.0/drivers/misc/ocxl/file.c --- linux-aws-5.19.0/drivers/misc/ocxl/file.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/misc/ocxl/file.c 2022-11-29 07:06:46.000000000 +0000 @@ -257,6 +257,8 @@ if (IS_ERR(ev_ctx)) return PTR_ERR(ev_ctx); rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx); + if (rc) + eventfd_ctx_put(ev_ctx); break; case OCXL_IOCTL_GET_METADATA: diff -Nru linux-aws-5.19.0/drivers/misc/pci_endpoint_test.c linux-aws-5.19.0/drivers/misc/pci_endpoint_test.c --- linux-aws-5.19.0/drivers/misc/pci_endpoint_test.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/misc/pci_endpoint_test.c 2022-11-29 07:06:46.000000000 +0000 @@ -332,6 +332,22 @@ return false; } +static int pci_endpoint_test_validate_xfer_params(struct device *dev, + struct pci_endpoint_test_xfer_param *param, size_t alignment) +{ + if (!param->size) { + dev_dbg(dev, "Data size is zero\n"); + return -EINVAL; + } + + if (param->size > SIZE_MAX - alignment) { + dev_dbg(dev, "Maximum transfer data size exceeded\n"); + return -EINVAL; + } + + return 0; +} + static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, unsigned long arg) { @@ -363,9 +379,11 @@ return false; } + err = pci_endpoint_test_validate_xfer_params(dev, ¶m, alignment); + if (err) + return false; + size = param.size; - if (size > SIZE_MAX - alignment) - goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); if (use_dma) @@ -497,9 +515,11 @@ return false; } + err = pci_endpoint_test_validate_xfer_params(dev, ¶m, alignment); + if (err) + return false; + size = param.size; - if (size > SIZE_MAX - alignment) - goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); if (use_dma) @@ -595,9 +615,11 @@ return false; } + err = pci_endpoint_test_validate_xfer_params(dev, ¶m, alignment); + if (err) + return false; + size = param.size; - if (size > SIZE_MAX - alignment) - goto err; use_dma = !!(param.flags & PCITEST_FLAGS_USE_DMA); if (use_dma) diff -Nru linux-aws-5.19.0/drivers/mmc/core/block.c linux-aws-5.19.0/drivers/mmc/core/block.c --- linux-aws-5.19.0/drivers/mmc/core/block.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/core/block.c 2022-11-29 07:06:46.000000000 +0000 @@ -1140,8 +1140,12 @@ { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; + unsigned int arg = card->erase_arg; - mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, card->erase_arg); + if (mmc_card_broken_sd_discard(card)) + arg = SD_ERASE_ARG; + + mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, arg); } static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, @@ -2509,7 +2513,6 @@ return md; err_cleanup_queue: - blk_cleanup_queue(md->disk->queue); blk_mq_free_tag_set(&md->queue.tag_set); err_kfree: kfree(md); diff -Nru linux-aws-5.19.0/drivers/mmc/core/card.h linux-aws-5.19.0/drivers/mmc/core/card.h --- linux-aws-5.19.0/drivers/mmc/core/card.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/core/card.h 2022-11-29 07:06:46.000000000 +0000 @@ -73,6 +73,7 @@ #define EXT_CSD_REV_ANY (-1u) #define CID_MANFID_SANDISK 0x2 +#define CID_MANFID_SANDISK_SD 0x3 #define CID_MANFID_ATP 0x9 #define CID_MANFID_TOSHIBA 0x11 #define CID_MANFID_MICRON 0x13 @@ -258,4 +259,9 @@ return c->quirks & MMC_QUIRK_BROKEN_HPI; } +static inline int mmc_card_broken_sd_discard(const struct mmc_card *c) +{ + return c->quirks & MMC_QUIRK_BROKEN_SD_DISCARD; +} + #endif diff -Nru linux-aws-5.19.0/drivers/mmc/core/queue.c linux-aws-5.19.0/drivers/mmc/core/queue.c --- linux-aws-5.19.0/drivers/mmc/core/queue.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/core/queue.c 2022-11-29 07:06:46.000000000 +0000 @@ -494,7 +494,6 @@ if (blk_queue_quiesced(q)) blk_mq_unquiesce_queue(q); - blk_cleanup_queue(q); blk_mq_free_tag_set(&mq->tag_set); /* diff -Nru linux-aws-5.19.0/drivers/mmc/core/quirks.h linux-aws-5.19.0/drivers/mmc/core/quirks.h --- linux-aws-5.19.0/drivers/mmc/core/quirks.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/core/quirks.h 2022-11-29 07:06:46.000000000 +0000 @@ -100,6 +100,12 @@ MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_TRIM_BROKEN), + /* + * Some SD cards reports discard support while they don't + */ + MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, + MMC_QUIRK_BROKEN_SD_DISCARD), + END_FIXUP }; diff -Nru linux-aws-5.19.0/drivers/mmc/core/sd.c linux-aws-5.19.0/drivers/mmc/core/sd.c --- linux-aws-5.19.0/drivers/mmc/core/sd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/core/sd.c 2022-11-29 07:06:46.000000000 +0000 @@ -870,7 +870,8 @@ * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) { + if (!mmc_host_is_spi(host) && (ocr & SD_OCR_S18R) && + rocr && (*rocr & SD_ROCR_S18A)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; @@ -949,16 +950,17 @@ /* Erase init depends on CSD and SSR */ mmc_init_erase(card); - - /* - * Fetch switch information from card. - */ - err = mmc_read_switch(card); - if (err) - return err; } /* + * Fetch switch information from card. Note, sd3_bus_mode can change if + * voltage switch outcome changes, so do this always. + */ + err = mmc_read_switch(card); + if (err) + return err; + + /* * For SPI, enable CRC as appropriate. * This CRC enable is located AFTER the reading of the * card registers because some SDHC cards are not able @@ -1480,26 +1482,15 @@ if (!v18_fixup_failed && !mmc_host_is_spi(host) && mmc_host_uhs(host) && mmc_sd_card_using_v18(card) && host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) { - /* - * Re-read switch information in case it has changed since - * oldcard was initialized. - */ - if (oldcard) { - err = mmc_read_switch(card); - if (err) - goto free_card; - } - if (mmc_sd_card_using_v18(card)) { - if (mmc_host_set_uhs_voltage(host) || - mmc_sd_init_uhs_card(card)) { - v18_fixup_failed = true; - mmc_power_cycle(host, ocr); - if (!oldcard) - mmc_remove_card(card); - goto retry; - } - goto done; + if (mmc_host_set_uhs_voltage(host) || + mmc_sd_init_uhs_card(card)) { + v18_fixup_failed = true; + mmc_power_cycle(host, ocr); + if (!oldcard) + mmc_remove_card(card); + goto retry; } + goto cont; } /* Initialization sequence for UHS-I cards */ @@ -1534,7 +1525,7 @@ mmc_set_bus_width(host, MMC_BUS_WIDTH_4); } } - +cont: if (!oldcard) { /* Read/parse the extension registers. */ err = sd_read_ext_regs(card); @@ -1566,7 +1557,7 @@ err = -EINVAL; goto free_card; } -done: + host->card = card; return 0; diff -Nru linux-aws-5.19.0/drivers/mmc/host/au1xmmc.c linux-aws-5.19.0/drivers/mmc/host/au1xmmc.c --- linux-aws-5.19.0/drivers/mmc/host/au1xmmc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/au1xmmc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1097,8 +1097,9 @@ if (host->platdata && host->platdata->cd_setup && !(mmc->caps & MMC_CAP_NEEDS_POLL)) host->platdata->cd_setup(mmc, 0); -out_clk: + clk_disable_unprepare(host->clk); +out_clk: clk_put(host->clk); out_irq: free_irq(host->irq, host); diff -Nru linux-aws-5.19.0/drivers/mmc/host/mmc_hsq.c linux-aws-5.19.0/drivers/mmc/host/mmc_hsq.c --- linux-aws-5.19.0/drivers/mmc/host/mmc_hsq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/mmc_hsq.c 2022-11-29 07:06:46.000000000 +0000 @@ -34,7 +34,7 @@ spin_lock_irqsave(&hsq->lock, flags); /* Make sure we are not already running a request now */ - if (hsq->mrq) { + if (hsq->mrq || hsq->recovery_halt) { spin_unlock_irqrestore(&hsq->lock, flags); return; } diff -Nru linux-aws-5.19.0/drivers/mmc/host/moxart-mmc.c linux-aws-5.19.0/drivers/mmc/host/moxart-mmc.c --- linux-aws-5.19.0/drivers/mmc/host/moxart-mmc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/moxart-mmc.c 2022-11-29 07:06:46.000000000 +0000 @@ -111,8 +111,8 @@ #define CLK_DIV_MASK 0x7f /* REG_BUS_WIDTH */ -#define BUS_WIDTH_8 BIT(2) -#define BUS_WIDTH_4 BIT(1) +#define BUS_WIDTH_4_SUPPORT BIT(3) +#define BUS_WIDTH_4 BIT(2) #define BUS_WIDTH_1 BIT(0) #define MMC_VDD_360 23 @@ -524,9 +524,6 @@ case MMC_BUS_WIDTH_4: writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH); break; - case MMC_BUS_WIDTH_8: - writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH); - break; default: writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH); break; @@ -651,16 +648,8 @@ dmaengine_slave_config(host->dma_chan_rx, &cfg); } - switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) { - case 1: + if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT) mmc->caps |= MMC_CAP_4_BIT_DATA; - break; - case 2: - mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; - break; - default: - break; - } writel(0, host->base + REG_INTERRUPT_MASK); diff -Nru linux-aws-5.19.0/drivers/mmc/host/renesas_sdhi_core.c linux-aws-5.19.0/drivers/mmc/host/renesas_sdhi_core.c --- linux-aws-5.19.0/drivers/mmc/host/renesas_sdhi_core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/renesas_sdhi_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -128,6 +128,7 @@ struct clk *ref_clk = priv->clk; unsigned int freq, diff, best_freq = 0, diff_min = ~0; unsigned int new_clock, clkh_shift = 0; + unsigned int new_upper_limit; int i; /* @@ -153,13 +154,20 @@ * greater than, new_clock. As we can divide by 1 << i for * any i in [0, 9] we want the input clock to be as close as * possible, but no greater than, new_clock << i. + * + * Add an upper limit of 1/1024 rate higher to the clock rate to fix + * clk rate jumping to lower rate due to rounding error (eg: RZ/G2L has + * 3 clk sources 533.333333 MHz, 400 MHz and 266.666666 MHz. The request + * for 533.333333 MHz will selects a slower 400 MHz due to rounding + * error (533333333 Hz / 4 * 4 = 533333332 Hz < 533333333 Hz)). */ for (i = min(9, ilog2(UINT_MAX / new_clock)); i >= 0; i--) { freq = clk_round_rate(ref_clk, new_clock << i); - if (freq > (new_clock << i)) { + new_upper_limit = (new_clock << i) + ((new_clock << i) >> 10); + if (freq > new_upper_limit) { /* Too fast; look for a slightly slower option */ freq = clk_round_rate(ref_clk, (new_clock << i) / 4 * 3); - if (freq > (new_clock << i)) + if (freq > new_upper_limit) continue; } @@ -181,6 +189,7 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, unsigned int new_clock) { + unsigned int clk_margin; u32 clk = 0, clock; sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & @@ -194,7 +203,13 @@ host->mmc->actual_clock = renesas_sdhi_clk_update(host, new_clock); clock = host->mmc->actual_clock / 512; - for (clk = 0x80000080; new_clock >= (clock << 1); clk >>= 1) + /* + * Add a margin of 1/1024 rate higher to the clock rate in order + * to avoid clk variable setting a value of 0 due to the margin + * provided for actual_clock in renesas_sdhi_clk_update(). + */ + clk_margin = new_clock >> 10; + for (clk = 0x80000080; new_clock + clk_margin >= (clock << 1); clk >>= 1) clock <<= 1; /* 1/1 clock is option */ diff -Nru linux-aws-5.19.0/drivers/mmc/host/sdhci-sprd.c linux-aws-5.19.0/drivers/mmc/host/sdhci-sprd.c --- linux-aws-5.19.0/drivers/mmc/host/sdhci-sprd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/sdhci-sprd.c 2022-11-29 07:06:46.000000000 +0000 @@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_min_clock(struct sdhci_host *host) { - return 400000; + return 100000; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host, diff -Nru linux-aws-5.19.0/drivers/mmc/host/sdhci-tegra.c linux-aws-5.19.0/drivers/mmc/host/sdhci-tegra.c --- linux-aws-5.19.0/drivers/mmc/host/sdhci-tegra.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/sdhci-tegra.c 2022-11-29 07:06:46.000000000 +0000 @@ -773,7 +773,7 @@ dev_err(dev, "failed to set clk rate to %luHz: %d\n", host_clk, err); - tegra_host->curr_clk_rate = host_clk; + tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk); if (tegra_host->ddr_signaling) host->max_clk = host_clk; else diff -Nru linux-aws-5.19.0/drivers/mmc/host/wmt-sdmmc.c linux-aws-5.19.0/drivers/mmc/host/wmt-sdmmc.c --- linux-aws-5.19.0/drivers/mmc/host/wmt-sdmmc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mmc/host/wmt-sdmmc.c 2022-11-29 07:06:46.000000000 +0000 @@ -846,7 +846,7 @@ if (IS_ERR(priv->clk_sdmmc)) { dev_err(&pdev->dev, "Error getting clock\n"); ret = PTR_ERR(priv->clk_sdmmc); - goto fail5; + goto fail5_and_a_half; } ret = clk_prepare_enable(priv->clk_sdmmc); @@ -863,6 +863,9 @@ return 0; fail6: clk_put(priv->clk_sdmmc); +fail5_and_a_half: + dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, + priv->dma_desc_buffer, priv->dma_desc_device_addr); fail5: free_irq(dma_irq, priv); fail4: diff -Nru linux-aws-5.19.0/drivers/mtd/devices/docg3.c linux-aws-5.19.0/drivers/mtd/devices/docg3.c --- linux-aws-5.19.0/drivers/mtd/devices/docg3.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mtd/devices/docg3.c 2022-11-29 07:06:46.000000000 +0000 @@ -1974,9 +1974,14 @@ dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade) diff -Nru linux-aws-5.19.0/drivers/mtd/nand/raw/atmel/nand-controller.c linux-aws-5.19.0/drivers/mtd/nand/raw/atmel/nand-controller.c --- linux-aws-5.19.0/drivers/mtd/nand/raw/atmel/nand-controller.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mtd/nand/raw/atmel/nand-controller.c 2022-11-29 07:06:46.000000000 +0000 @@ -405,6 +405,7 @@ dma_async_issue_pending(nc->dmac); wait_for_completion(&finished); + dma_unmap_single(nc->dev, buf_dma, len, dir); return 0; diff -Nru linux-aws-5.19.0/drivers/mtd/nand/raw/fsl_elbc_nand.c linux-aws-5.19.0/drivers/mtd/nand/raw/fsl_elbc_nand.c --- linux-aws-5.19.0/drivers/mtd/nand/raw/fsl_elbc_nand.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mtd/nand/raw/fsl_elbc_nand.c 2022-11-29 07:06:46.000000000 +0000 @@ -726,36 +726,40 @@ struct fsl_lbc_regs __iomem *lbc = ctrl->regs; unsigned int al; - switch (chip->ecc.engine_type) { /* * if ECC was not chosen in DT, decide whether to use HW or SW ECC from * CS Base Register */ - case NAND_ECC_ENGINE_TYPE_NONE: + if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_INVALID) { /* If CS Base Register selects full hardware ECC then use it */ if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == BR_DECC_CHK_GEN) { - chip->ecc.read_page = fsl_elbc_read_page; - chip->ecc.write_page = fsl_elbc_write_page; - chip->ecc.write_subpage = fsl_elbc_write_subpage; - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; - mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); - chip->ecc.size = 512; - chip->ecc.bytes = 3; - chip->ecc.strength = 1; } else { /* otherwise fall back to default software ECC */ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; chip->ecc.algo = NAND_ECC_ALGO_HAMMING; } + } + + switch (chip->ecc.engine_type) { + /* if HW ECC was chosen, setup ecc and oob layout */ + case NAND_ECC_ENGINE_TYPE_ON_HOST: + chip->ecc.read_page = fsl_elbc_read_page; + chip->ecc.write_page = fsl_elbc_write_page; + chip->ecc.write_subpage = fsl_elbc_write_subpage; + mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); + chip->ecc.size = 512; + chip->ecc.bytes = 3; + chip->ecc.strength = 1; break; - /* if SW ECC was chosen in DT, we do not need to set anything here */ + /* if none or SW ECC was chosen, we do not need to set anything here */ + case NAND_ECC_ENGINE_TYPE_NONE: case NAND_ECC_ENGINE_TYPE_SOFT: + case NAND_ECC_ENGINE_TYPE_ON_DIE: break; - /* should we also implement *_ECC_ENGINE_CONTROLLER to do as above? */ default: return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c linux-aws-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c --- linux-aws-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c 2022-11-29 07:06:46.000000000 +0000 @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -580,6 +581,7 @@ { struct device *dev = &pdev->dev; struct ebu_nand_controller *ebu_host; + struct device_node *chip_np; struct nand_chip *nand; struct mtd_info *mtd; struct resource *res; @@ -604,7 +606,12 @@ if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); - ret = device_property_read_u32(dev, "reg", &cs); + chip_np = of_get_next_child(dev->of_node, NULL); + if (!chip_np) + return dev_err_probe(dev, -EINVAL, + "Could not find child node for the NAND chip\n"); + + ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); return ret; @@ -660,7 +667,7 @@ writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN, ebu_host->ebu + EBU_ADDR_SEL(cs)); - nand_set_flash_node(&ebu_host->chip, dev->of_node); + nand_set_flash_node(&ebu_host->chip, chip_np); mtd = nand_to_mtd(&ebu_host->chip); if (!mtd->name) { @@ -716,7 +723,6 @@ } static const struct of_device_id ebu_nand_match[] = { - { .compatible = "intel,nand-controller" }, { .compatible = "intel,lgm-ebunand" }, {} }; diff -Nru linux-aws-5.19.0/drivers/mtd/nand/raw/meson_nand.c linux-aws-5.19.0/drivers/mtd/nand/raw/meson_nand.c --- linux-aws-5.19.0/drivers/mtd/nand/raw/meson_nand.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/mtd/nand/raw/meson_nand.c 2022-11-29 07:06:46.000000000 +0000 @@ -454,7 +454,7 @@ if (ECC_ERR_CNT(*info) != ECC_UNCORRECTABLE) { mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); *bitflips = max_t(u32, *bitflips, ECC_ERR_CNT(*info)); - *correct_bitmap |= 1 >> i; + *correct_bitmap |= BIT_ULL(i); continue; } if ((nand->options & NAND_NEED_SCRAMBLING) && @@ -800,7 +800,7 @@ u8 *data = buf + i * ecc->size; u8 *oob = nand->oob_poi + i * (ecc->bytes + 2); - if (correct_bitmap & (1 << i)) + if (correct_bitmap & BIT_ULL(i)) continue; ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, ecc->bytes + 2, diff -Nru linux-aws-5.19.0/drivers/net/bonding/bond_3ad.c linux-aws-5.19.0/drivers/net/bonding/bond_3ad.c --- linux-aws-5.19.0/drivers/net/bonding/bond_3ad.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/bonding/bond_3ad.c 2022-11-29 07:06:46.000000000 +0000 @@ -87,8 +87,9 @@ static u16 ad_ticks_per_sec; static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; -static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = - MULTICAST_LACPDU_ADDR; +const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = { + 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 +}; /* ================= main 802.3ad protocol functions ================== */ static int ad_lacpdu_send(struct port *port); diff -Nru linux-aws-5.19.0/drivers/net/bonding/bond_main.c linux-aws-5.19.0/drivers/net/bonding/bond_main.c --- linux-aws-5.19.0/drivers/net/bonding/bond_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/bonding/bond_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -865,12 +865,8 @@ dev_uc_unsync(slave_dev, bond_dev); dev_mc_unsync(slave_dev, bond_dev); - if (BOND_MODE(bond) == BOND_MODE_8023AD) { - /* del lacpdu mc addr from mc list */ - u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; - - dev_mc_del(slave_dev, lacpdu_multicast); - } + if (BOND_MODE(bond) == BOND_MODE_8023AD) + dev_mc_del(slave_dev, lacpdu_mcast_addr); } /*--------------------------- Active slave change ---------------------------*/ @@ -890,7 +886,8 @@ if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(old_active->dev, -1); - bond_hw_addr_flush(bond->dev, old_active->dev); + if (bond->dev->flags & IFF_UP) + bond_hw_addr_flush(bond->dev, old_active->dev); } if (new_active) { @@ -901,10 +898,12 @@ if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(new_active->dev, 1); - netif_addr_lock_bh(bond->dev); - dev_uc_sync(new_active->dev, bond->dev); - dev_mc_sync(new_active->dev, bond->dev); - netif_addr_unlock_bh(bond->dev); + if (bond->dev->flags & IFF_UP) { + netif_addr_lock_bh(bond->dev); + dev_uc_sync(new_active->dev, bond->dev); + dev_mc_sync(new_active->dev, bond->dev); + netif_addr_unlock_bh(bond->dev); + } } } @@ -1974,6 +1973,8 @@ for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) new_slave->target_last_arp_rx[i] = new_slave->last_rx; + new_slave->last_tx = new_slave->last_rx; + if (bond->params.miimon && !bond->params.use_carrier) { link_reporting = bond_check_dev_link(bond, slave_dev, 1); @@ -2137,16 +2138,14 @@ } } - netif_addr_lock_bh(bond_dev); - dev_mc_sync_multiple(slave_dev, bond_dev); - dev_uc_sync_multiple(slave_dev, bond_dev); - netif_addr_unlock_bh(bond_dev); - - if (BOND_MODE(bond) == BOND_MODE_8023AD) { - /* add lacpdu mc addr to mc list */ - u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; + if (bond_dev->flags & IFF_UP) { + netif_addr_lock_bh(bond_dev); + dev_mc_sync_multiple(slave_dev, bond_dev); + dev_uc_sync_multiple(slave_dev, bond_dev); + netif_addr_unlock_bh(bond_dev); - dev_mc_add(slave_dev, lacpdu_multicast); + if (BOND_MODE(bond) == BOND_MODE_8023AD) + dev_mc_add(slave_dev, lacpdu_mcast_addr); } } @@ -2418,7 +2417,8 @@ if (old_flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); - bond_hw_addr_flush(bond_dev, slave_dev); + if (old_flags & IFF_UP) + bond_hw_addr_flush(bond_dev, slave_dev); } slave_disable_netpoll(slave); @@ -2857,8 +2857,11 @@ return; } - if (bond_handle_vlan(slave, tags, skb)) + if (bond_handle_vlan(slave, tags, skb)) { + slave_update_last_tx(slave); arp_xmit(skb); + } + return; } @@ -3047,8 +3050,7 @@ curr_active_slave->last_link_up)) bond_validate_arp(bond, slave, tip, sip); else if (curr_arp_slave && (arp->ar_op == htons(ARPOP_REPLY)) && - bond_time_in_interval(bond, - dev_trans_start(curr_arp_slave->dev), 1)) + bond_time_in_interval(bond, slave_last_tx(curr_arp_slave), 1)) bond_validate_arp(bond, slave, sip, tip); out_unlock: @@ -3076,8 +3078,10 @@ } addrconf_addr_solict_mult(daddr, &mcaddr); - if (bond_handle_vlan(slave, tags, skb)) + if (bond_handle_vlan(slave, tags, skb)) { + slave_update_last_tx(slave); ndisc_send_skb(skb, &mcaddr, saddr); + } } static void bond_ns_send_all(struct bonding *bond, struct slave *slave) @@ -3134,6 +3138,9 @@ found: if (!ipv6_dev_get_saddr(dev_net(dst->dev), dst->dev, &targets[i], 0, &saddr)) bond_ns_send(slave, &targets[i], &saddr, tags); + else + bond_ns_send(slave, &targets[i], &in6addr_any, tags); + dst_release(dst); kfree(tags); } @@ -3165,12 +3172,19 @@ return ret; } -static void bond_validate_ns(struct bonding *bond, struct slave *slave, +static void bond_validate_na(struct bonding *bond, struct slave *slave, struct in6_addr *saddr, struct in6_addr *daddr) { int i; - if (ipv6_addr_any(saddr) || !bond_has_this_ip6(bond, daddr)) { + /* Ignore NAs that: + * 1. Source address is unspecified address. + * 2. Dest address is neither all-nodes multicast address nor + * exist on bond interface. + */ + if (ipv6_addr_any(saddr) || + (!ipv6_addr_equal(daddr, &in6addr_linklocal_allnodes) && + !bond_has_this_ip6(bond, daddr))) { slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c tip %pI6c not found\n", __func__, saddr, daddr); return; @@ -3213,15 +3227,14 @@ * see bond_arp_rcv(). */ if (bond_is_active_slave(slave)) - bond_validate_ns(bond, slave, saddr, daddr); + bond_validate_na(bond, slave, saddr, daddr); else if (curr_active_slave && time_after(slave_last_rx(bond, curr_active_slave), curr_active_slave->last_link_up)) - bond_validate_ns(bond, slave, saddr, daddr); + bond_validate_na(bond, slave, saddr, daddr); else if (curr_arp_slave && - bond_time_in_interval(bond, - dev_trans_start(curr_arp_slave->dev), 1)) - bond_validate_ns(bond, slave, saddr, daddr); + bond_time_in_interval(bond, slave_last_tx(curr_arp_slave), 1)) + bond_validate_na(bond, slave, saddr, daddr); out: return RX_HANDLER_ANOTHER; @@ -3308,12 +3321,12 @@ * so it can wait */ bond_for_each_slave_rcu(bond, slave, iter) { - unsigned long trans_start = dev_trans_start(slave->dev); + unsigned long last_tx = slave_last_tx(slave); bond_propose_link_state(slave, BOND_LINK_NOCHANGE); if (slave->link != BOND_LINK_UP) { - if (bond_time_in_interval(bond, trans_start, 1) && + if (bond_time_in_interval(bond, last_tx, 1) && bond_time_in_interval(bond, slave->last_rx, 1)) { bond_propose_link_state(slave, BOND_LINK_UP); @@ -3338,7 +3351,7 @@ * when the source ip is 0, so don't take the link down * if we don't know our ip yet */ - if (!bond_time_in_interval(bond, trans_start, bond->params.missed_max) || + if (!bond_time_in_interval(bond, last_tx, bond->params.missed_max) || !bond_time_in_interval(bond, slave->last_rx, bond->params.missed_max)) { bond_propose_link_state(slave, BOND_LINK_DOWN); @@ -3404,7 +3417,7 @@ */ static int bond_ab_arp_inspect(struct bonding *bond) { - unsigned long trans_start, last_rx; + unsigned long last_tx, last_rx; struct list_head *iter; struct slave *slave; int commit = 0; @@ -3455,9 +3468,9 @@ * - (more than missed_max*delta since receive AND * the bond has an IP address) */ - trans_start = dev_trans_start(slave->dev); + last_tx = slave_last_tx(slave); if (bond_is_active_slave(slave) && - (!bond_time_in_interval(bond, trans_start, bond->params.missed_max) || + (!bond_time_in_interval(bond, last_tx, bond->params.missed_max) || !bond_time_in_interval(bond, last_rx, bond->params.missed_max))) { bond_propose_link_state(slave, BOND_LINK_DOWN); commit++; @@ -3474,8 +3487,8 @@ */ static void bond_ab_arp_commit(struct bonding *bond) { - unsigned long trans_start; struct list_head *iter; + unsigned long last_tx; struct slave *slave; bond_for_each_slave(bond, slave, iter) { @@ -3484,10 +3497,10 @@ continue; case BOND_LINK_UP: - trans_start = dev_trans_start(slave->dev); + last_tx = slave_last_tx(slave); if (rtnl_dereference(bond->curr_active_slave) != slave || (!rtnl_dereference(bond->curr_active_slave) && - bond_time_in_interval(bond, trans_start, 1))) { + bond_time_in_interval(bond, last_tx, 1))) { struct slave *current_arp_slave; current_arp_slave = rtnl_dereference(bond->current_arp_slave); @@ -4142,6 +4155,12 @@ struct list_head *iter; struct slave *slave; + if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) { + bond->rr_tx_counter = alloc_percpu(u32); + if (!bond->rr_tx_counter) + return -ENOMEM; + } + /* reset slave->backup and slave->inactive */ if (bond_has_slaves(bond)) { bond_for_each_slave(bond, slave, iter) { @@ -4179,6 +4198,9 @@ /* register to receive LACPDUs */ bond->recv_probe = bond_3ad_lacpdu_recv; bond_3ad_initiate_agg_selection(bond, 1); + + bond_for_each_slave(bond, slave, iter) + dev_mc_add(slave->dev, lacpdu_mcast_addr); } if (bond_mode_can_use_xmit_hash(bond)) @@ -4190,6 +4212,7 @@ static int bond_close(struct net_device *bond_dev) { struct bonding *bond = netdev_priv(bond_dev); + struct slave *slave; bond_work_cancel_all(bond); bond->send_peer_notif = 0; @@ -4197,6 +4220,19 @@ bond_alb_deinitialize(bond); bond->recv_probe = NULL; + if (bond_uses_primary(bond)) { + rcu_read_lock(); + slave = rcu_dereference(bond->curr_active_slave); + if (slave) + bond_hw_addr_flush(bond_dev, slave->dev); + rcu_read_unlock(); + } else { + struct list_head *iter; + + bond_for_each_slave(bond, slave, iter) + bond_hw_addr_flush(bond_dev, slave->dev); + } + return 0; } @@ -6180,15 +6216,6 @@ if (!bond->wq) return -ENOMEM; - if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN) { - bond->rr_tx_counter = alloc_percpu(u32); - if (!bond->rr_tx_counter) { - destroy_workqueue(bond->wq); - bond->wq = NULL; - return -ENOMEM; - } - } - spin_lock_init(&bond->stats_lock); netdev_lockdep_set_classes(bond_dev); diff -Nru linux-aws-5.19.0/drivers/net/can/c_can/c_can.h linux-aws-5.19.0/drivers/net/can/c_can/c_can.h --- linux-aws-5.19.0/drivers/net/can/c_can/c_can.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/c_can/c_can.h 2022-11-29 07:06:46.000000000 +0000 @@ -235,9 +235,22 @@ return ring->tail & (ring->obj_num - 1); } -static inline u8 c_can_get_tx_free(const struct c_can_tx_ring *ring) +static inline u8 c_can_get_tx_free(const struct c_can_priv *priv, + const struct c_can_tx_ring *ring) { - return ring->obj_num - (ring->head - ring->tail); + u8 head = c_can_get_tx_head(ring); + u8 tail = c_can_get_tx_tail(ring); + + if (priv->type == BOSCH_D_CAN) + return ring->obj_num - (ring->head - ring->tail); + + /* This is not a FIFO. C/D_CAN sends out the buffers + * prioritized. The lowest buffer number wins. + */ + if (head < tail) + return 0; + + return ring->obj_num - head; } #endif /* C_CAN_H */ diff -Nru linux-aws-5.19.0/drivers/net/can/c_can/c_can_main.c linux-aws-5.19.0/drivers/net/can/c_can/c_can_main.c --- linux-aws-5.19.0/drivers/net/can/c_can/c_can_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/c_can/c_can_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -429,7 +429,7 @@ static bool c_can_tx_busy(const struct c_can_priv *priv, const struct c_can_tx_ring *tx_ring) { - if (c_can_get_tx_free(tx_ring) > 0) + if (c_can_get_tx_free(priv, tx_ring) > 0) return false; netif_stop_queue(priv->dev); @@ -437,7 +437,7 @@ /* Memory barrier before checking tx_free (head and tail) */ smp_mb(); - if (c_can_get_tx_free(tx_ring) == 0) { + if (c_can_get_tx_free(priv, tx_ring) == 0) { netdev_dbg(priv->dev, "Stopping tx-queue (tx_head=0x%08x, tx_tail=0x%08x, len=%d).\n", tx_ring->head, tx_ring->tail, @@ -465,7 +465,7 @@ idx = c_can_get_tx_head(tx_ring); tx_ring->head++; - if (c_can_get_tx_free(tx_ring) == 0) + if (c_can_get_tx_free(priv, tx_ring) == 0) netif_stop_queue(dev); if (idx < c_can_get_tx_tail(tx_ring)) @@ -748,7 +748,7 @@ return; tx_ring->tail += pkts; - if (c_can_get_tx_free(tx_ring)) { + if (c_can_get_tx_free(priv, tx_ring)) { /* Make sure that anybody stopping the queue after * this sees the new tx_ring->tail. */ @@ -760,8 +760,7 @@ stats->tx_packets += pkts; tail = c_can_get_tx_tail(tx_ring); - - if (tail == 0) { + if (priv->type == BOSCH_D_CAN && tail == 0) { u8 head = c_can_get_tx_head(tx_ring); /* Start transmission for all cached messages */ diff -Nru linux-aws-5.19.0/drivers/net/can/flexcan/flexcan-core.c linux-aws-5.19.0/drivers/net/can/flexcan/flexcan-core.c --- linux-aws-5.19.0/drivers/net/can/flexcan/flexcan-core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/flexcan/flexcan-core.c 2022-11-29 07:06:46.000000000 +0000 @@ -941,11 +941,6 @@ u32 reg_ctrl, reg_id, reg_iflag1; int i; - if (unlikely(drop)) { - skb = ERR_PTR(-ENOBUFS); - goto mark_as_read; - } - mb = flexcan_get_mb(priv, n); if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { @@ -974,6 +969,11 @@ reg_ctrl = priv->read(&mb->can_ctrl); } + if (unlikely(drop)) { + skb = ERR_PTR(-ENOBUFS); + goto mark_as_read; + } + if (reg_ctrl & FLEXCAN_MB_CNT_EDL) skb = alloc_canfd_skb(offload->dev, &cfd); else diff -Nru linux-aws-5.19.0/drivers/net/can/usb/gs_usb.c linux-aws-5.19.0/drivers/net/can/usb/gs_usb.c --- linux-aws-5.19.0/drivers/net/can/usb/gs_usb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/usb/gs_usb.c 2022-11-29 07:06:46.000000000 +0000 @@ -824,6 +824,7 @@ flags |= GS_CAN_MODE_TRIPLE_SAMPLE; /* finally start device */ + dev->can.state = CAN_STATE_ERROR_ACTIVE; dm->mode = cpu_to_le32(GS_CAN_MODE_START); dm->flags = cpu_to_le32(flags); rc = usb_control_msg(interface_to_usbdev(dev->iface), @@ -835,13 +836,12 @@ if (rc < 0) { netdev_err(netdev, "Couldn't start device (err=%d)\n", rc); kfree(dm); + dev->can.state = CAN_STATE_STOPPED; return rc; } kfree(dm); - dev->can.state = CAN_STATE_ERROR_ACTIVE; - parent->active_channels++; if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) netif_start_queue(netdev); diff -Nru linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c --- linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -476,7 +476,7 @@ /* This method might sleep. Do not call it in the atomic context * of URB completions. */ -static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) { usb_kill_anchored_urbs(&priv->tx_submitted); kvaser_usb_reset_tx_urb_contexts(priv); @@ -712,6 +712,7 @@ init_usb_anchor(&priv->tx_submitted); init_completion(&priv->start_comp); init_completion(&priv->stop_comp); + init_completion(&priv->flush_comp); priv->can.ctrlmode_supported = 0; priv->dev = dev; diff -Nru linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb.h linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb.h --- linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb.h 2022-11-29 07:06:46.000000000 +0000 @@ -177,6 +177,8 @@ extern const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops; extern const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops; +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv); + int kvaser_usb_recv_cmd(const struct kvaser_usb *dev, void *cmd, int len, int *actual_len); diff -Nru linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c --- linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c 2022-11-29 07:06:46.000000000 +0000 @@ -1914,7 +1914,7 @@ { int err; - init_completion(&priv->flush_comp); + reinit_completion(&priv->flush_comp); err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_FLUSH_QUEUE, priv->channel); diff -Nru linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c --- linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c 2022-11-29 07:06:46.000000000 +0000 @@ -310,6 +310,38 @@ } u; } __packed; +#define CMD_SIZE_ANY 0xff +#define kvaser_fsize(field) sizeof_field(struct kvaser_cmd, field) + +static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.leaf.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_LEAF_LOG_MESSAGE] = kvaser_fsize(u.leaf.log_message), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.leaf.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.leaf.error_event), + /* ignored events: */ + [CMD_FLUSH_QUEUE_REPLY] = CMD_SIZE_ANY, +}; + +static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.usbcan.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.usbcan.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.usbcan.error_event), + /* ignored events: */ + [CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY, +}; + /* Summary of a kvaser error event, for a unified Leaf/Usbcan error * handling. Some discrepancies between the two families exist: * @@ -397,6 +429,43 @@ .bittiming_const = &kvaser_usb_flexc_bittiming_const, }; +static int kvaser_usb_leaf_verify_size(const struct kvaser_usb *dev, + const struct kvaser_cmd *cmd) +{ + /* buffer size >= cmd->len ensured by caller */ + u8 min_size = 0; + + switch (dev->driver_info->family) { + case KVASER_LEAF: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_leaf)) + min_size = kvaser_usb_leaf_cmd_sizes_leaf[cmd->id]; + break; + case KVASER_USBCAN: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_usbcan)) + min_size = kvaser_usb_leaf_cmd_sizes_usbcan[cmd->id]; + break; + } + + if (min_size == CMD_SIZE_ANY) + return 0; + + if (min_size) { + min_size += CMD_HEADER_LEN; + if (cmd->len >= min_size) + return 0; + + dev_err_ratelimited(&dev->intf->dev, + "Received command %u too short (size %u, needed %u)", + cmd->id, cmd->len, min_size); + return -EIO; + } + + dev_warn_ratelimited(&dev->intf->dev, + "Unhandled command (%d, size %d)\n", + cmd->id, cmd->len); + return -EINVAL; +} + static void * kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv, const struct sk_buff *skb, int *cmd_len, @@ -502,6 +571,9 @@ end: kfree(buf); + if (err == 0) + err = kvaser_usb_leaf_verify_size(dev, cmd); + return err; } @@ -1132,6 +1204,9 @@ static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev, const struct kvaser_cmd *cmd) { + if (kvaser_usb_leaf_verify_size(dev, cmd) < 0) + return; + switch (cmd->id) { case CMD_START_CHIP_REPLY: kvaser_usb_leaf_start_chip_reply(dev, cmd); @@ -1350,9 +1425,13 @@ switch (mode) { case CAN_MODE_START: + kvaser_usb_unlink_tx_urbs(priv); + err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; break; default: return -EOPNOTSUPP; diff -Nru linux-aws-5.19.0/drivers/net/dsa/mt7530.c linux-aws-5.19.0/drivers/net/dsa/mt7530.c --- linux-aws-5.19.0/drivers/net/dsa/mt7530.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/dsa/mt7530.c 2022-11-29 07:06:46.000000000 +0000 @@ -506,14 +506,19 @@ static int mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface) { - struct mt7530_priv *priv = ds->priv; + return 0; +} + +static void +mt7531_pll_setup(struct mt7530_priv *priv) +{ u32 top_sig; u32 hwstrap; u32 xtal; u32 val; if (mt7531_dual_sgmii_supported(priv)) - return 0; + return; val = mt7530_read(priv, MT7531_CREV); top_sig = mt7530_read(priv, MT7531_TOP_SIG_SR); @@ -592,8 +597,6 @@ val |= EN_COREPLL; mt7530_write(priv, MT7531_PLLGP_EN, val); usleep_range(25, 35); - - return 0; } static void @@ -2310,6 +2313,8 @@ SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); + mt7531_pll_setup(priv); + if (mt7531_dual_sgmii_supported(priv)) { priv->p5_intf_sel = P5_INTF_SEL_GMAC5_SGMII; @@ -2863,8 +2868,6 @@ case 6: interface = PHY_INTERFACE_MODE_2500BASEX; - mt7531_pad_setup(ds, interface); - priv->p6_interface = interface; break; default: diff -Nru linux-aws-5.19.0/drivers/net/dsa/ocelot/felix_vsc9959.c linux-aws-5.19.0/drivers/net/dsa/ocelot/felix_vsc9959.c --- linux-aws-5.19.0/drivers/net/dsa/ocelot/felix_vsc9959.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/dsa/ocelot/felix_vsc9959.c 2022-11-29 07:06:46.000000000 +0000 @@ -16,11 +16,13 @@ #include #include #include +#include #include "felix.h" #define VSC9959_NUM_PORTS 6 #define VSC9959_TAS_GCL_ENTRY_MAX 63 +#define VSC9959_TAS_MIN_GATE_LEN_NS 33 #define VSC9959_VCAP_POLICER_BASE 63 #define VSC9959_VCAP_POLICER_MAX 383 #define VSC9959_SWITCH_PCI_BAR 4 @@ -1410,6 +1412,23 @@ mdiobus_free(felix->imdio); } +/* The switch considers any frame (regardless of size) as eligible for + * transmission if the traffic class gate is open for at least 33 ns. + * Overruns are prevented by cropping an interval at the end of the gate time + * slot for which egress scheduling is blocked, but we need to still keep 33 ns + * available for one packet to be transmitted, otherwise the port tc will hang. + * This function returns the size of a gate interval that remains available for + * setting the guard band, after reserving the space for one egress frame. + */ +static u64 vsc9959_tas_remaining_gate_len_ps(u64 gate_len_ns) +{ + /* Gate always open */ + if (gate_len_ns == U64_MAX) + return U64_MAX; + + return (gate_len_ns - VSC9959_TAS_MIN_GATE_LEN_NS) * PSEC_PER_NSEC; +} + /* Extract shortest continuous gate open intervals in ns for each traffic class * of a cyclic tc-taprio schedule. If a gate is always open, the duration is * considered U64_MAX. If the gate is always closed, it is considered 0. @@ -1471,6 +1490,65 @@ min_gate_len[tc] = 0; } +/* ocelot_write_rix is a macro that concatenates QSYS_MAXSDU_CFG_* with _RSZ, + * so we need to spell out the register access to each traffic class in helper + * functions, to simplify callers + */ +static void vsc9959_port_qmaxsdu_set(struct ocelot *ocelot, int port, int tc, + u32 max_sdu) +{ + switch (tc) { + case 0: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_0, + port); + break; + case 1: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_1, + port); + break; + case 2: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_2, + port); + break; + case 3: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_3, + port); + break; + case 4: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_4, + port); + break; + case 5: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_5, + port); + break; + case 6: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_6, + port); + break; + case 7: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_7, + port); + break; + } +} + +static u32 vsc9959_port_qmaxsdu_get(struct ocelot *ocelot, int port, int tc) +{ + switch (tc) { + case 0: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_0, port); + case 1: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_1, port); + case 2: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_2, port); + case 3: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_3, port); + case 4: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_4, port); + case 5: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_5, port); + case 6: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_6, port); + case 7: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_7, port); + default: + return 0; + } +} + /* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by the * switch (see the ALWAYS_GUARD_BAND_SCH_Q comment) are correct at all MTU * values (the default value is 1518). Also, for traffic class windows smaller @@ -1527,11 +1605,16 @@ vsc9959_tas_min_gate_lengths(ocelot_port->taprio, min_gate_len); + mutex_lock(&ocelot->fwd_domain_lock); + for (tc = 0; tc < OCELOT_NUM_TC; tc++) { + u64 remaining_gate_len_ps; u32 max_sdu; - if (min_gate_len[tc] == U64_MAX /* Gate always open */ || - min_gate_len[tc] * 1000 > needed_bit_time_ps) { + remaining_gate_len_ps = + vsc9959_tas_remaining_gate_len_ps(min_gate_len[tc]); + + if (remaining_gate_len_ps > needed_bit_time_ps) { /* Setting QMAXSDU_CFG to 0 disables oversized frame * dropping. */ @@ -1544,9 +1627,15 @@ /* If traffic class doesn't support a full MTU sized * frame, make sure to enable oversize frame dropping * for frames larger than the smallest that would fit. + * + * However, the exact same register, QSYS_QMAXSDU_CFG_*, + * controls not only oversized frame dropping, but also + * per-tc static guard band lengths, so it reduces the + * useful gate interval length. Therefore, be careful + * to calculate a guard band (and therefore max_sdu) + * that still leaves 33 ns available in the time slot. */ - max_sdu = div_u64(min_gate_len[tc] * 1000, - picos_per_byte); + max_sdu = div_u64(remaining_gate_len_ps, picos_per_byte); /* A TC gate may be completely closed, which is a * special case where all packets are oversized. * Any limit smaller than 64 octets accomplishes this @@ -1569,47 +1658,14 @@ max_sdu); } - /* ocelot_write_rix is a macro that concatenates - * QSYS_MAXSDU_CFG_* with _RSZ, so we need to spell out - * the writes to each traffic class - */ - switch (tc) { - case 0: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_0, - port); - break; - case 1: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_1, - port); - break; - case 2: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_2, - port); - break; - case 3: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_3, - port); - break; - case 4: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_4, - port); - break; - case 5: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_5, - port); - break; - case 6: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_6, - port); - break; - case 7: - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_7, - port); - break; - } + vsc9959_port_qmaxsdu_set(ocelot, port, tc, max_sdu); } ocelot_write_rix(ocelot, maxlen, QSYS_PORT_MAX_SDU, port); + + ocelot->ops->cut_through_fwd(ocelot); + + mutex_unlock(&ocelot->fwd_domain_lock); } static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, @@ -1636,13 +1692,13 @@ break; } + mutex_lock(&ocelot->tas_lock); + ocelot_rmw_rix(ocelot, QSYS_TAG_CONFIG_LINK_SPEED(tas_speed), QSYS_TAG_CONFIG_LINK_SPEED_M, QSYS_TAG_CONFIG, port); - mutex_lock(&ocelot->tas_lock); - if (ocelot_port->taprio) vsc9959_tas_guard_bands_update(ocelot, port); @@ -2709,7 +2765,7 @@ { struct felix *felix = ocelot_to_felix(ocelot); struct dsa_switch *ds = felix->ds; - int port, other_port; + int tc, port, other_port; lockdep_assert_held(&ocelot->fwd_domain_lock); @@ -2753,19 +2809,27 @@ min_speed = other_ocelot_port->speed; } - /* Enable cut-through forwarding for all traffic classes. */ - if (ocelot_port->speed == min_speed) + /* Enable cut-through forwarding for all traffic classes that + * don't have oversized dropping enabled, since this check is + * bypassed in cut-through mode. + */ + if (ocelot_port->speed == min_speed) { val = GENMASK(7, 0); + for (tc = 0; tc < OCELOT_NUM_TC; tc++) + if (vsc9959_port_qmaxsdu_get(ocelot, port, tc)) + val &= ~BIT(tc); + } + set: tmp = ocelot_read_rix(ocelot, ANA_CUT_THRU_CFG, port); if (tmp == val) continue; dev_dbg(ocelot->dev, - "port %d fwd mask 0x%lx speed %d min_speed %d, %s cut-through forwarding\n", + "port %d fwd mask 0x%lx speed %d min_speed %d, %s cut-through forwarding on TC mask 0x%x\n", port, mask, ocelot_port->speed, min_speed, - val ? "enabling" : "disabling"); + val ? "enabling" : "disabling", val); ocelot_write_rix(ocelot, val, ANA_CUT_THRU_CFG, port); } diff -Nru linux-aws-5.19.0/drivers/net/dsa/xrs700x/xrs700x.c linux-aws-5.19.0/drivers/net/dsa/xrs700x/xrs700x.c --- linux-aws-5.19.0/drivers/net/dsa/xrs700x/xrs700x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/dsa/xrs700x/xrs700x.c 2022-11-29 07:06:46.000000000 +0000 @@ -109,6 +109,7 @@ { struct xrs700x_port *p = &priv->ports[port]; struct rtnl_link_stats64 stats; + unsigned long flags; int i; memset(&stats, 0, sizeof(stats)); @@ -138,9 +139,9 @@ */ stats.rx_packets += stats.multicast; - u64_stats_update_begin(&p->syncp); + flags = u64_stats_update_begin_irqsave(&p->syncp); p->stats64 = stats; - u64_stats_update_end(&p->syncp); + u64_stats_update_end_irqrestore(&p->syncp, flags); mutex_unlock(&p->mib_mutex); } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_main.c linux-aws-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_main.c --- linux-aws-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -94,11 +94,8 @@ int err = 0; err = aq_nic_stop(aq_nic); - if (err < 0) - goto err_exit; aq_nic_deinit(aq_nic, true); -err_exit: return err; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/atheros/alx/main.c linux-aws-5.19.0/drivers/net/ethernet/atheros/alx/main.c --- linux-aws-5.19.0/drivers/net/ethernet/atheros/alx/main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/atheros/alx/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1912,11 +1912,14 @@ if (!netif_running(alx->dev)) return 0; + + rtnl_lock(); netif_device_detach(alx->dev); mutex_lock(&alx->mtx); __alx_stop(alx); mutex_unlock(&alx->mtx); + rtnl_unlock(); return 0; } @@ -1927,6 +1930,7 @@ struct alx_hw *hw = &alx->hw; int err; + rtnl_lock(); mutex_lock(&alx->mtx); alx_reset_phy(hw); @@ -1943,6 +1947,7 @@ unlock: mutex_unlock(&alx->mtx); + rtnl_unlock(); return err; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c --- linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 2022-11-29 07:06:46.000000000 +0000 @@ -789,6 +789,7 @@ BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n", pad, len, fp->rx_buf_size); bnx2x_panic(); + bnx2x_frag_free(fp, new_data); return; } #endif diff -Nru linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c --- linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c 2022-11-29 07:06:46.000000000 +0000 @@ -662,7 +662,6 @@ for (i = 0; i < nr_pkts; i++) { struct bnxt_sw_tx_bd *tx_buf; - bool compl_deferred = false; struct sk_buff *skb; int j, last; @@ -671,6 +670,8 @@ skb = tx_buf->skb; tx_buf->skb = NULL; + tx_bytes += skb->len; + if (tx_buf->is_push) { tx_buf->is_push = 0; goto next_tx_int; @@ -691,8 +692,9 @@ } if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) { if (bp->flags & BNXT_FLAG_CHIP_P5) { + /* PTP worker takes ownership of the skb */ if (!bnxt_get_tx_ts_p5(bp, skb)) - compl_deferred = true; + skb = NULL; else atomic_inc(&bp->ptp_cfg->tx_avail); } @@ -701,9 +703,7 @@ next_tx_int: cons = NEXT_TX(cons); - tx_bytes += skb->len; - if (!compl_deferred) - dev_kfree_skb_any(skb); + dev_kfree_skb_any(skb); } netdev_tx_completed_queue(txq, nr_pkts, tx_bytes); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c --- linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c 2022-11-29 07:06:46.000000000 +0000 @@ -317,9 +317,9 @@ if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters & (PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE | - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE))) { + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE))) { ptp->tstamp_filters &= ~(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE | - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE); + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE); netdev_warn(bp->dev, "Unsupported FW for all RX pkts timestamp filter\n"); } @@ -505,9 +505,13 @@ ptp->tstamp_filters = flags; if (netif_running(bp->dev)) { - rc = bnxt_close_nic(bp, false, false); - if (!rc) - rc = bnxt_open_nic(bp, false, false); + if (ptp->rx_filter == HWTSTAMP_FILTER_ALL) { + rc = bnxt_close_nic(bp, false, false); + if (!rc) + rc = bnxt_open_nic(bp, false, false); + } else { + bnxt_ptp_cfg_tstamp_filters(bp); + } if (!rc && !ptp->tstamp_filters) rc = -EIO; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/broadcom/tg3.c linux-aws-5.19.0/drivers/net/ethernet/broadcom/tg3.c --- linux-aws-5.19.0/drivers/net/ethernet/broadcom/tg3.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/broadcom/tg3.c 2022-11-29 07:06:46.000000000 +0000 @@ -18076,16 +18076,20 @@ struct net_device *dev = pci_get_drvdata(pdev); struct tg3 *tp = netdev_priv(dev); + tg3_reset_task_cancel(tp); + rtnl_lock(); + netif_device_detach(dev); if (netif_running(dev)) dev_close(dev); - if (system_state == SYSTEM_POWER_OFF) - tg3_power_down(tp); + tg3_power_down(tp); rtnl_unlock(); + + pci_disable_device(pdev); } /** diff -Nru linux-aws-5.19.0/drivers/net/ethernet/cadence/macb_main.c linux-aws-5.19.0/drivers/net/ethernet/cadence/macb_main.c --- linux-aws-5.19.0/drivers/net/ethernet/cadence/macb_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/cadence/macb_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -5092,6 +5092,7 @@ if (!(bp->wol & MACB_WOL_ENABLED)) { rtnl_lock(); phylink_stop(bp->phylink); + phy_exit(bp->sgmii_phy); rtnl_unlock(); spin_lock_irqsave(&bp->lock, flags); macb_reset_hw(bp); @@ -5181,6 +5182,9 @@ macb_set_rx_mode(netdev); macb_restore_features(bp); rtnl_lock(); + if (!device_may_wakeup(&bp->dev->dev)) + phy_init(bp->sgmii_phy); + phylink_start(bp->phylink); rtnl_unlock(); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c linux-aws-5.19.0/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c --- linux-aws-5.19.0/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -14,6 +14,7 @@ #include "cudbg_entity.h" #include "cudbg_lib.h" #include "cudbg_zlib.h" +#include "cxgb4_tc_mqprio.h" static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] = { {0x7e40, 0x7e44, 0x020, 28}, /* t6_tp_pio_regs_20_to_3b */ @@ -3458,7 +3459,7 @@ for (i = 0; i < utxq->ntxq; i++) QDESC_GET_TXQ(&utxq->uldtxq[i].q, cudbg_uld_txq_to_qtype(j), - out_unlock); + out_unlock_uld); } } @@ -3475,7 +3476,7 @@ for (i = 0; i < urxq->nrxq; i++) QDESC_GET_RXQ(&urxq->uldrxq[i].rspq, cudbg_uld_rxq_to_qtype(j), - out_unlock); + out_unlock_uld); } /* ULD FLQ */ @@ -3487,7 +3488,7 @@ for (i = 0; i < urxq->nrxq; i++) QDESC_GET_FLQ(&urxq->uldrxq[i].fl, cudbg_uld_flq_to_qtype(j), - out_unlock); + out_unlock_uld); } /* ULD CIQ */ @@ -3500,29 +3501,34 @@ for (i = 0; i < urxq->nciq; i++) QDESC_GET_RXQ(&urxq->uldrxq[base + i].rspq, cudbg_uld_ciq_to_qtype(j), - out_unlock); + out_unlock_uld); } } + mutex_unlock(&uld_mutex); + + if (!padap->tc_mqprio) + goto out; + mutex_lock(&padap->tc_mqprio->mqprio_mutex); /* ETHOFLD TXQ */ if (s->eohw_txq) for (i = 0; i < s->eoqsets; i++) QDESC_GET_TXQ(&s->eohw_txq[i].q, - CUDBG_QTYPE_ETHOFLD_TXQ, out); + CUDBG_QTYPE_ETHOFLD_TXQ, out_unlock_mqprio); /* ETHOFLD RXQ and FLQ */ if (s->eohw_rxq) { for (i = 0; i < s->eoqsets; i++) QDESC_GET_RXQ(&s->eohw_rxq[i].rspq, - CUDBG_QTYPE_ETHOFLD_RXQ, out); + CUDBG_QTYPE_ETHOFLD_RXQ, out_unlock_mqprio); for (i = 0; i < s->eoqsets; i++) QDESC_GET_FLQ(&s->eohw_rxq[i].fl, - CUDBG_QTYPE_ETHOFLD_FLQ, out); + CUDBG_QTYPE_ETHOFLD_FLQ, out_unlock_mqprio); } -out_unlock: - mutex_unlock(&uld_mutex); +out_unlock_mqprio: + mutex_unlock(&padap->tc_mqprio->mqprio_mutex); out: qdesc_info->qdesc_entry_size = sizeof(*qdesc_entry); @@ -3559,6 +3565,10 @@ #undef QDESC_GET return rc; + +out_unlock_uld: + mutex_unlock(&uld_mutex); + goto out; } int cudbg_collect_flash(struct cudbg_init *pdbg_init, diff -Nru linux-aws-5.19.0/drivers/net/ethernet/cortina/gemini.c linux-aws-5.19.0/drivers/net/ethernet/cortina/gemini.c --- linux-aws-5.19.0/drivers/net/ethernet/cortina/gemini.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/cortina/gemini.c 2022-11-29 07:06:46.000000000 +0000 @@ -1919,7 +1919,7 @@ /* Racing with RX NAPI */ do { - start = u64_stats_fetch_begin(&port->rx_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->rx_stats_syncp); stats->rx_packets = port->stats.rx_packets; stats->rx_bytes = port->stats.rx_bytes; @@ -1931,11 +1931,11 @@ stats->rx_crc_errors = port->stats.rx_crc_errors; stats->rx_frame_errors = port->stats.rx_frame_errors; - } while (u64_stats_fetch_retry(&port->rx_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->rx_stats_syncp, start)); /* Racing with MIB and TX completion interrupts */ do { - start = u64_stats_fetch_begin(&port->ir_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->ir_stats_syncp); stats->tx_errors = port->stats.tx_errors; stats->tx_packets = port->stats.tx_packets; @@ -1945,15 +1945,15 @@ stats->rx_missed_errors = port->stats.rx_missed_errors; stats->rx_fifo_errors = port->stats.rx_fifo_errors; - } while (u64_stats_fetch_retry(&port->ir_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->ir_stats_syncp, start)); /* Racing with hard_start_xmit */ do { - start = u64_stats_fetch_begin(&port->tx_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->tx_stats_syncp); stats->tx_dropped = port->stats.tx_dropped; - } while (u64_stats_fetch_retry(&port->tx_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->tx_stats_syncp, start)); stats->rx_dropped += stats->rx_missed_errors; } @@ -2031,18 +2031,18 @@ /* Racing with MIB interrupt */ do { p = values; - start = u64_stats_fetch_begin(&port->ir_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->ir_stats_syncp); for (i = 0; i < RX_STATS_NUM; i++) *p++ = port->hw_stats[i]; - } while (u64_stats_fetch_retry(&port->ir_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->ir_stats_syncp, start)); values = p; /* Racing with RX NAPI */ do { p = values; - start = u64_stats_fetch_begin(&port->rx_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->rx_stats_syncp); for (i = 0; i < RX_STATUS_NUM; i++) *p++ = port->rx_stats[i]; @@ -2050,13 +2050,13 @@ *p++ = port->rx_csum_stats[i]; *p++ = port->rx_napi_exits; - } while (u64_stats_fetch_retry(&port->rx_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->rx_stats_syncp, start)); values = p; /* Racing with TX start_xmit */ do { p = values; - start = u64_stats_fetch_begin(&port->tx_stats_syncp); + start = u64_stats_fetch_begin_irq(&port->tx_stats_syncp); for (i = 0; i < TX_MAX_FRAGS; i++) { *values++ = port->tx_frag_stats[i]; @@ -2065,7 +2065,7 @@ *values++ = port->tx_frags_linearized; *values++ = port->tx_hw_csummed; - } while (u64_stats_fetch_retry(&port->tx_stats_syncp, start)); + } while (u64_stats_fetch_retry_irq(&port->tx_stats_syncp, start)); } static int gmac_get_ksettings(struct net_device *netdev, diff -Nru linux-aws-5.19.0/drivers/net/ethernet/engleder/tsnep_hw.h linux-aws-5.19.0/drivers/net/ethernet/engleder/tsnep_hw.h --- linux-aws-5.19.0/drivers/net/ethernet/engleder/tsnep_hw.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/engleder/tsnep_hw.h 2022-11-29 07:06:46.000000000 +0000 @@ -92,8 +92,7 @@ /* tsnep register */ #define TSNEP_INFO 0x0100 -#define TSNEP_INFO_RX_ASSIGN 0x00010000 -#define TSNEP_INFO_TX_TIME 0x00020000 +#define TSNEP_INFO_TX_TIME 0x00010000 #define TSNEP_CONTROL 0x0108 #define TSNEP_CONTROL_TX_RESET 0x00000001 #define TSNEP_CONTROL_TX_ENABLE 0x00000002 diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c 2022-11-29 07:06:46.000000000 +0000 @@ -2432,7 +2432,7 @@ return 0; } -static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) +int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct tc_mqprio_qopt *mqprio = type_data; @@ -2486,25 +2486,6 @@ return 0; } -int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, - void *type_data) -{ - switch (type) { - case TC_SETUP_QDISC_MQPRIO: - return enetc_setup_tc_mqprio(ndev, type_data); - case TC_SETUP_QDISC_TAPRIO: - return enetc_setup_tc_taprio(ndev, type_data); - case TC_SETUP_QDISC_CBS: - return enetc_setup_tc_cbs(ndev, type_data); - case TC_SETUP_QDISC_ETF: - return enetc_setup_tc_txtime(ndev, type_data); - case TC_SETUP_BLOCK: - return enetc_setup_tc_psfp(ndev, type_data); - default: - return -EOPNOTSUPP; - } -} - static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { @@ -2600,29 +2581,6 @@ return 0; } -static int enetc_set_psfp(struct net_device *ndev, int en) -{ - struct enetc_ndev_priv *priv = netdev_priv(ndev); - int err; - - if (en) { - err = enetc_psfp_enable(priv); - if (err) - return err; - - priv->active_offloads |= ENETC_F_QCI; - return 0; - } - - err = enetc_psfp_disable(priv); - if (err) - return err; - - priv->active_offloads &= ~ENETC_F_QCI; - - return 0; -} - static void enetc_enable_rxvlan(struct net_device *ndev, bool en) { struct enetc_ndev_priv *priv = netdev_priv(ndev); @@ -2641,11 +2599,9 @@ enetc_bdr_enable_txvlan(&priv->si->hw, i, en); } -int enetc_set_features(struct net_device *ndev, - netdev_features_t features) +void enetc_set_features(struct net_device *ndev, netdev_features_t features) { netdev_features_t changed = ndev->features ^ features; - int err = 0; if (changed & NETIF_F_RXHASH) enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH)); @@ -2657,11 +2613,6 @@ if (changed & NETIF_F_HW_VLAN_CTAG_TX) enetc_enable_txvlan(ndev, !!(features & NETIF_F_HW_VLAN_CTAG_TX)); - - if (changed & NETIF_F_HW_TC) - err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); - - return err; } #ifdef CONFIG_FSL_ENETC_PTP_CLOCK diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.h linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.h --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.h 2022-11-29 07:06:46.000000000 +0000 @@ -393,11 +393,9 @@ void enetc_stop(struct net_device *ndev); netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev); struct net_device_stats *enetc_get_stats(struct net_device *ndev); -int enetc_set_features(struct net_device *ndev, - netdev_features_t features); +void enetc_set_features(struct net_device *ndev, netdev_features_t features); int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd); -int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, - void *type_data); +int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data); int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp); int enetc_xdp_xmit(struct net_device *ndev, int num_frames, struct xdp_frame **frames, u32 flags); @@ -465,6 +463,7 @@ int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data); int enetc_psfp_init(struct enetc_ndev_priv *priv); int enetc_psfp_clean(struct enetc_ndev_priv *priv); +int enetc_set_psfp(struct net_device *ndev, bool en); static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv) { @@ -540,4 +539,9 @@ { return 0; } + +static inline int enetc_set_psfp(struct net_device *ndev, bool en) +{ + return 0; +} #endif diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_pf.c linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_pf.c --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_pf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_pf.c 2022-11-29 07:06:46.000000000 +0000 @@ -709,6 +709,13 @@ { netdev_features_t changed = ndev->features ^ features; struct enetc_ndev_priv *priv = netdev_priv(ndev); + int err; + + if (changed & NETIF_F_HW_TC) { + err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); + if (err) + return err; + } if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { struct enetc_pf *pf = enetc_si_priv(priv->si); @@ -722,7 +729,28 @@ if (changed & NETIF_F_LOOPBACK) enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK)); - return enetc_set_features(ndev, features); + enetc_set_features(ndev, features); + + return 0; +} + +static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type type, + void *type_data) +{ + switch (type) { + case TC_SETUP_QDISC_MQPRIO: + return enetc_setup_tc_mqprio(ndev, type_data); + case TC_SETUP_QDISC_TAPRIO: + return enetc_setup_tc_taprio(ndev, type_data); + case TC_SETUP_QDISC_CBS: + return enetc_setup_tc_cbs(ndev, type_data); + case TC_SETUP_QDISC_ETF: + return enetc_setup_tc_txtime(ndev, type_data); + case TC_SETUP_BLOCK: + return enetc_setup_tc_psfp(ndev, type_data); + default: + return -EOPNOTSUPP; + } } static const struct net_device_ops enetc_ndev_ops = { @@ -739,7 +767,7 @@ .ndo_set_vf_spoofchk = enetc_pf_set_vf_spoofchk, .ndo_set_features = enetc_pf_set_features, .ndo_eth_ioctl = enetc_ioctl, - .ndo_setup_tc = enetc_setup_tc, + .ndo_setup_tc = enetc_pf_setup_tc, .ndo_bpf = enetc_setup_bpf, .ndo_xdp_xmit = enetc_xdp_xmit, }; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c 2022-11-29 07:06:46.000000000 +0000 @@ -1517,6 +1517,29 @@ } } +int enetc_set_psfp(struct net_device *ndev, bool en) +{ + struct enetc_ndev_priv *priv = netdev_priv(ndev); + int err; + + if (en) { + err = enetc_psfp_enable(priv); + if (err) + return err; + + priv->active_offloads |= ENETC_F_QCI; + return 0; + } + + err = enetc_psfp_disable(priv); + if (err) + return err; + + priv->active_offloads &= ~ENETC_F_QCI; + + return 0; +} + int enetc_psfp_init(struct enetc_ndev_priv *priv) { if (epsfp.psfp_sfi_bitmap) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_vf.c linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_vf.c --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_vf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/enetc_vf.c 2022-11-29 07:06:46.000000000 +0000 @@ -88,7 +88,20 @@ static int enetc_vf_set_features(struct net_device *ndev, netdev_features_t features) { - return enetc_set_features(ndev, features); + enetc_set_features(ndev, features); + + return 0; +} + +static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type type, + void *type_data) +{ + switch (type) { + case TC_SETUP_QDISC_MQPRIO: + return enetc_setup_tc_mqprio(ndev, type_data); + default: + return -EOPNOTSUPP; + } } /* Probing/ Init */ @@ -100,7 +113,7 @@ .ndo_set_mac_address = enetc_vf_set_mac_addr, .ndo_set_features = enetc_vf_set_features, .ndo_eth_ioctl = enetc_ioctl, - .ndo_setup_tc = enetc_setup_tc, + .ndo_setup_tc = enetc_vf_setup_tc, }; static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/Makefile linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/Makefile --- linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/enetc/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -9,7 +9,6 @@ obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o fsl-enetc-vf-y := enetc_vf.o $(common-objs) -fsl-enetc-vf-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o fsl-enetc-ierb-y := enetc_ierb.o diff -Nru linux-aws-5.19.0/drivers/net/ethernet/freescale/fs_enet/mac-fec.c linux-aws-5.19.0/drivers/net/ethernet/freescale/fs_enet/mac-fec.c --- linux-aws-5.19.0/drivers/net/ethernet/freescale/fs_enet/mac-fec.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/freescale/fs_enet/mac-fec.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,7 +98,7 @@ return -EINVAL; fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0); - if (!fep->fcc.fccp) + if (!fep->fec.fecp) return -EINVAL; return 0; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/fungible/funeth/funeth_txrx.h linux-aws-5.19.0/drivers/net/ethernet/fungible/funeth/funeth_txrx.h --- linux-aws-5.19.0/drivers/net/ethernet/fungible/funeth/funeth_txrx.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/fungible/funeth/funeth_txrx.h 2022-11-29 07:06:46.000000000 +0000 @@ -205,9 +205,9 @@ #define FUN_QSTAT_READ(q, seq, stats_copy) \ do { \ - seq = u64_stats_fetch_begin(&(q)->syncp); \ + seq = u64_stats_fetch_begin_irq(&(q)->syncp); \ stats_copy = (q)->stats; \ - } while (u64_stats_fetch_retry(&(q)->syncp, (seq))) + } while (u64_stats_fetch_retry_irq(&(q)->syncp, (seq))) #define FUN_INT_NAME_LEN (IFNAMSIZ + 16) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_ethtool.c linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_ethtool.c --- linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_ethtool.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_ethtool.c 2022-11-29 07:06:46.000000000 +0000 @@ -177,14 +177,14 @@ struct gve_rx_ring *rx = &priv->rx[ring]; start = - u64_stats_fetch_begin(&priv->rx[ring].statss); + u64_stats_fetch_begin_irq(&priv->rx[ring].statss); tmp_rx_pkts = rx->rpackets; tmp_rx_bytes = rx->rbytes; tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail; tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail; tmp_rx_desc_err_dropped_pkt = rx->rx_desc_err_dropped_pkt; - } while (u64_stats_fetch_retry(&priv->rx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->rx[ring].statss, start)); rx_pkts += tmp_rx_pkts; rx_bytes += tmp_rx_bytes; @@ -198,10 +198,10 @@ if (priv->tx) { do { start = - u64_stats_fetch_begin(&priv->tx[ring].statss); + u64_stats_fetch_begin_irq(&priv->tx[ring].statss); tmp_tx_pkts = priv->tx[ring].pkt_done; tmp_tx_bytes = priv->tx[ring].bytes_done; - } while (u64_stats_fetch_retry(&priv->tx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->tx[ring].statss, start)); tx_pkts += tmp_tx_pkts; tx_bytes += tmp_tx_bytes; @@ -259,13 +259,13 @@ data[i++] = rx->fill_cnt - rx->cnt; do { start = - u64_stats_fetch_begin(&priv->rx[ring].statss); + u64_stats_fetch_begin_irq(&priv->rx[ring].statss); tmp_rx_bytes = rx->rbytes; tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail; tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail; tmp_rx_desc_err_dropped_pkt = rx->rx_desc_err_dropped_pkt; - } while (u64_stats_fetch_retry(&priv->rx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->rx[ring].statss, start)); data[i++] = tmp_rx_bytes; data[i++] = rx->rx_cont_packet_cnt; @@ -331,9 +331,9 @@ } do { start = - u64_stats_fetch_begin(&priv->tx[ring].statss); + u64_stats_fetch_begin_irq(&priv->tx[ring].statss); tmp_tx_bytes = tx->bytes_done; - } while (u64_stats_fetch_retry(&priv->tx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->tx[ring].statss, start)); data[i++] = tmp_tx_bytes; data[i++] = tx->wake_queue; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_main.c linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_main.c --- linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -51,10 +51,10 @@ for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) { do { start = - u64_stats_fetch_begin(&priv->rx[ring].statss); + u64_stats_fetch_begin_irq(&priv->rx[ring].statss); packets = priv->rx[ring].rpackets; bytes = priv->rx[ring].rbytes; - } while (u64_stats_fetch_retry(&priv->rx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->rx[ring].statss, start)); s->rx_packets += packets; s->rx_bytes += bytes; @@ -64,10 +64,10 @@ for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) { do { start = - u64_stats_fetch_begin(&priv->tx[ring].statss); + u64_stats_fetch_begin_irq(&priv->tx[ring].statss); packets = priv->tx[ring].pkt_done; bytes = priv->tx[ring].bytes_done; - } while (u64_stats_fetch_retry(&priv->tx[ring].statss, + } while (u64_stats_fetch_retry_irq(&priv->tx[ring].statss, start)); s->tx_packets += packets; s->tx_bytes += bytes; @@ -1274,9 +1274,9 @@ } do { - start = u64_stats_fetch_begin(&priv->tx[idx].statss); + start = u64_stats_fetch_begin_irq(&priv->tx[idx].statss); tx_bytes = priv->tx[idx].bytes_done; - } while (u64_stats_fetch_retry(&priv->tx[idx].statss, start)); + } while (u64_stats_fetch_retry_irq(&priv->tx[idx].statss, start)); stats[stats_idx++] = (struct stats) { .stat_name = cpu_to_be32(TX_WAKE_CNT), .value = cpu_to_be64(priv->tx[idx].wake_queue), diff -Nru linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c --- linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/google/gve/gve_rx_dqo.c 2022-11-29 07:06:46.000000000 +0000 @@ -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 -Nru linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_rx.c linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_rx.c --- linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_rx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_rx.c 2022-11-29 07:06:46.000000000 +0000 @@ -74,14 +74,14 @@ unsigned int start; do { - start = u64_stats_fetch_begin(&rxq_stats->syncp); + start = u64_stats_fetch_begin_irq(&rxq_stats->syncp); stats->pkts = rxq_stats->pkts; stats->bytes = rxq_stats->bytes; stats->errors = rxq_stats->csum_errors + rxq_stats->other_errors; stats->csum_errors = rxq_stats->csum_errors; stats->other_errors = rxq_stats->other_errors; - } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); + } while (u64_stats_fetch_retry_irq(&rxq_stats->syncp, start)); } /** diff -Nru linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_tx.c linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_tx.c --- linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_tx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_tx.c 2022-11-29 07:06:46.000000000 +0000 @@ -99,14 +99,14 @@ unsigned int start; do { - start = u64_stats_fetch_begin(&txq_stats->syncp); + start = u64_stats_fetch_begin_irq(&txq_stats->syncp); stats->pkts = txq_stats->pkts; stats->bytes = txq_stats->bytes; stats->tx_busy = txq_stats->tx_busy; stats->tx_wake = txq_stats->tx_wake; stats->tx_dropped = txq_stats->tx_dropped; stats->big_frags_pkts = txq_stats->big_frags_pkts; - } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); + } while (u64_stats_fetch_retry_irq(&txq_stats->syncp, start)); } /** diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_client.c linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_client.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_client.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_client.c 2022-11-29 07:06:46.000000000 +0000 @@ -177,6 +177,10 @@ "Cannot locate client instance close routine\n"); return; } + if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) { + dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n"); + return; + } cdev->client->ops->close(&cdev->lan_info, cdev->client, reset); clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); i40e_client_release_qvlist(&cdev->lan_info); @@ -429,7 +433,6 @@ /* Remove failed client instance */ clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); - i40e_client_del_instance(pf); return; } } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 2022-11-29 07:06:46.000000000 +0000 @@ -4931,7 +4931,7 @@ /* We do not support setting channels via ethtool when TCs are * configured through mqprio */ - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) return -EINVAL; /* verify they are not requesting separate vectors */ diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e.h linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e.h --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e.h 2022-11-29 07:06:46.000000000 +0000 @@ -1291,4 +1291,18 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi, struct i40e_cloud_filter *filter, bool add); + +/** + * i40e_is_tc_mqprio_enabled - check if TC MQPRIO is enabled on PF + * @pf: pointer to a pf. + * + * Check and return value of flag I40E_FLAG_TC_MQPRIO. + * + * Return: I40E_FLAG_TC_MQPRIO set state. + **/ +static inline u32 i40e_is_tc_mqprio_enabled(struct i40e_pf *pf) +{ + return pf->flags & I40E_FLAG_TC_MQPRIO; +} + #endif /* _I40E_H_ */ diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -5339,7 +5339,7 @@ u8 num_tc = 0; struct i40e_dcbx_config *dcbcfg = &hw->local_dcbx_config; - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) return pf->vsi[pf->lan_vsi]->mqprio_qopt.qopt.num_tc; /* If neither MQPRIO nor DCB is enabled, then always use single TC */ @@ -5371,7 +5371,7 @@ **/ static u8 i40e_pf_get_tc_map(struct i40e_pf *pf) { - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) return i40e_mqprio_get_enabled_tc(pf); /* If neither MQPRIO nor DCB is enabled for this PF then just return @@ -5468,7 +5468,7 @@ int i; /* There is no need to reset BW when mqprio mode is on. */ - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) return 0; if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) { ret = i40e_set_bw_limit(vsi, vsi->seid, 0); @@ -5540,7 +5540,7 @@ vsi->tc_config.tc_info[i].qoffset); } - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) return; /* Assign UP2TC map for the VSI */ @@ -5701,7 +5701,7 @@ ctxt.vf_num = 0; ctxt.uplink_seid = vsi->uplink_seid; ctxt.info = vsi->info; - if (vsi->back->flags & I40E_FLAG_TC_MQPRIO) { + if (i40e_is_tc_mqprio_enabled(pf)) { ret = i40e_vsi_setup_queue_map_mqprio(vsi, &ctxt, enabled_tc); if (ret) goto out; @@ -5786,6 +5786,26 @@ } /** + * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits + * @vsi: Pointer to vsi structure + * @max_tx_rate: max TX rate in bytes to be converted into Mbits + * + * Helper function to convert units before send to set BW limit + **/ +static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate) +{ + if (max_tx_rate < I40E_BW_MBPS_DIVISOR) { + dev_warn(&vsi->back->pdev->dev, + "Setting max tx rate to minimum usable value of 50Mbps.\n"); + max_tx_rate = I40E_BW_CREDIT_DIVISOR; + } else { + do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); + } + + return max_tx_rate; +} + +/** * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate * @vsi: VSI to be configured * @seid: seid of the channel/VSI @@ -5807,10 +5827,10 @@ max_tx_rate, seid); return -EINVAL; } - if (max_tx_rate && max_tx_rate < 50) { + if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) { dev_warn(&pf->pdev->dev, "Setting max tx rate to minimum usable value of 50Mbps.\n"); - max_tx_rate = 50; + max_tx_rate = I40E_BW_CREDIT_DIVISOR; } /* Tx rate credits are in values of 50Mbps, 0 is disabled */ @@ -6425,7 +6445,7 @@ pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; if (vsi->type == I40E_VSI_MAIN) { - if (pf->flags & I40E_FLAG_TC_MQPRIO) + if (i40e_is_tc_mqprio_enabled(pf)) i40e_do_reset(pf, I40E_PF_RESET_FLAG, true); else i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); @@ -6536,6 +6556,9 @@ vsi->tc_seid_map[i] = ch->seid; } } + + /* reset to reconfigure TX queue contexts */ + i40e_do_reset(vsi->back, I40E_PF_RESET_FLAG, true); return ret; err_free: @@ -7819,7 +7842,7 @@ netdev_info(netdev, "Macvlans are not supported when DCB is enabled\n"); return ERR_PTR(-EINVAL); } - if ((pf->flags & I40E_FLAG_TC_MQPRIO)) { + if (i40e_is_tc_mqprio_enabled(pf)) { netdev_info(netdev, "Macvlans are not supported when HW TC offload is on\n"); return ERR_PTR(-EINVAL); } @@ -8072,7 +8095,7 @@ /* Quiesce VSI queues */ i40e_quiesce_vsi(vsi); - if (!hw && !(pf->flags & I40E_FLAG_TC_MQPRIO)) + if (!hw && !i40e_is_tc_mqprio_enabled(pf)) i40e_remove_queue_channels(vsi); /* Configure VSI for enabled TCs */ @@ -8096,11 +8119,11 @@ "Setup channel (id:%u) utilizing num_queues %d\n", vsi->seid, vsi->tc_config.tc_info[0].qcount); - if (pf->flags & I40E_FLAG_TC_MQPRIO) { + if (i40e_is_tc_mqprio_enabled(pf)) { if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (!ret) { u64 credits = max_tx_rate; @@ -10750,7 +10773,7 @@ * unless I40E_FLAG_TC_MQPRIO was enabled or DCB * is not supported with new link speed */ - if (pf->flags & I40E_FLAG_TC_MQPRIO) { + if (i40e_is_tc_mqprio_enabled(pf)) { i40e_aq_set_dcb_parameters(hw, false, NULL); } else { if (I40E_IS_X710TL_DEVICE(hw->device_id) && @@ -10845,10 +10868,10 @@ } if (vsi->mqprio_qopt.max_rate[0]) { - u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0]; + u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi, + vsi->mqprio_qopt.max_rate[0]); u64 credits = 0; - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); if (ret) goto end_unlock; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c 2022-11-29 07:06:46.000000000 +0000 @@ -3689,7 +3689,8 @@ u8 prio; /* is DCB enabled at all? */ - if (vsi->tc_config.numtc == 1) + if (vsi->tc_config.numtc == 1 || + i40e_is_tc_mqprio_enabled(vsi->back)) return netdev_pick_tx(netdev, skb, sb_dev); prio = skb->priority; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c 2022-11-29 07:06:46.000000000 +0000 @@ -2039,6 +2039,25 @@ } /** + * i40e_vc_get_max_frame_size + * @vf: pointer to the VF + * + * Max frame size is determined based on the current port's max frame size and + * whether a port VLAN is configured on this VF. The VF is not aware whether + * it's in a port VLAN so the PF needs to account for this in max frame size + * checks and sending the max frame size to the VF. + **/ +static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf) +{ + u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; + + if (vf->port_vlan_id) + max_frame_size -= VLAN_HLEN; + + return max_frame_size; +} + +/** * i40e_vc_get_vf_resources_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer @@ -2139,6 +2158,7 @@ vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE; vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE; + vfres->max_mtu = i40e_vc_get_max_frame_size(vf); if (vf->lan_vsi_idx) { vfres->vsi_res[0].vsi_id = vf->lan_vsi_id; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_main.c linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_main.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1184,66 +1184,138 @@ } /** - * iavf_down - Shutdown the connection processing + * iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF + * yet and mark other to be removed. * @adapter: board private structure - * - * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. **/ -void iavf_down(struct iavf_adapter *adapter) +static void iavf_clear_mac_vlan_filters(struct iavf_adapter *adapter) { - struct net_device *netdev = adapter->netdev; - struct iavf_vlan_filter *vlf; - struct iavf_cloud_filter *cf; - struct iavf_fdir_fltr *fdir; - struct iavf_mac_filter *f; - struct iavf_adv_rss *rss; - - if (adapter->state <= __IAVF_DOWN_PENDING) - return; - - netif_carrier_off(netdev); - netif_tx_disable(netdev); - adapter->link_up = false; - iavf_napi_disable_all(adapter); - iavf_irq_disable(adapter); + struct iavf_vlan_filter *vlf, *vlftmp; + struct iavf_mac_filter *f, *ftmp; spin_lock_bh(&adapter->mac_vlan_list_lock); - /* clear the sync flag on all filters */ __dev_uc_unsync(adapter->netdev, NULL); __dev_mc_unsync(adapter->netdev, NULL); /* remove all MAC filters */ - list_for_each_entry(f, &adapter->mac_filter_list, list) { - f->remove = true; + list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, + list) { + if (f->add) { + list_del(&f->list); + kfree(f); + } else { + f->remove = true; + } } /* remove all VLAN filters */ - list_for_each_entry(vlf, &adapter->vlan_filter_list, list) { - vlf->remove = true; + list_for_each_entry_safe(vlf, vlftmp, &adapter->vlan_filter_list, + list) { + if (vlf->add) { + list_del(&vlf->list); + kfree(vlf); + } else { + vlf->remove = true; + } } - spin_unlock_bh(&adapter->mac_vlan_list_lock); +} + +/** + * iavf_clear_cloud_filters - Remove cloud filters not sent to PF yet and + * mark other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_cloud_filters(struct iavf_adapter *adapter) +{ + struct iavf_cloud_filter *cf, *cftmp; /* remove all cloud filters */ spin_lock_bh(&adapter->cloud_filter_list_lock); - list_for_each_entry(cf, &adapter->cloud_filter_list, list) { - cf->del = true; + list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, + list) { + if (cf->add) { + list_del(&cf->list); + kfree(cf); + adapter->num_cloud_filters--; + } else { + cf->del = true; + } } spin_unlock_bh(&adapter->cloud_filter_list_lock); +} + +/** + * iavf_clear_fdir_filters - Remove fdir filters not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_fdir_filters(struct iavf_adapter *adapter) +{ + struct iavf_fdir_fltr *fdir, *fdirtmp; /* remove all Flow Director filters */ spin_lock_bh(&adapter->fdir_fltr_lock); - list_for_each_entry(fdir, &adapter->fdir_list_head, list) { - fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + list_for_each_entry_safe(fdir, fdirtmp, &adapter->fdir_list_head, + list) { + if (fdir->state == IAVF_FDIR_FLTR_ADD_REQUEST) { + list_del(&fdir->list); + kfree(fdir); + adapter->fdir_active_fltr--; + } else { + fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + } } spin_unlock_bh(&adapter->fdir_fltr_lock); +} + +/** + * iavf_clear_adv_rss_conf - Remove adv rss conf not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_adv_rss_conf(struct iavf_adapter *adapter) +{ + struct iavf_adv_rss *rss, *rsstmp; /* remove all advance RSS configuration */ spin_lock_bh(&adapter->adv_rss_lock); - list_for_each_entry(rss, &adapter->adv_rss_list_head, list) - rss->state = IAVF_ADV_RSS_DEL_REQUEST; + list_for_each_entry_safe(rss, rsstmp, &adapter->adv_rss_list_head, + list) { + if (rss->state == IAVF_ADV_RSS_ADD_REQUEST) { + list_del(&rss->list); + kfree(rss); + } else { + rss->state = IAVF_ADV_RSS_DEL_REQUEST; + } + } spin_unlock_bh(&adapter->adv_rss_lock); +} + +/** + * iavf_down - Shutdown the connection processing + * @adapter: board private structure + * + * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. + **/ +void iavf_down(struct iavf_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + + if (adapter->state <= __IAVF_DOWN_PENDING) + return; + + netif_carrier_off(netdev); + netif_tx_disable(netdev); + adapter->link_up = false; + iavf_napi_disable_all(adapter); + iavf_irq_disable(adapter); + + iavf_clear_mac_vlan_filters(adapter); + iavf_clear_cloud_filters(adapter); + iavf_clear_fdir_filters(adapter); + iavf_clear_adv_rss_conf(adapter); if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) { /* cancel any current operation */ @@ -1252,11 +1324,16 @@ * here for this to complete. The watchdog is still running * and it will take care of this. */ - adapter->aq_required = IAVF_FLAG_AQ_DEL_MAC_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; + if (!list_empty(&adapter->mac_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER; + if (!list_empty(&adapter->vlan_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; + if (!list_empty(&adapter->cloud_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; + if (!list_empty(&adapter->fdir_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; + if (!list_empty(&adapter->adv_rss_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES; } @@ -2789,6 +2866,11 @@ int i = 0, err; bool running; + /* Detach interface to avoid subsequent NDO callbacks */ + rtnl_lock(); + netif_device_detach(netdev); + rtnl_unlock(); + /* When device is being removed it doesn't make sense to run the reset * task, just return in such a case. */ @@ -2796,7 +2878,7 @@ if (adapter->state != __IAVF_REMOVE) queue_work(iavf_wq, &adapter->reset_task); - return; + goto reset_finish; } while (!mutex_trylock(&adapter->client_lock)) @@ -2866,7 +2948,6 @@ if (running) { netif_carrier_off(netdev); - netif_tx_stop_all_queues(netdev); adapter->link_up = false; iavf_napi_disable_all(adapter); } @@ -2996,7 +3077,7 @@ mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->crit_lock); - return; + goto reset_finish; reset_err: if (running) { set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); @@ -3007,6 +3088,10 @@ mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->crit_lock); dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); +reset_finish: + rtnl_lock(); + netif_device_attach(netdev); + rtnl_unlock(); } /** @@ -4074,6 +4159,7 @@ static int iavf_close(struct net_device *netdev) { struct iavf_adapter *adapter = netdev_priv(netdev); + u64 aq_to_restore; int status; mutex_lock(&adapter->crit_lock); @@ -4086,6 +4172,29 @@ set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); if (CLIENT_ENABLED(adapter)) adapter->flags |= IAVF_FLAG_CLIENT_NEEDS_CLOSE; + /* We cannot send IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS before + * IAVF_FLAG_AQ_DISABLE_QUEUES because in such case there is rtnl + * deadlock with adminq_task() until iavf_close timeouts. We must send + * IAVF_FLAG_AQ_GET_CONFIG before IAVF_FLAG_AQ_DISABLE_QUEUES to make + * disable queues possible for vf. Give only necessary flags to + * iavf_down and save other to set them right before iavf_close() + * returns, when IAVF_FLAG_AQ_DISABLE_QUEUES will be already sent and + * iavf will be in DOWN state. + */ + aq_to_restore = adapter->aq_required; + adapter->aq_required &= IAVF_FLAG_AQ_GET_CONFIG; + + /* Remove flags which we do not want to send after close or we want to + * send before disable queues. + */ + aq_to_restore &= ~(IAVF_FLAG_AQ_GET_CONFIG | + IAVF_FLAG_AQ_ENABLE_QUEUES | + IAVF_FLAG_AQ_CONFIGURE_QUEUES | + IAVF_FLAG_AQ_ADD_VLAN_FILTER | + IAVF_FLAG_AQ_ADD_MAC_FILTER | + IAVF_FLAG_AQ_ADD_CLOUD_FILTER | + IAVF_FLAG_AQ_ADD_FDIR_FILTER | + IAVF_FLAG_AQ_ADD_ADV_RSS_CFG); iavf_down(adapter); iavf_change_state(adapter, __IAVF_DOWN_PENDING); @@ -4109,6 +4218,10 @@ msecs_to_jiffies(500)); if (!status) netdev_warn(netdev, "Device resources not yet released\n"); + + mutex_lock(&adapter->crit_lock); + adapter->aq_required |= aq_to_restore; + mutex_unlock(&adapter->crit_lock); return 0; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_txrx.c linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_txrx.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_txrx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_txrx.c 2022-11-29 07:06:46.000000000 +0000 @@ -114,8 +114,11 @@ { u32 head, tail; + /* underlying hardware might not allow access and/or always return + * 0 for the head/tail registers so just use the cached values + */ head = ring->next_to_clean; - tail = readl(ring->tail); + tail = ring->next_to_use; if (head != tail) return (head < tail) ? @@ -1390,7 +1393,7 @@ #endif struct sk_buff *skb; - if (!rx_buffer) + if (!rx_buffer || !size) return NULL; /* prefetch first cache line of first page */ va = page_address(rx_buffer->page) + rx_buffer->page_offset; @@ -1548,7 +1551,7 @@ /* exit if we failed to retrieve a buffer */ if (!skb) { rx_ring->rx_stats.alloc_buff_failed++; - if (rx_buffer) + if (rx_buffer && size) rx_buffer->pagecnt_bias++; break; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c 2022-11-29 07:06:46.000000000 +0000 @@ -273,11 +273,14 @@ void iavf_configure_queues(struct iavf_adapter *adapter) { struct virtchnl_vsi_queue_config_info *vqci; - struct virtchnl_queue_pair_info *vqpi; + int i, max_frame = adapter->vf_res->max_mtu; int pairs = adapter->num_active_queues; - int i, max_frame = IAVF_MAX_RXBUFFER; + struct virtchnl_queue_pair_info *vqpi; size_t len; + if (max_frame > IAVF_MAX_RXBUFFER || !max_frame) + max_frame = IAVF_MAX_RXBUFFER; + if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { /* bail because we already have a command pending */ dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_base.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_base.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_base.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_base.c 2022-11-29 07:06:46.000000000 +0000 @@ -7,18 +7,6 @@ #include "ice_dcb_lib.h" #include "ice_sriov.h" -static bool ice_alloc_rx_buf_zc(struct ice_rx_ring *rx_ring) -{ - rx_ring->xdp_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->xdp_buf), GFP_KERNEL); - return !!rx_ring->xdp_buf; -} - -static bool ice_alloc_rx_buf(struct ice_rx_ring *rx_ring) -{ - rx_ring->rx_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL); - return !!rx_ring->rx_buf; -} - /** * __ice_vsi_get_qs_contig - Assign a contiguous chunk of queues to VSI * @qs_cfg: gathered variables needed for PF->VSI queues assignment @@ -519,11 +507,8 @@ xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, ring->q_index, ring->q_vector->napi.napi_id); - kfree(ring->rx_buf); ring->xsk_pool = ice_xsk_pool(ring); if (ring->xsk_pool) { - if (!ice_alloc_rx_buf_zc(ring)) - return -ENOMEM; xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); ring->rx_buf_len = @@ -538,8 +523,6 @@ dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n", ring->q_index); } else { - if (!ice_alloc_rx_buf(ring)) - return -ENOMEM; if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) /* coverity[check_return] */ xdp_rxq_info_reg(&ring->xdp_rxq, diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_ethtool.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_ethtool.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_ethtool.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_ethtool.c 2022-11-29 07:06:46.000000000 +0000 @@ -2826,6 +2826,7 @@ tx_rings[i].count = new_tx_cnt; tx_rings[i].desc = NULL; tx_rings[i].tx_buf = NULL; + tx_rings[i].tx_tstamps = &pf->ptp.port.tx; err = ice_setup_tx_ring(&tx_rings[i]); if (err) { while (i--) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_lib.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_lib.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_lib.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -911,7 +911,7 @@ */ static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) { - u16 offset = 0, qmap = 0, tx_count = 0, pow = 0; + u16 offset = 0, qmap = 0, tx_count = 0, rx_count = 0, pow = 0; u16 num_txq_per_tc, num_rxq_per_tc; u16 qcount_tx = vsi->alloc_txq; u16 qcount_rx = vsi->alloc_rxq; @@ -978,23 +978,25 @@ * at least 1) */ if (offset) - vsi->num_rxq = offset; + rx_count = offset; else - vsi->num_rxq = num_rxq_per_tc; + rx_count = num_rxq_per_tc; - if (vsi->num_rxq > vsi->alloc_rxq) { + if (rx_count > vsi->alloc_rxq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n", - vsi->num_rxq, vsi->alloc_rxq); + rx_count, vsi->alloc_rxq); return -EINVAL; } - vsi->num_txq = tx_count; - if (vsi->num_txq > vsi->alloc_txq) { + if (tx_count > vsi->alloc_txq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n", - vsi->num_txq, vsi->alloc_txq); + tx_count, vsi->alloc_txq); return -EINVAL; } + vsi->num_txq = tx_count; + vsi->num_rxq = rx_count; + if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) { dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n"); /* since there is a chance that num_rxq could have been changed @@ -3487,6 +3489,7 @@ u16 pow, offset = 0, qcount_tx = 0, qcount_rx = 0, qmap; u16 tc0_offset = vsi->mqprio_qopt.qopt.offset[0]; int tc0_qcount = vsi->mqprio_qopt.qopt.count[0]; + u16 new_txq, new_rxq; u8 netdev_tc = 0; int i; @@ -3527,21 +3530,24 @@ } } - /* Set actual Tx/Rx queue pairs */ - vsi->num_txq = offset + qcount_tx; - if (vsi->num_txq > vsi->alloc_txq) { + new_txq = offset + qcount_tx; + if (new_txq > vsi->alloc_txq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n", - vsi->num_txq, vsi->alloc_txq); + new_txq, vsi->alloc_txq); return -EINVAL; } - vsi->num_rxq = offset + qcount_rx; - if (vsi->num_rxq > vsi->alloc_rxq) { + new_rxq = offset + qcount_rx; + if (new_rxq > vsi->alloc_rxq) { dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n", - vsi->num_rxq, vsi->alloc_rxq); + new_rxq, vsi->alloc_rxq); return -EINVAL; } + /* Set actual Tx/Rx queue pairs */ + vsi->num_txq = new_txq; + vsi->num_rxq = new_rxq; + /* Setup queue TC[0].qmap for given VSI context */ ctxt->info.tc_mapping[0] = cpu_to_le16(qmap); ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]); @@ -3573,6 +3579,7 @@ { u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; struct ice_pf *pf = vsi->back; + struct ice_tc_cfg old_tc_cfg; struct ice_vsi_ctx *ctx; struct device *dev; int i, ret = 0; @@ -3597,6 +3604,7 @@ max_txqs[i] = vsi->num_txq; } + memcpy(&old_tc_cfg, &vsi->tc_cfg, sizeof(old_tc_cfg)); vsi->tc_cfg.ena_tc = ena_tc; vsi->tc_cfg.numtc = num_tc; @@ -3613,8 +3621,10 @@ else ret = ice_vsi_setup_q_map(vsi, ctx); - if (ret) + if (ret) { + memcpy(&vsi->tc_cfg, &old_tc_cfg, sizeof(vsi->tc_cfg)); goto out; + } /* must to indicate which section of VSI context are being modified */ ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_main.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_main.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -2399,8 +2399,6 @@ return -EBUSY; } - ice_unplug_aux_dev(pf); - switch (reset) { case ICE_RESET_PFR: set_bit(ICE_PFR_REQ, pf->state); @@ -2898,10 +2896,18 @@ if (xdp_ring_err) NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed"); } + /* reallocate Rx queues that are used for zero-copy */ + xdp_ring_err = ice_realloc_zc_buf(vsi, true); + if (xdp_ring_err) + NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Rx resources failed"); } else if (ice_is_xdp_ena_vsi(vsi) && !prog) { xdp_ring_err = ice_destroy_xdp_rings(vsi); if (xdp_ring_err) NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed"); + /* reallocate Rx queues that were used for zero-copy */ + xdp_ring_err = ice_realloc_zc_buf(vsi, false); + if (xdp_ring_err) + NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed"); } else { /* safe to call even when prog == vsi->xdp_prog as * dev_xdp_install in net/core/dev.c incremented prog's @@ -3904,7 +3910,7 @@ pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL); if (!pf->avail_rxqs) { - devm_kfree(ice_pf_to_dev(pf), pf->avail_txqs); + bitmap_free(pf->avail_txqs); pf->avail_txqs = NULL; return -ENOMEM; } @@ -6621,7 +6627,7 @@ */ int ice_down(struct ice_vsi *vsi) { - int i, tx_err, rx_err, link_err = 0, vlan_err = 0; + int i, tx_err, rx_err, vlan_err = 0; WARN_ON(!test_bit(ICE_VSI_DOWN, vsi->state)); @@ -6655,20 +6661,13 @@ ice_napi_disable_all(vsi); - if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { - link_err = ice_force_phys_link_state(vsi, false); - if (link_err) - netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", - vsi->vsi_num, link_err); - } - ice_for_each_txq(vsi, i) ice_clean_tx_ring(vsi->tx_rings[i]); ice_for_each_rxq(vsi, i) ice_clean_rx_ring(vsi->rx_rings[i]); - if (tx_err || rx_err || link_err || vlan_err) { + if (tx_err || rx_err || vlan_err) { netdev_err(vsi->netdev, "Failed to close VSI 0x%04X on switch 0x%04X\n", vsi->vsi_num, vsi->vsw->sw_id); return -EIO; @@ -6830,6 +6829,8 @@ if (err) goto err_setup_rx; + ice_vsi_cfg_netdev_tc(vsi, vsi->tc_cfg.ena_tc); + if (vsi->type == ICE_VSI_PF) { /* Notify the stack of the actual queue counts. */ err = netif_set_real_num_tx_queues(vsi->netdev, vsi->num_txq); @@ -8868,6 +8869,16 @@ return -EBUSY; } + if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { + int link_err = ice_force_phys_link_state(vsi, false); + + if (link_err) { + netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", + vsi->vsi_num, link_err); + return -EIO; + } + } + ice_vsi_close(vsi); return 0; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_txrx.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_txrx.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_txrx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_txrx.c 2022-11-29 07:06:46.000000000 +0000 @@ -610,7 +610,7 @@ if (test_bit(ICE_VSI_DOWN, vsi->state)) return -ENETDOWN; - if (!ice_is_xdp_ena_vsi(vsi) || queue_index >= vsi->num_xdp_txq) + if (!ice_is_xdp_ena_vsi(vsi)) return -ENXIO; if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) @@ -621,6 +621,9 @@ xdp_ring = vsi->xdp_rings[queue_index]; spin_lock(&xdp_ring->tx_lock); } else { + /* Generally, should not happen */ + if (unlikely(queue_index >= vsi->num_xdp_txq)) + return -ENXIO; xdp_ring = vsi->xdp_rings[queue_index]; } @@ -1464,7 +1467,7 @@ bool wd; if (tx_ring->xsk_pool) - wd = ice_xmit_zc(tx_ring, ICE_DESC_UNUSED(tx_ring), budget); + wd = ice_xmit_zc(tx_ring); else if (ice_ring_is_xdp(tx_ring)) wd = true; else diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.c linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.c --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.c 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,7 @@ err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, true); if (err) return err; + ice_clean_rx_ring(rx_ring); ice_qvec_toggle_napi(vsi, q_vector, false); ice_qp_clean_rings(vsi, q_idx); @@ -317,6 +318,62 @@ } /** + * ice_realloc_rx_xdp_bufs - reallocate for either XSK or normal buffer + * @rx_ring: Rx ring + * @pool_present: is pool for XSK present + * + * Try allocating memory and return ENOMEM, if failed to allocate. + * If allocation was successful, substitute buffer with allocated one. + * Returns 0 on success, negative on failure + */ +static int +ice_realloc_rx_xdp_bufs(struct ice_rx_ring *rx_ring, bool pool_present) +{ + size_t elem_size = pool_present ? sizeof(*rx_ring->xdp_buf) : + sizeof(*rx_ring->rx_buf); + void *sw_ring = kcalloc(rx_ring->count, elem_size, GFP_KERNEL); + + if (!sw_ring) + return -ENOMEM; + + if (pool_present) { + kfree(rx_ring->rx_buf); + rx_ring->rx_buf = NULL; + rx_ring->xdp_buf = sw_ring; + } else { + kfree(rx_ring->xdp_buf); + rx_ring->xdp_buf = NULL; + rx_ring->rx_buf = sw_ring; + } + + return 0; +} + +/** + * ice_realloc_zc_buf - reallocate XDP ZC queue pairs + * @vsi: Current VSI + * @zc: is zero copy set + * + * Reallocate buffer for rx_rings that might be used by XSK. + * XDP requires more memory, than rx_buf provides. + * Returns 0 on success, negative on failure + */ +int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc) +{ + struct ice_rx_ring *rx_ring; + unsigned long q; + + for_each_set_bit(q, vsi->af_xdp_zc_qps, + max_t(int, vsi->alloc_txq, vsi->alloc_rxq)) { + rx_ring = vsi->rx_rings[q]; + if (ice_realloc_rx_xdp_bufs(rx_ring, zc)) + return -ENOMEM; + } + + return 0; +} + +/** * ice_xsk_pool_setup - enable/disable a buffer pool region depending on its state * @vsi: Current VSI * @pool: buffer pool to enable/associate to a ring, NULL to disable @@ -335,21 +392,20 @@ goto failure; } - if (!is_power_of_2(vsi->rx_rings[qid]->count) || - !is_power_of_2(vsi->tx_rings[qid]->count)) { - netdev_err(vsi->netdev, "Please align ring sizes to power of 2\n"); - pool_failure = -EINVAL; - goto failure; - } - if_running = netif_running(vsi->netdev) && ice_is_xdp_ena_vsi(vsi); if (if_running) { + struct ice_rx_ring *rx_ring = vsi->rx_rings[qid]; + ret = ice_qp_dis(vsi, qid); if (ret) { netdev_err(vsi->netdev, "ice_qp_dis error = %d\n", ret); goto xsk_pool_if_up; } + + ret = ice_realloc_rx_xdp_bufs(rx_ring, pool_present); + if (ret) + goto xsk_pool_if_up; } pool_failure = pool_present ? ice_xsk_pool_enable(vsi, pool, qid) : @@ -471,11 +527,10 @@ bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count) { u16 rx_thresh = ICE_RING_QUARTER(rx_ring); - u16 batched, leftover, i, tail_bumps; + u16 leftover, i, tail_bumps; - batched = ALIGN_DOWN(count, rx_thresh); - tail_bumps = batched / rx_thresh; - leftover = count & (rx_thresh - 1); + tail_bumps = count / rx_thresh; + leftover = count - (tail_bumps * rx_thresh); for (i = 0; i < tail_bumps; i++) if (!__ice_alloc_rx_bufs_zc(rx_ring, rx_thresh)) @@ -725,69 +780,57 @@ } /** - * ice_clean_xdp_irq_zc - Reclaim resources after transmit completes on XDP ring - * @xdp_ring: XDP ring to clean - * @napi_budget: amount of descriptors that NAPI allows us to clean - * - * Returns count of cleaned descriptors - */ -static u16 ice_clean_xdp_irq_zc(struct ice_tx_ring *xdp_ring, int napi_budget) -{ - u16 tx_thresh = ICE_RING_QUARTER(xdp_ring); - int budget = napi_budget / tx_thresh; - u16 next_dd = xdp_ring->next_dd; - u16 ntc, cleared_dds = 0; - - do { - struct ice_tx_desc *next_dd_desc; - u16 desc_cnt = xdp_ring->count; - struct ice_tx_buf *tx_buf; - u32 xsk_frames; - u16 i; - - next_dd_desc = ICE_TX_DESC(xdp_ring, next_dd); - if (!(next_dd_desc->cmd_type_offset_bsz & - cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE))) - break; + * ice_clean_xdp_irq_zc - produce AF_XDP descriptors to CQ + * @xdp_ring: XDP Tx ring + */ +static void ice_clean_xdp_irq_zc(struct ice_tx_ring *xdp_ring) +{ + u16 ntc = xdp_ring->next_to_clean; + struct ice_tx_desc *tx_desc; + u16 cnt = xdp_ring->count; + struct ice_tx_buf *tx_buf; + u16 xsk_frames = 0; + u16 last_rs; + int i; - cleared_dds++; - xsk_frames = 0; - if (likely(!xdp_ring->xdp_tx_active)) { - xsk_frames = tx_thresh; - goto skip; - } + last_rs = xdp_ring->next_to_use ? xdp_ring->next_to_use - 1 : cnt - 1; + tx_desc = ICE_TX_DESC(xdp_ring, last_rs); + if ((tx_desc->cmd_type_offset_bsz & + cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE))) { + if (last_rs >= ntc) + xsk_frames = last_rs - ntc + 1; + else + xsk_frames = last_rs + cnt - ntc + 1; + } - ntc = xdp_ring->next_to_clean; + if (!xsk_frames) + return; - for (i = 0; i < tx_thresh; i++) { - tx_buf = &xdp_ring->tx_buf[ntc]; + if (likely(!xdp_ring->xdp_tx_active)) + goto skip; - if (tx_buf->raw_buf) { - ice_clean_xdp_tx_buf(xdp_ring, tx_buf); - tx_buf->raw_buf = NULL; - } else { - xsk_frames++; - } - - ntc++; - if (ntc >= xdp_ring->count) - ntc = 0; - } -skip: - xdp_ring->next_to_clean += tx_thresh; - if (xdp_ring->next_to_clean >= desc_cnt) - xdp_ring->next_to_clean -= desc_cnt; - if (xsk_frames) - xsk_tx_completed(xdp_ring->xsk_pool, xsk_frames); - next_dd_desc->cmd_type_offset_bsz = 0; - next_dd = next_dd + tx_thresh; - if (next_dd >= desc_cnt) - next_dd = tx_thresh - 1; - } while (--budget); + ntc = xdp_ring->next_to_clean; + for (i = 0; i < xsk_frames; i++) { + tx_buf = &xdp_ring->tx_buf[ntc]; - xdp_ring->next_dd = next_dd; + if (tx_buf->raw_buf) { + ice_clean_xdp_tx_buf(xdp_ring, tx_buf); + tx_buf->raw_buf = NULL; + } else { + xsk_frames++; + } - return cleared_dds * tx_thresh; + ntc++; + if (ntc >= xdp_ring->count) + ntc = 0; + } +skip: + tx_desc->cmd_type_offset_bsz = 0; + xdp_ring->next_to_clean += xsk_frames; + if (xdp_ring->next_to_clean >= cnt) + xdp_ring->next_to_clean -= cnt; + if (xsk_frames) + xsk_tx_completed(xdp_ring->xsk_pool, xsk_frames); } /** @@ -822,7 +865,6 @@ static void ice_xmit_pkt_batch(struct ice_tx_ring *xdp_ring, struct xdp_desc *descs, unsigned int *total_bytes) { - u16 tx_thresh = ICE_RING_QUARTER(xdp_ring); u16 ntu = xdp_ring->next_to_use; struct ice_tx_desc *tx_desc; u32 i; @@ -842,13 +884,6 @@ } xdp_ring->next_to_use = ntu; - - if (xdp_ring->next_to_use > xdp_ring->next_rs) { - tx_desc = ICE_TX_DESC(xdp_ring, xdp_ring->next_rs); - tx_desc->cmd_type_offset_bsz |= - cpu_to_le64(ICE_TX_DESC_CMD_RS << ICE_TXD_QW1_CMD_S); - xdp_ring->next_rs += tx_thresh; - } } /** @@ -861,7 +896,6 @@ static void ice_fill_tx_hw_ring(struct ice_tx_ring *xdp_ring, struct xdp_desc *descs, u32 nb_pkts, unsigned int *total_bytes) { - u16 tx_thresh = ICE_RING_QUARTER(xdp_ring); u32 batched, leftover, i; batched = ALIGN_DOWN(nb_pkts, PKTS_PER_BATCH); @@ -870,54 +904,54 @@ ice_xmit_pkt_batch(xdp_ring, &descs[i], total_bytes); for (; i < batched + leftover; i++) ice_xmit_pkt(xdp_ring, &descs[i], total_bytes); +} - if (xdp_ring->next_to_use > xdp_ring->next_rs) { - struct ice_tx_desc *tx_desc; +/** + * ice_set_rs_bit - set RS bit on last produced descriptor (one behind current NTU) + * @xdp_ring: XDP ring to produce the HW Tx descriptors on + */ +static void ice_set_rs_bit(struct ice_tx_ring *xdp_ring) +{ + u16 ntu = xdp_ring->next_to_use ? xdp_ring->next_to_use - 1 : xdp_ring->count - 1; + struct ice_tx_desc *tx_desc; - tx_desc = ICE_TX_DESC(xdp_ring, xdp_ring->next_rs); - tx_desc->cmd_type_offset_bsz |= - cpu_to_le64(ICE_TX_DESC_CMD_RS << ICE_TXD_QW1_CMD_S); - xdp_ring->next_rs += tx_thresh; - } + tx_desc = ICE_TX_DESC(xdp_ring, ntu); + tx_desc->cmd_type_offset_bsz |= + cpu_to_le64(ICE_TX_DESC_CMD_RS << ICE_TXD_QW1_CMD_S); } /** * ice_xmit_zc - take entries from XSK Tx ring and place them onto HW Tx ring * @xdp_ring: XDP ring to produce the HW Tx descriptors on - * @budget: number of free descriptors on HW Tx ring that can be used - * @napi_budget: amount of descriptors that NAPI allows us to clean * * Returns true if there is no more work that needs to be done, false otherwise */ -bool ice_xmit_zc(struct ice_tx_ring *xdp_ring, u32 budget, int napi_budget) +bool ice_xmit_zc(struct ice_tx_ring *xdp_ring) { struct xdp_desc *descs = xdp_ring->xsk_pool->tx_descs; - u16 tx_thresh = ICE_RING_QUARTER(xdp_ring); u32 nb_pkts, nb_processed = 0; unsigned int total_bytes = 0; + int budget; + + ice_clean_xdp_irq_zc(xdp_ring); - if (budget < tx_thresh) - budget += ice_clean_xdp_irq_zc(xdp_ring, napi_budget); + budget = ICE_DESC_UNUSED(xdp_ring); + budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring)); nb_pkts = xsk_tx_peek_release_desc_batch(xdp_ring->xsk_pool, budget); if (!nb_pkts) return true; if (xdp_ring->next_to_use + nb_pkts >= xdp_ring->count) { - struct ice_tx_desc *tx_desc; - nb_processed = xdp_ring->count - xdp_ring->next_to_use; ice_fill_tx_hw_ring(xdp_ring, descs, nb_processed, &total_bytes); - tx_desc = ICE_TX_DESC(xdp_ring, xdp_ring->next_rs); - tx_desc->cmd_type_offset_bsz |= - cpu_to_le64(ICE_TX_DESC_CMD_RS << ICE_TXD_QW1_CMD_S); - xdp_ring->next_rs = tx_thresh - 1; xdp_ring->next_to_use = 0; } ice_fill_tx_hw_ring(xdp_ring, &descs[nb_processed], nb_pkts - nb_processed, &total_bytes); + ice_set_rs_bit(xdp_ring); ice_xdp_ring_update_tail(xdp_ring); ice_update_tx_ring_stats(xdp_ring, nb_pkts, total_bytes); @@ -995,14 +1029,16 @@ */ void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring) { - u16 count_mask = rx_ring->count - 1; u16 ntc = rx_ring->next_to_clean; u16 ntu = rx_ring->next_to_use; - for ( ; ntc != ntu; ntc = (ntc + 1) & count_mask) { + while (ntc != ntu) { struct xdp_buff *xdp = *ice_xdp_buf(rx_ring, ntc); xsk_buff_free(xdp); + ntc++; + if (ntc >= rx_ring->count) + ntc = 0; } } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.h linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.h --- linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/intel/ice/ice_xsk.h 2022-11-29 07:06:46.000000000 +0000 @@ -26,12 +26,10 @@ bool ice_xsk_any_rx_ring_ena(struct ice_vsi *vsi); void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring); void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring); -bool ice_xmit_zc(struct ice_tx_ring *xdp_ring, u32 budget, int napi_budget); +bool ice_xmit_zc(struct ice_tx_ring *xdp_ring); +int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc); #else -static inline bool -ice_xmit_zc(struct ice_tx_ring __always_unused *xdp_ring, - u32 __always_unused budget, - int __always_unused napi_budget) +static inline bool ice_xmit_zc(struct ice_tx_ring __always_unused *xdp_ring) { return false; } @@ -72,5 +70,12 @@ static inline void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring) { } static inline void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring) { } + +static inline int +ice_realloc_zc_buf(struct ice_vsi __always_unused *vsi, + bool __always_unused zc) +{ + return 0; +} #endif /* CONFIG_XDP_SOCKETS */ #endif /* !_ICE_XSK_H_ */ diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c --- linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -691,6 +691,13 @@ return 0; } +static struct dentry *mvpp2_root; + +void mvpp2_dbgfs_exit(void) +{ + debugfs_remove(mvpp2_root); +} + void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) { debugfs_remove_recursive(priv->dbgfs_dir); @@ -700,10 +707,9 @@ void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) { - struct dentry *mvpp2_dir, *mvpp2_root; + struct dentry *mvpp2_dir; int ret, i; - mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); if (!mvpp2_root) mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2.h linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2.h --- linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2.h 2022-11-29 07:06:46.000000000 +0000 @@ -1530,6 +1530,7 @@ void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name); void mvpp2_dbgfs_cleanup(struct mvpp2 *priv); +void mvpp2_dbgfs_exit(void); void mvpp23_rx_fifo_fc_en(struct mvpp2 *priv, int port, bool en); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c --- linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -7706,7 +7706,18 @@ }, }; -module_platform_driver(mvpp2_driver); +static int __init mvpp2_driver_init(void) +{ + return platform_driver_register(&mvpp2_driver); +} +module_init(mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ + platform_driver_unregister(&mvpp2_driver); + mvpp2_dbgfs_exit(); +} +module_exit(mvpp2_driver_exit); MODULE_DESCRIPTION("Marvell PPv2 Ethernet Driver - www.marvell.com"); MODULE_AUTHOR("Marcin Wojtas "); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.c linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.c --- linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.c 2022-11-29 07:06:46.000000000 +0000 @@ -162,10 +162,14 @@ return ERR_PTR(err); } -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask) +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask) { ruleset->keymask = kmemdup(keymask, ACL_KEYMASK_SIZE, GFP_KERNEL); + if (!ruleset->keymask) + return -ENOMEM; + + return 0; } int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.h linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.h --- linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_acl.h 2022-11-29 07:06:46.000000000 +0000 @@ -185,8 +185,8 @@ prestera_acl_ruleset_lookup(struct prestera_acl *acl, struct prestera_flow_block *block, u32 chain_index); -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask); +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask); bool prestera_acl_ruleset_is_offload(struct prestera_acl_ruleset *ruleset); int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset); void prestera_acl_ruleset_put(struct prestera_acl_ruleset *ruleset); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_flower.c linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_flower.c --- linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_flower.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_flower.c 2022-11-29 07:06:46.000000000 +0000 @@ -428,7 +428,9 @@ } /* preserve keymask/template to this ruleset */ - prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + err = prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + if (err) + goto err_ruleset_keymask_set; /* skip error, as it is not possible to reject template operation, * so, keep the reference to the ruleset for rules to be added @@ -444,6 +446,8 @@ list_add_rcu(&template->list, &block->template_list); return 0; +err_ruleset_keymask_set: + prestera_acl_ruleset_put(ruleset); err_ruleset_get: kfree(template); err_malloc: diff -Nru linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_pci.c linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_pci.c --- linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/marvell/prestera/prestera_pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -872,6 +872,7 @@ static const struct pci_device_id prestera_pci_devices[] = { { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC804) }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC80C) }, + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xCC1E) }, { } }; MODULE_DEVICE_TABLE(pci, prestera_pci_devices); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.h linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.h --- linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.h 2022-11-29 07:06:46.000000000 +0000 @@ -312,8 +312,8 @@ #define MTK_RXD5_PPE_CPU_REASON GENMASK(22, 18) #define MTK_RXD5_SRC_PORT GENMASK(29, 26) -#define RX_DMA_GET_SPORT(x) (((x) >> 19) & 0xf) -#define RX_DMA_GET_SPORT_V2(x) (((x) >> 26) & 0x7) +#define RX_DMA_GET_SPORT(x) (((x) >> 19) & 0x7) +#define RX_DMA_GET_SPORT_V2(x) (((x) >> 26) & 0xf) /* PDMA V2 descriptor rxd3 */ #define RX_DMA_VTAG_V2 BIT(0) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.c linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.c --- linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.c 2022-11-29 07:06:46.000000000 +0000 @@ -412,7 +412,7 @@ if (entry->hash != 0xffff) { ppe->foe_table[entry->hash].ib1 &= ~MTK_FOE_IB1_STATE; ppe->foe_table[entry->hash].ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, - MTK_FOE_STATE_BIND); + MTK_FOE_STATE_INVALID); dma_wmb(); } entry->hash = 0xffff; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.h linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.h --- linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mediatek/mtk_ppe.h 2022-11-29 07:06:46.000000000 +0000 @@ -293,6 +293,9 @@ if (!ppe) return; + if (hash > MTK_PPE_HASH_MASK) + return; + now = (u16)jiffies; diff = now - ppe->foe_check_time[hash]; if (diff < HZ / 10) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/fw.c linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/fw.c --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/fw.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/fw.c 2022-11-29 07:06:46.000000000 +0000 @@ -289,6 +289,10 @@ sw_owner_id[i]); } + if (MLX5_CAP_GEN_2_MAX(dev, sw_vhca_id_valid) && + dev->priv.sw_vhca_id > 0) + MLX5_SET(init_hca_in, in, sw_vhca_id, dev->priv.sw_vhca_id); + return mlx5_cmd_exec_in(dev, init_hca, in); } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -90,6 +90,8 @@ MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); static u32 sw_owner_id[4]; +#define MAX_SW_VHCA_ID (BIT(__mlx5_bit_sz(cmd_hca_cap_2, sw_vhca_id)) - 1) +static DEFINE_IDA(sw_vhca_ida); enum { MLX5_ATOMIC_REQ_MODE_BE = 0x0, @@ -499,6 +501,49 @@ return err; } +bool mlx5_is_roce_on(struct mlx5_core_dev *dev) +{ + struct devlink *devlink = priv_to_devlink(dev); + union devlink_param_value val; + int err; + + err = devlink_param_driverinit_value_get(devlink, + DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, + &val); + + if (!err) + return val.vbool; + + mlx5_core_dbg(dev, "Failed to get param. err = %d\n", err); + return MLX5_CAP_GEN(dev, roce); +} +EXPORT_SYMBOL(mlx5_is_roce_on); + +static int handle_hca_cap_2(struct mlx5_core_dev *dev, void *set_ctx) +{ + void *set_hca_cap; + int err; + + if (!MLX5_CAP_GEN_MAX(dev, hca_cap_2)) + return 0; + + err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL_2); + if (err) + return err; + + if (!MLX5_CAP_GEN_2_MAX(dev, sw_vhca_id_valid) || + !(dev->priv.sw_vhca_id > 0)) + return 0; + + set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, + capability); + memcpy(set_hca_cap, dev->caps.hca[MLX5_CAP_GENERAL_2]->cur, + MLX5_ST_SZ_BYTES(cmd_hca_cap_2)); + MLX5_SET(cmd_hca_cap_2, set_hca_cap, sw_vhca_id_valid, 1); + + return set_caps(dev, set_ctx, MLX5_CAP_GENERAL_2); +} + static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) { struct mlx5_profile *prof = &dev->profile; @@ -577,7 +622,8 @@ MLX5_CAP_GEN_MAX(dev, num_total_dynamic_vf_msix)); if (MLX5_CAP_GEN(dev, roce_rw_supported)) - MLX5_SET(cmd_hca_cap, set_hca_cap, roce, mlx5_is_roce_init_enabled(dev)); + MLX5_SET(cmd_hca_cap, set_hca_cap, roce, + mlx5_is_roce_on(dev)); max_uc_list = max_uc_list_get_devlink_param(dev); if (max_uc_list > 0) @@ -603,7 +649,7 @@ */ static bool is_roce_fw_disabled(struct mlx5_core_dev *dev) { - return (MLX5_CAP_GEN(dev, roce_rw_supported) && !mlx5_is_roce_init_enabled(dev)) || + return (MLX5_CAP_GEN(dev, roce_rw_supported) && !mlx5_is_roce_on(dev)) || (!MLX5_CAP_GEN(dev, roce_rw_supported) && !MLX5_CAP_GEN(dev, roce)); } @@ -669,6 +715,13 @@ goto out; } + memset(set_ctx, 0, set_sz); + err = handle_hca_cap_2(dev, set_ctx); + if (err) { + mlx5_core_err(dev, "handle_hca_cap_2 failed\n"); + goto out; + } + out: kfree(set_ctx); return err; @@ -1512,6 +1565,18 @@ if (err) goto err_hca_caps; + /* The conjunction of sw_vhca_id with sw_owner_id will be a global + * unique id per function which uses mlx5_core. + * Those values are supplied to FW as part of the init HCA command to + * be used by both driver and FW when it's applicable. + */ + dev->priv.sw_vhca_id = ida_alloc_range(&sw_vhca_ida, 1, + MAX_SW_VHCA_ID, + GFP_KERNEL); + if (dev->priv.sw_vhca_id < 0) + mlx5_core_err(dev, "failed to allocate sw_vhca_id, err=%d\n", + dev->priv.sw_vhca_id); + return 0; err_hca_caps: @@ -1537,6 +1602,9 @@ { struct mlx5_priv *priv = &dev->priv; + if (priv->sw_vhca_id > 0) + ida_free(&sw_vhca_ida, dev->priv.sw_vhca_id); + mlx5_hca_caps_free(dev); mlx5_adev_cleanup(dev); mlx5_pagealloc_cleanup(dev); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/vport.c linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/vport.c --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/vport.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/vport.c 2022-11-29 07:06:46.000000000 +0000 @@ -1086,9 +1086,17 @@ goto free; MLX5_SET(modify_nic_vport_context_in, in, field_select.affiliation, 1); - MLX5_SET(modify_nic_vport_context_in, in, - nic_vport_context.affiliated_vhca_id, - MLX5_CAP_GEN(master_mdev, vhca_id)); + if (MLX5_CAP_GEN_2(master_mdev, sw_vhca_id_valid)) { + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.vhca_id_type, VHCA_ID_TYPE_SW); + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.affiliated_vhca_id, + MLX5_CAP_GEN_2(master_mdev, sw_vhca_id)); + } else { + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.affiliated_vhca_id, + MLX5_CAP_GEN(master_mdev, vhca_id)); + } MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.affiliation_criteria, MLX5_CAP_GEN(port_mdev, affiliate_nic_vport_criteria)); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h 2022-11-29 07:06:46.000000000 +0000 @@ -75,6 +75,7 @@ struct net_device *netdev; struct platform_device *pdev; void __iomem *mdio_io; + void __iomem *clk_io; struct mii_bus *mdiobus; spinlock_t lock; /* for packet processing indices */ u16 rx_q_entries; @@ -137,7 +138,8 @@ MLXBF_GIGE_RES_MDIO9, MLXBF_GIGE_RES_GPIO0, MLXBF_GIGE_RES_LLU, - MLXBF_GIGE_RES_PLU + MLXBF_GIGE_RES_PLU, + MLXBF_GIGE_RES_CLK }; /* Version of register data returned by mlxbf_gige_get_regs() */ diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -22,10 +22,23 @@ #include #include "mlxbf_gige.h" +#include "mlxbf_gige_regs.h" #define MLXBF_GIGE_MDIO_GW_OFFSET 0x0 #define MLXBF_GIGE_MDIO_CFG_OFFSET 0x4 +#define MLXBF_GIGE_MDIO_FREQ_REFERENCE 156250000ULL +#define MLXBF_GIGE_MDIO_COREPLL_CONST 16384ULL +#define MLXBF_GIGE_MDC_CLK_NS 400 +#define MLXBF_GIGE_MDIO_PLL_I1CLK_REG1 0x4 +#define MLXBF_GIGE_MDIO_PLL_I1CLK_REG2 0x8 +#define MLXBF_GIGE_MDIO_CORE_F_SHIFT 0 +#define MLXBF_GIGE_MDIO_CORE_F_MASK GENMASK(25, 0) +#define MLXBF_GIGE_MDIO_CORE_R_SHIFT 26 +#define MLXBF_GIGE_MDIO_CORE_R_MASK GENMASK(31, 26) +#define MLXBF_GIGE_MDIO_CORE_OD_SHIFT 0 +#define MLXBF_GIGE_MDIO_CORE_OD_MASK GENMASK(3, 0) + /* Support clause 22 */ #define MLXBF_GIGE_MDIO_CL22_ST1 0x1 #define MLXBF_GIGE_MDIO_CL22_WRITE 0x1 @@ -50,27 +63,76 @@ #define MLXBF_GIGE_MDIO_CFG_MDIO_IN_SAMP_MASK GENMASK(23, 16) #define MLXBF_GIGE_MDIO_CFG_MDIO_OUT_SAMP_MASK GENMASK(31, 24) +#define MLXBF_GIGE_MDIO_CFG_VAL (FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_MODE_MASK, 1) | \ + FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO3_3_MASK, 1) | \ + FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_FULL_DRIVE_MASK, 1) | \ + FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_IN_SAMP_MASK, 6) | \ + FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_OUT_SAMP_MASK, 13)) + +#define MLXBF_GIGE_BF2_COREPLL_ADDR 0x02800c30 +#define MLXBF_GIGE_BF2_COREPLL_SIZE 0x0000000c + +static struct resource corepll_params[] = { + [MLXBF_GIGE_VERSION_BF2] = { + .start = MLXBF_GIGE_BF2_COREPLL_ADDR, + .end = MLXBF_GIGE_BF2_COREPLL_ADDR + MLXBF_GIGE_BF2_COREPLL_SIZE - 1, + .name = "COREPLL_RES" + }, +}; + +/* Returns core clock i1clk in Hz */ +static u64 calculate_i1clk(struct mlxbf_gige *priv) +{ + u8 core_od, core_r; + u64 freq_output; + u32 reg1, reg2; + u32 core_f; + + reg1 = readl(priv->clk_io + MLXBF_GIGE_MDIO_PLL_I1CLK_REG1); + reg2 = readl(priv->clk_io + MLXBF_GIGE_MDIO_PLL_I1CLK_REG2); + + core_f = (reg1 & MLXBF_GIGE_MDIO_CORE_F_MASK) >> + MLXBF_GIGE_MDIO_CORE_F_SHIFT; + core_r = (reg1 & MLXBF_GIGE_MDIO_CORE_R_MASK) >> + MLXBF_GIGE_MDIO_CORE_R_SHIFT; + core_od = (reg2 & MLXBF_GIGE_MDIO_CORE_OD_MASK) >> + MLXBF_GIGE_MDIO_CORE_OD_SHIFT; + + /* Compute PLL output frequency as follow: + * + * CORE_F / 16384 + * freq_output = freq_reference * ---------------------------- + * (CORE_R + 1) * (CORE_OD + 1) + */ + freq_output = div_u64((MLXBF_GIGE_MDIO_FREQ_REFERENCE * core_f), + MLXBF_GIGE_MDIO_COREPLL_CONST); + freq_output = div_u64(freq_output, (core_r + 1) * (core_od + 1)); + + return freq_output; +} + /* Formula for encoding the MDIO period. The encoded value is * passed to the MDIO config register. * - * mdc_clk = 2*(val + 1)*i1clk + * mdc_clk = 2*(val + 1)*(core clock in sec) * - * 400 ns = 2*(val + 1)*(((1/430)*1000) ns) + * i1clk is in Hz: + * 400 ns = 2*(val + 1)*(1/i1clk) * - * val = (((400 * 430 / 1000) / 2) - 1) + * val = (((400/10^9) / (1/i1clk) / 2) - 1) + * val = (400/2 * i1clk)/10^9 - 1 */ -#define MLXBF_GIGE_I1CLK_MHZ 430 -#define MLXBF_GIGE_MDC_CLK_NS 400 +static u8 mdio_period_map(struct mlxbf_gige *priv) +{ + u8 mdio_period; + u64 i1clk; -#define MLXBF_GIGE_MDIO_PERIOD (((MLXBF_GIGE_MDC_CLK_NS * MLXBF_GIGE_I1CLK_MHZ / 1000) / 2) - 1) + i1clk = calculate_i1clk(priv); -#define MLXBF_GIGE_MDIO_CFG_VAL (FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_MODE_MASK, 1) | \ - FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO3_3_MASK, 1) | \ - FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_FULL_DRIVE_MASK, 1) | \ - FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDC_PERIOD_MASK, \ - MLXBF_GIGE_MDIO_PERIOD) | \ - FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_IN_SAMP_MASK, 6) | \ - FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDIO_OUT_SAMP_MASK, 13)) + mdio_period = div_u64((MLXBF_GIGE_MDC_CLK_NS >> 1) * i1clk, 1000000000) - 1; + + return mdio_period; +} static u32 mlxbf_gige_mdio_create_cmd(u16 data, int phy_add, int phy_reg, u32 opcode) @@ -117,6 +179,9 @@ /* Only return ad bits of the gw register */ ret &= MLXBF_GIGE_MDIO_GW_AD_MASK; + /* The MDIO lock is set on read. To release it, clear gw register */ + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); + return ret; } @@ -124,9 +189,9 @@ int phy_reg, u16 val) { struct mlxbf_gige *priv = bus->priv; + u32 temp; u32 cmd; int ret; - u32 temp; if (phy_reg & MII_ADDR_C45) return -EOPNOTSUPP; @@ -141,21 +206,50 @@ temp, !(temp & MLXBF_GIGE_MDIO_GW_BUSY_MASK), 5, 1000000); + /* The MDIO lock is set on read. To release it, clear gw register */ + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); + return ret; } +static void mlxbf_gige_mdio_cfg(struct mlxbf_gige *priv) +{ + u8 mdio_period; + u32 val; + + mdio_period = mdio_period_map(priv); + + val = MLXBF_GIGE_MDIO_CFG_VAL; + val |= FIELD_PREP(MLXBF_GIGE_MDIO_CFG_MDC_PERIOD_MASK, mdio_period); + writel(val, priv->mdio_io + MLXBF_GIGE_MDIO_CFG_OFFSET); +} + int mlxbf_gige_mdio_probe(struct platform_device *pdev, struct mlxbf_gige *priv) { struct device *dev = &pdev->dev; + struct resource *res; int ret; priv->mdio_io = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_MDIO9); if (IS_ERR(priv->mdio_io)) return PTR_ERR(priv->mdio_io); - /* Configure mdio parameters */ - writel(MLXBF_GIGE_MDIO_CFG_VAL, - priv->mdio_io + MLXBF_GIGE_MDIO_CFG_OFFSET); + /* clk resource shared with other drivers so cannot use + * devm_platform_ioremap_resource + */ + res = platform_get_resource(pdev, IORESOURCE_MEM, MLXBF_GIGE_RES_CLK); + if (!res) { + /* For backward compatibility with older ACPI tables, also keep + * CLK resource internal to the driver. + */ + res = &corepll_params[MLXBF_GIGE_VERSION_BF2]; + } + + priv->clk_io = devm_ioremap(dev, res->start, resource_size(res)); + if (!priv->clk_io) + return -ENOMEM; + + mlxbf_gige_mdio_cfg(priv); priv->mdiobus = devm_mdiobus_alloc(dev); if (!priv->mdiobus) { diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h 2022-11-29 07:06:46.000000000 +0000 @@ -8,6 +8,8 @@ #ifndef __MLXBF_GIGE_REGS_H__ #define __MLXBF_GIGE_REGS_H__ +#define MLXBF_GIGE_VERSION 0x0000 +#define MLXBF_GIGE_VERSION_BF2 0x0 #define MLXBF_GIGE_STATUS 0x0010 #define MLXBF_GIGE_STATUS_READY BIT(0) #define MLXBF_GIGE_INT_STATUS 0x0028 diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c --- linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c 2022-11-29 07:06:46.000000000 +0000 @@ -423,7 +423,8 @@ parms = mlxsw_sp_ipip_netdev_parms4(to_dev); ip_tunnel_init_flow(&fl4, parms.iph.protocol, *daddrp, *saddrp, - 0, 0, dev_net(to_dev), parms.link, tun->fwmark, 0); + 0, 0, dev_net(to_dev), parms.link, tun->fwmark, 0, + 0); rt = ip_route_output_key(tun->net, &fl4); if (IS_ERR(rt)) diff -Nru linux-aws-5.19.0/drivers/net/ethernet/microchip/lan743x_ptp.c linux-aws-5.19.0/drivers/net/ethernet/microchip/lan743x_ptp.c --- linux-aws-5.19.0/drivers/net/ethernet/microchip/lan743x_ptp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/microchip/lan743x_ptp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1049,6 +1049,10 @@ enum ptp_pin_function func, unsigned int chan) { + struct lan743x_ptp *lan_ptp = + container_of(ptp, struct lan743x_ptp, ptp_clock_info); + struct lan743x_adapter *adapter = + container_of(lan_ptp, struct lan743x_adapter, ptp); int result = 0; /* Confirm the requested function is supported. Parameter @@ -1057,7 +1061,10 @@ switch (func) { case PTP_PF_NONE: case PTP_PF_PEROUT: + break; case PTP_PF_EXTTS: + if (!adapter->is_pci11x1x) + result = -1; break; case PTP_PF_PHYSYNC: default: diff -Nru linux-aws-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c linux-aws-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c --- linux-aws-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c 2022-11-29 07:06:46.000000000 +0000 @@ -425,7 +425,8 @@ lan966x_ifh_get_src_port(skb->data, &src_port); lan966x_ifh_get_timestamp(skb->data, ×tamp); - WARN_ON(src_port >= lan966x->num_phys_ports); + if (WARN_ON(src_port >= lan966x->num_phys_ports)) + goto free_skb; skb->dev = lan966x->ports[src_port]->dev; skb_pull(skb, IFH_LEN * sizeof(u32)); @@ -449,6 +450,8 @@ return skb; +free_skb: + kfree_skb(skb); unmap_page: dma_unmap_page(lan966x->dev, (dma_addr_t)db->dataptr, FDMA_DCB_STATUS_BLOCKL(db->status), diff -Nru linux-aws-5.19.0/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c linux-aws-5.19.0/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c --- linux-aws-5.19.0/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c 2022-11-29 07:06:46.000000000 +0000 @@ -113,6 +113,8 @@ /* This assumes STATUS_WORD_POS == 1, Status * just after last data */ + if (!byte_swap) + val = ntohl((__force __be32)val); byte_cnt -= (4 - XTR_VALID_BYTES(val)); eof_flag = true; break; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/microsoft/mana/gdma_main.c linux-aws-5.19.0/drivers/net/ethernet/microsoft/mana/gdma_main.c --- linux-aws-5.19.0/drivers/net/ethernet/microsoft/mana/gdma_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/microsoft/mana/gdma_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -370,6 +370,11 @@ break; } + /* Per GDMA spec, rmb is necessary after checking owner_bits, before + * reading eqe. + */ + rmb(); + mana_gd_process_eqe(eq); eq->head++; @@ -1107,6 +1112,11 @@ if (WARN_ON_ONCE(owner_bits != new_bits)) return -1; + /* Per GDMA spec, rmb is necessary after checking owner_bits, before + * reading completion info + */ + rmb(); + comp->wq_num = cqe->cqe_info.wq_num; comp->is_sq = cqe->cqe_info.is_sq; memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE); diff -Nru linux-aws-5.19.0/drivers/net/ethernet/mscc/ocelot.c linux-aws-5.19.0/drivers/net/ethernet/mscc/ocelot.c --- linux-aws-5.19.0/drivers/net/ethernet/mscc/ocelot.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/mscc/ocelot.c 2022-11-29 07:06:46.000000000 +0000 @@ -290,6 +290,13 @@ if (!(vlan->portmask & BIT(port))) continue; + /* Ignore the VLAN added by ocelot_add_vlan_unaware_pvid(), + * because this is never active in hardware at the same time as + * the bridge VLANs, which only matter in VLAN-aware mode. + */ + if (vlan->vid >= OCELOT_RSV_VLAN_RANGE_START) + continue; + if (vlan->untagged & BIT(port)) num_untagged++; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c --- linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c 2022-11-29 07:06:46.000000000 +0000 @@ -127,10 +127,11 @@ return -EOPNOTSUPP; } - if (act->police.notexceed.act_id != FLOW_ACTION_PIPE && + if (act->police.notexceed.act_id != FLOW_ACTION_CONTINUE && + act->police.notexceed.act_id != FLOW_ACTION_PIPE && act->police.notexceed.act_id != FLOW_ACTION_ACCEPT) { NL_SET_ERR_MSG_MOD(extack, - "Offload not supported when conform action is not pipe or ok"); + "Offload not supported when conform action is not continue, pipe or ok"); return -EOPNOTSUPP; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_common.c linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_common.c --- linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -1629,21 +1629,21 @@ unsigned int start; do { - start = u64_stats_fetch_begin(&r_vec->rx_sync); + start = u64_stats_fetch_begin_irq(&r_vec->rx_sync); data[0] = r_vec->rx_pkts; data[1] = r_vec->rx_bytes; data[2] = r_vec->rx_drops; - } while (u64_stats_fetch_retry(&r_vec->rx_sync, start)); + } while (u64_stats_fetch_retry_irq(&r_vec->rx_sync, start)); stats->rx_packets += data[0]; stats->rx_bytes += data[1]; stats->rx_dropped += data[2]; do { - start = u64_stats_fetch_begin(&r_vec->tx_sync); + start = u64_stats_fetch_begin_irq(&r_vec->tx_sync); data[0] = r_vec->tx_pkts; data[1] = r_vec->tx_bytes; data[2] = r_vec->tx_errors; - } while (u64_stats_fetch_retry(&r_vec->tx_sync, start)); + } while (u64_stats_fetch_retry_irq(&r_vec->tx_sync, start)); stats->tx_packets += data[0]; stats->tx_bytes += data[1]; stats->tx_errors += data[2]; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c --- linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c 2022-11-29 07:06:46.000000000 +0000 @@ -494,7 +494,7 @@ unsigned int start; do { - start = u64_stats_fetch_begin(&nn->r_vecs[i].rx_sync); + start = u64_stats_fetch_begin_irq(&nn->r_vecs[i].rx_sync); data[0] = nn->r_vecs[i].rx_pkts; tmp[0] = nn->r_vecs[i].hw_csum_rx_ok; tmp[1] = nn->r_vecs[i].hw_csum_rx_inner_ok; @@ -502,10 +502,10 @@ tmp[3] = nn->r_vecs[i].hw_csum_rx_error; tmp[4] = nn->r_vecs[i].rx_replace_buf_alloc_fail; tmp[5] = nn->r_vecs[i].hw_tls_rx; - } while (u64_stats_fetch_retry(&nn->r_vecs[i].rx_sync, start)); + } while (u64_stats_fetch_retry_irq(&nn->r_vecs[i].rx_sync, start)); do { - start = u64_stats_fetch_begin(&nn->r_vecs[i].tx_sync); + start = u64_stats_fetch_begin_irq(&nn->r_vecs[i].tx_sync); data[1] = nn->r_vecs[i].tx_pkts; data[2] = nn->r_vecs[i].tx_busy; tmp[6] = nn->r_vecs[i].hw_csum_tx; @@ -515,7 +515,7 @@ tmp[10] = nn->r_vecs[i].hw_tls_tx; tmp[11] = nn->r_vecs[i].tls_tx_fallback; tmp[12] = nn->r_vecs[i].tls_tx_no_fallback; - } while (u64_stats_fetch_retry(&nn->r_vecs[i].tx_sync, start)); + } while (u64_stats_fetch_retry_irq(&nn->r_vecs[i].tx_sync, start)); data += NN_RVEC_PER_Q_STATS; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/renesas/ravb_main.c linux-aws-5.19.0/drivers/net/ethernet/renesas/ravb_main.c --- linux-aws-5.19.0/drivers/net/ethernet/renesas/ravb_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/renesas/ravb_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1449,6 +1449,8 @@ phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); } + /* Indicate that the MAC is responsible for managing PHY PM */ + phydev->mac_managed_pm = true; phy_attached_info(phydev); return 0; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/renesas/sh_eth.c linux-aws-5.19.0/drivers/net/ethernet/renesas/sh_eth.c --- linux-aws-5.19.0/drivers/net/ethernet/renesas/sh_eth.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/renesas/sh_eth.c 2022-11-29 07:06:46.000000000 +0000 @@ -2029,6 +2029,8 @@ if (mdp->cd->register_type != SH_ETH_REG_GIGABIT) phy_set_max_speed(phydev, SPEED_100); + /* Indicate that the MAC is responsible for managing PHY PM */ + phydev->mac_managed_pm = true; phy_attached_info(phydev); return 0; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/rocker/rocker_ofdpa.c linux-aws-5.19.0/drivers/net/ethernet/rocker/rocker_ofdpa.c --- linux-aws-5.19.0/drivers/net/ethernet/rocker/rocker_ofdpa.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/rocker/rocker_ofdpa.c 2022-11-29 07:06:46.000000000 +0000 @@ -1273,7 +1273,7 @@ bool removing; int err = 0; - entry = kzalloc(sizeof(*entry), GFP_KERNEL); + entry = kzalloc(sizeof(*entry), GFP_ATOMIC); if (!entry) return -ENOMEM; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sfc/efx_channels.c linux-aws-5.19.0/drivers/net/ethernet/sfc/efx_channels.c --- linux-aws-5.19.0/drivers/net/ethernet/sfc/efx_channels.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sfc/efx_channels.c 2022-11-29 07:06:46.000000000 +0000 @@ -319,7 +319,7 @@ efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); efx->n_rx_channels = 1; efx->n_tx_channels = 1; - efx->tx_channel_offset = 1; + efx->tx_channel_offset = efx_separate_tx_channels ? 1 : 0; efx->n_xdp_channels = 0; efx->xdp_channel_offset = efx->n_channels; efx->legacy_irq = efx->pci_dev->irq; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/efx_channels.c linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/efx_channels.c --- linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/efx_channels.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/efx_channels.c 2022-11-29 07:06:46.000000000 +0000 @@ -320,7 +320,7 @@ efx->n_channels = 1 + (efx_siena_separate_tx_channels ? 1 : 0); efx->n_rx_channels = 1; efx->n_tx_channels = 1; - efx->tx_channel_offset = 1; + efx->tx_channel_offset = efx_siena_separate_tx_channels ? 1 : 0; efx->n_xdp_channels = 0; efx->xdp_channel_offset = efx->n_channels; efx->legacy_irq = efx->pci_dev->irq; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/tx.c linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/tx.c --- linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/tx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sfc/siena/tx.c 2022-11-29 07:06:46.000000000 +0000 @@ -336,7 +336,7 @@ * previous packets out. */ if (!netdev_xmit_more()) - efx_tx_send_pending(tx_queue->channel); + efx_tx_send_pending(efx_get_tx_channel(efx, index)); return NETDEV_TX_OK; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sfc/tx.c linux-aws-5.19.0/drivers/net/ethernet/sfc/tx.c --- linux-aws-5.19.0/drivers/net/ethernet/sfc/tx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sfc/tx.c 2022-11-29 07:06:46.000000000 +0000 @@ -549,7 +549,7 @@ * previous packets out. */ if (!netdev_xmit_more()) - efx_tx_send_pending(tx_queue->channel); + efx_tx_send_pending(efx_get_tx_channel(efx, index)); return NETDEV_TX_OK; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/smsc/smsc911x.c linux-aws-5.19.0/drivers/net/ethernet/smsc/smsc911x.c --- linux-aws-5.19.0/drivers/net/ethernet/smsc/smsc911x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/smsc/smsc911x.c 2022-11-29 07:06:46.000000000 +0000 @@ -1037,6 +1037,8 @@ return ret; } + /* Indicate that the MAC is responsible for managing PHY PM */ + phydev->mac_managed_pm = true; phy_attached_info(phydev); phy_set_max_speed(phydev, SPEED_100); @@ -2587,6 +2589,8 @@ if (netif_running(ndev)) { netif_stop_queue(ndev); netif_device_detach(ndev); + if (!device_may_wakeup(dev)) + phy_stop(ndev->phydev); } /* enable wake on LAN, energy detection and the external PME @@ -2628,6 +2632,8 @@ if (netif_running(ndev)) { netif_device_attach(ndev); netif_start_queue(ndev); + if (!device_may_wakeup(dev)) + phy_start(ndev->phydev); } return 0; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c linux-aws-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c --- linux-aws-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -3704,6 +3704,15 @@ goto init_error; } + if (priv->plat->serdes_powerup) { + ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); + if (ret < 0) { + netdev_err(priv->dev, "%s: Serdes powerup failed\n", + __func__); + goto init_error; + } + } + ret = stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); @@ -3793,6 +3802,10 @@ /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); + /* Powerdown Serdes if there is */ + if (priv->plat->serdes_powerdown) + priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv); + netif_carrier_off(dev); stmmac_release_ptp(priv); @@ -7158,14 +7171,6 @@ goto error_netdev_register; } - if (priv->plat->serdes_powerup) { - ret = priv->plat->serdes_powerup(ndev, - priv->plat->bsp_priv); - - if (ret < 0) - goto error_serdes_powerup; - } - #ifdef CONFIG_DEBUG_FS stmmac_init_fs(ndev); #endif @@ -7180,8 +7185,6 @@ return ret; -error_serdes_powerup: - unregister_netdev(ndev); error_netdev_register: phylink_destroy(priv->phylink); error_xpcs_setup: diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sun/sunhme.c linux-aws-5.19.0/drivers/net/ethernet/sun/sunhme.c --- linux-aws-5.19.0/drivers/net/ethernet/sun/sunhme.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sun/sunhme.c 2022-11-29 07:06:46.000000000 +0000 @@ -2020,9 +2020,9 @@ skb_reserve(copy_skb, 2); skb_put(copy_skb, len); - dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE); skb_copy_from_linear_data(skb, copy_skb->data, len); - dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); + dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE); /* Reuse original ring buffer. */ hme_write_rxd(hp, this, (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), diff -Nru linux-aws-5.19.0/drivers/net/ethernet/sunplus/spl2sw_driver.c linux-aws-5.19.0/drivers/net/ethernet/sunplus/spl2sw_driver.c --- linux-aws-5.19.0/drivers/net/ethernet/sunplus/spl2sw_driver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/sunplus/spl2sw_driver.c 2022-11-29 07:06:46.000000000 +0000 @@ -248,8 +248,8 @@ /* Check if mac address is valid */ if (!is_valid_ether_addr(mac)) { - kfree(mac); dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac); + kfree(mac); return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/net/ethernet/ti/davinci_mdio.c linux-aws-5.19.0/drivers/net/ethernet/ti/davinci_mdio.c --- linux-aws-5.19.0/drivers/net/ethernet/ti/davinci_mdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/ti/davinci_mdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -26,6 +26,8 @@ #include #include #include +#include +#include /* * This timeout definition is a worst-case ultra defensive measure against @@ -41,6 +43,7 @@ struct davinci_mdio_of_param { int autosuspend_delay_ms; + bool manual_mode; }; struct davinci_mdio_regs { @@ -49,6 +52,15 @@ #define CONTROL_IDLE BIT(31) #define CONTROL_ENABLE BIT(30) #define CONTROL_MAX_DIV (0xffff) +#define CONTROL_CLKDIV GENMASK(15, 0) + +#define MDIO_MAN_MDCLK_O BIT(2) +#define MDIO_MAN_OE BIT(1) +#define MDIO_MAN_PIN BIT(0) +#define MDIO_MANUALMODE BIT(31) + +#define MDIO_PIN 0 + u32 alive; u32 link; @@ -59,7 +71,9 @@ u32 userintmasked; u32 userintmaskset; u32 userintmaskclr; - u32 __reserved_1[20]; + u32 manualif; + u32 poll; + u32 __reserved_1[18]; struct { u32 access; @@ -79,6 +93,7 @@ struct davinci_mdio_data { struct mdio_platform_data pdata; + struct mdiobb_ctrl bb_ctrl; struct davinci_mdio_regs __iomem *regs; struct clk *clk; struct device *dev; @@ -90,6 +105,7 @@ */ bool skip_scan; u32 clk_div; + bool manual_mode; }; static void davinci_mdio_init_clk(struct davinci_mdio_data *data) @@ -128,9 +144,122 @@ writel(data->clk_div | CONTROL_ENABLE, &data->regs->control); } -static int davinci_mdio_reset(struct mii_bus *bus) +static void davinci_mdio_disable(struct davinci_mdio_data *data) +{ + u32 reg; + + /* Disable MDIO state machine */ + reg = readl(&data->regs->control); + + reg &= ~CONTROL_CLKDIV; + reg |= data->clk_div; + + reg &= ~CONTROL_ENABLE; + writel(reg, &data->regs->control); +} + +static void davinci_mdio_enable_manual_mode(struct davinci_mdio_data *data) +{ + u32 reg; + /* set manual mode */ + reg = readl(&data->regs->poll); + reg |= MDIO_MANUALMODE; + writel(reg, &data->regs->poll); +} + +static void davinci_set_mdc(struct mdiobb_ctrl *ctrl, int level) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (level) + reg |= MDIO_MAN_MDCLK_O; + else + reg &= ~MDIO_MAN_MDCLK_O; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (output) + reg |= MDIO_MAN_OE; + else + reg &= ~MDIO_MAN_OE; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_data(struct mdiobb_ctrl *ctrl, int value) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (value) + reg |= MDIO_MAN_PIN; + else + reg &= ~MDIO_MAN_PIN; + + writel(reg, &data->regs->manualif); +} + +static int davinci_get_mdio_data(struct mdiobb_ctrl *ctrl) +{ + struct davinci_mdio_data *data; + unsigned long reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + return test_bit(MDIO_PIN, ®); +} + +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_read(bus, phy, reg); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdiobb_write(struct mii_bus *bus, int phy, int reg, + u16 val) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_write(bus, phy, reg, val); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdio_common_reset(struct davinci_mdio_data *data) { - struct davinci_mdio_data *data = bus->priv; u32 phy_mask, ver; int ret; @@ -138,6 +267,11 @@ if (ret < 0) return ret; + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } + /* wait for scan logic to settle */ msleep(PHY_MAX_ADDR * data->access_time); @@ -171,6 +305,23 @@ return 0; } +static int davinci_mdio_reset(struct mii_bus *bus) +{ + struct davinci_mdio_data *data = bus->priv; + + return davinci_mdio_common_reset(data); +} + +static int davinci_mdiobb_reset(struct mii_bus *bus) +{ + struct mdiobb_ctrl *ctrl = bus->priv; + struct davinci_mdio_data *data; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + + return davinci_mdio_common_reset(data); +} + /* wait until hardware is ready for another user access */ static inline int wait_for_user_access(struct davinci_mdio_data *data) { @@ -318,6 +469,28 @@ return 0; } +struct k3_mdio_soc_data { + bool manual_mode; +}; + +static const struct k3_mdio_soc_data am65_mdio_soc_data = { + .manual_mode = true, +}; + +static const struct soc_device_attribute k3_mdio_socinfo[] = { + { .family = "AM62X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721S2", .revision = "SR1.0", .data = &am65_mdio_soc_data}, + { /* sentinel */ }, +}; + #if IS_ENABLED(CONFIG_OF) static const struct davinci_mdio_of_param of_cpsw_mdio_data = { .autosuspend_delay_ms = 100, @@ -331,6 +504,14 @@ MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable); #endif +static const struct mdiobb_ops davinci_mdiobb_ops = { + .owner = THIS_MODULE, + .set_mdc = davinci_set_mdc, + .set_mdio_dir = davinci_set_mdio_dir, + .set_mdio_data = davinci_set_mdio_data, + .get_mdio_data = davinci_get_mdio_data, +}; + static int davinci_mdio_probe(struct platform_device *pdev) { struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -345,7 +526,26 @@ if (!data) return -ENOMEM; - data->bus = devm_mdiobus_alloc(dev); + data->manual_mode = false; + data->bb_ctrl.ops = &davinci_mdiobb_ops; + + if (IS_ENABLED(CONFIG_OF) && dev->of_node) { + const struct soc_device_attribute *soc_match_data; + + soc_match_data = soc_device_match(k3_mdio_socinfo); + if (soc_match_data && soc_match_data->data) { + const struct k3_mdio_soc_data *socdata = + soc_match_data->data; + + data->manual_mode = socdata->manual_mode; + } + } + + if (data->manual_mode) + data->bus = alloc_mdio_bitbang(&data->bb_ctrl); + else + data->bus = devm_mdiobus_alloc(dev); + if (!data->bus) { dev_err(dev, "failed to alloc mii bus\n"); return -ENOMEM; @@ -371,11 +571,20 @@ } data->bus->name = dev_name(dev); - data->bus->read = davinci_mdio_read; - data->bus->write = davinci_mdio_write; - data->bus->reset = davinci_mdio_reset; + + if (data->manual_mode) { + data->bus->read = davinci_mdiobb_read; + data->bus->write = davinci_mdiobb_write; + data->bus->reset = davinci_mdiobb_reset; + + dev_info(dev, "Configuring MDIO in manual mode\n"); + } else { + data->bus->read = davinci_mdio_read; + data->bus->write = davinci_mdio_write; + data->bus->reset = davinci_mdio_reset; + data->bus->priv = data; + } data->bus->parent = dev; - data->bus->priv = data; data->clk = devm_clk_get(dev, "fck"); if (IS_ERR(data->clk)) { @@ -433,9 +642,13 @@ { struct davinci_mdio_data *data = platform_get_drvdata(pdev); - if (data->bus) + if (data->bus) { mdiobus_unregister(data->bus); + if (data->manual_mode) + free_mdio_bitbang(data->bus); + } + pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -452,7 +665,9 @@ ctrl = readl(&data->regs->control); ctrl &= ~CONTROL_ENABLE; writel(ctrl, &data->regs->control); - wait_for_idle(data); + + if (!data->manual_mode) + wait_for_idle(data); return 0; } @@ -461,7 +676,12 @@ { struct davinci_mdio_data *data = dev_get_drvdata(dev); - davinci_mdio_enable(data); + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } else { + davinci_mdio_enable(data); + } return 0; } #endif diff -Nru linux-aws-5.19.0/drivers/net/ethernet/ti/Kconfig linux-aws-5.19.0/drivers/net/ethernet/ti/Kconfig --- linux-aws-5.19.0/drivers/net/ethernet/ti/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/ti/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -33,6 +33,7 @@ tristate "TI DaVinci MDIO Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST select PHYLIB + select MDIO_BITBANG help This driver supports TI's DaVinci MDIO module. diff -Nru linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet.h linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet.h --- linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet.h 2022-11-29 07:06:46.000000000 +0000 @@ -402,6 +402,9 @@ * @rx_bd_num: Size of RX buffer descriptor ring * @rx_bd_ci: Stores the index of the Rx buffer descriptor in the ring being * accessed currently. + * @rx_packets: RX packet count for statistics + * @rx_bytes: RX byte count for statistics + * @rx_stat_sync: Synchronization object for RX stats * @napi_tx: NAPI TX control structure * @tx_dma_cr: Nominal content of TX DMA control register * @tx_bd_v: Virtual address of the TX buffer descriptor ring @@ -411,6 +414,9 @@ * complete. Only updated at runtime by TX NAPI poll. * @tx_bd_tail: Stores the index of the next Tx buffer descriptor in the ring * to be populated. + * @tx_packets: TX packet count for statistics + * @tx_bytes: TX byte count for statistics + * @tx_stat_sync: Synchronization object for TX stats * @dma_err_task: Work structure to process Axi DMA errors * @tx_irq: Axidma TX IRQ number * @rx_irq: Axidma RX IRQ number @@ -458,6 +464,9 @@ dma_addr_t rx_bd_p; u32 rx_bd_num; u32 rx_bd_ci; + u64_stats_t rx_packets; + u64_stats_t rx_bytes; + struct u64_stats_sync rx_stat_sync; struct napi_struct napi_tx; u32 tx_dma_cr; @@ -466,6 +475,9 @@ u32 tx_bd_num; u32 tx_bd_ci; u32 tx_bd_tail; + u64_stats_t tx_packets; + u64_stats_t tx_bytes; + struct u64_stats_sync tx_stat_sync; struct work_struct dma_err_task; diff -Nru linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c --- linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -762,8 +762,10 @@ if (lp->tx_bd_ci >= lp->tx_bd_num) lp->tx_bd_ci %= lp->tx_bd_num; - ndev->stats.tx_packets += packets; - ndev->stats.tx_bytes += size; + u64_stats_update_begin(&lp->tx_stat_sync); + u64_stats_add(&lp->tx_packets, packets); + u64_stats_add(&lp->tx_bytes, size); + u64_stats_update_end(&lp->tx_stat_sync); /* Matches barrier in axienet_start_xmit */ smp_mb(); @@ -994,8 +996,10 @@ cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; } - lp->ndev->stats.rx_packets += packets; - lp->ndev->stats.rx_bytes += size; + u64_stats_update_begin(&lp->rx_stat_sync); + u64_stats_add(&lp->rx_packets, packets); + u64_stats_add(&lp->rx_bytes, size); + u64_stats_update_end(&lp->rx_stat_sync); if (tail_p) axienet_dma_out_addr(lp, XAXIDMA_RX_TDESC_OFFSET, tail_p); @@ -1302,10 +1306,32 @@ return phylink_mii_ioctl(lp->phylink, rq, cmd); } +static void +axienet_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +{ + struct axienet_local *lp = netdev_priv(dev); + unsigned int start; + + netdev_stats_to_stats64(stats, &dev->stats); + + do { + start = u64_stats_fetch_begin_irq(&lp->rx_stat_sync); + stats->rx_packets = u64_stats_read(&lp->rx_packets); + stats->rx_bytes = u64_stats_read(&lp->rx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->rx_stat_sync, start)); + + do { + start = u64_stats_fetch_begin_irq(&lp->tx_stat_sync); + stats->tx_packets = u64_stats_read(&lp->tx_packets); + stats->tx_bytes = u64_stats_read(&lp->tx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->tx_stat_sync, start)); +} + static const struct net_device_ops axienet_netdev_ops = { .ndo_open = axienet_open, .ndo_stop = axienet_stop, .ndo_start_xmit = axienet_start_xmit, + .ndo_get_stats64 = axienet_get_stats64, .ndo_change_mtu = axienet_change_mtu, .ndo_set_mac_address = netdev_set_mac_address, .ndo_validate_addr = eth_validate_addr, @@ -1860,6 +1886,9 @@ lp->rx_bd_num = RX_BD_NUM_DEFAULT; lp->tx_bd_num = TX_BD_NUM_DEFAULT; + u64_stats_init(&lp->rx_stat_sync); + u64_stats_init(&lp->tx_stat_sync); + netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll, NAPI_POLL_WEIGHT); netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll, NAPI_POLL_WEIGHT); diff -Nru linux-aws-5.19.0/drivers/net/hyperv/hyperv_net.h linux-aws-5.19.0/drivers/net/hyperv/hyperv_net.h --- linux-aws-5.19.0/drivers/net/hyperv/hyperv_net.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/hyperv/hyperv_net.h 2022-11-29 07:06:46.000000000 +0000 @@ -1051,7 +1051,8 @@ u32 vf_alloc; /* Serial number of the VF to team with */ u32 vf_serial; - + /* completion variable to confirm vf association */ + struct completion vf_add; /* Is the current data path through the VF NIC? */ bool data_path_is_vf; diff -Nru linux-aws-5.19.0/drivers/net/hyperv/netvsc.c linux-aws-5.19.0/drivers/net/hyperv/netvsc.c --- linux-aws-5.19.0/drivers/net/hyperv/netvsc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/hyperv/netvsc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1580,6 +1580,10 @@ net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; + + if (net_device_ctx->vf_alloc) + complete(&net_device_ctx->vf_add); + netdev_info(ndev, "VF slot %u %s\n", net_device_ctx->vf_serial, net_device_ctx->vf_alloc ? "added" : "removed"); diff -Nru linux-aws-5.19.0/drivers/net/hyperv/netvsc_drv.c linux-aws-5.19.0/drivers/net/hyperv/netvsc_drv.c --- linux-aws-5.19.0/drivers/net/hyperv/netvsc_drv.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/hyperv/netvsc_drv.c 2022-11-29 07:06:46.000000000 +0000 @@ -2313,6 +2313,18 @@ } + /* Fallback path to check synthetic vf with + * help of mac addr + */ + 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"); + return ndev; + } + } + netdev_notice(vf_netdev, "no netdev found for vf serial:%u\n", serial); return NULL; @@ -2409,6 +2421,11 @@ if (net_device_ctx->data_path_is_vf == vf_is_up) return NOTIFY_OK; + if (vf_is_up && !net_device_ctx->vf_alloc) { + netdev_info(ndev, "Waiting for the VF association from host\n"); + wait_for_completion(&net_device_ctx->vf_add); + } + ret = netvsc_switch_datapath(ndev, vf_is_up); if (ret) { @@ -2440,6 +2457,7 @@ netvsc_vf_setxdp(vf_netdev, NULL); + reinit_completion(&net_device_ctx->vf_add); netdev_rx_handler_unregister(vf_netdev); netdev_upper_dev_unlink(vf_netdev, ndev); RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL); @@ -2479,6 +2497,7 @@ INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); + init_completion(&net_device_ctx->vf_add); spin_lock_init(&net_device_ctx->lock); INIT_LIST_HEAD(&net_device_ctx->reconfig_events); INIT_DELAYED_WORK(&net_device_ctx->vf_takeover, netvsc_vf_setup); diff -Nru linux-aws-5.19.0/drivers/net/ieee802154/adf7242.c linux-aws-5.19.0/drivers/net/ieee802154/adf7242.c --- linux-aws-5.19.0/drivers/net/ieee802154/adf7242.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ieee802154/adf7242.c 2022-11-29 07:06:46.000000000 +0000 @@ -1310,10 +1310,11 @@ debugfs_remove_recursive(lp->debugfs_root); + ieee802154_unregister_hw(lp->hw); + cancel_delayed_work_sync(&lp->work); destroy_workqueue(lp->wqueue); - ieee802154_unregister_hw(lp->hw); mutex_destroy(&lp->bmux); ieee802154_free_hw(lp->hw); } diff -Nru linux-aws-5.19.0/drivers/net/ieee802154/cc2520.c linux-aws-5.19.0/drivers/net/ieee802154/cc2520.c --- linux-aws-5.19.0/drivers/net/ieee802154/cc2520.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ieee802154/cc2520.c 2022-11-29 07:06:46.000000000 +0000 @@ -504,6 +504,7 @@ goto err_tx; if (status & CC2520_STATUS_TX_UNDERFLOW) { + rc = -EINVAL; dev_err(&priv->spi->dev, "cc2520 tx underflow exception\n"); goto err_tx; } diff -Nru linux-aws-5.19.0/drivers/net/ipa/ipa_qmi.c linux-aws-5.19.0/drivers/net/ipa/ipa_qmi.c --- linux-aws-5.19.0/drivers/net/ipa/ipa_qmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipa/ipa_qmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -308,12 +308,12 @@ mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE); req.v4_route_tbl_info_valid = 1; req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset; - req.v4_route_tbl_info.count = mem->size / sizeof(__le64); + req.v4_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE); req.v6_route_tbl_info_valid = 1; req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset; - req.v6_route_tbl_info.count = mem->size / sizeof(__le64); + req.v6_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER); req.v4_filter_tbl_start_valid = 1; @@ -352,7 +352,7 @@ req.v4_hash_route_tbl_info_valid = 1; req.v4_hash_route_tbl_info.start = ipa->mem_offset + mem->offset; - req.v4_hash_route_tbl_info.count = mem->size / sizeof(__le64); + req.v4_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; } mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED); @@ -360,7 +360,7 @@ req.v6_hash_route_tbl_info_valid = 1; req.v6_hash_route_tbl_info.start = ipa->mem_offset + mem->offset; - req.v6_hash_route_tbl_info.count = mem->size / sizeof(__le64); + req.v6_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; } mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED); diff -Nru linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.c linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.c --- linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.c 2022-11-29 07:06:46.000000000 +0000 @@ -311,7 +311,7 @@ .tlv_type = 0x12, .offset = offsetof(struct ipa_init_modem_driver_req, v4_route_tbl_info), - .ei_array = ipa_mem_array_ei, + .ei_array = ipa_mem_bounds_ei, }, { .data_type = QMI_OPT_FLAG, @@ -332,7 +332,7 @@ .tlv_type = 0x13, .offset = offsetof(struct ipa_init_modem_driver_req, v6_route_tbl_info), - .ei_array = ipa_mem_array_ei, + .ei_array = ipa_mem_bounds_ei, }, { .data_type = QMI_OPT_FLAG, @@ -496,7 +496,7 @@ .tlv_type = 0x1b, .offset = offsetof(struct ipa_init_modem_driver_req, v4_hash_route_tbl_info), - .ei_array = ipa_mem_array_ei, + .ei_array = ipa_mem_bounds_ei, }, { .data_type = QMI_OPT_FLAG, @@ -517,7 +517,7 @@ .tlv_type = 0x1c, .offset = offsetof(struct ipa_init_modem_driver_req, v6_hash_route_tbl_info), - .ei_array = ipa_mem_array_ei, + .ei_array = ipa_mem_bounds_ei, }, { .data_type = QMI_OPT_FLAG, diff -Nru linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.h linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.h --- linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipa/ipa_qmi_msg.h 2022-11-29 07:06:46.000000000 +0000 @@ -86,9 +86,11 @@ IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01 = 0x5, /* QNX MSM */ }; -/* This defines the start and end offset of a range of memory. Both - * fields are offsets relative to the start of IPA shared memory. - * The end value is the last addressable byte *within* the range. +/* This defines the start and end offset of a range of memory. The start + * value is a byte offset relative to the start of IPA shared memory. The + * end value is the last addressable unit *within* the range. Typically + * the end value is in units of bytes, however it can also be a maximum + * array index value. */ struct ipa_mem_bounds { u32 start; @@ -129,18 +131,19 @@ u8 hdr_tbl_info_valid; struct ipa_mem_bounds hdr_tbl_info; - /* Routing table information. These define the location and size of - * non-hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + /* Routing table information. These define the location and maximum + * *index* (not byte) for the modem portion of non-hashable IPv4 and + * IPv6 routing tables. The start values are byte offsets relative + * to the start of IPA shared memory. */ u8 v4_route_tbl_info_valid; - struct ipa_mem_array v4_route_tbl_info; + struct ipa_mem_bounds v4_route_tbl_info; u8 v6_route_tbl_info_valid; - struct ipa_mem_array v6_route_tbl_info; + struct ipa_mem_bounds v6_route_tbl_info; /* Filter table information. These define the location of the * non-hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + * byte offsets relative to the start of IPA shared memory. */ u8 v4_filter_tbl_start_valid; u32 v4_filter_tbl_start; @@ -181,18 +184,20 @@ u8 zip_tbl_info_valid; struct ipa_mem_bounds zip_tbl_info; - /* Routing table information. These define the location and size - * of hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + /* Routing table information. These define the location and maximum + * *index* (not byte) for the modem portion of hashable IPv4 and IPv6 + * routing tables (if supported by hardware). The start values are + * byte offsets relative to the start of IPA shared memory. */ u8 v4_hash_route_tbl_info_valid; - struct ipa_mem_array v4_hash_route_tbl_info; + struct ipa_mem_bounds v4_hash_route_tbl_info; u8 v6_hash_route_tbl_info_valid; - struct ipa_mem_array v6_hash_route_tbl_info; + struct ipa_mem_bounds v6_hash_route_tbl_info; /* Filter table information. These define the location and size - * of hashable IPv4 and IPv6 filter tables. The start values are - * offsets relative to the start of IPA shared memory. + * of hashable IPv4 and IPv6 filter tables (if supported by hardware). + * The start values are byte offsets relative to the start of IPA + * shared memory. */ u8 v4_hash_filter_tbl_start_valid; u32 v4_hash_filter_tbl_start; diff -Nru linux-aws-5.19.0/drivers/net/ipa/ipa_table.c linux-aws-5.19.0/drivers/net/ipa/ipa_table.c --- linux-aws-5.19.0/drivers/net/ipa/ipa_table.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipa/ipa_table.c 2022-11-29 07:06:46.000000000 +0000 @@ -108,8 +108,6 @@ /* Assignment of route table entries to the modem and AP */ #define IPA_ROUTE_MODEM_MIN 0 -#define IPA_ROUTE_MODEM_COUNT 8 - #define IPA_ROUTE_AP_MIN IPA_ROUTE_MODEM_COUNT #define IPA_ROUTE_AP_COUNT \ (IPA_ROUTE_COUNT_MAX - IPA_ROUTE_MODEM_COUNT) diff -Nru linux-aws-5.19.0/drivers/net/ipa/ipa_table.h linux-aws-5.19.0/drivers/net/ipa/ipa_table.h --- linux-aws-5.19.0/drivers/net/ipa/ipa_table.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipa/ipa_table.h 2022-11-29 07:06:46.000000000 +0000 @@ -13,6 +13,9 @@ /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */ #define IPA_FILTER_COUNT_MAX 14 +/* The number of route table entries allotted to the modem */ +#define IPA_ROUTE_MODEM_COUNT 8 + /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */ #define IPA_ROUTE_COUNT_MAX 15 diff -Nru linux-aws-5.19.0/drivers/net/ipvlan/ipvlan_core.c linux-aws-5.19.0/drivers/net/ipvlan/ipvlan_core.c --- linux-aws-5.19.0/drivers/net/ipvlan/ipvlan_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/ipvlan/ipvlan_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -495,7 +495,6 @@ static int ipvlan_process_outbound(struct sk_buff *skb) { - struct ethhdr *ethh = eth_hdr(skb); int ret = NET_XMIT_DROP; /* The ipvlan is a pseudo-L2 device, so the packets that we receive @@ -505,6 +504,8 @@ if (skb_mac_header_was_set(skb)) { /* In this mode we dont care about * multicast and broadcast traffic */ + struct ethhdr *ethh = eth_hdr(skb); + if (is_multicast_ether_addr(ethh->h_dest)) { pr_debug_ratelimited( "Dropped {multi|broad}cast of type=[%x]\n", @@ -589,7 +590,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) { const struct ipvl_dev *ipvlan = netdev_priv(dev); - struct ethhdr *eth = eth_hdr(skb); + struct ethhdr *eth = skb_eth_hdr(skb); struct ipvl_addr *addr; void *lyr3h; int addr_type; @@ -619,6 +620,7 @@ return dev_forward_skb(ipvlan->phy_dev, skb); } else if (is_multicast_ether_addr(eth->h_dest)) { + skb_reset_mac_header(skb); ipvlan_skb_crossing_ns(skb, NULL); ipvlan_multicast_enqueue(ipvlan->port, skb, true); return NET_XMIT_SUCCESS; diff -Nru linux-aws-5.19.0/drivers/net/mdio/of_mdio.c linux-aws-5.19.0/drivers/net/mdio/of_mdio.c --- linux-aws-5.19.0/drivers/net/mdio/of_mdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/mdio/of_mdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -231,6 +231,7 @@ return 0; unregister: + of_node_put(child); mdiobus_unregister(mdio); return rc; } diff -Nru linux-aws-5.19.0/drivers/net/netdevsim/hwstats.c linux-aws-5.19.0/drivers/net/netdevsim/hwstats.c --- linux-aws-5.19.0/drivers/net/netdevsim/hwstats.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/netdevsim/hwstats.c 2022-11-29 07:06:46.000000000 +0000 @@ -433,11 +433,11 @@ goto err_remove_hwstats_recursive; } - debugfs_create_file("enable_ifindex", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_enable_fops.fops); - debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_disable_fops.fops); - debugfs_create_file("fail_next_enable", 0600, hwstats->l3_ddir, hwstats, + debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_fail_fops.fops); INIT_DELAYED_WORK(&hwstats->traffic_dw, diff -Nru linux-aws-5.19.0/drivers/net/netdevsim/netdev.c linux-aws-5.19.0/drivers/net/netdevsim/netdev.c --- linux-aws-5.19.0/drivers/net/netdevsim/netdev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/netdevsim/netdev.c 2022-11-29 07:06:46.000000000 +0000 @@ -67,10 +67,10 @@ unsigned int start; do { - start = u64_stats_fetch_begin(&ns->syncp); + start = u64_stats_fetch_begin_irq(&ns->syncp); stats->tx_bytes = ns->tx_bytes; stats->tx_packets = ns->tx_packets; - } while (u64_stats_fetch_retry(&ns->syncp, start)); + } while (u64_stats_fetch_retry_irq(&ns->syncp, start)); } static int diff -Nru linux-aws-5.19.0/drivers/net/phy/aquantia_main.c linux-aws-5.19.0/drivers/net/phy/aquantia_main.c --- linux-aws-5.19.0/drivers/net/phy/aquantia_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/phy/aquantia_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -90,6 +90,9 @@ #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) +#define VEND1_GLOBAL_GEN_STAT2 0xc831 +#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) + #define VEND1_GLOBAL_RSVD_STAT1 0xc885 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) @@ -124,6 +127,12 @@ #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) +/* Sleep and timeout for checking if the Processor-Intensive + * MDIO operation is finished + */ +#define AQR107_OP_IN_PROG_SLEEP 1000 +#define AQR107_OP_IN_PROG_TIMEOUT 100000 + struct aqr107_hw_stat { const char *name; int reg; @@ -596,16 +605,52 @@ phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); } +static int aqr107_wait_processor_intensive_op(struct phy_device *phydev) +{ + int val, err; + + /* The datasheet notes to wait at least 1ms after issuing a + * processor intensive operation before checking. + * We cannot use the 'sleep_before_read' parameter of read_poll_timeout + * because that just determines the maximum time slept, not the minimum. + */ + usleep_range(1000, 5000); + + err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, + VEND1_GLOBAL_GEN_STAT2, val, + !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG), + AQR107_OP_IN_PROG_SLEEP, + AQR107_OP_IN_PROG_TIMEOUT, false); + if (err) { + phydev_err(phydev, "timeout: processor-intensive MDIO operation\n"); + return err; + } + + return 0; +} + static int aqr107_suspend(struct phy_device *phydev) { - return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, - MDIO_CTRL1_LPOWER); + int err; + + err = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); + if (err) + return err; + + return aqr107_wait_processor_intensive_op(phydev); } static int aqr107_resume(struct phy_device *phydev) { - return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, - MDIO_CTRL1_LPOWER); + int err; + + err = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); + if (err) + return err; + + return aqr107_wait_processor_intensive_op(phydev); } static int aqr107_probe(struct phy_device *phydev) diff -Nru linux-aws-5.19.0/drivers/net/phy/meson-gxl.c linux-aws-5.19.0/drivers/net/phy/meson-gxl.c --- linux-aws-5.19.0/drivers/net/phy/meson-gxl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/phy/meson-gxl.c 2022-11-29 07:06:46.000000000 +0000 @@ -243,13 +243,7 @@ irq_status == INTSRC_ENERGY_DETECT) return IRQ_HANDLED; - /* Give PHY some time before MAC starts sending data. This works - * around an issue where network doesn't come up properly. - */ - if (!(irq_status & INTSRC_LINK_DOWN)) - phy_queue_state_machine(phydev, msecs_to_jiffies(100)); - else - phy_trigger_machine(phydev); + phy_trigger_machine(phydev); return IRQ_HANDLED; } diff -Nru linux-aws-5.19.0/drivers/net/phy/micrel.c linux-aws-5.19.0/drivers/net/phy/micrel.c --- linux-aws-5.19.0/drivers/net/phy/micrel.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/phy/micrel.c 2022-11-29 07:06:46.000000000 +0000 @@ -2662,16 +2662,19 @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev) { int irq_status, tsu_irq_status; + int ret = IRQ_NONE; irq_status = phy_read(phydev, LAN8814_INTS); - if (irq_status > 0 && (irq_status & LAN8814_INT_LINK)) - phy_trigger_machine(phydev); - if (irq_status < 0) { phy_error(phydev); return IRQ_NONE; } + if (irq_status & LAN8814_INT_LINK) { + phy_trigger_machine(phydev); + ret = IRQ_HANDLED; + } + while (1) { tsu_irq_status = lanphy_read_page_reg(phydev, 4, LAN8814_INTR_STS_REG); @@ -2680,12 +2683,15 @@ (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ | LAN8814_INTR_STS_REG_1588_TSU1_ | LAN8814_INTR_STS_REG_1588_TSU2_ | - LAN8814_INTR_STS_REG_1588_TSU3_))) + LAN8814_INTR_STS_REG_1588_TSU3_))) { lan8814_handle_ptp_interrupt(phydev); - else + ret = IRQ_HANDLED; + } else { break; + } } - return IRQ_HANDLED; + + return ret; } static int lan8814_ack_interrupt(struct phy_device *phydev) @@ -2838,12 +2844,18 @@ return 0; } +/* It is expected that there will not be any 'lan8814_take_coma_mode' + * function called in suspend. Because the GPIO line can be shared, so if one of + * the phys goes back in coma mode, then all the other PHYs will go, which is + * wrong. + */ static int lan8814_release_coma_mode(struct phy_device *phydev) { struct gpio_desc *gpiod; gpiod = devm_gpiod_get_optional(&phydev->mdio.dev, "coma-mode", - GPIOD_OUT_HIGH_OPEN_DRAIN); + GPIOD_OUT_HIGH_OPEN_DRAIN | + GPIOD_FLAGS_BIT_NONEXCLUSIVE); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); diff -Nru linux-aws-5.19.0/drivers/net/phy/microchip_t1.c linux-aws-5.19.0/drivers/net/phy/microchip_t1.c --- linux-aws-5.19.0/drivers/net/phy/microchip_t1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/phy/microchip_t1.c 2022-11-29 07:06:46.000000000 +0000 @@ -28,12 +28,16 @@ /* Interrupt Source Register */ #define LAN87XX_INTERRUPT_SOURCE (0x18) +#define LAN87XX_INTERRUPT_SOURCE_2 (0x08) /* Interrupt Mask Register */ #define LAN87XX_INTERRUPT_MASK (0x19) #define LAN87XX_MASK_LINK_UP (0x0004) #define LAN87XX_MASK_LINK_DOWN (0x0002) +#define LAN87XX_INTERRUPT_MASK_2 (0x09) +#define LAN87XX_MASK_COMM_RDY BIT(10) + /* MISC Control 1 Register */ #define LAN87XX_CTRL_1 (0x11) #define LAN87XX_MASK_RGMII_TXC_DLY_EN (0x4000) @@ -424,17 +428,55 @@ int rc, val = 0; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { - /* unmask all source and clear them before enable */ - rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, 0x7FFF); + /* clear all interrupt */ + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); + if (rc < 0) + return rc; + rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); - val = LAN87XX_MASK_LINK_UP | LAN87XX_MASK_LINK_DOWN; + if (rc < 0) + return rc; + + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_MASK_2, val); + if (rc < 0) + return rc; + + rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_SOURCE_2, 0); + if (rc < 0) + return rc; + + /* enable link down and comm ready interrupt */ + val = LAN87XX_MASK_LINK_DOWN; rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); + if (rc < 0) + return rc; + + val = LAN87XX_MASK_COMM_RDY; + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_MASK_2, val); } else { rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); - if (rc) + if (rc < 0) return rc; rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); + if (rc < 0) + return rc; + + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_MASK_2, val); + if (rc < 0) + return rc; + + rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_SOURCE_2, 0); } return rc < 0 ? rc : 0; @@ -444,6 +486,14 @@ { int irq_status; + irq_status = access_ereg(phydev, PHYACC_ATTR_MODE_READ, + PHYACC_ATTR_BANK_MISC, + LAN87XX_INTERRUPT_SOURCE_2, 0); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + irq_status = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); if (irq_status < 0) { phy_error(phydev); diff -Nru linux-aws-5.19.0/drivers/net/phy/phy_device.c linux-aws-5.19.0/drivers/net/phy/phy_device.c --- linux-aws-5.19.0/drivers/net/phy/phy_device.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/phy/phy_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -316,11 +316,13 @@ phydev->suspended_by_mdio_bus = 0; - /* If we manged to get here with the PHY state machine in a state neither - * PHY_HALTED nor PHY_READY this is an indication that something went wrong - * and we should most likely be using MAC managed PM and we are not. + /* If we managed to get here with the PHY state machine in a state + * neither PHY_HALTED, PHY_READY nor PHY_UP, this is an indication + * that something went wrong and we should most likely be using + * MAC managed PM, but we are not. */ - WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY); + WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY && + phydev->state != PHY_UP); ret = phy_init_hw(phydev); if (ret < 0) diff -Nru linux-aws-5.19.0/drivers/net/team/team.c linux-aws-5.19.0/drivers/net/team/team.c --- linux-aws-5.19.0/drivers/net/team/team.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/team/team.c 2022-11-29 07:06:46.000000000 +0000 @@ -1275,10 +1275,12 @@ } } - netif_addr_lock_bh(dev); - dev_uc_sync_multiple(port_dev, dev); - dev_mc_sync_multiple(port_dev, dev); - netif_addr_unlock_bh(dev); + if (dev->flags & IFF_UP) { + netif_addr_lock_bh(dev); + dev_uc_sync_multiple(port_dev, dev); + dev_mc_sync_multiple(port_dev, dev); + netif_addr_unlock_bh(dev); + } port->index = -1; list_add_tail_rcu(&port->list, &team->port_list); @@ -1349,8 +1351,10 @@ netdev_rx_handler_unregister(port_dev); team_port_disable_netpoll(port); vlan_vids_del_by_dev(port_dev, dev); - dev_uc_unsync(port_dev, dev); - dev_mc_unsync(port_dev, dev); + if (dev->flags & IFF_UP) { + dev_uc_unsync(port_dev, dev); + dev_mc_unsync(port_dev, dev); + } dev_close(port_dev); team_port_leave(team, port); @@ -1700,6 +1704,14 @@ static int team_close(struct net_device *dev) { + struct team *team = netdev_priv(dev); + struct team_port *port; + + list_for_each_entry(port, &team->port_list, list) { + dev_uc_unsync(port->dev, dev); + dev_mc_unsync(port->dev, dev); + } + return 0; } diff -Nru linux-aws-5.19.0/drivers/net/thunderbolt.c linux-aws-5.19.0/drivers/net/thunderbolt.c --- linux-aws-5.19.0/drivers/net/thunderbolt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/thunderbolt.c 2022-11-29 07:06:46.000000000 +0000 @@ -612,18 +612,13 @@ return; } - /* Both logins successful so enable the high-speed DMA paths and - * start the network device queue. + /* Both logins successful so enable the rings, high-speed DMA + * paths and start the network device queue. + * + * Note we enable the DMA paths last to make sure we have primed + * the Rx ring before any incoming packets are allowed to + * arrive. */ - ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, - net->rx_ring.ring->hop, - net->remote_transmit_path, - net->tx_ring.ring->hop); - if (ret) { - netdev_err(net->dev, "failed to enable DMA paths\n"); - return; - } - tb_ring_start(net->tx_ring.ring); tb_ring_start(net->rx_ring.ring); @@ -635,10 +630,21 @@ if (ret) goto err_free_rx_buffers; + ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, + net->rx_ring.ring->hop, + net->remote_transmit_path, + net->tx_ring.ring->hop); + if (ret) { + netdev_err(net->dev, "failed to enable DMA paths\n"); + goto err_free_tx_buffers; + } + netif_carrier_on(net->dev); netif_start_queue(net->dev); return; +err_free_tx_buffers: + tbnet_free_buffers(&net->tx_ring); err_free_rx_buffers: tbnet_free_buffers(&net->rx_ring); err_stop_rings: diff -Nru linux-aws-5.19.0/drivers/net/usb/cdc_ether.c linux-aws-5.19.0/drivers/net/usb/cdc_ether.c --- linux-aws-5.19.0/drivers/net/usb/cdc_ether.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/usb/cdc_ether.c 2022-11-29 07:06:46.000000000 +0000 @@ -777,6 +777,13 @@ }, #endif +/* Lenovo ThinkPad OneLink+ Dock (based on Realtek RTL8153) */ +{ + USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3054, USB_CLASS_COMM, + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info = 0, +}, + /* ThinkPad USB-C Dock (based on Realtek RTL8153) */ { USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3062, USB_CLASS_COMM, diff -Nru linux-aws-5.19.0/drivers/net/usb/qmi_wwan.c linux-aws-5.19.0/drivers/net/usb/qmi_wwan.c --- linux-aws-5.19.0/drivers/net/usb/qmi_wwan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/usb/qmi_wwan.c 2022-11-29 07:06:46.000000000 +0000 @@ -1399,6 +1399,7 @@ {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81c2, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */ diff -Nru linux-aws-5.19.0/drivers/net/usb/r8152.c linux-aws-5.19.0/drivers/net/usb/r8152.c --- linux-aws-5.19.0/drivers/net/usb/r8152.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/usb/r8152.c 2022-11-29 07:06:46.000000000 +0000 @@ -770,6 +770,7 @@ RX_EPROTO, }; +#define DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK 0x3054 #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082 #define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c #define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387 @@ -9583,6 +9584,7 @@ if (vendor_id == VENDOR_ID_LENOVO) { switch (product_id) { + case DEVICE_ID_THINKPAD_ONELINK_PLUS_DOCK: case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2: case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2: case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3: @@ -9830,6 +9832,7 @@ REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927), REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f), + REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069), REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082), diff -Nru linux-aws-5.19.0/drivers/net/usb/usbnet.c linux-aws-5.19.0/drivers/net/usb/usbnet.c --- linux-aws-5.19.0/drivers/net/usb/usbnet.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/usb/usbnet.c 2022-11-29 07:06:46.000000000 +0000 @@ -1601,6 +1601,7 @@ struct usbnet *dev; struct usb_device *xdev; struct net_device *net; + struct urb *urb; dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -1617,7 +1618,11 @@ net = dev->net; unregister_netdev (net); - usb_scuttle_anchored_urbs(&dev->deferred); + while ((urb = usb_get_from_anchor(&dev->deferred))) { + dev_kfree_skb(urb->context); + kfree(urb->sg); + usb_free_urb(urb); + } if (dev->driver_info->unbind) dev->driver_info->unbind(dev, intf); diff -Nru linux-aws-5.19.0/drivers/net/wireguard/netlink.c linux-aws-5.19.0/drivers/net/wireguard/netlink.c --- linux-aws-5.19.0/drivers/net/wireguard/netlink.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireguard/netlink.c 2022-11-29 07:06:46.000000000 +0000 @@ -436,14 +436,13 @@ if (attrs[WGPEER_A_ENDPOINT]) { struct sockaddr *addr = nla_data(attrs[WGPEER_A_ENDPOINT]); size_t len = nla_len(attrs[WGPEER_A_ENDPOINT]); + struct endpoint endpoint = { { { 0 } } }; - if ((len == sizeof(struct sockaddr_in) && - addr->sa_family == AF_INET) || - (len == sizeof(struct sockaddr_in6) && - addr->sa_family == AF_INET6)) { - struct endpoint endpoint = { { { 0 } } }; - - memcpy(&endpoint.addr, addr, len); + if (len == sizeof(struct sockaddr_in) && addr->sa_family == AF_INET) { + endpoint.addr4 = *(struct sockaddr_in *)addr; + wg_socket_set_peer_endpoint(peer, &endpoint); + } else if (len == sizeof(struct sockaddr_in6) && addr->sa_family == AF_INET6) { + endpoint.addr6 = *(struct sockaddr_in6 *)addr; wg_socket_set_peer_endpoint(peer, &endpoint); } } diff -Nru linux-aws-5.19.0/drivers/net/wireguard/selftest/ratelimiter.c linux-aws-5.19.0/drivers/net/wireguard/selftest/ratelimiter.c --- linux-aws-5.19.0/drivers/net/wireguard/selftest/ratelimiter.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireguard/selftest/ratelimiter.c 2022-11-29 07:06:46.000000000 +0000 @@ -6,29 +6,28 @@ #ifdef DEBUG #include -#include static const struct { bool result; - u64 nsec_to_sleep_before; + unsigned int msec_to_sleep_before; } expected_results[] __initconst = { [0 ... PACKETS_BURSTABLE - 1] = { true, 0 }, [PACKETS_BURSTABLE] = { false, 0 }, - [PACKETS_BURSTABLE + 1] = { true, NSEC_PER_SEC / PACKETS_PER_SECOND }, + [PACKETS_BURSTABLE + 1] = { true, MSEC_PER_SEC / PACKETS_PER_SECOND }, [PACKETS_BURSTABLE + 2] = { false, 0 }, - [PACKETS_BURSTABLE + 3] = { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) * 2 }, + [PACKETS_BURSTABLE + 3] = { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) * 2 }, [PACKETS_BURSTABLE + 4] = { true, 0 }, [PACKETS_BURSTABLE + 5] = { false, 0 } }; static __init unsigned int maximum_jiffies_at_index(int index) { - u64 total_nsecs = 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3; + unsigned int total_msecs = 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3; int i; for (i = 0; i <= index; ++i) - total_nsecs += expected_results[i].nsec_to_sleep_before; - return nsecs_to_jiffies(total_nsecs); + total_msecs += expected_results[i].msec_to_sleep_before; + return msecs_to_jiffies(total_msecs); } static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, @@ -43,12 +42,8 @@ loop_start_time = jiffies; for (i = 0; i < ARRAY_SIZE(expected_results); ++i) { - if (expected_results[i].nsec_to_sleep_before) { - ktime_t timeout = ktime_add(ktime_add_ns(ktime_get_coarse_boottime(), TICK_NSEC * 4 / 3), - ns_to_ktime(expected_results[i].nsec_to_sleep_before)); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOOTTIME); - } + if (expected_results[i].msec_to_sleep_before) + msleep(expected_results[i].msec_to_sleep_before); if (time_is_before_jiffies(loop_start_time + maximum_jiffies_at_index(i))) @@ -132,7 +127,7 @@ if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN)) return true; - BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND != 0); + BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND != 0); if (wg_ratelimiter_init()) goto out; @@ -172,7 +167,7 @@ ++test; #endif - for (trials = TRIALS_BEFORE_GIVING_UP;;) { + for (trials = TRIALS_BEFORE_GIVING_UP; IS_ENABLED(DEBUG_RATELIMITER_TIMINGS);) { int test_count = 0, ret; ret = timings_test(skb4, hdr4, skb6, hdr6, &test_count); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/core.c linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/core.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -95,6 +95,7 @@ .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA988X_HW_2_0_VERSION, @@ -133,6 +134,7 @@ .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9887_HW_1_0_VERSION, @@ -172,6 +174,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -206,6 +209,7 @@ .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -244,6 +248,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -282,6 +287,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_0_VERSION, @@ -320,6 +326,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -362,6 +369,7 @@ .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA99X0_HW_2_0_DEV_VERSION, @@ -406,6 +414,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9984_HW_1_0_DEV_VERSION, @@ -457,6 +466,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9888_HW_2_0_DEV_VERSION, @@ -505,6 +515,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_0_DEV_VERSION, @@ -543,6 +554,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -583,6 +595,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -614,6 +627,7 @@ .credit_size_workaround = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -659,6 +673,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = WCN3990_HW_1_0_DEV_VERSION, @@ -690,6 +705,7 @@ .tx_stats_over_pktlog = false, .dynamic_sar_support = true, .hw_restart_disconnect = true, + .use_fw_tx_credits = false, }, }; diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/htc.c linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/htc.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/htc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/htc.c 2022-11-29 07:06:46.000000000 +0000 @@ -947,13 +947,18 @@ return -ECOMM; } - htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + if (ar->hw_params.use_fw_tx_credits) + htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + else + htc->total_transmit_credits = 1; + htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); ath10k_dbg(ar, ATH10K_DBG_HTC, - "Target ready! transmit resources: %d size:%d\n", + "Target ready! transmit resources: %d size:%d actual credits:%d\n", htc->total_transmit_credits, - htc->target_credit_size); + htc->target_credit_size, + msg->ready.credit_count); if ((htc->total_transmit_credits == 0) || (htc->target_credit_size == 0)) { diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/hw.h linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/hw.h --- linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/hw.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/hw.h 2022-11-29 07:06:46.000000000 +0000 @@ -635,6 +635,8 @@ bool dynamic_sar_support; bool hw_restart_disconnect; + + bool use_fw_tx_credits; }; struct htt_resp; diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/mac.c linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/mac.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath10k/mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -864,11 +864,36 @@ return 0; } +static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer) +{ + int peer_id, i; + + lockdep_assert_held(&ar->conf_mutex); + + for_each_set_bit(peer_id, peer->peer_ids, + ATH10K_MAX_NUM_PEER_IDS) { + ar->peer_map[peer_id] = NULL; + } + + /* Double check that peer is properly un-referenced from + * the peer_map + */ + for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { + if (ar->peer_map[i] == peer) { + ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", + peer->addr, peer, i); + ar->peer_map[i] = NULL; + } + } + + list_del(&peer->list); + kfree(peer); + ar->num_peers--; +} + static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) { struct ath10k_peer *peer, *tmp; - int peer_id; - int i; lockdep_assert_held(&ar->conf_mutex); @@ -880,25 +905,7 @@ ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n", peer->addr, vdev_id); - for_each_set_bit(peer_id, peer->peer_ids, - ATH10K_MAX_NUM_PEER_IDS) { - ar->peer_map[peer_id] = NULL; - } - - /* Double check that peer is properly un-referenced from - * the peer_map - */ - for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { - if (ar->peer_map[i] == peer) { - ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", - peer->addr, peer, i); - ar->peer_map[i] = NULL; - } - } - - list_del(&peer->list); - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } spin_unlock_bh(&ar->data_lock); } @@ -7586,10 +7593,7 @@ /* Clean up the peer object as well since we * must have failed to do this above. */ - list_del(&peer->list); - ar->peer_map[i] = NULL; - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } } spin_unlock_bh(&ar->data_lock); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/ahb.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/ahb.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/ahb.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/ahb.c 2022-11-29 07:06:46.000000000 +0000 @@ -1088,20 +1088,10 @@ return ret; } -static int ath11k_ahb_remove(struct platform_device *pdev) +static void ath11k_ahb_remove_prepare(struct ath11k_base *ab) { - struct ath11k_base *ab = platform_get_drvdata(pdev); unsigned long left; - if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { - ath11k_ahb_power_down(ab); - ath11k_debugfs_soc_destroy(ab); - ath11k_qmi_deinit_service(ab); - goto qmi_fail; - } - - reinit_completion(&ab->driver_recovery); - if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { left = wait_for_completion_timeout(&ab->driver_recovery, ATH11K_AHB_RECOVERY_TIMEOUT); @@ -1111,19 +1101,60 @@ set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); cancel_work_sync(&ab->restart_work); + cancel_work_sync(&ab->qmi.event_work); +} + +static void ath11k_ahb_free_resources(struct ath11k_base *ab) +{ + struct platform_device *pdev = ab->pdev; - ath11k_core_deinit(ab); -qmi_fail: ath11k_ahb_free_irq(ab); ath11k_hal_srng_deinit(ab); ath11k_ahb_fw_resource_deinit(ab); ath11k_ce_free_pipes(ab); ath11k_core_free(ab); platform_set_drvdata(pdev, NULL); +} + +static int ath11k_ahb_remove(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_ahb_power_down(ab); + ath11k_debugfs_soc_destroy(ab); + ath11k_qmi_deinit_service(ab); + goto qmi_fail; + } + + ath11k_ahb_remove_prepare(ab); + ath11k_core_deinit(ab); + +qmi_fail: + ath11k_ahb_free_resources(ab); return 0; } +static void ath11k_ahb_shutdown(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + /* platform shutdown() & remove() are mutually exclusive. + * remove() is invoked during rmmod & shutdown() during + * system reboot/shutdown. + */ + ath11k_ahb_remove_prepare(ab); + + if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) + goto free_resources; + + ath11k_core_deinit(ab); + +free_resources: + ath11k_ahb_free_resources(ab); +} + static struct platform_driver ath11k_ahb_driver = { .driver = { .name = "ath11k", @@ -1131,6 +1162,7 @@ }, .probe = ath11k_ahb_probe, .remove = ath11k_ahb_remove, + .shutdown = ath11k_ahb_shutdown, }; static int ath11k_ahb_init(void) diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/core.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/core.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1635,6 +1635,8 @@ wake_up(&ab->wmi_ab.tx_credits_wq); wake_up(&ab->peer_mapping_wq); + + reinit_completion(&ab->driver_recovery); } static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab) diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/dp_rx.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/dp_rx.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/dp_rx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/dp_rx.c 2022-11-29 07:06:46.000000000 +0000 @@ -5194,7 +5194,8 @@ if (log_type != ATH11K_PKTLOG_TYPE_INVALID) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); - memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info)); + memset(ppdu_info, 0, sizeof(*ppdu_info)); + ppdu_info->peer_id = HAL_INVALID_PEERID; hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) && diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mac.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mac.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -4949,6 +4949,8 @@ if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts = vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; value |= SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } @@ -4989,7 +4991,7 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) { bool subfer, subfee; - int sound_dim = 0; + int sound_dim = 0, nsts = 0; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -4999,6 +5001,11 @@ subfer = false; } + if (ar->num_rx_chains < 2) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee = false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -5011,7 +5018,9 @@ sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -5023,9 +5032,15 @@ *vht_cap |= sound_dim; } - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + /* Enable Beamformee STS Field only if SU BF is enabled */ + if (subfee) { + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; + + nsts <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mhi.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mhi.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mhi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/mhi.c 2022-11-29 07:06:46.000000000 +0000 @@ -402,8 +402,7 @@ ret = ath11k_mhi_get_msi(ab_pci); if (ret) { ath11k_err(ab, "failed to get msi for mhi\n"); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) @@ -412,7 +411,7 @@ if (test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { ret = ath11k_mhi_read_addr_from_dt(mhi_ctrl); if (ret < 0) - return ret; + goto free_controller; } else { mhi_ctrl->iova_start = 0; mhi_ctrl->iova_stop = 0xFFFFFFFF; @@ -440,18 +439,22 @@ default: ath11k_err(ab, "failed assign mhi_config for unknown hw rev %d\n", ab->hw_rev); - mhi_free_controller(mhi_ctrl); - return -EINVAL; + ret = -EINVAL; + goto free_controller; } ret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config); if (ret) { ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } return 0; + +free_controller: + mhi_free_controller(mhi_ctrl); + ab_pci->mhi_ctrl = NULL; + return ret; } void ath11k_mhi_unregister(struct ath11k_pci *ab_pci) diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/peer.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/peer.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/peer.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/peer.c 2022-11-29 07:06:46.000000000 +0000 @@ -302,6 +302,21 @@ spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find_by_addr(ab, addr); + /* Check if the found peer is what we want to remove. + * While the sta is transitioning to another band we may + * have 2 peer with the same addr assigned to different + * vdev_id. Make sure we are deleting the correct peer. + */ + if (peer && peer->vdev_id == vdev_id) + ath11k_peer_rhash_delete(ab, peer); + + /* Fallback to peer list search if the correct peer can't be found. + * Skip the deletion of the peer from the rhash since it has already + * been deleted in peer add. + */ + if (!peer) + peer = ath11k_peer_find(ab, vdev_id, addr); + if (!peer) { spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -312,8 +327,6 @@ return -EINVAL; } - ath11k_peer_rhash_delete(ab, peer); - spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -372,8 +385,17 @@ spin_lock_bh(&ar->ab->base_lock); peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); if (peer) { - spin_unlock_bh(&ar->ab->base_lock); - return -EINVAL; + if (peer->vdev_id == param->vdev_id) { + spin_unlock_bh(&ar->ab->base_lock); + return -EINVAL; + } + + /* Assume sta is transitioning to another band. + * Remove here the peer from rhash. + */ + mutex_lock(&ar->ab->tbl_mtx_lock); + ath11k_peer_rhash_delete(ar->ab, peer); + mutex_unlock(&ar->ab->tbl_mtx_lock); } spin_unlock_bh(&ar->ab->base_lock); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1696,6 +1696,13 @@ }, }; +static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { + { + .data_type = QMI_EOTI, + .array_type = NO_ARRAY, + }, +}; + static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) { struct qmi_wlanfw_host_cap_req_msg_v01 req; @@ -3006,6 +3013,10 @@ struct ath11k_base *ab = qmi->ab; ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware ready\n"); + + ab->qmi.cal_done = 1; + wake_up(&ab->qmi.cold_boot_waitq); + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_READY, NULL); } @@ -3018,11 +3029,22 @@ struct ath11k_qmi, handle); struct ath11k_base *ab = qmi->ab; - ab->qmi.cal_done = 1; - wake_up(&ab->qmi.cold_boot_waitq); ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n"); } +static void ath11k_qmi_msg_fw_init_done_cb(struct qmi_handle *qmi_hdl, + struct sockaddr_qrtr *sq, + struct qmi_txn *txn, + const void *decoded) +{ + struct ath11k_qmi *qmi = container_of(qmi_hdl, + struct ath11k_qmi, handle); + struct ath11k_base *ab = qmi->ab; + + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_INIT_DONE, NULL); + ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware init done\n"); +} + static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { { .type = QMI_INDICATION, @@ -3053,6 +3075,14 @@ sizeof(struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01), .fn = ath11k_qmi_msg_cold_boot_cal_done_cb, }, + { + .type = QMI_INDICATION, + .msg_id = QMI_WLFW_FW_INIT_DONE_IND_V01, + .ei = qmi_wlfw_fw_init_done_ind_msg_v01_ei, + .decoded_size = + sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01), + .fn = ath11k_qmi_msg_fw_init_done_cb, + }, }; static int ath11k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, @@ -3145,7 +3175,7 @@ } break; - case ATH11K_QMI_EVENT_FW_READY: + case ATH11K_QMI_EVENT_FW_INIT_DONE: clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) { ath11k_hal_dump_srng_stats(ab); @@ -3169,6 +3199,8 @@ } break; + case ATH11K_QMI_EVENT_FW_READY: + break; case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE: break; default: diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.h linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.h --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/qmi.h 2022-11-29 07:06:46.000000000 +0000 @@ -31,8 +31,9 @@ #define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035 #define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037 -#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x0021 -#define QMI_WLFW_FW_READY_IND_V01 0x0038 +#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x003E +#define QMI_WLFW_FW_READY_IND_V01 0x0021 +#define QMI_WLFW_FW_INIT_DONE_IND_V01 0x0038 #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 #define ATH11K_FIRMWARE_MODE_OFF 4 @@ -69,6 +70,7 @@ ATH11K_QMI_EVENT_FORCE_FW_ASSERT, ATH11K_QMI_EVENT_POWER_UP, ATH11K_QMI_EVENT_POWER_DOWN, + ATH11K_QMI_EVENT_FW_INIT_DONE, ATH11K_QMI_EVENT_MAX, }; @@ -291,6 +293,10 @@ char placeholder; }; +struct qmi_wlfw_fw_init_done_ind_msg_v01 { + char placeholder; +}; + #define QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN 0 #define QMI_WLANFW_CAP_RESP_MSG_V01_MAX_LEN 235 #define QMI_WLANFW_CAP_REQ_V01 0x0024 diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/reg.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/reg.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/reg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/reg.c 2022-11-29 07:06:46.000000000 +0000 @@ -287,11 +287,7 @@ goto err; } - rtnl_lock(); - wiphy_lock(ar->hw->wiphy); - ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy); - wiphy_unlock(ar->hw->wiphy); - rtnl_unlock(); + ret = regulatory_set_wiphy_regd(ar->hw->wiphy, regd_copy); kfree(regd_copy); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.c linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -9003,12 +9003,13 @@ cmd->interval = arg->interval; cmd->method = arg->method; + arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); + arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); + if (arg->method == WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE || arg->method == WMI_STA_KEEPALIVE_METHOD_GRATUITOUS_ARP_REQUEST) { - arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); - arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE) | - FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); arp->src_ip4_addr = arg->src_ip4_addr; arp->dest_ip4_addr = arg->dest_ip4_addr; ether_addr_copy(arp->dest_mac_addr.addr, arg->dest_mac_addr); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.h linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.h --- linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath11k/wmi.h 2022-11-29 07:06:46.000000000 +0000 @@ -1214,7 +1214,7 @@ WMI_TAG_NS_OFFLOAD_TUPLE, WMI_TAG_FTM_INTG_CMD, WMI_TAG_STA_KEEPALIVE_CMD, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE, WMI_TAG_P2P_SET_VENDOR_IE_DATA_CMD, WMI_TAG_AP_PS_PEER_CMD, WMI_TAG_PEER_RATE_RETRY_SCHED_CMD, diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/htc_hst.c linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/htc_hst.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/htc_hst.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/htc_hst.c 2022-11-29 07:06:46.000000000 +0000 @@ -364,33 +364,27 @@ } static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle, - struct sk_buff *skb) + struct sk_buff *skb, u32 len) { uint32_t *pattern = (uint32_t *)skb->data; - switch (*pattern) { - case 0x33221199: - { + if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) { struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n", htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); - break; - } - case 0x33221299: - { + return; + } + if (*pattern == 0x33221299) { struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "bad epid: 0x%08x\n", htc_panic->epid); - break; - } - default: - dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); - break; + return; } + dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); } /* @@ -411,16 +405,26 @@ if (!htc_handle || !skb) return; + /* A valid message requires len >= 8. + * + * sizeof(struct htc_frame_hdr) == 8 + * sizeof(struct htc_ready_msg) == 8 + * sizeof(struct htc_panic_bad_vaddr) == 16 + * sizeof(struct htc_panic_bad_epid) == 8 + */ + if (unlikely(len < sizeof(struct htc_frame_hdr))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id; if (epid == 0x99) { - ath9k_htc_fw_panic_report(htc_handle, skb); + ath9k_htc_fw_panic_report(htc_handle, skb, len); kfree_skb(skb); return; } if (epid < 0 || epid >= ENDPOINT_MAX) { +invalid: if (pipe_id != USB_REG_IN_PIPE) dev_kfree_skb_any(skb); else @@ -432,21 +436,30 @@ /* Handle trailer */ if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { - if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) + if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) { /* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); + len -= 4; + } } /* Get the message ID */ + if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr + sizeof(struct htc_frame_hdr)); /* Now process HTC messages */ switch (be16_to_cpu(*msg_id)) { case HTC_MSG_READY_ID: + if (unlikely(len < sizeof(struct htc_ready_msg))) + goto invalid; htc_process_target_rdy(htc_handle, htc_hdr); break; case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: + if (unlikely(len < sizeof(struct htc_frame_hdr) + + sizeof(struct htc_conn_svc_rspmsg))) + goto invalid; htc_process_conn_rsp(htc_handle, htc_hdr); break; default: diff -Nru linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/rng.c linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/rng.c --- linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/rng.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ath/ath9k/rng.c 2022-11-29 07:06:46.000000000 +0000 @@ -83,7 +83,8 @@ if (!wait || !max || likely(bytes_read) || fail_stats > 110) break; - msleep_interruptible(ath9k_rng_delay_get(++fail_stats)); + if (hwrng_msleep(rng, ath9k_rng_delay_get(++fail_stats))) + break; } if (wait && !bytes_read && max) diff -Nru linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c --- linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -296,6 +296,7 @@ struct brcmf_pub *drvr = ifp->drvr; struct ethhdr *eh; int head_delta; + unsigned int tx_bytes = skb->len; brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); @@ -370,7 +371,7 @@ ndev->stats.tx_dropped++; } else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; } /* Return ok: we always eat the packet */ diff -Nru linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c --- linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c 2022-11-29 07:06:46.000000000 +0000 @@ -158,12 +158,12 @@ struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -185,7 +185,7 @@ pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) diff -Nru linux-aws-5.19.0/drivers/net/wireless/intel/iwlegacy/4965-rs.c linux-aws-5.19.0/drivers/net/wireless/intel/iwlegacy/4965-rs.c --- linux-aws-5.19.0/drivers/net/wireless/intel/iwlegacy/4965-rs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/intel/iwlegacy/4965-rs.c 2022-11-29 07:06:46.000000000 +0000 @@ -2403,7 +2403,7 @@ /* Repeat initial/next rate. * For legacy IL_NUMBER_TRY == 1, this loop will not execute. * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ - while (repeat_rate > 0) { + while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; @@ -2422,8 +2422,6 @@ cpu_to_le32(new_rate); repeat_rate--; idx++; - if (idx >= LINK_QUAL_MAX_RETRY_NUM) - goto out; } il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, @@ -2468,7 +2466,6 @@ repeat_rate--; } -out: lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; diff -Nru linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/Kconfig linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/Kconfig --- linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -140,6 +140,7 @@ depends on INTEL_MEI depends on PM depends on CFG80211 + depends on BROKEN help Enables the iwlmei kernel module. diff -Nru linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c --- linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 2022-11-29 07:06:46.000000000 +0000 @@ -1833,8 +1833,8 @@ * If nss < MAX: we can set zeros in other streams */ if (nss > MAX_HE_SUPP_NSS) { - IWL_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, - MAX_HE_SUPP_NSS); + IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, + MAX_HE_SUPP_NSS); nss = MAX_HE_SUPP_NSS; } diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/mac.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -1138,7 +1138,7 @@ offset %= 32; val = mt76_rr(dev, addr); - val >>= (tid % 32); + val >>= offset; if (offset > 20) { addr += 4; diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7615/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1194,12 +1194,16 @@ struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv; + mt7615_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); mt7615_mcu_set_sta_decap_offload(dev, vif, sta); + + mt7615_mutex_release(dev); } #ifdef CONFIG_PM diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c 2022-11-29 07:06:46.000000000 +0000 @@ -258,8 +258,10 @@ ntlv = le16_to_cpu(ntlv_hdr->tlv_num); ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1); - if (sta_hdr) - le16_add_cpu(&sta_hdr->len, len); + if (sta_hdr) { + len += le16_to_cpu(sta_hdr->len); + sta_hdr->len = cpu_to_le16(len); + } return ptlv; } diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -23,9 +23,9 @@ { struct mt7915_dev *dev = data; - if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) - return -EBUSY; - + /* The existing connected stations shall reconnect to apply + * new implicit txbf configuration. + */ dev->ibf = !!val; return mt7915_mcu_set_txbf(dev, MT_BF_TYPE_UPDATE); diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mac.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -2536,8 +2536,9 @@ } flowid = ffs(~msta->twt.flowid_mask) - 1; - le16p_replace_bits(&twt_agrt->req_type, flowid, - IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type |= le16_encode_bits(flowid, + IEEE80211_TWT_REQTYPE_FLOWID); table_id = ffs(~dev->twt.table_mask) - 1; exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, req_type); @@ -2587,8 +2588,9 @@ unlock: mutex_unlock(&dev->mt76.mutex); out: - le16p_replace_bits(&twt_agrt->req_type, setup_cmd, - IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type |= + le16_encode_bits(setup_cmd, IEEE80211_TWT_REQTYPE_SETUP_CMD); twt->control = (twt->control & IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT) | (twt->control & IEEE80211_TWT_CONTROL_RX_DISABLED); } diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c 2022-11-29 07:06:46.000000000 +0000 @@ -1460,7 +1460,7 @@ struct sta_phy phy = {}; int ret, nrates = 0; -#define __sta_phy_bitrate_mask_check(_mcs, _gi, _he) \ +#define __sta_phy_bitrate_mask_check(_mcs, _gi, _ht, _he) \ do { \ u8 i, gi = mask->control[band]._gi; \ gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \ @@ -1473,15 +1473,17 @@ continue; \ nrates += hweight16(mask->control[band]._mcs[i]); \ phy.mcs = ffs(mask->control[band]._mcs[i]) - 1; \ + if (_ht) \ + phy.mcs += 8 * i; \ } \ } while (0) if (sta->deflink.he_cap.has_he) { - __sta_phy_bitrate_mask_check(he_mcs, he_gi, 1); + __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); } else if (sta->deflink.vht_cap.vht_supported) { - __sta_phy_bitrate_mask_check(vht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); } else if (sta->deflink.ht_cap.ht_supported) { - __sta_phy_bitrate_mask_check(ht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); } else { nrates = hweight32(mask->control[band].legacy); phy.mcs = ffs(mask->control[band].legacy) - 1; diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mac.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -1215,6 +1215,7 @@ void mt7921_reset(struct mt76_dev *mdev) { struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); + struct mt76_connac_pm *pm = &dev->pm; if (!dev->hw_init_done) return; @@ -1222,8 +1223,12 @@ if (dev->hw_full_reset) return; + if (pm->suspended) + return; + queue_work(dev->mt76.wq, &dev->reset_work); } +EXPORT_SYMBOL_GPL(mt7921_reset); void mt7921_mac_update_mib_stats(struct mt7921_phy *phy) { diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -738,6 +738,7 @@ mt7921_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); @@ -1390,6 +1391,8 @@ struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; struct mt7921_dev *dev = mt7921_hw_dev(hw); + mt7921_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else @@ -1397,6 +1400,8 @@ mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, MCU_UNI_CMD(STA_REC_UPDATE)); + + mt7921_mutex_release(dev); } #if IS_ENABLED(CONFIG_IPV6) @@ -1499,17 +1504,23 @@ struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, true); if (err) - return err; + goto out; err = mt7921_mcu_set_bss_pm(dev, vif, true); if (err) - return err; + goto out; - return mt7921_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_NONE); + err = mt7921_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_NONE); +out: + mt7921_mutex_release(dev); + + return err; } static void @@ -1520,11 +1531,16 @@ struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt7921_mcu_set_bss_pm(dev, vif, false); if (err) - return; + goto out; mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false); + +out: + mt7921_mutex_release(dev); } const struct ieee80211_ops mt7921_ops = { diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -289,6 +289,8 @@ goto err_free_pci_vec; } + pci_set_drvdata(pdev, mdev); + dev = container_of(mdev, struct mt7921_dev, mt76); dev->hif_ops = &mt7921_pcie_ops; @@ -368,6 +370,7 @@ int i, err; pm->suspended = true; + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -433,6 +436,9 @@ restore_suspend: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -451,7 +457,7 @@ err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt7921_wpdma_reinit_cond(dev); @@ -481,11 +487,12 @@ mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } #endif /* CONFIG_PM */ diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c 2022-11-29 07:06:46.000000000 +0000 @@ -345,7 +345,7 @@ err = mt7921e_driver_own(dev); if (err) - return err; + goto out; err = mt7921_run_firmware(dev); if (err) diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -206,6 +206,7 @@ pm->suspended = true; set_bit(MT76_STATE_SUSPEND, &mdev->phy.state); + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -261,6 +262,9 @@ clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state); pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -276,7 +280,7 @@ err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt76_worker_enable(&mdev->tx_worker); mt76_worker_enable(&mdev->sdio.txrx_worker); @@ -288,11 +292,12 @@ mt76_connac_mcu_set_deep_sleep(mdev, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/usb.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/usb.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/usb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/usb.c 2022-11-29 07:06:46.000000000 +0000 @@ -292,11 +292,15 @@ static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; int err; + pm->suspended = true; + flush_work(&dev->reset_work); + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); if (err) - return err; + goto failed; mt76u_stop_rx(&dev->mt76); mt76u_stop_tx(&dev->mt76); @@ -304,11 +308,20 @@ set_bit(MT76_STATE_SUSPEND, &dev->mphy.state); return 0; + +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); + + return err; } static int mt7921u_resume(struct usb_interface *intf) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; bool reinit = true; int err, i; @@ -330,16 +343,23 @@ if (reinit || mt7921_dma_need_reinit(dev)) { err = mt7921u_dma_init(dev, true); if (err) - return err; + goto failed; } clear_bit(MT76_STATE_SUSPEND, &dev->mphy.state); err = mt76u_resume_rx(&dev->mt76); if (err < 0) - return err; + goto failed; + + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); - return mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); + return err; } #endif /* CONFIG_PM */ diff -Nru linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/sdio.c linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/sdio.c --- linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/sdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/mediatek/mt76/sdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -480,14 +480,14 @@ if (ndata_frames > 0) resched = true; - if (dev->drv->tx_status_data && + if (dev->drv->tx_status_data && ndata_frames > 0 && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) - queue_work(dev->wq, &dev->sdio.stat_work); + ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); } while (nframes > 0); if (resched) - mt76_worker_schedule(&dev->sdio.txrx_worker); + mt76_worker_schedule(&dev->tx_worker); } static void mt76s_tx_status_data(struct work_struct *work) @@ -510,7 +510,7 @@ } if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state)) - queue_work(dev->wq, &sdio->stat_work); + ieee80211_queue_work(dev->hw, &sdio->stat_work); else clear_bit(MT76_READING_STATS, &dev->phy.state); } diff -Nru linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/netdev.h linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/netdev.h --- linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/netdev.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/netdev.h 2022-11-29 07:06:46.000000000 +0000 @@ -254,6 +254,7 @@ u8 *rx_buffer; u32 rx_buffer_offset; u8 *tx_buffer; + u32 *vmm_table; struct txq_handle txq[NQUEUES]; int txq_entries; diff -Nru linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/sdio.c linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/sdio.c --- linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/sdio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/sdio.c 2022-11-29 07:06:46.000000000 +0000 @@ -27,6 +27,7 @@ bool irq_gpio; u32 block_size; int has_thrpt_enh3; + u8 *cmd53_buf; }; struct sdio_cmd52 { @@ -46,6 +47,7 @@ u32 count: 9; u8 *buffer; u32 block_size; + bool use_global_buf; }; static const struct wilc_hif_func wilc_hif_sdio; @@ -90,6 +92,8 @@ { struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); int size, ret; + struct wilc_sdio *sdio_priv = wilc->bus_data; + u8 *buf = cmd->buffer; sdio_claim_host(func); @@ -100,12 +104,23 @@ else size = cmd->count; + if (cmd->use_global_buf) { + if (size > sizeof(u32)) + return -EINVAL; + + buf = sdio_priv->cmd53_buf; + } + if (cmd->read_write) { /* write */ - ret = sdio_memcpy_toio(func, cmd->address, - (void *)cmd->buffer, size); + if (cmd->use_global_buf) + memcpy(buf, cmd->buffer, size); + + ret = sdio_memcpy_toio(func, cmd->address, buf, size); } else { /* read */ - ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, - cmd->address, size); + ret = sdio_memcpy_fromio(func, buf, cmd->address, size); + + if (cmd->use_global_buf) + memcpy(cmd->buffer, buf, size); } sdio_release_host(func); @@ -127,6 +142,12 @@ if (!sdio_priv) return -ENOMEM; + sdio_priv->cmd53_buf = kzalloc(sizeof(u32), GFP_KERNEL); + if (!sdio_priv->cmd53_buf) { + ret = -ENOMEM; + goto free; + } + ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO, &wilc_hif_sdio); if (ret) @@ -160,6 +181,7 @@ irq_dispose_mapping(wilc->dev_irq_num); wilc_netdev_cleanup(wilc); free: + kfree(sdio_priv->cmd53_buf); kfree(sdio_priv); return ret; } @@ -171,6 +193,7 @@ clk_disable_unprepare(wilc->rtc_clk); wilc_netdev_cleanup(wilc); + kfree(sdio_priv->cmd53_buf); kfree(sdio_priv); } @@ -367,8 +390,9 @@ cmd.address = WILC_SDIO_FBR_DATA_REG; cmd.block_mode = 0; cmd.increment = 1; - cmd.count = 4; + cmd.count = sizeof(u32); cmd.buffer = (u8 *)&data; + cmd.use_global_buf = true; cmd.block_size = sdio_priv->block_size; ret = wilc_sdio_cmd53(wilc, &cmd); if (ret) @@ -406,6 +430,7 @@ nblk = size / block_size; nleft = size % block_size; + cmd.use_global_buf = false; if (nblk > 0) { cmd.block_mode = 1; cmd.increment = 1; @@ -484,8 +509,9 @@ cmd.address = WILC_SDIO_FBR_DATA_REG; cmd.block_mode = 0; cmd.increment = 1; - cmd.count = 4; + cmd.count = sizeof(u32); cmd.buffer = (u8 *)data; + cmd.use_global_buf = true; cmd.block_size = sdio_priv->block_size; ret = wilc_sdio_cmd53(wilc, &cmd); @@ -527,6 +553,7 @@ nblk = size / block_size; nleft = size % block_size; + cmd.use_global_buf = false; if (nblk > 0) { cmd.block_mode = 1; cmd.increment = 1; diff -Nru linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/wlan.c linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/wlan.c --- linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/wlan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/microchip/wilc1000/wlan.c 2022-11-29 07:06:46.000000000 +0000 @@ -714,7 +714,7 @@ int ret = 0; int counter; int timeout; - u32 vmm_table[WILC_VMM_TBL_SIZE]; + u32 *vmm_table = wilc->vmm_table; u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; const struct wilc_hif_func *func; int srcu_idx; @@ -1251,6 +1251,8 @@ while ((rqe = wilc_wlan_rxq_remove(wilc))) kfree(rqe); + kfree(wilc->vmm_table); + wilc->vmm_table = NULL; kfree(wilc->rx_buffer); wilc->rx_buffer = NULL; kfree(wilc->tx_buffer); @@ -1485,6 +1487,14 @@ goto fail; } + if (!wilc->vmm_table) + wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL); + + if (!wilc->vmm_table) { + ret = -ENOBUFS; + goto fail; + } + if (!wilc->tx_buffer) wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL); @@ -1509,7 +1519,8 @@ return 0; fail: - + kfree(wilc->vmm_table); + wilc->vmm_table = NULL; kfree(wilc->rx_buffer); wilc->rx_buffer = NULL; kfree(wilc->tx_buffer); diff -Nru linux-aws-5.19.0/drivers/net/wireless/ralink/rt2x00/rt2800lib.c linux-aws-5.19.0/drivers/net/wireless/ralink/rt2x00/rt2800lib.c --- linux-aws-5.19.0/drivers/net/wireless/ralink/rt2x00/rt2800lib.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/ralink/rt2x00/rt2800lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -4164,7 +4164,10 @@ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); + if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); } if (rf->channel <= 14) { @@ -4365,7 +4368,8 @@ reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - rt2800_iq_calibrate(rt2x00dev, rf->channel); + if (rt2x00_rt(rt2x00dev, RT5592)) + rt2800_iq_calibrate(rt2x00dev, rf->channel); } bbp = rt2800_bbp_read(rt2x00dev, 4); @@ -5644,7 +5648,8 @@ if (qual->vgc_level != vgc_level) { if (rt2x00_rt(rt2x00dev, RT3572) || rt2x00_rt(rt2x00dev, RT3593) || - rt2x00_rt(rt2x00dev, RT3883)) { + rt2x00_rt(rt2x00dev, RT3883) || + rt2x00_rt(rt2x00dev, RT6352)) { rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); } else if (rt2x00_rt(rt2x00dev, RT5592)) { @@ -5867,7 +5872,7 @@ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); @@ -6129,6 +6134,27 @@ reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1878,13 +1878,6 @@ /* We have 8 bits to indicate validity */ map_addr = offset * 8; - if (map_addr >= EFUSE_MAP_LEN) { - dev_warn(dev, "%s: Illegal map_addr (%04x), " - "efuse corrupt!\n", - __func__, map_addr); - ret = -EINVAL; - goto exit; - } for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { /* Check word enable condition in the section */ if (word_mask & BIT(i)) { @@ -1895,6 +1888,13 @@ ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); if (ret) goto exit; + if (map_addr >= EFUSE_MAP_LEN - 1) { + dev_warn(dev, "%s: Illegal map_addr (%04x), " + "efuse corrupt!\n", + __func__, map_addr); + ret = -EINVAL; + goto exit; + } priv->efuse_wifi.raw[map_addr++] = val8; ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); @@ -2929,12 +2929,12 @@ } if (!(simubitmap & 0x30) && priv->tx_paths > 1) { - /* path B RX OK */ + /* path B TX OK */ for (i = 4; i < 6; i++) result[3][i] = result[c1][i]; } - if (!(simubitmap & 0x30) && priv->tx_paths > 1) { + if (!(simubitmap & 0xc0) && priv->tx_paths > 1) { /* path B RX OK */ for (i = 6; i < 8; i++) result[3][i] = result[c1][i]; @@ -4320,7 +4320,7 @@ } void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; @@ -4340,10 +4340,15 @@ } void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; - u8 bw = RTL8XXXU_CHANNEL_WIDTH_20; + u8 bw; + + if (txbw_40mhz) + bw = RTL8XXXU_CHANNEL_WIDTH_40; + else + bw = RTL8XXXU_CHANNEL_WIDTH_20; memset(&h2c, 0, sizeof(struct h2c_cmd)); @@ -4353,15 +4358,14 @@ h2c.b_macid_cfg.ramask2 = (ramask >> 16) & 0xff; h2c.b_macid_cfg.ramask3 = (ramask >> 24) & 0xff; - h2c.ramask.arg = 0x80; h2c.b_macid_cfg.data1 = rateid; if (sgi) h2c.b_macid_cfg.data1 |= BIT(7); h2c.b_macid_cfg.data2 = bw; - dev_dbg(&priv->udev->dev, "%s: rate mask %08x, arg %02x, size %zi\n", - __func__, ramask, h2c.ramask.arg, sizeof(h2c.b_macid_cfg)); + dev_dbg(&priv->udev->dev, "%s: rate mask %08x, rateid %02x, sgi %d, size %zi\n", + __func__, ramask, rateid, sgi, sizeof(h2c.b_macid_cfg)); rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.b_macid_cfg)); } @@ -4556,6 +4560,53 @@ return network_type; } +static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time) +{ + u32 reg_edca_param[IEEE80211_NUM_ACS] = { + [IEEE80211_AC_VO] = REG_EDCA_VO_PARAM, + [IEEE80211_AC_VI] = REG_EDCA_VI_PARAM, + [IEEE80211_AC_BE] = REG_EDCA_BE_PARAM, + [IEEE80211_AC_BK] = REG_EDCA_BK_PARAM, + }; + u32 val32; + u16 wireless_mode = 0; + u8 aifs, aifsn, sifs; + int i; + + if (priv->vif) { + struct ieee80211_sta *sta; + + rcu_read_lock(); + sta = ieee80211_find_sta(priv->vif, priv->vif->bss_conf.bssid); + if (sta) + wireless_mode = rtl8xxxu_wireless_mode(priv->hw, sta); + rcu_read_unlock(); + } + + if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ || + (wireless_mode & WIRELESS_MODE_N_24G)) + sifs = 16; + else + sifs = 10; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + val32 = rtl8xxxu_read32(priv, reg_edca_param[i]); + + /* It was set in conf_tx. */ + aifsn = val32 & 0xff; + + /* aifsn not set yet or already fixed */ + if (aifsn < 2 || aifsn > 15) + continue; + + aifs = aifsn * slot_time + sifs; + + val32 &= ~0xff; + val32 |= aifs; + rtl8xxxu_write32(priv, reg_edca_param[i], val32); + } +} + static void rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u32 changed) @@ -4622,7 +4673,11 @@ RATE_INFO_FLAGS_SHORT_GI; } - rarpt->txrate.bw |= RATE_INFO_BW_20; + if (rtl8xxxu_ht40_2g && + (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)) + rarpt->txrate.bw = RATE_INFO_BW_40; + else + rarpt->txrate.bw = RATE_INFO_BW_20; } bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); rarpt->bit_rate = bit_rate; @@ -4631,7 +4686,7 @@ priv->vif = vif; priv->rssi_level = RTL8XXXU_RATR_STA_INIT; - priv->fops->update_rate_mask(priv, ramask, 0, sgi); + priv->fops->update_rate_mask(priv, ramask, 0, sgi, rarpt->txrate.bw == RATE_INFO_BW_40); rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff); @@ -4671,6 +4726,8 @@ else val8 = 20; rtl8xxxu_write8(priv, REG_SLOT, val8); + + rtl8xxxu_set_aifs(priv, val8); } if (changed & BSS_CHANGED_BSSID) { @@ -5062,6 +5119,8 @@ if (control && control->sta) sta = control->sta; + queue = rtl8xxxu_queue_select(hw, skb); + tx_desc = skb_push(skb, tx_desc_size); memset(tx_desc, 0, tx_desc_size); @@ -5074,7 +5133,6 @@ is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue = rtl8xxxu_queue_select(hw, skb); tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); if (tx_info->control.hw_key) { @@ -6343,7 +6401,7 @@ } priv->rssi_level = rssi_level; - priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi); + priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz); } } diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h 2022-11-29 07:06:46.000000000 +0000 @@ -1425,7 +1425,7 @@ void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel, bool ht40); void (*update_rate_mask) (struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void (*report_connect) (struct rtl8xxxu_priv *priv, u8 macid, bool connect); void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, @@ -1511,9 +1511,9 @@ void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, u8 macid, bool connect); void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c 2022-11-29 07:06:46.000000000 +0000 @@ -2386,11 +2386,10 @@ rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, "Just Read IQK Matrix reg for channel:%d....\n", channel); - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][2] == 0)); + if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0) + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + rtlphy->iqk_matrix[indexforchannel].value, 0, + rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0); if (IS_92D_SINGLEPHY(rtlhal->version)) { if ((rtlphy->iqk_matrix[ indexforchannel].value[0][4] != 0) diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtw88/main.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtw88/main.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtw88/main.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtw88/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -2037,7 +2037,7 @@ ret = rtw_load_firmware(rtwdev, RTW_NORMAL_FW); if (ret) { rtw_warn(rtwdev, "no firmware loaded\n"); - return ret; + goto out; } if (chip->wow_fw_name) { @@ -2047,11 +2047,15 @@ wait_for_completion(&rtwdev->fw.completion); if (rtwdev->fw.firmware) release_firmware(rtwdev->fw.firmware); - return ret; + goto out; } } return 0; + +out: + destroy_workqueue(rtwdev->tx_wq); + return ret; } EXPORT_SYMBOL(rtw_core_init); diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/core.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/core.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -860,6 +860,7 @@ rtw89_debug(rtwdev, RTW89_DBG_FW, "ignore h2c due to power is off with firmware state=%d\n", test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags)); + dev_kfree_skb(skb); return 0; } diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/fw.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/fw.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/fw.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/fw.c 2022-11-29 07:06:46.000000000 +0000 @@ -2288,6 +2288,7 @@ { struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; struct cfg80211_scan_request *req = &scan_req->req; + u32 rx_fltr = rtwdev->hal.rx_fltr; u8 mac_addr[ETH_ALEN]; rtwdev->scan_info.scanning_vif = vif; @@ -2302,13 +2303,13 @@ ether_addr_copy(mac_addr, vif->addr); rtw89_core_scan_start(rtwdev, rtwvif, mac_addr, true); - rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr &= ~B_AX_A_BC; - rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH; + rx_fltr &= ~B_AX_A_BCN_CHK_EN; + rx_fltr &= ~B_AX_A_BC; + rx_fltr &= ~B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, - rtwdev->hal.rx_fltr); + rx_fltr); } void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, @@ -2322,9 +2323,6 @@ if (!vif) return; - rtwdev->hal.rx_fltr |= B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr |= B_AX_A_BC; - rtwdev->hal.rx_fltr |= B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/pci.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/pci.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -756,7 +756,8 @@ enable_intr: spin_lock_irqsave(&rtwpci->irq_lock, flags); - rtw89_chip_enable_intr(rtwdev, rtwpci); + if (likely(rtwpci->running)) + rtw89_chip_enable_intr(rtwdev, rtwpci); spin_unlock_irqrestore(&rtwpci->irq_lock, flags); return IRQ_HANDLED; } @@ -921,10 +922,12 @@ { struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch]; + struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; u32 cnt; spin_lock_bh(&rtwpci->trx_lock); cnt = rtw89_pci_get_avail_txbd_num(tx_ring); + cnt = min(cnt, wd_ring->curr_num); spin_unlock_bh(&rtwpci->trx_lock); return cnt; diff -Nru linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/ser.c linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/ser.c --- linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/ser.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/realtek/rtw89/ser.c 2022-11-29 07:06:46.000000000 +0000 @@ -152,7 +152,10 @@ rtw89_debug(rtwdev, RTW89_DBG_SER, "ser: %s receive %s\n", ser_st_name(ser), ser_ev_name(ser, evt)); + mutex_lock(&rtwdev->mutex); rtw89_leave_lps(rtwdev); + mutex_unlock(&rtwdev->mutex); + ser->st_tbl[ser->state].st_func(ser, evt); } diff -Nru linux-aws-5.19.0/drivers/net/wireless/silabs/wfx/main.c linux-aws-5.19.0/drivers/net/wireless/silabs/wfx/main.c --- linux-aws-5.19.0/drivers/net/wireless/silabs/wfx/main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/silabs/wfx/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -181,7 +181,7 @@ while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2); - if (chunk_len > len) { + if (chunk_len < 4 || chunk_len > len) { dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/net/wireless/st/cw1200/queue.c linux-aws-5.19.0/drivers/net/wireless/st/cw1200/queue.c --- linux-aws-5.19.0/drivers/net/wireless/st/cw1200/queue.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wireless/st/cw1200/queue.c 2022-11-29 07:06:46.000000000 +0000 @@ -91,23 +91,25 @@ bool unlock) { struct cw1200_queue_stats *stats = queue->stats; - struct cw1200_queue_item *item = NULL, *tmp; + struct cw1200_queue_item *item = NULL, *iter, *tmp; bool wakeup_stats = false; - list_for_each_entry_safe(item, tmp, &queue->queue, head) { - if (time_is_after_jiffies(item->queue_timestamp + queue->ttl)) + list_for_each_entry_safe(iter, tmp, &queue->queue, head) { + if (time_is_after_jiffies(iter->queue_timestamp + queue->ttl)) { + item = iter; break; + } --queue->num_queued; - --queue->link_map_cache[item->txpriv.link_id]; + --queue->link_map_cache[iter->txpriv.link_id]; spin_lock_bh(&stats->lock); --stats->num_queued; - if (!--stats->link_map_cache[item->txpriv.link_id]) + if (!--stats->link_map_cache[iter->txpriv.link_id]) wakeup_stats = true; spin_unlock_bh(&stats->lock); cw1200_debug_tx_ttl(stats->priv); - cw1200_queue_register_post_gc(head, item); - item->skb = NULL; - list_move_tail(&item->head, &queue->free_pool); + cw1200_queue_register_post_gc(head, iter); + iter->skb = NULL; + list_move_tail(&iter->head, &queue->free_pool); } if (wakeup_stats) diff -Nru linux-aws-5.19.0/drivers/net/wwan/iosm/iosm_ipc_wwan.c linux-aws-5.19.0/drivers/net/wwan/iosm/iosm_ipc_wwan.c --- linux-aws-5.19.0/drivers/net/wwan/iosm/iosm_ipc_wwan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/iosm/iosm_ipc_wwan.c 2022-11-29 07:06:46.000000000 +0000 @@ -323,15 +323,16 @@ ipc_wwan->dev = dev; ipc_wwan->ipc_imem = ipc_imem; + mutex_init(&ipc_wwan->if_mutex); + /* WWAN core will create a netdev for the default IP MUX channel */ if (wwan_register_ops(ipc_wwan->dev, &iosm_wwan_ops, ipc_wwan, IP_MUX_SESSION_DEFAULT)) { + mutex_destroy(&ipc_wwan->if_mutex); kfree(ipc_wwan); return NULL; } - mutex_init(&ipc_wwan->if_mutex); - return ipc_wwan; } diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.c linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.c --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.c 2022-11-29 07:06:46.000000000 +0000 @@ -1064,13 +1064,18 @@ struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info; u32 phy_ao_base, phy_pd_base; - if (md_ctrl->hif_id != CLDMA_ID_MD) - return; - - phy_ao_base = CLDMA1_AO_BASE; - phy_pd_base = CLDMA1_PD_BASE; - hw_info->phy_interrupt_id = CLDMA1_INT; hw_info->hw_mode = MODE_BIT_64; + + if (md_ctrl->hif_id == CLDMA_ID_MD) { + phy_ao_base = CLDMA1_AO_BASE; + phy_pd_base = CLDMA1_PD_BASE; + hw_info->phy_interrupt_id = CLDMA1_INT; + } else { + phy_ao_base = CLDMA0_AO_BASE; + phy_pd_base = CLDMA0_PD_BASE; + hw_info->phy_interrupt_id = CLDMA0_INT; + } + hw_info->ap_ao_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base, pbase->pcie_dev_reg_trsl_addr, phy_ao_base); hw_info->ap_pdn_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base, diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_hif_cldma.h 2022-11-29 07:06:46.000000000 +0000 @@ -34,7 +34,7 @@ /** * enum cldma_id - Identifiers for CLDMA HW units. * @CLDMA_ID_MD: Modem control channel. - * @CLDMA_ID_AP: Application Processor control channel (not used at the moment). + * @CLDMA_ID_AP: Application Processor control channel. * @CLDMA_NUM: Number of CLDMA HW units available. */ enum cldma_id { diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_mhccif.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_mhccif.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_mhccif.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_mhccif.h 2022-11-29 07:06:46.000000000 +0000 @@ -25,6 +25,7 @@ D2H_INT_EXCEPTION_CLEARQ_DONE | \ D2H_INT_EXCEPTION_ALLQ_RESET | \ D2H_INT_PORT_ENUM | \ + D2H_INT_ASYNC_AP_HK | \ D2H_INT_ASYNC_MD_HK) void t7xx_mhccif_mask_set(struct t7xx_pci_dev *t7xx_dev, u32 val); diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.c linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.c --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.c 2022-11-29 07:06:46.000000000 +0000 @@ -44,6 +44,7 @@ #include "t7xx_state_monitor.h" #define RT_ID_MD_PORT_ENUM 0 +#define RT_ID_AP_PORT_ENUM 1 /* Modem feature query identification code - "ICCC" */ #define MD_FEATURE_QUERY_ID 0x49434343 @@ -296,6 +297,7 @@ } t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage); + t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_AP], stage); if (stage == HIF_EX_INIT) t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_ACK); @@ -424,7 +426,7 @@ if (ft_spt_st != MTK_FEATURE_MUST_BE_SUPPORTED) return -EINVAL; - if (i == RT_ID_MD_PORT_ENUM) + if (i == RT_ID_MD_PORT_ENUM || i == RT_ID_AP_PORT_ENUM) t7xx_port_enum_msg_handler(ctl->md, rt_feature->data); } @@ -454,12 +456,12 @@ return 0; } -static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl, +static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info, + struct t7xx_fsm_ctl *ctl, enum t7xx_fsm_event_state event_id, enum t7xx_fsm_event_state err_detect) { struct t7xx_fsm_event *event = NULL, *event_next; - struct t7xx_sys_info *core_info = &md->core_md; struct device *dev = &md->t7xx_dev->pdev->dev; unsigned long flags; int ret; @@ -529,19 +531,33 @@ t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]); t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS2); md->core_md.handshake_ongoing = true; - t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); + t7xx_core_hk_handler(md, &md->core_md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); +} + +static void t7xx_ap_hk_wq(struct work_struct *work) +{ + struct t7xx_modem *md = container_of(work, struct t7xx_modem, ap_handshake_work); + struct t7xx_fsm_ctl *ctl = md->fsm_ctl; + + /* Clear the HS2 EXIT event appended in t7xx_core_reset(). */ + t7xx_fsm_clr_event(ctl, FSM_EVENT_AP_HS2_EXIT); + t7xx_cldma_stop(md->md_ctrl[CLDMA_ID_AP]); + t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_AP]); + t7xx_cldma_start(md->md_ctrl[CLDMA_ID_AP]); + md->core_ap.handshake_ongoing = true; + t7xx_core_hk_handler(md, &md->core_ap, ctl, FSM_EVENT_AP_HS2, FSM_EVENT_AP_HS2_EXIT); } void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) { struct t7xx_fsm_ctl *ctl = md->fsm_ctl; - void __iomem *mhccif_base; unsigned int int_sta; unsigned long flags; switch (evt_id) { case FSM_PRE_START: - t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM); + t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM | D2H_INT_ASYNC_MD_HK | + D2H_INT_ASYNC_AP_HK); break; case FSM_START: @@ -554,16 +570,26 @@ ctl->exp_flg = true; md->exp_id &= ~D2H_INT_EXCEPTION_INIT; md->exp_id &= ~D2H_INT_ASYNC_MD_HK; + md->exp_id &= ~D2H_INT_ASYNC_AP_HK; } else if (ctl->exp_flg) { md->exp_id &= ~D2H_INT_ASYNC_MD_HK; - } else if (md->exp_id & D2H_INT_ASYNC_MD_HK) { - queue_work(md->handshake_wq, &md->handshake_work); - md->exp_id &= ~D2H_INT_ASYNC_MD_HK; - mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; - iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); - t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); + md->exp_id &= ~D2H_INT_ASYNC_AP_HK; } else { - t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); + void __iomem *mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; + + if (md->exp_id & D2H_INT_ASYNC_MD_HK) { + queue_work(md->handshake_wq, &md->handshake_work); + md->exp_id &= ~D2H_INT_ASYNC_MD_HK; + iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); + t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); + } + + if (md->exp_id & D2H_INT_ASYNC_AP_HK) { + queue_work(md->ap_handshake_wq, &md->ap_handshake_work); + md->exp_id &= ~D2H_INT_ASYNC_AP_HK; + iowrite32(D2H_INT_ASYNC_AP_HK, mhccif_base + REG_EP2RC_SW_INT_ACK); + t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); + } } spin_unlock_irqrestore(&md->exp_lock, flags); @@ -576,6 +602,7 @@ case FSM_READY: t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); + t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); break; default: @@ -627,6 +654,19 @@ md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK; md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |= FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED); + + md->ap_handshake_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI, + 0, "ap_hk_wq"); + if (!md->ap_handshake_wq) { + destroy_workqueue(md->handshake_wq); + return NULL; + } + + INIT_WORK(&md->ap_handshake_work, t7xx_ap_hk_wq); + md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] &= ~FEATURE_MSK; + md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] |= + FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED); + return md; } @@ -638,6 +678,7 @@ md->exp_id = 0; t7xx_fsm_reset(md); t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]); + t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_AP]); t7xx_port_proxy_reset(md->port_prox); md->md_init_finish = true; return t7xx_core_reset(md); @@ -667,6 +708,10 @@ if (ret) goto err_destroy_hswq; + ret = t7xx_cldma_alloc(CLDMA_ID_AP, t7xx_dev); + if (ret) + goto err_destroy_hswq; + ret = t7xx_fsm_init(md); if (ret) goto err_destroy_hswq; @@ -679,12 +724,16 @@ if (ret) goto err_uninit_ccmni; - ret = t7xx_port_proxy_init(md); + ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_AP]); if (ret) goto err_uninit_md_cldma; + ret = t7xx_port_proxy_init(md); + if (ret) + goto err_uninit_ap_cldma; + ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0); - if (ret) /* fsm_uninit flushes cmd queue */ + if (ret) /* t7xx_fsm_uninit() flushes cmd queue */ goto err_uninit_proxy; t7xx_md_sys_sw_init(t7xx_dev); @@ -694,6 +743,9 @@ err_uninit_proxy: t7xx_port_proxy_uninit(md->port_prox); +err_uninit_ap_cldma: + t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); + err_uninit_md_cldma: t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); @@ -705,6 +757,7 @@ err_destroy_hswq: destroy_workqueue(md->handshake_wq); + destroy_workqueue(md->ap_handshake_wq); dev_err(&t7xx_dev->pdev->dev, "Modem init failed\n"); return ret; } @@ -720,8 +773,10 @@ t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION); t7xx_port_proxy_uninit(md->port_prox); + t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); t7xx_ccmni_exit(t7xx_dev); t7xx_fsm_uninit(md); destroy_workqueue(md->handshake_wq); + destroy_workqueue(md->ap_handshake_wq); } diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_modem_ops.h 2022-11-29 07:06:46.000000000 +0000 @@ -66,10 +66,13 @@ struct cldma_ctrl *md_ctrl[CLDMA_NUM]; struct t7xx_pci_dev *t7xx_dev; struct t7xx_sys_info core_md; + struct t7xx_sys_info core_ap; bool md_init_finish; bool rgu_irq_asserted; struct workqueue_struct *handshake_wq; struct work_struct handshake_work; + struct workqueue_struct *ap_handshake_wq; + struct work_struct ap_handshake_work; struct t7xx_fsm_ctl *fsm_ctl; struct port_proxy *port_prox; unsigned int exp_id; diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c 2022-11-29 07:06:46.000000000 +0000 @@ -167,8 +167,12 @@ case CTL_ID_HS2_MSG: skb_pull(skb, sizeof(*ctrl_msg_h)); - if (port_conf->rx_ch == PORT_CH_CONTROL_RX) { - ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2, skb->data, + if (port_conf->rx_ch == PORT_CH_CONTROL_RX || + port_conf->rx_ch == PORT_CH_AP_CONTROL_RX) { + int event = port_conf->rx_ch == PORT_CH_CONTROL_RX ? + FSM_EVENT_MD_HS2 : FSM_EVENT_AP_HS2; + + ret = t7xx_fsm_append_event(ctl, event, skb->data, le32_to_cpu(ctrl_msg_h->data_length)); if (ret) dev_err(port->dev, "Failed to append Handshake 2 event"); diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port.h 2022-11-29 07:06:46.000000000 +0000 @@ -36,9 +36,15 @@ /* Channel ID and Message ID definitions. * The channel number consists of peer_id(15:12) , channel_id(11:0) * peer_id: - * 0:reserved, 1: to sAP, 2: to MD + * 0:reserved, 1: to AP, 2: to MD */ enum port_ch { + /* to AP */ + PORT_CH_AP_CONTROL_RX = 0x1000, + PORT_CH_AP_CONTROL_TX = 0x1001, + PORT_CH_AP_LOG_RX = 0x1008, + PORT_CH_AP_LOG_TX = 0x1009, + /* to MD */ PORT_CH_CONTROL_RX = 0x2000, PORT_CH_CONTROL_TX = 0x2001, diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_proxy.c linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_proxy.c --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_proxy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_port_proxy.c 2022-11-29 07:06:46.000000000 +0000 @@ -77,6 +77,14 @@ .path_id = CLDMA_ID_MD, .ops = &ctl_port_ops, .name = "t7xx_ctrl", + }, { + .tx_ch = PORT_CH_AP_CONTROL_TX, + .rx_ch = PORT_CH_AP_CONTROL_RX, + .txq_index = Q_IDX_CTRL, + .rxq_index = Q_IDX_CTRL, + .path_id = CLDMA_ID_AP, + .ops = &ctl_port_ops, + .name = "t7xx_ap_ctrl", }, }; @@ -416,6 +424,9 @@ if (port_conf->tx_ch == PORT_CH_CONTROL_TX) md->core_md.ctl_port = port; + if (port_conf->tx_ch == PORT_CH_AP_CONTROL_TX) + md->core_ap.ctl_port = port; + port->t7xx_dev = md->t7xx_dev; port->dev = &md->t7xx_dev->pdev->dev; spin_lock_init(&port->port_update_lock); @@ -469,6 +480,7 @@ if (ret) return ret; + t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_AP], t7xx_port_proxy_recv_skb); t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_MD], t7xx_port_proxy_recv_skb); return 0; } diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_reg.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_reg.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_reg.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_reg.h 2022-11-29 07:06:46.000000000 +0000 @@ -56,7 +56,7 @@ #define D2H_INT_RESUME_ACK BIT(12) #define D2H_INT_SUSPEND_ACK_AP BIT(13) #define D2H_INT_RESUME_ACK_AP BIT(14) -#define D2H_INT_ASYNC_SAP_HK BIT(15) +#define D2H_INT_ASYNC_AP_HK BIT(15) #define D2H_INT_ASYNC_MD_HK BIT(16) /* Register base */ diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.c linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.c --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.c 2022-11-29 07:06:46.000000000 +0000 @@ -285,8 +285,9 @@ t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS1); t7xx_md_event_notify(md, FSM_START); - wait_event_interruptible_timeout(ctl->async_hk_wq, md->core_md.ready || ctl->exp_flg, - HZ * 60); + wait_event_interruptible_timeout(ctl->async_hk_wq, + (md->core_md.ready && md->core_ap.ready) || + ctl->exp_flg, HZ * 60); dev = &md->t7xx_dev->pdev->dev; if (ctl->exp_flg) @@ -299,6 +300,13 @@ fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT); return -ETIMEDOUT; + } else if (!md->core_ap.ready) { + dev_err(dev, "AP handshake timeout\n"); + if (md->core_ap.handshake_ongoing) + t7xx_fsm_append_event(ctl, FSM_EVENT_AP_HS2_EXIT, NULL, 0); + + fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT); + return -ETIMEDOUT; } t7xx_pci_pm_init_late(md->t7xx_dev); @@ -335,6 +343,7 @@ return; } + t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_AP]); t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_MD]); fsm_finish_command(ctl, cmd, fsm_routine_starting(ctl)); } diff -Nru linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.h linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.h --- linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/wwan/t7xx/t7xx_state_monitor.h 2022-11-29 07:06:46.000000000 +0000 @@ -38,10 +38,12 @@ enum t7xx_fsm_event_state { FSM_EVENT_INVALID, FSM_EVENT_MD_HS2, + FSM_EVENT_AP_HS2, FSM_EVENT_MD_EX, FSM_EVENT_MD_EX_REC_OK, FSM_EVENT_MD_EX_PASS, FSM_EVENT_MD_HS2_EXIT, + FSM_EVENT_AP_HS2_EXIT, FSM_EVENT_MAX }; diff -Nru linux-aws-5.19.0/drivers/net/xen-netback/xenbus.c linux-aws-5.19.0/drivers/net/xen-netback/xenbus.c --- linux-aws-5.19.0/drivers/net/xen-netback/xenbus.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/net/xen-netback/xenbus.c 2022-11-29 07:06:46.000000000 +0000 @@ -256,7 +256,6 @@ unsigned int queue_index; xen_unregister_watchers(vif); - xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status"); #ifdef CONFIG_DEBUG_FS xenvif_debugfs_delif(vif); #endif /* CONFIG_DEBUG_FS */ @@ -984,6 +983,7 @@ struct backend_info *be = dev_get_drvdata(&dev->dev); unregister_hotplug_status_watch(be); + xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); if (be->vif) { kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); backend_disconnect(be); diff -Nru linux-aws-5.19.0/drivers/nvdimm/pmem.c linux-aws-5.19.0/drivers/nvdimm/pmem.c --- linux-aws-5.19.0/drivers/nvdimm/pmem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvdimm/pmem.c 2022-11-29 07:06:46.000000000 +0000 @@ -45,7 +45,7 @@ return to_nd_region(to_dev(pmem)->parent); } -static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset) +static phys_addr_t pmem_to_phys(struct pmem_device *pmem, phys_addr_t offset) { return pmem->phys_addr + offset; } @@ -63,7 +63,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset, unsigned int len) { - phys_addr_t phys = to_phys(pmem, offset); + phys_addr_t phys = pmem_to_phys(pmem, offset); unsigned long pfn_start, pfn_end, pfn; /* only pmem in the linear map supports HWPoison */ @@ -97,7 +97,7 @@ static long __pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset, unsigned int len) { - phys_addr_t phys = to_phys(pmem, offset); + phys_addr_t phys = pmem_to_phys(pmem, offset); long cleared = nvdimm_clear_poison(to_dev(pmem), phys, len); if (cleared > 0) { diff -Nru linux-aws-5.19.0/drivers/nvme/host/apple.c linux-aws-5.19.0/drivers/nvme/host/apple.c --- linux-aws-5.19.0/drivers/nvme/host/apple.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/apple.c 2022-11-29 07:06:46.000000000 +0000 @@ -1502,7 +1502,7 @@ if (!blk_get_queue(anv->ctrl.admin_q)) { nvme_start_admin_queue(&anv->ctrl); - blk_cleanup_queue(anv->ctrl.admin_q); + blk_mq_destroy_queue(anv->ctrl.admin_q); anv->ctrl.admin_q = NULL; ret = -ENODEV; goto put_dev; diff -Nru linux-aws-5.19.0/drivers/nvme/host/core.c linux-aws-5.19.0/drivers/nvme/host/core.c --- linux-aws-5.19.0/drivers/nvme/host/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1089,8 +1089,8 @@ return effects; } -static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, - struct nvme_command *cmd, int status) +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status) { if (effects & NVME_CMD_EFFECTS_CSE_MASK) { nvme_unfreeze(ctrl); @@ -1126,21 +1126,16 @@ break; } } +EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, NVME_TARGET_PASSTHRU); -int nvme_execute_passthru_rq(struct request *rq) +int nvme_execute_passthru_rq(struct request *rq, u32 *effects) { struct nvme_command *cmd = nvme_req(rq)->cmd; struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; struct nvme_ns *ns = rq->q->queuedata; - u32 effects; - int ret; - effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); - ret = nvme_execute_rq(rq, false); - if (effects) /* nothing to be done for zero cmd effects */ - nvme_passthru_end(ctrl, effects, cmd, ret); - - return ret; + *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); + return nvme_execute_rq(rq, false); } EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU); @@ -2069,14 +2064,14 @@ static int nvme_pr_clear(struct block_device *bdev, u64 key) { - u32 cdw10 = 1 | (key ? 1 << 3 : 0); + u32 cdw10 = 1 | (key ? 0 : 1 << 3); - return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) { - u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } @@ -2801,7 +2796,6 @@ nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; @@ -3020,6 +3014,8 @@ ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); @@ -4105,7 +4101,6 @@ if (!nvme_ns_head_multipath(ns->head)) nvme_cdev_del(&ns->cdev, &ns->cdev_device); del_gendisk(ns->disk); - blk_cleanup_queue(ns->queue); down_write(&ns->ctrl->namespaces_rwsem); list_del_init(&ns->list); diff -Nru linux-aws-5.19.0/drivers/nvme/host/fc.c linux-aws-5.19.0/drivers/nvme/host/fc.c --- linux-aws-5.19.0/drivers/nvme/host/fc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/fc.c 2022-11-29 07:06:46.000000000 +0000 @@ -2392,7 +2392,7 @@ unsigned long flags; if (ctrl->ctrl.tagset) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(&ctrl->tag_set); } @@ -2402,8 +2402,8 @@ spin_unlock_irqrestore(&ctrl->rport->lock, flags); nvme_start_admin_queue(&ctrl->ctrl); - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(&ctrl->admin_tag_set); kfree(ctrl->queues); @@ -2953,7 +2953,7 @@ out_delete_hw_queues: nvme_fc_delete_hw_io_queues(ctrl); out_cleanup_blk_queue: - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tag_set: blk_mq_free_tag_set(&ctrl->tag_set); nvme_fc_free_io_queues(ctrl); @@ -3642,9 +3642,9 @@ return ERR_PTR(-EIO); out_cleanup_admin_q: - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_admin_tag_set: blk_mq_free_tag_set(&ctrl->admin_tag_set); out_free_queues: diff -Nru linux-aws-5.19.0/drivers/nvme/host/ioctl.c linux-aws-5.19.0/drivers/nvme/host/ioctl.c --- linux-aws-5.19.0/drivers/nvme/host/ioctl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/ioctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -136,9 +136,11 @@ unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl; struct request *req; void *meta = NULL; struct bio *bio; + u32 effects; int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer, @@ -147,8 +149,9 @@ return PTR_ERR(req); bio = req->bio; + ctrl = nvme_req(req)->ctrl; - ret = nvme_execute_passthru_rq(req); + ret = nvme_execute_passthru_rq(req, &effects); if (result) *result = le64_to_cpu(nvme_req(req)->result.u64); @@ -158,6 +161,10 @@ if (bio) blk_rq_unmap_user(bio); blk_mq_free_request(req); + + if (effects) + nvme_passthru_end(ctrl, effects, cmd, ret); + return ret; } diff -Nru linux-aws-5.19.0/drivers/nvme/host/multipath.c linux-aws-5.19.0/drivers/nvme/host/multipath.c --- linux-aws-5.19.0/drivers/nvme/host/multipath.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/multipath.c 2022-11-29 07:06:46.000000000 +0000 @@ -182,6 +182,7 @@ for_each_node(node) rcu_assign_pointer(head->current_path[node], NULL); + kblockd_schedule_work(&head->requeue_work); } static bool nvme_path_is_disabled(struct nvme_ns *ns) diff -Nru linux-aws-5.19.0/drivers/nvme/host/nvme.h linux-aws-5.19.0/drivers/nvme/host/nvme.h --- linux-aws-5.19.0/drivers/nvme/host/nvme.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/nvme.h 2022-11-29 07:06:46.000000000 +0000 @@ -994,7 +994,9 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode); -int nvme_execute_passthru_rq(struct request *rq); +int nvme_execute_passthru_rq(struct request *rq, u32 *effects); +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status); struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); void nvme_put_ns(struct nvme_ns *ns); diff -Nru linux-aws-5.19.0/drivers/nvme/host/pci.c linux-aws-5.19.0/drivers/nvme/host/pci.c --- linux-aws-5.19.0/drivers/nvme/host/pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -1760,7 +1760,7 @@ * queue to flush these to completion. */ nvme_start_admin_queue(&dev->ctrl); - blk_cleanup_queue(dev->ctrl.admin_q); + blk_mq_destroy_queue(dev->ctrl.admin_q); blk_mq_free_tag_set(&dev->admin_tagset); } } @@ -2825,6 +2825,8 @@ goto out; } + dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); + /* * If we're called to reset a live controller first shut it down before * moving on. @@ -2858,7 +2860,6 @@ * Don't limit the IOMMU merged segment size. */ dma_set_max_seg_size(dev->dev, 0xffffffff); - dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); mutex_unlock(&dev->shutdown_lock); @@ -3517,6 +3518,8 @@ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0xc0a9, 0x540a), /* Crucial P2 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, + { PCI_DEVICE(0x1d97, 0x2263), /* Lexar NM610 */ + .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061), .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, }, { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065), diff -Nru linux-aws-5.19.0/drivers/nvme/host/rdma.c linux-aws-5.19.0/drivers/nvme/host/rdma.c --- linux-aws-5.19.0/drivers/nvme/host/rdma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/rdma.c 2022-11-29 07:06:46.000000000 +0000 @@ -840,8 +840,8 @@ bool remove) { if (remove) { - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); } if (ctrl->async_event_sqe.data) { @@ -935,10 +935,10 @@ nvme_cancel_admin_tagset(&ctrl->ctrl); out_cleanup_queue: if (new) - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: if (new) - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_tagset: if (new) blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); @@ -957,7 +957,7 @@ bool remove) { if (remove) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(ctrl->ctrl.tagset); } nvme_rdma_free_io_queues(ctrl); @@ -1012,7 +1012,7 @@ out_cleanup_connect_q: nvme_cancel_tagset(&ctrl->ctrl); if (new) - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tag_set: if (new) blk_mq_free_tag_set(ctrl->ctrl.tagset); diff -Nru linux-aws-5.19.0/drivers/nvme/host/tcp.c linux-aws-5.19.0/drivers/nvme/host/tcp.c --- linux-aws-5.19.0/drivers/nvme/host/tcp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/host/tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -121,7 +121,6 @@ struct mutex send_mutex; struct llist_head req_list; struct list_head send_list; - bool more_requests; /* recv state */ void *pdu; @@ -318,7 +317,7 @@ static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) { return !list_empty(&queue->send_list) || - !llist_empty(&queue->req_list) || queue->more_requests; + !llist_empty(&queue->req_list); } static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, @@ -337,9 +336,7 @@ */ if (queue->io_cpu == raw_smp_processor_id() && sync && empty && mutex_trylock(&queue->send_mutex)) { - queue->more_requests = !last; nvme_tcp_send_all(queue); - queue->more_requests = false; mutex_unlock(&queue->send_mutex); } @@ -1227,7 +1224,7 @@ else if (unlikely(result < 0)) return; - if (!pending) + if (!pending || !queue->rd_enabled) return; } while (!time_after(jiffies, deadline)); /* quota is exhausted */ @@ -1884,7 +1881,7 @@ { nvme_tcp_stop_io_queues(ctrl); if (remove) { - blk_cleanup_queue(ctrl->connect_q); + blk_mq_destroy_queue(ctrl->connect_q); blk_mq_free_tag_set(ctrl->tagset); } nvme_tcp_free_io_queues(ctrl); @@ -1939,7 +1936,7 @@ out_cleanup_connect_q: nvme_cancel_tagset(ctrl); if (new) - blk_cleanup_queue(ctrl->connect_q); + blk_mq_destroy_queue(ctrl->connect_q); out_free_tag_set: if (new) blk_mq_free_tag_set(ctrl->tagset); @@ -1952,8 +1949,8 @@ { nvme_tcp_stop_queue(ctrl, 0); if (remove) { - blk_cleanup_queue(ctrl->admin_q); - blk_cleanup_queue(ctrl->fabrics_q); + blk_mq_destroy_queue(ctrl->admin_q); + blk_mq_destroy_queue(ctrl->fabrics_q); blk_mq_free_tag_set(ctrl->admin_tagset); } nvme_tcp_free_admin_queue(ctrl); @@ -2011,10 +2008,10 @@ nvme_cancel_admin_tagset(ctrl); out_cleanup_queue: if (new) - blk_cleanup_queue(ctrl->admin_q); + blk_mq_destroy_queue(ctrl->admin_q); out_cleanup_fabrics_q: if (new) - blk_cleanup_queue(ctrl->fabrics_q); + blk_mq_destroy_queue(ctrl->fabrics_q); out_free_tagset: if (new) blk_mq_free_tag_set(ctrl->admin_tagset); diff -Nru linux-aws-5.19.0/drivers/nvme/target/core.c linux-aws-5.19.0/drivers/nvme/target/core.c --- linux-aws-5.19.0/drivers/nvme/target/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/target/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -735,6 +735,8 @@ static void __nvmet_req_complete(struct nvmet_req *req, u16 status) { + struct nvmet_ns *ns = req->ns; + if (!req->sq->sqhd_disabled) nvmet_update_sq_head(req); req->cqe->sq_id = cpu_to_le16(req->sq->qid); @@ -745,9 +747,9 @@ trace_nvmet_req_complete(req); - if (req->ns) - nvmet_put_namespace(req->ns); req->ops->queue_response(req); + if (ns) + nvmet_put_namespace(ns); } void nvmet_req_complete(struct nvmet_req *req, u16 status) diff -Nru linux-aws-5.19.0/drivers/nvme/target/loop.c linux-aws-5.19.0/drivers/nvme/target/loop.c --- linux-aws-5.19.0/drivers/nvme/target/loop.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/target/loop.c 2022-11-29 07:06:46.000000000 +0000 @@ -266,8 +266,8 @@ if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags)) return; nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); - blk_cleanup_queue(ctrl->ctrl.admin_q); - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); blk_mq_free_tag_set(&ctrl->admin_tag_set); } @@ -283,7 +283,7 @@ mutex_unlock(&nvme_loop_ctrl_mutex); if (nctrl->tagset) { - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); blk_mq_free_tag_set(&ctrl->tag_set); } kfree(ctrl->queues); @@ -410,9 +410,9 @@ out_cleanup_queue: clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags); - blk_cleanup_queue(ctrl->ctrl.admin_q); + blk_mq_destroy_queue(ctrl->ctrl.admin_q); out_cleanup_fabrics_q: - blk_cleanup_queue(ctrl->ctrl.fabrics_q); + blk_mq_destroy_queue(ctrl->ctrl.fabrics_q); out_free_tagset: blk_mq_free_tag_set(&ctrl->admin_tag_set); out_free_sq: @@ -554,7 +554,7 @@ return 0; out_cleanup_connect_q: - blk_cleanup_queue(ctrl->ctrl.connect_q); + blk_mq_destroy_queue(ctrl->ctrl.connect_q); out_free_tagset: blk_mq_free_tag_set(&ctrl->tag_set); out_destroy_queues: diff -Nru linux-aws-5.19.0/drivers/nvme/target/passthru.c linux-aws-5.19.0/drivers/nvme/target/passthru.c --- linux-aws-5.19.0/drivers/nvme/target/passthru.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/target/passthru.c 2022-11-29 07:06:46.000000000 +0000 @@ -215,9 +215,11 @@ { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work); struct request *rq = req->p.rq; + struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; + u32 effects; int status; - status = nvme_execute_passthru_rq(rq); + status = nvme_execute_passthru_rq(rq, &effects); if (status == NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) { @@ -238,6 +240,9 @@ req->cqe->result = nvme_req(rq)->result; nvmet_req_complete(req, status); blk_mq_free_request(rq); + + if (effects) + nvme_passthru_end(ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq, diff -Nru linux-aws-5.19.0/drivers/nvme/target/tcp.c linux-aws-5.19.0/drivers/nvme/target/tcp.c --- linux-aws-5.19.0/drivers/nvme/target/tcp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/target/tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -935,10 +935,17 @@ struct nvme_tcp_data_pdu *data = &queue->pdu.data; struct nvmet_tcp_cmd *cmd; - if (likely(queue->nr_cmds)) + if (likely(queue->nr_cmds)) { + if (unlikely(data->ttag >= queue->nr_cmds)) { + pr_err("queue %d: received out of bound ttag %u, nr_cmds %u\n", + queue->idx, data->ttag, queue->nr_cmds); + nvmet_tcp_fatal_error(queue); + return -EPROTO; + } cmd = &queue->cmds[data->ttag]; - else + } else { cmd = &queue->connect; + } if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n", @@ -1506,6 +1513,9 @@ goto done; switch (sk->sk_state) { + case TCP_FIN_WAIT2: + case TCP_LAST_ACK: + break; case TCP_FIN_WAIT1: case TCP_CLOSE_WAIT: case TCP_CLOSE: diff -Nru linux-aws-5.19.0/drivers/nvme/target/zns.c linux-aws-5.19.0/drivers/nvme/target/zns.c --- linux-aws-5.19.0/drivers/nvme/target/zns.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvme/target/zns.c 2022-11-29 07:06:46.000000000 +0000 @@ -100,6 +100,7 @@ struct nvme_id_ns_zns *id_zns; u64 zsze; u16 status; + u32 mar, mor; if (le32_to_cpu(req->cmd->identify.nsid) == NVME_NSID_ALL) { req->error_loc = offsetof(struct nvme_identify, nsid); @@ -130,8 +131,20 @@ zsze = (bdev_zone_sectors(req->ns->bdev) << 9) >> req->ns->blksize_shift; id_zns->lbafe[0].zsze = cpu_to_le64(zsze); - id_zns->mor = cpu_to_le32(bdev_max_open_zones(req->ns->bdev)); - id_zns->mar = cpu_to_le32(bdev_max_active_zones(req->ns->bdev)); + + mor = bdev_max_open_zones(req->ns->bdev); + if (!mor) + mor = U32_MAX; + else + mor--; + id_zns->mor = cpu_to_le32(mor); + + mar = bdev_max_active_zones(req->ns->bdev); + if (!mar) + mar = U32_MAX; + else + mar--; + id_zns->mar = cpu_to_le32(mar); done: status = nvmet_copy_to_sgl(req, 0, id_zns, sizeof(*id_zns)); diff -Nru linux-aws-5.19.0/drivers/nvmem/core.c linux-aws-5.19.0/drivers/nvmem/core.c --- linux-aws-5.19.0/drivers/nvmem/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/nvmem/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -829,21 +829,18 @@ nvmem->dev.groups = nvmem_dev_groups; #endif - if (nvmem->nkeepout) { - rval = nvmem_validate_keepouts(nvmem); - if (rval) { - ida_free(&nvmem_ida, nvmem->id); - kfree(nvmem); - return ERR_PTR(rval); - } - } - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); rval = device_register(&nvmem->dev); if (rval) goto err_put_device; + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); + if (rval) + goto err_device_del; + } + if (config->compat) { rval = nvmem_sysfs_setup_compat(nvmem, config); if (rval) diff -Nru linux-aws-5.19.0/drivers/of/fdt.c linux-aws-5.19.0/drivers/of/fdt.c --- linux-aws-5.19.0/drivers/of/fdt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/of/fdt.c 2022-11-29 07:06:46.000000000 +0000 @@ -314,7 +314,7 @@ for (offset = 0; offset >= 0 && depth >= initial_depth; offset = fdt_next_node(blob, offset, &depth)) { - if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) + if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH - 1)) continue; if (!IS_ENABLED(CONFIG_OF_KOBJ) && diff -Nru linux-aws-5.19.0/drivers/parisc/ccio-dma.c linux-aws-5.19.0/drivers/parisc/ccio-dma.c --- linux-aws-5.19.0/drivers/parisc/ccio-dma.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/parisc/ccio-dma.c 2022-11-29 07:06:46.000000000 +0000 @@ -1380,15 +1380,17 @@ } } -static void __init ccio_init_resources(struct ioc *ioc) +static int __init ccio_init_resources(struct ioc *ioc) { struct resource *res = ioc->mmio_region; char *name = kmalloc(14, GFP_KERNEL); - + if (unlikely(!name)) + return -ENOMEM; snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path); ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low); ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv); + return 0; } static int new_ioc_area(struct resource *res, unsigned long size, @@ -1543,7 +1545,11 @@ return -ENOMEM; } ccio_ioc_init(ioc); - ccio_init_resources(ioc); + if (ccio_init_resources(ioc)) { + iounmap(ioc->ioc_regs); + kfree(ioc); + return -ENOMEM; + } hppa_dma_ops = &ccio_ops; hba = kzalloc(sizeof(*hba), GFP_KERNEL); diff -Nru linux-aws-5.19.0/drivers/pci/pci.c linux-aws-5.19.0/drivers/pci/pci.c --- linux-aws-5.19.0/drivers/pci/pci.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/pci/pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -2731,24 +2731,12 @@ if (target_state == PCI_POWER_ERROR) return -EIO; - /* - * There are systems (for example, Intel mobile chips since Coffee - * Lake) where the power drawn while suspended can be significantly - * reduced by disabling PTM on PCIe root ports as this allows the - * port to enter a lower-power PM state and the SoC to reach a - * lower-power idle state as a whole. - */ - if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) - pci_disable_ptm(dev); - pci_enable_wake(dev, target_state, wakeup); error = pci_set_power_state(dev, target_state); - if (error) { + if (error) pci_enable_wake(dev, target_state, false); - pci_restore_ptm_state(dev); - } return error; } @@ -2789,24 +2777,12 @@ if (target_state == PCI_POWER_ERROR) return -EIO; - /* - * There are systems (for example, Intel mobile chips since Coffee - * Lake) where the power drawn while suspended can be significantly - * reduced by disabling PTM on PCIe root ports as this allows the - * port to enter a lower-power PM state and the SoC to reach a - * lower-power idle state as a whole. - */ - if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) - pci_disable_ptm(dev); - __pci_enable_wake(dev, target_state, pci_dev_run_wake(dev)); error = pci_set_power_state(dev, target_state); - if (error) { + if (error) pci_enable_wake(dev, target_state, false); - pci_restore_ptm_state(dev); - } return error; } diff -Nru linux-aws-5.19.0/drivers/pci/pci-driver.c linux-aws-5.19.0/drivers/pci/pci-driver.c --- linux-aws-5.19.0/drivers/pci/pci-driver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pci/pci-driver.c 2022-11-29 07:06:46.000000000 +0000 @@ -774,6 +774,12 @@ pci_dev->skip_bus_pm = false; + /* + * Disabling PTM allows some systems, e.g., Intel mobile chips + * since Coffee Lake, to enter a lower-power PM state. + */ + pci_suspend_ptm(pci_dev); + if (pci_has_legacy_pm_support(pci_dev)) return pci_legacy_suspend(dev, PMSG_SUSPEND); @@ -867,20 +873,15 @@ } } - if (pci_dev->skip_bus_pm) { + if (!pci_dev->state_saved) { + pci_save_state(pci_dev); + /* - * Either the device is a bridge with a child in D0 below it, or - * the function is running for the second time in a row without - * going through full resume, which is possible only during - * suspend-to-idle in a spurious wakeup case. The device should - * be in D0 at this point, but if it is a bridge, it may be - * necessary to save its state. + * If the device is a bridge with a child in D0 below it, + * it needs to stay in D0, so check skip_bus_pm to avoid + * putting it into a low-power state in that case. */ - if (!pci_dev->state_saved) - pci_save_state(pci_dev); - } else if (!pci_dev->state_saved) { - pci_save_state(pci_dev); - if (pci_power_manageable(pci_dev)) + if (!pci_dev->skip_bus_pm && pci_power_manageable(pci_dev)) pci_prepare_to_sleep(pci_dev); } @@ -987,6 +988,8 @@ if (pci_dev->state_saved) pci_restore_standard_config(pci_dev); + pci_resume_ptm(pci_dev); + if (pci_has_legacy_pm_support(pci_dev)) return pci_legacy_resume(dev); @@ -1274,6 +1277,8 @@ pci_power_t prev = pci_dev->current_state; int error; + pci_suspend_ptm(pci_dev); + /* * If pci_dev->driver is not set (unbound), we leave the device in D0, * but it may go to D3cold when the bridge above it runtime suspends. @@ -1335,6 +1340,7 @@ * D3cold when the bridge above it runtime suspended. */ pci_pm_default_resume_early(pci_dev); + pci_resume_ptm(pci_dev); if (!pci_dev->driver) return 0; diff -Nru linux-aws-5.19.0/drivers/pci/pcie/ptm.c linux-aws-5.19.0/drivers/pci/pcie/ptm.c --- linux-aws-5.19.0/drivers/pci/pcie/ptm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pci/pcie/ptm.c 2022-11-29 07:06:46.000000000 +0000 @@ -9,30 +9,38 @@ #include #include "../pci.h" -static void pci_ptm_info(struct pci_dev *dev) +/* + * If the next upstream device supports PTM, return it; otherwise return + * NULL. PTM Messages are local, so both link partners must support it. + */ +static struct pci_dev *pci_upstream_ptm(struct pci_dev *dev) { - char clock_desc[8]; + struct pci_dev *ups = pci_upstream_bridge(dev); - switch (dev->ptm_granularity) { - case 0: - snprintf(clock_desc, sizeof(clock_desc), "unknown"); - break; - case 255: - snprintf(clock_desc, sizeof(clock_desc), ">254ns"); - break; - default: - snprintf(clock_desc, sizeof(clock_desc), "%uns", - dev->ptm_granularity); - break; - } - pci_info(dev, "PTM enabled%s, %s granularity\n", - dev->ptm_root ? " (root)" : "", clock_desc); + /* + * Switch Downstream Ports are not permitted to have a PTM + * capability; their PTM behavior is controlled by the Upstream + * Port (PCIe r5.0, sec 7.9.16), so if the upstream bridge is a + * Switch Downstream Port, look up one more level. + */ + if (ups && pci_pcie_type(ups) == PCI_EXP_TYPE_DOWNSTREAM) + ups = pci_upstream_bridge(ups); + + if (ups && ups->ptm_cap) + return ups; + + return NULL; } -void pci_disable_ptm(struct pci_dev *dev) +/* + * Find the PTM Capability (if present) and extract the information we need + * to use it. + */ +void pci_ptm_init(struct pci_dev *dev) { - int ptm; - u16 ctrl; + u16 ptm; + u32 cap; + struct pci_dev *ups; if (!pci_is_pcie(dev)) return; @@ -41,21 +49,47 @@ if (!ptm) return; - pci_read_config_word(dev, ptm + PCI_PTM_CTRL, &ctrl); - ctrl &= ~(PCI_PTM_CTRL_ENABLE | PCI_PTM_CTRL_ROOT); - pci_write_config_word(dev, ptm + PCI_PTM_CTRL, ctrl); + dev->ptm_cap = ptm; + pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_PTM, sizeof(u32)); + + pci_read_config_dword(dev, ptm + PCI_PTM_CAP, &cap); + dev->ptm_granularity = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; + + /* + * Per the spec recommendation (PCIe r6.0, sec 7.9.15.3), select the + * furthest upstream Time Source as the PTM Root. For Endpoints, + * "the Effective Granularity is the maximum Local Clock Granularity + * reported by the PTM Root and all intervening PTM Time Sources." + */ + ups = pci_upstream_ptm(dev); + if (ups) { + if (ups->ptm_granularity == 0) + dev->ptm_granularity = 0; + else if (ups->ptm_granularity > dev->ptm_granularity) + dev->ptm_granularity = ups->ptm_granularity; + } else if (cap & PCI_PTM_CAP_ROOT) { + dev->ptm_root = 1; + } else if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END) { + + /* + * Per sec 7.9.15.3, this should be the Local Clock + * Granularity of the associated Time Source. But it + * doesn't say how to find that Time Source. + */ + dev->ptm_granularity = 0; + } + + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || + pci_pcie_type(dev) == PCI_EXP_TYPE_UPSTREAM) + pci_enable_ptm(dev, NULL); } void pci_save_ptm_state(struct pci_dev *dev) { - int ptm; + u16 ptm = dev->ptm_cap; struct pci_cap_saved_state *save_state; - u16 *cap; - - if (!pci_is_pcie(dev)) - return; + u32 *cap; - ptm = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); if (!ptm) return; @@ -63,146 +97,152 @@ if (!save_state) return; - cap = (u16 *)&save_state->cap.data[0]; - pci_read_config_word(dev, ptm + PCI_PTM_CTRL, cap); + cap = (u32 *)&save_state->cap.data[0]; + pci_read_config_dword(dev, ptm + PCI_PTM_CTRL, cap); } void pci_restore_ptm_state(struct pci_dev *dev) { + u16 ptm = dev->ptm_cap; struct pci_cap_saved_state *save_state; - int ptm; - u16 *cap; + u32 *cap; - if (!pci_is_pcie(dev)) + if (!ptm) return; save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_PTM); - ptm = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); - if (!save_state || !ptm) + if (!save_state) return; - cap = (u16 *)&save_state->cap.data[0]; - pci_write_config_word(dev, ptm + PCI_PTM_CTRL, *cap); + cap = (u32 *)&save_state->cap.data[0]; + pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, *cap); } -void pci_ptm_init(struct pci_dev *dev) +/* Enable PTM in the Control register if possible */ +static int __pci_enable_ptm(struct pci_dev *dev) { - int pos; - u32 cap, ctrl; - u8 local_clock; + u16 ptm = dev->ptm_cap; struct pci_dev *ups; + u32 ctrl; - if (!pci_is_pcie(dev)) - return; - - /* - * Enable PTM only on interior devices (root ports, switch ports, - * etc.) on the assumption that it causes no link traffic until an - * endpoint enables it. - */ - if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ENDPOINT || - pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) - return; + if (!ptm) + return -EINVAL; /* - * Switch Downstream Ports are not permitted to have a PTM - * capability; their PTM behavior is controlled by the Upstream - * Port (PCIe r5.0, sec 7.9.16). + * A device uses local PTM Messages to request time information + * from a PTM Root that's farther upstream. Every device along the + * path must support PTM and have it enabled so it can handle the + * messages. Therefore, if this device is not a PTM Root, the + * upstream link partner must have PTM enabled before we can enable + * PTM. */ - ups = pci_upstream_bridge(dev); - if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && - ups && ups->ptm_enabled) { - dev->ptm_granularity = ups->ptm_granularity; - dev->ptm_enabled = 1; - return; + if (!dev->ptm_root) { + ups = pci_upstream_ptm(dev); + if (!ups || !ups->ptm_enabled) + return -EINVAL; } - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); - if (!pos) - return; - - pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_PTM, sizeof(u16)); - - pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); - local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; - - /* - * There's no point in enabling PTM unless it's enabled in the - * upstream device or this device can be a PTM Root itself. Per - * the spec recommendation (PCIe r3.1, sec 7.32.3), select the - * furthest upstream Time Source as the PTM Root. - */ - if (ups && ups->ptm_enabled) { - ctrl = PCI_PTM_CTRL_ENABLE; - if (ups->ptm_granularity == 0) - dev->ptm_granularity = 0; - else if (ups->ptm_granularity > local_clock) - dev->ptm_granularity = ups->ptm_granularity; - } else { - if (cap & PCI_PTM_CAP_ROOT) { - ctrl = PCI_PTM_CTRL_ENABLE | PCI_PTM_CTRL_ROOT; - dev->ptm_root = 1; - dev->ptm_granularity = local_clock; - } else - return; - } + pci_read_config_dword(dev, ptm + PCI_PTM_CTRL, &ctrl); + ctrl |= PCI_PTM_CTRL_ENABLE; + ctrl &= ~PCI_PTM_GRANULARITY_MASK; ctrl |= dev->ptm_granularity << 8; - pci_write_config_dword(dev, pos + PCI_PTM_CTRL, ctrl); - dev->ptm_enabled = 1; + if (dev->ptm_root) + ctrl |= PCI_PTM_CTRL_ROOT; - pci_ptm_info(dev); + pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, ctrl); + return 0; } +/** + * pci_enable_ptm() - Enable Precision Time Measurement + * @dev: PCI device + * @granularity: pointer to return granularity + * + * Enable Precision Time Measurement for @dev. If successful and + * @granularity is non-NULL, return the Effective Granularity. + * + * Return: zero if successful, or -EINVAL if @dev lacks a PTM Capability or + * is not a PTM Root and lacks an upstream path of PTM-enabled devices. + */ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) { - int pos; - u32 cap, ctrl; - struct pci_dev *ups; - - if (!pci_is_pcie(dev)) - return -EINVAL; - - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); - if (!pos) - return -EINVAL; - - pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); - if (!(cap & PCI_PTM_CAP_REQ)) - return -EINVAL; + int rc; + char clock_desc[8]; - /* - * For a PCIe Endpoint, PTM is only useful if the endpoint can - * issue PTM requests to upstream devices that have PTM enabled. - * - * For Root Complex Integrated Endpoints, there is no upstream - * device, so there must be some implementation-specific way to - * associate the endpoint with a time source. - */ - if (pci_pcie_type(dev) == PCI_EXP_TYPE_ENDPOINT) { - ups = pci_upstream_bridge(dev); - if (!ups || !ups->ptm_enabled) - return -EINVAL; + rc = __pci_enable_ptm(dev); + if (rc) + return rc; - dev->ptm_granularity = ups->ptm_granularity; - } else if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END) { - dev->ptm_granularity = 0; - } else - return -EINVAL; - - ctrl = PCI_PTM_CTRL_ENABLE; - ctrl |= dev->ptm_granularity << 8; - pci_write_config_dword(dev, pos + PCI_PTM_CTRL, ctrl); dev->ptm_enabled = 1; - pci_ptm_info(dev); - if (granularity) *granularity = dev->ptm_granularity; + + switch (dev->ptm_granularity) { + case 0: + snprintf(clock_desc, sizeof(clock_desc), "unknown"); + break; + case 255: + snprintf(clock_desc, sizeof(clock_desc), ">254ns"); + break; + default: + snprintf(clock_desc, sizeof(clock_desc), "%uns", + dev->ptm_granularity); + break; + } + pci_info(dev, "PTM enabled%s, %s granularity\n", + dev->ptm_root ? " (root)" : "", clock_desc); + return 0; } EXPORT_SYMBOL(pci_enable_ptm); +static void __pci_disable_ptm(struct pci_dev *dev) +{ + u16 ptm = dev->ptm_cap; + u32 ctrl; + + if (!ptm) + return; + + pci_read_config_dword(dev, ptm + PCI_PTM_CTRL, &ctrl); + ctrl &= ~(PCI_PTM_CTRL_ENABLE | PCI_PTM_CTRL_ROOT); + pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, ctrl); +} + +/** + * pci_disable_ptm() - Disable Precision Time Measurement + * @dev: PCI device + * + * Disable Precision Time Measurement for @dev. + */ +void pci_disable_ptm(struct pci_dev *dev) +{ + if (dev->ptm_enabled) { + __pci_disable_ptm(dev); + dev->ptm_enabled = 0; + } +} +EXPORT_SYMBOL(pci_disable_ptm); + +/* + * Disable PTM, but preserve dev->ptm_enabled so we silently re-enable it on + * resume if necessary. + */ +void pci_suspend_ptm(struct pci_dev *dev) +{ + if (dev->ptm_enabled) + __pci_disable_ptm(dev); +} + +/* If PTM was enabled before suspend, re-enable it when resuming */ +void pci_resume_ptm(struct pci_dev *dev) +{ + if (dev->ptm_enabled) + __pci_enable_ptm(dev); +} + bool pcie_ptm_enabled(struct pci_dev *dev) { if (!dev) diff -Nru linux-aws-5.19.0/drivers/pci/pci.h linux-aws-5.19.0/drivers/pci/pci.h --- linux-aws-5.19.0/drivers/pci/pci.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/pci/pci.h 2022-11-29 07:06:46.000000000 +0000 @@ -505,13 +505,17 @@ #endif /* CONFIG_PCI_IOV */ #ifdef CONFIG_PCIE_PTM +void pci_ptm_init(struct pci_dev *dev); void pci_save_ptm_state(struct pci_dev *dev); void pci_restore_ptm_state(struct pci_dev *dev); -void pci_disable_ptm(struct pci_dev *dev); +void pci_suspend_ptm(struct pci_dev *dev); +void pci_resume_ptm(struct pci_dev *dev); #else +static inline void pci_ptm_init(struct pci_dev *dev) { } static inline void pci_save_ptm_state(struct pci_dev *dev) { } static inline void pci_restore_ptm_state(struct pci_dev *dev) { } -static inline void pci_disable_ptm(struct pci_dev *dev) { } +static inline void pci_suspend_ptm(struct pci_dev *dev) { } +static inline void pci_resume_ptm(struct pci_dev *dev) { } #endif unsigned long pci_cardbus_resource_alignment(struct resource *); @@ -581,12 +585,6 @@ static inline void pcie_ecrc_get_policy(char *str) { } #endif -#ifdef CONFIG_PCIE_PTM -void pci_ptm_init(struct pci_dev *dev); -#else -static inline void pci_ptm_init(struct pci_dev *dev) { } -#endif - struct pci_dev_reset_methods { u16 vendor; u16 device; diff -Nru linux-aws-5.19.0/drivers/pci/setup-res.c linux-aws-5.19.0/drivers/pci/setup-res.c --- linux-aws-5.19.0/drivers/pci/setup-res.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pci/setup-res.c 2022-11-29 07:06:46.000000000 +0000 @@ -214,6 +214,17 @@ root = pci_find_parent_resource(dev, res); if (!root) { + /* + * If dev is behind a bridge, accesses will only reach it + * if res is inside the relevant bridge window. + */ + if (pci_upstream_bridge(dev)) + return -ENXIO; + + /* + * On the root bus, assume the host bridge will forward + * everything. + */ if (res->flags & IORESOURCE_IO) root = &ioport_resource; else diff -Nru linux-aws-5.19.0/drivers/peci/controller/peci-aspeed.c linux-aws-5.19.0/drivers/peci/controller/peci-aspeed.c --- linux-aws-5.19.0/drivers/peci/controller/peci-aspeed.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/peci/controller/peci-aspeed.c 2022-11-29 07:06:46.000000000 +0000 @@ -523,7 +523,7 @@ return PTR_ERR(priv->base); priv->irq = platform_get_irq(pdev, 0); - if (!priv->irq) + if (priv->irq < 0) return priv->irq; ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_peci_irq_handler, diff -Nru linux-aws-5.19.0/drivers/peci/cpu.c linux-aws-5.19.0/drivers/peci/cpu.c --- linux-aws-5.19.0/drivers/peci/cpu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/peci/cpu.c 2022-11-29 07:06:46.000000000 +0000 @@ -188,8 +188,6 @@ { struct auxiliary_device *adev = to_auxiliary_dev(dev); - auxiliary_device_uninit(adev); - kfree(adev->name); kfree(adev); } @@ -234,6 +232,7 @@ struct auxiliary_device *adev = _adev; auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); } static int devm_adev_add(struct device *dev, int idx) diff -Nru linux-aws-5.19.0/drivers/perf/arm-cmn.c linux-aws-5.19.0/drivers/perf/arm-cmn.c --- linux-aws-5.19.0/drivers/perf/arm-cmn.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/perf/arm-cmn.c 2022-11-29 07:06:46.000000000 +0000 @@ -36,7 +36,7 @@ #define CMN_CI_CHILD_COUNT GENMASK_ULL(15, 0) #define CMN_CI_CHILD_PTR_OFFSET GENMASK_ULL(31, 16) -#define CMN_CHILD_NODE_ADDR GENMASK(27, 0) +#define CMN_CHILD_NODE_ADDR GENMASK(29, 0) #define CMN_CHILD_NODE_EXTERNAL BIT(31) #define CMN_MAX_DIMENSION 12 diff -Nru linux-aws-5.19.0/drivers/perf/arm_pmu_platform.c linux-aws-5.19.0/drivers/perf/arm_pmu_platform.c --- linux-aws-5.19.0/drivers/perf/arm_pmu_platform.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/perf/arm_pmu_platform.c 2022-11-29 07:06:46.000000000 +0000 @@ -117,7 +117,7 @@ if (num_irqs == 1) { int irq = platform_get_irq(pdev, 0); - if (irq && irq_is_percpu_devid(irq)) + if ((irq > 0) && irq_is_percpu_devid(irq)) return pmu_parse_percpu_irq(pmu, irq); } diff -Nru linux-aws-5.19.0/drivers/perf/riscv_pmu_sbi.c linux-aws-5.19.0/drivers/perf/riscv_pmu_sbi.c --- linux-aws-5.19.0/drivers/perf/riscv_pmu_sbi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/perf/riscv_pmu_sbi.c 2022-11-29 07:06:46.000000000 +0000 @@ -467,7 +467,7 @@ if (!pmu_ctr_list) return -ENOMEM; - for (i = 0; i <= nctr; i++) { + for (i = 0; i < nctr; i++) { ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_GET_INFO, i, 0, 0, 0, 0, 0); if (ret.error) /* The logical counter ids are not expected to be contiguous */ @@ -639,8 +639,11 @@ struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node); struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events); - /* Enable the access for TIME csr only from the user mode now */ - csr_write(CSR_SCOUNTEREN, 0x2); + /* + * Enable the access for CYCLE, TIME, and INSTRET CSRs from userspace, + * as is necessary to maintain uABI compatibility. + */ + csr_write(CSR_SCOUNTEREN, 0x7); /* Stop all the counters so that they can be enabled from perf */ pmu_sbi_stop_all(pmu); diff -Nru linux-aws-5.19.0/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c linux-aws-5.19.0/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c --- linux-aws-5.19.0/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c 2022-11-29 07:06:46.000000000 +0000 @@ -197,7 +197,7 @@ struct phy_provider *phy; struct device *dev = &pdev->dev; struct phy_axg_mipi_pcie_analog_priv *priv; - struct device_node *np = dev->of_node; + struct device_node *np = dev->of_node, *parent_np; struct regmap *map; int ret; @@ -206,7 +206,9 @@ return -ENOMEM; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + parent_np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); diff -Nru linux-aws-5.19.0/drivers/phy/marvell/phy-mvebu-a3700-comphy.c linux-aws-5.19.0/drivers/phy/marvell/phy-mvebu-a3700-comphy.c --- linux-aws-5.19.0/drivers/phy/marvell/phy-mvebu-a3700-comphy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/phy/marvell/phy-mvebu-a3700-comphy.c 2022-11-29 07:06:46.000000000 +0000 @@ -274,7 +274,6 @@ int submode; bool invert_tx; bool invert_rx; - bool needs_reset; }; struct gbe_phy_init_data_fix { @@ -1097,40 +1096,12 @@ 0x0, PU_PLL_BIT | PU_RX_BIT | PU_TX_BIT); } -static int mvebu_a3700_comphy_reset(struct phy *phy) +static void mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_lane *lane) { - struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); - u16 mask, data; - - dev_dbg(lane->dev, "resetting lane %d\n", lane->id); - - /* COMPHY reset for internal logic */ - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, - SFT_RST_NO_REG, SFT_RST_NO_REG); - - /* COMPHY register reset (cleared automatically) */ - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, SFT_RST, SFT_RST); - - /* PIPE soft and register reset */ - data = PIPE_SOFT_RESET | PIPE_REG_RESET; - mask = data; - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, data, mask); - - /* Release PIPE register reset */ - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, - 0x0, PIPE_REG_RESET); - - /* Reset SB configuration register (only for lanes 0 and 1) */ - if (lane->id == 0 || lane->id == 1) { - u32 mask, data; - - data = PIN_RESET_CORE_BIT | PIN_RESET_COMPHY_BIT | - PIN_PU_PLL_BIT | PIN_PU_RX_BIT | PIN_PU_TX_BIT; - mask = data | PIN_PU_IVREF_BIT | PIN_TX_IDLE_BIT; - comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask); - } - - return 0; + /* + * The USB3 MAC sets the USB3 PHY to low state, so we do not + * need to power off USB3 PHY again. + */ } static bool mvebu_a3700_comphy_check_mode(int lane, @@ -1171,10 +1142,6 @@ (lane->mode != mode || lane->submode != submode)) return -EBUSY; - /* If changing mode, ensure reset is called */ - if (lane->mode != PHY_MODE_INVALID && lane->mode != mode) - lane->needs_reset = true; - /* Just remember the mode, ->power_on() will do the real setup */ lane->mode = mode; lane->submode = submode; @@ -1185,7 +1152,6 @@ static int mvebu_a3700_comphy_power_on(struct phy *phy) { struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); - int ret; if (!mvebu_a3700_comphy_check_mode(lane->id, lane->mode, lane->submode)) { @@ -1193,14 +1159,6 @@ return -EINVAL; } - if (lane->needs_reset) { - ret = mvebu_a3700_comphy_reset(phy); - if (ret) - return ret; - - lane->needs_reset = false; - } - switch (lane->mode) { case PHY_MODE_USB_HOST_SS: dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id); @@ -1224,38 +1182,28 @@ { struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); - switch (lane->mode) { - case PHY_MODE_USB_HOST_SS: - /* - * The USB3 MAC sets the USB3 PHY to low state, so we do not - * need to power off USB3 PHY again. - */ - break; - - case PHY_MODE_SATA: - mvebu_a3700_comphy_sata_power_off(lane); - break; - - case PHY_MODE_ETHERNET: + switch (lane->id) { + case 0: + mvebu_a3700_comphy_usb3_power_off(lane); mvebu_a3700_comphy_ethernet_power_off(lane); - break; - - case PHY_MODE_PCIE: + return 0; + case 1: mvebu_a3700_comphy_pcie_power_off(lane); - break; - + mvebu_a3700_comphy_ethernet_power_off(lane); + return 0; + case 2: + mvebu_a3700_comphy_usb3_power_off(lane); + mvebu_a3700_comphy_sata_power_off(lane); + return 0; default: dev_err(lane->dev, "invalid COMPHY mode\n"); return -EINVAL; } - - return 0; } static const struct phy_ops mvebu_a3700_comphy_ops = { .power_on = mvebu_a3700_comphy_power_on, .power_off = mvebu_a3700_comphy_power_off, - .reset = mvebu_a3700_comphy_reset, .set_mode = mvebu_a3700_comphy_set_mode, .owner = THIS_MODULE, }; @@ -1393,8 +1341,7 @@ * To avoid relying on the bootloader/firmware configuration, * power off all comphys. */ - mvebu_a3700_comphy_reset(phy); - lane->needs_reset = false; + mvebu_a3700_comphy_power_off(phy); } provider = devm_of_phy_provider_register(&pdev->dev, diff -Nru linux-aws-5.19.0/drivers/phy/mediatek/phy-mtk-tphy.c linux-aws-5.19.0/drivers/phy/mediatek/phy-mtk-tphy.c --- linux-aws-5.19.0/drivers/phy/mediatek/phy-mtk-tphy.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/phy/mediatek/phy-mtk-tphy.c 2022-11-29 07:06:46.000000000 +0000 @@ -906,7 +906,7 @@ static int phy_type_set(struct mtk_phy_instance *instance) { int type; - u32 mask; + u32 offset; if (!instance->type_sw) return 0; @@ -929,8 +929,9 @@ return 0; } - mask = RG_PHY_SW_TYPE << (instance->type_sw_index * BITS_PER_BYTE); - regmap_update_bits(instance->type_sw, instance->type_sw_reg, mask, type); + offset = instance->type_sw_index * BITS_PER_BYTE; + regmap_update_bits(instance->type_sw, instance->type_sw_reg, + RG_PHY_SW_TYPE << offset, type << offset); return 0; } diff -Nru linux-aws-5.19.0/drivers/phy/qualcomm/phy-qcom-usb-hsic.c linux-aws-5.19.0/drivers/phy/qualcomm/phy-qcom-usb-hsic.c --- linux-aws-5.19.0/drivers/phy/qualcomm/phy-qcom-usb-hsic.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/phy/qualcomm/phy-qcom-usb-hsic.c 2022-11-29 07:06:46.000000000 +0000 @@ -54,8 +54,10 @@ /* Configure pins for HSIC functionality */ pins_default = pinctrl_lookup_state(uphy->pctl, PINCTRL_STATE_DEFAULT); - if (IS_ERR(pins_default)) - return PTR_ERR(pins_default); + if (IS_ERR(pins_default)) { + ret = PTR_ERR(pins_default); + goto err_ulpi; + } ret = pinctrl_select_state(uphy->pctl, pins_default); if (ret) diff -Nru linux-aws-5.19.0/drivers/phy/rockchip/phy-rockchip-inno-usb2.c linux-aws-5.19.0/drivers/phy/rockchip/phy-rockchip-inno-usb2.c --- linux-aws-5.19.0/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 2022-11-29 07:06:46.000000000 +0000 @@ -1124,7 +1124,7 @@ struct rockchip_usb2phy_port *rport, struct device_node *child_np) { - int ret; + int ret, id; rport->port_id = USB2PHY_PORT_OTG; rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; @@ -1162,13 +1162,15 @@ ret = devm_extcon_register_notifier(rphy->dev, rphy->edev, EXTCON_USB_HOST, &rport->event_nb); - if (ret) + if (ret) { dev_err(rphy->dev, "register USB HOST notifier failed\n"); + goto out; + } if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { /* do initial sync of usb state */ - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); } } diff -Nru linux-aws-5.19.0/drivers/pinctrl/pinctrl-rockchip.c linux-aws-5.19.0/drivers/pinctrl/pinctrl-rockchip.c --- linux-aws-5.19.0/drivers/pinctrl/pinctrl-rockchip.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pinctrl/pinctrl-rockchip.c 2022-11-29 07:06:46.000000000 +0000 @@ -2393,11 +2393,24 @@ return 0; } +static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned offset, + bool input) +{ + struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); + struct rockchip_pin_bank *bank; + + bank = pin_to_bank(info, offset); + return rockchip_set_mux(bank, offset - bank->pin_base, RK_FUNC_GPIO); +} + static const struct pinmux_ops rockchip_pmx_ops = { .get_functions_count = rockchip_pmx_get_funcs_count, .get_function_name = rockchip_pmx_get_func_name, .get_function_groups = rockchip_pmx_get_groups, .set_mux = rockchip_pmx_set, + .gpio_set_direction = rockchip_pmx_gpio_set_direction, }; /* diff -Nru linux-aws-5.19.0/drivers/pinctrl/qcom/pinctrl-sc8180x.c linux-aws-5.19.0/drivers/pinctrl/qcom/pinctrl-sc8180x.c --- linux-aws-5.19.0/drivers/pinctrl/qcom/pinctrl-sc8180x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pinctrl/qcom/pinctrl-sc8180x.c 2022-11-29 07:06:46.000000000 +0000 @@ -530,10 +530,10 @@ DECLARE_MSM_GPIO_PINS(188); DECLARE_MSM_GPIO_PINS(189); -static const unsigned int sdc2_clk_pins[] = { 190 }; -static const unsigned int sdc2_cmd_pins[] = { 191 }; -static const unsigned int sdc2_data_pins[] = { 192 }; -static const unsigned int ufs_reset_pins[] = { 193 }; +static const unsigned int ufs_reset_pins[] = { 190 }; +static const unsigned int sdc2_clk_pins[] = { 191 }; +static const unsigned int sdc2_cmd_pins[] = { 192 }; +static const unsigned int sdc2_data_pins[] = { 193 }; enum sc8180x_functions { msm_mux_adsp_ext, @@ -1582,7 +1582,7 @@ static const struct msm_gpio_wakeirq_map sc8180x_pdc_map[] = { { 3, 31 }, { 5, 32 }, { 8, 33 }, { 9, 34 }, { 10, 100 }, { 12, 104 }, { 24, 37 }, { 26, 38 }, { 27, 41 }, { 28, 42 }, { 30, 39 }, { 36, 43 }, - { 37, 43 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 }, + { 37, 44 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 }, { 42, 48 }, { 46, 50 }, { 47, 49 }, { 48, 51 }, { 49, 53 }, { 50, 52 }, { 51, 116 }, { 51, 123 }, { 53, 54 }, { 54, 55 }, { 55, 56 }, { 56, 57 }, { 58, 58 }, { 60, 60 }, { 68, 62 }, { 70, 63 }, { 76, 86 }, diff -Nru linux-aws-5.19.0/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c linux-aws-5.19.0/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c --- linux-aws-5.19.0/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,7 +98,7 @@ static struct platform_driver a100_r_pinctrl_driver = { .probe = a100_r_pinctrl_probe, .driver = { - .name = "sun50iw10p1-r-pinctrl", + .name = "sun50i-a100-r-pinctrl", .of_match_table = a100_r_pinctrl_match, }, }; diff -Nru linux-aws-5.19.0/drivers/platform/chrome/chromeos_laptop.c linux-aws-5.19.0/drivers/platform/chrome/chromeos_laptop.c --- linux-aws-5.19.0/drivers/platform/chrome/chromeos_laptop.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/chrome/chromeos_laptop.c 2022-11-29 07:06:46.000000000 +0000 @@ -740,6 +740,7 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, const struct chromeos_laptop *src) { + struct i2c_peripheral *i2c_peripherals; struct i2c_peripheral *i2c_dev; struct i2c_board_info *info; int i; @@ -748,17 +749,15 @@ if (!src->num_i2c_peripherals) return 0; - cros_laptop->i2c_peripherals = kmemdup(src->i2c_peripherals, - src->num_i2c_peripherals * - sizeof(*src->i2c_peripherals), - GFP_KERNEL); - if (!cros_laptop->i2c_peripherals) + i2c_peripherals = kmemdup(src->i2c_peripherals, + src->num_i2c_peripherals * + sizeof(*src->i2c_peripherals), + GFP_KERNEL); + if (!i2c_peripherals) return -ENOMEM; - cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; - - for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + for (i = 0; i < src->num_i2c_peripherals; i++) { + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; error = chromeos_laptop_setup_irq(i2c_dev); @@ -775,16 +774,19 @@ } } + cros_laptop->i2c_peripherals = i2c_peripherals; + cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; + return 0; err_out: while (--i >= 0) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; if (!IS_ERR_OR_NULL(info->fwnode)) fwnode_remove_software_node(info->fwnode); } - kfree(cros_laptop->i2c_peripherals); + kfree(i2c_peripherals); return error; } diff -Nru linux-aws-5.19.0/drivers/platform/chrome/cros_ec.c linux-aws-5.19.0/drivers/platform/chrome/cros_ec.c --- linux-aws-5.19.0/drivers/platform/chrome/cros_ec.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/chrome/cros_ec.c 2022-11-29 07:06:46.000000000 +0000 @@ -352,10 +352,16 @@ static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { + bool wake_event; + while (ec_dev->mkbp_event_supported && - cros_ec_get_next_event(ec_dev, NULL, NULL) > 0) + cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) { blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); + + if (wake_event && device_may_wakeup(ec_dev->dev)) + pm_wakeup_event(ec_dev->dev, 0); + } } /** diff -Nru linux-aws-5.19.0/drivers/platform/chrome/cros_ec_chardev.c linux-aws-5.19.0/drivers/platform/chrome/cros_ec_chardev.c --- linux-aws-5.19.0/drivers/platform/chrome/cros_ec_chardev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/chrome/cros_ec_chardev.c 2022-11-29 07:06:46.000000000 +0000 @@ -327,6 +327,9 @@ if (copy_from_user(&s_mem, arg, sizeof(s_mem))) return -EFAULT; + if (s_mem.bytes > sizeof(s_mem.buffer)) + return -EINVAL; + num = ec_dev->cmd_readmem(ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer); if (num <= 0) diff -Nru linux-aws-5.19.0/drivers/platform/chrome/cros_ec_proto.c linux-aws-5.19.0/drivers/platform/chrome/cros_ec_proto.c --- linux-aws-5.19.0/drivers/platform/chrome/cros_ec_proto.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/chrome/cros_ec_proto.c 2022-11-29 07:06:46.000000000 +0000 @@ -750,6 +750,7 @@ u8 event_type; u32 host_event; int ret; + u32 ver_mask; /* * Default value for wake_event. @@ -771,6 +772,37 @@ return get_keyboard_state_event(ec_dev); ret = get_next_event(ec_dev); + /* + * -ENOPROTOOPT is returned when EC returns EC_RES_INVALID_VERSION. + * This can occur when EC based device (e.g. Fingerprint MCU) jumps to + * the RO image which doesn't support newer version of the command. In + * this case we will attempt to update maximum supported version of the + * EC_CMD_GET_NEXT_EVENT. + */ + if (ret == -ENOPROTOOPT) { + dev_dbg(ec_dev->dev, + "GET_NEXT_EVENT returned invalid version error.\n"); + ret = cros_ec_get_host_command_version_mask(ec_dev, + EC_CMD_GET_NEXT_EVENT, + &ver_mask); + if (ret < 0 || ver_mask == 0) + /* + * Do not change the MKBP supported version if we can't + * obtain supported version correctly. Please note that + * calling EC_CMD_GET_NEXT_EVENT returned + * EC_RES_INVALID_VERSION which means that the command + * is present. + */ + return -ENOPROTOOPT; + + ec_dev->mkbp_event_supported = fls(ver_mask); + dev_dbg(ec_dev->dev, "MKBP support version changed to %u\n", + ec_dev->mkbp_event_supported - 1); + + /* Try to get next event with new MKBP support version set. */ + ret = get_next_event(ec_dev); + } + if (ret <= 0) return ret; diff -Nru linux-aws-5.19.0/drivers/platform/chrome/cros_ec_typec.c linux-aws-5.19.0/drivers/platform/chrome/cros_ec_typec.c --- linux-aws-5.19.0/drivers/platform/chrome/cros_ec_typec.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/chrome/cros_ec_typec.c 2022-11-29 07:06:46.000000000 +0000 @@ -669,7 +669,7 @@ for (j = 0; j < sop_disc->svids[i].mode_count; j++) { memset(&desc, 0, sizeof(desc)); desc.svid = sop_disc->svids[i].svid; - desc.mode = j; + desc.mode = j + 1; desc.vdo = sop_disc->svids[i].mode_vdo[j]; if (is_partner) diff -Nru linux-aws-5.19.0/drivers/platform/mellanox/mlxreg-lc.c linux-aws-5.19.0/drivers/platform/mellanox/mlxreg-lc.c --- linux-aws-5.19.0/drivers/platform/mellanox/mlxreg-lc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/mellanox/mlxreg-lc.c 2022-11-29 07:06:46.000000000 +0000 @@ -460,8 +460,6 @@ u32 regval; int err; - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, ®val); if (err) goto regmap_read_fail; @@ -474,7 +472,6 @@ err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -491,8 +488,6 @@ * line card which is already has been enabled. Disabling does not affect the disabled line * card. */ - mutex_lock(&mlxreg_lc->lock); - err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, ®val); if (err) goto regmap_read_fail; @@ -505,7 +500,6 @@ err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); regmap_read_fail: - mutex_unlock(&mlxreg_lc->lock); return err; } @@ -538,6 +532,15 @@ static void mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) { + if (action) + mlxreg_lc->state |= state; + else + mlxreg_lc->state &= ~state; +} + +static void +mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) +{ mutex_lock(&mlxreg_lc->lock); if (action) @@ -560,8 +563,11 @@ dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); - if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) + mutex_lock(&mlxreg_lc->lock); + if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) { + mutex_unlock(&mlxreg_lc->lock); return 0; + } switch (kind) { case MLXREG_HOTPLUG_LC_SYNCED: @@ -574,7 +580,7 @@ if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) - return err; + goto mlxreg_lc_power_on_off_fail; } /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) @@ -588,12 +594,13 @@ /* In case line card is configured - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) err = mlxreg_lc_enable_disable(mlxreg_lc, 1); + mutex_unlock(&mlxreg_lc->lock); return err; } err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, mlxreg_lc->main_devs_num); if (err) - return err; + goto mlxreg_lc_create_static_devices_fail; /* In case line card is already in ready state - enable it. */ if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) @@ -620,6 +627,10 @@ break; } +mlxreg_lc_power_on_off_fail: +mlxreg_lc_create_static_devices_fail: + mutex_unlock(&mlxreg_lc->lock); + return err; } @@ -665,7 +676,7 @@ if (err) goto mlxreg_lc_create_static_devices_failed; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1); } /* Verify if line card is synchronized. */ @@ -676,7 +687,7 @@ /* Power on line card if necessary. */ if (regval & mlxreg_lc->data->mask) { mlxreg_lc->state |= MLXREG_LC_SYNCED; - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1); if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { err = mlxreg_lc_power_on_off(mlxreg_lc, 1); if (err) @@ -684,7 +695,7 @@ } } - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); return 0; @@ -863,7 +874,6 @@ if (err) { dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); - err = PTR_ERR(regmap); goto regcache_sync_fail; } @@ -905,6 +915,8 @@ struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0); + /* * Probing and removing are invoked by hotplug events raised upon line card insertion and * removing. If probing procedure fails all data is cleared. However, hotplug event still diff -Nru linux-aws-5.19.0/drivers/platform/surface/surface_aggregator_registry.c linux-aws-5.19.0/drivers/platform/surface/surface_aggregator_registry.c --- linux-aws-5.19.0/drivers/platform/surface/surface_aggregator_registry.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/surface/surface_aggregator_registry.c 2022-11-29 07:06:46.000000000 +0000 @@ -556,6 +556,9 @@ /* Surface Laptop Go 1 */ { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, + /* Surface Laptop Go 2 */ + { "MSHW0290", (unsigned long)ssam_node_group_slg1 }, + /* Surface Laptop Studio */ { "MSHW0123", (unsigned long)ssam_node_group_sls }, diff -Nru linux-aws-5.19.0/drivers/platform/x86/acer-wmi.c linux-aws-5.19.0/drivers/platform/x86/acer-wmi.c --- linux-aws-5.19.0/drivers/platform/x86/acer-wmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/acer-wmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -99,6 +99,7 @@ {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */ {KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */ {KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */ + {KE_KEY, 0x27, {KEY_HELP} }, {KE_KEY, 0x29, {KEY_PROG3} }, /* P_Key for TM8372 */ {KE_IGNORE, 0x41, {KEY_MUTE} }, {KE_IGNORE, 0x42, {KEY_PREVIOUSSONG} }, @@ -112,7 +113,13 @@ {KE_IGNORE, 0x48, {KEY_VOLUMEUP} }, {KE_IGNORE, 0x49, {KEY_VOLUMEDOWN} }, {KE_IGNORE, 0x4a, {KEY_VOLUMEDOWN} }, - {KE_IGNORE, 0x61, {KEY_SWITCHVIDEOMODE} }, + /* + * 0x61 is KEY_SWITCHVIDEOMODE. Usually this is a duplicate input event + * with the "Video Bus" input device events. But sometimes it is not + * a dup. Map it to KEY_UNKNOWN instead of using KE_IGNORE so that + * udev/hwdb can override it on systems where it is not a dup. + */ + {KE_KEY, 0x61, {KEY_UNKNOWN} }, {KE_IGNORE, 0x62, {KEY_BRIGHTNESSUP} }, {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ diff -Nru linux-aws-5.19.0/drivers/platform/x86/amd-pmc.c linux-aws-5.19.0/drivers/platform/x86/amd-pmc.c --- linux-aws-5.19.0/drivers/platform/x86/amd-pmc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/amd-pmc.c 2022-11-29 07:06:46.000000000 +0000 @@ -635,6 +635,13 @@ struct rtc_time tm; int rc; + /* we haven't yet read SMU version */ + if (!pdev->major) { + rc = amd_pmc_get_smu_version(pdev); + if (rc) + return rc; + } + if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53)) return 0; diff -Nru linux-aws-5.19.0/drivers/platform/x86/asus-wmi.c linux-aws-5.19.0/drivers/platform/x86/asus-wmi.c --- linux-aws-5.19.0/drivers/platform/x86/asus-wmi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/asus-wmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -107,7 +107,7 @@ #define WMI_EVENT_MASK 0xFFFF #define FAN_CURVE_POINTS 8 -#define FAN_CURVE_BUF_LEN (FAN_CURVE_POINTS * 2) +#define FAN_CURVE_BUF_LEN 32 #define FAN_CURVE_DEV_CPU 0x00 #define FAN_CURVE_DEV_GPU 0x01 /* Mask to determine if setting temperature or percentage */ @@ -2208,8 +2208,10 @@ curves = &asus->custom_fan_curves[fan_idx]; err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf, FAN_CURVE_BUF_LEN); - if (err) + if (err) { + pr_warn("%s (0x%08x) failed: %d\n", __func__, fan_dev, err); return err; + } fan_curve_copy_from_buf(curves, buf); curves->device_id = fan_dev; @@ -2227,9 +2229,6 @@ err = fan_curve_get_factory_default(asus, fan_dev); if (err) { - pr_debug("fan_curve_get_factory_default(0x%08x) failed: %d\n", - fan_dev, err); - /* Don't cause probe to fail on devices without fan-curves */ return 0; } diff -Nru linux-aws-5.19.0/drivers/platform/x86/hp-wmi.c linux-aws-5.19.0/drivers/platform/x86/hp-wmi.c --- linux-aws-5.19.0/drivers/platform/x86/hp-wmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/hp-wmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -177,7 +177,8 @@ enum hp_thermal_profile { HP_THERMAL_PROFILE_PERFORMANCE = 0x00, HP_THERMAL_PROFILE_DEFAULT = 0x01, - HP_THERMAL_PROFILE_COOL = 0x02 + HP_THERMAL_PROFILE_COOL = 0x02, + HP_THERMAL_PROFILE_QUIET = 0x03, }; #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW) @@ -1194,6 +1195,9 @@ case HP_THERMAL_PROFILE_COOL: *profile = PLATFORM_PROFILE_COOL; break; + case HP_THERMAL_PROFILE_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; default: return -EINVAL; } @@ -1216,6 +1220,9 @@ case PLATFORM_PROFILE_COOL: tp = HP_THERMAL_PROFILE_COOL; break; + case PLATFORM_PROFILE_QUIET: + tp = HP_THERMAL_PROFILE_QUIET; + break; default: return -EOPNOTSUPP; } @@ -1263,6 +1270,8 @@ platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + + set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); @@ -1289,8 +1298,16 @@ wwan_rfkill = NULL; rfkill2_count = 0; - if (hp_wmi_rfkill_setup(device)) - hp_wmi_rfkill2_setup(device); + /* + * In pre-2009 BIOS, command 1Bh return 0x4 to indicate that + * BIOS no longer controls the power for the wireless + * devices. All features supported by this command will no + * longer be supported. + */ + if (!hp_wmi_bios_2009_later()) { + if (hp_wmi_rfkill_setup(device)) + hp_wmi_rfkill2_setup(device); + } err = hp_wmi_hwmon_init(); diff -Nru linux-aws-5.19.0/drivers/platform/x86/intel/pmc/core.c linux-aws-5.19.0/drivers/platform/x86/intel/pmc/core.c --- linux-aws-5.19.0/drivers/platform/x86/intel/pmc/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/intel/pmc/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1914,6 +1914,8 @@ X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &tgl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &adl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &adl_reg_map), {} }; diff -Nru linux-aws-5.19.0/drivers/platform/x86/msi-laptop.c linux-aws-5.19.0/drivers/platform/x86/msi-laptop.c --- linux-aws-5.19.0/drivers/platform/x86/msi-laptop.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/msi-laptop.c 2022-11-29 07:06:46.000000000 +0000 @@ -596,11 +596,10 @@ { .ident = "MSI S270", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb @@ -633,8 +632,7 @@ DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb @@ -1048,8 +1046,7 @@ return -EINVAL; /* Register backlight stuff */ - - if (quirks->old_ec_model || + if (quirks->old_ec_model && acpi_video_get_backlight_type() == acpi_backlight_vendor) { struct backlight_properties props; memset(&props, 0, sizeof(struct backlight_properties)); @@ -1117,6 +1114,8 @@ fail_create_group: if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); + input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); rfkill_cleanup(); @@ -1137,6 +1136,7 @@ { if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); diff -Nru linux-aws-5.19.0/drivers/platform/x86/pmc_atom.c linux-aws-5.19.0/drivers/platform/x86/pmc_atom.c --- linux-aws-5.19.0/drivers/platform/x86/pmc_atom.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/pmc_atom.c 2022-11-29 07:06:46.000000000 +0000 @@ -232,7 +232,7 @@ pm1_cnt_port = acpi_base_addr + PM1_CNT; pm1_cnt_value = inl(pm1_cnt_port); - pm1_cnt_value &= SLEEP_TYPE_MASK; + pm1_cnt_value &= ~SLEEP_TYPE_MASK; pm1_cnt_value |= SLEEP_TYPE_S5; pm1_cnt_value |= SLEEP_ENABLE; @@ -354,7 +354,7 @@ static int dmi_callback(const struct dmi_system_id *d) { - pr_info("%s critclks quirk enabled\n", d->ident); + pr_info("%s: PMC critical clocks quirk enabled\n", d->ident); return 1; } diff -Nru linux-aws-5.19.0/drivers/platform/x86/x86-android-tablets.c linux-aws-5.19.0/drivers/platform/x86/x86-android-tablets.c --- linux-aws-5.19.0/drivers/platform/x86/x86-android-tablets.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/platform/x86/x86-android-tablets.c 2022-11-29 07:06:46.000000000 +0000 @@ -663,9 +663,23 @@ }, }; +static int __init chuwi_hi8_init(void) +{ + /* + * Avoid the acpi_unregister_gsi() call in x86_acpi_irq_helper_get() + * breaking the touchscreen + logging various errors when the Windows + * BIOS is used. + */ + if (acpi_dev_present("MSSL0001", NULL, 1)) + return -ENODEV; + + return 0; +} + static const struct x86_dev_info chuwi_hi8_info __initconst = { .i2c_client_info = chuwi_hi8_i2c_clients, .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients), + .init = chuwi_hi8_init, }; #define CZC_EC_EXTRA_PORT 0x68 diff -Nru linux-aws-5.19.0/drivers/power/supply/adp5061.c linux-aws-5.19.0/drivers/power/supply/adp5061.c --- linux-aws-5.19.0/drivers/power/supply/adp5061.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/power/supply/adp5061.c 2022-11-29 07:06:46.000000000 +0000 @@ -427,11 +427,11 @@ if (ret < 0) return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS(status1)]; - if (chg_type > ADP5061_CHG_FAST_CV) + chg_type = ADP5061_CHG_STATUS_1_CHG_STATUS(status1); + if (chg_type >= ARRAY_SIZE(adp5061_chg_type)) val->intval = POWER_SUPPLY_STATUS_UNKNOWN; else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type]; return ret; } diff -Nru linux-aws-5.19.0/drivers/powercap/intel_rapl_common.c linux-aws-5.19.0/drivers/powercap/intel_rapl_common.c --- linux-aws-5.19.0/drivers/powercap/intel_rapl_common.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/powercap/intel_rapl_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -994,6 +994,9 @@ y = value & 0x1f; value = (1 << y) * (4 + f) * rp->time_unit / 4; } else { + if (value < rp->time_unit) + return 0; + do_div(value, rp->time_unit); y = ilog2(value); f = div64_u64(4 * (value - (1 << y)), 1 << y); @@ -1035,7 +1038,6 @@ .check_unit = rapl_check_unit_core, .set_floor_freq = set_floor_freq_default, .compute_time_window = rapl_compute_time_window_core, - .dram_domain_energy_unit = 15300, .psys_domain_energy_unit = 1000000000, .spr_psys_bits = true, }; diff -Nru linux-aws-5.19.0/drivers/regulator/core.c linux-aws-5.19.0/drivers/regulator/core.c --- linux-aws-5.19.0/drivers/regulator/core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/regulator/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -2680,7 +2680,7 @@ * return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { - unsigned int time_remaining = delay; + int time_remaining = delay; while (time_remaining > 0) { _regulator_delay_helper(rdev->desc->poll_enabled_time); @@ -2732,13 +2732,18 @@ */ static int _regulator_handle_consumer_enable(struct regulator *regulator) { + int ret; struct regulator_dev *rdev = regulator->rdev; lockdep_assert_held_once(&rdev->mutex.base); regulator->enable_count++; - if (regulator->uA_load && regulator->enable_count == 1) - return drms_uA_update(rdev); + if (regulator->uA_load && regulator->enable_count == 1) { + ret = drms_uA_update(rdev); + if (ret) + regulator->enable_count--; + return ret; + } return 0; } diff -Nru linux-aws-5.19.0/drivers/regulator/qcom_rpm-regulator.c linux-aws-5.19.0/drivers/regulator/qcom_rpm-regulator.c --- linux-aws-5.19.0/drivers/regulator/qcom_rpm-regulator.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/regulator/qcom_rpm-regulator.c 2022-11-29 07:06:46.000000000 +0000 @@ -802,6 +802,12 @@ }; static const struct rpm_regulator_data rpm_pm8058_regulators[] = { + { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, @@ -829,12 +835,6 @@ { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, - { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, @@ -843,6 +843,12 @@ }; static const struct rpm_regulator_data rpm_pm8901_regulators[] = { + { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, @@ -851,12 +857,6 @@ { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, diff -Nru linux-aws-5.19.0/drivers/remoteproc/remoteproc_core.c linux-aws-5.19.0/drivers/remoteproc/remoteproc_core.c --- linux-aws-5.19.0/drivers/remoteproc/remoteproc_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/remoteproc/remoteproc_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -518,12 +518,13 @@ struct fw_rsc_vdev *rsc = ptr; struct device *dev = &rproc->dev; struct rproc_vdev *rvdev; + size_t rsc_size; int i, ret; char name[16]; /* make sure resource isn't truncated */ - if (struct_size(rsc, vring, rsc->num_of_vrings) + rsc->config_len > - avail) { + rsc_size = struct_size(rsc, vring, rsc->num_of_vrings); + if (size_add(rsc_size, rsc->config_len) > avail) { dev_err(dev, "vdev rsc is truncated\n"); return -EINVAL; } diff -Nru linux-aws-5.19.0/drivers/reset/reset-imx7.c linux-aws-5.19.0/drivers/reset/reset-imx7.c --- linux-aws-5.19.0/drivers/reset/reset-imx7.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/reset/reset-imx7.c 2022-11-29 07:06:46.000000000 +0000 @@ -329,6 +329,7 @@ break; case IMX8MP_RESET_PCIE_CTRL_APPS_EN: + case IMX8MP_RESET_PCIEPHY_PERST: value = assert ? 0 : bit; break; } diff -Nru linux-aws-5.19.0/drivers/rpmsg/qcom_glink_native.c linux-aws-5.19.0/drivers/rpmsg/qcom_glink_native.c --- linux-aws-5.19.0/drivers/rpmsg/qcom_glink_native.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/rpmsg/qcom_glink_native.c 2022-11-29 07:06:46.000000000 +0000 @@ -1546,7 +1546,7 @@ cancel_work_sync(&channel->intent_work); if (channel->rpdev) { - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; diff -Nru linux-aws-5.19.0/drivers/rpmsg/qcom_smd.c linux-aws-5.19.0/drivers/rpmsg/qcom_smd.c --- linux-aws-5.19.0/drivers/rpmsg/qcom_smd.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/rpmsg/qcom_smd.c 2022-11-29 07:06:46.000000000 +0000 @@ -1089,7 +1089,7 @@ /* Assign public information to the rpmsg_device */ rpdev = &qsdev->rpdev; - strncpy(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); + strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); rpdev->src = RPMSG_ADDR_ANY; rpdev->dst = RPMSG_ADDR_ANY; @@ -1323,7 +1323,7 @@ spin_unlock_irqrestore(&edge->channels_lock, flags); - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; rpmsg_unregister_device(&edge->dev, &chinfo); diff -Nru linux-aws-5.19.0/drivers/rpmsg/rpmsg_char.c linux-aws-5.19.0/drivers/rpmsg/rpmsg_char.c --- linux-aws-5.19.0/drivers/rpmsg/rpmsg_char.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/rpmsg/rpmsg_char.c 2022-11-29 07:06:46.000000000 +0000 @@ -76,7 +76,9 @@ mutex_lock(&eptdev->ept_lock); if (eptdev->ept) { - rpmsg_destroy_ept(eptdev->ept); + /* The default endpoint is released by the rpmsg core */ + if (!eptdev->default_ept) + rpmsg_destroy_ept(eptdev->ept); eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); diff -Nru linux-aws-5.19.0/drivers/s390/block/dasd_alias.c linux-aws-5.19.0/drivers/s390/block/dasd_alias.c --- linux-aws-5.19.0/drivers/s390/block/dasd_alias.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/s390/block/dasd_alias.c 2022-11-29 07:06:46.000000000 +0000 @@ -675,12 +675,12 @@ struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device) { struct dasd_eckd_private *alias_priv, *private = base_device->private; - struct alias_pav_group *group = private->pavgroup; struct alias_lcu *lcu = private->lcu; struct dasd_device *alias_device; + struct alias_pav_group *group; unsigned long flags; - if (!group || !lcu) + if (!lcu) return NULL; if (lcu->pav == NO_PAV || lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) @@ -697,6 +697,11 @@ } spin_lock_irqsave(&lcu->lock, flags); + group = private->pavgroup; + if (!group) { + spin_unlock_irqrestore(&lcu->lock, flags); + return NULL; + } alias_device = group->next; if (!alias_device) { if (list_empty(&group->aliaslist)) { diff -Nru linux-aws-5.19.0/drivers/s390/block/dasd.c linux-aws-5.19.0/drivers/s390/block/dasd.c --- linux-aws-5.19.0/drivers/s390/block/dasd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/s390/block/dasd.c 2022-11-29 07:06:46.000000000 +0000 @@ -3280,7 +3280,7 @@ static void dasd_free_queue(struct dasd_block *block) { if (block->request_queue) { - blk_cleanup_queue(block->request_queue); + blk_mq_destroy_queue(block->request_queue); blk_mq_free_tag_set(&block->tag_set); block->request_queue = NULL; } diff -Nru linux-aws-5.19.0/drivers/s390/block/dasd_genhd.c linux-aws-5.19.0/drivers/s390/block/dasd_genhd.c --- linux-aws-5.19.0/drivers/s390/block/dasd_genhd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/s390/block/dasd_genhd.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,8 +41,8 @@ if (base->devindex >= DASD_PER_MAJOR) return -EBUSY; - gdp = __alloc_disk_node(block->request_queue, NUMA_NO_NODE, - &dasd_bio_compl_lkclass); + gdp = blk_mq_alloc_disk_for_queue(block->request_queue, + &dasd_bio_compl_lkclass); if (!gdp) return -ENOMEM; diff -Nru linux-aws-5.19.0/drivers/scsi/3w-9xxx.c linux-aws-5.19.0/drivers/scsi/3w-9xxx.c --- linux-aws-5.19.0/drivers/scsi/3w-9xxx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/3w-9xxx.c 2022-11-29 07:06:46.000000000 +0000 @@ -2006,7 +2006,7 @@ retval = pci_enable_device(pdev); if (retval) { TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device"); - goto out_disable_device; + return -ENODEV; } pci_set_master(pdev); diff -Nru linux-aws-5.19.0/drivers/scsi/cxgbi/libcxgbi.c linux-aws-5.19.0/drivers/scsi/cxgbi/libcxgbi.c --- linux-aws-5.19.0/drivers/scsi/cxgbi/libcxgbi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/cxgbi/libcxgbi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1455,7 +1455,7 @@ if (conn) { log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p, cid %d.\n", csk, conn->id); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } } EXPORT_SYMBOL_GPL(cxgbi_conn_tx_open); diff -Nru linux-aws-5.19.0/drivers/scsi/hosts.c linux-aws-5.19.0/drivers/scsi/hosts.c --- linux-aws-5.19.0/drivers/scsi/hosts.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/hosts.c 2022-11-29 07:06:46.000000000 +0000 @@ -182,6 +182,15 @@ mutex_unlock(&shost->scan_mutex); scsi_proc_host_rm(shost); + /* + * New SCSI devices cannot be attached anymore because of the SCSI host + * state so drop the tag set refcnt. Wait until the tag set refcnt drops + * to zero because .exit_cmd_priv implementations may need the host + * pointer. + */ + kref_put(&shost->tagset_refcnt, scsi_mq_free_tags); + wait_for_completion(&shost->tagset_freed); + spin_lock_irqsave(shost->host_lock, flags); if (scsi_host_set_state(shost, SHOST_DEL)) BUG_ON(scsi_host_set_state(shost, SHOST_DEL_RECOVERY)); @@ -240,6 +249,9 @@ if (error) goto fail; + kref_init(&shost->tagset_refcnt); + init_completion(&shost->tagset_freed); + /* * Increase usage count temporarily here so that calling * scsi_autopm_put_host() will trigger runtime idle if there is @@ -312,6 +324,7 @@ pm_runtime_disable(&shost->shost_gendev); pm_runtime_set_suspended(&shost->shost_gendev); pm_runtime_put_noidle(&shost->shost_gendev); + kref_put(&shost->tagset_refcnt, scsi_mq_free_tags); fail: return error; } @@ -345,9 +358,6 @@ kfree(dev_name(&shost->shost_dev)); } - if (shost->tag_set.tags) - scsi_mq_destroy_tags(shost); - kfree(shost->shost_data); ida_simple_remove(&host_index_ida, shost->host_no); diff -Nru linux-aws-5.19.0/drivers/scsi/iscsi_tcp.c linux-aws-5.19.0/drivers/scsi/iscsi_tcp.c --- linux-aws-5.19.0/drivers/scsi/iscsi_tcp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/iscsi_tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -52,6 +52,10 @@ static unsigned int iscsi_max_lun = ~0; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static bool iscsi_recv_from_iscsi_q; +module_param_named(recv_from_iscsi_q, iscsi_recv_from_iscsi_q, bool, 0644); +MODULE_PARM_DESC(recv_from_iscsi_q, "Set to true to read iSCSI data/headers from the iscsi_q workqueue. The default is false which will perform reads from the network softirq context."); + static int iscsi_sw_tcp_dbg; module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, S_IRUGO | S_IWUSR); @@ -122,20 +126,13 @@ return 0; } -static void iscsi_sw_tcp_data_ready(struct sock *sk) +static void iscsi_sw_tcp_recv_data(struct iscsi_conn *conn) { - struct iscsi_conn *conn; - struct iscsi_tcp_conn *tcp_conn; + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; read_descriptor_t rd_desc; - read_lock_bh(&sk->sk_callback_lock); - conn = sk->sk_user_data; - if (!conn) { - read_unlock_bh(&sk->sk_callback_lock); - return; - } - tcp_conn = conn->dd_data; - /* * Use rd_desc to pass 'conn' to iscsi_tcp_recv. * We set count to 1 because we want the network layer to @@ -144,13 +141,48 @@ */ rd_desc.arg.data = conn; rd_desc.count = 1; - tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); - iscsi_sw_sk_state_check(sk); + tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); /* If we had to (atomically) map a highmem page, * unmap it now. */ iscsi_tcp_segment_unmap(&tcp_conn->in.segment); + + iscsi_sw_sk_state_check(sk); +} + +static void iscsi_sw_tcp_recv_data_work(struct work_struct *work) +{ + struct iscsi_conn *conn = container_of(work, struct iscsi_conn, + recvwork); + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; + + lock_sock(sk); + iscsi_sw_tcp_recv_data(conn); + release_sock(sk); +} + +static void iscsi_sw_tcp_data_ready(struct sock *sk) +{ + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; + struct iscsi_conn *conn; + + read_lock_bh(&sk->sk_callback_lock); + conn = sk->sk_user_data; + if (!conn) { + read_unlock_bh(&sk->sk_callback_lock); + return; + } + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + if (tcp_sw_conn->queue_recv) + iscsi_conn_queue_recv(conn); + else + iscsi_sw_tcp_recv_data(conn); read_unlock_bh(&sk->sk_callback_lock); } @@ -205,7 +237,7 @@ old_write_space(sk); ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n"); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn) @@ -276,6 +308,9 @@ if (segment->total_copied + segment->size < segment->total_size) flags |= MSG_MORE; + if (tcp_sw_conn->queue_recv) + flags |= MSG_DONTWAIT; + /* Use sendpage if we can; else fall back to sendmsg */ if (!segment->data) { sg = segment->sg; @@ -557,6 +592,10 @@ conn = cls_conn->dd_data; tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); + tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; + + mutex_init(&tcp_sw_conn->sock_lock); tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) @@ -592,11 +631,15 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) { - struct iscsi_session *session = conn->session; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; struct socket *sock = tcp_sw_conn->sock; + /* + * The iscsi transport class will make sure we are not called in + * parallel with start, stop, bind and destroys. However, this can be + * called twice if userspace does a stop then a destroy. + */ if (!sock) return; @@ -610,9 +653,11 @@ iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); - spin_lock_bh(&session->frwd_lock); + iscsi_suspend_rx(conn); + + mutex_lock(&tcp_sw_conn->sock_lock); tcp_sw_conn->sock = NULL; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); sockfd_put(sock); } @@ -664,7 +709,6 @@ struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; @@ -684,10 +728,10 @@ if (err) goto free_socket; - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); /* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); /* setup Socket parameters */ sk = sock->sk; @@ -724,8 +768,15 @@ break; case ISCSI_PARAM_DATADGST_EN: iscsi_set_param(cls_conn, param, buf, buflen); + + mutex_lock(&tcp_sw_conn->sock_lock); + if (!tcp_sw_conn->sock) { + mutex_unlock(&tcp_sw_conn->sock_lock); + return -ENOTCONN; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; + mutex_unlock(&tcp_sw_conn->sock_lock); break; case ISCSI_PARAM_MAX_R2T: return iscsi_tcp_set_max_r2t(conn, buf); @@ -740,8 +791,8 @@ enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; - struct iscsi_tcp_conn *tcp_conn = conn->dd_data; - struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; struct sockaddr_in6 addr; struct socket *sock; int rc; @@ -751,21 +802,36 @@ case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_LOCAL_PORT: spin_lock_bh(&conn->session->frwd_lock); - if (!tcp_sw_conn || !tcp_sw_conn->sock) { + if (!conn->session->leadconn) { spin_unlock_bh(&conn->session->frwd_lock); return -ENOTCONN; } - sock = tcp_sw_conn->sock; - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) { + rc = -ENOTCONN; + goto sock_unlock; + } + if (param == ISCSI_PARAM_LOCAL_PORT) rc = kernel_getsockname(sock, (struct sockaddr *)&addr); else rc = kernel_getpeername(sock, (struct sockaddr *)&addr); - sock_put(sock->sk); +sock_unlock: + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; @@ -803,17 +869,21 @@ } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; - if (!sock) { - spin_unlock_bh(&session->frwd_lock); - return -ENOTCONN; - } - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&session->frwd_lock); - rc = kernel_getsockname(sock, - (struct sockaddr *)&addr); - sock_put(sock->sk); + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) + rc = -ENOTCONN; + else + rc = kernel_getsockname(sock, (struct sockaddr *)&addr); + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; diff -Nru linux-aws-5.19.0/drivers/scsi/iscsi_tcp.h linux-aws-5.19.0/drivers/scsi/iscsi_tcp.h --- linux-aws-5.19.0/drivers/scsi/iscsi_tcp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/iscsi_tcp.h 2022-11-29 07:06:46.000000000 +0000 @@ -28,6 +28,11 @@ struct iscsi_sw_tcp_conn { struct socket *sock; + /* Taken when accessing the sock from the netlink/sysfs interface */ + struct mutex sock_lock; + + struct work_struct recvwork; + bool queue_recv; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ diff -Nru linux-aws-5.19.0/drivers/scsi/libiscsi.c linux-aws-5.19.0/drivers/scsi/libiscsi.c --- linux-aws-5.19.0/drivers/scsi/libiscsi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/libiscsi.c 2022-11-29 07:06:46.000000000 +0000 @@ -83,7 +83,7 @@ "%s " dbg_fmt, __func__, ##arg); \ } while (0); -inline void iscsi_conn_queue_work(struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); @@ -91,7 +91,17 @@ if (ihost->workq) queue_work(ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); + +inline void iscsi_conn_queue_recv(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags)) + queue_work(ihost->workq, &conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv); static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) @@ -765,7 +775,7 @@ goto free_task; } else { list_add_tail(&task->running, &conn->mgmtqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } return task; @@ -1513,7 +1523,7 @@ */ iscsi_put_task(task); } - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_requeue_task); @@ -1782,7 +1792,7 @@ } } else { list_add_tail(&task->running, &conn->cmdqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } session->queued_cmdsn++; @@ -1943,7 +1953,7 @@ /** * iscsi_suspend_tx - suspend iscsi_data_xmit - * @conn: iscsi conn tp stop processing IO on. + * @conn: iscsi conn to stop processing IO on. * * This function sets the suspend bit to prevent iscsi_data_xmit * from sending new IO, and if work is queued on the xmit thread @@ -1956,15 +1966,30 @@ set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) - flush_workqueue(ihost->workq); + flush_work(&conn->xmitwork); } EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); +} + +/** + * iscsi_suspend_rx - Prevent recvwork from running again. + * @conn: iscsi conn to stop. + */ +void iscsi_suspend_rx(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + if (ihost->workq) + flush_work(&conn->recvwork); } +EXPORT_SYMBOL_GPL(iscsi_suspend_rx); /* * We want to make sure a ping is in flight. It has timed out. diff -Nru linux-aws-5.19.0/drivers/scsi/libsas/sas_expander.c linux-aws-5.19.0/drivers/scsi/libsas/sas_expander.c --- linux-aws-5.19.0/drivers/scsi/libsas/sas_expander.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/libsas/sas_expander.c 2022-11-29 07:06:46.000000000 +0000 @@ -67,7 +67,7 @@ res = i->dft->lldd_execute_task(task, GFP_KERNEL); if (res) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); pr_notice("executing SMP task failed:%d\n", res); break; } diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_bsg.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_bsg.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_bsg.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_bsg.h 2022-11-29 07:06:46.000000000 +0000 @@ -1,7 +1,7 @@ /******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * - * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2010-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_crtn.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_crtn.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_crtn.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_crtn.h 2022-11-29 07:06:46.000000000 +0000 @@ -92,6 +92,14 @@ void lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag); void lpfc_unblock_requests(struct lpfc_hba *phba); void lpfc_block_requests(struct lpfc_hba *phba); +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries); +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor); +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry); +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries); void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); @@ -370,7 +378,7 @@ u8 cr_cx_cmd); void lpfc_sli_prep_abort_xri(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbq, u16 ulp_context, u16 iotag, u8 ulp_class, u16 cqid, - bool ia); + bool ia, bool wqec); struct lpfc_sglq *__lpfc_clear_active_sglq(struct lpfc_hba *phba, uint16_t xri); struct lpfc_sglq *__lpfc_sli_get_nvmet_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq); diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ct.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ct.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ct.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ct.c 2022-11-29 07:06:46.000000000 +0000 @@ -1509,7 +1509,7 @@ struct lpfc_sli_ct_request *CTrsp; int did; struct lpfc_nodelist *ndlp = NULL; - struct lpfc_nodelist *ns_ndlp = NULL; + struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp; uint32_t fc4_data_0, fc4_data_1; u32 ulp_status = get_job_ulpstatus(phba, rspiocb); u32 ulp_word4 = get_job_word4(phba, rspiocb); @@ -1522,15 +1522,12 @@ ulp_status, ulp_word4, did); /* Ignore response if link flipped after this request was made */ - if ((uint32_t) cmdiocb->event_tag != phba->fc_eventTag) { + if ((uint32_t)cmdiocb->event_tag != phba->fc_eventTag) { lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "9046 Event tag mismatch. Ignoring NS rsp\n"); goto out; } - /* Preserve the nameserver node to release the reference. */ - ns_ndlp = cmdiocb->ndlp; - if (ulp_status == IOSTAT_SUCCESS) { /* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *)outp->virt; diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -1,7 +1,7 @@ /******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * - * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2007-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * @@ -5531,7 +5531,7 @@ if (!debug) goto out; - debug->buffer = vmalloc(MAX_DEBUGFS_RX_TABLE_SIZE); + debug->buffer = vmalloc(MAX_DEBUGFS_RX_INFO_SIZE); if (!debug->buffer) { kfree(debug); goto out; @@ -5552,57 +5552,18 @@ struct lpfc_rx_monitor_debug *debug = file->private_data; struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private; char *buffer = debug->buffer; - struct rxtable_entry *entry; - int i, len = 0, head, tail, last, start; - head = atomic_read(&phba->rxtable_idx_head); - while (head == LPFC_RXMONITOR_TABLE_IN_USE) { - /* Table is getting updated */ - msleep(20); - head = atomic_read(&phba->rxtable_idx_head); - } - - tail = atomic_xchg(&phba->rxtable_idx_tail, head); - if (!phba->rxtable || head == tail) { - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "Rxtable is empty\n"); - goto out; + if (!phba->rx_monitor) { + scnprintf(buffer, MAX_DEBUGFS_RX_INFO_SIZE, + "Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, buffer, + MAX_DEBUGFS_RX_INFO_SIZE, + LPFC_MAX_RXMONITOR_ENTRY); } - last = (head > tail) ? head : LPFC_MAX_RXMONITOR_ENTRY; - start = tail; - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - " MaxBPI Tot_Data_CMF Tot_Data_Cmd " - "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " - "Bsy IO_cnt Info BWutil(ms)\n"); -get_table: - for (i = start; i < last; i++) { - entry = &phba->rxtable[i]; - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "%3d:%12lld %12lld %12lld %12lld " - "%7lldus %8lld %7lld " - "%2d %4d %2d %2d(%2d)\n", - i, entry->max_bytes_per_interval, - entry->cmf_bytes, - entry->total_bytes, - entry->rcv_bytes, - entry->avg_io_latency, - entry->avg_io_size, - entry->max_read_cnt, - entry->cmf_busy, - entry->io_cnt, - entry->cmf_info, - entry->timer_utilization, - entry->timer_interval); - } - - if (head != last) { - start = 0; - last = head; - goto get_table; - } -out: - return simple_read_from_buffer(buf, nbytes, ppos, buffer, len); + return simple_read_from_buffer(buf, nbytes, ppos, buffer, + strlen(buffer)); } static int diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.h 2022-11-29 07:06:46.000000000 +0000 @@ -282,7 +282,7 @@ void *ptr_private; }; -#define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) +#define MAX_DEBUGFS_RX_INFO_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) struct lpfc_rx_monitor_debug { char *i_private; char *buffer; diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_els.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_els.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_els.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_els.c 2022-11-29 07:06:46.000000000 +0000 @@ -1790,18 +1790,20 @@ /* Move this back to NPR state */ if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { - /* The new_ndlp is replacing ndlp totally, so we need - * to put ndlp on UNUSED list and try to free it. + /* The ndlp doesn't have a portname yet, but does have an + * NPort ID. The new_ndlp portname matches the Rport's + * portname. Reinstantiate the new_ndlp and reset the ndlp. */ lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "3179 PLOGI confirm NEW: %x %x\n", new_ndlp->nlp_DID, keepDID); /* Two ndlps cannot have the same did on the nodelist. - * Note: for this case, ndlp has a NULL WWPN so setting - * the nlp_fc4_type isn't required. + * The KeepDID and keep_nlp_fc4_type need to be swapped + * because ndlp is inflight with no WWPN. */ ndlp->nlp_DID = keepDID; + ndlp->nlp_fc4_type = keep_nlp_fc4_type; lpfc_nlp_set_state(vport, ndlp, keep_nlp_state); if (phba->sli_rev == LPFC_SLI_REV4 && active_rrqs_xri_bitmap) @@ -1816,9 +1818,8 @@ lpfc_unreg_rpi(vport, ndlp); - /* Two ndlps cannot have the same did and the fc4 - * type must be transferred because the ndlp is in - * flight. + /* The ndlp and new_ndlp both have WWPNs but are swapping + * NPort Ids and attributes. */ ndlp->nlp_DID = keepDID; ndlp->nlp_fc4_type = keep_nlp_fc4_type; diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc.h 2022-11-29 07:06:46.000000000 +0000 @@ -986,7 +986,8 @@ u8 last_seq, u8 cr_cx_cmd); void (*__lpfc_sli_prep_abort_xri)(struct lpfc_iocbq *cmdiocbq, u16 ulp_context, u16 iotag, - u8 ulp_class, u16 cqid, bool ia); + u8 ulp_class, u16 cqid, bool ia, + bool wqec); /* expedite pool */ struct lpfc_epd_pool epd_pool; @@ -1576,10 +1577,7 @@ u32 cgn_acqe_cnt; /* RX monitor handling for CMF */ - struct rxtable_entry *rxtable; /* RX_monitor information */ - atomic_t rxtable_idx_head; -#define LPFC_RXMONITOR_TABLE_IN_USE (LPFC_MAX_RXMONITOR_ENTRY + 73) - atomic_t rxtable_idx_tail; + struct lpfc_rx_info_monitor *rx_monitor; atomic_t rx_max_read_cnt; /* Maximum read bytes */ uint64_t rx_block_cnt; @@ -1628,7 +1626,7 @@ #define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_DUMP 32 -struct rxtable_entry { +struct rx_info_entry { uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t rcv_bytes; /* Total no of read bytes completed */ @@ -1643,6 +1641,13 @@ uint32_t timer_interval; }; +struct lpfc_rx_info_monitor { + struct rx_info_entry *ring; /* info organized in a circular buffer */ + u32 head_idx, tail_idx; /* index to head/tail of ring */ + spinlock_t lock; /* spinlock for ring */ + u32 entries; /* storing number entries/size of ring */ +}; + static inline struct Scsi_Host * lpfc_shost_from_vport(struct lpfc_vport *vport) { diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_hw4.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_hw4.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_hw4.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_hw4.h 2022-11-29 07:06:46.000000000 +0000 @@ -4736,7 +4736,6 @@ uint32_t rsvd_12_15[4]; /* word 12-15 */ }; -#define INHIBIT_ABORT 1 #define T_REQUEST_TAG 3 #define T_XRI_TAG 1 diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ids.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ids.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ids.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_ids.h 2022-11-29 07:06:46.000000000 +0000 @@ -1,7 +1,7 @@ /******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * - * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_init.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_init.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_init.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_init.c 2022-11-29 07:06:46.000000000 +0000 @@ -5571,38 +5571,12 @@ void lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) { - struct rxtable_entry *entry; - int cnt = 0, head, tail, last, start; - - head = atomic_read(&phba->rxtable_idx_head); - tail = atomic_read(&phba->rxtable_idx_tail); - if (!phba->rxtable || head == tail) { - lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, - "4411 Rxtable is empty\n"); - return; - } - last = tail; - start = head; - - /* Display the last LPFC_MAX_RXMONITOR_DUMP entries from the rxtable */ - while (start != last) { - if (start) - start--; - else - start = LPFC_MAX_RXMONITOR_ENTRY - 1; - entry = &phba->rxtable[start]; + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, - "4410 %02d: MBPI %lld Xmit %lld Cmpl %lld " - "Lat %lld ASz %lld Info %02d BWUtil %d " - "Int %d slot %d\n", - cnt, entry->max_bytes_per_interval, - entry->total_bytes, entry->rcv_bytes, - entry->avg_io_latency, entry->avg_io_size, - entry->cmf_info, entry->timer_utilization, - entry->timer_interval, start); - cnt++; - if (cnt >= LPFC_MAX_RXMONITOR_DUMP) - return; + "4411 Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, + LPFC_MAX_RXMONITOR_DUMP); } } @@ -6009,9 +5983,8 @@ { struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, cmf_timer); - struct rxtable_entry *entry; + struct rx_info_entry entry; uint32_t io_cnt; - uint32_t head, tail; uint32_t busy, max_read; uint64_t total, rcv, lat, mbpi, extra, cnt; int timer_interval = LPFC_CMF_INTERVAL; @@ -6131,40 +6104,30 @@ } /* Save rxmonitor information for debug */ - if (phba->rxtable) { - head = atomic_xchg(&phba->rxtable_idx_head, - LPFC_RXMONITOR_TABLE_IN_USE); - entry = &phba->rxtable[head]; - entry->total_bytes = total; - entry->cmf_bytes = total + extra; - entry->rcv_bytes = rcv; - entry->cmf_busy = busy; - entry->cmf_info = phba->cmf_active_info; + if (phba->rx_monitor) { + entry.total_bytes = total; + entry.cmf_bytes = total + extra; + entry.rcv_bytes = rcv; + entry.cmf_busy = busy; + entry.cmf_info = phba->cmf_active_info; if (io_cnt) { - entry->avg_io_latency = div_u64(lat, io_cnt); - entry->avg_io_size = div_u64(rcv, io_cnt); + entry.avg_io_latency = div_u64(lat, io_cnt); + entry.avg_io_size = div_u64(rcv, io_cnt); } else { - entry->avg_io_latency = 0; - entry->avg_io_size = 0; + entry.avg_io_latency = 0; + entry.avg_io_size = 0; } - entry->max_read_cnt = max_read; - entry->io_cnt = io_cnt; - entry->max_bytes_per_interval = mbpi; + entry.max_read_cnt = max_read; + entry.io_cnt = io_cnt; + entry.max_bytes_per_interval = mbpi; if (phba->cmf_active_mode == LPFC_CFG_MANAGED) - entry->timer_utilization = phba->cmf_last_ts; + entry.timer_utilization = phba->cmf_last_ts; else - entry->timer_utilization = ms; - entry->timer_interval = ms; + entry.timer_utilization = ms; + entry.timer_interval = ms; phba->cmf_last_ts = 0; - /* Increment rxtable index */ - head = (head + 1) % LPFC_MAX_RXMONITOR_ENTRY; - tail = atomic_read(&phba->rxtable_idx_tail); - if (head == tail) { - tail = (tail + 1) % LPFC_MAX_RXMONITOR_ENTRY; - atomic_set(&phba->rxtable_idx_tail, tail); - } - atomic_set(&phba->rxtable_idx_head, head); + lpfc_rx_monitor_record(phba->rx_monitor, &entry); } if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { @@ -8061,7 +8024,7 @@ /* Allocate device driver memory */ rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); if (rc) - return -ENOMEM; + goto out_destroy_workqueue; /* IF Type 2 ports get initialized now. */ if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= @@ -8489,6 +8452,9 @@ lpfc_destroy_bootstrap_mbox(phba); out_free_mem: lpfc_mem_free(phba); +out_destroy_workqueue: + destroy_workqueue(phba->wq); + phba->wq = NULL; return rc; } diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_mem.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_mem.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_mem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_mem.c 2022-11-29 07:06:46.000000000 +0000 @@ -344,9 +344,12 @@ phba->cgn_i = NULL; } - /* Free RX table */ - kfree(phba->rxtable); - phba->rxtable = NULL; + /* Free RX Monitor */ + if (phba->rx_monitor) { + lpfc_rx_monitor_destroy_ring(phba->rx_monitor); + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + } /* Free the iocb lookup array */ kfree(psli->iocbq_lookup); diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvme.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvme.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvme.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvme.c 2022-11-29 07:06:46.000000000 +0000 @@ -2824,6 +2824,7 @@ wcqep->word0 = 0; bf_set(lpfc_wcqe_c_status, wcqep, stat); wcqep->parameter = param; + wcqep->total_data_placed = 0; wcqep->word3 = 0; /* xb is 0 */ /* Call release with XB=1 to queue the IO into the abort list. */ diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvmet.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvmet.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvmet.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_nvmet.c 2022-11-29 07:06:46.000000000 +0000 @@ -3337,46 +3337,6 @@ return 1; } -/** - * lpfc_nvmet_prep_abort_wqe - set up 'abort' work queue entry. - * @pwqeq: Pointer to command iocb. - * @xritag: Tag that uniqely identifies the local exchange resource. - * @opt: Option bits - - * bit 0 = inhibit sending abts on the link - * - * This function is called with hbalock held. - **/ -static void -lpfc_nvmet_prep_abort_wqe(struct lpfc_iocbq *pwqeq, u16 xritag, u8 opt) -{ - union lpfc_wqe128 *wqe = &pwqeq->wqe; - - /* WQEs are reused. Clear stale data and set key fields to - * zero like ia, iaab, iaar, xri_tag, and ctxt_tag. - */ - memset(wqe, 0, sizeof(*wqe)); - - if (opt & INHIBIT_ABORT) - bf_set(abort_cmd_ia, &wqe->abort_cmd, 1); - /* Abort specified xri tag, with the mask deliberately zeroed */ - bf_set(abort_cmd_criteria, &wqe->abort_cmd, T_XRI_TAG); - - bf_set(wqe_cmnd, &wqe->abort_cmd.wqe_com, CMD_ABORT_XRI_CX); - - /* Abort the I/O associated with this outstanding exchange ID. */ - wqe->abort_cmd.wqe_com.abort_tag = xritag; - - /* iotag for the wqe completion. */ - bf_set(wqe_reqtag, &wqe->abort_cmd.wqe_com, pwqeq->iotag); - - bf_set(wqe_qosd, &wqe->abort_cmd.wqe_com, 1); - bf_set(wqe_lenloc, &wqe->abort_cmd.wqe_com, LPFC_WQE_LENLOC_NONE); - - bf_set(wqe_cmd_type, &wqe->abort_cmd.wqe_com, OTHER_COMMAND); - bf_set(wqe_wqec, &wqe->abort_cmd.wqe_com, 1); - bf_set(wqe_cqid, &wqe->abort_cmd.wqe_com, LPFC_WQE_CQ_ID_DEFAULT); -} - static int lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, struct lpfc_async_xchg_ctx *ctxp, @@ -3386,7 +3346,7 @@ struct lpfc_iocbq *abts_wqeq; struct lpfc_nodelist *ndlp; unsigned long flags; - u8 opt; + bool ia; int rc; tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; @@ -3426,7 +3386,7 @@ } abts_wqeq = ctxp->abort_wqeq; ctxp->state = LPFC_NVME_STE_ABORT; - opt = (ctxp->flag & LPFC_NVME_ABTS_RCV) ? INHIBIT_ABORT : 0; + ia = (ctxp->flag & LPFC_NVME_ABTS_RCV) ? true : false; spin_unlock_irqrestore(&ctxp->ctxlock, flags); /* Announce entry to new IO submit field. */ @@ -3472,7 +3432,9 @@ /* Ready - mark outstanding as aborted by driver. */ abts_wqeq->cmd_flag |= LPFC_DRIVER_ABORTED; - lpfc_nvmet_prep_abort_wqe(abts_wqeq, ctxp->wqeq->sli4_xritag, opt); + lpfc_sli_prep_abort_xri(phba, abts_wqeq, ctxp->wqeq->sli4_xritag, + abts_wqeq->iotag, CLASS3, + LPFC_WQE_CQ_ID_DEFAULT, ia, true); /* ABTS WQE must go to the same WQ as the WQE to be aborted */ abts_wqeq->hba_wqidx = ctxp->wqeq->hba_wqidx; diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_sli.c linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_sli.c --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_sli.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_sli.c 2022-11-29 07:06:46.000000000 +0000 @@ -7955,6 +7955,172 @@ } /** + * lpfc_rx_monitor_create_ring - Initialize ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entries: Number of rx_info_entry objects to allocate in ring + * + * Return: + * 0 - Success + * ENOMEM - Failure to kmalloc + **/ +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries) +{ + rx_monitor->ring = kmalloc_array(entries, sizeof(struct rx_info_entry), + GFP_KERNEL); + if (!rx_monitor->ring) + return -ENOMEM; + + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_lock_init(&rx_monitor->lock); + rx_monitor->entries = entries; + + return 0; +} + +/** + * lpfc_rx_monitor_destroy_ring - Free ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + **/ +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor) +{ + spin_lock(&rx_monitor->lock); + kfree(rx_monitor->ring); + rx_monitor->ring = NULL; + rx_monitor->entries = 0; + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_unlock(&rx_monitor->lock); +} + +/** + * lpfc_rx_monitor_record - Insert an entry into rx_monitor's ring + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entry: Pointer to rx_info_entry + * + * Used to insert an rx_info_entry into rx_monitor's ring. Note that this is a + * deep copy of rx_info_entry not a shallow copy of the rx_info_entry ptr. + * + * This is called from lpfc_cmf_timer, which is in timer/softirq context. + * + * In cases of old data overflow, we do a best effort of FIFO order. + **/ +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry) +{ + struct rx_info_entry *ring = rx_monitor->ring; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + + spin_lock(ring_lock); + memcpy(&ring[*tail_idx], entry, sizeof(*entry)); + *tail_idx = (*tail_idx + 1) % ring_size; + + /* Best effort of FIFO saved data */ + if (*tail_idx == *head_idx) + *head_idx = (*head_idx + 1) % ring_size; + + spin_unlock(ring_lock); +} + +/** + * lpfc_rx_monitor_report - Read out rx_monitor's ring + * @phba: Pointer to lpfc_hba object + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @buf: Pointer to char buffer that will contain rx monitor info data + * @buf_len: Length buf including null char + * @max_read_entries: Maximum number of entries to read out of ring + * + * Used to dump/read what's in rx_monitor's ring buffer. + * + * If buf is NULL || buf_len == 0, then it is implied that we want to log the + * information to kmsg instead of filling out buf. + * + * Return: + * Number of entries read out of the ring + **/ +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries) +{ + struct rx_info_entry *ring = rx_monitor->ring; + struct rx_info_entry *entry; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + u32 cnt = 0; + char tmp[DBG_LOG_STR_SZ] = {0}; + bool log_to_kmsg = (!buf || !buf_len) ? true : false; + + if (!log_to_kmsg) { + /* clear the buffer to be sure */ + memset(buf, 0, buf_len); + + scnprintf(buf, buf_len, "\t%-16s%-16s%-16s%-16s%-8s%-8s%-8s" + "%-8s%-8s%-8s%-16s\n", + "MaxBPI", "Tot_Data_CMF", + "Tot_Data_Cmd", "Tot_Data_Cmpl", + "Lat(us)", "Avg_IO", "Max_IO", "Bsy", + "IO_cnt", "Info", "BWutil(ms)"); + } + + /* Needs to be _bh because record is called from timer interrupt + * context + */ + spin_lock_bh(ring_lock); + while (*head_idx != *tail_idx) { + entry = &ring[*head_idx]; + + /* Read out this entry's data. */ + if (!log_to_kmsg) { + /* If !log_to_kmsg, then store to buf. */ + scnprintf(tmp, sizeof(tmp), + "%03d:\t%-16llu%-16llu%-16llu%-16llu%-8llu" + "%-8llu%-8llu%-8u%-8u%-8u%u(%u)\n", + *head_idx, entry->max_bytes_per_interval, + entry->cmf_bytes, entry->total_bytes, + entry->rcv_bytes, entry->avg_io_latency, + entry->avg_io_size, entry->max_read_cnt, + entry->cmf_busy, entry->io_cnt, + entry->cmf_info, entry->timer_utilization, + entry->timer_interval); + + /* Check for buffer overflow */ + if ((strlen(buf) + strlen(tmp)) >= buf_len) + break; + + /* Append entry's data to buffer */ + strlcat(buf, tmp, buf_len); + } else { + lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, + "4410 %02u: MBPI %llu Xmit %llu " + "Cmpl %llu Lat %llu ASz %llu Info %02u " + "BWUtil %u Int %u slot %u\n", + cnt, entry->max_bytes_per_interval, + entry->total_bytes, entry->rcv_bytes, + entry->avg_io_latency, + entry->avg_io_size, entry->cmf_info, + entry->timer_utilization, + entry->timer_interval, *head_idx); + } + + *head_idx = (*head_idx + 1) % ring_size; + + /* Don't feed more than max_read_entries */ + cnt++; + if (cnt >= max_read_entries) + break; + } + spin_unlock_bh(ring_lock); + + return cnt; +} + +/** * lpfc_cmf_setup - Initialize idle_stat tracking * @phba: Pointer to HBA context object. * @@ -8128,19 +8294,29 @@ phba->cmf_interval_rate = LPFC_CMF_INTERVAL; /* Allocate RX Monitor Buffer */ - if (!phba->rxtable) { - phba->rxtable = kmalloc_array(LPFC_MAX_RXMONITOR_ENTRY, - sizeof(struct rxtable_entry), - GFP_KERNEL); - if (!phba->rxtable) { + if (!phba->rx_monitor) { + phba->rx_monitor = kzalloc(sizeof(*phba->rx_monitor), + GFP_KERNEL); + + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2644 Failed to alloc memory " "for RX Monitor Buffer\n"); return -ENOMEM; } + + /* Instruct the rx_monitor object to instantiate its ring */ + if (lpfc_rx_monitor_create_ring(phba->rx_monitor, + LPFC_MAX_RXMONITOR_ENTRY)) { + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "2645 Failed to alloc memory " + "for RX Monitor's Ring\n"); + return -ENOMEM; + } } - atomic_set(&phba->rxtable_idx_head, 0); - atomic_set(&phba->rxtable_idx_tail, 0); + return 0; } @@ -10551,6 +10727,7 @@ cmd->un.elsreq64.bdl.bdeSize = sizeof(struct ulp_bde64); cmd->un.genreq64.xmit_els_remoteID = did; /* DID */ cmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX; + cmd->ulpPU = PARM_NPIV_DID; } cmd->ulpBdeCount = 1; cmd->ulpLe = 1; @@ -10857,7 +11034,8 @@ static void __lpfc_sli_prep_abort_xri_s3(struct lpfc_iocbq *cmdiocbq, u16 ulp_context, - u16 iotag, u8 ulp_class, u16 cqid, bool ia) + u16 iotag, u8 ulp_class, u16 cqid, bool ia, + bool wqec) { IOCB_t *icmd = NULL; @@ -10886,7 +11064,8 @@ static void __lpfc_sli_prep_abort_xri_s4(struct lpfc_iocbq *cmdiocbq, u16 ulp_context, - u16 iotag, u8 ulp_class, u16 cqid, bool ia) + u16 iotag, u8 ulp_class, u16 cqid, bool ia, + bool wqec) { union lpfc_wqe128 *wqe; @@ -10913,6 +11092,8 @@ bf_set(wqe_qosd, &wqe->abort_cmd.wqe_com, 1); /* Word 11 */ + if (wqec) + bf_set(wqe_wqec, &wqe->abort_cmd.wqe_com, 1); bf_set(wqe_cqid, &wqe->abort_cmd.wqe_com, cqid); bf_set(wqe_cmd_type, &wqe->abort_cmd.wqe_com, OTHER_COMMAND); } @@ -10920,10 +11101,10 @@ void lpfc_sli_prep_abort_xri(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbq, u16 ulp_context, u16 iotag, u8 ulp_class, u16 cqid, - bool ia) + bool ia, bool wqec) { phba->__lpfc_sli_prep_abort_xri(cmdiocbq, ulp_context, iotag, ulp_class, - cqid, ia); + cqid, ia, wqec); } /** @@ -12201,7 +12382,7 @@ lpfc_sli_prep_abort_xri(phba, abtsiocbp, ulp_context, iotag, cmdiocb->iocb.ulpClass, - LPFC_WQE_CQ_ID_DEFAULT, ia); + LPFC_WQE_CQ_ID_DEFAULT, ia, false); abtsiocbp->vport = vport; @@ -12661,7 +12842,7 @@ lpfc_sli_prep_abort_xri(phba, abtsiocbq, ulp_context, iotag, iocbq->iocb.ulpClass, cqid, - ia); + ia, false); abtsiocbq->vport = vport; diff -Nru linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_version.h linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_version.h --- linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_version.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/lpfc/lpfc_version.h 2022-11-29 07:06:46.000000000 +0000 @@ -20,7 +20,7 @@ * included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "14.2.0.4" +#define LPFC_DRIVER_VERSION "14.2.0.5" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ diff -Nru linux-aws-5.19.0/drivers/scsi/megaraid/megaraid_sas_fusion.c linux-aws-5.19.0/drivers/scsi/megaraid/megaraid_sas_fusion.c --- linux-aws-5.19.0/drivers/scsi/megaraid/megaraid_sas_fusion.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/megaraid/megaraid_sas_fusion.c 2022-11-29 07:06:46.000000000 +0000 @@ -5311,7 +5311,6 @@ if (!fusion->log_to_span) { dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); - kfree(instance->ctrl_context); return -ENOMEM; } } diff -Nru linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_base.c linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_base.c --- linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_base.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_base.c 2022-11-29 07:06:46.000000000 +0000 @@ -2993,7 +2993,7 @@ if (ioc->is_mcpu_endpoint || sizeof(dma_addr_t) == 4 || ioc->use_32bit_dma || - dma_get_required_mask(&pdev->dev) <= 32) + dma_get_required_mask(&pdev->dev) <= DMA_BIT_MASK(32)) ioc->dma_mask = 32; /* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */ else if (ioc->hba_mpi_version_belonged > MPI2_VERSION) diff -Nru linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c --- linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/mpt3sas/mpt3sas_scsih.c 2022-11-29 07:06:46.000000000 +0000 @@ -3670,6 +3670,7 @@ fw_event = list_first_entry(&ioc->fw_event_list, struct fw_event_work, list); list_del_init(&fw_event->list); + fw_event_work_put(fw_event); } spin_unlock_irqrestore(&ioc->fw_event_lock, flags); @@ -3751,7 +3752,6 @@ if (cancel_work_sync(&fw_event->work)) fw_event_work_put(fw_event); - fw_event_work_put(fw_event); } ioc->fw_events_cleanup = 0; } diff -Nru linux-aws-5.19.0/drivers/scsi/pm8001/pm8001_hwi.c linux-aws-5.19.0/drivers/scsi/pm8001/pm8001_hwi.c --- linux-aws-5.19.0/drivers/scsi/pm8001/pm8001_hwi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/pm8001/pm8001_hwi.c 2022-11-29 07:06:46.000000000 +0000 @@ -3608,6 +3608,10 @@ pm8001_dbg(pm8001_ha, FAIL, " TASK NULL. RETURNING !!!\n"); return -1; } + + if (t->task_proto == SAS_PROTOCOL_INTERNAL_ABORT) + atomic_dec(&pm8001_dev->running_req); + ts = &t->task_status; if (status != 0) pm8001_dbg(pm8001_ha, FAIL, "task abort failed status 0x%x ,tag = 0x%x, scp= 0x%x\n", diff -Nru linux-aws-5.19.0/drivers/scsi/qedf/qedf_main.c linux-aws-5.19.0/drivers/scsi/qedf/qedf_main.c --- linux-aws-5.19.0/drivers/scsi/qedf/qedf_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/qedf/qedf_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1921,6 +1921,27 @@ fc_vport_setlink(vn_port); } + /* Set symbolic node name */ + if (base_qedf->pdev->device == QL45xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 45xxx FCoE v%s", QEDF_VERSION); + + if (base_qedf->pdev->device == QL41xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 41xxx FCoE v%s", QEDF_VERSION); + + /* Set supported speed */ + fc_host_supported_speeds(vn_port->host) = n_port->link_supported_speeds; + + /* Set speed */ + vn_port->link_speed = n_port->link_speed; + + /* Set port type */ + fc_host_port_type(vn_port->host) = FC_PORTTYPE_NPIV; + + /* Set maxframe size */ + fc_host_maxframe_size(vn_port->host) = n_port->mfs; + QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%p.\n", vn_port); @@ -3686,11 +3707,6 @@ err1: scsi_host_put(lport->host); err0: - if (qedf) { - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); - - clear_bit(QEDF_PROBING, &qedf->flags); - } return rc; } diff -Nru linux-aws-5.19.0/drivers/scsi/qla2xxx/qla_target.c linux-aws-5.19.0/drivers/scsi/qla2xxx/qla_target.c --- linux-aws-5.19.0/drivers/scsi/qla2xxx/qla_target.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/qla2xxx/qla_target.c 2022-11-29 07:06:46.000000000 +0000 @@ -2151,8 +2151,10 @@ abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess, le32_to_cpu(abts->exchange_addr_to_abort)); - if (!abort_cmd) + if (!abort_cmd) { + mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); return -EIO; + } mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun; if (abort_cmd->qpair) { @@ -6935,14 +6937,8 @@ if (ha->flags.msix_enabled) { if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { - if (IS_QLA2071(ha)) { - /* 4 ports Baker: Enable Interrupt Handshake */ - icb->msix_atio = 0; - icb->firmware_options_2 |= cpu_to_le32(BIT_26); - } else { - icb->msix_atio = cpu_to_le16(msix->entry); - icb->firmware_options_2 &= cpu_to_le32(~BIT_26); - } + icb->msix_atio = cpu_to_le16(msix->entry); + icb->firmware_options_2 &= cpu_to_le32(~BIT_26); ql_dbg(ql_dbg_init, vha, 0xf072, "Registering ICB vector 0x%x for atio que.\n", msix->entry); diff -Nru linux-aws-5.19.0/drivers/scsi/scsi_lib.c linux-aws-5.19.0/drivers/scsi/scsi_lib.c --- linux-aws-5.19.0/drivers/scsi/scsi_lib.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/scsi_lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -118,7 +118,7 @@ } } -static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd) +static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd, unsigned long msecs) { struct request *rq = scsi_cmd_to_rq(cmd); @@ -128,7 +128,12 @@ } else { WARN_ON_ONCE(true); } - blk_mq_requeue_request(rq, true); + + if (msecs) { + blk_mq_requeue_request(rq, false); + blk_mq_delay_kick_requeue_list(rq->q, msecs); + } else + blk_mq_requeue_request(rq, true); } /** @@ -163,7 +168,7 @@ * Requeue this command. It will go before all other commands * that are already in the queue. Schedule requeue work under * lock such that the kblockd_schedule_work() call happens - * before blk_cleanup_queue() finishes. + * before blk_mq_destroy_queue() finishes. */ cmd->result = 0; @@ -424,9 +429,9 @@ * it and the queue. Mitigate by taking a reference to the * queue and never touching the sdev again after we drop the * host lock. Note: if __scsi_remove_device() invokes - * blk_cleanup_queue() before the queue is run from this + * blk_mq_destroy_queue() before the queue is run from this * function then blk_run_queue() will return immediately since - * blk_cleanup_queue() marks the queue with QUEUE_FLAG_DYING. + * blk_mq_destroy_queue() marks the queue with QUEUE_FLAG_DYING. */ slq = sdev->request_queue; if (!blk_get_queue(slq)) @@ -658,14 +663,6 @@ return bytes; } -/* Helper for scsi_io_completion() when "reprep" action required. */ -static void scsi_io_completion_reprep(struct scsi_cmnd *cmd, - struct request_queue *q) -{ - /* A new command will be prepared and issued. */ - scsi_mq_requeue_cmd(cmd); -} - static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd) { struct request *req = scsi_cmd_to_rq(cmd); @@ -683,14 +680,21 @@ return false; } +/* + * When ALUA transition state is returned, reprep the cmd to + * use the ALUA handler's transition timeout. Delay the reprep + * 1 sec to avoid aggressive retries of the target in that + * state. + */ +#define ALUA_TRANSITION_REPREP_DELAY 1000 + /* Helper for scsi_io_completion() when special action required. */ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) { - struct request_queue *q = cmd->device->request_queue; struct request *req = scsi_cmd_to_rq(cmd); int level = 0; - enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY, - ACTION_DELAYED_RETRY} action; + enum {ACTION_FAIL, ACTION_REPREP, ACTION_DELAYED_REPREP, + ACTION_RETRY, ACTION_DELAYED_RETRY} action; struct scsi_sense_hdr sshdr; bool sense_valid; bool sense_current = true; /* false implies "deferred sense" */ @@ -779,8 +783,8 @@ action = ACTION_DELAYED_RETRY; break; case 0x0a: /* ALUA state transition */ - blk_stat = BLK_STS_TRANSPORT; - fallthrough; + action = ACTION_DELAYED_REPREP; + break; default: action = ACTION_FAIL; break; @@ -839,7 +843,10 @@ return; fallthrough; case ACTION_REPREP: - scsi_io_completion_reprep(cmd, q); + scsi_mq_requeue_cmd(cmd, 0); + break; + case ACTION_DELAYED_REPREP: + scsi_mq_requeue_cmd(cmd, ALUA_TRANSITION_REPREP_DELAY); break; case ACTION_RETRY: /* Retry the same command immediately */ @@ -933,7 +940,7 @@ * command block will be released and the queue function will be goosed. If we * are not done then we have to figure out what to do next: * - * a) We can call scsi_io_completion_reprep(). The request will be + * a) We can call scsi_mq_requeue_cmd(). The request will be * unprepared and put back on the queue. Then a new command will * be created for it. This should be used if we made forward * progress, or if we want to switch from READ(10) to READ(6) for @@ -949,7 +956,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) { int result = cmd->result; - struct request_queue *q = cmd->device->request_queue; struct request *req = scsi_cmd_to_rq(cmd); blk_status_t blk_stat = BLK_STS_OK; @@ -986,7 +992,7 @@ * request just queue the command up again. */ if (likely(result == 0)) - scsi_io_completion_reprep(cmd, q); + scsi_mq_requeue_cmd(cmd, 0); else scsi_io_completion_action(cmd, result); } @@ -1989,9 +1995,13 @@ return blk_mq_alloc_tag_set(tag_set); } -void scsi_mq_destroy_tags(struct Scsi_Host *shost) +void scsi_mq_free_tags(struct kref *kref) { + struct Scsi_Host *shost = container_of(kref, typeof(*shost), + tagset_refcnt); + blk_mq_free_tag_set(&shost->tag_set); + complete(&shost->tagset_freed); } /** diff -Nru linux-aws-5.19.0/drivers/scsi/scsi_priv.h linux-aws-5.19.0/drivers/scsi/scsi_priv.h --- linux-aws-5.19.0/drivers/scsi/scsi_priv.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/scsi_priv.h 2022-11-29 07:06:46.000000000 +0000 @@ -94,7 +94,7 @@ extern void scsi_requeue_run_queue(struct work_struct *work); extern void scsi_start_queue(struct scsi_device *sdev); extern int scsi_mq_setup_tags(struct Scsi_Host *shost); -extern void scsi_mq_destroy_tags(struct Scsi_Host *shost); +extern void scsi_mq_free_tags(struct kref *kref); extern void scsi_exit_queue(void); extern void scsi_evt_thread(struct work_struct *work); diff -Nru linux-aws-5.19.0/drivers/scsi/scsi_scan.c linux-aws-5.19.0/drivers/scsi/scsi_scan.c --- linux-aws-5.19.0/drivers/scsi/scsi_scan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/scsi_scan.c 2022-11-29 07:06:46.000000000 +0000 @@ -340,6 +340,7 @@ kfree(sdev); goto out; } + kref_get(&sdev->host->tagset_refcnt); sdev->request_queue = q; q->queuedata = sdev; __scsi_init_queue(sdev->host, q); diff -Nru linux-aws-5.19.0/drivers/scsi/scsi_sysfs.c linux-aws-5.19.0/drivers/scsi/scsi_sysfs.c --- linux-aws-5.19.0/drivers/scsi/scsi_sysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/scsi_sysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -1475,7 +1475,8 @@ scsi_device_set_state(sdev, SDEV_DEL); mutex_unlock(&sdev->state_mutex); - blk_cleanup_queue(sdev->request_queue); + blk_mq_destroy_queue(sdev->request_queue); + kref_put(&sdev->host->tagset_refcnt, scsi_mq_free_tags); cancel_work_sync(&sdev->requeue_work); if (sdev->host->hostt->slave_destroy) diff -Nru linux-aws-5.19.0/drivers/scsi/sd.c linux-aws-5.19.0/drivers/scsi/sd.c --- linux-aws-5.19.0/drivers/scsi/sd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/sd.c 2022-11-29 07:06:46.000000000 +0000 @@ -3440,8 +3440,8 @@ if (!sdkp) goto out; - gd = __alloc_disk_node(sdp->request_queue, NUMA_NO_NODE, - &sd_bio_compl_lkclass); + gd = blk_mq_alloc_disk_for_queue(sdp->request_queue, + &sd_bio_compl_lkclass); if (!gd) goto out_free; diff -Nru linux-aws-5.19.0/drivers/scsi/sr.c linux-aws-5.19.0/drivers/scsi/sr.c --- linux-aws-5.19.0/drivers/scsi/sr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/scsi/sr.c 2022-11-29 07:06:46.000000000 +0000 @@ -624,8 +624,8 @@ if (!cd) goto fail; - disk = __alloc_disk_node(sdev->request_queue, NUMA_NO_NODE, - &sr_bio_compl_lkclass); + disk = blk_mq_alloc_disk_for_queue(sdev->request_queue, + &sr_bio_compl_lkclass); if (!disk) goto fail_free; mutex_init(&cd->lock); diff -Nru linux-aws-5.19.0/drivers/slimbus/Kconfig linux-aws-5.19.0/drivers/slimbus/Kconfig --- linux-aws-5.19.0/drivers/slimbus/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/slimbus/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -22,7 +22,8 @@ config SLIM_QCOM_NGD_CTRL tristate "Qualcomm SLIMbus Satellite Non-Generic Device Component" - depends on HAS_IOMEM && DMA_ENGINE && NET && QCOM_RPROC_COMMON + depends on HAS_IOMEM && DMA_ENGINE && NET + depends on QCOM_RPROC_COMMON || COMPILE_TEST depends on ARCH_QCOM || COMPILE_TEST select QCOM_QMI_HELPERS select QCOM_PDR_HELPERS diff -Nru linux-aws-5.19.0/drivers/slimbus/qcom-ngd-ctrl.c linux-aws-5.19.0/drivers/slimbus/qcom-ngd-ctrl.c --- linux-aws-5.19.0/drivers/slimbus/qcom-ngd-ctrl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/slimbus/qcom-ngd-ctrl.c 2022-11-29 07:06:46.000000000 +0000 @@ -1470,7 +1470,13 @@ ngd->pdev->dev.of_node = node; ctrl->ngd = ngd; - platform_device_add(ngd->pdev); + ret = platform_device_add(ngd->pdev); + if (ret) { + platform_device_put(ngd->pdev); + kfree(ngd); + of_node_put(node); + return ret; + } ngd->base = ctrl->base + ngd->id * data->offset + (ngd->id - 1) * data->size; @@ -1576,17 +1582,27 @@ ctrl->pdr = pdr_handle_alloc(slim_pd_status, ctrl); if (IS_ERR(ctrl->pdr)) { dev_err(dev, "Failed to init PDR handle\n"); - return PTR_ERR(ctrl->pdr); + ret = PTR_ERR(ctrl->pdr); + goto err_pdr_alloc; } pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { + ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return PTR_ERR(pds); + goto err_pdr_lookup; } platform_driver_register(&qcom_slim_ngd_driver); return of_qcom_slim_ngd_register(dev, ctrl); + +err_pdr_alloc: + qcom_unregister_ssr_notifier(ctrl->notifier, &ctrl->nb); + +err_pdr_lookup: + pdr_handle_release(ctrl->pdr); + + return ret; } static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev) diff -Nru linux-aws-5.19.0/drivers/soc/bcm/brcmstb/pm/pm-arm.c linux-aws-5.19.0/drivers/soc/bcm/brcmstb/pm/pm-arm.c --- linux-aws-5.19.0/drivers/soc/bcm/brcmstb/pm/pm-arm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/bcm/brcmstb/pm/pm-arm.c 2022-11-29 07:06:46.000000000 +0000 @@ -684,13 +684,14 @@ const struct of_device_id *of_id = NULL; struct device_node *dn; void __iomem *base; - int ret, i; + int ret, i, s; /* AON ctrl registers */ base = brcmstb_ioremap_match(aon_ctrl_dt_ids, 0, NULL); if (IS_ERR(base)) { pr_err("error mapping AON_CTRL\n"); - return PTR_ERR(base); + ret = PTR_ERR(base); + goto aon_err; } ctrl.aon_ctrl_base = base; @@ -700,8 +701,10 @@ /* Assume standard offset */ ctrl.aon_sram = ctrl.aon_ctrl_base + AON_CTRL_SYSTEM_DATA_RAM_OFS; + s = 0; } else { ctrl.aon_sram = base; + s = 1; } writel_relaxed(0, ctrl.aon_sram + AON_REG_PANIC); @@ -711,7 +714,8 @@ (const void **)&ddr_phy_data); if (IS_ERR(base)) { pr_err("error mapping DDR PHY\n"); - return PTR_ERR(base); + ret = PTR_ERR(base); + goto ddr_phy_err; } ctrl.support_warm_boot = ddr_phy_data->supports_warm_boot; ctrl.pll_status_offset = ddr_phy_data->pll_status_offset; @@ -731,17 +735,20 @@ for_each_matching_node(dn, ddr_shimphy_dt_ids) { i = ctrl.num_memc; if (i >= MAX_NUM_MEMC) { + of_node_put(dn); pr_warn("too many MEMCs (max %d)\n", MAX_NUM_MEMC); break; } base = of_io_request_and_map(dn, 0, dn->full_name); if (IS_ERR(base)) { + of_node_put(dn); if (!ctrl.support_warm_boot) break; pr_err("error mapping DDR SHIMPHY %d\n", i); - return PTR_ERR(base); + ret = PTR_ERR(base); + goto ddr_shimphy_err; } ctrl.memcs[i].ddr_shimphy_base = base; ctrl.num_memc++; @@ -752,14 +759,18 @@ for_each_matching_node(dn, brcmstb_memc_of_match) { base = of_iomap(dn, 0); if (!base) { + of_node_put(dn); pr_err("error mapping DDR Sequencer %d\n", i); - return -ENOMEM; + ret = -ENOMEM; + goto brcmstb_memc_err; } of_id = of_match_node(brcmstb_memc_of_match, dn); if (!of_id) { iounmap(base); - return -EINVAL; + of_node_put(dn); + ret = -EINVAL; + goto brcmstb_memc_err; } ddr_seq_data = of_id->data; @@ -779,21 +790,24 @@ dn = of_find_matching_node(NULL, sram_dt_ids); if (!dn) { pr_err("SRAM not found\n"); - return -EINVAL; + ret = -EINVAL; + goto brcmstb_memc_err; } ret = brcmstb_init_sram(dn); of_node_put(dn); if (ret) { pr_err("error setting up SRAM for PM\n"); - return ret; + goto brcmstb_memc_err; } ctrl.pdev = pdev; ctrl.s3_params = kmalloc(sizeof(*ctrl.s3_params), GFP_KERNEL); - if (!ctrl.s3_params) - return -ENOMEM; + if (!ctrl.s3_params) { + ret = -ENOMEM; + goto s3_params_err; + } ctrl.s3_params_pa = dma_map_single(&pdev->dev, ctrl.s3_params, sizeof(*ctrl.s3_params), DMA_TO_DEVICE); @@ -813,7 +827,21 @@ out: kfree(ctrl.s3_params); - +s3_params_err: + iounmap(ctrl.boot_sram); +brcmstb_memc_err: + for (i--; i >= 0; i--) + iounmap(ctrl.memcs[i].ddr_ctrl); +ddr_shimphy_err: + for (i = 0; i < ctrl.num_memc; i++) + iounmap(ctrl.memcs[i].ddr_shimphy_base); + + iounmap(ctrl.memcs[0].ddr_phy_base); +ddr_phy_err: + iounmap(ctrl.aon_ctrl_base); + if (s) + iounmap(ctrl.aon_sram); +aon_err: pr_warn("PM: initialization failed with code %d\n", ret); return ret; diff -Nru linux-aws-5.19.0/drivers/soc/fsl/Kconfig linux-aws-5.19.0/drivers/soc/fsl/Kconfig --- linux-aws-5.19.0/drivers/soc/fsl/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/fsl/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -24,6 +24,7 @@ tristate "QorIQ DPAA2 DPIO driver" depends on FSL_MC_BUS select SOC_BUS + select FSL_GUTS select DIMLIB help Driver for the DPAA2 DPIO object. A DPIO provides queue and diff -Nru linux-aws-5.19.0/drivers/soc/imx/gpcv2.c linux-aws-5.19.0/drivers/soc/imx/gpcv2.c --- linux-aws-5.19.0/drivers/soc/imx/gpcv2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/imx/gpcv2.c 2022-11-29 07:06:46.000000000 +0000 @@ -333,6 +333,8 @@ } } + reset_control_assert(domain->reset); + /* Enable reset clocks for all devices in the domain */ ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); if (ret) { @@ -340,7 +342,8 @@ goto out_regulator_disable; } - reset_control_assert(domain->reset); + /* delays for reset to propagate */ + udelay(5); if (domain->bits.pxx) { /* request the domain to power up */ diff -Nru linux-aws-5.19.0/drivers/soc/imx/imx8m-blk-ctrl.c linux-aws-5.19.0/drivers/soc/imx/imx8m-blk-ctrl.c --- linux-aws-5.19.0/drivers/soc/imx/imx8m-blk-ctrl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/imx/imx8m-blk-ctrl.c 2022-11-29 07:06:46.000000000 +0000 @@ -242,7 +242,6 @@ ret = PTR_ERR(domain->power_dev); goto cleanup_pds; } - dev_set_name(domain->power_dev, "%s", data->name); domain->genpd.name = data->name; domain->genpd.power_on = imx8m_blk_ctrl_power_on; diff -Nru linux-aws-5.19.0/drivers/soc/qcom/smem_state.c linux-aws-5.19.0/drivers/soc/qcom/smem_state.c --- linux-aws-5.19.0/drivers/soc/qcom/smem_state.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/qcom/smem_state.c 2022-11-29 07:06:46.000000000 +0000 @@ -136,6 +136,7 @@ struct qcom_smem_state *state = container_of(ref, struct qcom_smem_state, refcount); list_del(&state->list); + of_node_put(state->of_node); kfree(state); } @@ -205,7 +206,7 @@ kref_init(&state->refcount); - state->of_node = of_node; + state->of_node = of_node_get(of_node); state->ops = *ops; state->priv = priv; diff -Nru linux-aws-5.19.0/drivers/soc/qcom/smsm.c linux-aws-5.19.0/drivers/soc/qcom/smsm.c --- linux-aws-5.19.0/drivers/soc/qcom/smsm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/qcom/smsm.c 2022-11-29 07:06:46.000000000 +0000 @@ -526,7 +526,7 @@ for (id = 0; id < smsm->num_hosts; id++) { ret = smsm_parse_ipc(smsm, id); if (ret < 0) - return ret; + goto out_put; } /* Acquire the main SMSM state vector */ @@ -534,13 +534,14 @@ smsm->num_entries * sizeof(u32)); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate shared state entry\n"); - return ret; + goto out_put; } states = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE, NULL); if (IS_ERR(states)) { dev_err(&pdev->dev, "Unable to acquire shared state entry\n"); - return PTR_ERR(states); + ret = PTR_ERR(states); + goto out_put; } /* Acquire the list of interrupt mask vectors */ @@ -548,13 +549,14 @@ ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, size); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n"); - return ret; + goto out_put; } intr_mask = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, NULL); if (IS_ERR(intr_mask)) { dev_err(&pdev->dev, "unable to acquire shared memory interrupt mask\n"); - return PTR_ERR(intr_mask); + ret = PTR_ERR(intr_mask); + goto out_put; } /* Setup the reference to the local state bits */ @@ -565,7 +567,8 @@ smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm); if (IS_ERR(smsm->state)) { dev_err(smsm->dev, "failed to register qcom_smem_state\n"); - return PTR_ERR(smsm->state); + ret = PTR_ERR(smsm->state); + goto out_put; } /* Register handlers for remote processor entries of interest. */ @@ -595,16 +598,19 @@ } platform_set_drvdata(pdev, smsm); + of_node_put(local_node); return 0; unwind_interfaces: + of_node_put(node); for (id = 0; id < smsm->num_entries; id++) if (smsm->entries[id].domain) irq_domain_remove(smsm->entries[id].domain); qcom_smem_state_unregister(smsm->state); - +out_put: + of_node_put(local_node); return ret; } diff -Nru linux-aws-5.19.0/drivers/soc/sunxi/sunxi_sram.c linux-aws-5.19.0/drivers/soc/sunxi/sunxi_sram.c --- linux-aws-5.19.0/drivers/soc/sunxi/sunxi_sram.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/sunxi/sunxi_sram.c 2022-11-29 07:06:46.000000000 +0000 @@ -78,8 +78,8 @@ static struct sunxi_sram_desc sun50i_a64_sram_c = { .data = SUNXI_SRAM_DATA("C", 0x4, 24, 1, - SUNXI_SRAM_MAP(0, 1, "cpu"), - SUNXI_SRAM_MAP(1, 0, "de2")), + SUNXI_SRAM_MAP(1, 0, "cpu"), + SUNXI_SRAM_MAP(0, 1, "de2")), }; static const struct of_device_id sunxi_sram_dt_ids[] = { @@ -254,6 +254,7 @@ writel(val | ((device << sram_data->offset) & mask), base + sram_data->reg); + sram_desc->claimed = true; spin_unlock(&sram_lock); return 0; @@ -329,11 +330,11 @@ .writeable_reg = sunxi_sram_regmap_accessible_reg, }; -static int sunxi_sram_probe(struct platform_device *pdev) +static int __init sunxi_sram_probe(struct platform_device *pdev) { - struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; + struct device *dev = &pdev->dev; sram_dev = &pdev->dev; @@ -345,13 +346,6 @@ if (IS_ERR(base)) return PTR_ERR(base); - of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); - - d = debugfs_create_file("sram", S_IRUGO, NULL, NULL, - &sunxi_sram_fops); - if (!d) - return -ENOMEM; - if (variant->num_emac_clocks > 0) { emac_clock = devm_regmap_init_mmio(&pdev->dev, base, &sunxi_sram_emac_clock_regmap); @@ -360,6 +354,10 @@ return PTR_ERR(emac_clock); } + of_platform_populate(dev->of_node, NULL, NULL, dev); + + debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); + return 0; } @@ -409,9 +407,8 @@ .name = "sunxi-sram", .of_match_table = sunxi_sram_dt_match, }, - .probe = sunxi_sram_probe, }; -module_platform_driver(sunxi_sram_driver); +builtin_platform_driver_probe(sunxi_sram_driver, sunxi_sram_probe); MODULE_AUTHOR("Maxime Ripard "); MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver"); diff -Nru linux-aws-5.19.0/drivers/soc/tegra/Kconfig linux-aws-5.19.0/drivers/soc/tegra/Kconfig --- linux-aws-5.19.0/drivers/soc/tegra/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soc/tegra/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -136,7 +136,6 @@ def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool diff -Nru linux-aws-5.19.0/drivers/soundwire/cadence_master.c linux-aws-5.19.0/drivers/soundwire/cadence_master.c --- linux-aws-5.19.0/drivers/soundwire/cadence_master.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soundwire/cadence_master.c 2022-11-29 07:06:46.000000000 +0000 @@ -544,9 +544,12 @@ return SDW_CMD_IGNORED; } - /* fill response */ - for (i = 0; i < count; i++) - msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, cdns->response_buf[i]); + if (msg->flags == SDW_MSG_FLAG_READ) { + /* fill response */ + for (i = 0; i < count; i++) + msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, + cdns->response_buf[i]); + } return SDW_CMD_OK; } diff -Nru linux-aws-5.19.0/drivers/soundwire/intel.c linux-aws-5.19.0/drivers/soundwire/intel.c --- linux-aws-5.19.0/drivers/soundwire/intel.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/soundwire/intel.c 2022-11-29 07:06:46.000000000 +0000 @@ -1401,7 +1401,6 @@ ret = intel_register_dai(sdw); if (ret) { dev_err(dev, "DAI registration failed: %d\n", ret); - snd_soc_unregister_component(dev); goto err_interrupt; } diff -Nru linux-aws-5.19.0/drivers/soundwire/qcom.c linux-aws-5.19.0/drivers/soundwire/qcom.c --- linux-aws-5.19.0/drivers/soundwire/qcom.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/soundwire/qcom.c 2022-11-29 07:06:46.000000000 +0000 @@ -167,7 +167,7 @@ u8 wcmd_id; struct qcom_swrm_port_config pconfig[QCOM_SDW_MAX_PORTS]; struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS]; - enum sdw_slave_status status[SDW_MAX_DEVICES]; + enum sdw_slave_status status[SDW_MAX_DEVICES + 1]; int (*reg_read)(struct qcom_swrm_ctrl *ctrl, int reg, u32 *val); int (*reg_write)(struct qcom_swrm_ctrl *ctrl, int reg, int val); u32 slave_status; @@ -411,7 +411,7 @@ ctrl->reg_read(ctrl, SWRM_MCP_SLV_STATUS, &val); - for (dev_num = 0; dev_num < SDW_MAX_DEVICES; dev_num++) { + for (dev_num = 0; dev_num <= SDW_MAX_DEVICES; dev_num++) { status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ)); if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) { @@ -431,7 +431,7 @@ ctrl->reg_read(ctrl, SWRM_MCP_SLV_STATUS, &val); ctrl->slave_status = val; - for (i = 0; i < SDW_MAX_DEVICES; i++) { + for (i = 0; i <= SDW_MAX_DEVICES; i++) { u32 s; s = (val >> (i * 2)); diff -Nru linux-aws-5.19.0/drivers/spi/spi-bitbang-txrx.h linux-aws-5.19.0/drivers/spi/spi-bitbang-txrx.h --- linux-aws-5.19.0/drivers/spi/spi-bitbang-txrx.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-bitbang-txrx.h 2022-11-29 07:06:46.000000000 +0000 @@ -116,6 +116,7 @@ { /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ + u8 rxbit = bits - 1; u32 oldbit = !(word & 1); /* clock starts at inactive polarity */ for (; likely(bits); bits--) { @@ -135,7 +136,7 @@ /* sample LSB (from slave) on leading edge */ word >>= 1; if ((flags & SPI_MASTER_NO_RX) == 0) - word |= getmiso(spi) << (bits - 1); + word |= getmiso(spi) << rxbit; setsck(spi, cpol); } return word; @@ -148,6 +149,7 @@ { /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ + u8 rxbit = bits - 1; u32 oldbit = !(word & 1); /* clock starts at inactive polarity */ for (; likely(bits); bits--) { @@ -168,7 +170,7 @@ /* sample LSB (from slave) on trailing edge */ word >>= 1; if ((flags & SPI_MASTER_NO_RX) == 0) - word |= getmiso(spi) << (bits - 1); + word |= getmiso(spi) << rxbit; } return word; } diff -Nru linux-aws-5.19.0/drivers/spi/spi.c linux-aws-5.19.0/drivers/spi/spi.c --- linux-aws-5.19.0/drivers/spi/spi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1047,6 +1047,8 @@ if (sgt->orig_nents) { dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); sg_free_table(sgt); + sgt->orig_nents = 0; + sgt->nents = 0; } } diff -Nru linux-aws-5.19.0/drivers/spi/spi-cadence-quadspi.c linux-aws-5.19.0/drivers/spi/spi-cadence-quadspi.c --- linux-aws-5.19.0/drivers/spi/spi-cadence-quadspi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-cadence-quadspi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1619,7 +1619,7 @@ pm_runtime_enable(dev); ret = pm_runtime_resume_and_get(dev); if (ret < 0) - return ret; + goto probe_pm_failed; ret = clk_prepare_enable(cqspi->clk); if (ret) { @@ -1712,6 +1712,7 @@ clk_disable_unprepare(cqspi->clk); probe_clk_failed: pm_runtime_put_sync(dev); +probe_pm_failed: pm_runtime_disable(dev); return ret; } diff -Nru linux-aws-5.19.0/drivers/spi/spi-dw-bt1.c linux-aws-5.19.0/drivers/spi/spi-dw-bt1.c --- linux-aws-5.19.0/drivers/spi/spi-dw-bt1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-dw-bt1.c 2022-11-29 07:06:46.000000000 +0000 @@ -293,8 +293,10 @@ pm_runtime_enable(&pdev->dev); ret = dw_spi_add_host(&pdev->dev, dws); - if (ret) + if (ret) { + pm_runtime_disable(&pdev->dev); goto err_disable_clk; + } platform_set_drvdata(pdev, dwsbt1); diff -Nru linux-aws-5.19.0/drivers/spi/spi-meson-spicc.c linux-aws-5.19.0/drivers/spi/spi-meson-spicc.c --- linux-aws-5.19.0/drivers/spi/spi-meson-spicc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-meson-spicc.c 2022-11-29 07:06:46.000000000 +0000 @@ -537,7 +537,7 @@ struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return 0; return clk_divider_ops.recalc_rate(hw, parent_rate); @@ -549,7 +549,7 @@ struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.determine_rate(hw, req); @@ -561,7 +561,7 @@ struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.set_rate(hw, rate, parent_rate); diff -Nru linux-aws-5.19.0/drivers/spi/spi-mt7621.c linux-aws-5.19.0/drivers/spi/spi-mt7621.c --- linux-aws-5.19.0/drivers/spi/spi-mt7621.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-mt7621.c 2022-11-29 07:06:46.000000000 +0000 @@ -340,11 +340,9 @@ return PTR_ERR(base); clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", - status); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "unable to get SYS clock\n"); status = clk_prepare_enable(clk); if (status) diff -Nru linux-aws-5.19.0/drivers/spi/spi-omap-100k.c linux-aws-5.19.0/drivers/spi/spi-omap-100k.c --- linux-aws-5.19.0/drivers/spi/spi-omap-100k.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-omap-100k.c 2022-11-29 07:06:46.000000000 +0000 @@ -412,6 +412,7 @@ return status; err_fck: + pm_runtime_disable(&pdev->dev); clk_disable_unprepare(spi100k->fck); err_ick: clk_disable_unprepare(spi100k->ick); diff -Nru linux-aws-5.19.0/drivers/spi/spi-qup.c linux-aws-5.19.0/drivers/spi/spi-qup.c --- linux-aws-5.19.0/drivers/spi/spi-qup.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-qup.c 2022-11-29 07:06:46.000000000 +0000 @@ -1198,8 +1198,10 @@ return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } /* Disable clocks auto gaiting */ config = readl_relaxed(controller->base + QUP_CONFIG); @@ -1245,14 +1247,25 @@ return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) - return ret; + goto disable_clk; - return spi_master_resume(master); + ret = spi_master_resume(master); + if (ret) + goto disable_clk; + + return 0; + +disable_clk: + clk_disable_unprepare(controller->cclk); + clk_disable_unprepare(controller->iclk); + return ret; } #endif /* CONFIG_PM_SLEEP */ diff -Nru linux-aws-5.19.0/drivers/spi/spi-s3c64xx.c linux-aws-5.19.0/drivers/spi/spi-s3c64xx.c --- linux-aws-5.19.0/drivers/spi/spi-s3c64xx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/spi/spi-s3c64xx.c 2022-11-29 07:06:46.000000000 +0000 @@ -83,6 +83,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -663,6 +664,13 @@ return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1100,6 +1108,7 @@ master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->use_gpio_descriptors = true; master->dma_alignment = 8; diff -Nru linux-aws-5.19.0/drivers/spmi/spmi-pmic-arb.c linux-aws-5.19.0/drivers/spmi/spmi-pmic-arb.c --- linux-aws-5.19.0/drivers/spmi/spmi-pmic-arb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/spmi/spmi-pmic-arb.c 2022-11-29 07:06:46.000000000 +0000 @@ -992,7 +992,8 @@ * version 5, there is more than one APID mapped to each PPID. * The owner field for each of these mappings specifies the EE which is * allowed to write to the APID. The owner of the last (highest) APID - * for a given PPID will receive interrupts from the PPID. + * which has the IRQ owner bit set for a given PPID will receive + * interrupts from the PPID. */ for (i = 0; ; i++, apidd++) { offset = pmic_arb->ver_ops->apid_map_offset(i); @@ -1015,16 +1016,16 @@ apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; diff -Nru linux-aws-5.19.0/drivers/staging/greybus/audio_helper.c linux-aws-5.19.0/drivers/staging/greybus/audio_helper.c --- linux-aws-5.19.0/drivers/staging/greybus/audio_helper.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/greybus/audio_helper.c 2022-11-29 07:06:46.000000000 +0000 @@ -3,7 +3,6 @@ * Greybus Audio Sound SoC helper APIs */ -#include #include #include #include @@ -116,10 +115,6 @@ { int i; struct snd_soc_dapm_widget *w, *next_w; -#ifdef CONFIG_DEBUG_FS - struct dentry *parent = dapm->debugfs_dapm; - struct dentry *debugfs_w = NULL; -#endif mutex_lock(&dapm->card->dapm_mutex); for (i = 0; i < num; i++) { @@ -139,12 +134,6 @@ continue; } widget++; -#ifdef CONFIG_DEBUG_FS - if (!parent) - debugfs_w = debugfs_lookup(w->name, parent); - debugfs_remove(debugfs_w); - debugfs_w = NULL; -#endif gbaudio_dapm_free_widget(w); } mutex_unlock(&dapm->card->dapm_mutex); diff -Nru linux-aws-5.19.0/drivers/staging/media/meson/vdec/vdec_hevc.c linux-aws-5.19.0/drivers/staging/media/meson/vdec/vdec_hevc.c --- linux-aws-5.19.0/drivers/staging/media/meson/vdec/vdec_hevc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/media/meson/vdec/vdec_hevc.c 2022-11-29 07:06:46.000000000 +0000 @@ -167,8 +167,12 @@ clk_set_rate(core->vdec_hevc_clk, 666666666); ret = clk_prepare_enable(core->vdec_hevc_clk); - if (ret) + if (ret) { + if (core->platform->revision == VDEC_REVISION_G12A || + core->platform->revision == VDEC_REVISION_SM1) + clk_disable_unprepare(core->vdec_hevcf_clk); return ret; + } if (core->platform->revision == VDEC_REVISION_SM1) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, diff -Nru linux-aws-5.19.0/drivers/staging/media/rkvdec/rkvdec-h264.c linux-aws-5.19.0/drivers/staging/media/rkvdec/rkvdec-h264.c --- linux-aws-5.19.0/drivers/staging/media/rkvdec/rkvdec-h264.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/media/rkvdec/rkvdec-h264.c 2022-11-29 07:06:46.000000000 +0000 @@ -1175,8 +1175,8 @@ schedule_delayed_work(&rkvdec->watchdog_work, msecs_to_jiffies(2000)); - writel(0xffffffff, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); - writel(0xffffffff, rkvdec->regs + RKVDEC_REG_H264_ERR_E); + writel(0, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); + writel(0, rkvdec->regs + RKVDEC_REG_H264_ERR_E); writel(1, rkvdec->regs + RKVDEC_REG_PREF_LUMA_CACHE_COMMAND); writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); diff -Nru linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus.c linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus.c --- linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus.c 2022-11-29 07:06:46.000000000 +0000 @@ -422,6 +422,8 @@ if (!dev) return -ENOMEM; + platform_set_drvdata(pdev, dev); + dev->vfd = cedrus_video_device; dev->dev = &pdev->dev; dev->pdev = pdev; @@ -495,8 +497,6 @@ goto err_m2m_mc; } - platform_set_drvdata(pdev, dev); - return 0; err_m2m_mc: diff -Nru linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus_h265.c linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus_h265.c --- linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus_h265.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/media/sunxi/cedrus/cedrus_h265.c 2022-11-29 07:06:46.000000000 +0000 @@ -234,8 +234,9 @@ cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_FLUSH_BITS | VE_DEC_H265_TRIGGER_TYPE_N_BITS(tmp)); - while (cedrus_read(dev, VE_DEC_H265_STATUS) & VE_DEC_H265_STATUS_VLD_BUSY) - udelay(1); + + if (cedrus_wait_for(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_VLD_BUSY)) + dev_err_ratelimited(dev->dev, "timed out waiting to skip bits\n"); count += tmp; } diff -Nru linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/os_intfs.c linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/os_intfs.c --- linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/os_intfs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/os_intfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -18,6 +18,7 @@ MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); MODULE_AUTHOR("Realtek Semiconductor Corp."); MODULE_VERSION(DRIVERVERSION); +MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin"); #define CONFIG_BR_EXT_BRNAME "br0" #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */ diff -Nru linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/usb_intf.c linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/usb_intf.c --- linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/usb_intf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/r8188eu/os_dep/usb_intf.c 2022-11-29 07:06:46.000000000 +0000 @@ -28,6 +28,7 @@ /*=== Realtek demoboard ===*/ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill USB-N150 Nano */ /*=== Customer ID ===*/ /****** 8188EUS ********/ {USB_DEVICE(0x07B8, 0x8179)}, /* Abocom - Abocom */ diff -Nru linux-aws-5.19.0/drivers/staging/rtl8712/rtl8712_cmd.c linux-aws-5.19.0/drivers/staging/rtl8712/rtl8712_cmd.c --- linux-aws-5.19.0/drivers/staging/rtl8712/rtl8712_cmd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/rtl8712/rtl8712_cmd.c 2022-11-29 07:06:46.000000000 +0000 @@ -117,34 +117,6 @@ kfree(pdrvcmd->pbuf); } -static u8 read_macreg_hdl(struct _adapter *padapter, u8 *pbuf) -{ - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; - - /* invoke cmd->callback function */ - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; - if (!pcmd_callback) - r8712_free_cmd_obj(pcmd); - else - pcmd_callback(padapter, pcmd); - return H2C_SUCCESS; -} - -static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf) -{ - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; - - /* invoke cmd->callback function */ - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; - if (!pcmd_callback) - r8712_free_cmd_obj(pcmd); - else - pcmd_callback(padapter, pcmd); - return H2C_SUCCESS; -} - static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf) { struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; @@ -213,14 +185,6 @@ pcmd_r = NULL; switch (pcmd->cmdcode) { - case GEN_CMD_CODE(_Read_MACREG): - read_macreg_hdl(padapter, (u8 *)pcmd); - pcmd_r = pcmd; - break; - case GEN_CMD_CODE(_Write_MACREG): - write_macreg_hdl(padapter, (u8 *)pcmd); - pcmd_r = pcmd; - break; case GEN_CMD_CODE(_Read_BBREG): read_bbreg_hdl(padapter, (u8 *)pcmd); break; diff -Nru linux-aws-5.19.0/drivers/staging/rtl8723bs/core/rtw_cmd.c linux-aws-5.19.0/drivers/staging/rtl8723bs/core/rtw_cmd.c --- linux-aws-5.19.0/drivers/staging/rtl8723bs/core/rtw_cmd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/rtl8723bs/core/rtw_cmd.c 2022-11-29 07:06:46.000000000 +0000 @@ -161,8 +161,6 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - int res = 0; - init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp); @@ -175,18 +173,16 @@ pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); - if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM; - goto exit; - } + if (!pcmdpriv->cmd_allocated_buf) + return -ENOMEM; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM; - goto exit; + kfree(pcmdpriv->cmd_allocated_buf); + return -ENOMEM; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); @@ -196,8 +192,8 @@ pcmdpriv->rsp_cnt = 0; mutex_init(&pcmdpriv->sctx_mutex); -exit: - return res; + + return 0; } static void c2h_wk_callback(struct work_struct *work); diff -Nru linux-aws-5.19.0/drivers/staging/rtl8723bs/os_dep/os_intfs.c linux-aws-5.19.0/drivers/staging/rtl8723bs/os_dep/os_intfs.c --- linux-aws-5.19.0/drivers/staging/rtl8723bs/os_dep/os_intfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/rtl8723bs/os_dep/os_intfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -664,51 +664,36 @@ u8 rtw_init_drv_sw(struct adapter *padapter) { - u8 ret8 = _SUCCESS; - rtw_init_default_value(padapter); rtw_init_hal_com_default_value(padapter); - if (rtw_init_cmd_priv(&padapter->cmdpriv)) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_cmd_priv(&padapter->cmdpriv)) + return _FAIL; padapter->cmdpriv.padapter = padapter; - if (rtw_init_evt_priv(&padapter->evtpriv)) { - ret8 = _FAIL; - goto exit; - } - + if (rtw_init_evt_priv(&padapter->evtpriv)) + goto free_cmd_priv; - if (rtw_init_mlme_priv(padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_mlme_priv(padapter) == _FAIL) + goto free_evt_priv; init_mlme_ext_priv(padapter); - if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } - - if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) + goto free_mlme_ext; + + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) + goto free_xmit_priv; /* add for CONFIG_IEEE80211W, none 11w also can use */ spin_lock_init(&padapter->security_key_mutex); /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ /* memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */ - if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) + goto free_recv_priv; padapter->stapriv.padapter = padapter; padapter->setband = GHZ24_50; @@ -719,9 +704,26 @@ rtw_hal_dm_init(padapter); -exit: + return _SUCCESS; + +free_recv_priv: + _rtw_free_recv_priv(&padapter->recvpriv); + +free_xmit_priv: + _rtw_free_xmit_priv(&padapter->xmitpriv); + +free_mlme_ext: + free_mlme_ext_priv(&padapter->mlmeextpriv); + + rtw_free_mlme_priv(&padapter->mlmepriv); + +free_evt_priv: + rtw_free_evt_priv(&padapter->evtpriv); + +free_cmd_priv: + rtw_free_cmd_priv(&padapter->cmdpriv); - return ret8; + return _FAIL; } void rtw_cancel_all_timer(struct adapter *padapter) diff -Nru linux-aws-5.19.0/drivers/staging/vt6655/device_main.c linux-aws-5.19.0/drivers/staging/vt6655/device_main.c --- linux-aws-5.19.0/drivers/staging/vt6655/device_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/staging/vt6655/device_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -564,7 +564,7 @@ kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD0Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -610,7 +610,7 @@ kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD1Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -675,7 +675,7 @@ return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } @@ -715,7 +715,7 @@ return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } diff -Nru linux-aws-5.19.0/drivers/tee/tee_shm.c linux-aws-5.19.0/drivers/tee/tee_shm.c --- linux-aws-5.19.0/drivers/tee/tee_shm.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tee/tee_shm.c 2022-11-29 07:06:46.000000000 +0000 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "tee_private.h" diff -Nru linux-aws-5.19.0/drivers/thermal/cpufreq_cooling.c linux-aws-5.19.0/drivers/thermal/cpufreq_cooling.c --- linux-aws-5.19.0/drivers/thermal/cpufreq_cooling.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/thermal/cpufreq_cooling.c 2022-11-29 07:06:46.000000000 +0000 @@ -530,17 +530,17 @@ struct thermal_cooling_device_ops *cooling_ops; char *name; + if (IS_ERR_OR_NULL(policy)) { + pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); + return ERR_PTR(-EINVAL); + } + dev = get_cpu_device(policy->cpu); if (unlikely(!dev)) { pr_warn("No cpu device for cpu %d\n", policy->cpu); return ERR_PTR(-ENODEV); } - if (IS_ERR_OR_NULL(policy)) { - pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); - return ERR_PTR(-EINVAL); - } - i = cpufreq_table_count_valid_entries(policy); if (!i) { pr_debug("%s: CPUFreq table not found or has no valid entries\n", diff -Nru linux-aws-5.19.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c linux-aws-5.19.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c --- linux-aws-5.19.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c 2022-11-29 07:06:46.000000000 +0000 @@ -527,7 +527,7 @@ priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer, obj->package.elements[0].buffer.length, GFP_KERNEL); - if (!priv->data_vault) + if (ZERO_OR_NULL_PTR(priv->data_vault)) goto out_free; bin_attr_data_vault.private = priv->data_vault; @@ -597,7 +597,7 @@ goto free_imok; } - if (priv->data_vault) { + if (!ZERO_OR_NULL_PTR(priv->data_vault)) { result = sysfs_create_group(&pdev->dev.kobj, &data_attribute_group); if (result) @@ -615,7 +615,8 @@ free_sysfs: cleanup_odvp(priv); if (priv->data_vault) { - sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group); + if (!ZERO_OR_NULL_PTR(priv->data_vault)) + sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group); kfree(priv->data_vault); } free_uuid: @@ -647,7 +648,7 @@ if (!priv->rel_misc_dev_res) acpi_thermal_rel_misc_device_remove(priv->adev->handle); - if (priv->data_vault) + if (!ZERO_OR_NULL_PTR(priv->data_vault)) sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group); diff -Nru linux-aws-5.19.0/drivers/thermal/intel/intel_powerclamp.c linux-aws-5.19.0/drivers/thermal/intel/intel_powerclamp.c --- linux-aws-5.19.0/drivers/thermal/intel/intel_powerclamp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thermal/intel/intel_powerclamp.c 2022-11-29 07:06:46.000000000 +0000 @@ -532,8 +532,10 @@ /* prefer BSP */ control_cpu = 0; - if (!cpu_online(control_cpu)) - control_cpu = smp_processor_id(); + if (!cpu_online(control_cpu)) { + control_cpu = get_cpu(); + put_cpu(); + } clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); diff -Nru linux-aws-5.19.0/drivers/thermal/qcom/tsens-v0_1.c linux-aws-5.19.0/drivers/thermal/qcom/tsens-v0_1.c --- linux-aws-5.19.0/drivers/thermal/qcom/tsens-v0_1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thermal/qcom/tsens-v0_1.c 2022-11-29 07:06:46.000000000 +0000 @@ -604,7 +604,7 @@ struct tsens_plat_data data_8939 = { .num_sensors = 10, .ops = &ops_8939, - .hw_ids = (unsigned int []){ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10 }, + .hw_ids = (unsigned int []){ 0, 1, 2, 3, 5, 6, 7, 8, 9, 10 }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, diff -Nru linux-aws-5.19.0/drivers/thunderbolt/ctl.c linux-aws-5.19.0/drivers/thunderbolt/ctl.c --- linux-aws-5.19.0/drivers/thunderbolt/ctl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/ctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -407,7 +407,7 @@ static int tb_async_error(const struct ctl_pkg *pkg) { - const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg; + const struct cfg_error_pkg *error = pkg->buffer; if (pkg->frame.eof != TB_CFG_PKG_ERROR) return false; diff -Nru linux-aws-5.19.0/drivers/thunderbolt/icm.c linux-aws-5.19.0/drivers/thunderbolt/icm.c --- linux-aws-5.19.0/drivers/thunderbolt/icm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/icm.c 2022-11-29 07:06:46.000000000 +0000 @@ -2527,6 +2527,7 @@ tb->cm_ops = &icm_icl_ops; break; + case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI: case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI: icm->is_supported = icm_tgl_is_supported; icm->get_mode = icm_ar_get_mode; diff -Nru linux-aws-5.19.0/drivers/thunderbolt/nhi.c linux-aws-5.19.0/drivers/thunderbolt/nhi.c --- linux-aws-5.19.0/drivers/thunderbolt/nhi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/nhi.c 2022-11-29 07:06:46.000000000 +0000 @@ -28,7 +28,11 @@ #define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") #define RING_FIRST_USABLE_HOPID 1 - +/* + * Used with QUIRK_E2E to specify an unused HopID the Rx credits are + * transferred. + */ +#define RING_E2E_RESERVED_HOPID RING_FIRST_USABLE_HOPID /* * Minimal number of vectors when we use MSI-X. Two for control channel * Rx/Tx and the rest four are for cross domain DMA paths. @@ -38,7 +42,9 @@ #define NHI_MAILBOX_TIMEOUT 500 /* ms */ +/* Host interface quirks */ #define QUIRK_AUTO_CLEAR_INT BIT(0) +#define QUIRK_E2E BIT(1) static int ring_interrupt_index(struct tb_ring *ring) { @@ -458,8 +464,18 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) { + unsigned int start_hop = RING_FIRST_USABLE_HOPID; int ret = 0; + if (nhi->quirks & QUIRK_E2E) { + start_hop = RING_FIRST_USABLE_HOPID + 1; + if (ring->flags & RING_FLAG_E2E && !ring->is_tx) { + dev_dbg(&nhi->pdev->dev, "quirking E2E TX HopID %u -> %u\n", + ring->e2e_tx_hop, RING_E2E_RESERVED_HOPID); + ring->e2e_tx_hop = RING_E2E_RESERVED_HOPID; + } + } + spin_lock_irq(&nhi->lock); if (ring->hop < 0) { @@ -469,7 +485,7 @@ * Automatically allocate HopID from the non-reserved * range 1 .. hop_count - 1. */ - for (i = RING_FIRST_USABLE_HOPID; i < nhi->hop_count; i++) { + for (i = start_hop; i < nhi->hop_count; i++) { if (ring->is_tx) { if (!nhi->tx_rings[i]) { ring->hop = i; @@ -484,6 +500,11 @@ } } + if (ring->hop > 0 && ring->hop < start_hop) { + dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); + ret = -EINVAL; + goto err_unlock; + } if (ring->hop < 0 || ring->hop >= nhi->hop_count) { dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); ret = -EINVAL; @@ -1097,12 +1118,26 @@ static void nhi_check_quirks(struct tb_nhi *nhi) { - /* - * Intel hardware supports auto clear of the interrupt status - * reqister right after interrupt is being issued. - */ - if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) + if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) { + /* + * Intel hardware supports auto clear of the interrupt + * status register right after interrupt is being + * issued. + */ nhi->quirks |= QUIRK_AUTO_CLEAR_INT; + + switch (nhi->pdev->device) { + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI: + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: + /* + * Falcon Ridge controller needs the end-to-end + * flow control workaround to avoid losing Rx + * packets when RING_FLAG_E2E is set. + */ + nhi->quirks |= QUIRK_E2E; + break; + } + } } static int nhi_check_iommu_pdev(struct pci_dev *pdev, void *data) diff -Nru linux-aws-5.19.0/drivers/thunderbolt/nhi.h linux-aws-5.19.0/drivers/thunderbolt/nhi.h --- linux-aws-5.19.0/drivers/thunderbolt/nhi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/nhi.h 2022-11-29 07:06:46.000000000 +0000 @@ -55,6 +55,7 @@ * need for the PCI quirk anymore as we will use ICM also on Apple * hardware. */ +#define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI 0x1134 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI 0x1137 #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_NHI 0x157d #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_BRIDGE 0x157e diff -Nru linux-aws-5.19.0/drivers/thunderbolt/switch.c linux-aws-5.19.0/drivers/thunderbolt/switch.c --- linux-aws-5.19.0/drivers/thunderbolt/switch.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/switch.c 2022-11-29 07:06:46.000000000 +0000 @@ -2413,6 +2413,7 @@ * additional capabilities. */ sw->config.cmuv = USB4_VERSION_1_0; + sw->config.plug_events_delay = 0xa; /* Enumerate the switch */ ret = tb_sw_write(sw, (u32 *)&sw->config + 1, TB_CFG_SWITCH, @@ -2821,6 +2822,26 @@ tb_sw_info(sw, "failed to determine preferred buffer allocation, using defaults\n"); } +static int tb_switch_port_hotplug_enable(struct tb_switch *sw) +{ + struct tb_port *port; + + if (tb_switch_is_icm(sw)) + return 0; + + tb_switch_for_each_port(sw, port) { + int res; + + if (!port->cap_usb4) + continue; + + res = usb4_port_hotplug_enable(port); + if (res) + return res; + } + return 0; +} + /** * tb_switch_add() - Add a switch to the domain * @sw: Switch to add @@ -2890,6 +2911,10 @@ return ret; } + ret = tb_switch_port_hotplug_enable(sw); + if (ret) + return ret; + ret = device_add(&sw->dev); if (ret) { dev_err(&sw->dev, "failed to add device: %d\n", ret); @@ -3781,14 +3806,18 @@ */ int tb_switch_xhci_connect(struct tb_switch *sw) { - bool usb_port1, usb_port3, xhci_port1, xhci_port3; struct tb_port *port1, *port3; int ret; + if (sw->generation != 3) + return 0; + port1 = &sw->ports[1]; port3 = &sw->ports[3]; if (tb_switch_is_alpine_ridge(sw)) { + bool usb_port1, usb_port3, xhci_port1, xhci_port3; + usb_port1 = tb_lc_is_usb_plugged(port1); usb_port3 = tb_lc_is_usb_plugged(port3); xhci_port1 = tb_lc_is_xhci_connected(port1); diff -Nru linux-aws-5.19.0/drivers/thunderbolt/tb.h linux-aws-5.19.0/drivers/thunderbolt/tb.h --- linux-aws-5.19.0/drivers/thunderbolt/tb.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/tb.h 2022-11-29 07:06:46.000000000 +0000 @@ -1170,6 +1170,7 @@ void usb4_switch_remove_ports(struct tb_switch *sw); int usb4_port_unlock(struct tb_port *port); +int usb4_port_hotplug_enable(struct tb_port *port); int usb4_port_configure(struct tb_port *port); void usb4_port_unconfigure(struct tb_port *port); int usb4_port_configure_xdomain(struct tb_port *port); diff -Nru linux-aws-5.19.0/drivers/thunderbolt/tb_regs.h linux-aws-5.19.0/drivers/thunderbolt/tb_regs.h --- linux-aws-5.19.0/drivers/thunderbolt/tb_regs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/tb_regs.h 2022-11-29 07:06:46.000000000 +0000 @@ -302,6 +302,7 @@ #define ADP_CS_5 0x05 #define ADP_CS_5_LCA_MASK GENMASK(28, 22) #define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31) /* TMU adapter registers */ #define TMU_ADP_CS_3 0x03 diff -Nru linux-aws-5.19.0/drivers/thunderbolt/usb4.c linux-aws-5.19.0/drivers/thunderbolt/usb4.c --- linux-aws-5.19.0/drivers/thunderbolt/usb4.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/thunderbolt/usb4.c 2022-11-29 07:06:46.000000000 +0000 @@ -1046,6 +1046,26 @@ return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); } +/** + * usb4_port_hotplug_enable() - Enables hotplug for a port + * @port: USB4 port to operate on + * + * Enables hot plug events on a given port. This is only intended + * to be used on lane, DP-IN, and DP-OUT adapters. + */ +int usb4_port_hotplug_enable(struct tb_port *port) +{ + int ret; + u32 val; + + ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1); + if (ret) + return ret; + + val &= ~ADP_CS_5_DHP; + return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1); +} + static int usb4_port_set_configured(struct tb_port *port, bool configured) { int ret; diff -Nru linux-aws-5.19.0/drivers/tty/n_gsm.c linux-aws-5.19.0/drivers/tty/n_gsm.c --- linux-aws-5.19.0/drivers/tty/n_gsm.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/n_gsm.c 2022-11-29 07:06:46.000000000 +0000 @@ -248,7 +248,7 @@ bool constipated; /* Asked by remote to shut up */ bool has_devices; /* Devices were registered */ - spinlock_t tx_lock; + struct mutex tx_mutex; unsigned int tx_bytes; /* TX data outstanding */ #define TX_THRESH_HI 8192 #define TX_THRESH_LO 2048 @@ -256,7 +256,7 @@ struct list_head tx_data_list; /* Pending data packets */ /* Control messages */ - struct timer_list kick_timer; /* Kick TX queuing on timeout */ + struct delayed_work kick_timeout; /* Kick TX queuing on timeout */ struct timer_list t2_timer; /* Retransmit timer for commands */ int cretries; /* Command retry counter */ struct gsm_control *pending_cmd;/* Our current pending command */ @@ -680,7 +680,6 @@ struct gsm_msg *msg; u8 *dp; int ocr; - unsigned long flags; msg = gsm_data_alloc(gsm, addr, 0, control); if (!msg) @@ -702,10 +701,10 @@ gsm_print_packet("Q->", addr, cr, control, NULL, 0); - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); list_add_tail(&msg->list, &gsm->tx_ctrl_list); gsm->tx_bytes += msg->len; - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); gsmld_write_trigger(gsm); return 0; @@ -730,7 +729,7 @@ spin_unlock_irqrestore(&dlci->lock, flags); /* Clear data packets in MUX write queue */ - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) { if (msg->addr != addr) continue; @@ -738,7 +737,7 @@ list_del(&msg->list); kfree(msg); } - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); } /** @@ -1009,7 +1008,7 @@ gsm->tx_bytes += msg->len; gsmld_write_trigger(gsm); - mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); + schedule_delayed_work(&gsm->kick_timeout, 10 * gsm->t1 * HZ / 100); } /** @@ -1024,10 +1023,9 @@ static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) { - unsigned long flags; - spin_lock_irqsave(&dlci->gsm->tx_lock, flags); + mutex_lock(&dlci->gsm->tx_mutex); __gsm_data_queue(dlci, msg); - spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); + mutex_unlock(&dlci->gsm->tx_mutex); } /** @@ -1039,7 +1037,7 @@ * is data. Keep to the MRU of the mux. This path handles the usual tty * interface which is a byte stream with optional modem data. * - * Caller must hold the tx_lock of the mux. + * Caller must hold the tx_mutex of the mux. */ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) @@ -1099,7 +1097,7 @@ * is data. Keep to the MRU of the mux. This path handles framed data * queued as skbuffs to the DLCI. * - * Caller must hold the tx_lock of the mux. + * Caller must hold the tx_mutex of the mux. */ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, @@ -1115,7 +1113,7 @@ if (dlci->adaption == 4) overhead = 1; - /* dlci->skb is locked by tx_lock */ + /* dlci->skb is locked by tx_mutex */ if (dlci->skb == NULL) { dlci->skb = skb_dequeue_tail(&dlci->skb_list); if (dlci->skb == NULL) @@ -1169,7 +1167,7 @@ * Push an empty frame in to the transmit queue to update the modem status * bits and to transmit an optional break. * - * Caller must hold the tx_lock of the mux. + * Caller must hold the tx_mutex of the mux. */ static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci, @@ -1283,13 +1281,12 @@ static void gsm_dlci_data_kick(struct gsm_dlci *dlci) { - unsigned long flags; int sweep; if (dlci->constipated) return; - spin_lock_irqsave(&dlci->gsm->tx_lock, flags); + mutex_lock(&dlci->gsm->tx_mutex); /* If we have nothing running then we need to fire up */ sweep = (dlci->gsm->tx_bytes < TX_THRESH_LO); if (dlci->gsm->tx_bytes == 0) { @@ -1300,7 +1297,7 @@ } if (sweep) gsm_dlci_data_sweep(dlci->gsm); - spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); + mutex_unlock(&dlci->gsm->tx_mutex); } /* @@ -1984,24 +1981,23 @@ } /** - * gsm_kick_timer - transmit if possible - * @t: timer contained in our gsm object + * gsm_kick_timeout - transmit if possible + * @work: work contained in our gsm object * * Transmit data from DLCIs if the queue is empty. We can't rely on * a tty wakeup except when we filled the pipe so we need to fire off * new data ourselves in other cases. */ -static void gsm_kick_timer(struct timer_list *t) +static void gsm_kick_timeout(struct work_struct *work) { - struct gsm_mux *gsm = from_timer(gsm, t, kick_timer); - unsigned long flags; + struct gsm_mux *gsm = container_of(work, struct gsm_mux, kick_timeout.work); int sent = 0; - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); /* If we have nothing running then we need to fire up */ if (gsm->tx_bytes < TX_THRESH_LO) sent = gsm_dlci_data_sweep(gsm); - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); if (sent && debug & 4) pr_info("%s TX queue stalled\n", __func__); @@ -2458,7 +2454,7 @@ } /* Finish outstanding timers, making sure they are done */ - del_timer_sync(&gsm->kick_timer); + cancel_delayed_work_sync(&gsm->kick_timeout); del_timer_sync(&gsm->t2_timer); /* Finish writing to ldisc */ @@ -2501,13 +2497,6 @@ if (dlci == NULL) return -ENOMEM; - timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); - timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); - INIT_WORK(&gsm->tx_work, gsmld_write_task); - init_waitqueue_head(&gsm->event); - spin_lock_init(&gsm->control_lock); - spin_lock_init(&gsm->tx_lock); - if (gsm->encoding == 0) gsm->receive = gsm0_receive; else @@ -2538,6 +2527,7 @@ break; } } + mutex_destroy(&gsm->tx_mutex); mutex_destroy(&gsm->mutex); kfree(gsm->txframe); kfree(gsm->buf); @@ -2609,9 +2599,15 @@ } spin_lock_init(&gsm->lock); mutex_init(&gsm->mutex); + mutex_init(&gsm->tx_mutex); kref_init(&gsm->ref); INIT_LIST_HEAD(&gsm->tx_ctrl_list); INIT_LIST_HEAD(&gsm->tx_data_list); + INIT_DELAYED_WORK(&gsm->kick_timeout, gsm_kick_timeout); + timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); + INIT_WORK(&gsm->tx_work, gsmld_write_task); + init_waitqueue_head(&gsm->event); + spin_lock_init(&gsm->control_lock); gsm->t1 = T1; gsm->t2 = T2; @@ -2636,6 +2632,7 @@ } spin_unlock(&gsm_mux_lock); if (i == MAX_MUX) { + mutex_destroy(&gsm->tx_mutex); mutex_destroy(&gsm->mutex); kfree(gsm->txframe); kfree(gsm->buf); @@ -2791,17 +2788,16 @@ static void gsmld_write_task(struct work_struct *work) { struct gsm_mux *gsm = container_of(work, struct gsm_mux, tx_work); - unsigned long flags; int i, ret; /* All outstanding control channel and control messages and one data * frame is sent. */ ret = -ENODEV; - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); if (gsm->tty) ret = gsm_data_kick(gsm); - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); if (ret >= 0) for (i = 0; i < NUM_DLCI; i++) @@ -2858,7 +2854,8 @@ flags = *fp++; switch (flags) { case TTY_NORMAL: - gsm->receive(gsm, *cp); + if (gsm->receive) + gsm->receive(gsm, *cp); break; case TTY_OVERRUN: case TTY_BREAK: @@ -2946,10 +2943,6 @@ gsmld_attach_gsm(tty, gsm); - timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); - timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); - INIT_WORK(&gsm->tx_work, gsmld_write_task); - return 0; } @@ -3012,7 +3005,6 @@ const unsigned char *buf, size_t nr) { struct gsm_mux *gsm = tty->disc_data; - unsigned long flags; int space; int ret; @@ -3020,13 +3012,13 @@ return -ENODEV; ret = -ENOBUFS; - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); space = tty_write_room(tty); if (space >= nr) ret = tty->ops->write(tty, buf, nr); else set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); return ret; } @@ -3323,14 +3315,13 @@ static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk) { struct gsm_mux *gsm = dlci->gsm; - unsigned long flags; if (dlci->state != DLCI_OPEN || dlci->adaption != 2) return; - spin_lock_irqsave(&gsm->tx_lock, flags); + mutex_lock(&gsm->tx_mutex); gsm_dlci_modem_output(gsm, dlci, brk); - spin_unlock_irqrestore(&gsm->tx_lock, flags); + mutex_unlock(&gsm->tx_mutex); } /** diff -Nru linux-aws-5.19.0/drivers/tty/serial/8250/8250_core.c linux-aws-5.19.0/drivers/tty/serial/8250/8250_core.c --- linux-aws-5.19.0/drivers/tty/serial/8250/8250_core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/8250/8250_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -298,10 +298,9 @@ jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq(struct uart_8250_port *up) +static void univ8250_setup_timer(struct uart_8250_port *up) { struct uart_port *port = &up->port; - int retval = 0; /* * The above check will only give an accurate result the first time @@ -322,10 +321,16 @@ */ if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); - else - retval = serial_link_irq_chain(up); +} + +static int univ8250_setup_irq(struct uart_8250_port *up) +{ + struct uart_port *port = &up->port; + + if (port->irq) + return serial_link_irq_chain(up); - return retval; + return 0; } static void univ8250_release_irq(struct uart_8250_port *up) @@ -381,6 +386,7 @@ static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, }; static struct uart_8250_port serial8250_ports[UART_NR]; diff -Nru linux-aws-5.19.0/drivers/tty/serial/8250/8250_pci.c linux-aws-5.19.0/drivers/tty/serial/8250/8250_pci.c --- linux-aws-5.19.0/drivers/tty/serial/8250/8250_pci.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/8250/8250_pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -1232,6 +1232,10 @@ serial8250_do_set_mctrl(port, mctrl); } +/* + * We require EFR features for clock programming, so set UPF_FULL_PROBE + * for full probing regardless of CONFIG_SERIAL_8250_16550A_VARIANTS setting. + */ static int pci_oxsemi_tornado_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *up, int idx) @@ -1239,6 +1243,7 @@ struct pci_dev *dev = priv->dev; if (pci_oxsemi_tornado_p(dev)) { + up->port.flags |= UPF_FULL_PROBE; up->port.get_divisor = pci_oxsemi_tornado_get_divisor; up->port.set_divisor = pci_oxsemi_tornado_set_divisor; up->port.set_mctrl = pci_oxsemi_tornado_set_mctrl; diff -Nru linux-aws-5.19.0/drivers/tty/serial/8250/8250_port.c linux-aws-5.19.0/drivers/tty/serial/8250/8250_port.c --- linux-aws-5.19.0/drivers/tty/serial/8250/8250_port.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/8250/8250_port.c 2022-11-29 07:06:46.000000000 +0000 @@ -1029,7 +1029,8 @@ up->port.type = PORT_16550A; up->capabilities |= UART_CAP_FIFO; - if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS)) + if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS) && + !(up->port.flags & UPF_FULL_PROBE)) return; /* @@ -2302,6 +2303,10 @@ if (port->irq && (up->port.flags & UPF_SHARE_IRQ)) up->port.irqflags |= IRQF_SHARED; + retval = up->ops->setup_irq(up); + if (retval) + goto out; + if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; @@ -2344,9 +2349,7 @@ } } - retval = up->ops->setup_irq(up); - if (retval) - goto out; + up->ops->setup_timer(up); /* * Now, initialize the UART @@ -3322,8 +3325,13 @@ unsigned int baud, quot, frac = 0; termios.c_cflag = port->cons->cflag; - if (port->state->port.tty && termios.c_cflag == 0) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag == 0) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud = serial8250_get_baud_rate(port, &termios, NULL); quot = serial8250_get_divisor(port, baud, &frac); diff -Nru linux-aws-5.19.0/drivers/tty/serial/atmel_serial.c linux-aws-5.19.0/drivers/tty/serial/atmel_serial.c --- linux-aws-5.19.0/drivers/tty/serial/atmel_serial.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/atmel_serial.c 2022-11-29 07:06:46.000000000 +0000 @@ -296,9 +296,6 @@ mode = atmel_uart_readl(port, ATMEL_US_MR); - /* Resetting serial mode to RS232 (0x0) */ - mode &= ~ATMEL_US_USMODE; - if (rs485conf->flags & SER_RS485_ENABLED) { dev_dbg(port->dev, "Setting UART to RS485\n"); if (rs485conf->flags & SER_RS485_RX_DURING_TX) @@ -308,6 +305,7 @@ atmel_uart_writel(port, ATMEL_US_TTGR, rs485conf->delay_rts_after_send); + mode &= ~ATMEL_US_USMODE; mode |= ATMEL_US_USMODE_RS485; } else { dev_dbg(port->dev, "Setting UART to RS232\n"); diff -Nru linux-aws-5.19.0/drivers/tty/serial/cpm_uart/cpm_uart_core.c linux-aws-5.19.0/drivers/tty/serial/cpm_uart/cpm_uart_core.c --- linux-aws-5.19.0/drivers/tty/serial/cpm_uart/cpm_uart_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/cpm_uart/cpm_uart_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -1214,12 +1214,6 @@ pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; spin_lock_init(&pinfo->port.lock); - pinfo->port.irq = irq_of_parse_and_map(np, 0); - if (pinfo->port.irq == NO_IRQ) { - ret = -EINVAL; - goto out_pram; - } - for (i = 0; i < NUM_GPIOS; i++) { struct gpio_desc *gpiod; @@ -1229,7 +1223,7 @@ if (IS_ERR(gpiod)) { ret = PTR_ERR(gpiod); - goto out_irq; + goto out_pram; } if (gpiod) { @@ -1255,8 +1249,6 @@ return cpm_uart_request_port(&pinfo->port); -out_irq: - irq_dispose_mapping(pinfo->port.irq); out_pram: cpm_uart_unmap_pram(pinfo, pram); out_mem: @@ -1436,11 +1428,17 @@ /* initialize the device pointer for the port */ pinfo->port.dev = &ofdev->dev; + pinfo->port.irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); + if (!pinfo->port.irq) + return -EINVAL; + ret = cpm_uart_init_port(ofdev->dev.of_node, pinfo); - if (ret) - return ret; + if (!ret) + return uart_add_one_port(&cpm_reg, &pinfo->port); + + irq_dispose_mapping(pinfo->port.irq); - return uart_add_one_port(&cpm_reg, &pinfo->port); + return ret; } static int cpm_uart_remove(struct platform_device *ofdev) diff -Nru linux-aws-5.19.0/drivers/tty/serial/fsl_lpuart.c linux-aws-5.19.0/drivers/tty/serial/fsl_lpuart.c --- linux-aws-5.19.0/drivers/tty/serial/fsl_lpuart.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/fsl_lpuart.c 2022-11-29 07:06:46.000000000 +0000 @@ -1381,9 +1381,9 @@ * Note: UART is assumed to be active high. */ if (rs485->flags & SER_RS485_RTS_ON_SEND) - modem &= ~UARTMODEM_TXRTSPOL; - else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) modem |= UARTMODEM_TXRTSPOL; + else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) + modem &= ~UARTMODEM_TXRTSPOL; } writeb(modem, sport->port.membase + UARTMODEM); @@ -1768,6 +1768,7 @@ if (sport->lpuart_dma_rx_use) { del_timer_sync(&sport->lpuart_timer); lpuart_dma_rx_free(&sport->port); + sport->lpuart_dma_rx_use = false; } if (sport->lpuart_dma_tx_use) { @@ -1776,6 +1777,7 @@ sport->dma_tx_in_progress = false; dmaengine_terminate_all(sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; } if (sport->dma_tx_chan) @@ -2182,6 +2184,7 @@ uart_update_timeout(port, termios->c_cflag, baud); /* wait transmit engin complete */ + lpuart32_write(&sport->port, 0, UARTMODIR); lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); /* disable transmit and receive */ @@ -2705,14 +2708,15 @@ lpuart_reg.cons = LPUART_CONSOLE; handler = lpuart_int; } - ret = uart_add_one_port(&lpuart_reg, &sport->port); - if (ret) - goto failed_attach_port; ret = lpuart_global_reset(sport); if (ret) goto failed_reset; + ret = uart_add_one_port(&lpuart_reg, &sport->port); + if (ret) + goto failed_attach_port; + ret = uart_get_rs485_mode(&sport->port); if (ret) goto failed_get_rs485; @@ -2735,9 +2739,9 @@ failed_irq_request: failed_get_rs485: -failed_reset: uart_remove_one_port(&lpuart_reg, &sport->port); failed_attach_port: +failed_reset: lpuart_disable_clks(sport); return ret; } diff -Nru linux-aws-5.19.0/drivers/tty/serial/jsm/jsm_driver.c linux-aws-5.19.0/drivers/tty/serial/jsm/jsm_driver.c --- linux-aws-5.19.0/drivers/tty/serial/jsm/jsm_driver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/jsm/jsm_driver.c 2022-11-29 07:06:46.000000000 +0000 @@ -211,7 +211,8 @@ break; default: - return -ENXIO; + rc = -ENXIO; + goto out_kfree_brd; } rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd); diff -Nru linux-aws-5.19.0/drivers/tty/serial/serial-tegra.c linux-aws-5.19.0/drivers/tty/serial/serial-tegra.c --- linux-aws-5.19.0/drivers/tty/serial/serial-tegra.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/serial-tegra.c 2022-11-29 07:06:46.000000000 +0000 @@ -525,7 +525,7 @@ count = tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); spin_lock_irqsave(&tup->uport.lock, flags); - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress = 0; if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(&tup->uport); @@ -613,7 +613,6 @@ static void tegra_uart_stop_tx(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); - struct circ_buf *xmit = &tup->uport.state->xmit; struct dma_tx_state state; unsigned int count; @@ -624,7 +623,7 @@ dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); count = tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(&tup->uport, count); tup->tx_in_progress = 0; } diff -Nru linux-aws-5.19.0/drivers/tty/serial/stm32-usart.c linux-aws-5.19.0/drivers/tty/serial/stm32-usart.c --- linux-aws-5.19.0/drivers/tty/serial/stm32-usart.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/stm32-usart.c 2022-11-29 07:06:46.000000000 +0000 @@ -62,6 +62,53 @@ writel_relaxed(val, port->membase + reg); } +static unsigned int stm32_usart_tx_empty(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; + + if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) + return TIOCSER_TEMT; + + return 0; +} + +static void stm32_usart_rs485_rts_enable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } +} + +static void stm32_usart_rs485_rts_disable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } +} + static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, u32 delay_DDE, u32 baud) { @@ -145,6 +192,12 @@ stm32_usart_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); + /* Adjust RTS polarity in case it's driven in software */ + if (stm32_usart_tx_empty(port)) + stm32_usart_rs485_rts_disable(port); + else + stm32_usart_rs485_rts_enable(port); + return 0; } @@ -460,42 +513,6 @@ stm32_usart_clr_bits(port, ofs->cr1, USART_CR1_TCIE); } -static void stm32_usart_rs485_rts_enable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } -} - -static void stm32_usart_rs485_rts_disable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } -} - static void stm32_usart_transmit_chars_pio(struct uart_port *port) { struct stm32_port *stm32_port = to_stm32_port(port); @@ -738,17 +755,6 @@ return IRQ_HANDLED; } -static unsigned int stm32_usart_tx_empty(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; - - if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) - return TIOCSER_TEMT; - - return 0; -} - static void stm32_usart_set_mctrl(struct uart_port *port, unsigned int mctrl) { struct stm32_port *stm32_port = to_stm32_port(port); diff -Nru linux-aws-5.19.0/drivers/tty/serial/tegra-tcu.c linux-aws-5.19.0/drivers/tty/serial/tegra-tcu.c --- linux-aws-5.19.0/drivers/tty/serial/tegra-tcu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/tegra-tcu.c 2022-11-29 07:06:46.000000000 +0000 @@ -101,7 +101,7 @@ break; tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); + uart_xmit_advance(port, count); } uart_write_wakeup(port); diff -Nru linux-aws-5.19.0/drivers/tty/serial/xilinx_uartps.c linux-aws-5.19.0/drivers/tty/serial/xilinx_uartps.c --- linux-aws-5.19.0/drivers/tty/serial/xilinx_uartps.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/serial/xilinx_uartps.c 2022-11-29 07:06:46.000000000 +0000 @@ -361,6 +361,8 @@ isrstatus &= ~CDNS_UART_IXR_TXEMPTY; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask; /* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO. diff -Nru linux-aws-5.19.0/drivers/tty/vt/vt.c linux-aws-5.19.0/drivers/tty/vt/vt.c --- linux-aws-5.19.0/drivers/tty/vt/vt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/tty/vt/vt.c 2022-11-29 07:06:46.000000000 +0000 @@ -4662,9 +4662,11 @@ console_lock(); if (vc->vc_mode != KD_TEXT) rc = -EINVAL; - else if (vc->vc_sw->con_font_set) + else if (vc->vc_sw->con_font_set) { + if (vc_is_sel(vc)) + clear_selection(); rc = vc->vc_sw->con_font_set(vc, &font, op->flags); - else + } else rc = -ENOSYS; console_unlock(); kfree(font.data); @@ -4691,9 +4693,11 @@ console_unlock(); return -EINVAL; } - if (vc->vc_sw->con_font_default) + if (vc->vc_sw->con_font_default) { + if (vc_is_sel(vc)) + clear_selection(); rc = vc->vc_sw->con_font_default(vc, &font, s); - else + } else rc = -ENOSYS; console_unlock(); if (!rc) { diff -Nru linux-aws-5.19.0/drivers/ufs/core/ufshcd.c linux-aws-5.19.0/drivers/ufs/core/ufshcd.c --- linux-aws-5.19.0/drivers/ufs/core/ufshcd.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/ufs/core/ufshcd.c 2022-11-29 07:06:46.000000000 +0000 @@ -8723,6 +8723,8 @@ struct scsi_device *sdp; unsigned long flags; int ret, retries; + unsigned long deadline; + int32_t remaining; spin_lock_irqsave(hba->host->host_lock, flags); sdp = hba->ufs_device_wlun; @@ -8755,9 +8757,14 @@ * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ + deadline = jiffies + 10 * HZ; for (retries = 3; retries > 0; --retries) { + ret = -ETIMEDOUT; + remaining = deadline - jiffies; + if (remaining <= 0) + break; ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); + remaining / HZ, 0, 0, RQF_PM, NULL); if (!scsi_status_is_check_condition(ret) || !scsi_sense_valid(&sshdr) || sshdr.sense_key != UNIT_ATTENTION) @@ -9512,7 +9519,7 @@ ufs_bsg_remove(hba); ufshpb_remove(hba); ufs_sysfs_remove_nodes(hba->dev); - blk_cleanup_queue(hba->tmf_queue); + blk_mq_destroy_queue(hba->tmf_queue); blk_mq_free_tag_set(&hba->tmf_tag_set); scsi_remove_host(hba->host); /* disable interrupts */ @@ -9808,7 +9815,7 @@ return 0; free_tmf_queue: - blk_cleanup_queue(hba->tmf_queue); + blk_mq_destroy_queue(hba->tmf_queue); free_tmf_tag_set: blk_mq_free_tag_set(&hba->tmf_tag_set); out_remove_scsi_host: diff -Nru linux-aws-5.19.0/drivers/usb/cdns3/cdns3-gadget.c linux-aws-5.19.0/drivers/usb/cdns3/cdns3-gadget.c --- linux-aws-5.19.0/drivers/usb/cdns3/cdns3-gadget.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/cdns3/cdns3-gadget.c 2022-11-29 07:06:46.000000000 +0000 @@ -1530,7 +1530,8 @@ TRB_LEN(le32_to_cpu(trb->length)); if (priv_req->num_of_trb > 1 && - le32_to_cpu(trb->control) & TRB_SMM) + le32_to_cpu(trb->control) & TRB_SMM && + le32_to_cpu(trb->control) & TRB_CHAIN) transfer_end = true; cdns3_ep_inc_deq(priv_ep); @@ -1690,6 +1691,7 @@ ep_cfg &= ~EP_CFG_ENABLE; writel(ep_cfg, &priv_dev->regs->ep_cfg); priv_ep->flags &= ~EP_QUIRK_ISO_OUT_EN; + priv_ep->flags |= EP_UPDATE_EP_TRBADDR; } cdns3_transfer_completed(priv_dev, priv_ep); } else if (!(priv_ep->flags & EP_STALLED) && diff -Nru linux-aws-5.19.0/drivers/usb/class/cdc-acm.c linux-aws-5.19.0/drivers/usb/class/cdc-acm.c --- linux-aws-5.19.0/drivers/usb/class/cdc-acm.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/class/cdc-acm.c 2022-11-29 07:06:46.000000000 +0000 @@ -1810,6 +1810,9 @@ { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */ .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */ }, + { USB_DEVICE(0x0c26, 0x0020), /* Icom ICF3400 Serie */ + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ + }, { USB_DEVICE(0x0ca6, 0xa050), /* Castles VEGA3000 */ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ }, diff -Nru linux-aws-5.19.0/drivers/usb/common/debug.c linux-aws-5.19.0/drivers/usb/common/debug.c --- linux-aws-5.19.0/drivers/usb/common/debug.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/common/debug.c 2022-11-29 07:06:46.000000000 +0000 @@ -208,30 +208,28 @@ snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", wValue); } -/** - * usb_decode_ctrl - Returns human readable representation of control request. - * @str: buffer to return a human-readable representation of control request. - * This buffer should have about 200 bytes. - * @size: size of str buffer. - * @bRequestType: matches the USB bmRequestType field - * @bRequest: matches the USB bRequest field - * @wValue: matches the USB wValue field (CPU byte order) - * @wIndex: matches the USB wIndex field (CPU byte order) - * @wLength: matches the USB wLength field (CPU byte order) - * - * Function returns decoded, formatted and human-readable description of - * control request packet. - * - * The usage scenario for this is for tracepoints, so function as a return - * use the same value as in parameters. This approach allows to use this - * function in TP_printk - * - * Important: wValue, wIndex, wLength parameters before invoking this function - * should be processed by le16_to_cpu macro. - */ -const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, - __u8 bRequest, __u16 wValue, __u16 wIndex, - __u16 wLength) +static void usb_decode_ctrl_generic(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + u8 recip = bRequestType & USB_RECIP_MASK; + u8 type = bRequestType & USB_TYPE_MASK; + + snprintf(str, size, + "Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u", + (type == USB_TYPE_STANDARD) ? "Standard" : + (type == USB_TYPE_VENDOR) ? "Vendor" : + (type == USB_TYPE_CLASS) ? "Class" : "Unknown", + (recip == USB_RECIP_DEVICE) ? "Device" : + (recip == USB_RECIP_INTERFACE) ? "Interface" : + (recip == USB_RECIP_ENDPOINT) ? "Endpoint" : "Unknown", + (bRequestType & USB_DIR_IN) ? "IN" : "OUT", + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) { switch (bRequest) { case USB_REQ_GET_STATUS: @@ -272,14 +270,48 @@ usb_decode_set_isoch_delay(wValue, str, size); break; default: - snprintf(str, size, "%02x %02x %02x %02x %02x %02x %02x %02x", - bRequestType, bRequest, - (u8)(cpu_to_le16(wValue) & 0xff), - (u8)(cpu_to_le16(wValue) >> 8), - (u8)(cpu_to_le16(wIndex) & 0xff), - (u8)(cpu_to_le16(wIndex) >> 8), - (u8)(cpu_to_le16(wLength) & 0xff), - (u8)(cpu_to_le16(wLength) >> 8)); + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + } +} + +/** + * usb_decode_ctrl - Returns human readable representation of control request. + * @str: buffer to return a human-readable representation of control request. + * This buffer should have about 200 bytes. + * @size: size of str buffer. + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (CPU byte order) + * @wIndex: matches the USB wIndex field (CPU byte order) + * @wLength: matches the USB wLength field (CPU byte order) + * + * Function returns decoded, formatted and human-readable description of + * control request packet. + * + * The usage scenario for this is for tracepoints, so function as a return + * use the same value as in parameters. This approach allows to use this + * function in TP_printk + * + * Important: wValue, wIndex, wLength parameters before invoking this function + * should be processed by le16_to_cpu macro. + */ +const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + switch (bRequestType & USB_TYPE_MASK) { + case USB_TYPE_STANDARD: + usb_decode_ctrl_standard(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + case USB_TYPE_VENDOR: + case USB_TYPE_CLASS: + default: + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; } return str; diff -Nru linux-aws-5.19.0/drivers/usb/core/hub.c linux-aws-5.19.0/drivers/usb/core/hub.c --- linux-aws-5.19.0/drivers/usb/core/hub.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/core/hub.c 2022-11-29 07:06:46.000000000 +0000 @@ -6082,6 +6082,11 @@ * the reset is over (using their post_reset method). * * Return: The same as for usb_reset_and_verify_device(). + * However, if a reset is already in progress (for instance, if a + * driver doesn't have pre_reset() or post_reset() callbacks, and while + * being unbound or re-bound during the ongoing reset its disconnect() + * or probe() routine tries to perform a second, nested reset), the + * routine returns -EINPROGRESS. * * Note: * The caller must own the device lock. For example, it's safe to use @@ -6115,6 +6120,10 @@ return -EISDIR; } + if (udev->reset_in_progress) + return -EINPROGRESS; + udev->reset_in_progress = 1; + port_dev = hub->ports[udev->portnum - 1]; /* @@ -6179,6 +6188,7 @@ usb_autosuspend_device(udev); memalloc_noio_restore(noio_flag); + udev->reset_in_progress = 0; return ret; } EXPORT_SYMBOL_GPL(usb_reset_device); diff -Nru linux-aws-5.19.0/drivers/usb/core/quirks.c linux-aws-5.19.0/drivers/usb/core/quirks.c --- linux-aws-5.19.0/drivers/usb/core/quirks.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/core/quirks.c 2022-11-29 07:06:46.000000000 +0000 @@ -437,6 +437,10 @@ { USB_DEVICE(0x1532, 0x0116), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, diff -Nru linux-aws-5.19.0/drivers/usb/dwc2/platform.c linux-aws-5.19.0/drivers/usb/dwc2/platform.c --- linux-aws-5.19.0/drivers/usb/dwc2/platform.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc2/platform.c 2022-11-29 07:06:46.000000000 +0000 @@ -154,9 +154,9 @@ } else if (hsotg->plat && hsotg->plat->phy_init) { ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } else { - ret = phy_power_on(hsotg->phy); + ret = phy_init(hsotg->phy); if (ret == 0) - ret = phy_init(hsotg->phy); + ret = phy_power_on(hsotg->phy); } return ret; @@ -188,9 +188,9 @@ } else if (hsotg->plat && hsotg->plat->phy_exit) { ret = hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } else { - ret = phy_exit(hsotg->phy); + ret = phy_power_off(hsotg->phy); if (ret == 0) - ret = phy_power_off(hsotg->phy); + ret = phy_exit(hsotg->phy); } if (ret) return ret; diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/core.c linux-aws-5.19.0/drivers/usb/dwc3/core.c --- linux-aws-5.19.0/drivers/usb/dwc3/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -86,7 +85,7 @@ * mode. If the controller supports DRD but the dr_mode is not * specified or set to OTG, then set the mode to peripheral. */ - if (mode == USB_DR_MODE_OTG && !dwc->edev && + if (mode == USB_DR_MODE_OTG && (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) || !device_property_read_bool(dwc->dev, "usb-role-switch")) && !DWC3_VER_IS_PRIOR(DWC3, 330A)) @@ -408,6 +407,10 @@ reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1); + + if (dwc->gfladj_refclk_lpm_sel) + reg |= DWC3_GFLADJ_REFCLK_LPM_SEL; + dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); } @@ -789,7 +792,7 @@ else reg |= DWC3_GUSB2PHYCFG_ENBLSLPM; - if (dwc->dis_u2_freeclk_exists_quirk) + if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); @@ -833,15 +836,16 @@ { dwc3_event_buffers_cleanup(dwc); + usb_phy_set_suspend(dwc->usb2_phy, 1); + usb_phy_set_suspend(dwc->usb3_phy, 1); + phy_power_off(dwc->usb2_generic_phy); + phy_power_off(dwc->usb3_generic_phy); + usb_phy_shutdown(dwc->usb2_phy); usb_phy_shutdown(dwc->usb3_phy); phy_exit(dwc->usb2_generic_phy); phy_exit(dwc->usb3_generic_phy); - usb_phy_set_suspend(dwc->usb2_phy, 1); - usb_phy_set_suspend(dwc->usb3_phy, 1); - phy_power_off(dwc->usb2_generic_phy); - phy_power_off(dwc->usb3_generic_phy); dwc3_clk_disable(dwc); reset_control_assert(dwc->reset); } @@ -1145,6 +1149,21 @@ dwc3_writel(dwc->regs, DWC3_GUCTL2, reg); } + /* + * When configured in HOST mode, after issuing U3/L2 exit controller + * fails to send proper CRC checksum in CRC5 feild. Because of this + * behaviour Transaction Error is generated, resulting in reset and + * re-enumeration of usb device attached. All the termsel, xcvrsel, + * opmode becomes 0 during end of resume. Enabling bit 10 of GUCTL1 + * will correct this problem. This option is to support certain + * legacy ULPI PHYs. + */ + if (dwc->resume_hs_terminations) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); + reg |= DWC3_GUCTL1_RESUME_OPMODE_HS_HOST; + dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); + } + if (!DWC3_VER_IS_PRIOR(DWC3, 250A)) { reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); @@ -1488,8 +1507,12 @@ "snps,dis-del-phy-power-chg-quirk"); dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev, "snps,dis-tx-ipgap-linecheck-quirk"); + dwc->resume_hs_terminations = device_property_read_bool(dev, + "snps,resume-hs-terminations"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); + dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, + "snps,gfladj-refclk-lpm-sel-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); @@ -1633,46 +1656,6 @@ } } -static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) -{ - struct device *dev = dwc->dev; - struct device_node *np_phy; - struct extcon_dev *edev = NULL; - const char *name; - - if (device_property_read_bool(dev, "extcon")) - return extcon_get_edev_by_phandle(dev, 0); - - /* - * Device tree platforms should get extcon via phandle. - * On ACPI platforms, we get the name from a device property. - * This device property is for kernel internal use only and - * is expected to be set by the glue code. - */ - if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) - return extcon_get_extcon_dev(name); - - /* - * Try to get an extcon device from the USB PHY controller's "port" - * node. Check if it has the "port" node first, to avoid printing the - * error message from underlying code, as it's a valid case: extcon - * device (and "port" node) may be missing in case of "usb-role-switch" - * or OTG mode. - */ - np_phy = of_parse_phandle(dev->of_node, "phys", 0); - if (of_graph_is_present(np_phy)) { - struct device_node *np_conn; - - np_conn = of_graph_get_remote_node(np_phy, -1, -1); - if (np_conn) - edev = extcon_find_edev_by_node(np_conn); - of_node_put(np_conn); - } - of_node_put(np_phy); - - return edev; -} - static int dwc3_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1717,15 +1700,11 @@ dwc3_get_properties(dwc); - if (!dwc->sysdev_is_parent) { - ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); - if (ret) - return ret; - } - dwc->reset = devm_reset_control_array_get_optional_shared(dev); - if (IS_ERR(dwc->reset)) - return PTR_ERR(dwc->reset); + if (IS_ERR(dwc->reset)) { + ret = PTR_ERR(dwc->reset); + goto put_usb_psy; + } if (dev->of_node) { /* @@ -1735,45 +1714,57 @@ * check for them to retain backwards compatibility. */ dwc->bus_clk = devm_clk_get_optional(dev, "bus_early"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } if (dwc->bus_clk == NULL) { dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } } dwc->ref_clk = devm_clk_get_optional(dev, "ref"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } if (dwc->ref_clk == NULL) { dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } } dwc->susp_clk = devm_clk_get_optional(dev, "suspend"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } if (dwc->susp_clk == NULL) { dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } } } ret = reset_control_deassert(dwc->reset); if (ret) - return ret; + goto put_usb_psy; ret = dwc3_clk_enable(dwc); if (ret) @@ -1788,6 +1779,13 @@ platform_set_drvdata(pdev, dwc); dwc3_cache_hwparams(dwc); + if (!dwc->sysdev_is_parent && + DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) { + ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); + if (ret) + goto disable_clks; + } + spin_lock_init(&dwc->lock); mutex_init(&dwc->mutex); @@ -1808,13 +1806,6 @@ goto err2; } - dwc->edev = dwc3_get_extcon(dwc); - if (IS_ERR(dwc->edev)) { - ret = PTR_ERR(dwc->edev); - dev_err_probe(dwc->dev, ret, "failed to get extcon\n"); - goto err3; - } - ret = dwc3_get_dr_mode(dwc); if (ret) goto err3; @@ -1844,16 +1835,16 @@ dwc3_debugfs_exit(dwc); dwc3_event_buffers_cleanup(dwc); - usb_phy_shutdown(dwc->usb2_phy); - usb_phy_shutdown(dwc->usb3_phy); - phy_exit(dwc->usb2_generic_phy); - phy_exit(dwc->usb3_generic_phy); - usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1); phy_power_off(dwc->usb2_generic_phy); phy_power_off(dwc->usb3_generic_phy); + usb_phy_shutdown(dwc->usb2_phy); + usb_phy_shutdown(dwc->usb3_phy); + phy_exit(dwc->usb2_generic_phy); + phy_exit(dwc->usb3_generic_phy); + dwc3_ulpi_exit(dwc); err4: @@ -1873,7 +1864,7 @@ dwc3_clk_disable(dwc); assert_reset: reset_control_assert(dwc->reset); - +put_usb_psy: if (dwc->usb_psy) power_supply_put(dwc->usb_psy); diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/core.h linux-aws-5.19.0/drivers/usb/dwc3/core.h --- linux-aws-5.19.0/drivers/usb/dwc3/core.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/core.h 2022-11-29 07:06:46.000000000 +0000 @@ -262,6 +262,7 @@ #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10) @@ -390,6 +391,7 @@ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f #define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23) #define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24) #define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31) @@ -1093,6 +1095,8 @@ * change quirk. * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate * check during HS transmit. + * @resume-hs-terminations: Set if we enable quirk for fixing improper crc + * generation after resume from suspend. * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed * instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk @@ -1308,7 +1312,9 @@ unsigned dis_u2_freeclk_exists_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/drd.c linux-aws-5.19.0/drivers/usb/dwc3/drd.c --- linux-aws-5.19.0/drivers/usb/dwc3/drd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/drd.c 2022-11-29 07:06:46.000000000 +0000 @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -438,6 +439,51 @@ return NOTIFY_DONE; } +static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) +{ + struct device *dev = dwc->dev; + struct device_node *np_phy; + struct extcon_dev *edev = NULL; + const char *name; + + if (device_property_read_bool(dev, "extcon")) + return extcon_get_edev_by_phandle(dev, 0); + + /* + * Device tree platforms should get extcon via phandle. + * On ACPI platforms, we get the name from a device property. + * This device property is for kernel internal use only and + * is expected to be set by the glue code. + */ + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) { + edev = extcon_get_extcon_dev(name); + if (!edev) + return ERR_PTR(-EPROBE_DEFER); + + return edev; + } + + /* + * Try to get an extcon device from the USB PHY controller's "port" + * node. Check if it has the "port" node first, to avoid printing the + * error message from underlying code, as it's a valid case: extcon + * device (and "port" node) may be missing in case of "usb-role-switch" + * or OTG mode. + */ + np_phy = of_parse_phandle(dev->of_node, "phys", 0); + if (of_graph_is_present(np_phy)) { + struct device_node *np_conn; + + np_conn = of_graph_get_remote_node(np_phy, -1, -1); + if (np_conn) + edev = extcon_find_edev_by_node(np_conn); + of_node_put(np_conn); + } + of_node_put(np_phy); + + return edev; +} + #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH) #define ROLE_SWITCH 1 static int dwc3_usb_role_switch_set(struct usb_role_switch *sw, @@ -542,6 +588,10 @@ device_property_read_bool(dwc->dev, "usb-role-switch")) return dwc3_setup_role_switch(dwc); + dwc->edev = dwc3_get_extcon(dwc); + if (IS_ERR(dwc->edev)) + return PTR_ERR(dwc->edev); + if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/dwc3-pci.c linux-aws-5.19.0/drivers/usb/dwc3/dwc3-pci.c --- linux-aws-5.19.0/drivers/usb/dwc3/dwc3-pci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/dwc3-pci.c 2022-11-29 07:06:46.000000000 +0000 @@ -44,6 +44,7 @@ #define PCI_DEVICE_ID_INTEL_ADLP 0x51ee #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 +#define PCI_DEVICE_ID_INTEL_RPL 0x460e #define PCI_DEVICE_ID_INTEL_RPLS 0x7a61 #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1 #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e @@ -456,6 +457,9 @@ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), (kernel_ulong_t) &dwc3_pci_intel_swnode, }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL), + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS), (kernel_ulong_t) &dwc3_pci_intel_swnode, }, diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/gadget.c linux-aws-5.19.0/drivers/usb/dwc3/gadget.c --- linux-aws-5.19.0/drivers/usb/dwc3/gadget.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/gadget.c 2022-11-29 07:06:46.000000000 +0000 @@ -2538,9 +2538,6 @@ is_on = !!is_on; - if (dwc->pullups_connected == is_on) - return 0; - dwc->softconnect = is_on; /* @@ -2564,6 +2561,11 @@ pm_runtime_put(dwc->dev); return 0; } + + if (dwc->pullups_connected == is_on) { + pm_runtime_put(dwc->dev); + return 0; + } if (!is_on) { ret = dwc3_gadget_soft_disconnect(dwc); diff -Nru linux-aws-5.19.0/drivers/usb/dwc3/host.c linux-aws-5.19.0/drivers/usb/dwc3/host.c --- linux-aws-5.19.0/drivers/usb/dwc3/host.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/dwc3/host.c 2022-11-29 07:06:46.000000000 +0000 @@ -11,8 +11,13 @@ #include #include +#include "../host/xhci-plat.h" #include "core.h" +static const struct xhci_plat_priv dwc3_xhci_plat_priv = { + .quirks = XHCI_SKIP_PHY_INIT, +}; + static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, int irq, char *name) { @@ -92,6 +97,11 @@ goto err; } + ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, + sizeof(dwc3_xhci_plat_priv)); + if (ret) + goto err; + memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); if (dwc->usb3_lpm_capable) diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/f_fs.c linux-aws-5.19.0/drivers/usb/gadget/function/f_fs.c --- linux-aws-5.19.0/drivers/usb/gadget/function/f_fs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/f_fs.c 2022-11-29 07:06:46.000000000 +0000 @@ -2645,10 +2645,10 @@ unsigned i = 0; vla_group(d); vla_item(d, struct usb_gadget_strings *, stringtabs, - lang_count + 1); + size_add(lang_count, 1)); vla_item(d, struct usb_gadget_strings, stringtab, lang_count); vla_item(d, struct usb_string, strings, - lang_count*(needed_count+1)); + size_mul(lang_count, (needed_count + 1))); char *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL); diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/f_printer.c linux-aws-5.19.0/drivers/usb/gadget/function/f_printer.c --- linux-aws-5.19.0/drivers/usb/gadget/function/f_printer.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/f_printer.c 2022-11-29 07:06:46.000000000 +0000 @@ -89,7 +89,7 @@ u8 printer_cdev_open; wait_queue_head_t wait; unsigned q_len; - char *pnp_string; /* We don't own memory! */ + char **pnp_string; /* We don't own memory! */ struct usb_function function; }; @@ -1000,16 +1000,16 @@ if ((wIndex>>8) != dev->interface) break; - if (!dev->pnp_string) { + if (!*dev->pnp_string) { value = 0; break; } - value = strlen(dev->pnp_string); + value = strlen(*dev->pnp_string); buf[0] = (value >> 8) & 0xFF; buf[1] = value & 0xFF; - memcpy(buf + 2, dev->pnp_string, value); + memcpy(buf + 2, *dev->pnp_string, value); DBG(dev, "1284 PNP String: %x %s\n", value, - dev->pnp_string); + *dev->pnp_string); break; case GET_PORT_STATUS: /* Get Port Status */ @@ -1475,7 +1475,7 @@ kref_init(&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len; mutex_unlock(&opts->lock); diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/f_uac2.c linux-aws-5.19.0/drivers/usb/gadget/function/f_uac2.c --- linux-aws-5.19.0/drivers/usb/gadget/function/f_uac2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/f_uac2.c 2022-11-29 07:06:46.000000000 +0000 @@ -291,6 +291,12 @@ .bInterval = 4, }; +static struct usb_ss_ep_comp_descriptor ss_ep_int_desc_comp = { + .bLength = sizeof(ss_ep_int_desc_comp), + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, + .wBytesPerInterval = cpu_to_le16(6), +}; + /* Audio Streaming OUT Interface - Alt0 */ static struct usb_interface_descriptor std_as_out_if0_desc = { .bLength = sizeof std_as_out_if0_desc, @@ -604,7 +610,8 @@ (struct usb_descriptor_header *)&in_feature_unit_desc, (struct usb_descriptor_header *)&io_out_ot_desc, - (struct usb_descriptor_header *)&ss_ep_int_desc, + (struct usb_descriptor_header *)&ss_ep_int_desc, + (struct usb_descriptor_header *)&ss_ep_int_desc_comp, (struct usb_descriptor_header *)&std_as_out_if0_desc, (struct usb_descriptor_header *)&std_as_out_if1_desc, @@ -800,6 +807,7 @@ struct usb_ss_ep_comp_descriptor *epout_desc_comp = NULL; struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL; struct usb_ss_ep_comp_descriptor *epin_fback_desc_comp = NULL; + struct usb_ss_ep_comp_descriptor *ep_int_desc_comp = NULL; struct usb_endpoint_descriptor *epout_desc; struct usb_endpoint_descriptor *epin_desc; struct usb_endpoint_descriptor *epin_fback_desc; @@ -827,6 +835,7 @@ epin_fback_desc = &ss_epin_fback_desc; epin_fback_desc_comp = &ss_epin_fback_desc_comp; ep_int_desc = &ss_ep_int_desc; + ep_int_desc_comp = &ss_ep_int_desc_comp; } i = 0; @@ -855,8 +864,11 @@ if (EPOUT_EN(opts)) headers[i++] = USBDHDR(&io_out_ot_desc); - if (FUOUT_EN(opts) || FUIN_EN(opts)) + if (FUOUT_EN(opts) || FUIN_EN(opts)) { headers[i++] = USBDHDR(ep_int_desc); + if (ep_int_desc_comp) + headers[i++] = USBDHDR(ep_int_desc_comp); + } if (EPOUT_EN(opts)) { headers[i++] = USBDHDR(&std_as_out_if0_desc); diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/f_uvc.c linux-aws-5.19.0/drivers/usb/gadget/function/f_uvc.c --- linux-aws-5.19.0/drivers/usb/gadget/function/f_uvc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/f_uvc.c 2022-11-29 07:06:46.000000000 +0000 @@ -421,7 +421,7 @@ int ret; /* TODO reference counting. */ - memset(&uvc->vdev, 0, sizeof(uvc->video)); + memset(&uvc->vdev, 0, sizeof(uvc->vdev)); uvc->vdev.v4l2_dev = &uvc->v4l2_dev; uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev; uvc->vdev.fops = &uvc_v4l2_fops; @@ -897,10 +897,14 @@ { struct usb_composite_dev *cdev = c->cdev; struct uvc_device *uvc = to_uvc(f); + struct uvc_video *video = &uvc->video; long wait_ret = 1; uvcg_info(f, "%s()\n", __func__); + if (video->async_wq) + destroy_workqueue(video->async_wq); + /* * If we know we're connected via v4l2, then there should be a cleanup * of the device from userspace either via UVC_EVENT_DISCONNECT or diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/storage_common.c linux-aws-5.19.0/drivers/usb/gadget/function/storage_common.c --- linux-aws-5.19.0/drivers/usb/gadget/function/storage_common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/storage_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -294,8 +294,10 @@ void store_cdrom_address(u8 *dest, int msf, u32 addr) { if (msf) { - /* Convert to Minutes-Seconds-Frames */ - addr >>= 2; /* Convert to 2048-byte frames */ + /* + * Convert to Minutes-Seconds-Frames. + * Sector size is already set to 2048 bytes. + */ addr += 2*75; /* Lead-in occupies 2 seconds */ dest[3] = addr % 75; /* Frames */ addr /= 75; diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/uvc.h linux-aws-5.19.0/drivers/usb/gadget/function/uvc.h --- linux-aws-5.19.0/drivers/usb/gadget/function/uvc.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/uvc.h 2022-11-29 07:06:46.000000000 +0000 @@ -88,6 +88,7 @@ struct usb_ep *ep; struct work_struct pump; + struct workqueue_struct *async_wq; /* Frame parameters */ u8 bpp; diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/uvc_v4l2.c linux-aws-5.19.0/drivers/usb/gadget/function/uvc_v4l2.c --- linux-aws-5.19.0/drivers/usb/gadget/function/uvc_v4l2.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/uvc_v4l2.c 2022-11-29 07:06:46.000000000 +0000 @@ -170,7 +170,7 @@ return ret; if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } diff -Nru linux-aws-5.19.0/drivers/usb/gadget/function/uvc_video.c linux-aws-5.19.0/drivers/usb/gadget/function/uvc_video.c --- linux-aws-5.19.0/drivers/usb/gadget/function/uvc_video.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/function/uvc_video.c 2022-11-29 07:06:46.000000000 +0000 @@ -277,7 +277,7 @@ spin_unlock_irqrestore(&video->req_lock, flags); if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); } static int @@ -485,7 +485,7 @@ video->req_int_count = 0; - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } @@ -499,6 +499,11 @@ spin_lock_init(&video->req_lock); INIT_WORK(&video->pump, uvcg_video_pump); + /* Allocate a work queue for asynchronous video pump handler. */ + video->async_wq = alloc_workqueue("uvcgadget", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!video->async_wq) + return -EINVAL; + video->uvc = uvc; video->fcc = V4L2_PIX_FMT_YUYV; video->bpp = 16; diff -Nru linux-aws-5.19.0/drivers/usb/gadget/udc/core.c linux-aws-5.19.0/drivers/usb/gadget/udc/core.c --- linux-aws-5.19.0/drivers/usb/gadget/udc/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/gadget/udc/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -736,7 +736,10 @@ ret = gadget->ops->pullup(gadget, 0); if (!ret) { gadget->connected = 0; - gadget->udc->driver->disconnect(gadget); + mutex_lock(&udc_lock); + if (gadget->udc->driver) + gadget->udc->driver->disconnect(gadget); + mutex_unlock(&udc_lock); } out: @@ -1489,7 +1492,6 @@ usb_gadget_udc_set_speed(udc, driver->max_speed); - mutex_lock(&udc_lock); ret = driver->bind(udc->gadget, driver); if (ret) goto err_bind; @@ -1499,7 +1501,6 @@ goto err_start; usb_gadget_enable_async_callbacks(udc); usb_udc_connect_control(udc); - mutex_unlock(&udc_lock); kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); return 0; @@ -1512,6 +1513,7 @@ dev_err(&udc->dev, "failed to start %s: %d\n", driver->function, ret); + mutex_lock(&udc_lock); udc->driver = NULL; driver->is_bound = false; mutex_unlock(&udc_lock); @@ -1529,7 +1531,6 @@ kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); - mutex_lock(&udc_lock); usb_gadget_disconnect(gadget); usb_gadget_disable_async_callbacks(udc); if (gadget->irq) @@ -1537,6 +1538,7 @@ udc->driver->unbind(gadget); usb_gadget_udc_stop(udc); + mutex_lock(&udc_lock); driver->is_bound = false; udc->driver = NULL; mutex_unlock(&udc_lock); @@ -1612,7 +1614,7 @@ struct usb_udc *udc = container_of(dev, struct usb_udc, dev); ssize_t ret; - mutex_lock(&udc_lock); + device_lock(&udc->gadget->dev); if (!udc->driver) { dev_err(dev, "soft-connect without a gadget driver\n"); ret = -EOPNOTSUPP; @@ -1633,7 +1635,7 @@ ret = n; out: - mutex_unlock(&udc_lock); + device_unlock(&udc->gadget->dev); return ret; } static DEVICE_ATTR_WO(soft_connect); @@ -1652,11 +1654,15 @@ char *buf) { struct usb_udc *udc = container_of(dev, struct usb_udc, dev); - struct usb_gadget_driver *drv = udc->driver; + struct usb_gadget_driver *drv; + int rc = 0; - if (!drv || !drv->function) - return 0; - return scnprintf(buf, PAGE_SIZE, "%s\n", drv->function); + mutex_lock(&udc_lock); + drv = udc->driver; + if (drv && drv->function) + rc = scnprintf(buf, PAGE_SIZE, "%s\n", drv->function); + mutex_unlock(&udc_lock); + return rc; } static DEVICE_ATTR_RO(function); diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci.c linux-aws-5.19.0/drivers/usb/host/xhci.c --- linux-aws-5.19.0/drivers/usb/host/xhci.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci.c 2022-11-29 07:06:46.000000000 +0000 @@ -151,9 +151,11 @@ xhci_err(xhci, "Host took too long to start, " "waited %u microseconds.\n", XHCI_MAX_HALT_USEC); - if (!ret) + if (!ret) { /* clear state flags. Including dying, halted or removing */ xhci->xhc_state = 0; + xhci->run_graceperiod = jiffies + msecs_to_jiffies(500); + } return ret; } @@ -791,8 +793,6 @@ void xhci_shutdown(struct usb_hcd *hcd) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); - unsigned long flags; - int i; if (xhci->quirks & XHCI_SPURIOUS_REBOOT) usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); @@ -808,21 +808,12 @@ del_timer_sync(&xhci->shared_hcd->rh_timer); } - spin_lock_irqsave(&xhci->lock, flags); + spin_lock_irq(&xhci->lock); xhci_halt(xhci); - - /* Power off USB2 ports*/ - for (i = 0; i < xhci->usb2_rhub.num_ports; i++) - xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags); - - /* Power off USB3 ports*/ - for (i = 0; i < xhci->usb3_rhub.num_ports; i++) - xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags); - /* Workaround for spurious wakeups at shutdown with HSW */ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) xhci_reset(xhci, XHCI_RESET_SHORT_USEC); - spin_unlock_irqrestore(&xhci->lock, flags); + spin_unlock_irq(&xhci->lock); xhci_cleanup_msix(xhci); @@ -1192,7 +1183,8 @@ /* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE | STS_HCE)) { reinit_xhc = true; - xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); + if (!xhci->broken_suspend) + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); } if (reinit_xhc) { diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci-dbgcap.c linux-aws-5.19.0/drivers/usb/host/xhci-dbgcap.c --- linux-aws-5.19.0/drivers/usb/host/xhci-dbgcap.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci-dbgcap.c 2022-11-29 07:06:46.000000000 +0000 @@ -988,7 +988,7 @@ dbc->driver = driver; if (readl(&dbc->regs->control) & DBC_CTRL_DBC_ENABLE) - return NULL; + goto err; INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events); spin_lock_init(&dbc->lock); diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci.h linux-aws-5.19.0/drivers/usb/host/xhci.h --- linux-aws-5.19.0/drivers/usb/host/xhci.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci.h 2022-11-29 07:06:46.000000000 +0000 @@ -1826,7 +1826,7 @@ /* Host controller watchdog timer structures */ unsigned int xhc_state; - + unsigned long run_graceperiod; u32 command; struct s3_save s3; /* Host controller is dying - not responding to commands. "I'm not dead yet!" @@ -1899,6 +1899,7 @@ #define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_BROKEN_D3COLD BIT_ULL(41) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) unsigned int num_active_eps; unsigned int limit_active_eps; @@ -2196,8 +2197,6 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd); -void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index, - bool on, unsigned long *flags); void xhci_hc_died(struct xhci_hcd *xhci); diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci-hub.c linux-aws-5.19.0/drivers/usb/host/xhci-hub.c --- linux-aws-5.19.0/drivers/usb/host/xhci-hub.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci-hub.c 2022-11-29 07:06:46.000000000 +0000 @@ -652,7 +652,7 @@ * It will release and re-aquire the lock while calling ACPI * method. */ -void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, +static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index, bool on, unsigned long *flags) __must_hold(&xhci->lock) { @@ -1648,6 +1648,17 @@ status = bus_state->resuming_ports; + /* + * SS devices are only visible to roothub after link training completes. + * Keep polling roothubs for a grace period after xHC start + */ + if (xhci->run_graceperiod) { + if (time_before(jiffies, xhci->run_graceperiod)) + status = 1; + else + xhci->run_graceperiod = 0; + } + mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; /* For each port, did anything change? If so, set that bit in buf. */ diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci-mem.c linux-aws-5.19.0/drivers/usb/host/xhci-mem.c --- linux-aws-5.19.0/drivers/usb/host/xhci-mem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci-mem.c 2022-11-29 07:06:46.000000000 +0000 @@ -641,7 +641,7 @@ num_stream_ctxs, &stream_info->ctx_array_dma, mem_flags); if (!stream_info->stream_ctx_array) - goto cleanup_ctx; + goto cleanup_ring_array; memset(stream_info->stream_ctx_array, 0, sizeof(struct xhci_stream_ctx)*num_stream_ctxs); @@ -702,6 +702,11 @@ } xhci_free_command(xhci, stream_info->free_streams_command); cleanup_ctx: + xhci_free_stream_ctx(xhci, + stream_info->num_stream_ctxs, + stream_info->stream_ctx_array, + stream_info->ctx_array_dma); +cleanup_ring_array: kfree(stream_info->stream_rings); cleanup_info: kfree(stream_info); diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci-mtk-sch.c linux-aws-5.19.0/drivers/usb/host/xhci-mtk-sch.c --- linux-aws-5.19.0/drivers/usb/host/xhci-mtk-sch.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci-mtk-sch.c 2022-11-29 07:06:46.000000000 +0000 @@ -425,7 +425,6 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) { - u32 extra_cs_count; u32 start_ss, last_ss; u32 start_cs, last_cs; @@ -461,18 +460,12 @@ if (last_cs > 7) return -ESCH_CS_OVERFLOW; - if (sch_ep->ep_type == ISOC_IN_EP) - extra_cs_count = (last_cs == 7) ? 1 : 2; - else /* ep_type : INTR IN / INTR OUT */ - extra_cs_count = 1; - - cs_count += extra_cs_count; if (cs_count > 7) cs_count = 7; /* HW limit */ sch_ep->cs_count = cs_count; - /* one for ss, the other for idle */ - sch_ep->num_budget_microframes = cs_count + 2; + /* ss, idle are ignored */ + sch_ep->num_budget_microframes = cs_count; /* * if interval=1, maxp >752, num_budge_micoframe is larger @@ -771,8 +764,8 @@ if (ret) return ret; - if (ep->hcpriv) - drop_ep_quirk(hcd, udev, ep); + /* needn't check @ep->hcpriv, xhci_endpoint_disable set it NULL */ + drop_ep_quirk(hcd, udev, ep); return 0; } diff -Nru linux-aws-5.19.0/drivers/usb/host/xhci-plat.c linux-aws-5.19.0/drivers/usb/host/xhci-plat.c --- linux-aws-5.19.0/drivers/usb/host/xhci-plat.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/host/xhci-plat.c 2022-11-29 07:06:46.000000000 +0000 @@ -123,7 +123,7 @@ }; static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks = XHCI_RESET_ON_RESUME, + .quirks = XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; static const struct of_device_id usb_xhci_of_match[] = { @@ -398,12 +398,17 @@ pm_runtime_get_sync(&dev->dev); xhci->xhc_state |= XHCI_STATE_REMOVING; - usb_remove_hcd(shared_hcd); - xhci->shared_hcd = NULL; + if (shared_hcd) { + usb_remove_hcd(shared_hcd); + xhci->shared_hcd = NULL; + } + usb_phy_shutdown(hcd->usb_phy); usb_remove_hcd(hcd); - usb_put_hcd(shared_hcd); + + if (shared_hcd) + usb_put_hcd(shared_hcd); clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); @@ -432,7 +437,16 @@ * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ - return xhci_suspend(xhci, device_may_wakeup(dev)); + ret = xhci_suspend(xhci, device_may_wakeup(dev)); + if (ret) + return ret; + + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_disable_unprepare(xhci->clk); + clk_disable_unprepare(xhci->reg_clk); + } + + return 0; } static int __maybe_unused xhci_plat_resume(struct device *dev) @@ -441,6 +455,11 @@ struct xhci_hcd *xhci = hcd_to_xhci(hcd); 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 = xhci_priv_resume_quirk(hcd); if (ret) return ret; diff -Nru linux-aws-5.19.0/drivers/usb/misc/idmouse.c linux-aws-5.19.0/drivers/usb/misc/idmouse.c --- linux-aws-5.19.0/drivers/usb/misc/idmouse.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/misc/idmouse.c 2022-11-29 07:06:46.000000000 +0000 @@ -177,10 +177,6 @@ bytes_read += bulk_read; } - /* reset the device */ -reset: - ftip_command(dev, FTIP_RELEASE, 0, 0); - /* check for valid image */ /* right border should be black (0x00) */ for (bytes_read = sizeof(HEADER)-1 + WIDTH-1; bytes_read < IMGSIZE; bytes_read += WIDTH) @@ -192,6 +188,10 @@ if (dev->bulk_in_buffer[bytes_read] != 0xFF) return -EAGAIN; + /* reset the device */ +reset: + ftip_command(dev, FTIP_RELEASE, 0, 0); + /* should be IMGSIZE == 65040 */ dev_dbg(&dev->interface->dev, "read %d bytes fingerprint data\n", bytes_read); diff -Nru linux-aws-5.19.0/drivers/usb/mon/mon_bin.c linux-aws-5.19.0/drivers/usb/mon/mon_bin.c --- linux-aws-5.19.0/drivers/usb/mon/mon_bin.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/mon/mon_bin.c 2022-11-29 07:06:46.000000000 +0000 @@ -1268,6 +1268,11 @@ { /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops = &mon_bin_vm_ops; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + vma->vm_flags &= ~VM_MAYWRITE; vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; vma->vm_private_data = filp->private_data; mon_bin_vma_open(vma); diff -Nru linux-aws-5.19.0/drivers/usb/mtu3/mtu3_core.c linux-aws-5.19.0/drivers/usb/mtu3/mtu3_core.c --- linux-aws-5.19.0/drivers/usb/mtu3/mtu3_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/mtu3/mtu3_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -971,8 +971,6 @@ goto irq_err; } - device_init_wakeup(dev, true); - /* power down device IP for power saving by default */ mtu3_stop(mtu); diff -Nru linux-aws-5.19.0/drivers/usb/mtu3/mtu3_plat.c linux-aws-5.19.0/drivers/usb/mtu3/mtu3_plat.c --- linux-aws-5.19.0/drivers/usb/mtu3/mtu3_plat.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/mtu3/mtu3_plat.c 2022-11-29 07:06:46.000000000 +0000 @@ -332,6 +332,8 @@ pm_runtime_enable(dev); pm_runtime_get_sync(dev); + device_init_wakeup(dev, true); + ret = ssusb_rscs_init(ssusb); if (ret) goto comm_init_err; diff -Nru linux-aws-5.19.0/drivers/usb/musb/Kconfig linux-aws-5.19.0/drivers/usb/musb/Kconfig --- linux-aws-5.19.0/drivers/usb/musb/Kconfig 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/musb/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -86,7 +86,7 @@ tristate "TUSB6010" depends on HAS_IOMEM depends on ARCH_OMAP2PLUS || COMPILE_TEST - depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules + depends on NOP_USB_XCEIV!=m || USB_MUSB_HDRC=m config USB_MUSB_OMAP2PLUS tristate "OMAP2430 and onwards" diff -Nru linux-aws-5.19.0/drivers/usb/musb/musb_gadget.c linux-aws-5.19.0/drivers/usb/musb/musb_gadget.c --- linux-aws-5.19.0/drivers/usb/musb/musb_gadget.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/musb/musb_gadget.c 2022-11-29 07:06:46.000000000 +0000 @@ -760,6 +760,9 @@ musb_writew(epio, MUSB_RXCSR, csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int)fifo_count); musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count; diff -Nru linux-aws-5.19.0/drivers/usb/serial/ch341.c linux-aws-5.19.0/drivers/usb/serial/ch341.c --- linux-aws-5.19.0/drivers/usb/serial/ch341.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/ch341.c 2022-11-29 07:06:46.000000000 +0000 @@ -97,7 +97,10 @@ u8 mcr; u8 msr; u8 lcr; + unsigned long quirks; + u8 version; + unsigned long break_end; }; @@ -250,8 +253,12 @@ /* * CH341A buffers data until a full endpoint-size packet (32 bytes) * has been received unless bit 7 is set. + * + * At least one device with version 0x27 appears to have this bit + * inverted. */ - val |= BIT(7); + if (priv->version > 0x27) + val |= BIT(7); r = ch341_control_out(dev, CH341_REQ_WRITE_REG, CH341_REG_DIVISOR << 8 | CH341_REG_PRESCALER, @@ -265,6 +272,9 @@ * (stop bits, parity and word length). Version 0x30 and above use * CH341_REG_LCR only and CH341_REG_LCR2 is always set to zero. */ + if (priv->version < 0x30) + return 0; + r = ch341_control_out(dev, CH341_REQ_WRITE_REG, CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr); if (r) @@ -308,7 +318,9 @@ r = ch341_control_in(dev, CH341_REQ_READ_VERSION, 0, 0, buffer, size); if (r) return r; - dev_dbg(&dev->dev, "Chip version: 0x%02x\n", buffer[0]); + + priv->version = buffer[0]; + dev_dbg(&dev->dev, "Chip version: 0x%02x\n", priv->version); r = ch341_control_out(dev, CH341_REQ_SERIAL_INIT, 0, 0); if (r < 0) diff -Nru linux-aws-5.19.0/drivers/usb/serial/cp210x.c linux-aws-5.19.0/drivers/usb/serial/cp210x.c --- linux-aws-5.19.0/drivers/usb/serial/cp210x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/cp210x.c 2022-11-29 07:06:46.000000000 +0000 @@ -130,6 +130,7 @@ { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */ { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ + { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */ { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */ diff -Nru linux-aws-5.19.0/drivers/usb/serial/ftdi_sio.c linux-aws-5.19.0/drivers/usb/serial/ftdi_sio.c --- linux-aws-5.19.0/drivers/usb/serial/ftdi_sio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/ftdi_sio.c 2022-11-29 07:06:46.000000000 +0000 @@ -1045,6 +1045,8 @@ /* IDS GmbH devices */ { USB_DEVICE(IDS_VID, IDS_SI31A_PID) }, { USB_DEVICE(IDS_VID, IDS_CM31A_PID) }, + /* Omron devices */ + { USB_DEVICE(OMRON_VID, OMRON_CS1W_CIF31_PID) }, /* U-Blox devices */ { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, @@ -1317,8 +1319,7 @@ case 38400: div_value = ftdi_sio_b38400; break; case 57600: div_value = ftdi_sio_b57600; break; case 115200: div_value = ftdi_sio_b115200; break; - } /* baud */ - if (div_value == 0) { + default: dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n", __func__, baud); div_value = ftdi_sio_b9600; diff -Nru linux-aws-5.19.0/drivers/usb/serial/ftdi_sio_ids.h linux-aws-5.19.0/drivers/usb/serial/ftdi_sio_ids.h --- linux-aws-5.19.0/drivers/usb/serial/ftdi_sio_ids.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/ftdi_sio_ids.h 2022-11-29 07:06:46.000000000 +0000 @@ -662,6 +662,12 @@ #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */ /* + * Omron corporation (https://www.omron.com) + */ + #define OMRON_VID 0x0590 + #define OMRON_CS1W_CIF31_PID 0x00b2 + +/* * Acton Research Corp. */ #define ACTON_VID 0x0647 /* Vendor ID */ diff -Nru linux-aws-5.19.0/drivers/usb/serial/option.c linux-aws-5.19.0/drivers/usb/serial/option.c --- linux-aws-5.19.0/drivers/usb/serial/option.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/option.c 2022-11-29 07:06:46.000000000 +0000 @@ -253,8 +253,10 @@ #define QUECTEL_PRODUCT_BG96 0x0296 #define QUECTEL_PRODUCT_EP06 0x0306 #define QUECTEL_PRODUCT_EM05G 0x030a +#define QUECTEL_PRODUCT_EM060K 0x030b #define QUECTEL_PRODUCT_EM12 0x0512 #define QUECTEL_PRODUCT_RM500Q 0x0800 +#define QUECTEL_PRODUCT_RM520N 0x0801 #define QUECTEL_PRODUCT_EC200S_CN 0x6002 #define QUECTEL_PRODUCT_EC200T 0x6026 #define QUECTEL_PRODUCT_RM500K 0x7001 @@ -438,6 +440,8 @@ #define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9 #define CINTERION_PRODUCT_MV32_WA 0x00f1 #define CINTERION_PRODUCT_MV32_WB 0x00f2 +#define CINTERION_PRODUCT_MV32_WA_RMNET 0x00f3 +#define CINTERION_PRODUCT_MV32_WB_RMNET 0x00f4 /* Olivetti products */ #define OLIVETTI_VENDOR_ID 0x0b3c @@ -573,6 +577,10 @@ #define WETELECOM_PRODUCT_6802 0x6802 #define WETELECOM_PRODUCT_WMD300 0x6803 +/* OPPO products */ +#define OPPO_VENDOR_ID 0x22d9 +#define OPPO_PRODUCT_R11 0x276c + /* Device flags */ @@ -1131,6 +1139,8 @@ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), .driver_info = NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0203, 0xff), /* BG95-M3 */ + .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), @@ -1138,6 +1148,9 @@ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff), .driver_info = RSVD(6) | ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, @@ -1149,6 +1162,9 @@ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), .driver_info = ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) }, @@ -1993,8 +2009,12 @@ .driver_info = RSVD(0)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), .driver_info = RSVD(3)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA_RMNET, 0xff), + .driver_info = RSVD(0) }, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff), .driver_info = RSVD(3)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB_RMNET, 0xff), + .driver_info = RSVD(0) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), .driver_info = RSVD(4) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), @@ -2155,6 +2175,7 @@ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ { 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) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); diff -Nru linux-aws-5.19.0/drivers/usb/serial/qcserial.c linux-aws-5.19.0/drivers/usb/serial/qcserial.c --- linux-aws-5.19.0/drivers/usb/serial/qcserial.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/serial/qcserial.c 2022-11-29 07:06:46.000000000 +0000 @@ -177,6 +177,7 @@ {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ + {DEVICE_SWI(0x413c, 0x81c2)}, /* Dell Wireless 5811e */ {DEVICE_SWI(0x413c, 0x81cb)}, /* Dell Wireless 5816e QDL */ {DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */ {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */ diff -Nru linux-aws-5.19.0/drivers/usb/storage/unusual_devs.h linux-aws-5.19.0/drivers/usb/storage/unusual_devs.h --- linux-aws-5.19.0/drivers/usb/storage/unusual_devs.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/storage/unusual_devs.h 2022-11-29 07:06:46.000000000 +0000 @@ -1275,12 +1275,6 @@ USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100, - "Samsung", - "Flash Drive FIT", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64), - /* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya", @@ -2301,6 +2295,13 @@ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), +/* Reported by Witold Lipieta */ +UNUSUAL_DEV( 0x1fc9, 0x0117, 0x0100, 0x0100, + "NXP Semiconductors", + "PN7462AU", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE ), + /* Supplied with some Castlewood ORB removable drives */ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, "Double-H Technology", diff -Nru linux-aws-5.19.0/drivers/usb/storage/unusual_uas.h linux-aws-5.19.0/drivers/usb/storage/unusual_uas.h --- linux-aws-5.19.0/drivers/usb/storage/unusual_uas.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/storage/unusual_uas.h 2022-11-29 07:06:46.000000000 +0000 @@ -52,6 +52,13 @@ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x090c, 0x2000, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI * commands in UAS mode. Observed with the 1.28 firmware; are there others? @@ -62,6 +69,13 @@ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_IGNORE_UAS), +/* Reported-by: Tom Hu */ +UNUSUAL_DEV(0x0b05, 0x1932, 0x0000, 0x9999, + "ASUS", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: David Webb */ UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, "Seagate", @@ -69,6 +83,13 @@ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_LUNS), +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x0bda, 0x9210, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Benjamin Tissoires */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation", @@ -111,6 +132,13 @@ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x17ef, 0x3899, 0x0000, 0x9999, + "Thinkplus", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Hans de Goede */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, "VIA", diff -Nru linux-aws-5.19.0/drivers/usb/typec/altmodes/displayport.c linux-aws-5.19.0/drivers/usb/typec/altmodes/displayport.c --- linux-aws-5.19.0/drivers/usb/typec/altmodes/displayport.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/typec/altmodes/displayport.c 2022-11-29 07:06:46.000000000 +0000 @@ -99,8 +99,8 @@ case DP_STATUS_CON_UFP_D: case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */ conf |= DP_CONF_UFP_U_AS_UFP_D; - pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) & - DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo); + pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) & + DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo); break; default: break; diff -Nru linux-aws-5.19.0/drivers/usb/typec/mux/intel_pmc_mux.c linux-aws-5.19.0/drivers/usb/typec/mux/intel_pmc_mux.c --- linux-aws-5.19.0/drivers/usb/typec/mux/intel_pmc_mux.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/typec/mux/intel_pmc_mux.c 2022-11-29 07:06:46.000000000 +0000 @@ -571,9 +571,11 @@ static int is_memory(struct acpi_resource *res, void *data) { - struct resource r; + struct resource_win win = {}; + struct resource *r = &win.res; - return !acpi_dev_resource_memory(res, &r); + return !(acpi_dev_resource_memory(res, r) || + acpi_dev_resource_address_space(res, &win)); } /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */ @@ -583,6 +585,9 @@ /* AlderLake */ { "INTC1079", 0x160, }, + + /* Meteor Lake */ + { "INTC107A", 0x160, }, {} }; diff -Nru linux-aws-5.19.0/drivers/usb/typec/tcpm/tcpm.c linux-aws-5.19.0/drivers/usb/typec/tcpm/tcpm.c --- linux-aws-5.19.0/drivers/usb/typec/tcpm/tcpm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/typec/tcpm/tcpm.c 2022-11-29 07:06:46.000000000 +0000 @@ -6191,6 +6191,13 @@ struct tcpm_port *port = power_supply_get_drvdata(psy); int ret; + /* + * All the properties below are related to USB PD. The check needs to be + * property specific when a non-pd related property is added. + */ + if (!port->pd_supported) + return -EOPNOTSUPP; + switch (psp) { case POWER_SUPPLY_PROP_ONLINE: ret = tcpm_psy_set_online(port, val); diff -Nru linux-aws-5.19.0/drivers/usb/typec/ucsi/ucsi.c linux-aws-5.19.0/drivers/usb/typec/ucsi/ucsi.c --- linux-aws-5.19.0/drivers/usb/typec/ucsi/ucsi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/usb/typec/ucsi/ucsi.c 2022-11-29 07:06:46.000000000 +0000 @@ -588,8 +588,6 @@ num_pdos * sizeof(u32)); if (ret < 0 && ret != -ETIMEDOUT) dev_err(ucsi->dev, "UCSI_GET_PDOS failed (%d)\n", ret); - if (ret == 0 && offset == 0) - dev_warn(ucsi->dev, "UCSI_GET_PDOS returned 0 bytes\n"); return ret; } @@ -1069,11 +1067,9 @@ cap->fwnode = ucsi_find_fwnode(con); con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode); - if (IS_ERR(con->usb_role_sw)) { - dev_err(ucsi->dev, "con%d: failed to get usb role switch\n", - con->num); - return PTR_ERR(con->usb_role_sw); - } + if (IS_ERR(con->usb_role_sw)) + return dev_err_probe(ucsi->dev, PTR_ERR(con->usb_role_sw), + "con%d: failed to get usb role switch\n", con->num); /* Delay other interactions with the con until registration is complete */ mutex_lock(&con->lock); @@ -1200,32 +1196,6 @@ return ret; } -static void ucsi_unregister_connectors(struct ucsi *ucsi) -{ - struct ucsi_connector *con; - int i; - - if (!ucsi->connector) - return; - - for (i = 0; i < ucsi->cap.num_connectors; i++) { - con = &ucsi->connector[i]; - - if (!con->wq) - break; - - cancel_work_sync(&con->work); - ucsi_unregister_partner(con); - ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON); - ucsi_unregister_port_psy(con); - destroy_workqueue(con->wq); - typec_unregister_port(con->port); - } - - kfree(ucsi->connector); - ucsi->connector = NULL; -} - /** * ucsi_init - Initialize UCSI interface * @ucsi: UCSI to be initialized @@ -1234,6 +1204,7 @@ */ static int ucsi_init(struct ucsi *ucsi) { + struct ucsi_connector *con; u64 command; int ret; int i; @@ -1264,7 +1235,7 @@ } /* Allocate the connectors. Released in ucsi_unregister() */ - ucsi->connector = kcalloc(ucsi->cap.num_connectors, + ucsi->connector = kcalloc(ucsi->cap.num_connectors + 1, sizeof(*ucsi->connector), GFP_KERNEL); if (!ucsi->connector) { ret = -ENOMEM; @@ -1288,7 +1259,15 @@ return 0; err_unregister: - ucsi_unregister_connectors(ucsi); + for (con = ucsi->connector; con->port; con++) { + ucsi_unregister_partner(con); + ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON); + ucsi_unregister_port_psy(con); + if (con->wq) + destroy_workqueue(con->wq); + typec_unregister_port(con->port); + con->port = NULL; + } err_reset: memset(&ucsi->cap, 0, sizeof(ucsi->cap)); @@ -1402,6 +1381,7 @@ void ucsi_unregister(struct ucsi *ucsi) { u64 cmd = UCSI_SET_NOTIFICATION_ENABLE; + int i; /* Make sure that we are not in the middle of driver initialization */ cancel_delayed_work_sync(&ucsi->work); @@ -1409,7 +1389,18 @@ /* Disable notifications */ ucsi->ops->async_write(ucsi, UCSI_CONTROL, &cmd, sizeof(cmd)); - ucsi_unregister_connectors(ucsi); + for (i = 0; i < ucsi->cap.num_connectors; i++) { + cancel_work_sync(&ucsi->connector[i].work); + ucsi_unregister_partner(&ucsi->connector[i]); + ucsi_unregister_altmodes(&ucsi->connector[i], + UCSI_RECIPIENT_CON); + ucsi_unregister_port_psy(&ucsi->connector[i]); + if (ucsi->connector[i].wq) + destroy_workqueue(ucsi->connector[i].wq); + typec_unregister_port(ucsi->connector[i].port); + } + + kfree(ucsi->connector); } EXPORT_SYMBOL_GPL(ucsi_unregister); diff -Nru linux-aws-5.19.0/drivers/vdpa/ifcvf/ifcvf_base.c linux-aws-5.19.0/drivers/vdpa/ifcvf/ifcvf_base.c --- linux-aws-5.19.0/drivers/vdpa/ifcvf/ifcvf_base.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/vdpa/ifcvf/ifcvf_base.c 2022-11-29 07:06:46.000000000 +0000 @@ -315,7 +315,7 @@ u32 q_pair_id; ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id = qid / hw->nr_vring; + q_pair_id = qid / 2; avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; last_avail_idx = vp_ioread16(avail_idx_addr); @@ -329,7 +329,7 @@ u32 q_pair_id; ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id = qid / hw->nr_vring; + q_pair_id = qid / 2; avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; hw->vring[qid].last_avail_idx = num; vp_iowrite16(num, avail_idx_addr); diff -Nru linux-aws-5.19.0/drivers/vdpa/mlx5/net/mlx5_vnet.c linux-aws-5.19.0/drivers/vdpa/mlx5/net/mlx5_vnet.c --- linux-aws-5.19.0/drivers/vdpa/mlx5/net/mlx5_vnet.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/vdpa/mlx5/net/mlx5_vnet.c 2022-11-29 07:06:46.000000000 +0000 @@ -1297,6 +1297,8 @@ static int create_rqt(struct mlx5_vdpa_net *ndev) { + int rqt_table_size = roundup_pow_of_two(ndev->rqt_size); + int act_sz = roundup_pow_of_two(ndev->cur_num_vqs / 2); __be32 *list; void *rqtc; int inlen; @@ -1304,7 +1306,7 @@ int i, j; int err; - inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num); + inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + rqt_table_size * MLX5_ST_SZ_BYTES(rq_num); in = kzalloc(inlen, GFP_KERNEL); if (!in) return -ENOMEM; @@ -1313,12 +1315,12 @@ rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context); MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q); - MLX5_SET(rqtc, rqtc, rqt_max_size, ndev->rqt_size); + MLX5_SET(rqtc, rqtc, rqt_max_size, rqt_table_size); list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]); - for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2) + for (i = 0, j = 0; i < act_sz; i++, j += 2) list[i] = cpu_to_be32(ndev->vqs[j % ndev->cur_num_vqs].virtq_id); - MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size); + MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz); err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev->res.rqtn); kfree(in); if (err) @@ -1331,6 +1333,7 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num) { + int act_sz = roundup_pow_of_two(num / 2); __be32 *list; void *rqtc; int inlen; @@ -1338,7 +1341,7 @@ int i, j; int err; - inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num); + inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + act_sz * MLX5_ST_SZ_BYTES(rq_num); in = kzalloc(inlen, GFP_KERNEL); if (!in) return -ENOMEM; @@ -1349,10 +1352,10 @@ MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q); list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]); - for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2) + for (i = 0, j = 0; i < act_sz; i++, j = j + 2) list[i] = cpu_to_be32(ndev->vqs[j % num].virtq_id); - MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size); + MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz); err = mlx5_vdpa_modify_rqt(&ndev->mvdev, in, inlen, ndev->res.rqtn); kfree(in); if (err) diff -Nru linux-aws-5.19.0/drivers/vdpa/vdpa_user/vduse_dev.c linux-aws-5.19.0/drivers/vdpa/vdpa_user/vduse_dev.c --- linux-aws-5.19.0/drivers/vdpa/vdpa_user/vduse_dev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/vdpa/vdpa_user/vduse_dev.c 2022-11-29 07:06:46.000000000 +0000 @@ -662,10 +662,15 @@ { struct vduse_dev *dev = vdpa_to_vduse(vdpa); - if (offset > dev->config_size || - len > dev->config_size - offset) + /* Initialize the buffer in case of partial copy. */ + memset(buf, 0, len); + + if (offset > dev->config_size) return; + if (len > dev->config_size - offset) + len = dev->config_size - offset; + memcpy(buf, dev->config + offset, len); } diff -Nru linux-aws-5.19.0/drivers/vfio/vfio_iommu_type1.c linux-aws-5.19.0/drivers/vfio/vfio_iommu_type1.c --- linux-aws-5.19.0/drivers/vfio/vfio_iommu_type1.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/drivers/vfio/vfio_iommu_type1.c 2022-11-29 07:06:46.000000000 +0000 @@ -559,6 +559,18 @@ ret = pin_user_pages_remote(mm, vaddr, npages, flags | FOLL_LONGTERM, pages, NULL, NULL); if (ret > 0) { + int i; + + /* + * The zero page is always resident, we don't need to pin it + * and it falls into our invalid/reserved test so we don't + * unpin in put_pfn(). Unpin all zero pages in the batch here. + */ + for (i = 0 ; i < ret; i++) { + if (unlikely(is_zero_pfn(page_to_pfn(pages[i])))) + unpin_user_page(pages[i]); + } + *pfn = page_to_pfn(pages[0]); goto done; } diff -Nru linux-aws-5.19.0/drivers/vhost/vsock.c linux-aws-5.19.0/drivers/vhost/vsock.c --- linux-aws-5.19.0/drivers/vhost/vsock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/vhost/vsock.c 2022-11-29 07:06:46.000000000 +0000 @@ -393,7 +393,7 @@ return NULL; } - pkt->buf = kmalloc(pkt->len, GFP_KERNEL); + pkt->buf = kvmalloc(pkt->len, GFP_KERNEL); if (!pkt->buf) { kfree(pkt); return NULL; diff -Nru linux-aws-5.19.0/drivers/video/fbdev/chipsfb.c linux-aws-5.19.0/drivers/video/fbdev/chipsfb.c --- linux-aws-5.19.0/drivers/video/fbdev/chipsfb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/video/fbdev/chipsfb.c 2022-11-29 07:06:46.000000000 +0000 @@ -430,6 +430,7 @@ err_release_fb: framebuffer_release(p); err_disable: + pci_disable_device(dp); err_out: return rc; } diff -Nru linux-aws-5.19.0/drivers/video/fbdev/core/fbsysfs.c linux-aws-5.19.0/drivers/video/fbdev/core/fbsysfs.c --- linux-aws-5.19.0/drivers/video/fbdev/core/fbsysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/video/fbdev/core/fbsysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -84,6 +84,10 @@ if (WARN_ON(refcount_read(&info->count))) return; +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) + mutex_destroy(&info->bl_curve_mutex); +#endif + kfree(info->apertures); kfree(info); } diff -Nru linux-aws-5.19.0/drivers/video/fbdev/omap/omapfb_main.c linux-aws-5.19.0/drivers/video/fbdev/omap/omapfb_main.c --- linux-aws-5.19.0/drivers/video/fbdev/omap/omapfb_main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/video/fbdev/omap/omapfb_main.c 2022-11-29 07:06:46.000000000 +0000 @@ -1643,14 +1643,14 @@ goto cleanup; } fbdev->int_irq = platform_get_irq(pdev, 0); - if (!fbdev->int_irq) { + if (fbdev->int_irq < 0) { dev_err(&pdev->dev, "unable to get irq\n"); r = ENXIO; goto cleanup; } fbdev->ext_irq = platform_get_irq(pdev, 1); - if (!fbdev->ext_irq) { + if (fbdev->ext_irq < 0) { dev_err(&pdev->dev, "unable to get irq\n"); r = ENXIO; goto cleanup; diff -Nru linux-aws-5.19.0/drivers/video/fbdev/smscufx.c linux-aws-5.19.0/drivers/video/fbdev/smscufx.c --- linux-aws-5.19.0/drivers/video/fbdev/smscufx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/video/fbdev/smscufx.c 2022-11-29 07:06:46.000000000 +0000 @@ -137,6 +137,8 @@ static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size); static void ufx_free_urb_list(struct ufx_data *dev); +static DEFINE_MUTEX(disconnect_mutex); + /* reads a control register */ static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data) { @@ -1071,9 +1073,13 @@ if (user == 0 && !console) return -EBUSY; + mutex_lock(&disconnect_mutex); + /* If the USB device is gone, we don't accept new opens */ - if (dev->virtualized) + if (dev->virtualized) { + mutex_unlock(&disconnect_mutex); return -ENODEV; + } dev->fb_count++; @@ -1097,6 +1103,8 @@ pr_debug("open /dev/fb%d user=%d fb_info=%p count=%d", info->node, user, info, dev->fb_count); + mutex_unlock(&disconnect_mutex); + return 0; } @@ -1741,6 +1749,8 @@ { struct ufx_data *dev; + mutex_lock(&disconnect_mutex); + dev = usb_get_intfdata(interface); pr_debug("USB disconnect starting\n"); @@ -1761,6 +1771,8 @@ kref_put(&dev->kref, ufx_free); /* consider ufx_data freed */ + + mutex_unlock(&disconnect_mutex); } static struct usb_driver ufx_driver = { diff -Nru linux-aws-5.19.0/drivers/video/fbdev/stifb.c linux-aws-5.19.0/drivers/video/fbdev/stifb.c --- linux-aws-5.19.0/drivers/video/fbdev/stifb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/video/fbdev/stifb.c 2022-11-29 07:06:46.000000000 +0000 @@ -1298,7 +1298,7 @@ /* limit fbsize to max visible screen size */ if (fix->smem_len > yres*fix->line_length) - fix->smem_len = yres*fix->line_length; + fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024); fix->accel = FB_ACCEL_NONE; diff -Nru linux-aws-5.19.0/drivers/xen/gntdev.c linux-aws-5.19.0/drivers/xen/gntdev.c --- linux-aws-5.19.0/drivers/xen/gntdev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/xen/gntdev.c 2022-11-29 07:06:46.000000000 +0000 @@ -286,6 +286,9 @@ */ } + if (use_ptemod && map->notifier_init) + mmu_interval_notifier_remove(&map->notifier); + if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { notify_remote_via_evtchn(map->notify.event); evtchn_put(map->notify.event); @@ -298,7 +301,7 @@ static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) { struct gntdev_grant_map *map = data; - unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT; + unsigned int pgnr = (addr - map->pages_vm_start) >> PAGE_SHIFT; int flags = map->flags | GNTMAP_application_map | GNTMAP_contains_pte | (1 << _GNTMAP_guest_avail0); u64 pte_maddr; @@ -367,8 +370,7 @@ for (i = 0; i < map->count; i++) { if (map->map_ops[i].status == GNTST_okay) { map->unmap_ops[i].handle = map->map_ops[i].handle; - if (!use_ptemod) - alloced++; + alloced++; } else if (!err) err = -EINVAL; @@ -377,8 +379,7 @@ if (use_ptemod) { if (map->kmap_ops[i].status == GNTST_okay) { - if (map->map_ops[i].status == GNTST_okay) - alloced++; + alloced++; map->kunmap_ops[i].handle = map->kmap_ops[i].handle; } else if (!err) err = -EINVAL; @@ -394,8 +395,14 @@ unsigned int i; struct gntdev_grant_map *map = data->data; unsigned int offset = data->unmap_ops - map->unmap_ops; + int successful_unmaps = 0; + int live_grants; for (i = 0; i < data->count; i++) { + if (map->unmap_ops[offset + i].status == GNTST_okay && + map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->unmap_ops[offset + i].status != GNTST_okay && map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("unmap handle=%d st=%d\n", @@ -403,6 +410,10 @@ map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; if (use_ptemod) { + if (map->kunmap_ops[offset + i].status == GNTST_okay && + map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->kunmap_ops[offset + i].status != GNTST_okay && map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("kunmap handle=%u st=%d\n", @@ -411,11 +422,15 @@ map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; } } + /* * Decrease the live-grant counter. This must happen after the loop to * prevent premature reuse of the grants by gnttab_mmap(). */ - atomic_sub(data->count, &map->live_grants); + live_grants = atomic_sub_return(successful_unmaps, &map->live_grants); + if (WARN_ON(live_grants < 0)) + pr_err("%s: live_grants became negative (%d) after unmapping %d pages!\n", + __func__, live_grants, successful_unmaps); /* Release reference taken by __unmap_grant_pages */ gntdev_put_map(NULL, map); @@ -496,11 +511,7 @@ struct gntdev_priv *priv = file->private_data; pr_debug("gntdev_vma_close %p\n", vma); - if (use_ptemod) { - WARN_ON(map->vma != vma); - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } + vma->vm_private_data = NULL; gntdev_put_map(priv, map); } @@ -528,29 +539,30 @@ struct gntdev_grant_map *map = container_of(mn, struct gntdev_grant_map, notifier); unsigned long mstart, mend; + unsigned long map_start, map_end; if (!mmu_notifier_range_blockable(range)) return false; + map_start = map->pages_vm_start; + map_end = map->pages_vm_start + (map->count << PAGE_SHIFT); + /* * If the VMA is split or otherwise changed the notifier is not * updated, but we don't want to process VA's outside the modified * VMA. FIXME: It would be much more understandable to just prevent * modifying the VMA in the first place. */ - if (map->vma->vm_start >= range->end || - map->vma->vm_end <= range->start) + if (map_start >= range->end || map_end <= range->start) return true; - mstart = max(range->start, map->vma->vm_start); - mend = min(range->end, map->vma->vm_end); + mstart = max(range->start, map_start); + mend = min(range->end, map_end); pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n", - map->index, map->count, - map->vma->vm_start, map->vma->vm_end, - range->start, range->end, mstart, mend); - unmap_grant_pages(map, - (mstart - map->vma->vm_start) >> PAGE_SHIFT, - (mend - mstart) >> PAGE_SHIFT); + map->index, map->count, map_start, map_end, + range->start, range->end, mstart, mend); + unmap_grant_pages(map, (mstart - map_start) >> PAGE_SHIFT, + (mend - mstart) >> PAGE_SHIFT); return true; } @@ -1030,18 +1042,15 @@ return -EINVAL; pr_debug("map %d+%d at %lx (pgoff %lx)\n", - index, count, vma->vm_start, vma->vm_pgoff); + index, count, vma->vm_start, vma->vm_pgoff); mutex_lock(&priv->lock); map = gntdev_find_map_index(priv, index, count); if (!map) goto unlock_out; - if (use_ptemod && map->vma) + if (!atomic_add_unless(&map->in_use, 1, 1)) goto unlock_out; - if (atomic_read(&map->live_grants)) { - err = -EAGAIN; - goto unlock_out; - } + refcount_inc(&map->users); vma->vm_ops = &gntdev_vmops; @@ -1062,15 +1071,16 @@ map->flags |= GNTMAP_readonly; } + map->pages_vm_start = vma->vm_start; + if (use_ptemod) { - map->vma = vma; err = mmu_interval_notifier_insert_locked( &map->notifier, vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, &gntdev_mmu_ops); - if (err) { - map->vma = NULL; + if (err) goto out_unlock_put; - } + + map->notifier_init = true; } mutex_unlock(&priv->lock); @@ -1087,7 +1097,6 @@ */ mmu_interval_read_begin(&map->notifier); - map->pages_vm_start = vma->vm_start; err = apply_to_page_range(vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, find_grant_ptes, map); @@ -1116,13 +1125,8 @@ out_unlock_put: mutex_unlock(&priv->lock); out_put_map: - if (use_ptemod) { + if (use_ptemod) unmap_grant_pages(map, 0, map->count); - if (map->vma) { - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } - } gntdev_put_map(priv, map); return err; } diff -Nru linux-aws-5.19.0/drivers/xen/gntdev-common.h linux-aws-5.19.0/drivers/xen/gntdev-common.h --- linux-aws-5.19.0/drivers/xen/gntdev-common.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/xen/gntdev-common.h 2022-11-29 07:06:46.000000000 +0000 @@ -44,9 +44,10 @@ }; struct gntdev_grant_map { + atomic_t in_use; struct mmu_interval_notifier notifier; + bool notifier_init; struct list_head next; - struct vm_area_struct *vma; int index; int count; int flags; diff -Nru linux-aws-5.19.0/drivers/xen/grant-table.c linux-aws-5.19.0/drivers/xen/grant-table.c --- linux-aws-5.19.0/drivers/xen/grant-table.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/xen/grant-table.c 2022-11-29 07:06:46.000000000 +0000 @@ -1047,6 +1047,9 @@ size_t size; int i, ret; + if (args->nr_pages < 0 || args->nr_pages > (INT_MAX >> PAGE_SHIFT)) + return -ENOMEM; + size = args->nr_pages << PAGE_SHIFT; if (args->coherent) args->vaddr = dma_alloc_coherent(args->dev, size, diff -Nru linux-aws-5.19.0/drivers/xen/xenbus/xenbus_client.c linux-aws-5.19.0/drivers/xen/xenbus/xenbus_client.c --- linux-aws-5.19.0/drivers/xen/xenbus/xenbus_client.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/drivers/xen/xenbus/xenbus_client.c 2022-11-29 07:06:46.000000000 +0000 @@ -382,9 +382,10 @@ unsigned long ring_size = nr_pages * XEN_PAGE_SIZE; grant_ref_t gref_head; unsigned int i; + void *addr; int ret; - *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO); + addr = *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO); if (!*vaddr) { ret = -ENOMEM; goto err; @@ -401,13 +402,15 @@ unsigned long gfn; if (is_vmalloc_addr(*vaddr)) - gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr[i])); + gfn = pfn_to_gfn(vmalloc_to_pfn(addr)); else - gfn = virt_to_gfn(vaddr[i]); + gfn = virt_to_gfn(addr); grefs[i] = gnttab_claim_grant_reference(&gref_head); gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id, gfn, 0); + + addr += XEN_PAGE_SIZE; } return 0; diff -Nru linux-aws-5.19.0/fs/afs/flock.c linux-aws-5.19.0/fs/afs/flock.c --- linux-aws-5.19.0/fs/afs/flock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/afs/flock.c 2022-11-29 07:06:46.000000000 +0000 @@ -76,7 +76,7 @@ if (call->error == 0) { spin_lock(&vnode->lock); trace_afs_flock_ev(vnode, NULL, afs_flock_timestamp, 0); - vnode->locked_at = call->reply_time; + vnode->locked_at = call->issue_time; afs_schedule_lock_extension(vnode); spin_unlock(&vnode->lock); } diff -Nru linux-aws-5.19.0/fs/afs/fsclient.c linux-aws-5.19.0/fs/afs/fsclient.c --- linux-aws-5.19.0/fs/afs/fsclient.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/afs/fsclient.c 2022-11-29 07:06:46.000000000 +0000 @@ -131,7 +131,7 @@ static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) { - return ktime_divns(call->reply_time, NSEC_PER_SEC) + expiry; + return ktime_divns(call->issue_time, NSEC_PER_SEC) + expiry; } static void xdr_decode_AFSCallBack(const __be32 **_bp, diff -Nru linux-aws-5.19.0/fs/afs/internal.h linux-aws-5.19.0/fs/afs/internal.h --- linux-aws-5.19.0/fs/afs/internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/afs/internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -137,7 +137,6 @@ bool need_attention; /* T if RxRPC poked us */ bool async; /* T if asynchronous */ bool upgrade; /* T to request service upgrade */ - bool have_reply_time; /* T if have got reply_time */ bool intr; /* T if interruptible */ bool unmarshalling_error; /* T if an unmarshalling error occurred */ u16 service_id; /* Actual service ID (after upgrade) */ @@ -151,7 +150,7 @@ } __attribute__((packed)); __be64 tmp64; }; - ktime_t reply_time; /* Time of first reply packet */ + ktime_t issue_time; /* Time of issue of operation */ }; struct afs_call_type { diff -Nru linux-aws-5.19.0/fs/afs/rxrpc.c linux-aws-5.19.0/fs/afs/rxrpc.c --- linux-aws-5.19.0/fs/afs/rxrpc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/afs/rxrpc.c 2022-11-29 07:06:46.000000000 +0000 @@ -347,6 +347,7 @@ if (call->max_lifespan) rxrpc_kernel_set_max_life(call->net->socket, rxcall, call->max_lifespan); + call->issue_time = ktime_get_real(); /* send the request */ iov[0].iov_base = call->request; @@ -497,12 +498,6 @@ return; } - if (!call->have_reply_time && - rxrpc_kernel_get_reply_time(call->net->socket, - call->rxcall, - &call->reply_time)) - call->have_reply_time = true; - ret = call->type->deliver(call); state = READ_ONCE(call->state); if (ret == 0 && call->unmarshalling_error) diff -Nru linux-aws-5.19.0/fs/afs/yfsclient.c linux-aws-5.19.0/fs/afs/yfsclient.c --- linux-aws-5.19.0/fs/afs/yfsclient.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/afs/yfsclient.c 2022-11-29 07:06:46.000000000 +0000 @@ -232,8 +232,7 @@ struct afs_callback *cb = &scb->callback; ktime_t cb_expiry; - cb_expiry = call->reply_time; - cb_expiry = ktime_add(cb_expiry, xdr_to_u64(x->expiration_time) * 100); + cb_expiry = ktime_add(call->issue_time, xdr_to_u64(x->expiration_time) * 100); cb->expires_at = ktime_divns(cb_expiry, NSEC_PER_SEC); scb->have_cb = true; *_bp += xdr_size(x); diff -Nru linux-aws-5.19.0/fs/btrfs/block-group.c linux-aws-5.19.0/fs/btrfs/block-group.c --- linux-aws-5.19.0/fs/btrfs/block-group.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/block-group.c 2022-11-29 07:06:46.000000000 +0000 @@ -2191,7 +2191,16 @@ int need_clear = 0; u64 cache_gen; - if (!root) + /* + * Either no extent root (with ibadroots rescue option) or we have + * unsupported RO options. The fs can never be mounted read-write, so no + * need to waste time searching block group items. + * + * This also allows new extent tree related changes to be RO compat, + * no need for a full incompat flag. + */ + if (!root || (btrfs_super_compat_ro_flags(info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP)) return fill_dummy_bgs(info); key.objectid = 0; diff -Nru linux-aws-5.19.0/fs/btrfs/ctree.h linux-aws-5.19.0/fs/btrfs/ctree.h --- linux-aws-5.19.0/fs/btrfs/ctree.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/ctree.h 2022-11-29 07:06:46.000000000 +0000 @@ -1065,8 +1065,6 @@ spinlock_t zone_active_bgs_lock; struct list_head zone_active_bgs; - /* Waiters when BTRFS_FS_NEED_ZONE_FINISH is set */ - wait_queue_head_t zone_finish_wait; #ifdef CONFIG_BTRFS_FS_REF_VERIFY spinlock_t ref_verify_lock; diff -Nru linux-aws-5.19.0/fs/btrfs/disk-io.c linux-aws-5.19.0/fs/btrfs/disk-io.c --- linux-aws-5.19.0/fs/btrfs/disk-io.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/disk-io.c 2022-11-29 07:06:46.000000000 +0000 @@ -3173,7 +3173,6 @@ init_waitqueue_head(&fs_info->transaction_blocked_wait); init_waitqueue_head(&fs_info->async_submit_wait); init_waitqueue_head(&fs_info->delayed_iputs_wait); - init_waitqueue_head(&fs_info->zone_finish_wait); /* Usable values until the real ones are cached from the superblock */ fs_info->nodesize = 4096; @@ -4588,6 +4587,17 @@ set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); /* + * If we had UNFINISHED_DROPS we could still be processing them, so + * clear that bit and wake up relocation so it can stop. + * We must do this before stopping the block group reclaim task, because + * at btrfs_relocate_block_group() we wait for this bit, and after the + * wait we stop with -EINTR if btrfs_fs_closing() returns non-zero - we + * have just set BTRFS_FS_CLOSING_START, so btrfs_fs_closing() will + * return 1. + */ + btrfs_wake_unfinished_drop(fs_info); + + /* * We may have the reclaim task running and relocating a data block group, * in which case it may create delayed iputs. So stop it before we park * the cleaner kthread otherwise we can get new delayed iputs after @@ -4605,12 +4615,6 @@ */ kthread_park(fs_info->cleaner_kthread); - /* - * If we had UNFINISHED_DROPS we could still be processing them, so - * clear that bit and wake up relocation so it can stop. - */ - btrfs_wake_unfinished_drop(fs_info); - /* wait for the qgroup rescan worker to stop */ btrfs_qgroup_wait_for_completion(fs_info, false); @@ -4633,6 +4637,31 @@ /* clear out the rbtree of defraggable inodes */ btrfs_cleanup_defrag_inodes(fs_info); + /* + * After we parked the cleaner kthread, ordered extents may have + * completed and created new delayed iputs. If one of the async reclaim + * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we + * can hang forever trying to stop it, because if a delayed iput is + * added after it ran btrfs_run_delayed_iputs() and before it called + * btrfs_wait_on_delayed_iputs(), it will hang forever since there is + * no one else to run iputs. + * + * So wait for all ongoing ordered extents to complete and then run + * delayed iputs. This works because once we reach this point no one + * can either create new ordered extents nor create delayed iputs + * through some other means. + * + * Also note that btrfs_wait_ordered_roots() is not safe here, because + * it waits for BTRFS_ORDERED_COMPLETE to be set on an ordered extent, + * but the delayed iput for the respective inode is made only when doing + * the final btrfs_put_ordered_extent() (which must happen at + * btrfs_finish_ordered_io() when we are unmounting). + */ + btrfs_flush_workqueue(fs_info->endio_write_workers); + /* Ordered extents for free space inodes. */ + btrfs_flush_workqueue(fs_info->endio_freespace_worker); + btrfs_run_delayed_iputs(fs_info); + cancel_work_sync(&fs_info->async_reclaim_work); cancel_work_sync(&fs_info->async_data_reclaim_work); cancel_work_sync(&fs_info->preempt_reclaim_work); diff -Nru linux-aws-5.19.0/fs/btrfs/extent-tree.c linux-aws-5.19.0/fs/btrfs/extent-tree.c --- linux-aws-5.19.0/fs/btrfs/extent-tree.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/extent-tree.c 2022-11-29 07:06:46.000000000 +0000 @@ -4904,6 +4904,9 @@ !test_bit(BTRFS_ROOT_RESET_LOCKDEP_CLASS, &root->state)) lockdep_owner = BTRFS_FS_TREE_OBJECTID; + /* btrfs_clean_tree_block() accesses generation field. */ + btrfs_set_header_generation(buf, trans->transid); + /* * This needs to stay, because we could allocate a freed block from an * old tree into a new tree, so we need to make sure this new block is diff -Nru linux-aws-5.19.0/fs/btrfs/file.c linux-aws-5.19.0/fs/btrfs/file.c --- linux-aws-5.19.0/fs/btrfs/file.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/file.c 2022-11-29 07:06:46.000000000 +0000 @@ -523,6 +523,7 @@ testend = 0; } while (1) { + bool ends_after_range = false; int no_splits = 0; modified = false; @@ -539,10 +540,12 @@ write_unlock(&em_tree->lock); break; } + if (testend && em->start + em->len > start + len) + ends_after_range = true; flags = em->flags; gen = em->generation; if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { - if (testend && em->start + em->len >= start + len) { + if (ends_after_range) { free_extent_map(em); write_unlock(&em_tree->lock); break; @@ -592,7 +595,7 @@ split = split2; split2 = NULL; } - if (testend && em->start + em->len > start + len) { + if (ends_after_range) { u64 diff = start + len - em->start; split->start = start + len; @@ -630,14 +633,42 @@ } else { ret = add_extent_mapping(em_tree, split, modified); - ASSERT(ret == 0); /* Logic error */ + /* Logic error, shouldn't happen. */ + ASSERT(ret == 0); + if (WARN_ON(ret != 0) && modified) + btrfs_set_inode_full_sync(inode); } free_extent_map(split); split = NULL; } next: - if (extent_map_in_tree(em)) + if (extent_map_in_tree(em)) { + /* + * If the extent map is still in the tree it means that + * either of the following is true: + * + * 1) It fits entirely in our range (doesn't end beyond + * it or starts before it); + * + * 2) It starts before our range and/or ends after our + * range, and we were not able to allocate the extent + * maps for split operations, @split and @split2. + * + * If we are at case 2) then we just remove the entire + * extent map - this is fine since if anyone needs it to + * access the subranges outside our range, will just + * load it again from the subvolume tree's file extent + * item. However if the extent map was in the list of + * modified extents, then we must mark the inode for a + * full fsync, otherwise a fast fsync will miss this + * extent if it's new and needs to be logged. + */ + if ((em->start < start || ends_after_range) && modified) { + ASSERT(no_splits); + btrfs_set_inode_full_sync(inode); + } remove_extent_mapping(em_tree, em); + } write_unlock(&em_tree->lock); /* once for us */ @@ -2202,14 +2233,6 @@ atomic_inc(&root->log_batch); /* - * Always check for the full sync flag while holding the inode's lock, - * to avoid races with other tasks. The flag must be either set all the - * time during logging or always off all the time while logging. - */ - full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); - - /* * Before we acquired the inode's lock and the mmap lock, someone may * have dirtied more pages in the target range. We need to make sure * that writeback for any such pages does not start while we are logging @@ -2234,6 +2257,17 @@ } /* + * Always check for the full sync flag while holding the inode's lock, + * to avoid races with other tasks. The flag must be either set all the + * time during logging or always off all the time while logging. + * We check the flag here after starting delalloc above, because when + * running delalloc the full sync flag may be set if we need to drop + * extra extent map ranges due to temporary memory allocation failures. + */ + full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, + &BTRFS_I(inode)->runtime_flags); + + /* * We have to do this here to avoid the priority inversion of waiting on * IO of a lower priority task while holding a transaction open. * @@ -3810,6 +3844,7 @@ .mmap = btrfs_file_mmap, .open = btrfs_file_open, .release = btrfs_release_file, + .get_unmapped_area = thp_get_unmapped_area, .fsync = btrfs_sync_file, .fallocate = btrfs_fallocate, .unlocked_ioctl = btrfs_ioctl, diff -Nru linux-aws-5.19.0/fs/btrfs/free-space-cache.c linux-aws-5.19.0/fs/btrfs/free-space-cache.c --- linux-aws-5.19.0/fs/btrfs/free-space-cache.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/free-space-cache.c 2022-11-29 07:06:46.000000000 +0000 @@ -48,6 +48,25 @@ struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); +static void __btrfs_remove_free_space_cache_locked( + struct btrfs_free_space_ctl *ctl) +{ + struct btrfs_free_space *info; + struct rb_node *node; + + while ((node = rb_last(&ctl->free_space_offset)) != NULL) { + info = rb_entry(node, struct btrfs_free_space, offset_index); + if (!info->bitmap) { + unlink_free_space(ctl, info, true); + kmem_cache_free(btrfs_free_space_cachep, info); + } else { + free_bitmap(ctl, info); + } + + cond_resched_lock(&ctl->tree_lock); + } +} + static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path, u64 offset) @@ -693,6 +712,12 @@ max_bitmaps = max_t(u64, max_bitmaps, 1); + if (ctl->total_bitmaps > max_bitmaps) + btrfs_err(block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu", + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg); ASSERT(ctl->total_bitmaps <= max_bitmaps); /* @@ -875,7 +900,14 @@ return ret; free_cache: io_ctl_drop_pages(&io_ctl); - __btrfs_remove_free_space_cache(ctl); + + /* + * We need to call the _locked variant so we don't try to update the + * discard counters. + */ + spin_lock(&ctl->tree_lock); + __btrfs_remove_free_space_cache_locked(ctl); + spin_unlock(&ctl->tree_lock); goto out; } @@ -1001,7 +1033,13 @@ if (ret == 0) ret = 1; } else { + /* + * We need to call the _locked variant so we don't try to update + * the discard counters. + */ + spin_lock(&tmp_ctl.tree_lock); __btrfs_remove_free_space_cache(&tmp_ctl); + spin_unlock(&tmp_ctl.tree_lock); btrfs_warn(fs_info, "block group %llu has wrong amount of free space", block_group->start); @@ -2964,25 +3002,6 @@ btrfs_put_block_group(block_group); } -static void __btrfs_remove_free_space_cache_locked( - struct btrfs_free_space_ctl *ctl) -{ - struct btrfs_free_space *info; - struct rb_node *node; - - while ((node = rb_last(&ctl->free_space_offset)) != NULL) { - info = rb_entry(node, struct btrfs_free_space, offset_index); - if (!info->bitmap) { - unlink_free_space(ctl, info, true); - kmem_cache_free(btrfs_free_space_cachep, info); - } else { - free_bitmap(ctl, info); - } - - cond_resched_lock(&ctl->tree_lock); - } -} - void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) { spin_lock(&ctl->tree_lock); diff -Nru linux-aws-5.19.0/fs/btrfs/inode.c linux-aws-5.19.0/fs/btrfs/inode.c --- linux-aws-5.19.0/fs/btrfs/inode.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -1643,10 +1643,9 @@ done_offset = end; if (done_offset == start) { - struct btrfs_fs_info *info = inode->root->fs_info; - - wait_var_event(&info->zone_finish_wait, - !test_bit(BTRFS_FS_NEED_ZONE_FINISH, &info->flags)); + wait_on_bit_io(&inode->root->fs_info->flags, + BTRFS_FS_NEED_ZONE_FINISH, + TASK_UNINTERRUPTIBLE); continue; } diff -Nru linux-aws-5.19.0/fs/btrfs/qgroup.c linux-aws-5.19.0/fs/btrfs/qgroup.c --- linux-aws-5.19.0/fs/btrfs/qgroup.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/qgroup.c 2022-11-29 07:06:46.000000000 +0000 @@ -1174,6 +1174,21 @@ fs_info->qgroup_rescan_running = true; btrfs_queue_work(fs_info->qgroup_rescan_workers, &fs_info->qgroup_rescan_work); + } else { + /* + * We have set both BTRFS_FS_QUOTA_ENABLED and + * BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with + * -EINPROGRESS. That can happen because someone started the + * rescan worker by calling quota rescan ioctl before we + * attempted to initialize the rescan worker. Failure due to + * quotas disabled in the meanwhile is not possible, because + * we are holding a write lock on fs_info->subvol_sem, which + * is also acquired when disabling quotas. + * Ignore such error, and any other error would need to undo + * everything we did in the transaction we just committed. + */ + ASSERT(ret == -EINPROGRESS); + ret = 0; } out_free_path: diff -Nru linux-aws-5.19.0/fs/btrfs/scrub.c linux-aws-5.19.0/fs/btrfs/scrub.c --- linux-aws-5.19.0/fs/btrfs/scrub.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/scrub.c 2022-11-29 07:06:46.000000000 +0000 @@ -731,6 +731,13 @@ dev = sblock->sectors[0]->dev; fs_info = sblock->sctx->fs_info; + /* Super block error, no need to search extent tree. */ + if (sblock->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { + btrfs_warn_in_rcu(fs_info, "%s on device %s, physical %llu", + errstr, rcu_str_deref(dev->name), + sblock->sectors[0]->physical); + return; + } path = btrfs_alloc_path(); if (!path) return; @@ -806,7 +813,7 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) { struct scrub_ctx *sctx = sblock_to_check->sctx; - struct btrfs_device *dev; + struct btrfs_device *dev = sblock_to_check->sectors[0]->dev; struct btrfs_fs_info *fs_info; u64 logical; unsigned int failed_mirror_index; @@ -827,13 +834,15 @@ fs_info = sctx->fs_info; if (sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { /* - * if we find an error in a super block, we just report it. + * If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ + scrub_print_warning("super block error", sblock_to_check); spin_lock(&sctx->stat_lock); ++sctx->stat.super_errors; spin_unlock(&sctx->stat_lock); + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_CORRUPTION_ERRS); return 0; } logical = sblock_to_check->sectors[0]->logical; @@ -842,7 +851,6 @@ is_metadata = !(sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_DATA); have_csum = sblock_to_check->sectors[0]->have_csum; - dev = sblock_to_check->sectors[0]->dev; if (!sctx->is_dev_replace && btrfs_repair_one_zone(fs_info, logical)) return 0; @@ -1773,7 +1781,7 @@ else if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) ret = scrub_checksum_tree_block(sblock); else if (flags & BTRFS_EXTENT_FLAG_SUPER) - (void)scrub_checksum_super(sblock); + ret = scrub_checksum_super(sblock); else WARN_ON(1); if (ret) @@ -1912,23 +1920,6 @@ if (memcmp(calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; - if (fail_cor + fail_gen) { - /* - * if we find an error in a super block, we just report it. - * They will get written with the next transaction commit - * anyway - */ - spin_lock(&sctx->stat_lock); - ++sctx->stat.super_errors; - spin_unlock(&sctx->stat_lock); - if (fail_cor) - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_CORRUPTION_ERRS); - else - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_GENERATION_ERRS); - } - return fail_cor + fail_gen; } @@ -4121,6 +4112,7 @@ int ret; struct btrfs_device *dev; unsigned int nofs_flag; + bool need_commit = false; if (btrfs_fs_closing(fs_info)) return -EAGAIN; @@ -4224,6 +4216,12 @@ */ nofs_flag = memalloc_nofs_save(); if (!is_dev_replace) { + u64 old_super_errors; + + spin_lock(&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; + spin_unlock(&sctx->stat_lock); + btrfs_info(fs_info, "scrub: started on devid %llu", devid); /* * by holding device list mutex, we can @@ -4232,6 +4230,16 @@ mutex_lock(&fs_info->fs_devices->device_list_mutex); ret = scrub_supers(sctx, dev); mutex_unlock(&fs_info->fs_devices->device_list_mutex); + + spin_lock(&sctx->stat_lock); + /* + * Super block errors found, but we can not commit transaction + * at current context, since btrfs_commit_transaction() needs + * to pause the current running scrub (hold by ourselves). + */ + if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; + spin_unlock(&sctx->stat_lock); } if (!ret) @@ -4258,6 +4266,25 @@ scrub_workers_put(fs_info); scrub_put_ctx(sctx); + /* + * We found some super block errors before, now try to force a + * transaction commit, as scrub has finished. + */ + if (need_commit) { + struct btrfs_trans_handle *trans; + + trans = btrfs_start_transaction(fs_info->tree_root, 0); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + btrfs_err(fs_info, + "scrub: failed to start transaction to fix super block errors: %d", ret); + return ret; + } + ret = btrfs_commit_transaction(trans); + if (ret < 0) + btrfs_err(fs_info, + "scrub: failed to commit transaction to fix super block errors: %d", ret); + } return ret; out: scrub_workers_put(fs_info); diff -Nru linux-aws-5.19.0/fs/btrfs/space-info.c linux-aws-5.19.0/fs/btrfs/space-info.c --- linux-aws-5.19.0/fs/btrfs/space-info.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/space-info.c 2022-11-29 07:06:46.000000000 +0000 @@ -199,7 +199,7 @@ ASSERT(flags & BTRFS_BLOCK_GROUP_TYPE_MASK); if (flags & BTRFS_BLOCK_GROUP_DATA) - return SZ_1G; + return BTRFS_MAX_DATA_CHUNK_SIZE; else if (flags & BTRFS_BLOCK_GROUP_SYSTEM) return SZ_32M; diff -Nru linux-aws-5.19.0/fs/btrfs/super.c linux-aws-5.19.0/fs/btrfs/super.c --- linux-aws-5.19.0/fs/btrfs/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -625,6 +625,7 @@ int saved_compress_level; bool saved_compress_force; int no_compress = 0; + const bool remounting = test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state); if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); @@ -1136,10 +1137,12 @@ } if (!ret) ret = btrfs_check_mountopts_zoned(info); - if (!ret && btrfs_test_opt(info, SPACE_CACHE)) - btrfs_info(info, "disk space caching is enabled"); - if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE)) - btrfs_info(info, "using free space tree"); + if (!ret && !remounting) { + if (btrfs_test_opt(info, SPACE_CACHE)) + btrfs_info(info, "disk space caching is enabled"); + if (btrfs_test_opt(info, FREE_SPACE_TREE)) + btrfs_info(info, "using free space tree"); + } return ret; } @@ -2113,6 +2116,15 @@ ret = -EINVAL; goto restore; } + if (btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP) { + btrfs_err(fs_info, + "can not remount read-write due to unsupported optional flags 0x%llx", + btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP); + ret = -EINVAL; + goto restore; + } if (fs_info->fs_devices->rw_devices == 0) { ret = -EACCES; goto restore; diff -Nru linux-aws-5.19.0/fs/btrfs/volumes.c linux-aws-5.19.0/fs/btrfs/volumes.c --- linux-aws-5.19.0/fs/btrfs/volumes.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/volumes.c 2022-11-29 07:06:46.000000000 +0000 @@ -5266,6 +5266,9 @@ ctl->stripe_size); } + /* Stripe size should not go beyond 1G. */ + ctl->stripe_size = min_t(u64, ctl->stripe_size, SZ_1G); + /* Align to BTRFS_STRIPE_LEN */ ctl->stripe_size = round_down(ctl->stripe_size, BTRFS_STRIPE_LEN); ctl->chunk_size = ctl->stripe_size * data_stripes; diff -Nru linux-aws-5.19.0/fs/btrfs/zoned.c linux-aws-5.19.0/fs/btrfs/zoned.c --- linux-aws-5.19.0/fs/btrfs/zoned.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/btrfs/zoned.c 2022-11-29 07:06:46.000000000 +0000 @@ -421,10 +421,19 @@ * since btrfs adds the pages one by one to a bio, and btrfs cannot * increase the metadata reservation even if it increases the number of * extents, it is safe to stick with the limit. + * + * With the zoned emulation, we can have non-zoned device on the zoned + * mode. In this case, we don't have a valid max zone append size. So, + * use max_segments * PAGE_SIZE as the pseudo max_zone_append_size. */ - zone_info->max_zone_append_size = - min_t(u64, (u64)bdev_max_zone_append_sectors(bdev) << SECTOR_SHIFT, - (u64)bdev_max_segments(bdev) << PAGE_SHIFT); + if (bdev_is_zoned(bdev)) { + zone_info->max_zone_append_size = min_t(u64, + (u64)bdev_max_zone_append_sectors(bdev) << SECTOR_SHIFT, + (u64)bdev_max_segments(bdev) << PAGE_SHIFT); + } else { + zone_info->max_zone_append_size = + (u64)bdev_max_segments(bdev) << PAGE_SHIFT; + } if (!IS_ALIGNED(nr_sectors, zone_sectors)) zone_info->nr_zones++; @@ -1178,7 +1187,7 @@ * offset. */ static int calculate_alloc_pointer(struct btrfs_block_group *cache, - u64 *offset_ret) + u64 *offset_ret, bool new) { struct btrfs_fs_info *fs_info = cache->fs_info; struct btrfs_root *root; @@ -1188,6 +1197,21 @@ int ret; u64 length; + /* + * Avoid tree lookups for a new block group, there's no use for it. + * It must always be 0. + * + * Also, we have a lock chain of extent buffer lock -> chunk mutex. + * For new a block group, this function is called from + * btrfs_make_block_group() which is already taking the chunk mutex. + * Thus, we cannot call calculate_alloc_pointer() which takes extent + * buffer locks to avoid deadlock. + */ + if (new) { + *offset_ret = 0; + return 0; + } + path = btrfs_alloc_path(); if (!path) return -ENOMEM; @@ -1323,6 +1347,13 @@ else num_conventional++; + /* + * Consider a zone as active if we can allow any number of + * active zones. + */ + if (!device->zone_info->max_active_zones) + __set_bit(i, active); + if (!is_sequential) { alloc_offsets[i] = WP_CONVENTIONAL; continue; @@ -1389,45 +1420,23 @@ __set_bit(i, active); break; } - - /* - * Consider a zone as active if we can allow any number of - * active zones. - */ - if (!device->zone_info->max_active_zones) - __set_bit(i, active); } if (num_sequential > 0) cache->seq_zone = true; if (num_conventional > 0) { - /* - * Avoid calling calculate_alloc_pointer() for new BG. It - * is no use for new BG. It must be always 0. - * - * Also, we have a lock chain of extent buffer lock -> - * chunk mutex. For new BG, this function is called from - * btrfs_make_block_group() which is already taking the - * chunk mutex. Thus, we cannot call - * calculate_alloc_pointer() which takes extent buffer - * locks to avoid deadlock. - */ - /* Zone capacity is always zone size in emulation */ cache->zone_capacity = cache->length; - if (new) { - cache->alloc_offset = 0; - goto out; - } - ret = calculate_alloc_pointer(cache, &last_alloc); - if (ret || map->num_stripes == num_conventional) { - if (!ret) - cache->alloc_offset = last_alloc; - else - btrfs_err(fs_info, + ret = calculate_alloc_pointer(cache, &last_alloc, new); + if (ret) { + btrfs_err(fs_info, "zoned: failed to determine allocation offset of bg %llu", - cache->start); + cache->start); + goto out; + } else if (map->num_stripes == num_conventional) { + cache->alloc_offset = last_alloc; + cache->zone_is_active = 1; goto out; } } @@ -1495,13 +1504,6 @@ goto out; } - if (cache->zone_is_active) { - btrfs_get_block_group(cache); - spin_lock(&fs_info->zone_active_bgs_lock); - list_add_tail(&cache->active_bg_list, &fs_info->zone_active_bgs); - spin_unlock(&fs_info->zone_active_bgs_lock); - } - out: if (cache->alloc_offset > fs_info->zone_size) { btrfs_err(fs_info, @@ -1526,10 +1528,16 @@ ret = -EIO; } - if (!ret) + if (!ret) { cache->meta_write_pointer = cache->alloc_offset + cache->start; - - if (ret) { + if (cache->zone_is_active) { + btrfs_get_block_group(cache); + spin_lock(&fs_info->zone_active_bgs_lock); + list_add_tail(&cache->active_bg_list, + &fs_info->zone_active_bgs); + spin_unlock(&fs_info->zone_active_bgs_lock); + } + } else { kfree(cache->physical_map); cache->physical_map = NULL; } @@ -1910,10 +1918,44 @@ return ret; } +static void wait_eb_writebacks(struct btrfs_block_group *block_group) +{ + struct btrfs_fs_info *fs_info = block_group->fs_info; + const u64 end = block_group->start + block_group->length; + struct radix_tree_iter iter; + struct extent_buffer *eb; + void __rcu **slot; + + rcu_read_lock(); + radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, + block_group->start >> fs_info->sectorsize_bits) { + eb = radix_tree_deref_slot(slot); + if (!eb) + continue; + if (radix_tree_deref_retry(eb)) { + slot = radix_tree_iter_retry(&iter); + continue; + } + + if (eb->start < block_group->start) + continue; + if (eb->start >= end) + break; + + slot = radix_tree_iter_resume(slot, &iter); + rcu_read_unlock(); + wait_on_extent_buffer_writeback(eb); + rcu_read_lock(); + } + rcu_read_unlock(); +} + static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_written) { struct btrfs_fs_info *fs_info = block_group->fs_info; struct map_lookup *map; + const bool is_metadata = (block_group->flags & + (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)); int ret = 0; int i; @@ -1924,8 +1966,7 @@ } /* Check if we have unwritten allocated space */ - if ((block_group->flags & - (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) && + if (is_metadata && block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) { spin_unlock(&block_group->lock); return -EAGAIN; @@ -1950,6 +1991,9 @@ /* No need to wait for NOCOW writers. Zoned mode does not allow that */ btrfs_wait_ordered_roots(fs_info, U64_MAX, block_group->start, block_group->length); + /* Wait for extent buffers to be written. */ + if (is_metadata) + wait_eb_writebacks(block_group); spin_lock(&block_group->lock); @@ -2007,8 +2051,7 @@ /* For active_bg_list */ btrfs_put_block_group(block_group); - clear_bit(BTRFS_FS_NEED_ZONE_FINISH, &fs_info->flags); - wake_up_all(&fs_info->zone_finish_wait); + clear_and_wake_up_bit(BTRFS_FS_NEED_ZONE_FINISH, &fs_info->flags); return 0; } diff -Nru linux-aws-5.19.0/fs/cachefiles/internal.h linux-aws-5.19.0/fs/cachefiles/internal.h --- linux-aws-5.19.0/fs/cachefiles/internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cachefiles/internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -111,6 +111,7 @@ char *tag; /* cache binding tag */ refcount_t unbind_pincount;/* refcount to do daemon unbind */ struct xarray reqs; /* xarray of pending on-demand requests */ + unsigned long req_id_next; struct xarray ondemand_ids; /* xarray for ondemand_id allocation */ u32 ondemand_id_next; }; diff -Nru linux-aws-5.19.0/fs/cachefiles/ondemand.c linux-aws-5.19.0/fs/cachefiles/ondemand.c --- linux-aws-5.19.0/fs/cachefiles/ondemand.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cachefiles/ondemand.c 2022-11-29 07:06:46.000000000 +0000 @@ -158,9 +158,13 @@ /* fail OPEN request if daemon reports an error */ if (size < 0) { - if (!IS_ERR_VALUE(size)) - size = -EINVAL; - req->error = size; + if (!IS_ERR_VALUE(size)) { + req->error = -EINVAL; + ret = -EINVAL; + } else { + req->error = size; + ret = 0; + } goto out; } @@ -238,14 +242,19 @@ unsigned long id = 0; size_t n; int ret = 0; - XA_STATE(xas, &cache->reqs, 0); + XA_STATE(xas, &cache->reqs, cache->req_id_next); /* - * Search for a request that has not ever been processed, to prevent - * requests from being processed repeatedly. + * Cyclically search for a request that has not ever been processed, + * to prevent requests from being processed repeatedly, and make + * request distribution fair. */ xa_lock(&cache->reqs); req = xas_find_marked(&xas, UINT_MAX, CACHEFILES_REQ_NEW); + if (!req && cache->req_id_next > 0) { + xas_set(&xas, 0); + req = xas_find_marked(&xas, cache->req_id_next - 1, CACHEFILES_REQ_NEW); + } if (!req) { xa_unlock(&cache->reqs); return 0; @@ -260,6 +269,7 @@ } xas_clear_mark(&xas, CACHEFILES_REQ_NEW); + cache->req_id_next = xas.xa_index + 1; xa_unlock(&cache->reqs); id = xas.xa_index; diff -Nru linux-aws-5.19.0/fs/ceph/file.c linux-aws-5.19.0/fs/ceph/file.c --- linux-aws-5.19.0/fs/ceph/file.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ceph/file.c 2022-11-29 07:06:46.000000000 +0000 @@ -740,6 +740,12 @@ if (dentry->d_name.len > NAME_MAX) return -ENAMETOOLONG; + /* + * Do not truncate the file, since atomic_open is called before the + * permission check. The caller will do the truncation afterward. + */ + flags &= ~O_TRUNC; + if (flags & O_CREAT) { if (ceph_quota_is_max_files_exceeded(dir)) return -EDQUOT; @@ -807,9 +813,7 @@ } set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); - err = ceph_mdsc_do_request(mdsc, - (flags & (O_CREAT|O_TRUNC)) ? dir : NULL, - req); + err = ceph_mdsc_do_request(mdsc, (flags & O_CREAT) ? dir : NULL, req); if (err == -ENOENT) { dentry = ceph_handle_snapdir(req, dentry); if (IS_ERR(dentry)) { diff -Nru linux-aws-5.19.0/fs/cifs/cifsfs.c linux-aws-5.19.0/fs/cifs/cifsfs.c --- linux-aws-5.19.0/fs/cifs/cifsfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/cifsfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -1232,6 +1232,12 @@ lock_two_nondirectories(target_inode, src_inode); cifs_dbg(FYI, "about to flush pages\n"); + + rc = filemap_write_and_wait_range(src_inode->i_mapping, off, + off + len - 1); + if (rc) + goto out; + /* should we flush first and last page first */ truncate_inode_pages(&target_inode->i_data, 0); diff -Nru linux-aws-5.19.0/fs/cifs/cifsproto.h linux-aws-5.19.0/fs/cifs/cifsproto.h --- linux-aws-5.19.0/fs/cifs/cifsproto.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/cifsproto.h 2022-11-29 07:06:46.000000000 +0000 @@ -642,7 +642,7 @@ int cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server); int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon); +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount); void extract_unc_hostname(const char *unc, const char **h, size_t *len); int copy_path_name(char *dst, const char *src); diff -Nru linux-aws-5.19.0/fs/cifs/connect.c linux-aws-5.19.0/fs/cifs/connect.c --- linux-aws-5.19.0/fs/cifs/connect.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/connect.c 2022-11-29 07:06:46.000000000 +0000 @@ -155,7 +155,7 @@ /* * query server network interfaces, in case they change */ - rc = SMB3_request_interfaces(0, tcon); + rc = SMB3_request_interfaces(0, tcon, false); if (rc) { cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", __func__, rc); @@ -707,9 +707,6 @@ int length = 0; int total_read; - smb_msg->msg_control = NULL; - smb_msg->msg_controllen = 0; - for (total_read = 0; msg_data_left(smb_msg); total_read += length) { try_to_freeze(); @@ -765,7 +762,7 @@ cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, unsigned int to_read) { - struct msghdr smb_msg; + struct msghdr smb_msg = {}; struct kvec iov = {.iov_base = buf, .iov_len = to_read}; iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read); @@ -775,15 +772,13 @@ ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read) { - struct msghdr smb_msg; + struct msghdr smb_msg = {}; /* * iov_iter_discard already sets smb_msg.type and count and iov_offset * and cifs_readv_from_socket sets msg_control and msg_controllen * so little to initialize in struct msghdr */ - smb_msg.msg_name = NULL; - smb_msg.msg_namelen = 0; iov_iter_discard(&smb_msg.msg_iter, READ, to_read); return cifs_readv_from_socket(server, &smb_msg); @@ -793,7 +788,7 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read) { - struct msghdr smb_msg; + struct msghdr smb_msg = {}; struct bio_vec bv = { .bv_page = page, .bv_len = to_read, .bv_offset = page_offset}; iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read); diff -Nru linux-aws-5.19.0/fs/cifs/file.c linux-aws-5.19.0/fs/cifs/file.c --- linux-aws-5.19.0/fs/cifs/file.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/file.c 2022-11-29 07:06:46.000000000 +0000 @@ -3327,6 +3327,9 @@ ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) { + struct file *file = iocb->ki_filp; + + cifs_revalidate_mapping(file->f_inode); return __cifs_writev(iocb, from, true); } @@ -4021,6 +4024,15 @@ len = ctx->len; } + if (direct) { + rc = filemap_write_and_wait_range(file->f_inode->i_mapping, + offset, offset + len - 1); + if (rc) { + kref_put(&ctx->refcount, cifs_aio_ctx_release); + return -EAGAIN; + } + } + /* grab a lock here due to read response handlers can access ctx */ mutex_lock(&ctx->aio_mutex); diff -Nru linux-aws-5.19.0/fs/cifs/smb2file.c linux-aws-5.19.0/fs/cifs/smb2file.c --- linux-aws-5.19.0/fs/cifs/smb2file.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/smb2file.c 2022-11-29 07:06:46.000000000 +0000 @@ -61,7 +61,6 @@ nr_ioctl_req.Reserved = 0; rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, fid->volatile_fid, FSCTL_LMR_REQUEST_RESILIENCY, - true /* is_fsctl */, (char *)&nr_ioctl_req, sizeof(nr_ioctl_req), CIFSMaxBufSize, NULL, NULL /* no return info */); if (rc == -EOPNOTSUPP) { diff -Nru linux-aws-5.19.0/fs/cifs/smb2ops.c linux-aws-5.19.0/fs/cifs/smb2ops.c --- linux-aws-5.19.0/fs/cifs/smb2ops.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/smb2ops.c 2022-11-29 07:06:46.000000000 +0000 @@ -511,8 +511,7 @@ static int parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, - size_t buf_len, - struct cifs_ses *ses) + size_t buf_len, struct cifs_ses *ses, bool in_mount) { struct network_interface_info_ioctl_rsp *p; struct sockaddr_in *addr4; @@ -542,6 +541,20 @@ } spin_unlock(&ses->iface_lock); + /* + * Samba server e.g. can return an empty interface list in some cases, + * which would only be a problem if we were requesting multichannel + */ + if (bytes_left == 0) { + /* avoid spamming logs every 10 minutes, so log only in mount */ + if ((ses->chan_max > 1) && in_mount) + cifs_dbg(VFS, + "empty network interface list returned by server %s\n", + ses->server->hostname); + rc = -EINVAL; + goto out; + } + while (bytes_left >= sizeof(*p)) { memset(&tmp_iface, 0, sizeof(tmp_iface)); tmp_iface.speed = le64_to_cpu(p->LinkSpeed); @@ -672,7 +685,7 @@ } int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount) { int rc; unsigned int ret_data_len = 0; @@ -680,7 +693,7 @@ struct cifs_ses *ses = tcon->ses; rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, - FSCTL_QUERY_NETWORK_INTERFACE_INFO, true /* is_fsctl */, + FSCTL_QUERY_NETWORK_INTERFACE_INFO, NULL /* no data input */, 0 /* no data input */, CIFSMaxBufSize, (char **)&out_buf, &ret_data_len); if (rc == -EOPNOTSUPP) { @@ -692,7 +705,7 @@ goto out; } - rc = parse_server_interfaces(out_buf, ret_data_len, ses); + rc = parse_server_interfaces(out_buf, ret_data_len, ses, in_mount); if (rc) goto out; @@ -1022,7 +1035,7 @@ if (rc) return; - SMB3_request_interfaces(xid, tcon); + SMB3_request_interfaces(xid, tcon, true /* called during mount */); SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, FS_ATTRIBUTE_INFORMATION); @@ -1609,9 +1622,8 @@ struct resume_key_req *res_key; rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid, - FSCTL_SRV_REQUEST_RESUME_KEY, true /* is_fsctl */, - NULL, 0 /* no input */, CIFSMaxBufSize, - (char **)&res_key, &ret_data_len); + FSCTL_SRV_REQUEST_RESUME_KEY, NULL, 0 /* no input */, + CIFSMaxBufSize, (char **)&res_key, &ret_data_len); if (rc == -EOPNOTSUPP) { pr_warn_once("Server share %s does not support copy range\n", tcon->treeName); @@ -1753,7 +1765,7 @@ rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE; rc = SMB2_ioctl_init(tcon, server, &rqst[1], COMPOUND_FID, COMPOUND_FID, - qi.info_type, true, buffer, qi.output_buffer_length, + qi.info_type, buffer, qi.output_buffer_length, CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE - MAX_SMB2_CLOSE_RESPONSE_SIZE); free_req1_func = SMB2_ioctl_free; @@ -1887,17 +1899,8 @@ int chunks_copied = 0; bool chunk_sizes_updated = false; ssize_t bytes_written, total_bytes_written = 0; - struct inode *inode; pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL); - - /* - * We need to flush all unwritten data before we can send the - * copychunk ioctl to the server. - */ - inode = d_inode(trgtfile->dentry); - filemap_write_and_wait(inode->i_mapping); - if (pcchunk == NULL) return -ENOMEM; @@ -1929,9 +1932,8 @@ retbuf = NULL; rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE, - true /* is_fsctl */, (char *)pcchunk, - sizeof(struct copychunk_ioctl), CIFSMaxBufSize, - (char **)&retbuf, &ret_data_len); + (char *)pcchunk, sizeof(struct copychunk_ioctl), + CIFSMaxBufSize, (char **)&retbuf, &ret_data_len); if (rc == 0) { if (ret_data_len != sizeof(struct copychunk_ioctl_rsp)) { @@ -2091,7 +2093,6 @@ rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_SET_SPARSE, - true /* is_fctl */, &setsparse, 1, CIFSMaxBufSize, NULL, NULL); if (rc) { tcon->broken_sparse_sup = true; @@ -2174,7 +2175,6 @@ rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, trgtfile->fid.volatile_fid, FSCTL_DUPLICATE_EXTENTS_TO_FILE, - true /* is_fsctl */, (char *)&dup_ext_buf, sizeof(struct duplicate_extents_to_file), CIFSMaxBufSize, NULL, @@ -2209,7 +2209,6 @@ return SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_SET_INTEGRITY_INFORMATION, - true /* is_fsctl */, (char *)&integr_info, sizeof(struct fsctl_set_integrity_information_req), CIFSMaxBufSize, NULL, @@ -2262,7 +2261,6 @@ rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_SRV_ENUMERATE_SNAPSHOTS, - true /* is_fsctl */, NULL, 0 /* no input data */, max_response_size, (char **)&retbuf, &ret_data_len); @@ -2982,7 +2980,6 @@ do { rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, FSCTL_DFS_GET_REFERRALS, - true /* is_fsctl */, (char *)dfs_req, dfs_req_size, CIFSMaxBufSize, (char **)&dfs_rsp, &dfs_rsp_size); if (!is_retryable_error(rc)) @@ -3189,8 +3186,7 @@ rc = SMB2_ioctl_init(tcon, server, &rqst[1], fid.persistent_fid, - fid.volatile_fid, FSCTL_GET_REPARSE_POINT, - true /* is_fctl */, NULL, 0, + fid.volatile_fid, FSCTL_GET_REPARSE_POINT, NULL, 0, CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE - MAX_SMB2_CLOSE_RESPONSE_SIZE); @@ -3370,8 +3366,7 @@ rc = SMB2_ioctl_init(tcon, server, &rqst[1], COMPOUND_FID, - COMPOUND_FID, FSCTL_GET_REPARSE_POINT, - true /* is_fctl */, NULL, 0, + COMPOUND_FID, FSCTL_GET_REPARSE_POINT, NULL, 0, CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE - MAX_SMB2_CLOSE_RESPONSE_SIZE); @@ -3599,26 +3594,43 @@ return pntsd; } +static long smb3_zero_data(struct file *file, struct cifs_tcon *tcon, + loff_t offset, loff_t len, unsigned int xid) +{ + struct cifsFileInfo *cfile = file->private_data; + struct file_zero_data_information fsctl_buf; + + cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len); + + fsctl_buf.FileOffset = cpu_to_le64(offset); + fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); + + return SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, + cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, + (char *)&fsctl_buf, + sizeof(struct file_zero_data_information), + 0, NULL, NULL); +} + static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, loff_t offset, loff_t len, bool keep_size) { struct cifs_ses *ses = tcon->ses; - struct inode *inode; - struct cifsInodeInfo *cifsi; + struct inode *inode = file_inode(file); + struct cifsInodeInfo *cifsi = CIFS_I(inode); struct cifsFileInfo *cfile = file->private_data; - struct file_zero_data_information fsctl_buf; long rc; unsigned int xid; __le64 eof; xid = get_xid(); - inode = d_inode(cfile->dentry); - cifsi = CIFS_I(inode); - trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, ses->Suid, offset, len); + inode_lock(inode); + filemap_invalidate_lock(inode->i_mapping); + /* * We zero the range through ioctl, so we need remove the page caches * first, otherwise the data may be inconsistent with the server. @@ -3626,26 +3638,12 @@ truncate_pagecache_range(inode, offset, offset + len - 1); /* if file not oplocked can't be sure whether asking to extend size */ - if (!CIFS_CACHE_READ(cifsi)) - if (keep_size == false) { - rc = -EOPNOTSUPP; - trace_smb3_zero_err(xid, cfile->fid.persistent_fid, - tcon->tid, ses->Suid, offset, len, rc); - free_xid(xid); - return rc; - } - - cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len); - - fsctl_buf.FileOffset = cpu_to_le64(offset); - fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); + rc = -EOPNOTSUPP; + if (keep_size == false && !CIFS_CACHE_READ(cifsi)) + goto zero_range_exit; - rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, - cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, true, - (char *)&fsctl_buf, - sizeof(struct file_zero_data_information), - 0, NULL, NULL); - if (rc) + rc = smb3_zero_data(file, tcon, offset, len, xid); + if (rc < 0) goto zero_range_exit; /* @@ -3658,6 +3656,8 @@ } zero_range_exit: + filemap_invalidate_unlock(inode->i_mapping); + inode_unlock(inode); free_xid(xid); if (rc) trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid, @@ -3702,7 +3702,7 @@ rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, - true /* is_fctl */, (char *)&fsctl_buf, + (char *)&fsctl_buf, sizeof(struct file_zero_data_information), CIFSMaxBufSize, NULL, NULL); filemap_invalidate_unlock(inode->i_mapping); @@ -3764,7 +3764,7 @@ in_data.length = cpu_to_le64(len); rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, - FSCTL_QUERY_ALLOCATED_RANGES, true, + FSCTL_QUERY_ALLOCATED_RANGES, (char *)&in_data, sizeof(in_data), 1024 * sizeof(struct file_allocated_range_buffer), (char **)&out_data, &out_data_len); @@ -3965,39 +3965,50 @@ { int rc; unsigned int xid; - struct inode *inode; + struct inode *inode = file_inode(file); struct cifsFileInfo *cfile = file->private_data; - struct cifsInodeInfo *cifsi; + struct cifsInodeInfo *cifsi = CIFS_I(inode); __le64 eof; + loff_t old_eof; xid = get_xid(); - inode = d_inode(cfile->dentry); - cifsi = CIFS_I(inode); + inode_lock(inode); - if (off >= i_size_read(inode) || - off + len >= i_size_read(inode)) { + old_eof = i_size_read(inode); + if ((off >= old_eof) || + off + len >= old_eof) { rc = -EINVAL; goto out; } + filemap_invalidate_lock(inode->i_mapping); + rc = filemap_write_and_wait_range(inode->i_mapping, off, old_eof - 1); + if (rc < 0) + goto out_2; + + truncate_pagecache_range(inode, off, old_eof); + rc = smb2_copychunk_range(xid, cfile, cfile, off + len, - i_size_read(inode) - off - len, off); + old_eof - off - len, off); if (rc < 0) - goto out; + goto out_2; - eof = cpu_to_le64(i_size_read(inode) - len); + eof = cpu_to_le64(old_eof - len); rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); if (rc < 0) - goto out; + goto out_2; rc = 0; cifsi->server_eof = i_size_read(inode) - len; truncate_setsize(inode, cifsi->server_eof); fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof); +out_2: + filemap_invalidate_unlock(inode->i_mapping); out: + inode_unlock(inode); free_xid(xid); return rc; } @@ -4008,34 +4019,47 @@ int rc; unsigned int xid; struct cifsFileInfo *cfile = file->private_data; + struct inode *inode = file_inode(file); __le64 eof; - __u64 count; + __u64 count, old_eof; xid = get_xid(); - if (off >= i_size_read(file->f_inode)) { + inode_lock(inode); + + old_eof = i_size_read(inode); + if (off >= old_eof) { rc = -EINVAL; goto out; } - count = i_size_read(file->f_inode) - off; - eof = cpu_to_le64(i_size_read(file->f_inode) + len); + count = old_eof - off; + eof = cpu_to_le64(old_eof + len); + + filemap_invalidate_lock(inode->i_mapping); + rc = filemap_write_and_wait_range(inode->i_mapping, off, old_eof + len - 1); + if (rc < 0) + goto out_2; + truncate_pagecache_range(inode, off, old_eof); rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); if (rc < 0) - goto out; + goto out_2; rc = smb2_copychunk_range(xid, cfile, cfile, off, count, off + len); if (rc < 0) - goto out; + goto out_2; - rc = smb3_zero_range(file, tcon, off, len, 1); + rc = smb3_zero_data(file, tcon, off, len, xid); if (rc < 0) - goto out; + goto out_2; rc = 0; +out_2: + filemap_invalidate_unlock(inode->i_mapping); out: + inode_unlock(inode); free_xid(xid); return rc; } @@ -4085,7 +4109,7 @@ rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, - FSCTL_QUERY_ALLOCATED_RANGES, true, + FSCTL_QUERY_ALLOCATED_RANGES, (char *)&in_data, sizeof(in_data), sizeof(struct file_allocated_range_buffer), (char **)&out_data, &out_data_len); @@ -4145,7 +4169,7 @@ rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, - FSCTL_QUERY_ALLOCATED_RANGES, true, + FSCTL_QUERY_ALLOCATED_RANGES, (char *)&in_data, sizeof(in_data), 1024 * sizeof(struct file_allocated_range_buffer), (char **)&out_data, &out_data_len); diff -Nru linux-aws-5.19.0/fs/cifs/smb2pdu.c linux-aws-5.19.0/fs/cifs/smb2pdu.c --- linux-aws-5.19.0/fs/cifs/smb2pdu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/smb2pdu.c 2022-11-29 07:06:46.000000000 +0000 @@ -964,16 +964,17 @@ } else if (rc != 0) goto neg_exit; + rc = -EIO; if (strcmp(server->vals->version_string, SMB3ANY_VERSION_STRING) == 0) { if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { cifs_server_dbg(VFS, "SMB2 dialect returned but not requested\n"); - return -EIO; + goto neg_exit; } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { cifs_server_dbg(VFS, "SMB2.1 dialect returned but not requested\n"); - return -EIO; + goto neg_exit; } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) { /* ops set to 3.0 by default for default so update */ server->ops = &smb311_operations; @@ -984,7 +985,7 @@ if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { cifs_server_dbg(VFS, "SMB2 dialect returned but not requested\n"); - return -EIO; + goto neg_exit; } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { /* ops set to 3.0 by default for default so update */ server->ops = &smb21_operations; @@ -998,7 +999,7 @@ /* if requested single dialect ensure returned dialect matched */ cifs_server_dbg(VFS, "Invalid 0x%x dialect returned: not requested\n", le16_to_cpu(rsp->DialectRevision)); - return -EIO; + goto neg_exit; } cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode); @@ -1016,9 +1017,10 @@ else { cifs_server_dbg(VFS, "Invalid dialect returned by server 0x%x\n", le16_to_cpu(rsp->DialectRevision)); - rc = -EIO; goto neg_exit; } + + rc = 0; server->dialect = le16_to_cpu(rsp->DialectRevision); /* @@ -1166,13 +1168,13 @@ pneg_inbuf->Dialects[0] = cpu_to_le16(server->vals->protocol_id); pneg_inbuf->DialectCount = cpu_to_le16(1); - /* structure is big enough for 3 dialects, sending only 1 */ + /* structure is big enough for 4 dialects, sending only 1 */ inbuflen = sizeof(*pneg_inbuf) - - sizeof(pneg_inbuf->Dialects[0]) * 2; + sizeof(pneg_inbuf->Dialects[0]) * 3; } rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, - FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */, + FSCTL_VALIDATE_NEGOTIATE_INFO, (char *)pneg_inbuf, inbuflen, CIFSMaxBufSize, (char **)&pneg_rsp, &rsplen); if (rc == -EOPNOTSUPP) { @@ -2408,7 +2410,7 @@ unsigned int acelen, acl_size, ace_count; unsigned int owner_offset = 0; unsigned int group_offset = 0; - struct smb3_acl acl; + struct smb3_acl acl = {}; *len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); @@ -2481,6 +2483,7 @@ acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclSize = cpu_to_le16(acl_size); acl.AceCount = cpu_to_le16(ace_count); + /* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); @@ -3051,7 +3054,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, struct smb_rqst *rqst, u64 persistent_fid, u64 volatile_fid, u32 opcode, - bool is_fsctl, char *in_data, u32 indatalen, + char *in_data, u32 indatalen, __u32 max_response_size) { struct smb2_ioctl_req *req; @@ -3126,10 +3129,8 @@ req->hdr.CreditCharge = cpu_to_le16(DIV_ROUND_UP(max(indatalen, max_response_size), SMB2_MAX_BUFFER_SIZE)); - if (is_fsctl) - req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); - else - req->Flags = 0; + /* always an FSCTL (for now) */ + req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); /* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */ if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) @@ -3156,9 +3157,9 @@ */ int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, - u64 volatile_fid, u32 opcode, bool is_fsctl, - char *in_data, u32 indatalen, u32 max_out_data_len, - char **out_data, u32 *plen /* returned data len */) + u64 volatile_fid, u32 opcode, char *in_data, u32 indatalen, + u32 max_out_data_len, char **out_data, + u32 *plen /* returned data len */) { struct smb_rqst rqst; struct smb2_ioctl_rsp *rsp = NULL; @@ -3200,7 +3201,7 @@ rc = SMB2_ioctl_init(tcon, server, &rqst, persistent_fid, volatile_fid, opcode, - is_fsctl, in_data, indatalen, max_out_data_len); + in_data, indatalen, max_out_data_len); if (rc) goto ioctl_exit; @@ -3292,7 +3293,7 @@ cpu_to_le16(COMPRESSION_FORMAT_DEFAULT); rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid, - FSCTL_SET_COMPRESSION, true /* is_fsctl */, + FSCTL_SET_COMPRESSION, (char *)&fsctl_input /* data input */, 2 /* in data len */, CIFSMaxBufSize /* max out data */, &ret_data /* out data */, NULL); diff -Nru linux-aws-5.19.0/fs/cifs/smb2proto.h linux-aws-5.19.0/fs/cifs/smb2proto.h --- linux-aws-5.19.0/fs/cifs/smb2proto.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/smb2proto.h 2022-11-29 07:06:46.000000000 +0000 @@ -147,13 +147,13 @@ extern void SMB2_open_free(struct smb_rqst *rqst); extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 opcode, - bool is_fsctl, char *in_data, u32 indatalen, u32 maxoutlen, + char *in_data, u32 indatalen, u32 maxoutlen, char **out_data, u32 *plen /* returned data len */); extern int SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, struct smb_rqst *rqst, u64 persistent_fid, u64 volatile_fid, u32 opcode, - bool is_fsctl, char *in_data, u32 indatalen, + char *in_data, u32 indatalen, __u32 max_response_size); extern void SMB2_ioctl_free(struct smb_rqst *rqst); extern int SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, diff -Nru linux-aws-5.19.0/fs/cifs/smb2transport.c linux-aws-5.19.0/fs/cifs/smb2transport.c --- linux-aws-5.19.0/fs/cifs/smb2transport.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/smb2transport.c 2022-11-29 07:06:46.000000000 +0000 @@ -225,9 +225,9 @@ struct smb_rqst drqst; ses = smb2_find_smb_ses(server, le64_to_cpu(shdr->SessionId)); - if (!ses) { + if (unlikely(!ses)) { cifs_server_dbg(VFS, "%s: Could not find session\n", __func__); - return 0; + return -ENOENT; } memset(smb2_signature, 0x0, SMB2_HMACSHA256_SIZE); @@ -557,8 +557,10 @@ u8 key[SMB3_SIGN_KEY_SIZE]; rc = smb2_get_sign_key(le64_to_cpu(shdr->SessionId), server, key); - if (rc) - return 0; + if (unlikely(rc)) { + cifs_server_dbg(VFS, "%s: Could not get signing key\n", __func__); + return rc; + } if (allocate_crypto) { rc = cifs_alloc_hash("cmac(aes)", &hash, &sdesc); diff -Nru linux-aws-5.19.0/fs/cifs/transport.c linux-aws-5.19.0/fs/cifs/transport.c --- linux-aws-5.19.0/fs/cifs/transport.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/cifs/transport.c 2022-11-29 07:06:46.000000000 +0000 @@ -196,10 +196,6 @@ *sent = 0; - smb_msg->msg_name = (struct sockaddr *) &server->dstaddr; - smb_msg->msg_namelen = sizeof(struct sockaddr); - smb_msg->msg_control = NULL; - smb_msg->msg_controllen = 0; if (server->noblocksnd) smb_msg->msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; else @@ -311,7 +307,7 @@ sigset_t mask, oldmask; size_t total_len = 0, sent, size; struct socket *ssocket = server->ssocket; - struct msghdr smb_msg; + struct msghdr smb_msg = {}; __be32 rfc1002_marker; if (cifs_rdma_enabled(server)) { diff -Nru linux-aws-5.19.0/fs/coredump.c linux-aws-5.19.0/fs/coredump.c --- linux-aws-5.19.0/fs/coredump.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/coredump.c 2022-11-29 07:06:46.000000000 +0000 @@ -832,6 +832,38 @@ } } +static int dump_emit_page(struct coredump_params *cprm, struct page *page) +{ + struct bio_vec bvec = { + .bv_page = page, + .bv_offset = 0, + .bv_len = PAGE_SIZE, + }; + struct iov_iter iter; + struct file *file = cprm->file; + loff_t pos = file->f_pos; + ssize_t n; + + if (cprm->to_skip) { + if (!__dump_skip(cprm, cprm->to_skip)) + return 0; + cprm->to_skip = 0; + } + if (cprm->written + PAGE_SIZE > cprm->limit) + return 0; + if (dump_interrupted()) + return 0; + iov_iter_bvec(&iter, WRITE, &bvec, 1, PAGE_SIZE); + n = __kernel_write_iter(cprm->file, &iter, &pos); + if (n != PAGE_SIZE) + return 0; + file->f_pos = pos; + cprm->written += PAGE_SIZE; + cprm->pos += PAGE_SIZE; + + return 1; +} + int dump_emit(struct coredump_params *cprm, const void *addr, int nr) { if (cprm->to_skip) { @@ -863,7 +895,6 @@ for (addr = start; addr < start + len; addr += PAGE_SIZE) { struct page *page; - int stop; /* * To avoid having to allocate page tables for virtual address @@ -874,10 +905,7 @@ */ page = get_dump_page(addr); if (page) { - void *kaddr = kmap_local_page(page); - - stop = !dump_emit(cprm, kaddr, PAGE_SIZE); - kunmap_local(kaddr); + int stop = !dump_emit_page(cprm, page); put_page(page); if (stop) return 0; diff -Nru linux-aws-5.19.0/fs/dax.c linux-aws-5.19.0/fs/dax.c --- linux-aws-5.19.0/fs/dax.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/dax.c 2022-11-29 07:06:46.000000000 +0000 @@ -1241,6 +1241,9 @@ loff_t done = 0; int ret; + if (!iomi.len) + return 0; + if (iov_iter_rw(iter) == WRITE) { lockdep_assert_held_write(&iomi.inode->i_rwsem); iomi.flags |= IOMAP_WRITE; diff -Nru linux-aws-5.19.0/fs/debugfs/inode.c linux-aws-5.19.0/fs/debugfs/inode.c --- linux-aws-5.19.0/fs/debugfs/inode.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/debugfs/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -745,6 +745,28 @@ EXPORT_SYMBOL_GPL(debugfs_remove); /** + * debugfs_lookup_and_remove - lookup a directory or file and recursively remove it + * @name: a pointer to a string containing the name of the item to look up. + * @parent: a pointer to the parent dentry of the item. + * + * This is the equlivant of doing something like + * debugfs_remove(debugfs_lookup(..)) but with the proper reference counting + * handled for the directory being looked up. + */ +void debugfs_lookup_and_remove(const char *name, struct dentry *parent) +{ + struct dentry *dentry; + + dentry = debugfs_lookup(name, parent); + if (!dentry) + return; + + debugfs_remove(dentry); + dput(dentry); +} +EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove); + +/** * debugfs_rename - rename a file/directory in the debugfs filesystem * @old_dir: a pointer to the parent dentry for the renamed object. This * should be a directory dentry. diff -Nru linux-aws-5.19.0/fs/dlm/ast.c linux-aws-5.19.0/fs/dlm/ast.c --- linux-aws-5.19.0/fs/dlm/ast.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/dlm/ast.c 2022-11-29 07:06:46.000000000 +0000 @@ -200,13 +200,13 @@ if (!prev_seq) { kref_get(&lkb->lkb_ref); + mutex_lock(&ls->ls_cb_mutex); if (test_bit(LSFL_CB_DELAY, &ls->ls_flags)) { - mutex_lock(&ls->ls_cb_mutex); list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); - mutex_unlock(&ls->ls_cb_mutex); } else { queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); } + mutex_unlock(&ls->ls_cb_mutex); } out: mutex_unlock(&lkb->lkb_cb_mutex); @@ -288,7 +288,9 @@ void dlm_callback_suspend(struct dlm_ls *ls) { + mutex_lock(&ls->ls_cb_mutex); set_bit(LSFL_CB_DELAY, &ls->ls_flags); + mutex_unlock(&ls->ls_cb_mutex); if (ls->ls_callback_wq) flush_workqueue(ls->ls_callback_wq); diff -Nru linux-aws-5.19.0/fs/dlm/lock.c linux-aws-5.19.0/fs/dlm/lock.c --- linux-aws-5.19.0/fs/dlm/lock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/dlm/lock.c 2022-11-29 07:06:46.000000000 +0000 @@ -2920,17 +2920,9 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_args *args) { - int rv = -EINVAL; + int rv = -EBUSY; if (args->flags & DLM_LKF_CONVERT) { - if (lkb->lkb_flags & DLM_IFL_MSTCPY) - goto out; - - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) - goto out; - - rv = -EBUSY; if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; @@ -2940,6 +2932,14 @@ if (is_overlap(lkb)) goto out; + + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) + goto out; + + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + goto out; } lkb->lkb_exflags = args->flags; @@ -3672,7 +3672,7 @@ case cpu_to_le32(DLM_MSG_REQUEST_REPLY): case cpu_to_le32(DLM_MSG_CONVERT_REPLY): case cpu_to_le32(DLM_MSG_GRANT): - if (!lkb->lkb_lvbptr) + if (!lkb->lkb_lvbptr || !(lkb->lkb_exflags & DLM_LKF_VALBLK)) break; memcpy(ms->m_extra, lkb->lkb_lvbptr, r->res_ls->ls_lvblen); break; diff -Nru linux-aws-5.19.0/fs/dlm/lowcomms.c linux-aws-5.19.0/fs/dlm/lowcomms.c --- linux-aws-5.19.0/fs/dlm/lowcomms.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/dlm/lowcomms.c 2022-11-29 07:06:46.000000000 +0000 @@ -1336,6 +1336,8 @@ return NULL; } + /* for dlm_lowcomms_commit_msg() */ + kref_get(&msg->ref); /* we assume if successful commit must called */ msg->idx = idx; return msg; @@ -1375,6 +1377,8 @@ { _dlm_lowcomms_commit_msg(msg); srcu_read_unlock(&connections_srcu, msg->idx); + /* because dlm_lowcomms_new_msg() */ + kref_put(&msg->ref, dlm_msg_release); } #endif diff -Nru linux-aws-5.19.0/fs/erofs/fscache.c linux-aws-5.19.0/fs/erofs/fscache.c --- linux-aws-5.19.0/fs/erofs/fscache.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/erofs/fscache.c 2022-11-29 07:06:46.000000000 +0000 @@ -222,8 +222,10 @@ rreq = erofs_fscache_alloc_request(folio_mapping(folio), folio_pos(folio), folio_size(folio)); - if (IS_ERR(rreq)) + if (IS_ERR(rreq)) { + ret = PTR_ERR(rreq); goto out; + } return erofs_fscache_read_folios_async(mdev.m_fscache->cookie, rreq, mdev.m_pa); @@ -301,8 +303,10 @@ rreq = erofs_fscache_alloc_request(folio_mapping(folio), folio_pos(folio), folio_size(folio)); - if (IS_ERR(rreq)) + if (IS_ERR(rreq)) { + ret = PTR_ERR(rreq); goto out_unlock; + } pstart = mdev.m_pa + (pos - map.m_la); return erofs_fscache_read_folios_async(mdev.m_fscache->cookie, diff -Nru linux-aws-5.19.0/fs/erofs/inode.c linux-aws-5.19.0/fs/erofs/inode.c --- linux-aws-5.19.0/fs/erofs/inode.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/erofs/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -214,7 +214,7 @@ /* if it cannot be handled with fast symlink scheme */ if (vi->datalayout != EROFS_INODE_FLAT_INLINE || - inode->i_size >= EROFS_BLKSIZ) { + inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) { inode->i_op = &erofs_symlink_iops; return 0; } diff -Nru linux-aws-5.19.0/fs/erofs/internal.h linux-aws-5.19.0/fs/erofs/internal.h --- linux-aws-5.19.0/fs/erofs/internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/erofs/internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -195,7 +195,6 @@ atomic_t refcount; }; -#if defined(CONFIG_SMP) static inline bool erofs_workgroup_try_to_freeze(struct erofs_workgroup *grp, int val) { @@ -224,34 +223,6 @@ return atomic_cond_read_relaxed(&grp->refcount, VAL != EROFS_LOCKED_MAGIC); } -#else -static inline bool erofs_workgroup_try_to_freeze(struct erofs_workgroup *grp, - int val) -{ - preempt_disable(); - /* no need to spin on UP platforms, let's just disable preemption. */ - if (val != atomic_read(&grp->refcount)) { - preempt_enable(); - return false; - } - return true; -} - -static inline void erofs_workgroup_unfreeze(struct erofs_workgroup *grp, - int orig_val) -{ - preempt_enable(); -} - -static inline int erofs_wait_on_workgroup_freezed(struct erofs_workgroup *grp) -{ - int v = atomic_read(&grp->refcount); - - /* workgroup is never freezed on uniprocessor systems */ - DBG_BUGON(v == EROFS_LOCKED_MAGIC); - return v; -} -#endif /* !CONFIG_SMP */ #endif /* !CONFIG_EROFS_FS_ZIP */ /* we strictly follow PAGE_SIZE and no buffer head yet */ diff -Nru linux-aws-5.19.0/fs/erofs/super.c linux-aws-5.19.0/fs/erofs/super.c --- linux-aws-5.19.0/fs/erofs/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/erofs/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -877,7 +877,7 @@ WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC); if (erofs_is_fscache_mode(sb)) - generic_shutdown_super(sb); + kill_anon_super(sb); else kill_block_super(sb); diff -Nru linux-aws-5.19.0/fs/eventfd.c linux-aws-5.19.0/fs/eventfd.c --- linux-aws-5.19.0/fs/eventfd.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/eventfd.c 2022-11-29 07:06:46.000000000 +0000 @@ -69,17 +69,17 @@ * it returns false, the eventfd_signal() call should be deferred to a * safe context. */ - if (WARN_ON_ONCE(current->in_eventfd_signal)) + if (WARN_ON_ONCE(current->in_eventfd)) return 0; spin_lock_irqsave(&ctx->wqh.lock, flags); - current->in_eventfd_signal = 1; + current->in_eventfd = 1; if (ULLONG_MAX - ctx->count < n) n = ULLONG_MAX - ctx->count; ctx->count += n; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); - current->in_eventfd_signal = 0; + current->in_eventfd = 0; spin_unlock_irqrestore(&ctx->wqh.lock, flags); return n; @@ -253,8 +253,10 @@ __set_current_state(TASK_RUNNING); } eventfd_ctx_do_read(ctx, &ucnt); + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLOUT); + current->in_eventfd = 0; spin_unlock_irq(&ctx->wqh.lock); if (unlikely(copy_to_iter(&ucnt, sizeof(ucnt), to) != sizeof(ucnt))) return -EFAULT; @@ -301,8 +303,10 @@ } if (likely(res > 0)) { ctx->count += ucnt; + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); + current->in_eventfd = 0; } spin_unlock_irq(&ctx->wqh.lock); diff -Nru linux-aws-5.19.0/fs/exfat/fatent.c linux-aws-5.19.0/fs/exfat/fatent.c --- linux-aws-5.19.0/fs/exfat/fatent.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/exfat/fatent.c 2022-11-29 07:06:46.000000000 +0000 @@ -270,8 +270,7 @@ struct super_block *sb = dir->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); struct buffer_head *bh; - sector_t blknr, last_blknr; - int i; + sector_t blknr, last_blknr, i; blknr = exfat_cluster_to_sector(sbi, clu); last_blknr = blknr + sbi->sect_per_clus; diff -Nru linux-aws-5.19.0/fs/ext2/super.c linux-aws-5.19.0/fs/ext2/super.c --- linux-aws-5.19.0/fs/ext2/super.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext2/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -163,7 +163,7 @@ db_count = sbi->s_gdb_count; for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); percpu_counter_destroy(&sbi->s_freeblocks_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter); @@ -1053,6 +1053,13 @@ sbi->s_blocks_per_group); goto failed_mount; } + /* At least inode table, bitmaps, and sb have to fit in one group */ + if (sbi->s_blocks_per_group <= sbi->s_itb_per_group + 3) { + ext2_msg(sb, KERN_ERR, + "error: #blocks per group smaller than metadata size: %lu <= %lu", + sbi->s_blocks_per_group, sbi->s_inodes_per_group + 3); + goto failed_mount; + } if (sbi->s_frags_per_group > sb->s_blocksize * 8) { ext2_msg(sb, KERN_ERR, "error: #fragments per group too big: %lu", @@ -1066,9 +1073,14 @@ sbi->s_inodes_per_group); goto failed_mount; } + if (sb_bdev_nr_blocks(sb) < le32_to_cpu(es->s_blocks_count)) { + ext2_msg(sb, KERN_ERR, + "bad geometry: block count %u exceeds size of device (%u blocks)", + le32_to_cpu(es->s_blocks_count), + (unsigned)sb_bdev_nr_blocks(sb)); + goto failed_mount; + } - if (EXT2_BLOCKS_PER_GROUP(sb) == 0) - goto cantfind_ext2; sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) - 1) / EXT2_BLOCKS_PER_GROUP(sb)) + 1; @@ -1081,7 +1093,7 @@ } db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); - sbi->s_group_desc = kmalloc_array(db_count, + sbi->s_group_desc = kvmalloc_array(db_count, sizeof(struct buffer_head *), GFP_KERNEL); if (sbi->s_group_desc == NULL) { @@ -1207,7 +1219,7 @@ for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); failed_mount_group_desc: - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); failed_mount: brelse(bh); diff -Nru linux-aws-5.19.0/fs/ext4/ext4.h linux-aws-5.19.0/fs/ext4/ext4.h --- linux-aws-5.19.0/fs/ext4/ext4.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/ext4.h 2022-11-29 07:06:46.000000000 +0000 @@ -167,8 +167,6 @@ #define EXT4_MB_CR0_OPTIMIZED 0x8000 /* Avg fragment size rb tree lookup succeeded at least once for cr = 1 */ #define EXT4_MB_CR1_OPTIMIZED 0x00010000 -/* Perform linear traversal for one group */ -#define EXT4_MB_SEARCH_NEXT_LINEAR 0x00020000 struct ext4_allocation_request { /* target inode for block we're allocating */ struct inode *inode; @@ -1589,8 +1587,8 @@ struct list_head s_discard_list; struct work_struct s_discard_work; atomic_t s_retry_alloc_pending; - struct rb_root s_mb_avg_fragment_size_root; - rwlock_t s_mb_rb_lock; + struct list_head *s_mb_avg_fragment_size; + rwlock_t *s_mb_avg_fragment_size_locks; struct list_head *s_mb_largest_free_orders; rwlock_t *s_mb_largest_free_orders_locks; @@ -3402,6 +3400,8 @@ ext4_grpblk_t bb_first_free; /* first free block */ ext4_grpblk_t bb_free; /* total free blocks */ ext4_grpblk_t bb_fragments; /* nr of freespace fragments */ + int bb_avg_fragment_size_order; /* order of average + fragment in BG */ ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */ ext4_group_t bb_group; /* Group number */ struct list_head bb_prealloc_list; @@ -3409,7 +3409,7 @@ void *bb_bitmap; #endif struct rw_semaphore alloc_sem; - struct rb_node bb_avg_fragment_size_rb; + struct list_head bb_avg_fragment_size_node; struct list_head bb_largest_free_order_node; ext4_grpblk_t bb_counters[]; /* Nr of free power-of-two-block * regions, index is order. diff -Nru linux-aws-5.19.0/fs/ext4/extents.c linux-aws-5.19.0/fs/ext4/extents.c --- linux-aws-5.19.0/fs/ext4/extents.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/extents.c 2022-11-29 07:06:46.000000000 +0000 @@ -460,6 +460,10 @@ error_msg = "invalid eh_entries"; goto corrupted; } + if (unlikely((eh->eh_entries == 0) && (depth > 0))) { + error_msg = "eh_entries is 0 but eh_depth is > 0"; + goto corrupted; + } if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { error_msg = "invalid extent entries"; goto corrupted; diff -Nru linux-aws-5.19.0/fs/ext4/fast_commit.c linux-aws-5.19.0/fs/ext4/fast_commit.c --- linux-aws-5.19.0/fs/ext4/fast_commit.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/fast_commit.c 2022-11-29 07:06:46.000000000 +0000 @@ -874,22 +874,25 @@ tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE); tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino)); + ret = -ECANCELED; dst = ext4_fc_reserve_space(inode->i_sb, sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc); if (!dst) - return -ECANCELED; + goto err; if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc)) - return -ECANCELED; + goto err; dst += sizeof(tl); if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc)) - return -ECANCELED; + goto err; dst += sizeof(fc_inode); if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc), inode_len, crc)) - return -ECANCELED; - - return 0; + goto err; + ret = 0; +err: + brelse(iloc.bh); + return ret; } /* @@ -1491,13 +1494,15 @@ if (state->fc_modified_inodes[i] == ino) return 0; if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) { - state->fc_modified_inodes = krealloc( - state->fc_modified_inodes, + int *fc_modified_inodes; + + fc_modified_inodes = krealloc(state->fc_modified_inodes, sizeof(int) * (state->fc_modified_inodes_size + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); - if (!state->fc_modified_inodes) + if (!fc_modified_inodes) return -ENOMEM; + state->fc_modified_inodes = fc_modified_inodes; state->fc_modified_inodes_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; } @@ -1682,15 +1687,18 @@ if (replay && state->fc_regions_used != state->fc_regions_valid) state->fc_regions_used = state->fc_regions_valid; if (state->fc_regions_used == state->fc_regions_size) { + struct ext4_fc_alloc_region *fc_regions; + + fc_regions = krealloc(state->fc_regions, + sizeof(struct ext4_fc_alloc_region) * + (state->fc_regions_size + + EXT4_FC_REPLAY_REALLOC_INCREMENT), + GFP_KERNEL); + if (!fc_regions) + return -ENOMEM; state->fc_regions_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; - state->fc_regions = krealloc( - state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), - GFP_KERNEL); - if (!state->fc_regions) - return -ENOMEM; + state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; region->ino = ino; diff -Nru linux-aws-5.19.0/fs/ext4/file.c linux-aws-5.19.0/fs/ext4/file.c --- linux-aws-5.19.0/fs/ext4/file.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/file.c 2022-11-29 07:06:46.000000000 +0000 @@ -528,6 +528,12 @@ ret = -EAGAIN; goto out; } + /* + * Make sure inline data cannot be created anymore since we are going + * to allocate blocks for DIO. We know the inode does not have any + * inline data now because ext4_dio_supported() checked for that. + */ + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); offset = iocb->ki_pos; count = ret; diff -Nru linux-aws-5.19.0/fs/ext4/ialloc.c linux-aws-5.19.0/fs/ext4/ialloc.c --- linux-aws-5.19.0/fs/ext4/ialloc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/ialloc.c 2022-11-29 07:06:46.000000000 +0000 @@ -510,7 +510,7 @@ goto fallback; } - max_dirs = ndirs / ngroups + inodes_per_group / 16; + max_dirs = ndirs / ngroups + inodes_per_group*flex_size / 16; min_inodes = avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes = 1; diff -Nru linux-aws-5.19.0/fs/ext4/inode.c linux-aws-5.19.0/fs/ext4/inode.c --- linux-aws-5.19.0/fs/ext4/inode.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -1188,6 +1188,13 @@ page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; + /* + * The same as page allocation, we prealloc buffer heads before + * starting the handle. + */ + if (!page_has_buffers(page)) + create_empty_buffers(page, inode->i_sb->s_blocksize, 0); + unlock_page(page); retry_journal: @@ -5340,6 +5347,7 @@ int error, rc = 0; int orphan = 0; const unsigned int ia_valid = attr->ia_valid; + bool inc_ivers = true; if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) return -EIO; @@ -5425,8 +5433,8 @@ return -EINVAL; } - if (IS_I_VERSION(inode) && attr->ia_size != inode->i_size) - inode_inc_iversion(inode); + if (attr->ia_size == inode->i_size) + inc_ivers = false; if (shrink) { if (ext4_should_order_data(inode)) { @@ -5528,6 +5536,8 @@ } if (!error) { + if (inc_ivers) + inode_inc_iversion(inode); setattr_copy(mnt_userns, inode, attr); mark_inode_dirty(inode); } @@ -5731,9 +5741,6 @@ } ext4_fc_track_inode(handle, inode); - if (IS_I_VERSION(inode)) - inode_inc_iversion(inode); - /* the do_update_inode consumes one bh->b_count */ get_bh(iloc->bh); diff -Nru linux-aws-5.19.0/fs/ext4/ioctl.c linux-aws-5.19.0/fs/ext4/ioctl.c --- linux-aws-5.19.0/fs/ext4/ioctl.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/ioctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -442,6 +442,7 @@ swap_inode_data(inode, inode_bl); inode->i_ctime = inode_bl->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = prandom_u32(); inode_bl->i_generation = prandom_u32(); @@ -655,6 +656,7 @@ ext4_set_inode_flags(inode, false); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); err = ext4_mark_iloc_dirty(handle, inode, &iloc); flags_err: @@ -765,6 +767,7 @@ EXT4_I(inode)->i_projid = kprojid; inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); out_dirty: rc = ext4_mark_iloc_dirty(handle, inode, &iloc); if (!err) @@ -1178,6 +1181,7 @@ err = ext4_reserve_inode_write(handle, inode, &iloc); if (err == 0) { inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = generation; err = ext4_mark_iloc_dirty(handle, inode, &iloc); } diff -Nru linux-aws-5.19.0/fs/ext4/mballoc.c linux-aws-5.19.0/fs/ext4/mballoc.c --- linux-aws-5.19.0/fs/ext4/mballoc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/mballoc.c 2022-11-29 07:06:46.000000000 +0000 @@ -140,13 +140,15 @@ * number of buddy bitmap orders possible) number of lists. Group-infos are * placed in appropriate lists. * - * 2) Average fragment size rb tree (sbi->s_mb_avg_fragment_size_root) + * 2) Average fragment size lists (sbi->s_mb_avg_fragment_size) * - * Locking: sbi->s_mb_rb_lock (rwlock) + * Locking: sbi->s_mb_avg_fragment_size_locks(array of rw locks) * - * This is a red black tree consisting of group infos and the tree is sorted - * by average fragment sizes (which is calculated as ext4_group_info->bb_free - * / ext4_group_info->bb_fragments). + * This is an array of lists where in the i-th list there are groups with + * average fragment size >= 2^i and < 2^(i+1). The average fragment size + * is computed as ext4_group_info->bb_free / ext4_group_info->bb_fragments. + * Note that we don't bother with a special list for completely empty groups + * so we only have MB_NUM_ORDERS(sb) lists. * * When "mb_optimize_scan" mount option is set, mballoc consults the above data * structures to decide the order in which groups are to be traversed for @@ -160,7 +162,8 @@ * * At CR = 1, we only consider groups where average fragment size > request * size. So, we lookup a group which has average fragment size just above or - * equal to request size using our rb tree (data structure 2) in O(log N) time. + * equal to request size using our average fragment size group lists (data + * structure 2) in O(1) time. * * If "mb_optimize_scan" mount option is not set, mballoc traverses groups in * linear order which requires O(N) search time for each CR 0 and CR 1 phase. @@ -802,65 +805,51 @@ } } -static void ext4_mb_rb_insert(struct rb_root *root, struct rb_node *new, - int (*cmp)(struct rb_node *, struct rb_node *)) +static int mb_avg_fragment_size_order(struct super_block *sb, ext4_grpblk_t len) { - struct rb_node **iter = &root->rb_node, *parent = NULL; + int order; - while (*iter) { - parent = *iter; - if (cmp(new, *iter) > 0) - iter = &((*iter)->rb_left); - else - iter = &((*iter)->rb_right); - } - - rb_link_node(new, parent, iter); - rb_insert_color(new, root); -} - -static int -ext4_mb_avg_fragment_size_cmp(struct rb_node *rb1, struct rb_node *rb2) -{ - struct ext4_group_info *grp1 = rb_entry(rb1, - struct ext4_group_info, - bb_avg_fragment_size_rb); - struct ext4_group_info *grp2 = rb_entry(rb2, - struct ext4_group_info, - bb_avg_fragment_size_rb); - int num_frags_1, num_frags_2; - - num_frags_1 = grp1->bb_fragments ? - grp1->bb_free / grp1->bb_fragments : 0; - num_frags_2 = grp2->bb_fragments ? - grp2->bb_free / grp2->bb_fragments : 0; - - return (num_frags_2 - num_frags_1); + /* + * We don't bother with a special lists groups with only 1 block free + * extents and for completely empty groups. + */ + order = fls(len) - 2; + if (order < 0) + return 0; + if (order == MB_NUM_ORDERS(sb)) + order--; + return order; } -/* - * Reinsert grpinfo into the avg_fragment_size tree with new average - * fragment size. - */ +/* Move group to appropriate avg_fragment_size list */ static void mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp) { struct ext4_sb_info *sbi = EXT4_SB(sb); + int new_order; if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_free == 0) return; - write_lock(&sbi->s_mb_rb_lock); - if (!RB_EMPTY_NODE(&grp->bb_avg_fragment_size_rb)) { - rb_erase(&grp->bb_avg_fragment_size_rb, - &sbi->s_mb_avg_fragment_size_root); - RB_CLEAR_NODE(&grp->bb_avg_fragment_size_rb); - } + new_order = mb_avg_fragment_size_order(sb, + grp->bb_free / grp->bb_fragments); + if (new_order == grp->bb_avg_fragment_size_order) + return; - ext4_mb_rb_insert(&sbi->s_mb_avg_fragment_size_root, - &grp->bb_avg_fragment_size_rb, - ext4_mb_avg_fragment_size_cmp); - write_unlock(&sbi->s_mb_rb_lock); + if (grp->bb_avg_fragment_size_order != -1) { + write_lock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + list_del(&grp->bb_avg_fragment_size_node); + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + } + grp->bb_avg_fragment_size_order = new_order; + write_lock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); + list_add_tail(&grp->bb_avg_fragment_size_node, + &sbi->s_mb_avg_fragment_size[grp->bb_avg_fragment_size_order]); + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ + grp->bb_avg_fragment_size_order]); } /* @@ -909,86 +898,55 @@ *new_cr = 1; } else { *group = grp->bb_group; - ac->ac_last_optimal_group = *group; ac->ac_flags |= EXT4_MB_CR0_OPTIMIZED; } } /* - * Choose next group by traversing average fragment size tree. Updates *new_cr - * if cr lvel needs an update. Sets EXT4_MB_SEARCH_NEXT_LINEAR to indicate that - * the linear search should continue for one iteration since there's lock - * contention on the rb tree lock. + * Choose next group by traversing average fragment size list of suitable + * order. Updates *new_cr if cr level needs an update. */ static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *ac, int *new_cr, ext4_group_t *group, ext4_group_t ngroups) { struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); - int avg_fragment_size, best_so_far; - struct rb_node *node, *found; - struct ext4_group_info *grp; - - /* - * If there is contention on the lock, instead of waiting for the lock - * to become available, just continue searching lineraly. We'll resume - * our rb tree search later starting at ac->ac_last_optimal_group. - */ - if (!read_trylock(&sbi->s_mb_rb_lock)) { - ac->ac_flags |= EXT4_MB_SEARCH_NEXT_LINEAR; - return; - } + struct ext4_group_info *grp = NULL, *iter; + int i; if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) { if (sbi->s_mb_stats) atomic_inc(&sbi->s_bal_cr1_bad_suggestions); - /* We have found something at CR 1 in the past */ - grp = ext4_get_group_info(ac->ac_sb, ac->ac_last_optimal_group); - for (found = rb_next(&grp->bb_avg_fragment_size_rb); found != NULL; - found = rb_next(found)) { - grp = rb_entry(found, struct ext4_group_info, - bb_avg_fragment_size_rb); + } + + for (i = mb_avg_fragment_size_order(ac->ac_sb, ac->ac_g_ex.fe_len); + i < MB_NUM_ORDERS(ac->ac_sb); i++) { + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) + continue; + read_lock(&sbi->s_mb_avg_fragment_size_locks[i]); + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) { + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); + continue; + } + list_for_each_entry(iter, &sbi->s_mb_avg_fragment_size[i], + bb_avg_fragment_size_node) { if (sbi->s_mb_stats) atomic64_inc(&sbi->s_bal_cX_groups_considered[1]); - if (likely(ext4_mb_good_group(ac, grp->bb_group, 1))) + if (likely(ext4_mb_good_group(ac, iter->bb_group, 1))) { + grp = iter; break; - } - goto done; - } - - node = sbi->s_mb_avg_fragment_size_root.rb_node; - best_so_far = 0; - found = NULL; - - while (node) { - grp = rb_entry(node, struct ext4_group_info, - bb_avg_fragment_size_rb); - avg_fragment_size = 0; - if (ext4_mb_good_group(ac, grp->bb_group, 1)) { - avg_fragment_size = grp->bb_fragments ? - grp->bb_free / grp->bb_fragments : 0; - if (!best_so_far || avg_fragment_size < best_so_far) { - best_so_far = avg_fragment_size; - found = node; } } - if (avg_fragment_size > ac->ac_g_ex.fe_len) - node = node->rb_right; - else - node = node->rb_left; + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); + if (grp) + break; } -done: - if (found) { - grp = rb_entry(found, struct ext4_group_info, - bb_avg_fragment_size_rb); + if (grp) { *group = grp->bb_group; ac->ac_flags |= EXT4_MB_CR1_OPTIMIZED; } else { *new_cr = 2; } - - read_unlock(&sbi->s_mb_rb_lock); - ac->ac_last_optimal_group = *group; } static inline int should_optimize_scan(struct ext4_allocation_context *ac) @@ -1017,11 +975,6 @@ goto inc_and_return; } - if (ac->ac_flags & EXT4_MB_SEARCH_NEXT_LINEAR) { - ac->ac_flags &= ~EXT4_MB_SEARCH_NEXT_LINEAR; - goto inc_and_return; - } - return group; inc_and_return: /* @@ -1049,8 +1002,10 @@ { *new_cr = ac->ac_criteria; - if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) + if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) { + *group = next_linear_group(ac, *group, ngroups); return; + } if (*new_cr == 0) { ext4_mb_choose_next_group_cr0(ac, new_cr, group, ngroups); @@ -1075,23 +1030,25 @@ struct ext4_sb_info *sbi = EXT4_SB(sb); int i; - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && grp->bb_largest_free_order >= 0) { + for (i = MB_NUM_ORDERS(sb) - 1; i >= 0; i--) + if (grp->bb_counters[i] > 0) + break; + /* No need to move between order lists? */ + if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || + i == grp->bb_largest_free_order) { + grp->bb_largest_free_order = i; + return; + } + + if (grp->bb_largest_free_order >= 0) { write_lock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); list_del_init(&grp->bb_largest_free_order_node); write_unlock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); } - grp->bb_largest_free_order = -1; /* uninit */ - - for (i = MB_NUM_ORDERS(sb) - 1; i >= 0; i--) { - if (grp->bb_counters[i] > 0) { - grp->bb_largest_free_order = i; - break; - } - } - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && - grp->bb_largest_free_order >= 0 && grp->bb_free) { + grp->bb_largest_free_order = i; + if (grp->bb_largest_free_order >= 0 && grp->bb_free) { write_lock(&sbi->s_mb_largest_free_orders_locks[ grp->bb_largest_free_order]); list_add_tail(&grp->bb_largest_free_order_node, @@ -1148,13 +1105,13 @@ EXT4_GROUP_INFO_BBITMAP_CORRUPT); } mb_set_largest_free_order(sb, grp); + mb_update_avg_fragment_size(sb, grp); clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state)); period = get_cycles() - period; atomic_inc(&sbi->s_mb_buddies_generated); atomic64_add(period, &sbi->s_mb_generation_time); - mb_update_avg_fragment_size(sb, grp); } /* The buddy information is attached the buddy cache inode @@ -2630,7 +2587,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) { ext4_group_t prefetch_grp = 0, ngroups, group, i; - int cr = -1; + int cr = -1, new_cr; int err = 0, first_err = 0; unsigned int nr = 0, prefetch_ios = 0; struct ext4_sb_info *sbi; @@ -2701,17 +2658,14 @@ * from the goal value specified */ group = ac->ac_g_ex.fe_group; - ac->ac_last_optimal_group = group; ac->ac_groups_linear_remaining = sbi->s_mb_max_linear_groups; prefetch_grp = group; - for (i = 0; i < ngroups; group = next_linear_group(ac, group, ngroups), - i++) { - int ret = 0, new_cr; + for (i = 0, new_cr = cr; i < ngroups; i++, + ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups)) { + int ret = 0; cond_resched(); - - ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups); if (new_cr != cr) { cr = new_cr; goto repeat; @@ -2985,9 +2939,7 @@ struct super_block *sb = pde_data(file_inode(seq->file)); unsigned long position; - read_lock(&EXT4_SB(sb)->s_mb_rb_lock); - - if (*pos < 0 || *pos >= MB_NUM_ORDERS(sb) + 1) + if (*pos < 0 || *pos >= 2*MB_NUM_ORDERS(sb)) return NULL; position = *pos + 1; return (void *) ((unsigned long) position); @@ -2999,7 +2951,7 @@ unsigned long position; ++*pos; - if (*pos < 0 || *pos >= MB_NUM_ORDERS(sb) + 1) + if (*pos < 0 || *pos >= 2*MB_NUM_ORDERS(sb)) return NULL; position = *pos + 1; return (void *) ((unsigned long) position); @@ -3011,29 +2963,22 @@ struct ext4_sb_info *sbi = EXT4_SB(sb); unsigned long position = ((unsigned long) v); struct ext4_group_info *grp; - struct rb_node *n; - unsigned int count, min, max; + unsigned int count; position--; if (position >= MB_NUM_ORDERS(sb)) { - seq_puts(seq, "fragment_size_tree:\n"); - n = rb_first(&sbi->s_mb_avg_fragment_size_root); - if (!n) { - seq_puts(seq, "\ttree_min: 0\n\ttree_max: 0\n\ttree_nodes: 0\n"); - return 0; - } - grp = rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); - min = grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; - count = 1; - while (rb_next(n)) { - count++; - n = rb_next(n); - } - grp = rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); - max = grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; + position -= MB_NUM_ORDERS(sb); + if (position == 0) + seq_puts(seq, "avg_fragment_size_lists:\n"); - seq_printf(seq, "\ttree_min: %u\n\ttree_max: %u\n\ttree_nodes: %u\n", - min, max, count); + count = 0; + read_lock(&sbi->s_mb_avg_fragment_size_locks[position]); + list_for_each_entry(grp, &sbi->s_mb_avg_fragment_size[position], + bb_avg_fragment_size_node) + count++; + read_unlock(&sbi->s_mb_avg_fragment_size_locks[position]); + seq_printf(seq, "\tlist_order_%u_groups: %u\n", + (unsigned int)position, count); return 0; } @@ -3043,9 +2988,11 @@ seq_puts(seq, "max_free_order_lists:\n"); } count = 0; + read_lock(&sbi->s_mb_largest_free_orders_locks[position]); list_for_each_entry(grp, &sbi->s_mb_largest_free_orders[position], bb_largest_free_order_node) count++; + read_unlock(&sbi->s_mb_largest_free_orders_locks[position]); seq_printf(seq, "\tlist_order_%u_groups: %u\n", (unsigned int)position, count); @@ -3053,11 +3000,7 @@ } static void ext4_mb_seq_structs_summary_stop(struct seq_file *seq, void *v) -__releases(&EXT4_SB(sb)->s_mb_rb_lock) { - struct super_block *sb = pde_data(file_inode(seq->file)); - - read_unlock(&EXT4_SB(sb)->s_mb_rb_lock); } const struct seq_operations ext4_mb_seq_structs_summary_ops = { @@ -3170,8 +3113,9 @@ init_rwsem(&meta_group_info[i]->alloc_sem); meta_group_info[i]->bb_free_root = RB_ROOT; INIT_LIST_HEAD(&meta_group_info[i]->bb_largest_free_order_node); - RB_CLEAR_NODE(&meta_group_info[i]->bb_avg_fragment_size_rb); + INIT_LIST_HEAD(&meta_group_info[i]->bb_avg_fragment_size_node); meta_group_info[i]->bb_largest_free_order = -1; /* uninit */ + meta_group_info[i]->bb_avg_fragment_size_order = -1; /* uninit */ meta_group_info[i]->bb_group = group; mb_group_bb_bitmap_alloc(sb, meta_group_info[i], group); @@ -3420,7 +3364,24 @@ i++; } while (i < MB_NUM_ORDERS(sb)); - sbi->s_mb_avg_fragment_size_root = RB_ROOT; + sbi->s_mb_avg_fragment_size = + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), + GFP_KERNEL); + if (!sbi->s_mb_avg_fragment_size) { + ret = -ENOMEM; + goto out; + } + sbi->s_mb_avg_fragment_size_locks = + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(rwlock_t), + GFP_KERNEL); + if (!sbi->s_mb_avg_fragment_size_locks) { + ret = -ENOMEM; + goto out; + } + for (i = 0; i < MB_NUM_ORDERS(sb); i++) { + INIT_LIST_HEAD(&sbi->s_mb_avg_fragment_size[i]); + rwlock_init(&sbi->s_mb_avg_fragment_size_locks[i]); + } sbi->s_mb_largest_free_orders = kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), GFP_KERNEL); @@ -3439,7 +3400,6 @@ INIT_LIST_HEAD(&sbi->s_mb_largest_free_orders[i]); rwlock_init(&sbi->s_mb_largest_free_orders_locks[i]); } - rwlock_init(&sbi->s_mb_rb_lock); spin_lock_init(&sbi->s_md_lock); sbi->s_mb_free_pending = 0; @@ -3510,6 +3470,8 @@ free_percpu(sbi->s_locality_groups); sbi->s_locality_groups = NULL; out: + kfree(sbi->s_mb_avg_fragment_size); + kfree(sbi->s_mb_avg_fragment_size_locks); kfree(sbi->s_mb_largest_free_orders); kfree(sbi->s_mb_largest_free_orders_locks); kfree(sbi->s_mb_offsets); @@ -3576,6 +3538,8 @@ kvfree(group_info); rcu_read_unlock(); } + kfree(sbi->s_mb_avg_fragment_size); + kfree(sbi->s_mb_avg_fragment_size_locks); kfree(sbi->s_mb_largest_free_orders); kfree(sbi->s_mb_largest_free_orders_locks); kfree(sbi->s_mb_offsets); @@ -5187,6 +5151,7 @@ struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); int bsbits = ac->ac_sb->s_blocksize_bits; loff_t size, isize; + bool inode_pa_eligible, group_pa_eligible; if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) return; @@ -5194,25 +5159,27 @@ if (unlikely(ac->ac_flags & EXT4_MB_HINT_GOAL_ONLY)) return; + 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); isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) >> bsbits; + /* No point in using inode preallocation for closed files */ if ((size == isize) && !ext4_fs_is_busy(sbi) && - !inode_is_open_for_write(ac->ac_inode)) { - ac->ac_flags |= EXT4_MB_HINT_NOPREALLOC; - return; - } + !inode_is_open_for_write(ac->ac_inode)) + inode_pa_eligible = false; - if (sbi->s_mb_group_prealloc <= 0) { - ac->ac_flags |= EXT4_MB_STREAM_ALLOC; - return; - } - - /* don't use group allocation for large files */ size = max(size, isize); - if (size > sbi->s_mb_stream_request) { - ac->ac_flags |= EXT4_MB_STREAM_ALLOC; + /* Don't use group allocation for large files */ + if (size > sbi->s_mb_stream_request) + group_pa_eligible = false; + + if (!group_pa_eligible) { + if (inode_pa_eligible) + ac->ac_flags |= EXT4_MB_STREAM_ALLOC; + else + ac->ac_flags |= EXT4_MB_HINT_NOPREALLOC; return; } @@ -5559,6 +5526,7 @@ ext4_fsblk_t block = 0; unsigned int inquota = 0; unsigned int reserv_clstrs = 0; + int retries = 0; u64 seq; might_sleep(); @@ -5661,7 +5629,8 @@ ar->len = ac->ac_b_ex.fe_len; } } else { - if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) + if (++retries < 3 && + ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) goto repeat; /* * If block allocation fails then the pa allocated above diff -Nru linux-aws-5.19.0/fs/ext4/mballoc.h linux-aws-5.19.0/fs/ext4/mballoc.h --- linux-aws-5.19.0/fs/ext4/mballoc.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/mballoc.h 2022-11-29 07:06:46.000000000 +0000 @@ -178,7 +178,6 @@ /* copy of the best found extent taken before preallocation efforts */ struct ext4_free_extent ac_f_ex; - ext4_group_t ac_last_optimal_group; __u32 ac_groups_considered; __u32 ac_flags; /* allocation hints */ __u16 ac_groups_scanned; diff -Nru linux-aws-5.19.0/fs/ext4/namei.c linux-aws-5.19.0/fs/ext4/namei.c --- linux-aws-5.19.0/fs/ext4/namei.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/namei.c 2022-11-29 07:06:46.000000000 +0000 @@ -85,15 +85,20 @@ return bh; inode->i_size += inode->i_sb->s_blocksize; EXT4_I(inode)->i_disksize = inode->i_size; + err = ext4_mark_inode_dirty(handle, inode); + if (err) + goto out; BUFFER_TRACE(bh, "get_write_access"); err = ext4_journal_get_write_access(handle, inode->i_sb, bh, EXT4_JTR_NONE); - if (err) { - brelse(bh); - ext4_std_error(inode->i_sb, err); - return ERR_PTR(err); - } + if (err) + goto out; return bh; + +out: + brelse(bh); + ext4_std_error(inode->i_sb, err); + return ERR_PTR(err); } static int ext4_dx_csum_verify(struct inode *inode, @@ -126,7 +131,7 @@ struct ext4_dir_entry *dirent; int is_dx_block = 0; - if (block >= inode->i_size) { + if (block >= inode->i_size >> inode->i_blkbits) { ext4_error_inode(inode, func, line, block, "Attempting to read directory block (%u) that is past i_size (%llu)", block, inode->i_size); diff -Nru linux-aws-5.19.0/fs/ext4/resize.c linux-aws-5.19.0/fs/ext4/resize.c --- linux-aws-5.19.0/fs/ext4/resize.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/resize.c 2022-11-29 07:06:46.000000000 +0000 @@ -2100,7 +2100,7 @@ goto out; } - if (ext4_blocks_count(es) == n_blocks_count) + if (ext4_blocks_count(es) == n_blocks_count && n_blocks_count_retry == 0) goto out; err = ext4_alloc_flex_bg_array(sb, n_group + 1); diff -Nru linux-aws-5.19.0/fs/ext4/super.c linux-aws-5.19.0/fs/ext4/super.c --- linux-aws-5.19.0/fs/ext4/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -205,19 +205,12 @@ int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) { - if (trylock_buffer(bh)) { - if (wait) - return ext4_read_bh(bh, op_flags, NULL); + lock_buffer(bh); + if (!wait) { ext4_read_bh_nowait(bh, op_flags, NULL); return 0; } - if (wait) { - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return 0; - return -EIO; - } - return 0; + return ext4_read_bh(bh, op_flags, NULL); } /* @@ -264,7 +257,8 @@ struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); if (likely(bh)) { - ext4_read_bh_lock(bh, REQ_RAHEAD, false); + if (trylock_buffer(bh)) + ext4_read_bh_nowait(bh, REQ_RAHEAD, NULL); brelse(bh); } } @@ -1585,7 +1579,7 @@ Opt_inlinecrypt, Opt_usrjquota, Opt_grpjquota, Opt_quota, Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err, - Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, + Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_dax, Opt_dax_always, Opt_dax_inode, Opt_dax_never, Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_warn_on_error, Opt_nowarn_on_error, Opt_mblk_io_submit, Opt_debug_want_extra_isize, @@ -1694,7 +1688,7 @@ fsparam_flag ("barrier", Opt_barrier), fsparam_u32 ("barrier", Opt_barrier), fsparam_flag ("nobarrier", Opt_nobarrier), - fsparam_flag ("i_version", Opt_i_version), + fsparam_flag ("i_version", Opt_removed), fsparam_flag ("dax", Opt_dax), fsparam_enum ("dax", Opt_dax_type, ext4_param_dax), fsparam_u32 ("stripe", Opt_stripe), @@ -2140,11 +2134,6 @@ case Opt_abort: ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED); return 0; - case Opt_i_version: - ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20"); - ext4_msg(NULL, KERN_WARNING, "Use iversion instead\n"); - ctx_set_flags(ctx, SB_I_VERSION); - return 0; case Opt_inlinecrypt: #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT ctx_set_flags(ctx, SB_INLINECRYPT); @@ -2814,14 +2803,6 @@ sb->s_flags &= ~ctx->mask_s_flags; sb->s_flags |= ctx->vals_s_flags; - /* - * i_version differs from common mount option iversion so we have - * to let vfs know that it was set, otherwise it would get cleared - * on remount - */ - if (ctx->mask_s_flags & SB_I_VERSION) - fc->sb_flags |= SB_I_VERSION; - #define APPLY(X) ({ if (ctx->spec & EXT4_SPEC_##X) sbi->X = ctx->X; }) APPLY(s_commit_interval); APPLY(s_stripe); @@ -2970,8 +2951,6 @@ SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time); if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time); - if (sb->s_flags & SB_I_VERSION) - SEQ_OPTS_PUTS("i_version"); if (nodefs || sbi->s_stripe) SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe); if (nodefs || EXT4_MOUNT_DATA_FLAGS & @@ -3758,6 +3737,7 @@ unsigned long next_wakeup, cur; BUG_ON(NULL == eli); + set_freezable(); cont_thread: while (true) { @@ -3973,9 +3953,9 @@ goto out; } - if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && - (first_not_zeroed == ngroups || sb_rdonly(sb) || - !test_opt(sb, INIT_INODE_TABLE))) + if (sb_rdonly(sb) || + (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && + (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE)))) goto out; elr = ext4_li_request_new(sb, first_not_zeroed); @@ -4630,6 +4610,9 @@ sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); + /* i_version is always enabled now */ + sb->s_flags |= SB_I_VERSION; + if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && (ext4_has_compat_features(sb) || ext4_has_ro_compat_features(sb) || @@ -6643,7 +6626,7 @@ handle_t *handle; /* Data block + inode block */ - handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2); + handle = ext4_journal_start_sb(sb, EXT4_HT_QUOTA, 2); if (IS_ERR(handle)) return PTR_ERR(handle); ret = dquot_commit_info(sb, type); diff -Nru linux-aws-5.19.0/fs/ext4/xattr.c linux-aws-5.19.0/fs/ext4/xattr.c --- linux-aws-5.19.0/fs/ext4/xattr.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ext4/xattr.c 2022-11-29 07:06:46.000000000 +0000 @@ -2412,6 +2412,7 @@ if (!error) { ext4_xattr_update_super_block(handle, inode->i_sb); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); if (!value) no_expand = 0; error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); diff -Nru linux-aws-5.19.0/fs/f2fs/checkpoint.c linux-aws-5.19.0/fs/f2fs/checkpoint.c --- linux-aws-5.19.0/fs/f2fs/checkpoint.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/checkpoint.c 2022-11-29 07:06:46.000000000 +0000 @@ -140,7 +140,7 @@ unsigned int segno, offset; bool exist; - if (type != DATA_GENERIC_ENHANCE && type != DATA_GENERIC_ENHANCE_READ) + if (type == DATA_GENERIC) return true; segno = GET_SEGNO(sbi, blkaddr); @@ -148,6 +148,13 @@ se = get_seg_entry(sbi, segno); exist = f2fs_test_bit(offset, se->cur_valid_map); + if (exist && type == DATA_GENERIC_ENHANCE_UPDATE) { + f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", + blkaddr, exist); + set_sbi_flag(sbi, SBI_NEED_FSCK); + return exist; + } + if (!exist && type == DATA_GENERIC_ENHANCE) { f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", blkaddr, exist); @@ -185,6 +192,7 @@ case DATA_GENERIC: case DATA_GENERIC_ENHANCE: case DATA_GENERIC_ENHANCE_READ: + case DATA_GENERIC_ENHANCE_UPDATE: if (unlikely(blkaddr >= MAX_BLKADDR(sbi) || blkaddr < MAIN_BLKADDR(sbi))) { f2fs_warn(sbi, "access invalid blkaddr:%u", @@ -1055,7 +1063,8 @@ spin_unlock(&sbi->inode_lock[type]); } -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp) { struct list_head *head; struct inode *inode; @@ -1090,11 +1099,15 @@ if (inode) { unsigned long cur_ino = inode->i_ino; - F2FS_I(inode)->cp_task = current; + if (from_cp) + F2FS_I(inode)->cp_task = current; + F2FS_I(inode)->wb_task = current; filemap_fdatawrite(inode->i_mapping); - F2FS_I(inode)->cp_task = NULL; + F2FS_I(inode)->wb_task = NULL; + if (from_cp) + F2FS_I(inode)->cp_task = NULL; iput(inode); /* We need to give cpu to another writers. */ @@ -1223,7 +1236,7 @@ /* write all the dirty dentry pages */ if (get_pages(sbi, F2FS_DIRTY_DENTS)) { f2fs_unlock_all(sbi); - err = f2fs_sync_dirty_inodes(sbi, DIR_INODE); + err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true); if (err) return err; cond_resched(); @@ -1894,15 +1907,27 @@ void f2fs_stop_ckpt_thread(struct f2fs_sb_info *sbi) { struct ckpt_req_control *cprc = &sbi->cprc_info; + struct task_struct *ckpt_task; - if (cprc->f2fs_issue_ckpt) { - struct task_struct *ckpt_task = cprc->f2fs_issue_ckpt; + if (!cprc->f2fs_issue_ckpt) + return; - cprc->f2fs_issue_ckpt = NULL; - kthread_stop(ckpt_task); + ckpt_task = cprc->f2fs_issue_ckpt; + cprc->f2fs_issue_ckpt = NULL; + kthread_stop(ckpt_task); - flush_remained_ckpt_reqs(sbi, NULL); - } + f2fs_flush_ckpt_thread(sbi); +} + +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi) +{ + struct ckpt_req_control *cprc = &sbi->cprc_info; + + flush_remained_ckpt_reqs(sbi, NULL); + + /* Let's wait for the previous dispatched checkpoint. */ + while (atomic_read(&cprc->queued_ckpt)) + io_schedule_timeout(DEFAULT_IO_TIMEOUT); } void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi) diff -Nru linux-aws-5.19.0/fs/f2fs/data.c linux-aws-5.19.0/fs/f2fs/data.c --- linux-aws-5.19.0/fs/f2fs/data.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/data.c 2022-11-29 07:06:46.000000000 +0000 @@ -2843,7 +2843,7 @@ } unlock_page(page); if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) && - !F2FS_I(inode)->cp_task && allow_balance) + !F2FS_I(inode)->wb_task && allow_balance) f2fs_balance_fs(sbi, need_balance_fs); if (unlikely(f2fs_cp_error(sbi))) { @@ -3141,7 +3141,7 @@ struct writeback_control *wbc) { /* to avoid deadlock in path of data flush */ - if (F2FS_I(inode)->cp_task) + if (F2FS_I(inode)->wb_task) return false; if (!S_ISREG(inode->i_mode)) diff -Nru linux-aws-5.19.0/fs/f2fs/extent_cache.c linux-aws-5.19.0/fs/f2fs/extent_cache.c --- linux-aws-5.19.0/fs/f2fs/extent_cache.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/extent_cache.c 2022-11-29 07:06:46.000000000 +0000 @@ -804,9 +804,8 @@ if (!f2fs_may_extent_tree(inode)) return; - set_inode_flag(inode, FI_NO_EXTENT); - write_lock(&et->lock); + set_inode_flag(inode, FI_NO_EXTENT); __free_extent_tree(sbi, et); if (et->largest.len) { et->largest.len = 0; diff -Nru linux-aws-5.19.0/fs/f2fs/f2fs.h linux-aws-5.19.0/fs/f2fs/f2fs.h --- linux-aws-5.19.0/fs/f2fs/f2fs.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/f2fs.h 2022-11-29 07:06:46.000000000 +0000 @@ -266,6 +266,10 @@ * condition of read on truncated area * by extent_cache */ + DATA_GENERIC_ENHANCE_UPDATE, /* + * strong check on range and segment + * bitmap for update case + */ META_GENERIC, }; @@ -780,6 +784,7 @@ unsigned int clevel; /* maximum level of given file name */ struct task_struct *task; /* lookup and create consistency */ struct task_struct *cp_task; /* separate cp/wb IO stats*/ + struct task_struct *wb_task; /* indicate inode is in context of writeback */ nid_t i_xattr_nid; /* node id that contains xattrs */ loff_t last_disk_size; /* lastly written file size */ spinlock_t i_size_lock; /* protect last_disk_size */ @@ -3676,6 +3681,7 @@ * checkpoint.c */ void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io); +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi); struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index); @@ -3705,7 +3711,8 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); void f2fs_update_dirty_folio(struct inode *inode, struct folio *folio); void f2fs_remove_dirty_inode(struct inode *inode); -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp); void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi); int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); diff -Nru linux-aws-5.19.0/fs/f2fs/gc.c linux-aws-5.19.0/fs/f2fs/gc.c --- linux-aws-5.19.0/fs/f2fs/gc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/gc.c 2022-11-29 07:06:46.000000000 +0000 @@ -97,14 +97,10 @@ */ if (sbi->gc_mode == GC_URGENT_HIGH) { spin_lock(&sbi->gc_urgent_high_lock); - if (sbi->gc_urgent_high_limited) { - if (!sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_limited = false; - spin_unlock(&sbi->gc_urgent_high_lock); - sbi->gc_mode = GC_NORMAL; - continue; - } - sbi->gc_urgent_high_remaining--; + if (sbi->gc_urgent_high_limited && + !sbi->gc_urgent_high_remaining--) { + sbi->gc_urgent_high_limited = false; + sbi->gc_mode = GC_NORMAL; } spin_unlock(&sbi->gc_urgent_high_lock); } @@ -1079,7 +1075,7 @@ { struct page *node_page; nid_t nid; - unsigned int ofs_in_node; + unsigned int ofs_in_node, max_addrs; block_t source_blkaddr; nid = le32_to_cpu(sum->nid); @@ -1105,6 +1101,14 @@ return false; } + max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE : + DEF_ADDRS_PER_BLOCK; + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u", + ofs_in_node, dni->ino, dni->nid, max_addrs); + return false; + } + *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); diff -Nru linux-aws-5.19.0/fs/f2fs/recovery.c linux-aws-5.19.0/fs/f2fs/recovery.c --- linux-aws-5.19.0/fs/f2fs/recovery.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/recovery.c 2022-11-29 07:06:46.000000000 +0000 @@ -474,7 +474,7 @@ struct dnode_of_data tdn = *dn; nid_t ino, nid; struct inode *inode; - unsigned int offset; + unsigned int offset, ofs_in_node, max_addrs; block_t bidx; int i; @@ -501,15 +501,24 @@ got_it: /* Use the locked dnode page and inode */ nid = le32_to_cpu(sum.nid); + ofs_in_node = le16_to_cpu(sum.ofs_in_node); + + max_addrs = ADDRS_PER_PAGE(dn->node_page, dn->inode); + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u", + ofs_in_node, dn->inode->i_ino, nid, max_addrs); + return -EFSCORRUPTED; + } + if (dn->inode->i_ino == nid) { tdn.nid = nid; if (!dn->inode_page_locked) lock_page(dn->inode_page); tdn.node_page = dn->inode_page; - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } else if (dn->nid == nid) { - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } @@ -698,6 +707,14 @@ goto err; } + if (f2fs_is_valid_blkaddr(sbi, dest, + DATA_GENERIC_ENHANCE_UPDATE)) { + f2fs_err(sbi, "Inconsistent dest blkaddr:%u, ino:%lu, ofs:%u", + dest, inode->i_ino, dn.ofs_in_node); + err = -EFSCORRUPTED; + goto err; + } + /* write dummy data page */ f2fs_replace_block(sbi, &dn, src, dest, ni.version, false, false); diff -Nru linux-aws-5.19.0/fs/f2fs/segment.c linux-aws-5.19.0/fs/f2fs/segment.c --- linux-aws-5.19.0/fs/f2fs/segment.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/segment.c 2022-11-29 07:06:46.000000000 +0000 @@ -469,7 +469,7 @@ mutex_lock(&sbi->flush_lock); blk_start_plug(&plug); - f2fs_sync_dirty_inodes(sbi, FILE_INODE); + f2fs_sync_dirty_inodes(sbi, FILE_INODE, false); blk_finish_plug(&plug); mutex_unlock(&sbi->flush_lock); diff -Nru linux-aws-5.19.0/fs/f2fs/super.c linux-aws-5.19.0/fs/f2fs/super.c --- linux-aws-5.19.0/fs/f2fs/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/f2fs/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -298,10 +298,10 @@ static inline void limit_reserve_root(struct f2fs_sb_info *sbi) { - block_t limit = min((sbi->user_block_count << 1) / 1000, + block_t limit = min((sbi->user_block_count >> 3), sbi->user_block_count - sbi->reserved_blocks); - /* limit is 0.2% */ + /* limit is 12.5% */ if (test_opt(sbi, RESERVE_ROOT) && F2FS_OPTION(sbi).root_reserved_blocks > limit) { F2FS_OPTION(sbi).root_reserved_blocks = limit; @@ -1637,9 +1637,8 @@ if (is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY)) return -EINVAL; - /* ensure no checkpoint required */ - if (!llist_empty(&F2FS_SB(sb)->cprc_info.issue_list)) - return -EINVAL; + /* Let's flush checkpoints and stop the thread. */ + f2fs_flush_ckpt_thread(F2FS_SB(sb)); /* to avoid deadlock on f2fs_evict_inode->SB_FREEZE_FS */ set_sbi_flag(F2FS_SB(sb), SBI_IS_FREEZING); @@ -2146,6 +2145,9 @@ f2fs_up_write(&sbi->gc_lock); f2fs_sync_fs(sbi->sb, 1); + + /* Let's ensure there's no pending checkpoint anymore */ + f2fs_flush_ckpt_thread(sbi); } static int f2fs_remount(struct super_block *sb, int *flags, char *data) @@ -2311,6 +2313,9 @@ f2fs_stop_ckpt_thread(sbi); need_restart_ckpt = true; } else { + /* Flush if the prevous checkpoint, if exists. */ + f2fs_flush_ckpt_thread(sbi); + err = f2fs_start_ckpt_thread(sbi); if (err) { f2fs_err(sbi, diff -Nru linux-aws-5.19.0/fs/file_table.c linux-aws-5.19.0/fs/file_table.c --- linux-aws-5.19.0/fs/file_table.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/file_table.c 2022-11-29 07:06:46.000000000 +0000 @@ -321,12 +321,7 @@ } fops_put(file->f_op); put_pid(file->f_owner.pid); - if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_dec(inode); - if (mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(mnt); - } + put_file_access(file); dput(dentry); if (unlikely(mode & FMODE_NEED_UNMOUNT)) dissolve_on_fput(mnt); diff -Nru linux-aws-5.19.0/fs/fs-writeback.c linux-aws-5.19.0/fs/fs-writeback.c --- linux-aws-5.19.0/fs/fs-writeback.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/fs-writeback.c 2022-11-29 07:06:46.000000000 +0000 @@ -1718,9 +1718,14 @@ */ if (!(inode->i_state & I_DIRTY_ALL)) inode_cgwb_move_to_attached(inode, wb); - else if (!(inode->i_state & I_SYNC_QUEUED) && - (inode->i_state & I_DIRTY)) - redirty_tail_locked(inode, wb); + else if (!(inode->i_state & I_SYNC_QUEUED)) { + if ((inode->i_state & I_DIRTY)) + redirty_tail_locked(inode, wb); + else if (inode->i_state & I_DIRTY_TIME) { + inode->dirtied_when = jiffies; + inode_io_list_move_locked(inode, wb, &wb->b_dirty_time); + } + } spin_unlock(&wb->list_lock); inode_sync_complete(inode); @@ -2370,6 +2375,20 @@ if (flags & I_DIRTY_INODE) { /* + * Inode timestamp update will piggback on this dirtying. + * We tell ->dirty_inode callback that timestamps need to + * be updated by setting I_DIRTY_TIME in flags. + */ + if (inode->i_state & I_DIRTY_TIME) { + spin_lock(&inode->i_lock); + if (inode->i_state & I_DIRTY_TIME) { + inode->i_state &= ~I_DIRTY_TIME; + flags |= I_DIRTY_TIME; + } + spin_unlock(&inode->i_lock); + } + + /* * Notify the filesystem about the inode being dirtied, so that * (if needed) it can update on-disk fields and journal the * inode. This is only needed when the inode itself is being @@ -2378,7 +2397,8 @@ */ trace_writeback_dirty_inode_start(inode, flags); if (sb->s_op->dirty_inode) - sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE); + sb->s_op->dirty_inode(inode, + flags & (I_DIRTY_INODE | I_DIRTY_TIME)); trace_writeback_dirty_inode(inode, flags); /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ @@ -2399,21 +2419,15 @@ */ smp_mb(); - if (((inode->i_state & flags) == flags) || - (dirtytime && (inode->i_state & I_DIRTY_INODE))) + if ((inode->i_state & flags) == flags) return; spin_lock(&inode->i_lock); - if (dirtytime && (inode->i_state & I_DIRTY_INODE)) - goto out_unlock_inode; if ((inode->i_state & flags) != flags) { const int was_dirty = inode->i_state & I_DIRTY; inode_attach_wb(inode, NULL); - /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ - if (flags & I_DIRTY_INODE) - inode->i_state &= ~I_DIRTY_TIME; inode->i_state |= flags; /* @@ -2486,7 +2500,6 @@ out_unlock: if (wb) spin_unlock(&wb->list_lock); -out_unlock_inode: spin_unlock(&inode->i_lock); } EXPORT_SYMBOL(__mark_inode_dirty); diff -Nru linux-aws-5.19.0/fs/internal.h linux-aws-5.19.0/fs/internal.h --- linux-aws-5.19.0/fs/internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -16,6 +16,7 @@ struct fs_context; struct user_namespace; struct pipe_inode_info; +struct iov_iter; /* * block/bdev.c @@ -101,6 +102,16 @@ extern struct file *alloc_empty_file(int, const struct cred *); extern struct file *alloc_empty_file_noaccount(int, const struct cred *); +static inline void put_file_access(struct file *file) +{ + if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_dec(file->f_inode); + } else if (file->f_mode & FMODE_WRITER) { + put_write_access(file->f_inode); + __mnt_drop_write(file->f_path.mnt); + } +} + /* * super.c */ @@ -221,3 +232,5 @@ int setxattr_copy(const char __user *name, struct xattr_ctx *ctx); int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry, struct xattr_ctx *ctx); + +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *pos); diff -Nru linux-aws-5.19.0/fs/iomap/buffered-io.c linux-aws-5.19.0/fs/iomap/buffered-io.c --- linux-aws-5.19.0/fs/iomap/buffered-io.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/iomap/buffered-io.c 2022-11-29 07:06:46.000000000 +0000 @@ -1412,7 +1412,7 @@ if (!count) folio_end_writeback(folio); done: - mapping_set_error(folio->mapping, error); + mapping_set_error(inode->i_mapping, error); return error; } diff -Nru linux-aws-5.19.0/fs/jbd2/commit.c linux-aws-5.19.0/fs/jbd2/commit.c --- linux-aws-5.19.0/fs/jbd2/commit.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/jbd2/commit.c 2022-11-29 07:06:46.000000000 +0000 @@ -570,7 +570,7 @@ journal->j_running_transaction = NULL; start_time = ktime_get(); commit_transaction->t_log_start = journal->j_head; - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); write_unlock(&journal->j_state_lock); jbd_debug(3, "JBD2: commit phase 2a\n"); diff -Nru linux-aws-5.19.0/fs/jbd2/journal.c linux-aws-5.19.0/fs/jbd2/journal.c --- linux-aws-5.19.0/fs/jbd2/journal.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/jbd2/journal.c 2022-11-29 07:06:46.000000000 +0000 @@ -926,10 +926,16 @@ for (i = j_fc_off - 1; i >= j_fc_off - num_blks; i--) { bh = journal->j_fc_wbuf[i]; wait_on_buffer(bh); + /* + * Update j_fc_off so jbd2_fc_release_bufs can release remain + * buffer head. + */ + if (unlikely(!buffer_uptodate(bh))) { + journal->j_fc_off = i + 1; + return -EIO; + } put_bh(bh); journal->j_fc_wbuf[i] = NULL; - if (unlikely(!buffer_uptodate(bh))) - return -EIO; } return 0; diff -Nru linux-aws-5.19.0/fs/jbd2/recovery.c linux-aws-5.19.0/fs/jbd2/recovery.c --- linux-aws-5.19.0/fs/jbd2/recovery.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/jbd2/recovery.c 2022-11-29 07:06:46.000000000 +0000 @@ -256,6 +256,7 @@ err = journal->j_fc_replay_callback(journal, bh, pass, next_fc_block - journal->j_fc_first, expected_commit_id); + brelse(bh); next_fc_block++; if (err < 0 || err == JBD2_FC_REPLAY_STOP) break; diff -Nru linux-aws-5.19.0/fs/jbd2/transaction.c linux-aws-5.19.0/fs/jbd2/transaction.c --- linux-aws-5.19.0/fs/jbd2/transaction.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/jbd2/transaction.c 2022-11-29 07:06:46.000000000 +0000 @@ -168,7 +168,7 @@ int need_to_start; tid_t tid = journal->j_running_transaction->t_tid; - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); need_to_start = !tid_geq(journal->j_commit_request, tid); read_unlock(&journal->j_state_lock); @@ -194,7 +194,7 @@ read_unlock(&journal->j_state_lock); return; } - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); read_unlock(&journal->j_state_lock); /* @@ -920,7 +920,7 @@ write_lock(&journal->j_state_lock); --journal->j_barrier_count; write_unlock(&journal->j_state_lock); - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); } static void warn_dirty_buffer(struct buffer_head *bh) diff -Nru linux-aws-5.19.0/fs/ksmbd/server.c linux-aws-5.19.0/fs/ksmbd/server.c --- linux-aws-5.19.0/fs/ksmbd/server.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ksmbd/server.c 2022-11-29 07:06:46.000000000 +0000 @@ -235,10 +235,8 @@ if (work->sess && work->sess->enc && work->encrypted && conn->ops->encrypt_resp) { rc = conn->ops->encrypt_resp(work); - if (rc < 0) { + if (rc < 0) conn->ops->set_rsp_status(work, STATUS_DATA_ERROR); - goto send; - } } ksmbd_conn_write(work); diff -Nru linux-aws-5.19.0/fs/ksmbd/smb2pdu.c linux-aws-5.19.0/fs/ksmbd/smb2pdu.c --- linux-aws-5.19.0/fs/ksmbd/smb2pdu.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ksmbd/smb2pdu.c 2022-11-29 07:06:46.000000000 +0000 @@ -3798,11 +3798,6 @@ return 0; } -static void restart_ctx(struct dir_context *ctx) -{ - ctx->pos = 0; -} - static int verify_info_level(int info_level) { switch (info_level) { @@ -3911,7 +3906,6 @@ if (srch_flag & SMB2_REOPEN || srch_flag & SMB2_RESTART_SCANS) { ksmbd_debug(SMB, "Restart directory scan\n"); generic_file_llseek(dir_fp->filp, 0, SEEK_SET); - restart_ctx(&dir_fp->readdir_data.ctx); } memset(&d_info, 0, sizeof(struct ksmbd_dir_info)); @@ -3958,11 +3952,9 @@ */ if (!d_info.out_buf_len && !d_info.num_entry) goto no_buf_len; - if (rc == 0) - restart_ctx(&dir_fp->readdir_data.ctx); - if (rc == -ENOSPC) + if (rc > 0 || rc == -ENOSPC) rc = 0; - if (rc) + else if (rc) goto err_out; d_info.wptr = d_info.rptr; @@ -4019,6 +4011,8 @@ rsp->hdr.Status = STATUS_NO_MEMORY; else if (rc == -EFAULT) rsp->hdr.Status = STATUS_INVALID_INFO_CLASS; + else if (rc == -EIO) + rsp->hdr.Status = STATUS_FILE_CORRUPT_ERROR; if (!rsp->hdr.Status) rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR; @@ -7633,11 +7627,16 @@ goto out; } - if (in_buf_len < sizeof(struct validate_negotiate_info_req)) - return -EINVAL; + if (in_buf_len < offsetof(struct validate_negotiate_info_req, + Dialects)) { + ret = -EINVAL; + goto out; + } - if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) - return -EINVAL; + if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) { + ret = -EINVAL; + goto out; + } ret = fsctl_validate_negotiate_info(conn, (struct validate_negotiate_info_req *)&req->Buffer[0], diff -Nru linux-aws-5.19.0/fs/ksmbd/smb_common.c linux-aws-5.19.0/fs/ksmbd/smb_common.c --- linux-aws-5.19.0/fs/ksmbd/smb_common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ksmbd/smb_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -4,6 +4,8 @@ * Copyright (C) 2018 Namjae Jeon */ +#include + #include "smb_common.h" #include "server.h" #include "misc.h" @@ -625,8 +627,8 @@ if (!cred) return -ENOMEM; - cred->fsuid = make_kuid(current_user_ns(), uid); - cred->fsgid = make_kgid(current_user_ns(), gid); + cred->fsuid = make_kuid(&init_user_ns, uid); + cred->fsgid = make_kgid(&init_user_ns, gid); gi = groups_alloc(0); if (!gi) { diff -Nru linux-aws-5.19.0/fs/nfs/internal.h linux-aws-5.19.0/fs/nfs/internal.h --- linux-aws-5.19.0/fs/nfs/internal.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nfs/internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -606,6 +606,31 @@ return GFP_KERNEL; } +/* + * Special version of should_remove_suid() that ignores capabilities. + */ +static inline int nfs_should_remove_suid(const struct inode *inode) +{ + umode_t mode = inode->i_mode; + int kill = 0; + + /* suid always must be killed */ + if (unlikely(mode & S_ISUID)) + kill = ATTR_KILL_SUID; + + /* + * sgid without any exec bits is just a mandatory locking mark; leave + * it alone. If some exec bits are set, it's a real sgid; kill it. + */ + if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) + kill |= ATTR_KILL_SGID; + + if (unlikely(kill && S_ISREG(mode))) + return kill; + + return 0; +} + /* unlink.c */ extern struct rpc_task * nfs_async_rename(struct inode *old_dir, struct inode *new_dir, diff -Nru linux-aws-5.19.0/fs/nfs/nfs42proc.c linux-aws-5.19.0/fs/nfs/nfs42proc.c --- linux-aws-5.19.0/fs/nfs/nfs42proc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/nfs/nfs42proc.c 2022-11-29 07:06:46.000000000 +0000 @@ -78,10 +78,15 @@ status = nfs4_call_sync(server->client, server, msg, &args.seq_args, &res.seq_res, 0); - if (status == 0) + if (status == 0) { + if (nfs_should_remove_suid(inode)) { + spin_lock(&inode->i_lock); + nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE); + spin_unlock(&inode->i_lock); + } status = nfs_post_op_update_inode_force_wcc(inode, res.falloc_fattr); - + } if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE]) trace_nfs4_fallocate(inode, &args, status); else diff -Nru linux-aws-5.19.0/fs/nfs/super.c linux-aws-5.19.0/fs/nfs/super.c --- linux-aws-5.19.0/fs/nfs/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/nfs/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -1051,22 +1051,31 @@ if (ctx->bsize) sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits); - if (server->nfs_client->rpc_ops->version != 2) { - /* The VFS shouldn't apply the umask to mode bits. We will do - * so ourselves when necessary. + switch (server->nfs_client->rpc_ops->version) { + case 2: + sb->s_time_gran = 1000; + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; + break; + case 3: + /* + * The VFS shouldn't apply the umask to mode bits. + * We will do so ourselves when necessary. */ sb->s_flags |= SB_POSIXACL; sb->s_time_gran = 1; - sb->s_export_op = &nfs_export_ops; - } else - sb->s_time_gran = 1000; - - if (server->nfs_client->rpc_ops->version != 4) { sb->s_time_min = 0; sb->s_time_max = U32_MAX; - } else { + sb->s_export_op = &nfs_export_ops; + break; + case 4: + sb->s_flags |= SB_POSIXACL; + sb->s_time_gran = 1; sb->s_time_min = S64_MIN; sb->s_time_max = S64_MAX; + if (server->caps & NFS_CAP_ATOMIC_OPEN_V1) + sb->s_export_op = &nfs_export_ops; + break; } sb->s_magic = NFS_SUPER_MAGIC; diff -Nru linux-aws-5.19.0/fs/nfs/write.c linux-aws-5.19.0/fs/nfs/write.c --- linux-aws-5.19.0/fs/nfs/write.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nfs/write.c 2022-11-29 07:06:46.000000000 +0000 @@ -1497,31 +1497,6 @@ NFS_PROTO(data->inode)->commit_rpc_prepare(task, data); } -/* - * Special version of should_remove_suid() that ignores capabilities. - */ -static int nfs_should_remove_suid(const struct inode *inode) -{ - umode_t mode = inode->i_mode; - int kill = 0; - - /* suid always must be killed */ - if (unlikely(mode & S_ISUID)) - kill = ATTR_KILL_SUID; - - /* - * sgid without any exec bits is just a mandatory locking mark; leave - * it alone. If some exec bits are set, it's a real sgid; kill it. - */ - if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) - kill |= ATTR_KILL_SGID; - - if (unlikely(kill && S_ISREG(mode))) - return kill; - - return 0; -} - static void nfs_writeback_check_extend(struct nfs_pgio_header *hdr, struct nfs_fattr *fattr) { diff -Nru linux-aws-5.19.0/fs/nfsd/nfs4proc.c linux-aws-5.19.0/fs/nfsd/nfs4proc.c --- linux-aws-5.19.0/fs/nfsd/nfs4proc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nfsd/nfs4proc.c 2022-11-29 07:06:46.000000000 +0000 @@ -2663,9 +2663,6 @@ status = nfserr_minor_vers_mismatch; if (nfsd_minorversion(nn, args->minorversion, NFSD_TEST) <= 0) goto out; - status = nfserr_resource; - if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - goto out; status = nfs41_check_op_ordering(args); if (status) { @@ -2678,10 +2675,20 @@ rqstp->rq_lease_breaker = (void **)&cstate->clp; - trace_nfsd_compound(rqstp, args->opcnt); + trace_nfsd_compound(rqstp, args->client_opcnt); while (!status && resp->opcnt < args->opcnt) { op = &args->ops[resp->opcnt++]; + if (unlikely(resp->opcnt == NFSD_MAX_OPS_PER_COMPOUND)) { + /* If there are still more operations to process, + * stop here and report NFS4ERR_RESOURCE. */ + if (cstate->minorversion == 0 && + args->client_opcnt > resp->opcnt) { + op->status = nfserr_resource; + goto encode_op; + } + } + /* * The XDR decode routines may have pre-set op->status; * for example, if there is a miscellaneous XDR error @@ -2757,8 +2764,8 @@ status = op->status; } - trace_nfsd_compound_status(args->opcnt, resp->opcnt, status, - nfsd4_op_name(op->opnum)); + trace_nfsd_compound_status(args->client_opcnt, resp->opcnt, + status, nfsd4_op_name(op->opnum)); nfsd4_cstate_clear_replay(cstate); nfsd4_increment_op_stats(op->opnum); diff -Nru linux-aws-5.19.0/fs/nfsd/nfs4recover.c linux-aws-5.19.0/fs/nfsd/nfs4recover.c --- linux-aws-5.19.0/fs/nfsd/nfs4recover.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/nfsd/nfs4recover.c 2022-11-29 07:06:46.000000000 +0000 @@ -815,8 +815,10 @@ princhash.data = memdup_user( &ci->cc_princhash.cp_data, princhashlen); - if (IS_ERR_OR_NULL(princhash.data)) + if (IS_ERR_OR_NULL(princhash.data)) { + kfree(name.data); return -EFAULT; + } princhash.len = princhashlen; } else princhash.len = 0; diff -Nru linux-aws-5.19.0/fs/nfsd/nfs4state.c linux-aws-5.19.0/fs/nfsd/nfs4state.c --- linux-aws-5.19.0/fs/nfsd/nfs4state.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/nfsd/nfs4state.c 2022-11-29 07:06:46.000000000 +0000 @@ -1049,6 +1049,7 @@ static void nfs4_free_deleg(struct nfs4_stid *stid) { + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(deleg_slab, stid); atomic_long_dec(&num_delegations); } @@ -1463,6 +1464,7 @@ release_all_access(stp); if (stp->st_stateowner) nfs4_put_stateowner(stp->st_stateowner); + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(stateid_slab, stid); } @@ -6608,6 +6610,7 @@ struct nfs4_client *clp = s->st_stid.sc_client; bool unhashed; LIST_HEAD(reaplist); + struct nfs4_ol_stateid *stp; spin_lock(&clp->cl_lock); unhashed = unhash_open_stateid(s, &reaplist); @@ -6616,6 +6619,8 @@ if (unhashed) put_ol_stateid_locked(s, &reaplist); spin_unlock(&clp->cl_lock); + list_for_each_entry(stp, &reaplist, st_locks) + nfs4_free_cpntf_statelist(clp->net, &stp->st_stid); free_ol_stateid_reaplist(&reaplist); } else { spin_unlock(&clp->cl_lock); diff -Nru linux-aws-5.19.0/fs/nfsd/nfs4xdr.c linux-aws-5.19.0/fs/nfsd/nfs4xdr.c --- linux-aws-5.19.0/fs/nfsd/nfs4xdr.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nfsd/nfs4xdr.c 2022-11-29 07:06:46.000000000 +0000 @@ -2347,16 +2347,10 @@ if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0) return false; - if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0) + if (xdr_stream_decode_u32(argp->xdr, &argp->client_opcnt) < 0) return false; - - /* - * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS - * here, so we return success at the xdr level so that - * nfsd4_proc can handle this is an NFS-level error. - */ - if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - return true; + argp->opcnt = min_t(u32, argp->client_opcnt, + NFSD_MAX_OPS_PER_COMPOUND); if (argp->opcnt > ARRAY_SIZE(argp->iops)) { argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); @@ -3999,7 +3993,7 @@ if (resp->xdr->buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { WARN_ON_ONCE(1); - return nfserr_resource; + return nfserr_serverfault; } xdr_commit_encode(xdr); diff -Nru linux-aws-5.19.0/fs/nfsd/xdr4.h linux-aws-5.19.0/fs/nfsd/xdr4.h --- linux-aws-5.19.0/fs/nfsd/xdr4.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nfsd/xdr4.h 2022-11-29 07:06:46.000000000 +0000 @@ -689,9 +689,10 @@ struct svcxdr_tmpbuf *to_free; struct svc_rqst *rqstp; - u32 taglen; char * tag; + u32 taglen; u32 minorversion; + u32 client_opcnt; u32 opcnt; struct nfsd4_op *ops; struct nfsd4_op iops[8]; diff -Nru linux-aws-5.19.0/fs/nilfs2/inode.c linux-aws-5.19.0/fs/nilfs2/inode.c --- linux-aws-5.19.0/fs/nilfs2/inode.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/nilfs2/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -328,6 +328,7 @@ struct inode *inode; struct nilfs_inode_info *ii; struct nilfs_root *root; + struct buffer_head *bh; int err = -ENOMEM; ino_t ino; @@ -343,11 +344,25 @@ ii->i_state = BIT(NILFS_I_NEW); ii->i_root = root; - err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); if (unlikely(err)) goto failed_ifile_create_inode; /* reference count of i_bh inherits from nilfs_mdt_read_block() */ + if (unlikely(ino < NILFS_USER_INO)) { + nilfs_warn(sb, + "inode bitmap is inconsistent for reserved inodes"); + do { + brelse(bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); + if (unlikely(err)) + goto failed_ifile_create_inode; + } while (ino < NILFS_USER_INO); + + nilfs_info(sb, "repaired inode bitmap for reserved inodes"); + } + ii->i_bh = bh; + atomic64_inc(&root->inodes_count); inode_init_owner(&init_user_ns, inode, dir, mode); inode->i_ino = ino; diff -Nru linux-aws-5.19.0/fs/nilfs2/segment.c linux-aws-5.19.0/fs/nilfs2/segment.c --- linux-aws-5.19.0/fs/nilfs2/segment.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/nilfs2/segment.c 2022-11-29 07:06:46.000000000 +0000 @@ -875,9 +875,11 @@ nilfs_mdt_mark_dirty(nilfs->ns_cpfile); nilfs_cpfile_put_checkpoint( nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - } else - WARN_ON(err == -EINVAL || err == -ENOENT); - + } else if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint creation failed due to metadata corruption."); + err = -EIO; + } return err; } @@ -891,7 +893,11 @@ err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, &raw_cp, &bh_cp); if (unlikely(err)) { - WARN_ON(err == -EINVAL || err == -ENOENT); + if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint finalization failed due to metadata corruption."); + err = -EIO; + } goto failed_ibh; } raw_cp->cp_snapshot_list.ssl_next = 0; @@ -2786,10 +2792,9 @@ inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); err = nilfs_segctor_start_thread(nilfs->ns_writer); - if (err) { - kfree(nilfs->ns_writer); - nilfs->ns_writer = NULL; - } + if (unlikely(err)) + nilfs_detach_log_writer(sb); + return err; } diff -Nru linux-aws-5.19.0/fs/ntfs/super.c linux-aws-5.19.0/fs/ntfs/super.c --- linux-aws-5.19.0/fs/ntfs/super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/ntfs/super.c 2022-11-29 07:06:46.000000000 +0000 @@ -2092,7 +2092,8 @@ // TODO: Initialize security. /* Get the extended system files' directory inode. */ vol->extend_ino = ntfs_iget(sb, FILE_Extend); - if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) { + if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) || + !S_ISDIR(vol->extend_ino->i_mode)) { if (!IS_ERR(vol->extend_ino)) iput(vol->extend_ino); ntfs_error(sb, "Failed to load $Extend."); diff -Nru linux-aws-5.19.0/fs/ntfs3/inode.c linux-aws-5.19.0/fs/ntfs3/inode.c --- linux-aws-5.19.0/fs/ntfs3/inode.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ntfs3/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -1941,8 +1941,6 @@ .setattr = ntfs3_setattr, .listxattr = ntfs_listxattr, .permission = ntfs_permission, - .get_acl = ntfs_get_acl, - .set_acl = ntfs_set_acl, }; const struct address_space_operations ntfs_aops = { diff -Nru linux-aws-5.19.0/fs/ntfs3/xattr.c linux-aws-5.19.0/fs/ntfs3/xattr.c --- linux-aws-5.19.0/fs/ntfs3/xattr.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/ntfs3/xattr.c 2022-11-29 07:06:46.000000000 +0000 @@ -625,67 +625,6 @@ return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false); } -static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, void *buffer, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - acl = ntfs_get_acl(inode, type, false); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (!acl) - return -ENODATA; - - err = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); - posix_acl_release(acl); - - return err; -} - -static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, const void *value, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EPERM; - - if (!value) { - acl = NULL; - } else { - acl = posix_acl_from_xattr(&init_user_ns, value, size); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (acl) { - err = posix_acl_valid(&init_user_ns, acl); - if (err) - goto release_and_out; - } - } - - err = ntfs_set_acl(mnt_userns, inode, acl, type); - -release_and_out: - posix_acl_release(acl); - return err; -} - /* * ntfs_init_acl - Initialize the ACLs of a new inode. * @@ -852,23 +791,6 @@ goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - /* TODO: init_user_ns? */ - err = ntfs_xattr_get_acl( - &init_user_ns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - buffer, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL); @@ -981,22 +903,6 @@ goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - err = ntfs_xattr_set_acl( - mnt_userns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - value, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0); @@ -1086,7 +992,7 @@ } // clang-format off -static const struct xattr_handler ntfs_xattr_handler = { +static const struct xattr_handler ntfs_other_xattr_handler = { .prefix = "", .get = ntfs_getxattr, .set = ntfs_setxattr, @@ -1094,7 +1000,11 @@ }; const struct xattr_handler *ntfs_xattr_handlers[] = { - &ntfs_xattr_handler, +#ifdef CONFIG_NTFS3_FS_POSIX_ACL + &posix_acl_access_xattr_handler, + &posix_acl_default_xattr_handler, +#endif + &ntfs_other_xattr_handler, NULL, }; // clang-format on diff -Nru linux-aws-5.19.0/fs/open.c linux-aws-5.19.0/fs/open.c --- linux-aws-5.19.0/fs/open.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/open.c 2022-11-29 07:06:46.000000000 +0000 @@ -810,7 +810,9 @@ return 0; } - if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { + if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_inc(inode); + } else if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { error = get_write_access(inode); if (unlikely(error)) goto cleanup_file; @@ -850,8 +852,6 @@ goto cleanup_all; } f->f_mode |= FMODE_OPENED; - if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_inc(inode); if ((f->f_mode & FMODE_READ) && likely(f->f_op->read || f->f_op->read_iter)) f->f_mode |= FMODE_CAN_READ; @@ -902,10 +902,7 @@ if (WARN_ON_ONCE(error > 0)) error = -EINVAL; fops_put(f->f_op); - if (f->f_mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(f->f_path.mnt); - } + put_file_access(f); cleanup_file: path_put(&f->f_path); f->f_path.mnt = NULL; diff -Nru linux-aws-5.19.0/fs/quota/quota_tree.c linux-aws-5.19.0/fs/quota/quota_tree.c --- linux-aws-5.19.0/fs/quota/quota_tree.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/quota/quota_tree.c 2022-11-29 07:06:46.000000000 +0000 @@ -71,6 +71,35 @@ return ret; } +static inline int do_check_range(struct super_block *sb, const char *val_name, + uint val, uint min_val, uint max_val) +{ + if (val < min_val || val > max_val) { + quota_error(sb, "Getting %s %u out of range %u-%u", + val_name, val, min_val, max_val); + return -EUCLEAN; + } + + return 0; +} + +static int check_dquot_block_header(struct qtree_mem_dqinfo *info, + struct qt_disk_dqdbheader *dh) +{ + int err = 0; + + err = do_check_range(info->dqi_sb, "dqdh_next_free", + le32_to_cpu(dh->dqdh_next_free), 0, + info->dqi_blocks - 1); + if (err) + return err; + err = do_check_range(info->dqi_sb, "dqdh_prev_free", + le32_to_cpu(dh->dqdh_prev_free), 0, + info->dqi_blocks - 1); + + return err; +} + /* Remove empty block from list and return it */ static int get_free_dqblk(struct qtree_mem_dqinfo *info) { @@ -85,6 +114,9 @@ ret = read_blk(info, blk, buf); if (ret < 0) goto out_buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free); } else { @@ -232,6 +264,9 @@ *err = read_blk(info, blk, buf); if (*err < 0) goto out_buf; + *err = check_dquot_block_header(info, dh); + if (*err) + goto out_buf; } else { blk = get_free_dqblk(info); if ((int)blk < 0) { @@ -424,6 +459,9 @@ goto out_buf; } dh = (struct qt_disk_dqdbheader *)buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; le16_add_cpu(&dh->dqdh_entries, -1); if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */ ret = remove_free_dqentry(info, buf, blk); diff -Nru linux-aws-5.19.0/fs/read_write.c linux-aws-5.19.0/fs/read_write.c --- linux-aws-5.19.0/fs/read_write.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/read_write.c 2022-11-29 07:06:46.000000000 +0000 @@ -509,14 +509,9 @@ } /* caller is responsible for file_start_write/file_end_write */ -ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos) +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *pos) { - struct kvec iov = { - .iov_base = (void *)buf, - .iov_len = min_t(size_t, count, MAX_RW_COUNT), - }; struct kiocb kiocb; - struct iov_iter iter; ssize_t ret; if (WARN_ON_ONCE(!(file->f_mode & FMODE_WRITE))) @@ -532,8 +527,7 @@ init_sync_kiocb(&kiocb, file); kiocb.ki_pos = pos ? *pos : 0; - iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); - ret = file->f_op->write_iter(&kiocb, &iter); + ret = file->f_op->write_iter(&kiocb, from); if (ret > 0) { if (pos) *pos = kiocb.ki_pos; @@ -543,6 +537,18 @@ inc_syscw(current); return ret; } + +/* caller is responsible for file_start_write/file_end_write */ +ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos) +{ + struct kvec iov = { + .iov_base = (void *)buf, + .iov_len = min_t(size_t, count, MAX_RW_COUNT), + }; + struct iov_iter iter; + iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); + return __kernel_write_iter(file, &iter, pos); +} /* * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()", * but autofs is one of the few internal kernel users that actually diff -Nru linux-aws-5.19.0/fs/splice.c linux-aws-5.19.0/fs/splice.c --- linux-aws-5.19.0/fs/splice.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/splice.c 2022-07-31 21:03:01.000000000 +0000 @@ -814,15 +814,17 @@ { struct pipe_inode_info *pipe; long ret, bytes; + umode_t i_mode; size_t len; int i, flags, more; /* - * We require the input to be seekable, as we don't want to randomly - * drop data for eg socket -> socket splicing. Use the piped splicing - * for that! + * We require the input being a regular file, as we don't want to + * randomly drop data for eg socket -> socket splicing. Use the + * piped splicing for that! */ - if (unlikely(!(in->f_mode & FMODE_LSEEK))) + i_mode = file_inode(in)->i_mode; + if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) return -EINVAL; /* diff -Nru linux-aws-5.19.0/fs/tracefs/inode.c linux-aws-5.19.0/fs/tracefs/inode.c --- linux-aws-5.19.0/fs/tracefs/inode.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/tracefs/inode.c 2022-11-29 07:06:46.000000000 +0000 @@ -141,6 +141,8 @@ kuid_t uid; kgid_t gid; umode_t mode; + /* Opt_* bitfield. */ + unsigned int opts; }; enum { @@ -241,6 +243,7 @@ kgid_t gid; char *p; + opts->opts = 0; opts->mode = TRACEFS_DEFAULT_MODE; while ((p = strsep(&data, ",")) != NULL) { @@ -275,24 +278,36 @@ * but traditionally tracefs has ignored all mount options */ } + + opts->opts |= BIT(token); } return 0; } -static int tracefs_apply_options(struct super_block *sb) +static int tracefs_apply_options(struct super_block *sb, bool remount) { struct tracefs_fs_info *fsi = sb->s_fs_info; struct inode *inode = d_inode(sb->s_root); struct tracefs_mount_opts *opts = &fsi->mount_opts; - inode->i_mode &= ~S_IALLUGO; - inode->i_mode |= opts->mode; + /* + * On remount, only reset mode/uid/gid if they were provided as mount + * options. + */ + + if (!remount || opts->opts & BIT(Opt_mode)) { + inode->i_mode &= ~S_IALLUGO; + inode->i_mode |= opts->mode; + } - inode->i_uid = opts->uid; + if (!remount || opts->opts & BIT(Opt_uid)) + inode->i_uid = opts->uid; - /* Set all the group ids to the mount option */ - set_gid(sb->s_root, opts->gid); + if (!remount || opts->opts & BIT(Opt_gid)) { + /* Set all the group ids to the mount option */ + set_gid(sb->s_root, opts->gid); + } return 0; } @@ -307,7 +322,7 @@ if (err) goto fail; - tracefs_apply_options(sb); + tracefs_apply_options(sb, true); fail: return err; @@ -359,7 +374,7 @@ sb->s_op = &tracefs_super_operations; - tracefs_apply_options(sb); + tracefs_apply_options(sb, false); return 0; diff -Nru linux-aws-5.19.0/fs/userfaultfd.c linux-aws-5.19.0/fs/userfaultfd.c --- linux-aws-5.19.0/fs/userfaultfd.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/fs/userfaultfd.c 2022-11-29 07:06:46.000000000 +0000 @@ -991,7 +991,7 @@ int fd; fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, new, - O_RDWR | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); + O_RDONLY | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); if (fd < 0) return fd; @@ -2096,7 +2096,7 @@ mmgrab(ctx->mm); fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, ctx, - O_RDWR | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); + O_RDONLY | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); if (fd < 0) { mmdrop(ctx->mm); kmem_cache_free(userfaultfd_ctx_cachep, ctx); diff -Nru linux-aws-5.19.0/fs/xfs/xfs_super.c linux-aws-5.19.0/fs/xfs/xfs_super.c --- linux-aws-5.19.0/fs/xfs/xfs_super.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/fs/xfs/xfs_super.c 2022-11-29 07:06:46.000000000 +0000 @@ -650,7 +650,7 @@ static void xfs_fs_dirty_inode( struct inode *inode, - int flag) + int flags) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; @@ -658,7 +658,13 @@ if (!(inode->i_sb->s_flags & SB_LAZYTIME)) return; - if (flag != I_DIRTY_SYNC || !(inode->i_state & I_DIRTY_TIME)) + + /* + * Only do the timestamp update if the inode is dirty (I_DIRTY_SYNC) + * and has dirty timestamp (I_DIRTY_TIME). I_DIRTY_TIME can be passed + * in flags possibly together with I_DIRTY_SYNC. + */ + if ((flags & ~I_DIRTY_TIME) != I_DIRTY_SYNC || !(flags & I_DIRTY_TIME)) return; if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) diff -Nru linux-aws-5.19.0/include/asm-generic/vmlinux.lds.h linux-aws-5.19.0/include/asm-generic/vmlinux.lds.h --- linux-aws-5.19.0/include/asm-generic/vmlinux.lds.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/asm-generic/vmlinux.lds.h 2022-11-29 07:06:46.000000000 +0000 @@ -543,10 +543,9 @@ */ #ifdef CONFIG_CFI_CLANG #define TEXT_CFI_JT \ - . = ALIGN(PMD_SIZE); \ + ALIGN_FUNCTION(); \ __cfi_jt_start = .; \ *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) \ - . = ALIGN(PMD_SIZE); \ __cfi_jt_end = .; #else #define TEXT_CFI_JT diff -Nru linux-aws-5.19.0/include/drm/drm_connector.h linux-aws-5.19.0/include/drm/drm_connector.h --- linux-aws-5.19.0/include/drm/drm_connector.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/drm/drm_connector.h 2022-11-29 07:06:46.000000000 +0000 @@ -323,6 +323,22 @@ }; /** + * struct drm_luminance_range_info - Panel's luminance range for + * &drm_display_info. Calculated using data in EDID + * + * This struct is used to store a luminance range supported by panel + * as calculated using data from EDID's static hdr metadata. + * + * @min_luminance: This is the min supported luminance value + * + * @max_luminance: This is the max supported luminance value + */ +struct drm_luminance_range_info { + u32 min_luminance; + u32 max_luminance; +}; + +/** * enum drm_privacy_screen_status - privacy screen status * * This enum is used to track and control the state of the integrated privacy @@ -624,6 +640,11 @@ struct drm_monitor_range_info monitor_range; /** + * @luminance_range: Luminance range supported by panel + */ + struct drm_luminance_range_info luminance_range; + + /** * @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from * the DisplayID VESA vendor block. 0 for conventional Single-Stream * Transport (SST), or 2 or 4 MSO streams. diff -Nru linux-aws-5.19.0/include/dt-bindings/clock/samsung,exynosautov9.h linux-aws-5.19.0/include/dt-bindings/clock/samsung,exynosautov9.h --- linux-aws-5.19.0/include/dt-bindings/clock/samsung,exynosautov9.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/dt-bindings/clock/samsung,exynosautov9.h 2022-11-29 07:06:46.000000000 +0000 @@ -226,21 +226,21 @@ #define CLK_GOUT_PERIC0_IPCLK_8 28 #define CLK_GOUT_PERIC0_IPCLK_9 29 #define CLK_GOUT_PERIC0_IPCLK_10 30 -#define CLK_GOUT_PERIC0_IPCLK_11 30 -#define CLK_GOUT_PERIC0_PCLK_0 31 -#define CLK_GOUT_PERIC0_PCLK_1 32 -#define CLK_GOUT_PERIC0_PCLK_2 33 -#define CLK_GOUT_PERIC0_PCLK_3 34 -#define CLK_GOUT_PERIC0_PCLK_4 35 -#define CLK_GOUT_PERIC0_PCLK_5 36 -#define CLK_GOUT_PERIC0_PCLK_6 37 -#define CLK_GOUT_PERIC0_PCLK_7 38 -#define CLK_GOUT_PERIC0_PCLK_8 39 -#define CLK_GOUT_PERIC0_PCLK_9 40 -#define CLK_GOUT_PERIC0_PCLK_10 41 -#define CLK_GOUT_PERIC0_PCLK_11 42 +#define CLK_GOUT_PERIC0_IPCLK_11 31 +#define CLK_GOUT_PERIC0_PCLK_0 32 +#define CLK_GOUT_PERIC0_PCLK_1 33 +#define CLK_GOUT_PERIC0_PCLK_2 34 +#define CLK_GOUT_PERIC0_PCLK_3 35 +#define CLK_GOUT_PERIC0_PCLK_4 36 +#define CLK_GOUT_PERIC0_PCLK_5 37 +#define CLK_GOUT_PERIC0_PCLK_6 38 +#define CLK_GOUT_PERIC0_PCLK_7 39 +#define CLK_GOUT_PERIC0_PCLK_8 40 +#define CLK_GOUT_PERIC0_PCLK_9 41 +#define CLK_GOUT_PERIC0_PCLK_10 42 +#define CLK_GOUT_PERIC0_PCLK_11 43 -#define PERIC0_NR_CLK 43 +#define PERIC0_NR_CLK 44 /* CMU_PERIC1 */ #define CLK_MOUT_PERIC1_BUS_USER 1 @@ -272,21 +272,21 @@ #define CLK_GOUT_PERIC1_IPCLK_8 28 #define CLK_GOUT_PERIC1_IPCLK_9 29 #define CLK_GOUT_PERIC1_IPCLK_10 30 -#define CLK_GOUT_PERIC1_IPCLK_11 30 -#define CLK_GOUT_PERIC1_PCLK_0 31 -#define CLK_GOUT_PERIC1_PCLK_1 32 -#define CLK_GOUT_PERIC1_PCLK_2 33 -#define CLK_GOUT_PERIC1_PCLK_3 34 -#define CLK_GOUT_PERIC1_PCLK_4 35 -#define CLK_GOUT_PERIC1_PCLK_5 36 -#define CLK_GOUT_PERIC1_PCLK_6 37 -#define CLK_GOUT_PERIC1_PCLK_7 38 -#define CLK_GOUT_PERIC1_PCLK_8 39 -#define CLK_GOUT_PERIC1_PCLK_9 40 -#define CLK_GOUT_PERIC1_PCLK_10 41 -#define CLK_GOUT_PERIC1_PCLK_11 42 +#define CLK_GOUT_PERIC1_IPCLK_11 31 +#define CLK_GOUT_PERIC1_PCLK_0 32 +#define CLK_GOUT_PERIC1_PCLK_1 33 +#define CLK_GOUT_PERIC1_PCLK_2 34 +#define CLK_GOUT_PERIC1_PCLK_3 35 +#define CLK_GOUT_PERIC1_PCLK_4 36 +#define CLK_GOUT_PERIC1_PCLK_5 37 +#define CLK_GOUT_PERIC1_PCLK_6 38 +#define CLK_GOUT_PERIC1_PCLK_7 39 +#define CLK_GOUT_PERIC1_PCLK_8 40 +#define CLK_GOUT_PERIC1_PCLK_9 41 +#define CLK_GOUT_PERIC1_PCLK_10 42 +#define CLK_GOUT_PERIC1_PCLK_11 43 -#define PERIC1_NR_CLK 43 +#define PERIC1_NR_CLK 44 /* CMU_PERIS */ #define CLK_MOUT_PERIS_BUS_USER 1 diff -Nru linux-aws-5.19.0/include/kunit/test.h linux-aws-5.19.0/include/kunit/test.h --- linux-aws-5.19.0/include/kunit/test.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/kunit/test.h 2022-11-29 07:06:46.000000000 +0000 @@ -863,7 +863,7 @@ #define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_ASSERTION, \ + KUNIT_EXPECTATION, \ left, <=, right, \ fmt, \ ##__VA_ARGS__) @@ -1153,7 +1153,7 @@ #define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_EXPECTATION, \ + KUNIT_ASSERTION, \ left, <, right, \ fmt, \ ##__VA_ARGS__) @@ -1194,7 +1194,7 @@ #define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_EXPECTATION, \ + KUNIT_ASSERTION, \ left, >, right, \ fmt, \ ##__VA_ARGS__) diff -Nru linux-aws-5.19.0/include/linux/ata.h linux-aws-5.19.0/include/linux/ata.h --- linux-aws-5.19.0/include/linux/ata.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/ata.h 2022-11-29 07:06:46.000000000 +0000 @@ -566,6 +566,18 @@ ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) +#define ata_id_has_ncq_autosense(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) +#define ata_id_has_dipm(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 3))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -578,9 +590,6 @@ #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) -#define ata_id_has_ncq_autosense(id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) static inline bool ata_id_has_hipm(const u16 *id) { @@ -592,17 +601,6 @@ return val & (1 << 9); } -static inline bool ata_id_has_dipm(const u16 *id) -{ - u16 val = id[ATA_ID_FEATURE_SUPP]; - - if (val == 0 || val == 0xffff) - return false; - - return val & (1 << 3); -} - - static inline bool ata_id_has_fua(const u16 *id) { if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) @@ -771,16 +769,21 @@ static inline bool ata_id_has_sense_reporting(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!(id[ATA_ID_CFS_ENABLE_2] & BIT(15))) + return false; + if ((id[ATA_ID_COMMAND_SET_3] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_3] & (1 << 6); + return id[ATA_ID_COMMAND_SET_3] & BIT(6); } static inline bool ata_id_sense_reporting_enabled(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!ata_id_has_sense_reporting(id)) + return false; + /* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */ + if ((id[ATA_ID_COMMAND_SET_4] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_4] & (1 << 6); + return id[ATA_ID_COMMAND_SET_4] & BIT(6); } /** diff -Nru linux-aws-5.19.0/include/linux/bio.h linux-aws-5.19.0/include/linux/bio.h --- linux-aws-5.19.0/include/linux/bio.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/bio.h 2022-11-29 07:06:46.000000000 +0000 @@ -509,7 +509,7 @@ { bio_clear_flag(bio, BIO_REMAPPED); if (bio->bi_bdev != bdev) - bio_clear_flag(bio, BIO_THROTTLED); + bio_clear_flag(bio, BIO_BPS_THROTTLED); bio->bi_bdev = bdev; bio_associate_blkg(bio); } diff -Nru linux-aws-5.19.0/include/linux/blkdev.h linux-aws-5.19.0/include/linux/blkdev.h --- linux-aws-5.19.0/include/linux/blkdev.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/blkdev.h 2022-11-29 07:06:46.000000000 +0000 @@ -148,6 +148,7 @@ #define GD_NATIVE_CAPACITY 3 #define GD_ADDED 4 #define GD_SUPPRESS_PART_SCAN 5 +#define GD_OWNS_QUEUE 6 struct mutex open_mutex; /* open/close mutex */ unsigned open_partitions; /* number of open partitions */ @@ -559,7 +560,6 @@ #define QUEUE_FLAG_NOXMERGES 9 /* No extended merges */ #define QUEUE_FLAG_ADD_RANDOM 10 /* Contributes to random pool */ #define QUEUE_FLAG_SAME_FORCE 12 /* force complete on same CPU */ -#define QUEUE_FLAG_DEAD 13 /* queue tear-down finished */ #define QUEUE_FLAG_INIT_DONE 14 /* queue is initialized */ #define QUEUE_FLAG_STABLE_WRITES 15 /* don't modify blks until WB is done */ #define QUEUE_FLAG_POLL 16 /* IO polling enabled if set */ @@ -587,7 +587,6 @@ #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) #define blk_queue_has_srcu(q) test_bit(QUEUE_FLAG_HAS_SRCU, &(q)->queue_flags) -#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags) #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) #define blk_queue_noxmerges(q) \ @@ -812,8 +811,6 @@ int bdev_disk_changed(struct gendisk *disk, bool invalidate); -struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id, - struct lock_class_key *lkclass); void put_disk(struct gendisk *disk); struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass); @@ -955,7 +952,6 @@ /* * Access functions for manipulating queue properties */ -extern void blk_cleanup_queue(struct request_queue *); void blk_queue_bounce_limit(struct request_queue *q, enum blk_bounce limit); extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int); diff -Nru linux-aws-5.19.0/include/linux/blk-mq.h linux-aws-5.19.0/include/linux/blk-mq.h --- linux-aws-5.19.0/include/linux/blk-mq.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/blk-mq.h 2022-11-29 07:06:46.000000000 +0000 @@ -686,10 +686,13 @@ \ __blk_mq_alloc_disk(set, queuedata, &__key); \ }) +struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q, + struct lock_class_key *lkclass); struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, struct request_queue *q); void blk_mq_unregister_dev(struct device *, struct request_queue *); +void blk_mq_destroy_queue(struct request_queue *); int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set); int blk_mq_alloc_sq_tag_set(struct blk_mq_tag_set *set, diff -Nru linux-aws-5.19.0/include/linux/blk_types.h linux-aws-5.19.0/include/linux/blk_types.h --- linux-aws-5.19.0/include/linux/blk_types.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/blk_types.h 2022-11-29 07:06:46.000000000 +0000 @@ -323,7 +323,7 @@ BIO_QUIET, /* Make BIO Quiet */ BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ BIO_REFFED, /* bio has elevated ->bi_cnt */ - BIO_THROTTLED, /* This bio has already been subjected to + BIO_BPS_THROTTLED, /* This bio has already been subjected to * throttling rules. Don't do it again. */ BIO_TRACE_COMPLETION, /* bio_endio() should trace the final completion * of this bio. */ diff -Nru linux-aws-5.19.0/include/linux/bpf-cgroup-defs.h linux-aws-5.19.0/include/linux/bpf-cgroup-defs.h --- linux-aws-5.19.0/include/linux/bpf-cgroup-defs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/bpf-cgroup-defs.h 2022-11-29 07:06:46.000000000 +0000 @@ -47,8 +47,8 @@ * have either zero or one element * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS */ - struct list_head progs[MAX_CGROUP_BPF_ATTACH_TYPE]; - u32 flags[MAX_CGROUP_BPF_ATTACH_TYPE]; + struct hlist_head progs[MAX_CGROUP_BPF_ATTACH_TYPE]; + u8 flags[MAX_CGROUP_BPF_ATTACH_TYPE]; /* list of cgroup shared storages */ struct list_head storages; diff -Nru linux-aws-5.19.0/include/linux/bpf-cgroup.h linux-aws-5.19.0/include/linux/bpf-cgroup.h --- linux-aws-5.19.0/include/linux/bpf-cgroup.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/bpf-cgroup.h 2022-11-29 07:06:46.000000000 +0000 @@ -95,7 +95,7 @@ }; struct bpf_prog_list { - struct list_head node; + struct hlist_node node; struct bpf_prog *prog; struct bpf_cgroup_link *link; struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]; diff -Nru linux-aws-5.19.0/include/linux/bpf.h linux-aws-5.19.0/include/linux/bpf.h --- linux-aws-5.19.0/include/linux/bpf.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/bpf.h 2022-11-29 07:06:46.000000000 +0000 @@ -398,6 +398,9 @@ /* DYNPTR points to a ringbuf record. */ DYNPTR_TYPE_RINGBUF = BIT(9 + BPF_BASE_TYPE_BITS), + /* Size is known at compile time. */ + MEM_FIXED_SIZE = BIT(10 + BPF_BASE_TYPE_BITS), + __BPF_TYPE_FLAG_MAX, __BPF_TYPE_LAST_FLAG = __BPF_TYPE_FLAG_MAX - 1, }; @@ -461,6 +464,8 @@ * all bytes or clear them in error case. */ ARG_PTR_TO_UNINIT_MEM = MEM_UNINIT | ARG_PTR_TO_MEM, + /* Pointer to valid memory of size known at compile time. */ + ARG_PTR_TO_FIXED_SIZE_MEM = MEM_FIXED_SIZE | ARG_PTR_TO_MEM, /* This must be the last entry. Its purpose is to ensure the enum is * wide enough to hold the higher bits reserved for bpf_type_flag. @@ -526,6 +531,14 @@ u32 *arg5_btf_id; }; u32 *arg_btf_id[5]; + struct { + size_t arg1_size; + size_t arg2_size; + size_t arg3_size; + size_t arg4_size; + size_t arg5_size; + }; + size_t arg_size[5]; }; int *ret_btf_id; /* return value btf_id */ bool (*allowed)(const struct bpf_prog *prog); @@ -856,6 +869,7 @@ struct bpf_dispatcher_prog progs[BPF_DISPATCHER_MAX]; int num_progs; void *image; + void *rw_image; u32 image_off; struct bpf_ksym ksym; }; @@ -875,7 +889,7 @@ struct bpf_trampoline *bpf_trampoline_get(u64 key, struct bpf_attach_target_info *tgt_info); void bpf_trampoline_put(struct bpf_trampoline *tr); -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs); +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs); #define BPF_DISPATCHER_INIT(_name) { \ .mutex = __MUTEX_INITIALIZER(_name.mutex), \ .func = &_name##_func, \ @@ -2260,12 +2274,9 @@ extern const struct bpf_func_proto bpf_btf_find_by_name_kind_proto; extern const struct bpf_func_proto bpf_sk_setsockopt_proto; extern const struct bpf_func_proto bpf_sk_getsockopt_proto; -extern const struct bpf_func_proto bpf_kallsyms_lookup_name_proto; extern const struct bpf_func_proto bpf_find_vma_proto; extern const struct bpf_func_proto bpf_loop_proto; -extern const struct bpf_func_proto bpf_strncmp_proto; extern const struct bpf_func_proto bpf_copy_from_user_task_proto; -extern const struct bpf_func_proto bpf_kptr_xchg_proto; const struct bpf_func_proto *tracing_prog_func_proto( enum bpf_func_id func_id, const struct bpf_prog *prog); diff -Nru linux-aws-5.19.0/include/linux/bpf_verifier.h linux-aws-5.19.0/include/linux/bpf_verifier.h --- linux-aws-5.19.0/include/linux/bpf_verifier.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/bpf_verifier.h 2022-11-29 07:06:46.000000000 +0000 @@ -212,6 +212,17 @@ * is used purely to inform the user of a reference leak. */ int insn_idx; + /* There can be a case like: + * main (frame 0) + * cb (frame 1) + * func (frame 3) + * cb (frame 4) + * Hence for frame 4, if callback_ref just stored boolean, it would be + * impossible to distinguish nested callback refs. Hence store the + * frameno and compare that to callback_ref in check_reference_leak when + * exiting a callback function. + */ + int callback_ref; }; /* state of the program: diff -Nru linux-aws-5.19.0/include/linux/buffer_head.h linux-aws-5.19.0/include/linux/buffer_head.h --- linux-aws-5.19.0/include/linux/buffer_head.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/buffer_head.h 2022-11-29 07:06:46.000000000 +0000 @@ -137,6 +137,17 @@ static __always_inline void set_buffer_uptodate(struct buffer_head *bh) { /* + * If somebody else already set this uptodate, they will + * have done the memory barrier, and a reader will thus + * see *some* valid buffer state. + * + * Any other serialization (with IO errors or whatever that + * might clear the bit) has to come from other state (eg BH_Lock). + */ + if (test_bit(BH_Uptodate, &bh->b_state)) + return; + + /* * make it consistent with folio_mark_uptodate * pairs with smp_load_acquire in buffer_uptodate */ diff -Nru linux-aws-5.19.0/include/linux/cpumask.h linux-aws-5.19.0/include/linux/cpumask.h --- linux-aws-5.19.0/include/linux/cpumask.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/cpumask.h 2022-11-29 07:06:46.000000000 +0000 @@ -1083,9 +1083,10 @@ * cover a worst-case of every other cpu being on one of two nodes for a * very large NR_CPUS. * - * Use PAGE_SIZE as a minimum for smaller configurations. + * Use PAGE_SIZE as a minimum for smaller configurations while avoiding + * unsigned comparison to -1. */ -#define CPUMAP_FILE_MAX_BYTES ((((NR_CPUS * 9)/32 - 1) > PAGE_SIZE) \ +#define CPUMAP_FILE_MAX_BYTES (((NR_CPUS * 9)/32 > PAGE_SIZE) \ ? (NR_CPUS * 9)/32 - 1 : PAGE_SIZE) #define CPULIST_FILE_MAX_BYTES (((NR_CPUS * 7)/2 > PAGE_SIZE) ? (NR_CPUS * 7)/2 : PAGE_SIZE) diff -Nru linux-aws-5.19.0/include/linux/debugfs.h linux-aws-5.19.0/include/linux/debugfs.h --- linux-aws-5.19.0/include/linux/debugfs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/debugfs.h 2022-11-29 07:06:46.000000000 +0000 @@ -91,6 +91,8 @@ void debugfs_remove(struct dentry *dentry); #define debugfs_remove_recursive debugfs_remove +void debugfs_lookup_and_remove(const char *name, struct dentry *parent); + const struct file_operations *debugfs_real_fops(const struct file *filp); int debugfs_file_get(struct dentry *dentry); @@ -225,6 +227,10 @@ static inline void debugfs_remove_recursive(struct dentry *dentry) { } +static inline void debugfs_lookup_and_remove(const char *name, + struct dentry *parent) +{ } + const struct file_operations *debugfs_real_fops(const struct file *filp); static inline int debugfs_file_get(struct dentry *dentry) diff -Nru linux-aws-5.19.0/include/linux/dynamic_debug.h linux-aws-5.19.0/include/linux/dynamic_debug.h --- linux-aws-5.19.0/include/linux/dynamic_debug.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/dynamic_debug.h 2022-11-29 07:06:46.000000000 +0000 @@ -55,9 +55,6 @@ #if defined(CONFIG_DYNAMIC_DEBUG_CORE) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries(const char *query, const char *modname); - int ddebug_add_module(struct _ddebug *tab, unsigned int n, const char *modname); extern int ddebug_remove_module(const char *mod_name); @@ -201,7 +198,7 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *modname) { - if (strstr(param, "dyndbg")) { + if (!strcmp(param, "dyndbg")) { /* avoid pr_warn(), which wants pr_fmt() fully defined */ printk(KERN_WARNING "dyndbg param is supported only in " "CONFIG_DYNAMIC_DEBUG builds\n"); @@ -221,12 +218,6 @@ rowsize, groupsize, buf, len, ascii); \ } while (0) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); - return 0; -} - #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ #endif diff -Nru linux-aws-5.19.0/include/linux/eventfd.h linux-aws-5.19.0/include/linux/eventfd.h --- linux-aws-5.19.0/include/linux/eventfd.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/eventfd.h 2022-11-29 07:06:46.000000000 +0000 @@ -46,7 +46,7 @@ static inline bool eventfd_signal_allowed(void) { - return !current->in_eventfd_signal; + return !current->in_eventfd; } #else /* CONFIG_EVENTFD */ diff -Nru linux-aws-5.19.0/include/linux/export-internal.h linux-aws-5.19.0/include/linux/export-internal.h --- linux-aws-5.19.0/include/linux/export-internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/export-internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -10,8 +10,10 @@ #include #include -/* __used is needed to keep __crc_* for LTO */ #define SYMBOL_CRC(sym, crc, sec) \ - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym = crc + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ + "__crc_" #sym ":" "\n" \ + ".long " #crc "\n" \ + ".previous" "\n") #endif /* __LINUX_EXPORT_INTERNAL_H__ */ diff -Nru linux-aws-5.19.0/include/linux/filter.h linux-aws-5.19.0/include/linux/filter.h --- linux-aws-5.19.0/include/linux/filter.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/filter.h 2022-11-29 07:06:46.000000000 +0000 @@ -1052,6 +1052,8 @@ typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size); + struct bpf_binary_header * bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, unsigned int alignment, @@ -1064,6 +1066,9 @@ struct bpf_binary_header * bpf_jit_binary_pack_hdr(const struct bpf_prog *fp); +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns); +void bpf_prog_pack_free(struct bpf_binary_header *hdr); + static inline bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) { return list_empty(&fp->aux->ksym.lnode) || diff -Nru linux-aws-5.19.0/include/linux/fortify-string.h linux-aws-5.19.0/include/linux/fortify-string.h --- linux-aws-5.19.0/include/linux/fortify-string.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/fortify-string.h 2022-11-29 07:06:46.000000000 +0000 @@ -19,7 +19,8 @@ unsigned char *__p = (unsigned char *)(p); \ size_t __ret = (size_t)-1; \ size_t __p_size = __builtin_object_size(p, 1); \ - if (__p_size != (size_t)-1) { \ + if (__p_size != (size_t)-1 && \ + __builtin_constant_p(*__p)) { \ size_t __p_len = __p_size - 1; \ if (__builtin_constant_p(__p[__p_len]) && \ __p[__p_len] == '\0') \ diff -Nru linux-aws-5.19.0/include/linux/fs.h linux-aws-5.19.0/include/linux/fs.h --- linux-aws-5.19.0/include/linux/fs.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/fs.h 2022-11-29 07:06:46.000000000 +0000 @@ -2241,13 +2241,14 @@ * don't have to write inode on fdatasync() when only * e.g. the timestamps have changed. * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. - * I_DIRTY_TIME The inode itself only has dirty timestamps, and the + * I_DIRTY_TIME The inode itself has dirty timestamps, and the * lazytime mount option is enabled. We keep track of this * separately from I_DIRTY_SYNC in order to implement * lazytime. This gets cleared if I_DIRTY_INODE - * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. I.e. - * either I_DIRTY_TIME *or* I_DIRTY_INODE can be set in - * i_state, but not both. I_DIRTY_PAGES may still be set. + * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. But + * I_DIRTY_TIME can still be set if I_DIRTY_SYNC is already + * in place because writeback might already be in progress + * and we don't want to lose the time update * I_NEW Serves as both a mutex and completion notification. * New inodes set I_NEW. If two processes both create * the same inode, one of them will release its inode and diff -Nru linux-aws-5.19.0/include/linux/hugetlb.h linux-aws-5.19.0/include/linux/hugetlb.h --- linux-aws-5.19.0/include/linux/hugetlb.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/hugetlb.h 2022-11-29 07:06:46.000000000 +0000 @@ -203,8 +203,8 @@ struct page *follow_huge_pd(struct vm_area_struct *vma, unsigned long address, hugepd_t hpd, int flags, int pdshift); -struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags); +struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, + int flags); struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address, pud_t *pud, int flags); struct page *follow_huge_pgd(struct mm_struct *mm, unsigned long address, @@ -308,8 +308,8 @@ return NULL; } -static inline struct page *follow_huge_pmd(struct mm_struct *mm, - unsigned long address, pmd_t *pmd, int flags) +static inline struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, + unsigned long address, int flags) { return NULL; } diff -Nru linux-aws-5.19.0/include/linux/hw_random.h linux-aws-5.19.0/include/linux/hw_random.h --- linux-aws-5.19.0/include/linux/hw_random.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/hw_random.h 2022-11-29 07:06:46.000000000 +0000 @@ -50,6 +50,7 @@ struct list_head list; struct kref ref; struct completion cleanup_done; + struct completion dying; }; struct device; @@ -61,4 +62,6 @@ extern void hwrng_unregister(struct hwrng *rng); extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng); +extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs); + #endif /* LINUX_HWRANDOM_H_ */ diff -Nru linux-aws-5.19.0/include/linux/intel-iommu.h linux-aws-5.19.0/include/linux/intel-iommu.h --- linux-aws-5.19.0/include/linux/intel-iommu.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/intel-iommu.h 2022-11-29 07:06:46.000000000 +0000 @@ -196,7 +196,6 @@ #define ecap_dis(e) (((e) >> 27) & 0x1) #define ecap_nest(e) (((e) >> 26) & 0x1) #define ecap_mts(e) (((e) >> 25) & 0x1) -#define ecap_ecs(e) (((e) >> 24) & 0x1) #define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16) #define ecap_max_iotlb_offset(e) (ecap_iotlb_offset(e) + 16) #define ecap_coherent(e) ((e) & 0x1) @@ -264,7 +263,6 @@ #define DMA_GSTS_CFIS (((u32)1) << 23) /* DMA_RTADDR_REG */ -#define DMA_RTADDR_RTT (((u64)1) << 11) #define DMA_RTADDR_SMT (((u64)1) << 10) /* CCMD_REG */ @@ -579,6 +577,7 @@ #ifdef CONFIG_INTEL_IOMMU unsigned long *domain_ids; /* bitmap of domains */ + unsigned long *copied_tables; /* bitmap of copied tables */ spinlock_t lock; /* protect context, domain ids */ struct root_entry *root_entry; /* virtual address */ @@ -692,6 +691,11 @@ (struct dma_pte *)ALIGN((unsigned long)pte, VTD_PAGE_SIZE) - pte; } +static inline bool context_present(struct context_entry *context) +{ + return (context->lo & 1); +} + extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev); extern int dmar_enable_qi(struct intel_iommu *iommu); @@ -776,7 +780,6 @@ #endif /* CONFIG_INTEL_IOMMU_DEBUGFS */ extern const struct attribute_group *intel_iommu_groups[]; -bool context_present(struct context_entry *context); struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, u8 devfn, int alloc); diff -Nru linux-aws-5.19.0/include/linux/iova.h linux-aws-5.19.0/include/linux/iova.h --- linux-aws-5.19.0/include/linux/iova.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/iova.h 2022-11-29 07:06:46.000000000 +0000 @@ -75,7 +75,7 @@ return iova >> iova_shift(iovad); } -#if IS_ENABLED(CONFIG_IOMMU_IOVA) +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) int iova_cache_get(void); void iova_cache_put(void); diff -Nru linux-aws-5.19.0/include/linux/mlx5/driver.h linux-aws-5.19.0/include/linux/mlx5/driver.h --- linux-aws-5.19.0/include/linux/mlx5/driver.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/mlx5/driver.h 2022-11-29 07:06:46.000000000 +0000 @@ -606,6 +606,7 @@ spinlock_t ctx_lock; struct mlx5_adev **adev; int adev_idx; + int sw_vhca_id; struct mlx5_events *events; struct mlx5_flow_steering *steering; @@ -1274,16 +1275,17 @@ MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32, }; -static inline bool mlx5_is_roce_init_enabled(struct mlx5_core_dev *dev) +bool mlx5_is_roce_on(struct mlx5_core_dev *dev); + +static inline bool mlx5_get_roce_state(struct mlx5_core_dev *dev) { - struct devlink *devlink = priv_to_devlink(dev); - union devlink_param_value val; - int err; - - err = devlink_param_driverinit_value_get(devlink, - DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, - &val); - return err ? MLX5_CAP_GEN(dev, roce) : val.vbool; + if (MLX5_CAP_GEN(dev, roce_rw_supported)) + return MLX5_CAP_GEN(dev, roce); + + /* If RoCE cap is read-only in FW, get RoCE state from devlink + * in order to support RoCE enable/disable feature + */ + return mlx5_is_roce_on(dev); } #endif /* MLX5_DRIVER_H */ diff -Nru linux-aws-5.19.0/include/linux/mlx5/mlx5_ifc.h linux-aws-5.19.0/include/linux/mlx5/mlx5_ifc.h --- linux-aws-5.19.0/include/linux/mlx5/mlx5_ifc.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/mlx5/mlx5_ifc.h 2022-11-29 07:06:46.000000000 +0000 @@ -1806,7 +1806,14 @@ u8 max_reformat_remove_size[0x8]; u8 max_reformat_remove_offset[0x8]; - u8 reserved_at_c0[0x740]; + u8 reserved_at_c0[0x160]; + + u8 reserved_at_220[0x1]; + u8 sw_vhca_id_valid[0x1]; + u8 sw_vhca_id[0xe]; + u8 reserved_at_230[0x10]; + + u8 reserved_at_240[0x5c0]; }; enum mlx5_ifc_flow_destination_type { @@ -3717,6 +3724,11 @@ struct mlx5_ifc_wq_bits wq; }; +enum { + VHCA_ID_TYPE_HW = 0, + VHCA_ID_TYPE_SW = 1, +}; + struct mlx5_ifc_nic_vport_context_bits { u8 reserved_at_0[0x5]; u8 min_wqe_inline_mode[0x3]; @@ -3733,8 +3745,8 @@ u8 event_on_mc_address_change[0x1]; u8 event_on_uc_address_change[0x1]; - u8 reserved_at_40[0xc]; - + u8 vhca_id_type[0x1]; + u8 reserved_at_41[0xb]; u8 affiliation_criteria[0x4]; u8 affiliated_vhca_id[0x10]; @@ -7193,7 +7205,12 @@ u8 reserved_at_20[0x10]; u8 op_mod[0x10]; - u8 reserved_at_40[0x40]; + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x2]; + u8 sw_vhca_id[0xe]; + u8 reserved_at_70[0x10]; + u8 sw_owner_id[4][0x20]; }; diff -Nru linux-aws-5.19.0/include/linux/mmc/card.h linux-aws-5.19.0/include/linux/mmc/card.h --- linux-aws-5.19.0/include/linux/mmc/card.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/mmc/card.h 2022-11-29 07:06:46.000000000 +0000 @@ -292,6 +292,7 @@ #define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */ #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ +#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */ bool reenable_cmdq; /* Re-enable Command Queue */ diff -Nru linux-aws-5.19.0/include/linux/of_device.h linux-aws-5.19.0/include/linux/of_device.h --- linux-aws-5.19.0/include/linux/of_device.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/of_device.h 2022-11-29 07:06:46.000000000 +0000 @@ -101,8 +101,9 @@ } static inline int of_dma_configure_id(struct device *dev, - struct device_node *np, - bool force_dma) + struct device_node *np, + bool force_dma, + const u32 *id) { return 0; } diff -Nru linux-aws-5.19.0/include/linux/once.h linux-aws-5.19.0/include/linux/once.h --- linux-aws-5.19.0/include/linux/once.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/once.h 2022-11-29 07:06:46.000000000 +0000 @@ -5,10 +5,18 @@ #include #include +/* Helpers used from arbitrary contexts. + * Hard irqs are blocked, be cautious. + */ bool __do_once_start(bool *done, unsigned long *flags); void __do_once_done(bool *done, struct static_key_true *once_key, unsigned long *flags, struct module *mod); +/* Variant for process contexts only. */ +bool __do_once_slow_start(bool *done); +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod); + /* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only * once, where DO_ONCE() can live in the fast-path. After @func has @@ -52,9 +60,29 @@ ___ret; \ }) +/* Variant of DO_ONCE() for process/sleepable contexts. */ +#define DO_ONCE_SLOW(func, ...) \ + ({ \ + bool ___ret = false; \ + static bool __section(".data.once") ___done = false; \ + static DEFINE_STATIC_KEY_TRUE(___once_key); \ + if (static_branch_unlikely(&___once_key)) { \ + ___ret = __do_once_slow_start(&___done); \ + if (unlikely(___ret)) { \ + func(__VA_ARGS__); \ + __do_once_slow_done(&___done, &___once_key, \ + THIS_MODULE); \ + } \ + } \ + ___ret; \ + }) + #define get_random_once(buf, nbytes) \ DO_ONCE(get_random_bytes, (buf), (nbytes)) #define get_random_once_wait(buf, nbytes) \ DO_ONCE(get_random_bytes_wait, (buf), (nbytes)) \ +#define get_random_slow_once(buf, nbytes) \ + DO_ONCE_SLOW(get_random_bytes, (buf), (nbytes)) + #endif /* _LINUX_ONCE_H */ diff -Nru linux-aws-5.19.0/include/linux/pci.h linux-aws-5.19.0/include/linux/pci.h --- linux-aws-5.19.0/include/linux/pci.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/pci.h 2022-11-29 07:06:46.000000000 +0000 @@ -477,6 +477,7 @@ unsigned int broken_cmd_compl:1; /* No compl for some cmds */ #endif #ifdef CONFIG_PCIE_PTM + u16 ptm_cap; /* PTM Capability */ unsigned int ptm_root:1; unsigned int ptm_enabled:1; u8 ptm_granularity; @@ -1681,10 +1682,12 @@ #ifdef CONFIG_PCIE_PTM int pci_enable_ptm(struct pci_dev *dev, u8 *granularity); +void pci_disable_ptm(struct pci_dev *dev); bool pcie_ptm_enabled(struct pci_dev *dev); #else static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) { return -EINVAL; } +static inline void pci_disable_ptm(struct pci_dev *dev) { } static inline bool pcie_ptm_enabled(struct pci_dev *dev) { return false; } #endif diff -Nru linux-aws-5.19.0/include/linux/platform_data/x86/pmc_atom.h linux-aws-5.19.0/include/linux/platform_data/x86/pmc_atom.h --- linux-aws-5.19.0/include/linux/platform_data/x86/pmc_atom.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/platform_data/x86/pmc_atom.h 2022-11-29 07:06:46.000000000 +0000 @@ -7,6 +7,8 @@ #ifndef PMC_ATOM_H #define PMC_ATOM_H +#include + /* ValleyView Power Control Unit PCI Device ID */ #define PCI_DEVICE_ID_VLV_PMC 0x0F1C /* CherryTrail Power Control Unit PCI Device ID */ @@ -139,9 +141,9 @@ #define ACPI_MMIO_REG_LEN 0x100 #define PM1_CNT 0x4 -#define SLEEP_TYPE_MASK 0xFFFFECFF +#define SLEEP_TYPE_MASK GENMASK(12, 10) #define SLEEP_TYPE_S5 0x1C00 -#define SLEEP_ENABLE 0x2000 +#define SLEEP_ENABLE BIT(13) extern int pmc_atom_read(int offset, u32 *value); diff -Nru linux-aws-5.19.0/include/linux/ring_buffer.h linux-aws-5.19.0/include/linux/ring_buffer.h --- linux-aws-5.19.0/include/linux/ring_buffer.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/ring_buffer.h 2022-11-29 07:06:46.000000000 +0000 @@ -101,7 +101,7 @@ int ring_buffer_wait(struct trace_buffer *buffer, int cpu, int full); __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, struct file *filp, poll_table *poll_table); - +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu); #define RING_BUFFER_ALL_CPUS -1 diff -Nru linux-aws-5.19.0/include/linux/sched.h linux-aws-5.19.0/include/linux/sched.h --- linux-aws-5.19.0/include/linux/sched.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/sched.h 2022-11-29 07:06:46.000000000 +0000 @@ -934,7 +934,7 @@ #endif #ifdef CONFIG_EVENTFD /* Recursion prevention for eventfd_signal() */ - unsigned in_eventfd_signal:1; + unsigned in_eventfd:1; #endif #ifdef CONFIG_IOMMU_SVA unsigned pasid_activated:1; diff -Nru linux-aws-5.19.0/include/linux/scmi_protocol.h linux-aws-5.19.0/include/linux/scmi_protocol.h --- linux-aws-5.19.0/include/linux/scmi_protocol.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/scmi_protocol.h 2022-11-29 07:06:46.000000000 +0000 @@ -78,7 +78,7 @@ struct scmi_clk_proto_ops { int (*count_get)(const struct scmi_protocol_handle *ph); - const struct scmi_clock_info *(*info_get) + const struct scmi_clock_info __must_check *(*info_get) (const struct scmi_protocol_handle *ph, u32 clk_id); int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id, u64 *rate); @@ -460,7 +460,7 @@ */ struct scmi_sensor_proto_ops { int (*count_get)(const struct scmi_protocol_handle *ph); - const struct scmi_sensor_info *(*info_get) + const struct scmi_sensor_info __must_check *(*info_get) (const struct scmi_protocol_handle *ph, u32 sensor_id); int (*trip_point_config)(const struct scmi_protocol_handle *ph, u32 sensor_id, u8 trip_id, u64 trip_value); diff -Nru linux-aws-5.19.0/include/linux/serial_8250.h linux-aws-5.19.0/include/linux/serial_8250.h --- linux-aws-5.19.0/include/linux/serial_8250.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/serial_8250.h 2022-11-29 07:06:46.000000000 +0000 @@ -74,6 +74,7 @@ struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); + void (*setup_timer)(struct uart_8250_port *); }; struct uart_8250_em485 { diff -Nru linux-aws-5.19.0/include/linux/serial_core.h linux-aws-5.19.0/include/linux/serial_core.h --- linux-aws-5.19.0/include/linux/serial_core.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/serial_core.h 2022-11-29 07:06:46.000000000 +0000 @@ -101,7 +101,7 @@ __u32 buf_overrun; }; -typedef unsigned int __bitwise upf_t; +typedef u64 __bitwise upf_t; typedef unsigned int __bitwise upstat_t; struct uart_port { @@ -208,6 +208,7 @@ #define UPF_FIXED_PORT ((__force upf_t) (1 << 29)) #define UPF_DEAD ((__force upf_t) (1 << 30)) #define UPF_IOREMAP ((__force upf_t) (1 << 31)) +#define UPF_FULL_PROBE ((__force upf_t) (1ULL << 32)) #define __UPF_CHANGE_MASK 0x17fff #define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK) @@ -302,6 +303,23 @@ /* number of characters left in xmit buffer before we ask for more */ #define WAKEUP_CHARS 256 +/** + * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars + * @up: uart_port structure describing the port + * @chars: number of characters sent + * + * This function advances the tail of circular xmit buffer by the number of + * @chars transmitted and handles accounting of transmitted bytes (into + * @up's icount.tx). + */ +static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars) +{ + struct circ_buf *xmit = &up->state->xmit; + + xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1); + up->icount.tx += chars; +} + struct module; struct tty_driver; diff -Nru linux-aws-5.19.0/include/linux/skbuff.h linux-aws-5.19.0/include/linux/skbuff.h --- linux-aws-5.19.0/include/linux/skbuff.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/skbuff.h 2022-11-29 07:06:46.000000000 +0000 @@ -2530,6 +2530,22 @@ return skb_headlen(skb) + __skb_pagelen(skb); } +static inline void __skb_fill_page_desc_noacc(struct skb_shared_info *shinfo, + int i, struct page *page, + int off, int size) +{ + skb_frag_t *frag = &shinfo->frags[i]; + + /* + * Propagate page pfmemalloc to the skb if we can. The problem is + * that not all callers have unique ownership of the page but rely + * on page_is_pfmemalloc doing the right thing(tm). + */ + frag->bv_page = page; + frag->bv_offset = off; + skb_frag_size_set(frag, size); +} + /** * __skb_fill_page_desc - initialise a paged fragment in an skb * @skb: buffer containing fragment to be initialised @@ -2546,17 +2562,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size) { - skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; - - /* - * Propagate page pfmemalloc to the skb if we can. The problem is - * that not all callers have unique ownership of the page but rely - * on page_is_pfmemalloc doing the right thing(tm). - */ - frag->bv_page = page; - frag->bv_offset = off; - skb_frag_size_set(frag, size); - + __skb_fill_page_desc_noacc(skb_shinfo(skb), i, page, off, size); page = compound_head(page); if (page_is_pfmemalloc(page)) skb->pfmemalloc = true; @@ -2583,6 +2589,27 @@ skb_shinfo(skb)->nr_frags = i + 1; } +/** + * skb_fill_page_desc_noacc - initialise a paged fragment in an skb + * @skb: buffer containing fragment to be initialised + * @i: paged fragment index to initialise + * @page: the page to use for this fragment + * @off: the offset to the data with @page + * @size: the length of the data + * + * Variant of skb_fill_page_desc() which does not deal with + * pfmemalloc, if page is not owned by us. + */ +static inline void skb_fill_page_desc_noacc(struct sk_buff *skb, int i, + struct page *page, int off, + int size) +{ + struct skb_shared_info *shinfo = skb_shinfo(skb); + + __skb_fill_page_desc_noacc(shinfo, i, page, off, size); + shinfo->nr_frags = i + 1; +} + void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, int size, unsigned int truesize); diff -Nru linux-aws-5.19.0/include/linux/tcp.h linux-aws-5.19.0/include/linux/tcp.h --- linux-aws-5.19.0/include/linux/tcp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/tcp.h 2022-11-29 07:06:46.000000000 +0000 @@ -265,7 +265,7 @@ u32 packets_out; /* Packets which are "in flight" */ u32 retrans_out; /* Retransmitted packets out */ u32 max_packets_out; /* max packets_out in last window */ - u32 max_packets_seq; /* right edge of max_packets_out flight */ + u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */ u16 urg_data; /* Saved octet of OOB data and control flags */ u8 ecn_flags; /* ECN status bits. */ diff -Nru linux-aws-5.19.0/include/linux/time64.h linux-aws-5.19.0/include/linux/time64.h --- linux-aws-5.19.0/include/linux/time64.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/time64.h 2022-11-29 07:06:46.000000000 +0000 @@ -20,6 +20,9 @@ struct timespec64 it_value; }; +/* Parameters used to convert the timespec values: */ +#define PSEC_PER_NSEC 1000L + /* Located here for timespec[64]_valid_strict */ #define TIME64_MAX ((s64)~((u64)1 << 63)) #define TIME64_MIN (-TIME64_MAX - 1) diff -Nru linux-aws-5.19.0/include/linux/trace_events.h linux-aws-5.19.0/include/linux/trace_events.h --- linux-aws-5.19.0/include/linux/trace_events.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/linux/trace_events.h 2022-11-29 07:06:46.000000000 +0000 @@ -92,6 +92,7 @@ unsigned int temp_size; char *fmt; /* modified format holder */ unsigned int fmt_size; + long wait_index; /* trace_seq for __print_flags() and __print_symbolic() etc. */ struct trace_seq tmp_seq; diff -Nru linux-aws-5.19.0/include/linux/trace.h linux-aws-5.19.0/include/linux/trace.h --- linux-aws-5.19.0/include/linux/trace.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/trace.h 2022-11-29 07:06:46.000000000 +0000 @@ -2,8 +2,6 @@ #ifndef _LINUX_TRACE_H #define _LINUX_TRACE_H -#ifdef CONFIG_TRACING - #define TRACE_EXPORT_FUNCTION BIT(0) #define TRACE_EXPORT_EVENT BIT(1) #define TRACE_EXPORT_MARKER BIT(2) @@ -28,6 +26,8 @@ int flags; }; +#ifdef CONFIG_TRACING + int register_ftrace_export(struct trace_export *export); int unregister_ftrace_export(struct trace_export *export); @@ -48,6 +48,38 @@ void osnoise_trace_irq_entry(int id); void osnoise_trace_irq_exit(int id, const char *desc); +#else /* CONFIG_TRACING */ +static inline int register_ftrace_export(struct trace_export *export) +{ + return -EINVAL; +} +static inline int unregister_ftrace_export(struct trace_export *export) +{ + return 0; +} +static inline void trace_printk_init_buffers(void) +{ +} +static inline int trace_array_printk(struct trace_array *tr, unsigned long ip, + const char *fmt, ...) +{ + return 0; +} +static inline int trace_array_init_printk(struct trace_array *tr) +{ + return -EINVAL; +} +static inline void trace_array_put(struct trace_array *tr) +{ +} +static inline struct trace_array *trace_array_get_by_name(const char *name) +{ + return NULL; +} +static inline int trace_array_destroy(struct trace_array *tr) +{ + return 0; +} #endif /* CONFIG_TRACING */ #endif /* _LINUX_TRACE_H */ diff -Nru linux-aws-5.19.0/include/linux/udp.h linux-aws-5.19.0/include/linux/udp.h --- linux-aws-5.19.0/include/linux/udp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/udp.h 2022-11-29 07:06:46.000000000 +0000 @@ -70,6 +70,7 @@ * For encapsulation sockets. */ int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); + void (*encap_err_rcv)(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset); int (*encap_err_lookup)(struct sock *sk, struct sk_buff *skb); void (*encap_destroy)(struct sock *sk); diff -Nru linux-aws-5.19.0/include/linux/usb/typec_dp.h linux-aws-5.19.0/include/linux/usb/typec_dp.h --- linux-aws-5.19.0/include/linux/usb/typec_dp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/usb/typec_dp.h 2022-11-29 07:06:46.000000000 +0000 @@ -73,6 +73,11 @@ #define DP_CAP_USB BIT(7) #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8) #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16) +/* Get pin assignment taking plug & receptacle into consideration */ +#define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ + DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_)) +#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ + DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_)) /* DisplayPort Status Update VDO bits */ #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3) diff -Nru linux-aws-5.19.0/include/linux/usb.h linux-aws-5.19.0/include/linux/usb.h --- linux-aws-5.19.0/include/linux/usb.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/linux/usb.h 2022-11-29 07:06:46.000000000 +0000 @@ -575,6 +575,7 @@ * @devaddr: device address, XHCI: assigned by HW, others: same as devnum * @can_submit: URBs may be submitted * @persist_enabled: USB_PERSIST enabled for this device + * @reset_in_progress: the device is being reset * @have_langid: whether string_langid is valid * @authorized: policy has said we can use it; * (user space) policy determines if we authorize this device to be @@ -661,6 +662,7 @@ unsigned can_submit:1; unsigned persist_enabled:1; + unsigned reset_in_progress:1; unsigned have_langid:1; unsigned authorized:1; unsigned authenticated:1; diff -Nru linux-aws-5.19.0/include/net/bond_3ad.h linux-aws-5.19.0/include/net/bond_3ad.h --- linux-aws-5.19.0/include/net/bond_3ad.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/bond_3ad.h 2022-11-29 07:06:46.000000000 +0000 @@ -15,8 +15,6 @@ #define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW) #define AD_TIMER_INTERVAL 100 /*msec*/ -#define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} - #define AD_LACP_SLOW 0 #define AD_LACP_FAST 1 diff -Nru linux-aws-5.19.0/include/net/bonding.h linux-aws-5.19.0/include/net/bonding.h --- linux-aws-5.19.0/include/net/bonding.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/bonding.h 2022-11-29 07:06:46.000000000 +0000 @@ -161,8 +161,9 @@ struct net_device *dev; /* first - useful for panic debug */ struct bonding *bond; /* our master */ int delay; - /* all three in jiffies */ + /* all 4 in jiffies */ unsigned long last_link_up; + unsigned long last_tx; unsigned long last_rx; unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS]; s8 link; /* one of BOND_LINK_XXXX */ @@ -539,6 +540,16 @@ return slave->last_rx; } +static inline void slave_update_last_tx(struct slave *slave) +{ + WRITE_ONCE(slave->last_tx, jiffies); +} + +static inline unsigned long slave_last_tx(struct slave *slave) +{ + return READ_ONCE(slave->last_tx); +} + #ifdef CONFIG_NET_POLL_CONTROLLER static inline netdev_tx_t bond_netpoll_send_skb(const struct slave *slave, struct sk_buff *skb) @@ -774,6 +785,9 @@ /* exported from bond_sysfs_slave.c */ extern const struct sysfs_ops slave_sysfs_ops; +/* exported from bond_3ad.c */ +extern const u8 lacpdu_mcast_addr[]; + static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb) { dev_core_stats_tx_dropped_inc(dev); diff -Nru linux-aws-5.19.0/include/net/ieee802154_netdev.h linux-aws-5.19.0/include/net/ieee802154_netdev.h --- linux-aws-5.19.0/include/net/ieee802154_netdev.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/ieee802154_netdev.h 2022-11-29 07:06:46.000000000 +0000 @@ -15,6 +15,22 @@ #ifndef IEEE802154_NETDEVICE_H #define IEEE802154_NETDEVICE_H +#define IEEE802154_REQUIRED_SIZE(struct_type, member) \ + (offsetof(typeof(struct_type), member) + \ + sizeof(((typeof(struct_type) *)(NULL))->member)) + +#define IEEE802154_ADDR_OFFSET \ + offsetof(typeof(struct sockaddr_ieee802154), addr) + +#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) + +#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) + +#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) + #include #include #include @@ -165,6 +181,33 @@ memcpy(raw, &temp, IEEE802154_ADDR_LEN); } +static inline int +ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) +{ + struct ieee802154_addr_sa *sa; + int ret = 0; + + sa = &daddr->addr; + if (len < IEEE802154_MIN_NAMELEN) + return -EINVAL; + switch (sa->addr_type) { + case IEEE802154_ADDR_NONE: + break; + case IEEE802154_ADDR_SHORT: + if (len < IEEE802154_NAMELEN_SHORT) + ret = -EINVAL; + break; + case IEEE802154_ADDR_LONG: + if (len < IEEE802154_NAMELEN_LONG) + ret = -EINVAL; + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, const struct ieee802154_addr_sa *sa) { diff -Nru linux-aws-5.19.0/include/net/ip_tunnels.h linux-aws-5.19.0/include/net/ip_tunnels.h --- linux-aws-5.19.0/include/net/ip_tunnels.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/net/ip_tunnels.h 2022-11-29 07:06:46.000000000 +0000 @@ -274,7 +274,8 @@ __be32 daddr, __be32 saddr, __be32 key, __u8 tos, struct net *net, int oif, - __u32 mark, __u32 tun_inner_hash) + __u32 mark, __u32 tun_inner_hash, + __u8 flow_flags) { memset(fl4, 0, sizeof(*fl4)); @@ -291,6 +292,7 @@ fl4->fl4_gre_key = key; fl4->flowi4_mark = mark; fl4->flowi4_multipath_hash = tun_inner_hash; + fl4->flowi4_flags = flow_flags; } int ip_tunnel_init(struct net_device *dev); diff -Nru linux-aws-5.19.0/include/net/tcp.h linux-aws-5.19.0/include/net/tcp.h --- linux-aws-5.19.0/include/net/tcp.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/tcp.h 2022-11-29 07:06:46.000000000 +0000 @@ -1289,11 +1289,14 @@ { const struct tcp_sock *tp = tcp_sk(sk); + if (tp->is_cwnd_limited) + return true; + /* If in slow start, ensure cwnd grows to twice what was ACKed. */ if (tcp_in_slow_start(tp)) return tcp_snd_cwnd(tp) < 2 * tp->max_packets_out; - return tp->is_cwnd_limited; + return false; } /* BBR congestion control needs pacing. diff -Nru linux-aws-5.19.0/include/net/udp_tunnel.h linux-aws-5.19.0/include/net/udp_tunnel.h --- linux-aws-5.19.0/include/net/udp_tunnel.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/udp_tunnel.h 2022-11-29 07:06:46.000000000 +0000 @@ -67,6 +67,9 @@ typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb); typedef int (*udp_tunnel_encap_err_lookup_t)(struct sock *sk, struct sk_buff *skb); +typedef void (*udp_tunnel_encap_err_rcv_t)(struct sock *sk, + struct sk_buff *skb, + unsigned int udp_offset); typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk); typedef struct sk_buff *(*udp_tunnel_gro_receive_t)(struct sock *sk, struct list_head *head, @@ -80,6 +83,7 @@ __u8 encap_type; udp_tunnel_encap_rcv_t encap_rcv; udp_tunnel_encap_err_lookup_t encap_err_lookup; + udp_tunnel_encap_err_rcv_t encap_err_rcv; udp_tunnel_encap_destroy_t encap_destroy; udp_tunnel_gro_receive_t gro_receive; udp_tunnel_gro_complete_t gro_complete; diff -Nru linux-aws-5.19.0/include/net/xfrm.h linux-aws-5.19.0/include/net/xfrm.h --- linux-aws-5.19.0/include/net/xfrm.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/xfrm.h 2022-11-29 07:06:46.000000000 +0000 @@ -1195,6 +1195,8 @@ static inline int xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) { + if (!sk_fullsock(osk)) + return 0; sk->sk_policy[0] = NULL; sk->sk_policy[1] = NULL; if (unlikely(osk->sk_policy[0] || osk->sk_policy[1])) diff -Nru linux-aws-5.19.0/include/net/xsk_buff_pool.h linux-aws-5.19.0/include/net/xsk_buff_pool.h --- linux-aws-5.19.0/include/net/xsk_buff_pool.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/net/xsk_buff_pool.h 2022-11-29 07:06:46.000000000 +0000 @@ -95,7 +95,7 @@ struct xdp_umem *umem); int xp_assign_dev(struct xsk_buff_pool *pool, struct net_device *dev, u16 queue_id, u16 flags); -int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem, +int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs, struct net_device *dev, u16 queue_id); int xp_alloc_tx_descs(struct xsk_buff_pool *pool, struct xdp_sock *xs); void xp_destroy(struct xsk_buff_pool *pool); diff -Nru linux-aws-5.19.0/include/scsi/libiscsi.h linux-aws-5.19.0/include/scsi/libiscsi.h --- linux-aws-5.19.0/include/scsi/libiscsi.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/include/scsi/libiscsi.h 2022-11-29 07:06:46.000000000 +0000 @@ -213,6 +213,8 @@ struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ + /* recv */ + struct work_struct recvwork; unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ @@ -452,8 +454,10 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); +extern void iscsi_suspend_rx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); -extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); +extern void iscsi_conn_queue_recv(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ diff -Nru linux-aws-5.19.0/include/scsi/scsi_host.h linux-aws-5.19.0/include/scsi/scsi_host.h --- linux-aws-5.19.0/include/scsi/scsi_host.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/scsi/scsi_host.h 2022-11-29 07:06:46.000000000 +0000 @@ -557,6 +557,8 @@ struct scsi_host_template *hostt; struct scsi_transport_template *transportt; + struct kref tagset_refcnt; + struct completion tagset_freed; /* Area to keep a shared tag map */ struct blk_mq_tag_set tag_set; diff -Nru linux-aws-5.19.0/include/soc/at91/sama7-ddr.h linux-aws-5.19.0/include/soc/at91/sama7-ddr.h --- linux-aws-5.19.0/include/soc/at91/sama7-ddr.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/soc/at91/sama7-ddr.h 2022-11-29 07:06:46.000000000 +0000 @@ -38,6 +38,14 @@ #define DDR3PHY_DSGCR_ODTPDD_ODT0 (1 << 20) /* ODT[0] Power Down Driver */ #define DDR3PHY_ZQ0SR0 (0x188) /* ZQ status register 0 */ +#define DDR3PHY_ZQ0SR0_PDO_OFF (0) /* Pull-down output impedance select offset */ +#define DDR3PHY_ZQ0SR0_PUO_OFF (5) /* Pull-up output impedance select offset */ +#define DDR3PHY_ZQ0SR0_PDODT_OFF (10) /* Pull-down on-die termination impedance select offset */ +#define DDR3PHY_ZQ0SRO_PUODT_OFF (15) /* Pull-up on-die termination impedance select offset */ + +#define DDR3PHY_DX0DLLCR (0x1CC) /* DDR3PHY DATX8 DLL Control Register */ +#define DDR3PHY_DX1DLLCR (0x20C) /* DDR3PHY DATX8 DLL Control Register */ +#define DDR3PHY_DXDLLCR_DLLDIS (1 << 31) /* DLL Disable */ /* UDDRC */ #define UDDRC_STAT (0x04) /* UDDRC Operating Mode Status Register */ diff -Nru linux-aws-5.19.0/include/sound/cs35l41.h linux-aws-5.19.0/include/sound/cs35l41.h --- linux-aws-5.19.0/include/sound/cs35l41.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/sound/cs35l41.h 2022-11-29 07:06:46.000000000 +0000 @@ -665,6 +665,10 @@ #define CS35L41_BST_EN_DEFAULT 0x2 #define CS35L41_AMP_EN_SHIFT 0 #define CS35L41_AMP_EN_MASK 1 +#define CS35L41_VMON_EN_MASK 0x1000 +#define CS35L41_VMON_EN_SHIFT 12 +#define CS35L41_IMON_EN_MASK 0x2000 +#define CS35L41_IMON_EN_SHIFT 13 #define CS35L41_PDN_DONE_MASK 0x00800000 #define CS35L41_PDN_DONE_SHIFT 23 @@ -881,6 +885,9 @@ int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap, enum cs35l41_cspl_mbox_cmd cmd); int cs35l41_write_fs_errata(struct device *dev, struct regmap *regmap); +int cs35l41_enter_hibernate(struct device *dev, struct regmap *regmap, + enum cs35l41_boost_type b_type); +int cs35l41_exit_hibernate(struct device *dev, struct regmap *regmap); int cs35l41_init_boost(struct device *dev, struct regmap *regmap, struct cs35l41_hw_cfg *hw_cfg); bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type); diff -Nru linux-aws-5.19.0/include/uapi/linux/xfrm.h linux-aws-5.19.0/include/uapi/linux/xfrm.h --- linux-aws-5.19.0/include/uapi/linux/xfrm.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/uapi/linux/xfrm.h 2022-11-29 07:06:46.000000000 +0000 @@ -296,7 +296,7 @@ XFRMA_ETIMER_THRESH, XFRMA_SRCADDR, /* xfrm_address_t */ XFRMA_COADDR, /* xfrm_address_t */ - XFRMA_LASTUSED, /* unsigned long */ + XFRMA_LASTUSED, /* __u64 */ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ XFRMA_MIGRATE, XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ diff -Nru linux-aws-5.19.0/include/uapi/rdma/mlx5-abi.h linux-aws-5.19.0/include/uapi/rdma/mlx5-abi.h --- linux-aws-5.19.0/include/uapi/rdma/mlx5-abi.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/include/uapi/rdma/mlx5-abi.h 2022-11-29 07:06:46.000000000 +0000 @@ -104,6 +104,7 @@ MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4, + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5, }; enum mlx5_user_cmds_supp_uhw { diff -Nru linux-aws-5.19.0/io_uring/io_uring.c linux-aws-5.19.0/io_uring/io_uring.c --- linux-aws-5.19.0/io_uring/io_uring.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/io_uring/io_uring.c 2022-11-29 07:06:46.000000000 +0000 @@ -4215,6 +4215,7 @@ return -EAGAIN; } + req->cqe.res = iov_iter_count(&s->iter); /* * Now retry read with the IOCB_WAITQ parts set in the iocb. If * we get -EIOCBQUEUED, then we'll get a notification when the @@ -5061,7 +5062,8 @@ req_set_fail(req); __io_req_complete(req, issue_flags, ret, 0); /* put file to avoid an attempt to IOPOLL the req */ - io_put_file(req->file); + if (!(req->flags & REQ_F_FIXED_FILE)) + io_put_file(req->file); req->file = NULL; return 0; } @@ -5848,10 +5850,13 @@ async_msg = req->async_data; req->flags |= REQ_F_NEED_CLEANUP; memcpy(async_msg, kmsg, sizeof(*kmsg)); - async_msg->msg.msg_name = &async_msg->addr; + if (async_msg->msg.msg_name) + async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ - if (!async_msg->free_iov) - async_msg->msg.msg_iter.iov = async_msg->fast_iov; + if (!kmsg->free_iov) { + size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; + async_msg->msg.msg_iter.iov = &async_msg->fast_iov[fast_idx]; + } return -EAGAIN; } @@ -8264,6 +8269,7 @@ switch (io_arm_poll_handler(req, 0)) { case IO_APOLL_READY: + io_kbuf_recycle(req, 0); io_req_task_queue(req); break; case IO_APOLL_ABORTED: @@ -10705,12 +10711,6 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx) { io_sq_thread_finish(ctx); - - if (ctx->mm_account) { - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; - } - io_rsrc_refs_drop(ctx); /* __io_rsrc_put_work() may need uring_lock to progress, wait w/o it */ io_wait_rsrc_data(ctx->buf_data); @@ -10749,6 +10749,10 @@ #endif WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list)); + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes); @@ -10950,6 +10954,9 @@ io_poll_remove_all(ctx, NULL, true); /* if we failed setting up the ctx, we might not have any rings */ io_iopoll_try_reap_events(ctx); + /* drop cached put refs after potentially doing completions */ + if (current->io_uring) + io_uring_drop_tctx_refs(current); } INIT_WORK(&ctx->exit_work, io_ring_exit_work); diff -Nru linux-aws-5.19.0/ipc/mqueue.c linux-aws-5.19.0/ipc/mqueue.c --- linux-aws-5.19.0/ipc/mqueue.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/ipc/mqueue.c 2022-11-29 07:06:46.000000000 +0000 @@ -1746,6 +1746,7 @@ unregister_filesystem(&mqueue_fs_type); out_sysctl: kmem_cache_destroy(mqueue_inode_cachep); + retire_mq_sysctls(&init_ipc_ns); return error; } diff -Nru linux-aws-5.19.0/kernel/auditsc.c linux-aws-5.19.0/kernel/auditsc.c --- linux-aws-5.19.0/kernel/auditsc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/auditsc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1023,7 +1023,6 @@ WARN_ON(!list_empty(&ctx->killed_trees)); audit_free_module(ctx); ctx->fds[0] = -1; - audit_proctitle_free(ctx); ctx->type = 0; /* reset last for audit_free_*() */ } @@ -1109,6 +1108,7 @@ { /* resetting is extra work, but it is likely just noise */ audit_reset_context(context); + audit_proctitle_free(context); free_tree_refs(context); kfree(context->filterkey); kfree(context); @@ -2071,7 +2071,7 @@ /* run through both filters to ensure we set the filterkey properly */ audit_filter_syscall(current, context); audit_filter_inodes(current, context); - if (context->current_state < AUDIT_STATE_RECORD) + if (context->current_state != AUDIT_STATE_RECORD) goto out; audit_log_exit(); diff -Nru linux-aws-5.19.0/kernel/bpf/bpf_local_storage.c linux-aws-5.19.0/kernel/bpf/bpf_local_storage.c --- linux-aws-5.19.0/kernel/bpf/bpf_local_storage.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/bpf_local_storage.c 2022-11-29 07:06:46.000000000 +0000 @@ -555,11 +555,11 @@ struct bpf_local_storage_elem, map_node))) { if (busy_counter) { migrate_disable(); - __this_cpu_inc(*busy_counter); + this_cpu_inc(*busy_counter); } bpf_selem_unlink(selem, false); if (busy_counter) { - __this_cpu_dec(*busy_counter); + this_cpu_dec(*busy_counter); migrate_enable(); } cond_resched_rcu(); diff -Nru linux-aws-5.19.0/kernel/bpf/bpf_task_storage.c linux-aws-5.19.0/kernel/bpf/bpf_task_storage.c --- linux-aws-5.19.0/kernel/bpf/bpf_task_storage.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/bpf_task_storage.c 2022-11-29 07:06:46.000000000 +0000 @@ -26,20 +26,20 @@ static void bpf_task_storage_lock(void) { migrate_disable(); - __this_cpu_inc(bpf_task_storage_busy); + this_cpu_inc(bpf_task_storage_busy); } static void bpf_task_storage_unlock(void) { - __this_cpu_dec(bpf_task_storage_busy); + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); } static bool bpf_task_storage_trylock(void) { migrate_disable(); - if (unlikely(__this_cpu_inc_return(bpf_task_storage_busy) != 1)) { - __this_cpu_dec(bpf_task_storage_busy); + if (unlikely(this_cpu_inc_return(bpf_task_storage_busy) != 1)) { + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); return false; } diff -Nru linux-aws-5.19.0/kernel/bpf/btf.c linux-aws-5.19.0/kernel/bpf/btf.c --- linux-aws-5.19.0/kernel/bpf/btf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/btf.c 2022-11-29 07:06:46.000000000 +0000 @@ -3120,7 +3120,7 @@ if (v->next_member) { const struct btf_type *last_member_type; const struct btf_member *last_member; - u16 last_member_type_id; + u32 last_member_type_id; last_member = btf_type_member(v->t) + v->next_member - 1; last_member_type_id = last_member->type; diff -Nru linux-aws-5.19.0/kernel/bpf/cgroup.c linux-aws-5.19.0/kernel/bpf/cgroup.c --- linux-aws-5.19.0/kernel/bpf/cgroup.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/cgroup.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,11 +157,12 @@ mutex_lock(&cgroup_mutex); for (atype = 0; atype < ARRAY_SIZE(cgrp->bpf.progs); atype++) { - struct list_head *progs = &cgrp->bpf.progs[atype]; - struct bpf_prog_list *pl, *pltmp; + struct hlist_head *progs = &cgrp->bpf.progs[atype]; + struct bpf_prog_list *pl; + struct hlist_node *pltmp; - list_for_each_entry_safe(pl, pltmp, progs, node) { - list_del(&pl->node); + hlist_for_each_entry_safe(pl, pltmp, progs, node) { + hlist_del(&pl->node); if (pl->prog) bpf_prog_put(pl->prog); if (pl->link) @@ -217,12 +218,12 @@ /* count number of elements in the list. * it's slow but the list cannot be long */ -static u32 prog_list_length(struct list_head *head) +static u32 prog_list_length(struct hlist_head *head) { struct bpf_prog_list *pl; u32 cnt = 0; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; cnt++; @@ -291,7 +292,7 @@ if (cnt > 0 && !(p->bpf.flags[atype] & BPF_F_ALLOW_MULTI)) continue; - list_for_each_entry(pl, &p->bpf.progs[atype], node) { + hlist_for_each_entry(pl, &p->bpf.progs[atype], node) { if (!prog_list_prog(pl)) continue; @@ -342,7 +343,7 @@ cgroup_bpf_get(p); for (i = 0; i < NR; i++) - INIT_LIST_HEAD(&cgrp->bpf.progs[i]); + INIT_HLIST_HEAD(&cgrp->bpf.progs[i]); INIT_LIST_HEAD(&cgrp->bpf.storages); @@ -418,7 +419,7 @@ #define BPF_CGROUP_MAX_PROGS 64 -static struct bpf_prog_list *find_attach_entry(struct list_head *progs, +static struct bpf_prog_list *find_attach_entry(struct hlist_head *progs, struct bpf_prog *prog, struct bpf_cgroup_link *link, struct bpf_prog *replace_prog, @@ -428,12 +429,12 @@ /* single-attach case */ if (!allow_multi) { - if (list_empty(progs)) + if (hlist_empty(progs)) return NULL; - return list_first_entry(progs, typeof(*pl), node); + return hlist_entry(progs->first, typeof(*pl), node); } - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (prog && pl->prog == prog && prog != replace_prog) /* disallow attaching the same prog twice */ return ERR_PTR(-EINVAL); @@ -444,7 +445,7 @@ /* direct prog multi-attach w/ replacement case */ if (replace_prog) { - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->prog == replace_prog) /* a match found */ return pl; @@ -480,7 +481,7 @@ struct bpf_cgroup_storage *new_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {}; enum cgroup_bpf_attach_type atype; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; int err; if (((flags & BPF_F_ALLOW_OVERRIDE) && (flags & BPF_F_ALLOW_MULTI)) || @@ -503,7 +504,7 @@ if (!hierarchy_allows_attach(cgrp, atype)) return -EPERM; - if (!list_empty(progs) && cgrp->bpf.flags[atype] != saved_flags) + if (!hlist_empty(progs) && cgrp->bpf.flags[atype] != saved_flags) /* Disallow attaching non-overridable on top * of existing overridable in this cgroup. * Disallow attaching multi-prog if overridable or none @@ -525,12 +526,22 @@ if (pl) { old_prog = pl->prog; } else { + struct hlist_node *last = NULL; + pl = kmalloc(sizeof(*pl), GFP_KERNEL); if (!pl) { bpf_cgroup_storages_free(new_storage); return -ENOMEM; } - list_add_tail(&pl->node, progs); + if (hlist_empty(progs)) + hlist_add_head(&pl->node, progs); + else + hlist_for_each(last, progs) { + if (last->next) + continue; + hlist_add_behind(&pl->node, last); + break; + } } pl->prog = prog; @@ -556,7 +567,7 @@ } bpf_cgroup_storages_free(new_storage); if (!old_prog) { - list_del(&pl->node); + hlist_del(&pl->node); kfree(pl); } return err; @@ -587,7 +598,7 @@ struct cgroup_subsys_state *css; struct bpf_prog_array *progs; struct bpf_prog_list *pl; - struct list_head *head; + struct hlist_head *head; struct cgroup *cg; int pos; @@ -603,7 +614,7 @@ continue; head = &cg->bpf.progs[atype]; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; if (pl->link == link) @@ -637,7 +648,7 @@ enum cgroup_bpf_attach_type atype; struct bpf_prog *old_prog; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; bool found = false; atype = to_cgroup_bpf_attach_type(link->type); @@ -649,7 +660,7 @@ if (link->link.prog->type != new_prog->type) return -EINVAL; - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->link == link) { found = true; break; @@ -688,7 +699,7 @@ return ret; } -static struct bpf_prog_list *find_detach_entry(struct list_head *progs, +static struct bpf_prog_list *find_detach_entry(struct hlist_head *progs, struct bpf_prog *prog, struct bpf_cgroup_link *link, bool allow_multi) @@ -696,14 +707,14 @@ struct bpf_prog_list *pl; if (!allow_multi) { - if (list_empty(progs)) + if (hlist_empty(progs)) /* report error when trying to detach and nothing is attached */ return ERR_PTR(-ENOENT); /* to maintain backward compatibility NONE and OVERRIDE cgroups * allow detaching with invalid FD (prog==NULL) in legacy mode */ - return list_first_entry(progs, typeof(*pl), node); + return hlist_entry(progs->first, typeof(*pl), node); } if (!prog && !link) @@ -713,7 +724,7 @@ return ERR_PTR(-EINVAL); /* find the prog or link and detach it */ - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->prog == prog && pl->link == link) return pl; } @@ -737,7 +748,7 @@ struct cgroup_subsys_state *css; struct bpf_prog_array *progs; struct bpf_prog_list *pl; - struct list_head *head; + struct hlist_head *head; struct cgroup *cg; int pos; @@ -754,7 +765,7 @@ continue; head = &cg->bpf.progs[atype]; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; if (pl->prog == prog && pl->link == link) @@ -762,8 +773,10 @@ pos++; } } + + /* no link or prog match, skip the cgroup of this layer */ + continue; found: - BUG_ON(!cg); progs = rcu_dereference_protected( desc->bpf.effective[atype], lockdep_is_held(&cgroup_mutex)); @@ -791,7 +804,7 @@ enum cgroup_bpf_attach_type atype; struct bpf_prog *old_prog; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; u32 flags; atype = to_cgroup_bpf_attach_type(type); @@ -822,9 +835,10 @@ } /* now can actually delete it from this cgroup list */ - list_del(&pl->node); + hlist_del(&pl->node); + kfree(pl); - if (list_empty(progs)) + if (hlist_empty(progs)) /* last program was detached, reset flags to zero */ cgrp->bpf.flags[atype] = 0; if (old_prog) @@ -852,7 +866,7 @@ enum bpf_attach_type type = attr->query.attach_type; enum cgroup_bpf_attach_type atype; struct bpf_prog_array *effective; - struct list_head *progs; + struct hlist_head *progs; struct bpf_prog *prog; int cnt, ret = 0, i; u32 flags; @@ -891,7 +905,7 @@ u32 id; i = 0; - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { prog = prog_list_prog(pl); id = prog->aux->id; if (copy_to_user(prog_ids + i, &id, sizeof(id))) diff -Nru linux-aws-5.19.0/kernel/bpf/core.c linux-aws-5.19.0/kernel/bpf/core.c --- linux-aws-5.19.0/kernel/bpf/core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/core.c 2022-11-29 07:06:46.000000000 +0000 @@ -822,6 +822,11 @@ unsigned long bitmap[]; }; +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size) +{ + memset(area, 0, size); +} + #define BPF_PROG_SIZE_TO_NBITS(size) (round_up(size, BPF_PROG_CHUNK_SIZE) / BPF_PROG_CHUNK_SIZE) static size_t bpf_prog_pack_size = -1; @@ -892,7 +897,7 @@ return pack; } -static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) { unsigned int nbits = BPF_PROG_SIZE_TO_NBITS(size); struct bpf_prog_pack *pack; @@ -936,7 +941,7 @@ return ptr; } -static void bpf_prog_pack_free(struct bpf_binary_header *hdr) +void bpf_prog_pack_free(struct bpf_binary_header *hdr) { struct bpf_prog_pack *pack = NULL, *tmp; unsigned int nbits; @@ -1005,7 +1010,7 @@ int bpf_jit_charge_modmem(u32 size) { - if (atomic_long_add_return(size, &bpf_jit_current) > bpf_jit_limit) { + if (atomic_long_add_return(size, &bpf_jit_current) > READ_ONCE(bpf_jit_limit)) { if (!bpf_capable()) { atomic_long_sub(size, &bpf_jit_current); return -EPERM; diff -Nru linux-aws-5.19.0/kernel/bpf/dispatcher.c linux-aws-5.19.0/kernel/bpf/dispatcher.c --- linux-aws-5.19.0/kernel/bpf/dispatcher.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/dispatcher.c 2022-11-29 07:06:46.000000000 +0000 @@ -85,12 +85,12 @@ return false; } -int __weak arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int __weak arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { return -ENOTSUPP; } -static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image) +static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image, void *buf) { s64 ips[BPF_DISPATCHER_MAX] = {}, *ipsp = &ips[0]; int i; @@ -99,12 +99,12 @@ if (d->progs[i].prog) *ipsp++ = (s64)(uintptr_t)d->progs[i].prog->bpf_func; } - return arch_prepare_bpf_dispatcher(image, &ips[0], d->num_progs); + return arch_prepare_bpf_dispatcher(image, buf, &ips[0], d->num_progs); } static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) { - void *old, *new; + void *old, *new, *tmp; u32 noff; int err; @@ -117,8 +117,14 @@ } new = d->num_progs ? d->image + noff : NULL; + tmp = d->num_progs ? d->rw_image + noff : NULL; if (new) { - if (bpf_dispatcher_prepare(d, new)) + /* Prepare the dispatcher in d->rw_image. Then use + * bpf_arch_text_copy to update d->image, which is RO+X. + */ + if (bpf_dispatcher_prepare(d, new, tmp)) + return; + if (IS_ERR(bpf_arch_text_copy(new, tmp, PAGE_SIZE / 2))) return; } @@ -140,9 +146,18 @@ mutex_lock(&d->mutex); if (!d->image) { - d->image = bpf_jit_alloc_exec_page(); + d->image = bpf_prog_pack_alloc(PAGE_SIZE, bpf_jit_fill_hole_with_zero); if (!d->image) goto out; + d->rw_image = bpf_jit_alloc_exec(PAGE_SIZE); + if (!d->rw_image) { + u32 size = PAGE_SIZE; + + bpf_arch_text_copy(d->image, &size, sizeof(size)); + bpf_prog_pack_free((struct bpf_binary_header *)d->image); + d->image = NULL; + goto out; + } bpf_image_ksym_add(d->image, &d->ksym); } diff -Nru linux-aws-5.19.0/kernel/bpf/hashtab.c linux-aws-5.19.0/kernel/bpf/hashtab.c --- linux-aws-5.19.0/kernel/bpf/hashtab.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/hashtab.c 2022-11-29 07:06:46.000000000 +0000 @@ -162,17 +162,25 @@ unsigned long *pflags) { unsigned long flags; + bool use_raw_lock; hash = hash & HASHTAB_MAP_LOCK_MASK; - migrate_disable(); + use_raw_lock = htab_use_raw_lock(htab); + if (use_raw_lock) + preempt_disable(); + else + migrate_disable(); if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) { __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); return -EBUSY; } - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_lock_irqsave(&b->raw_lock, flags); else spin_lock_irqsave(&b->lock, flags); @@ -185,13 +193,18 @@ struct bucket *b, u32 hash, unsigned long flags) { + bool use_raw_lock = htab_use_raw_lock(htab); + hash = hash & HASHTAB_MAP_LOCK_MASK; - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_unlock_irqrestore(&b->raw_lock, flags); else spin_unlock_irqrestore(&b->lock, flags); __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); } static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node); @@ -1691,8 +1704,11 @@ /* do not grab the lock unless need it (bucket_cnt > 0). */ if (locked) { ret = htab_lock_bucket(htab, b, batch, &flags); - if (ret) - goto next_batch; + if (ret) { + rcu_read_unlock(); + bpf_enable_instrumentation(); + goto after_loop; + } } bucket_cnt = 0; diff -Nru linux-aws-5.19.0/kernel/bpf/helpers.c linux-aws-5.19.0/kernel/bpf/helpers.c --- linux-aws-5.19.0/kernel/bpf/helpers.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/helpers.c 2022-11-29 07:06:46.000000000 +0000 @@ -584,7 +584,7 @@ return strncmp(s1, s2, s1_sz); } -const struct bpf_func_proto bpf_strncmp_proto = { +static const struct bpf_func_proto bpf_strncmp_proto = { .func = bpf_strncmp, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1402,7 +1402,7 @@ */ #define BPF_PTR_POISON ((void *)((0xeB9FUL << 2) + POISON_POINTER_DELTA)) -const struct bpf_func_proto bpf_kptr_xchg_proto = { +static const struct bpf_func_proto bpf_kptr_xchg_proto = { .func = bpf_kptr_xchg, .gpl_only = false, .ret_type = RET_PTR_TO_BTF_ID_OR_NULL, @@ -1468,6 +1468,8 @@ { int err; + BTF_TYPE_EMIT(struct bpf_dynptr); + err = bpf_dynptr_check_size(size); if (err) goto error; @@ -1487,7 +1489,7 @@ return err; } -const struct bpf_func_proto bpf_dynptr_from_mem_proto = { +static const struct bpf_func_proto bpf_dynptr_from_mem_proto = { .func = bpf_dynptr_from_mem, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1514,7 +1516,7 @@ return 0; } -const struct bpf_func_proto bpf_dynptr_read_proto = { +static const struct bpf_func_proto bpf_dynptr_read_proto = { .func = bpf_dynptr_read, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1542,7 +1544,7 @@ return 0; } -const struct bpf_func_proto bpf_dynptr_write_proto = { +static const struct bpf_func_proto bpf_dynptr_write_proto = { .func = bpf_dynptr_write, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1570,7 +1572,7 @@ return (unsigned long)(ptr->data + ptr->offset + offset); } -const struct bpf_func_proto bpf_dynptr_data_proto = { +static const struct bpf_func_proto bpf_dynptr_data_proto = { .func = bpf_dynptr_data, .gpl_only = false, .ret_type = RET_PTR_TO_DYNPTR_MEM_OR_NULL, @@ -1627,26 +1629,12 @@ return &bpf_ringbuf_discard_proto; case BPF_FUNC_ringbuf_query: return &bpf_ringbuf_query_proto; - case BPF_FUNC_ringbuf_reserve_dynptr: - return &bpf_ringbuf_reserve_dynptr_proto; - case BPF_FUNC_ringbuf_submit_dynptr: - return &bpf_ringbuf_submit_dynptr_proto; - case BPF_FUNC_ringbuf_discard_dynptr: - return &bpf_ringbuf_discard_dynptr_proto; case BPF_FUNC_for_each_map_elem: return &bpf_for_each_map_elem_proto; case BPF_FUNC_loop: return &bpf_loop_proto; case BPF_FUNC_strncmp: return &bpf_strncmp_proto; - case BPF_FUNC_dynptr_from_mem: - return &bpf_dynptr_from_mem_proto; - case BPF_FUNC_dynptr_read: - return &bpf_dynptr_read_proto; - case BPF_FUNC_dynptr_write: - return &bpf_dynptr_write_proto; - case BPF_FUNC_dynptr_data: - return &bpf_dynptr_data_proto; default: break; } @@ -1675,6 +1663,20 @@ return &bpf_timer_cancel_proto; case BPF_FUNC_kptr_xchg: return &bpf_kptr_xchg_proto; + case BPF_FUNC_ringbuf_reserve_dynptr: + return &bpf_ringbuf_reserve_dynptr_proto; + case BPF_FUNC_ringbuf_submit_dynptr: + return &bpf_ringbuf_submit_dynptr_proto; + case BPF_FUNC_ringbuf_discard_dynptr: + return &bpf_ringbuf_discard_dynptr_proto; + case BPF_FUNC_dynptr_from_mem: + return &bpf_dynptr_from_mem_proto; + case BPF_FUNC_dynptr_read: + return &bpf_dynptr_read_proto; + case BPF_FUNC_dynptr_write: + return &bpf_dynptr_write_proto; + case BPF_FUNC_dynptr_data: + return &bpf_dynptr_data_proto; default: break; } diff -Nru linux-aws-5.19.0/kernel/bpf/syscall.c linux-aws-5.19.0/kernel/bpf/syscall.c --- linux-aws-5.19.0/kernel/bpf/syscall.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/syscall.c 2022-11-29 07:06:46.000000000 +0000 @@ -578,7 +578,7 @@ if (off_desc->type == BPF_KPTR_UNREF) { u64 *p = (u64 *)btf_id_ptr; - WRITE_ONCE(p, 0); + WRITE_ONCE(*p, 0); continue; } old_ptr = xchg(btf_id_ptr, 0); @@ -4361,7 +4361,9 @@ if (attr->task_fd_query.flags != 0) return -EINVAL; + rcu_read_lock(); task = get_pid_task(find_vpid(pid), PIDTYPE_PID); + rcu_read_unlock(); if (!task) return -ENOENT; @@ -5138,7 +5140,7 @@ return *res ? 0 : -ENOENT; } -const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = { +static const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = { .func = bpf_kallsyms_lookup_name, .gpl_only = false, .ret_type = RET_INTEGER, @@ -5153,7 +5155,7 @@ { switch (func_id) { case BPF_FUNC_sys_bpf: - return &bpf_sys_bpf_proto; + return !perfmon_capable() ? NULL : &bpf_sys_bpf_proto; case BPF_FUNC_btf_find_by_name_kind: return &bpf_btf_find_by_name_kind_proto; case BPF_FUNC_sys_close: diff -Nru linux-aws-5.19.0/kernel/bpf/trampoline.c linux-aws-5.19.0/kernel/bpf/trampoline.c --- linux-aws-5.19.0/kernel/bpf/trampoline.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/trampoline.c 2022-11-29 07:06:46.000000000 +0000 @@ -585,7 +585,7 @@ run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -620,7 +620,7 @@ bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock(); } @@ -631,7 +631,7 @@ migrate_disable(); might_fault(); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -647,7 +647,7 @@ bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock_trace(); } diff -Nru linux-aws-5.19.0/kernel/bpf/verifier.c linux-aws-5.19.0/kernel/bpf/verifier.c --- linux-aws-5.19.0/kernel/bpf/verifier.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/bpf/verifier.c 2022-11-29 07:06:46.000000000 +0000 @@ -467,25 +467,11 @@ return type & MEM_RDONLY; } -static bool arg_type_may_be_refcounted(enum bpf_arg_type type) -{ - return type == ARG_PTR_TO_SOCK_COMMON; -} - static bool type_may_be_null(u32 type) { return type & PTR_MAYBE_NULL; } -static bool may_be_acquire_function(enum bpf_func_id func_id) -{ - return func_id == BPF_FUNC_sk_lookup_tcp || - func_id == BPF_FUNC_sk_lookup_udp || - func_id == BPF_FUNC_skc_lookup_tcp || - func_id == BPF_FUNC_map_lookup_elem || - func_id == BPF_FUNC_ringbuf_reserve; -} - static bool is_acquire_function(enum bpf_func_id func_id, const struct bpf_map *map) { @@ -518,6 +504,26 @@ func_id == BPF_FUNC_skc_to_tcp_request_sock; } +static bool is_dynptr_acquire_function(enum bpf_func_id func_id) +{ + return func_id == BPF_FUNC_dynptr_data; +} + +static bool helper_multiple_ref_obj_use(enum bpf_func_id func_id, + const struct bpf_map *map) +{ + int ref_obj_uses = 0; + + if (is_ptr_cast_function(func_id)) + ref_obj_uses++; + if (is_acquire_function(func_id, map)) + ref_obj_uses++; + if (is_dynptr_acquire_function(func_id)) + ref_obj_uses++; + + return ref_obj_uses > 1; +} + static bool is_cmpxchg_insn(const struct bpf_insn *insn) { return BPF_CLASS(insn->code) == BPF_STX && @@ -1086,6 +1092,7 @@ id = ++env->id_gen; state->refs[new_ofs].id = id; state->refs[new_ofs].insn_idx = insn_idx; + state->refs[new_ofs].callback_ref = state->in_callback_fn ? state->frameno : 0; return id; } @@ -1098,6 +1105,9 @@ last_idx = state->acquired_refs - 1; for (i = 0; i < state->acquired_refs; i++) { if (state->refs[i].id == ptr_id) { + /* Cannot release caller references in callbacks */ + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + return -EINVAL; if (last_idx && i != last_idx) memcpy(&state->refs[i], &state->refs[last_idx], sizeof(*state->refs)); @@ -5533,17 +5543,6 @@ type == ARG_CONST_SIZE_OR_ZERO; } -static bool arg_type_is_alloc_size(enum bpf_arg_type type) -{ - return type == ARG_CONST_ALLOC_SIZE_OR_ZERO; -} - -static bool arg_type_is_int_ptr(enum bpf_arg_type type) -{ - return type == ARG_PTR_TO_INT || - type == ARG_PTR_TO_LONG; -} - static bool arg_type_is_release(enum bpf_arg_type type) { return type & OBJ_RELEASE; @@ -5847,6 +5846,7 @@ struct bpf_reg_state *regs = cur_regs(env), *reg = ®s[regno]; enum bpf_arg_type arg_type = fn->arg_type[arg]; enum bpf_reg_type type = reg->type; + u32 *arg_btf_id = NULL; int err = 0; if (arg_type == ARG_DONTCARE) @@ -5891,7 +5891,11 @@ } } - err = check_reg_type(env, regno, arg_type, fn->arg_btf_id[arg], meta); + /* arg_btf_id and arg_size are in a union. */ + if (base_type(arg_type) == ARG_PTR_TO_BTF_ID) + arg_btf_id = fn->arg_btf_id[arg]; + + err = check_reg_type(env, regno, arg_type, arg_btf_id, meta); if (err) return err; @@ -5932,7 +5936,8 @@ meta->ref_obj_id = reg->ref_obj_id; } - if (arg_type == ARG_CONST_MAP_PTR) { + switch (base_type(arg_type)) { + case ARG_CONST_MAP_PTR: /* bpf_map_xxx(map_ptr) call: remember that map_ptr */ if (meta->map_ptr) { /* Use map_uid (which is unique id of inner map) to reject: @@ -5957,7 +5962,8 @@ } meta->map_ptr = reg->map_ptr; meta->map_uid = reg->map_uid; - } else if (arg_type == ARG_PTR_TO_MAP_KEY) { + break; + case ARG_PTR_TO_MAP_KEY: /* bpf_map_xxx(..., map_ptr, ..., key) call: * check that [key, key + map->key_size) are within * stack limits and initialized @@ -5974,7 +5980,8 @@ err = check_helper_mem_access(env, regno, meta->map_ptr->key_size, false, NULL); - } else if (base_type(arg_type) == ARG_PTR_TO_MAP_VALUE) { + break; + case ARG_PTR_TO_MAP_VALUE: if (type_may_be_null(arg_type) && register_is_null(reg)) return 0; @@ -5990,14 +5997,16 @@ err = check_helper_mem_access(env, regno, meta->map_ptr->value_size, false, meta); - } else if (arg_type == ARG_PTR_TO_PERCPU_BTF_ID) { + break; + case ARG_PTR_TO_PERCPU_BTF_ID: if (!reg->btf_id) { verbose(env, "Helper has invalid btf_id in R%d\n", regno); return -EACCES; } meta->ret_btf = reg->btf; meta->ret_btf_id = reg->btf_id; - } else if (arg_type == ARG_PTR_TO_SPIN_LOCK) { + break; + case ARG_PTR_TO_SPIN_LOCK: if (meta->func_id == BPF_FUNC_spin_lock) { if (process_spin_lock(env, regno, true)) return -EACCES; @@ -6008,21 +6017,32 @@ verbose(env, "verifier internal error\n"); return -EFAULT; } - } else if (arg_type == ARG_PTR_TO_TIMER) { + break; + case ARG_PTR_TO_TIMER: if (process_timer_func(env, regno, meta)) return -EACCES; - } else if (arg_type == ARG_PTR_TO_FUNC) { + break; + case ARG_PTR_TO_FUNC: meta->subprogno = reg->subprogno; - } else if (base_type(arg_type) == ARG_PTR_TO_MEM) { + break; + case ARG_PTR_TO_MEM: /* The access to this pointer is only checked when we hit the * next is_mem_size argument below. */ meta->raw_mode = arg_type & MEM_UNINIT; - } else if (arg_type_is_mem_size(arg_type)) { - bool zero_size_allowed = (arg_type == ARG_CONST_SIZE_OR_ZERO); - - err = check_mem_size_reg(env, reg, regno, zero_size_allowed, meta); - } else if (arg_type_is_dynptr(arg_type)) { + if (arg_type & MEM_FIXED_SIZE) { + err = check_helper_mem_access(env, regno, + fn->arg_size[arg], false, + meta); + } + break; + case ARG_CONST_SIZE: + err = check_mem_size_reg(env, reg, regno, false, meta); + break; + case ARG_CONST_SIZE_OR_ZERO: + err = check_mem_size_reg(env, reg, regno, true, meta); + break; + case ARG_PTR_TO_DYNPTR: if (arg_type & MEM_UNINIT) { if (!is_dynptr_reg_valid_uninit(env, reg)) { verbose(env, "Dynptr has to be an uninitialized dynptr\n"); @@ -6056,21 +6076,31 @@ err_extra, arg + 1); return -EINVAL; } - } else if (arg_type_is_alloc_size(arg_type)) { + break; + case ARG_CONST_ALLOC_SIZE_OR_ZERO: if (!tnum_is_const(reg->var_off)) { verbose(env, "R%d is not a known constant'\n", regno); return -EACCES; } meta->mem_size = reg->var_off.value; - } else if (arg_type_is_int_ptr(arg_type)) { + err = mark_chain_precision(env, regno); + if (err) + return err; + break; + case ARG_PTR_TO_INT: + case ARG_PTR_TO_LONG: + { int size = int_ptr_type_to_size(arg_type); err = check_helper_mem_access(env, regno, size, false, meta); if (err) return err; err = check_ptr_alignment(env, reg, 0, size, true); - } else if (arg_type == ARG_PTR_TO_CONST_STR) { + break; + } + case ARG_PTR_TO_CONST_STR: + { struct bpf_map *map = reg->map_ptr; int map_off; u64 map_addr; @@ -6109,9 +6139,12 @@ verbose(env, "string is not zero-terminated\n"); return -EINVAL; } - } else if (arg_type == ARG_PTR_TO_KPTR) { + break; + } + case ARG_PTR_TO_KPTR: if (process_kptr_func(env, regno, meta)) return -EACCES; + break; } return err; @@ -6408,11 +6441,19 @@ return count <= 1; } -static bool check_args_pair_invalid(enum bpf_arg_type arg_curr, - enum bpf_arg_type arg_next) +static bool check_args_pair_invalid(const struct bpf_func_proto *fn, int arg) { - return (base_type(arg_curr) == ARG_PTR_TO_MEM) != - arg_type_is_mem_size(arg_next); + bool is_fixed = fn->arg_type[arg] & MEM_FIXED_SIZE; + bool has_size = fn->arg_size[arg] != 0; + bool is_next_size = false; + + if (arg + 1 < ARRAY_SIZE(fn->arg_type)) + is_next_size = arg_type_is_mem_size(fn->arg_type[arg + 1]); + + if (base_type(fn->arg_type[arg]) != ARG_PTR_TO_MEM) + return is_next_size; + + return has_size == is_next_size || is_next_size == is_fixed; } static bool check_arg_pair_ok(const struct bpf_func_proto *fn) @@ -6423,43 +6464,16 @@ * helper function specification. */ if (arg_type_is_mem_size(fn->arg1_type) || - base_type(fn->arg5_type) == ARG_PTR_TO_MEM || - check_args_pair_invalid(fn->arg1_type, fn->arg2_type) || - check_args_pair_invalid(fn->arg2_type, fn->arg3_type) || - check_args_pair_invalid(fn->arg3_type, fn->arg4_type) || - check_args_pair_invalid(fn->arg4_type, fn->arg5_type)) + check_args_pair_invalid(fn, 0) || + check_args_pair_invalid(fn, 1) || + check_args_pair_invalid(fn, 2) || + check_args_pair_invalid(fn, 3) || + check_args_pair_invalid(fn, 4)) return false; return true; } -static bool check_refcount_ok(const struct bpf_func_proto *fn, int func_id) -{ - int count = 0; - - if (arg_type_may_be_refcounted(fn->arg1_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg2_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg3_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg4_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg5_type)) - count++; - - /* A reference acquiring function cannot acquire - * another refcounted ptr. - */ - if (may_be_acquire_function(func_id) && count) - return false; - - /* We only support one arg being unreferenced at the moment, - * which is sufficient for the helper functions we have right now. - */ - return count <= 1; -} - static bool check_btf_id_ok(const struct bpf_func_proto *fn) { int i; @@ -6468,7 +6482,10 @@ if (base_type(fn->arg_type[i]) == ARG_PTR_TO_BTF_ID && !fn->arg_btf_id[i]) return false; - if (base_type(fn->arg_type[i]) != ARG_PTR_TO_BTF_ID && fn->arg_btf_id[i]) + if (base_type(fn->arg_type[i]) != ARG_PTR_TO_BTF_ID && fn->arg_btf_id[i] && + /* arg_btf_id and arg_size are in a union. */ + (base_type(fn->arg_type[i]) != ARG_PTR_TO_MEM || + !(fn->arg_type[i] & MEM_FIXED_SIZE))) return false; } @@ -6480,8 +6497,7 @@ { return check_raw_mode_ok(fn) && check_arg_pair_ok(fn) && - check_btf_id_ok(fn) && - check_refcount_ok(fn, func_id) ? 0 : -EINVAL; + check_btf_id_ok(fn) ? 0 : -EINVAL; } /* Packet data might have moved, any old PTR_TO_PACKET[_META,_END] @@ -6915,10 +6931,17 @@ caller->regs[BPF_REG_0] = *r0; } - /* Transfer references to the caller */ - err = copy_reference_state(caller, callee); - if (err) - return err; + /* callback_fn frame should have released its own additions to parent's + * reference state at this point, or check_reference_leak would + * complain, hence it must be the same as the caller. There is no need + * to copy it back. + */ + if (!callee->in_callback_fn) { + /* Transfer references to the caller */ + err = copy_reference_state(caller, callee); + if (err) + return err; + } *insn_idx = callee->callsite + 1; if (env->log.level & BPF_LOG_LEVEL) { @@ -7040,13 +7063,20 @@ static int check_reference_leak(struct bpf_verifier_env *env) { struct bpf_func_state *state = cur_func(env); + bool refs_lingering = false; int i; + if (state->frameno && !state->in_callback_fn) + return 0; + for (i = 0; i < state->acquired_refs; i++) { + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + continue; verbose(env, "Unreleased reference id=%d alloc_insn=%d\n", state->refs[i].id, state->refs[i].insn_idx); + refs_lingering = true; } - return state->acquired_refs ? -EINVAL : 0; + return refs_lingering ? -EINVAL : 0; } static int check_bpf_snprintf_call(struct bpf_verifier_env *env, @@ -7384,6 +7414,12 @@ if (type_may_be_null(regs[BPF_REG_0].type)) regs[BPF_REG_0].id = ++env->id_gen; + if (helper_multiple_ref_obj_use(func_id, meta.map_ptr)) { + verbose(env, "verifier internal error: func %s#%d sets ref_obj_id more than once\n", + func_id_name(func_id), func_id); + return -EFAULT; + } + if (is_ptr_cast_function(func_id)) { /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = meta.ref_obj_id; @@ -7396,10 +7432,10 @@ regs[BPF_REG_0].id = id; /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = id; - } else if (func_id == BPF_FUNC_dynptr_data) { + } else if (is_dynptr_acquire_function(func_id)) { int dynptr_id = 0, i; - /* Find the id of the dynptr we're acquiring a reference to */ + /* Find the id of the dynptr we're tracking the reference of */ for (i = 0; i < MAX_BPF_FUNC_REG_ARGS; i++) { if (arg_type_is_dynptr(fn->arg_type[i])) { if (dynptr_id) { @@ -12234,6 +12270,16 @@ return -EINVAL; } + /* We must do check_reference_leak here before + * prepare_func_exit to handle the case when + * state->curframe > 0, it may be a callback + * function, for which reference_state must + * match caller reference state when it exits. + */ + err = check_reference_leak(env); + if (err) + return err; + if (state->curframe) { /* exit from nested function */ err = prepare_func_exit(env, &env->insn_idx); @@ -12243,10 +12289,6 @@ continue; } - err = check_reference_leak(env); - if (err) - return err; - err = check_return_code(env); if (err) return err; diff -Nru linux-aws-5.19.0/kernel/cgroup/cgroup.c linux-aws-5.19.0/kernel/cgroup/cgroup.c --- linux-aws-5.19.0/kernel/cgroup/cgroup.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/cgroup/cgroup.c 2022-11-29 07:06:46.000000000 +0000 @@ -2347,6 +2347,47 @@ EXPORT_SYMBOL_GPL(task_cgroup_path); /** + * cgroup_attach_lock - Lock for ->attach() + * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem + * + * cgroup migration sometimes needs to stabilize threadgroups against forks and + * exits by write-locking cgroup_threadgroup_rwsem. However, some ->attach() + * implementations (e.g. cpuset), also need to disable CPU hotplug. + * Unfortunately, letting ->attach() operations acquire cpus_read_lock() can + * lead to deadlocks. + * + * Bringing up a CPU may involve creating and destroying tasks which requires + * read-locking threadgroup_rwsem, so threadgroup_rwsem nests inside + * cpus_read_lock(). If we call an ->attach() which acquires the cpus lock while + * write-locking threadgroup_rwsem, the locking order is reversed and we end up + * waiting for an on-going CPU hotplug operation which in turn is waiting for + * the threadgroup_rwsem to be released to create new tasks. For more details: + * + * http://lkml.kernel.org/r/20220711174629.uehfmqegcwn2lqzu@wubuntu + * + * Resolve the situation by always acquiring cpus_read_lock() before optionally + * write-locking cgroup_threadgroup_rwsem. This allows ->attach() to assume that + * CPU hotplug is disabled on entry. + */ +static void cgroup_attach_lock(bool lock_threadgroup) +{ + cpus_read_lock(); + if (lock_threadgroup) + percpu_down_write(&cgroup_threadgroup_rwsem); +} + +/** + * cgroup_attach_unlock - Undo cgroup_attach_lock() + * @lock_threadgroup: whether to up_write cgroup_threadgroup_rwsem + */ +static void cgroup_attach_unlock(bool lock_threadgroup) +{ + if (lock_threadgroup) + percpu_up_write(&cgroup_threadgroup_rwsem); + cpus_read_unlock(); +} + +/** * cgroup_migrate_add_task - add a migration target task to a migration context * @task: target task * @mgctx: target migration context @@ -2822,8 +2863,7 @@ } struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, - bool *locked) - __acquires(&cgroup_threadgroup_rwsem) + bool *threadgroup_locked) { struct task_struct *tsk; pid_t pid; @@ -2840,12 +2880,8 @@ * Therefore, we can skip the global lock. */ lockdep_assert_held(&cgroup_mutex); - if (pid || threadgroup) { - percpu_down_write(&cgroup_threadgroup_rwsem); - *locked = true; - } else { - *locked = false; - } + *threadgroup_locked = pid || threadgroup; + cgroup_attach_lock(*threadgroup_locked); rcu_read_lock(); if (pid) { @@ -2876,17 +2912,14 @@ goto out_unlock_rcu; out_unlock_threadgroup: - if (*locked) { - percpu_up_write(&cgroup_threadgroup_rwsem); - *locked = false; - } + cgroup_attach_unlock(*threadgroup_locked); + *threadgroup_locked = false; out_unlock_rcu: rcu_read_unlock(); return tsk; } -void cgroup_procs_write_finish(struct task_struct *task, bool locked) - __releases(&cgroup_threadgroup_rwsem) +void cgroup_procs_write_finish(struct task_struct *task, bool threadgroup_locked) { struct cgroup_subsys *ss; int ssid; @@ -2894,8 +2927,8 @@ /* release reference from cgroup_procs_write_start() */ put_task_struct(task); - if (locked) - percpu_up_write(&cgroup_threadgroup_rwsem); + cgroup_attach_unlock(threadgroup_locked); + for_each_subsys(ss, ssid) if (ss->post_attach) ss->post_attach(); @@ -2950,12 +2983,11 @@ struct cgroup_subsys_state *d_css; struct cgroup *dsct; struct css_set *src_cset; + bool has_tasks; int ret; lockdep_assert_held(&cgroup_mutex); - percpu_down_write(&cgroup_threadgroup_rwsem); - /* look up all csses currently attached to @cgrp's subtree */ spin_lock_irq(&css_set_lock); cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) { @@ -2966,6 +2998,15 @@ } spin_unlock_irq(&css_set_lock); + /* + * We need to write-lock threadgroup_rwsem while migrating tasks. + * However, if there are no source csets for @cgrp, changing its + * controllers isn't gonna produce any task migrations and the + * write-locking can be skipped safely. + */ + has_tasks = !list_empty(&mgctx.preloaded_src_csets); + cgroup_attach_lock(has_tasks); + /* NULL dst indicates self on default hierarchy */ ret = cgroup_migrate_prepare_dst(&mgctx); if (ret) @@ -2985,7 +3026,7 @@ ret = cgroup_migrate_execute(&mgctx); out_finish: cgroup_migrate_finish(&mgctx); - percpu_up_write(&cgroup_threadgroup_rwsem); + cgroup_attach_unlock(has_tasks); return ret; } @@ -4933,13 +4974,13 @@ struct task_struct *task; const struct cred *saved_cred; ssize_t ret; - bool locked; + bool threadgroup_locked; dst_cgrp = cgroup_kn_lock_live(of->kn, false); if (!dst_cgrp) return -ENODEV; - task = cgroup_procs_write_start(buf, threadgroup, &locked); + task = cgroup_procs_write_start(buf, threadgroup, &threadgroup_locked); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock; @@ -4965,7 +5006,7 @@ ret = cgroup_attach_task(dst_cgrp, task, threadgroup); out_finish: - cgroup_procs_write_finish(task, locked); + cgroup_procs_write_finish(task, threadgroup_locked); out_unlock: cgroup_kn_unlock(of->kn); @@ -5985,6 +6026,9 @@ if (!kn) goto out; + if (kernfs_type(kn) != KERNFS_DIR) + goto put; + rcu_read_lock(); cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); @@ -5992,7 +6036,7 @@ cgrp = NULL; rcu_read_unlock(); - +put: kernfs_put(kn); out: return cgrp; @@ -6571,8 +6615,12 @@ { struct kernfs_node *kn; struct cgroup *cgrp = ERR_PTR(-ENOENT); + struct cgroup *root_cgrp; - kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path); + spin_lock_irq(&css_set_lock); + root_cgrp = current_cgns_cgroup_from_root(&cgrp_dfl_root); + kn = kernfs_walk_and_get(root_cgrp->kn, path); + spin_unlock_irq(&css_set_lock); if (!kn) goto out; diff -Nru linux-aws-5.19.0/kernel/cgroup/cgroup-v1.c linux-aws-5.19.0/kernel/cgroup/cgroup-v1.c --- linux-aws-5.19.0/kernel/cgroup/cgroup-v1.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/cgroup/cgroup-v1.c 2022-11-29 07:06:46.000000000 +0000 @@ -59,6 +59,7 @@ int retval = 0; mutex_lock(&cgroup_mutex); + cpus_read_lock(); percpu_down_write(&cgroup_threadgroup_rwsem); for_each_root(root) { struct cgroup *from_cgrp; @@ -72,6 +73,7 @@ break; } percpu_up_write(&cgroup_threadgroup_rwsem); + cpus_read_unlock(); mutex_unlock(&cgroup_mutex); return retval; diff -Nru linux-aws-5.19.0/kernel/cgroup/cpuset.c linux-aws-5.19.0/kernel/cgroup/cpuset.c --- linux-aws-5.19.0/kernel/cgroup/cpuset.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/cgroup/cpuset.c 2022-11-29 07:06:46.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1127,10 +1128,18 @@ { struct css_task_iter it; struct task_struct *task; + bool top_cs = cs == &top_cpuset; css_task_iter_start(&cs->css, 0, &it); - while ((task = css_task_iter_next(&it))) + while ((task = css_task_iter_next(&it))) { + /* + * Percpu kthreads in top_cpuset are ignored + */ + if (top_cs && (task->flags & PF_KTHREAD) && + kthread_is_per_cpu(task)) + continue; set_cpus_allowed_ptr(task, cs->effective_cpus); + } css_task_iter_end(&it); } @@ -2092,12 +2101,7 @@ update_flag(CS_CPU_EXCLUSIVE, cs, 0); } - /* - * Update cpumask of parent's tasks except when it is the top - * cpuset as some system daemons cannot be mapped to other CPUs. - */ - if (parent != &top_cpuset) - update_tasks_cpumask(parent); + update_tasks_cpumask(parent); if (parent->child_ecpus_count) update_sibling_cpumasks(parent, cs, &tmpmask); @@ -2289,7 +2293,7 @@ cgroup_taskset_first(tset, &css); cs = css_cs(css); - cpus_read_lock(); + lockdep_assert_cpus_held(); /* see cgroup_attach_lock() */ percpu_down_write(&cpuset_rwsem); guarantee_online_mems(cs, &cpuset_attach_nodemask_to); @@ -2343,7 +2347,6 @@ wake_up(&cpuset_attach_wq); percpu_up_write(&cpuset_rwsem); - cpus_read_unlock(); } /* The various types of files and directories in a cpuset file system */ diff -Nru linux-aws-5.19.0/kernel/dma/swiotlb.c linux-aws-5.19.0/kernel/dma/swiotlb.c --- linux-aws-5.19.0/kernel/dma/swiotlb.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/dma/swiotlb.c 2022-11-29 07:06:46.000000000 +0000 @@ -464,7 +464,10 @@ } } -#define slot_addr(start, idx) ((start) + ((idx) << IO_TLB_SHIFT)) +static inline phys_addr_t slot_addr(phys_addr_t start, phys_addr_t idx) +{ + return start + (idx << IO_TLB_SHIFT); +} /* * Carefully handle integer overflow which can occur when boundary_mask == ~0UL. diff -Nru linux-aws-5.19.0/kernel/kprobes.c linux-aws-5.19.0/kernel/kprobes.c --- linux-aws-5.19.0/kernel/kprobes.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/kprobes.c 2022-11-29 07:06:46.000000000 +0000 @@ -1562,6 +1562,7 @@ /* Ensure it is not in reserved area nor out of text */ if (!(core_kernel_text((unsigned long) p->addr) || is_module_text_address((unsigned long) p->addr)) || + in_gate_area_no_mm((unsigned long) p->addr) || within_kprobe_blacklist((unsigned long) p->addr) || jump_label_text_reserved(p->addr, p->addr) || static_call_text_reserved(p->addr, p->addr) || diff -Nru linux-aws-5.19.0/kernel/livepatch/transition.c linux-aws-5.19.0/kernel/livepatch/transition.c --- linux-aws-5.19.0/kernel/livepatch/transition.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/livepatch/transition.c 2022-11-29 07:06:46.000000000 +0000 @@ -610,9 +610,23 @@ /* Called from copy_process() during fork */ void klp_copy_process(struct task_struct *child) { - child->patch_state = current->patch_state; - /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ + /* + * The parent process may have gone through a KLP transition since + * the thread flag was copied in setup_thread_stack earlier. Bring + * the task flag up to date with the parent here. + * + * The operation is serialized against all klp_*_transition() + * operations by the tasklist_lock. The only exception is + * klp_update_patch_state(current), but we cannot race with + * that because we are current. + */ + if (test_tsk_thread_flag(current, TIF_PATCH_PENDING)) + set_tsk_thread_flag(child, TIF_PATCH_PENDING); + else + clear_tsk_thread_flag(child, TIF_PATCH_PENDING); + + child->patch_state = current->patch_state; } /* diff -Nru linux-aws-5.19.0/kernel/module/tracking.c linux-aws-5.19.0/kernel/module/tracking.c --- linux-aws-5.19.0/kernel/module/tracking.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/module/tracking.c 2022-11-29 07:06:46.000000000 +0000 @@ -21,6 +21,9 @@ module_assert_mutex_or_preempt(); + if (!mod->taints) + goto out; + list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list, lockdep_is_held(&module_mutex)) { if (!strcmp(mod_taint->name, mod->name) && diff -Nru linux-aws-5.19.0/kernel/rcu/tree.c linux-aws-5.19.0/kernel/rcu/tree.c --- linux-aws-5.19.0/kernel/rcu/tree.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/rcu/tree.c 2022-11-29 07:06:46.000000000 +0000 @@ -3508,15 +3508,16 @@ bnode = (struct kvfree_rcu_bulk_data *) __get_free_page(GFP_KERNEL | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); - if (bnode) { - raw_spin_lock_irqsave(&krcp->lock, flags); - pushed = put_cached_bnode(krcp, bnode); - raw_spin_unlock_irqrestore(&krcp->lock, flags); + if (!bnode) + break; - if (!pushed) { - free_page((unsigned long) bnode); - break; - } + raw_spin_lock_irqsave(&krcp->lock, flags); + pushed = put_cached_bnode(krcp, bnode); + raw_spin_unlock_irqrestore(&krcp->lock, flags); + + if (!pushed) { + free_page((unsigned long) bnode); + break; } } diff -Nru linux-aws-5.19.0/kernel/rcu/tree_plugin.h linux-aws-5.19.0/kernel/rcu/tree_plugin.h --- linux-aws-5.19.0/kernel/rcu/tree_plugin.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/rcu/tree_plugin.h 2022-11-29 07:06:46.000000000 +0000 @@ -641,7 +641,8 @@ expboost = (t->rcu_blocked_node && READ_ONCE(t->rcu_blocked_node->exp_tasks)) || (rdp->grpmask & READ_ONCE(rnp->expmask)) || - IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) || + (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) && + ((rdp->grpmask & READ_ONCE(rnp->qsmask)) || t->rcu_blocked_node)) || (IS_ENABLED(CONFIG_RCU_BOOST) && irqs_were_disabled && t->rcu_blocked_node); // Need to defer quiescent state until everything is enabled. diff -Nru linux-aws-5.19.0/kernel/sched/debug.c linux-aws-5.19.0/kernel/sched/debug.c --- linux-aws-5.19.0/kernel/sched/debug.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/sched/debug.c 2022-11-29 07:06:46.000000000 +0000 @@ -416,7 +416,7 @@ char buf[32]; snprintf(buf, sizeof(buf), "cpu%d", cpu); - debugfs_remove(debugfs_lookup(buf, sd_dentry)); + debugfs_lookup_and_remove(buf, sd_dentry); d_cpu = debugfs_create_dir(buf, sd_dentry); i = 0; diff -Nru linux-aws-5.19.0/kernel/trace/bpf_trace.c linux-aws-5.19.0/kernel/trace/bpf_trace.c --- linux-aws-5.19.0/kernel/trace/bpf_trace.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/bpf_trace.c 2022-11-29 07:06:46.000000000 +0000 @@ -1026,6 +1026,22 @@ .arg1_type = ARG_PTR_TO_CTX, }; +#ifdef CONFIG_X86_KERNEL_IBT +static unsigned long get_entry_ip(unsigned long fentry_ip) +{ + u32 instr; + + /* Being extra safe in here in case entry ip is on the page-edge. */ + if (get_kernel_nofault(instr, (u32 *) fentry_ip - 1)) + return fentry_ip; + if (is_endbr(instr)) + fentry_ip -= ENDBR_INSN_SIZE; + return fentry_ip; +} +#else +#define get_entry_ip(fentry_ip) fentry_ip +#endif + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) { struct kprobe *kp = kprobe_running(); @@ -2414,13 +2430,13 @@ } static void -kprobe_multi_link_handler(struct fprobe *fp, unsigned long entry_ip, +kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip, struct pt_regs *regs) { struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); - kprobe_multi_link_prog_run(link, entry_ip, regs); + kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), regs); } static int symbols_cmp_r(const void *a, const void *b, const void *priv) diff -Nru linux-aws-5.19.0/kernel/trace/ftrace.c linux-aws-5.19.0/kernel/trace/ftrace.c --- linux-aws-5.19.0/kernel/trace/ftrace.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/ftrace.c 2022-11-29 07:06:46.000000000 +0000 @@ -1644,6 +1644,18 @@ static struct ftrace_ops * ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops); +static bool skip_record(struct dyn_ftrace *rec) +{ + /* + * At boot up, weak functions are set to disable. Function tracing + * can be enabled before they are, and they still need to be disabled now. + * If the record is disabled, still continue if it is marked as already + * enabled (this is needed to keep the accounting working). + */ + return rec->flags & FTRACE_FL_DISABLED && + !(rec->flags & FTRACE_FL_ENABLED); +} + static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, int filter_hash, bool inc) @@ -1693,7 +1705,7 @@ int in_hash = 0; int match = 0; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; if (all) { @@ -2090,7 +2102,7 @@ ftrace_bug_type = FTRACE_BUG_UNKNOWN; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) return FTRACE_UPDATE_IGNORE; /* @@ -2205,7 +2217,7 @@ if (update) { /* If there's no more users, clear all flags */ if (!ftrace_rec_count(rec)) - rec->flags = 0; + rec->flags &= FTRACE_FL_DISABLED; else /* * Just disable the record, but keep the ops TRAMP @@ -2599,7 +2611,7 @@ do_for_each_ftrace_rec(pg, rec) { - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; failed = __ftrace_replace_code(rec, enable); @@ -6037,8 +6049,12 @@ if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash; diff -Nru linux-aws-5.19.0/kernel/trace/kprobe_event_gen_test.c linux-aws-5.19.0/kernel/trace/kprobe_event_gen_test.c --- linux-aws-5.19.0/kernel/trace/kprobe_event_gen_test.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/kprobe_event_gen_test.c 2022-11-29 07:06:46.000000000 +0000 @@ -35,6 +35,45 @@ static struct trace_event_file *gen_kprobe_test; static struct trace_event_file *gen_kretprobe_test; +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64) +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" + +/* ARM */ +#elif defined(CONFIG_ARM) +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV) +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + + /* * Test to make sure we can create a kprobe event, then add more * fields. @@ -58,14 +97,14 @@ * fields. */ ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", - "do_sys_open", - "dfd=%ax", "filename=%dx"); + KPROBE_GEN_TEST_FUNC, + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) goto free; /* Use kprobe_event_add_fields to add the rest of the fields */ - ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)"); + ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); if (ret) goto free; @@ -128,7 +167,7 @@ * Define the kretprobe event. */ ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", - "do_sys_open", + KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) goto free; @@ -206,7 +245,7 @@ WARN_ON(kprobe_event_delete("gen_kprobe_test")); /* Disable the event or you can't remove it */ - WARN_ON(trace_array_set_clr_event(gen_kprobe_test->tr, + WARN_ON(trace_array_set_clr_event(gen_kretprobe_test->tr, "kprobes", "gen_kretprobe_test", false)); diff -Nru linux-aws-5.19.0/kernel/trace/ring_buffer.c linux-aws-5.19.0/kernel/trace/ring_buffer.c --- linux-aws-5.19.0/kernel/trace/ring_buffer.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/ring_buffer.c 2022-11-29 07:06:46.000000000 +0000 @@ -413,6 +413,7 @@ struct irq_work work; wait_queue_head_t waiters; wait_queue_head_t full_waiters; + long wait_index; bool waiters_pending; bool full_waiters_pending; bool wakeup_full; @@ -917,13 +918,45 @@ struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); - if (rbwork->wakeup_full) { + if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; wake_up_all(&rbwork->full_waiters); } } /** + * ring_buffer_wake_waiters - wake up any waiters on this ring buffer + * @buffer: The ring buffer to wake waiters on + * + * In the case of a file that represents a ring buffer is closing, + * it is prudent to wake up any waiters that are on this. + */ +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu) +{ + struct ring_buffer_per_cpu *cpu_buffer; + struct rb_irq_work *rbwork; + + if (cpu == RING_BUFFER_ALL_CPUS) { + + /* Wake up individual ones too. One level recursion */ + for_each_buffer_cpu(buffer, cpu) + ring_buffer_wake_waiters(buffer, cpu); + + rbwork = &buffer->irq_work; + } else { + cpu_buffer = buffer->buffers[cpu]; + rbwork = &cpu_buffer->irq_work; + } + + rbwork->wait_index++; + /* make sure the waiters see the new index */ + smp_wmb(); + + rb_wake_up_waiters(&rbwork->work); +} + +/** * ring_buffer_wait - wait for input to the ring buffer * @buffer: buffer to wait on * @cpu: the cpu buffer to wait on @@ -938,6 +971,7 @@ struct ring_buffer_per_cpu *cpu_buffer; DEFINE_WAIT(wait); struct rb_irq_work *work; + long wait_index; int ret = 0; /* @@ -956,6 +990,7 @@ work = &cpu_buffer->irq_work; } + wait_index = READ_ONCE(work->wait_index); while (true) { if (full) @@ -1011,7 +1046,7 @@ nr_pages = cpu_buffer->nr_pages; dirty = ring_buffer_nr_dirty_pages(buffer, cpu); if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy && @@ -1020,6 +1055,11 @@ } schedule(); + + /* Make sure to see the new wait index */ + smp_rmb(); + if (wait_index != work->wait_index) + break; } if (full) @@ -2608,6 +2648,9 @@ /* Mark the rest of the page with padding */ rb_event_set_padding(event); + /* Make sure the padding is visible before the write update */ + smp_wmb(); + /* Set the write back to the previous setting */ local_sub(length, &tail_page->write); return; @@ -2619,6 +2662,9 @@ /* time delta must be non zero */ event->time_delta = 1; + /* Make sure the padding is visible before the tail_page->write update */ + smp_wmb(); + /* Set write to end of buffer */ length = (tail + length) - BUF_PAGE_SIZE; local_sub(length, &tail_page->write); @@ -4587,6 +4633,33 @@ arch_spin_unlock(&cpu_buffer->lock); local_irq_restore(flags); + /* + * The writer has preempt disable, wait for it. But not forever + * Although, 1 second is pretty much "forever" + */ +#define USECS_WAIT 1000000 + for (nr_loops = 0; nr_loops < USECS_WAIT; nr_loops++) { + /* If the write is past the end of page, a writer is still updating it */ + if (likely(!reader || rb_page_write(reader) <= BUF_PAGE_SIZE)) + break; + + udelay(1); + + /* Get the latest version of the reader write value */ + smp_rmb(); + } + + /* The writer is not moving forward? Something is wrong */ + if (RB_WARN_ON(cpu_buffer, nr_loops == USECS_WAIT)) + reader = NULL; + + /* + * Make sure we see any padding after the write update + * (see rb_reset_tail()) + */ + smp_rmb(); + + return reader; } @@ -5616,7 +5689,15 @@ unsigned int pos = 0; unsigned int size; - if (full) + /* + * If a full page is expected, this can still be returned + * if there's been a previous partial read and the + * rest of the page can be read and the commit page is off + * the reader page. + */ + if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock; if (len > (commit - read)) diff -Nru linux-aws-5.19.0/kernel/trace/trace.c linux-aws-5.19.0/kernel/trace/trace.c --- linux-aws-5.19.0/kernel/trace/trace.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace.c 2022-11-29 07:06:46.000000000 +0000 @@ -1193,12 +1193,14 @@ { void *cond_data = NULL; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) cond_data = tr->cond_snapshot->cond_data; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return cond_data; } @@ -1334,9 +1336,11 @@ goto fail_unlock; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); tr->cond_snapshot = cond_snapshot; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); mutex_unlock(&trace_types_lock); @@ -1363,6 +1367,7 @@ { int ret = 0; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (!tr->cond_snapshot) @@ -1373,6 +1378,7 @@ } arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return ret; } @@ -2200,6 +2206,11 @@ #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX +/* + * Preemption must be disabled before acquiring trace_cmdline_lock. + * The various trace_arrays' max_lock must be acquired in a context + * where interrupt is disabled. + */ static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; @@ -2412,7 +2423,11 @@ * the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. + * + * This is called within the scheduler and wake up, so interrupts + * had better been disabled and run queue lock been held. */ + lockdep_assert_preemption_disabled(); if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; @@ -5890,9 +5905,11 @@ char buf[64]; int r; + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); r = scnprintf(buf, sizeof(buf), "%u\n", savedcmd->cmdline_num); arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } @@ -5917,10 +5934,12 @@ return -ENOMEM; } + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); savedcmd_temp = savedcmd; savedcmd = s; arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); free_saved_cmdlines_buffer(savedcmd_temp); return 0; @@ -6373,10 +6392,12 @@ #ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; } @@ -6407,12 +6428,12 @@ if (tr->current_trace->reset) tr->current_trace->reset(tr); +#ifdef CONFIG_TRACER_MAX_TRACE + had_max_tr = tr->current_trace->use_max_tr; + /* Current trace needs to be nop_trace before synchronize_rcu */ tr->current_trace = &nop_trace; -#ifdef CONFIG_TRACER_MAX_TRACE - had_max_tr = tr->allocated_snapshot; - if (had_max_tr && !t->use_max_tr) { /* * We need to make sure that the update_max_tr sees that @@ -6425,11 +6446,13 @@ free_snapshot(tr); } - if (t->use_max_tr && !had_max_tr) { + if (t->use_max_tr && !tr->allocated_snapshot) { ret = tracing_alloc_snapshot_instance(tr); if (ret < 0) goto out; } +#else + tr->current_trace = &nop_trace; #endif if (t->init) { @@ -7436,10 +7459,12 @@ goto out; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; @@ -8137,6 +8162,12 @@ __trace_array_put(iter->tr); + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + if (info->spare) ring_buffer_free_read_page(iter->array_buffer->buffer, info->spare_cpu, info->spare); @@ -8290,6 +8321,8 @@ /* did we read anything? */ if (!spd.nr_pages) { + long wait_index; + if (ret) goto out; @@ -8297,10 +8330,21 @@ if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) goto out; + wait_index = READ_ONCE(iter->wait_index); + ret = wait_on_pipe(iter, iter->tr->buffer_percent); if (ret) goto out; + /* No need to wait after waking up when tracing is off */ + if (!tracer_tracing_is_on(iter->tr)) + goto out; + + /* Make sure we see the new wait_index */ + smp_rmb(); + if (wait_index != iter->wait_index) + goto out; + goto again; } @@ -8311,12 +8355,34 @@ return ret; } +/* An ioctl call with cmd 0 to the ring buffer file will wake up all waiters */ +static long tracing_buffers_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct ftrace_buffer_info *info = file->private_data; + struct trace_iterator *iter = &info->iter; + + if (cmd) + return -ENOIOCTLCMD; + + mutex_lock(&trace_types_lock); + + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + + mutex_unlock(&trace_types_lock); + return 0; +} + static const struct file_operations tracing_buffers_fops = { .open = tracing_buffers_open, .read = tracing_buffers_read, .poll = tracing_buffers_poll, .release = tracing_buffers_release, .splice_read = tracing_buffers_splice_read, + .unlocked_ioctl = tracing_buffers_ioctl, .llseek = no_llseek, }; @@ -9005,6 +9071,8 @@ tracer_tracing_off(tr); if (tr->current_trace->stop) tr->current_trace->stop(tr); + /* Wake up any waiters */ + ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS); } mutex_unlock(&trace_types_lock); } diff -Nru linux-aws-5.19.0/kernel/trace/trace_eprobe.c linux-aws-5.19.0/kernel/trace/trace_eprobe.c --- linux-aws-5.19.0/kernel/trace/trace_eprobe.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_eprobe.c 2022-11-29 07:06:46.000000000 +0000 @@ -16,6 +16,7 @@ #include "trace_dynevent.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define EPROBE_EVENT_SYSTEM "eprobes" @@ -452,29 +453,14 @@ static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -484,21 +470,7 @@ static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -508,29 +480,7 @@ static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int diff -Nru linux-aws-5.19.0/kernel/trace/trace_events_synth.c linux-aws-5.19.0/kernel/trace/trace_events_synth.c --- linux-aws-5.19.0/kernel/trace/trace_events_synth.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_events_synth.c 2022-11-29 07:06:46.000000000 +0000 @@ -17,6 +17,8 @@ /* for gfp flag names */ #include #include +#include "trace_probe.h" +#include "trace_probe_kernel.h" #include "trace_synth.h" @@ -409,6 +411,7 @@ { unsigned int len = 0; char *str_field; + int ret; if (is_dynamic) { u32 data_offset; @@ -417,19 +420,27 @@ data_offset += event->n_u64 * sizeof(u64); data_offset += data_size; - str_field = (char *)entry + data_offset; - - len = strlen(str_val) + 1; - strscpy(str_field, str_val, len); + len = kern_fetch_store_strlen((unsigned long)str_val); data_offset |= len << 16; *(u32 *)&entry->fields[*n_u64] = data_offset; + ret = kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry); + (*n_u64)++; } else { str_field = (char *)&entry->fields[*n_u64]; - strscpy(str_field, str_val, STR_VAR_LEN_MAX); +#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); + else +#endif + ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX); + + if (ret < 0) + strcpy(str_field, FAULT_STRING); + (*n_u64) += STR_VAR_LEN_MAX / sizeof(u64); } @@ -462,7 +473,7 @@ val_idx = var_ref_idx[field_pos]; str_val = (char *)(long)var_ref_vals[val_idx]; - len = strlen(str_val) + 1; + len = kern_fetch_store_strlen((unsigned long)str_val); fields_size += len; } diff -Nru linux-aws-5.19.0/kernel/trace/trace_events_trigger.c linux-aws-5.19.0/kernel/trace/trace_events_trigger.c --- linux-aws-5.19.0/kernel/trace/trace_events_trigger.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_events_trigger.c 2022-11-29 07:06:46.000000000 +0000 @@ -142,7 +142,8 @@ { struct event_trigger_data *data; - list_for_each_entry_rcu(data, &file->triggers, list) { + list_for_each_entry_rcu(data, &file->triggers, list, + lockdep_is_held(&event_mutex)) { if (data->flags & EVENT_TRIGGER_FL_PROBE) continue; return true; diff -Nru linux-aws-5.19.0/kernel/trace/trace_kprobe.c linux-aws-5.19.0/kernel/trace/trace_kprobe.c --- linux-aws-5.19.0/kernel/trace/trace_kprobe.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_kprobe.c 2022-11-29 07:06:46.000000000 +0000 @@ -20,6 +20,7 @@ #include "trace_kprobe_selftest.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define KPROBE_EVENT_SYSTEM "kprobes" #define KRETPROBE_MAXACTIVE_MAX 4096 @@ -1219,29 +1220,14 @@ static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -1251,21 +1237,7 @@ static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -1275,29 +1247,7 @@ static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int diff -Nru linux-aws-5.19.0/kernel/trace/trace_osnoise.c linux-aws-5.19.0/kernel/trace/trace_osnoise.c --- linux-aws-5.19.0/kernel/trace/trace_osnoise.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_osnoise.c 2022-11-29 07:06:46.000000000 +0000 @@ -1786,8 +1786,9 @@ for_each_cpu(cpu, current_mask) { retval = start_kthread(cpu); if (retval) { + cpus_read_unlock(); stop_per_cpu_kthreads(); - break; + return retval; } } diff -Nru linux-aws-5.19.0/kernel/trace/trace_preemptirq.c linux-aws-5.19.0/kernel/trace/trace_preemptirq.c --- linux-aws-5.19.0/kernel/trace/trace_preemptirq.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_preemptirq.c 2022-11-29 07:06:46.000000000 +0000 @@ -95,14 +95,14 @@ } lockdep_hardirqs_on_prepare(); - lockdep_hardirqs_on(CALLER_ADDR0); + lockdep_hardirqs_on(caller_addr); } EXPORT_SYMBOL(trace_hardirqs_on_caller); NOKPROBE_SYMBOL(trace_hardirqs_on_caller); __visible void trace_hardirqs_off_caller(unsigned long caller_addr) { - lockdep_hardirqs_off(CALLER_ADDR0); + lockdep_hardirqs_off(caller_addr); if (!this_cpu_read(tracing_irq_cpu)) { this_cpu_write(tracing_irq_cpu, 1); diff -Nru linux-aws-5.19.0/kernel/trace/trace_probe_kernel.h linux-aws-5.19.0/kernel/trace/trace_probe_kernel.h --- linux-aws-5.19.0/kernel/trace/trace_probe_kernel.h 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/kernel/trace/trace_probe_kernel.h 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,115 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TRACE_PROBE_KERNEL_H_ +#define __TRACE_PROBE_KERNEL_H_ + +#define FAULT_STRING "(fault)" + +/* + * This depends on trace_probe.h, but can not include it due to + * the way trace_probe_tmpl.h is used by trace_kprobe.c and trace_eprobe.c. + * Which means that any other user must include trace_probe.h before including + * this file. + */ +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen_user(unsigned long addr) +{ + const void __user *uaddr = (__force const void __user *)addr; + int ret; + + ret = strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + /* + * strnlen_user_nofault returns zero on fault, insert the + * FAULT_STRING when that occurs. + */ + if (ret <= 0) + return strlen(FAULT_STRING) + 1; + return ret; +} + +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen(unsigned long addr) +{ + int ret, len = 0; + u8 c; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if (addr < TASK_SIZE) + return kern_fetch_store_strlen_user(addr); +#endif + + do { + ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); + len++; + } while (c && ret == 0 && len < MAX_STRING_SIZE); + + /* For faults, return enough to hold the FAULT_STRING */ + return (ret < 0) ? strlen(FAULT_STRING) + 1 : len; +} + +static nokprobe_inline void set_data_loc(int ret, void *dest, void *__dest, void *base, int len) +{ + if (ret >= 0) { + *(u32 *)dest = make_data_loc(ret, __dest - base); + } else { + strscpy(__dest, FAULT_STRING, len); + ret = strlen(__dest) + 1; + } +} + +/* + * Fetch a null-terminated string from user. Caller MUST set *(u32 *)buf + * with max length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string_user(unsigned long addr, void *dest, void *base) +{ + const void __user *uaddr = (__force const void __user *)addr; + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); + set_data_loc(ret, dest, __dest, base, maxlen); + + return ret; +} + +/* + * Fetch a null-terminated string. Caller MUST set *(u32 *)buf with max + * length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string(unsigned long addr, void *dest, void *base) +{ + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if ((unsigned long)addr < TASK_SIZE) + return kern_fetch_store_string_user(addr, dest, base); +#endif + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + /* + * Try to get string again, since the string can be changed while + * probing. + */ + ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); + set_data_loc(ret, dest, __dest, base, maxlen); + + return ret; +} + +#endif /* __TRACE_PROBE_KERNEL_H_ */ diff -Nru linux-aws-5.19.0/kernel/workqueue.c linux-aws-5.19.0/kernel/workqueue.c --- linux-aws-5.19.0/kernel/workqueue.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/kernel/workqueue.c 2022-11-29 07:06:46.000000000 +0000 @@ -3066,10 +3066,8 @@ if (WARN_ON(!work->func)) return false; - if (!from_cancel) { - lock_map_acquire(&work->lockdep_map); - lock_map_release(&work->lockdep_map); - } + lock_map_acquire(&work->lockdep_map); + lock_map_release(&work->lockdep_map); if (start_flush_work(work, &barr, from_cancel)) { wait_for_completion(&barr.done); diff -Nru linux-aws-5.19.0/lib/dynamic_debug.c linux-aws-5.19.0/lib/dynamic_debug.c --- linux-aws-5.19.0/lib/dynamic_debug.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/lib/dynamic_debug.c 2022-11-29 07:06:46.000000000 +0000 @@ -211,10 +211,11 @@ continue; #ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) + if (!(newflags & _DPRINTK_FLAGS_PRINT)) static_branch_disable(&dp->key.dd_key_true); - } else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + } else if (newflags & _DPRINTK_FLAGS_PRINT) { static_branch_enable(&dp->key.dd_key_true); + } #endif dp->flags = newflags; v4pr_info("changed %s:%d [%s]%s =%s\n", @@ -383,10 +384,6 @@ return -EINVAL; } - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { char *keyword = words[i]; char *arg = words[i+1]; @@ -427,6 +424,13 @@ if (rc) return rc; } + if (!query->module && modname) + /* + * support $modname.dyndbg=, when + * not given in the query itself + */ + query->module = modname; + vpr_info_dq(query, "parsed"); return 0; } @@ -553,35 +557,6 @@ return nfound; } -/** - * dynamic_debug_exec_queries - select and change dynamic-debug prints - * @query: query-string described in admin-guide/dynamic-debug-howto - * @modname: string containing module name, usually &module.mod_name - * - * This uses the >/proc/dynamic_debug/control reader, allowing module - * authors to modify their dynamic-debug callsites. The modname is - * canonically struct module.mod_name, but can also be null or a - * module-wildcard, for example: "drm*". - */ -int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - int rc; - char *qry; /* writable copy of query */ - - if (!query) { - pr_err("non-null query/command string expected\n"); - return -EINVAL; - } - qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); - if (!qry) - return -ENOMEM; - - rc = ddebug_exec_queries(qry, modname); - kfree(qry); - return rc; -} -EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); - #define PREFIX_SIZE 64 static int remaining(int wrote) diff -Nru linux-aws-5.19.0/lib/Kconfig.debug linux-aws-5.19.0/lib/Kconfig.debug --- linux-aws-5.19.0/lib/Kconfig.debug 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/lib/Kconfig.debug 2022-11-29 07:06:46.000000000 +0000 @@ -231,6 +231,11 @@ in the "Debug information" choice below, indicating that debug information will be generated for build targets. +# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which +# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 +config AS_HAS_NON_CONST_LEB128 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL @@ -253,6 +258,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time. @@ -264,8 +270,10 @@ config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help - Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. + Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 + if using clang without clang's integrated assembler, and gdb 7.0+. If you have consumers of DWARF debug info that are not ready for newer revisions of DWARF, you may wish to choose this or have your @@ -274,7 +282,7 @@ config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some diff -Nru linux-aws-5.19.0/lib/once.c linux-aws-5.19.0/lib/once.c --- linux-aws-5.19.0/lib/once.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/lib/once.c 2022-11-29 07:06:46.000000000 +0000 @@ -66,3 +66,33 @@ once_disable_jump(once_key, mod); } EXPORT_SYMBOL(__do_once_done); + +static DEFINE_MUTEX(once_mutex); + +bool __do_once_slow_start(bool *done) + __acquires(once_mutex) +{ + mutex_lock(&once_mutex); + if (*done) { + mutex_unlock(&once_mutex); + /* Keep sparse happy by restoring an even lock count on + * this mutex. In case we return here, we don't call into + * __do_once_done but return early in the DO_ONCE_SLOW() macro. + */ + __acquire(once_mutex); + return false; + } + + return true; +} +EXPORT_SYMBOL(__do_once_slow_start); + +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod) + __releases(once_mutex) +{ + *done = true; + mutex_unlock(&once_mutex); + once_disable_jump(once_key, mod); +} +EXPORT_SYMBOL(__do_once_slow_done); diff -Nru linux-aws-5.19.0/MAINTAINERS linux-aws-5.19.0/MAINTAINERS --- linux-aws-5.19.0/MAINTAINERS 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/MAINTAINERS 2022-11-29 07:06:46.000000000 +0000 @@ -4857,6 +4857,7 @@ F: Documentation/devicetree/bindings/sound/cirrus,cs* F: include/dt-bindings/sound/cs* F: sound/pci/hda/cs* +F: sound/pci/hda/hda_cs_dsp_ctl.* F: sound/soc/codecs/cs* CIRRUS LOGIC DSP FIRMWARE DRIVER diff -Nru linux-aws-5.19.0/Makefile linux-aws-5.19.0/Makefile --- linux-aws-5.19.0/Makefile 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 19 -SUBLEVEL = 7 +SUBLEVEL = 17 EXTRAVERSION = NAME = Superb Owl @@ -833,8 +833,8 @@ # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO KBUILD_CFLAGS += -ftrivial-auto-var-init=zero -ifdef CONFIG_CC_IS_CLANG -# https://bugs.llvm.org/show_bug.cgi?id=45497 +ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER +# https://github.com/llvm/llvm-project/issues/44842 KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif endif @@ -1289,8 +1289,7 @@ PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts - $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ - $(error Headers not exportable for the $(SRCARCH) architecture)) + $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for UML)) $(Q)$(MAKE) $(hdr-inst)=include/uapi $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(Q)$(MAKE) $(hdr-inst)=ubuntu/include dst=include oldheaders= diff -Nru linux-aws-5.19.0/mm/damon/dbgfs.c linux-aws-5.19.0/mm/damon/dbgfs.c --- linux-aws-5.19.0/mm/damon/dbgfs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/damon/dbgfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -853,6 +853,7 @@ struct dentry *root, *dir, **new_dirs; struct damon_ctx **new_ctxs; int i, j; + int ret = 0; if (damon_nr_running_ctxs()) return -EBUSY; @@ -867,14 +868,16 @@ new_dirs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs), GFP_KERNEL); - if (!new_dirs) - return -ENOMEM; + if (!new_dirs) { + ret = -ENOMEM; + goto out_dput; + } new_ctxs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_ctxs), GFP_KERNEL); if (!new_ctxs) { - kfree(new_dirs); - return -ENOMEM; + ret = -ENOMEM; + goto out_new_dirs; } for (i = 0, j = 0; i < dbgfs_nr_ctxs; i++) { @@ -894,7 +897,13 @@ dbgfs_ctxs = new_ctxs; dbgfs_nr_ctxs--; - return 0; + goto out_dput; + +out_new_dirs: + kfree(new_dirs); +out_dput: + dput(dir); + return ret; } static ssize_t dbgfs_rm_context_write(struct file *file, diff -Nru linux-aws-5.19.0/mm/damon/sysfs.c linux-aws-5.19.0/mm/damon/sysfs.c --- linux-aws-5.19.0/mm/damon/sysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/damon/sysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -2181,13 +2181,13 @@ if (!t) return -ENOMEM; + damon_add_target(ctx, t); if (ctx->ops.id == DAMON_OPS_VADDR || ctx->ops.id == DAMON_OPS_FVADDR) { t->pid = find_get_pid(sys_target->pid); if (!t->pid) goto destroy_targets_out; } - damon_add_target(ctx, t); err = damon_sysfs_set_regions(t, sys_target->regions); if (err) goto destroy_targets_out; diff -Nru linux-aws-5.19.0/mm/damon/vaddr.c linux-aws-5.19.0/mm/damon/vaddr.c --- linux-aws-5.19.0/mm/damon/vaddr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/damon/vaddr.c 2022-11-29 07:06:46.000000000 +0000 @@ -304,6 +304,11 @@ if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (pmd_huge(*pmd)) { damon_pmdp_mkold(pmd, walk->mm, addr); spin_unlock(ptl); @@ -431,6 +436,11 @@ #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (!pmd_huge(*pmd)) { spin_unlock(ptl); goto regular_page; diff -Nru linux-aws-5.19.0/mm/frontswap.c linux-aws-5.19.0/mm/frontswap.c --- linux-aws-5.19.0/mm/frontswap.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/frontswap.c 2022-11-29 07:06:46.000000000 +0000 @@ -125,6 +125,9 @@ * p->frontswap set to something valid to work properly. */ frontswap_map_set(sis, map); + + if (!frontswap_enabled()) + return; frontswap_ops->init(type); } diff -Nru linux-aws-5.19.0/mm/gup.c linux-aws-5.19.0/mm/gup.c --- linux-aws-5.19.0/mm/gup.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/gup.c 2022-11-29 07:06:46.000000000 +0000 @@ -531,6 +531,18 @@ if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) == (FOLL_PIN | FOLL_GET))) return ERR_PTR(-EINVAL); + + /* + * Considering PTE level hugetlb, like continuous-PTE hugetlb on + * ARM64 architecture. + */ + if (is_vm_hugetlb_page(vma)) { + page = follow_huge_pmd_pte(vma, address, flags); + if (page) + return page; + return no_page_table(vma, flags); + } + retry: if (unlikely(pmd_bad(*pmd))) return no_page_table(vma, flags); @@ -663,7 +675,7 @@ if (pmd_none(pmdval)) return no_page_table(vma, flags); if (pmd_huge(pmdval) && is_vm_hugetlb_page(vma)) { - page = follow_huge_pmd(mm, address, pmd, flags); + page = follow_huge_pmd_pte(vma, address, flags); if (page) return page; return no_page_table(vma, flags); @@ -2278,8 +2290,28 @@ } #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL -static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, - unsigned int flags, struct page **pages, int *nr) +/* + * Fast-gup relies on pte change detection to avoid concurrent pgtable + * operations. + * + * To pin the page, fast-gup needs to do below in order: + * (1) pin the page (by prefetching pte), then (2) check pte not changed. + * + * For the rest of pgtable operations where pgtable updates can be racy + * with fast-gup, we need to do (1) clear pte, then (2) check whether page + * is pinned. + * + * Above will work for all pte-level operations, including THP split. + * + * For THP collapse, it's a bit more complicated because fast-gup may be + * walking a pgtable page that is being freed (pte is still valid but pmd + * can be cleared already). To avoid race in such condition, we need to + * also check pmd here to make sure pmd doesn't change (corresponds to + * pmdp_collapse_flush() in the THP collapse code path). + */ +static int gup_pte_range(pmd_t pmd, pmd_t *pmdp, unsigned long addr, + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { struct dev_pagemap *pgmap = NULL; int nr_start = *nr, ret = 0; @@ -2325,7 +2357,8 @@ goto pte_unmap; } - if (unlikely(pte_val(pte) != pte_val(*ptep))) { + if (unlikely(pmd_val(pmd) != pmd_val(*pmdp)) || + unlikely(pte_val(pte) != pte_val(*ptep))) { gup_put_folio(folio, 1, flags); goto pte_unmap; } @@ -2372,8 +2405,9 @@ * get_user_pages_fast_only implementation that can pin pages. Thus it's still * useful to have gup_huge_pmd even if we can't operate on ptes. */ -static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, - unsigned int flags, struct page **pages, int *nr) +static int gup_pte_range(pmd_t pmd, pmd_t *pmdp, unsigned long addr, + unsigned long end, unsigned int flags, + struct page **pages, int *nr) { return 0; } @@ -2697,7 +2731,7 @@ if (!gup_huge_pd(__hugepd(pmd_val(pmd)), addr, PMD_SHIFT, next, flags, pages, nr)) return 0; - } else if (!gup_pte_range(pmd, addr, next, flags, pages, nr)) + } else if (!gup_pte_range(pmd, pmdp, addr, next, flags, pages, nr)) return 0; } while (pmdp++, addr = next, addr != end); diff -Nru linux-aws-5.19.0/mm/hugetlb.c linux-aws-5.19.0/mm/hugetlb.c --- linux-aws-5.19.0/mm/hugetlb.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/hugetlb.c 2022-11-29 07:06:46.000000000 +0000 @@ -3418,6 +3418,7 @@ { int i, nid = page_to_nid(page); struct hstate *target_hstate; + struct page *subpage; int rc = 0; target_hstate = size_to_hstate(PAGE_SIZE << h->demote_order); @@ -3451,15 +3452,16 @@ mutex_lock(&target_hstate->resize_lock); for (i = 0; i < pages_per_huge_page(h); i += pages_per_huge_page(target_hstate)) { + subpage = nth_page(page, i); if (hstate_is_gigantic(target_hstate)) - prep_compound_gigantic_page_for_demote(page + i, + prep_compound_gigantic_page_for_demote(subpage, target_hstate->order); else - prep_compound_page(page + i, target_hstate->order); - set_page_private(page + i, 0); - set_page_refcounted(page + i); - prep_new_huge_page(target_hstate, page + i, nid); - put_page(page + i); + prep_compound_page(subpage, target_hstate->order); + set_page_private(subpage, 0); + set_page_refcounted(subpage); + prep_new_huge_page(target_hstate, subpage, nid); + put_page(subpage); } mutex_unlock(&target_hstate->resize_lock); @@ -5048,6 +5050,7 @@ * unmapped and its refcount is dropped, so just clear pte here. */ if (unlikely(!pte_present(pte))) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* * If the pte was wr-protected by uffd-wp in any of the * swap forms, meanwhile the caller does not want to @@ -5059,6 +5062,7 @@ set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); else +#endif huge_pte_clear(mm, address, ptep, sz); spin_unlock(ptl); continue; @@ -5087,11 +5091,13 @@ tlb_remove_huge_tlb_entry(h, tlb, ptep, address); if (huge_pte_dirty(pte)) set_page_dirty(page); +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* Leave a uffd-wp pte marker if needed */ if (huge_pte_uffd_wp(pte) && !(zap_flags & ZAP_FLAG_DROP_MARKER)) set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); +#endif hugetlb_count_sub(pages_per_huge_page(h), mm); page_remove_rmap(page, vma, true); @@ -5461,7 +5467,6 @@ unsigned long addr, unsigned long reason) { - vm_fault_t ret; u32 hash; struct vm_fault vmf = { .vma = vma, @@ -5479,18 +5484,14 @@ }; /* - * hugetlb_fault_mutex and i_mmap_rwsem must be - * dropped before handling userfault. Reacquire - * after handling fault to make calling code simpler. + * vma_lock and hugetlb_fault_mutex must be dropped before handling + * userfault. Also mmap_lock will be dropped during handling + * userfault, any vma operation should be careful from here. */ hash = hugetlb_fault_mutex_hash(mapping, idx); mutex_unlock(&hugetlb_fault_mutex_table[hash]); i_mmap_unlock_read(mapping); - ret = handle_userfault(&vmf, reason); - i_mmap_lock_read(mapping); - mutex_lock(&hugetlb_fault_mutex_table[hash]); - - return ret; + return handle_userfault(&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm, @@ -5508,6 +5509,7 @@ spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); bool new_page, new_pagecache_page = false; + u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* * Currently, we are forced to kill the process in the event the @@ -5518,7 +5520,7 @@ if (is_vma_resv_set(vma, HPAGE_RESV_UNMAPPED)) { pr_warn_ratelimited("PID %d killed due to inadequate hugepage pool\n", current->pid); - return ret; + goto out; } /* @@ -5535,12 +5537,10 @@ page = find_lock_page(mapping, idx); if (!page) { /* Check for page in userfault range */ - if (userfaultfd_missing(vma)) { - ret = hugetlb_handle_userfault(vma, mapping, idx, + if (userfaultfd_missing(vma)) + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MISSING); - goto out; - } page = alloc_huge_page(vma, haddr, 0); if (IS_ERR(page)) { @@ -5600,10 +5600,9 @@ if (userfaultfd_minor(vma)) { unlock_page(page); put_page(page); - ret = hugetlb_handle_userfault(vma, mapping, idx, + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MINOR); - goto out; } } @@ -5661,6 +5660,8 @@ unlock_page(page); out: + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + i_mmap_unlock_read(mapping); return ret; backout: @@ -5759,11 +5760,13 @@ entry = huge_ptep_get(ptep); /* PTE markers should be handled the same way as none pte */ - if (huge_pte_none_mostly(entry)) { - ret = hugetlb_no_page(mm, vma, mapping, idx, address, ptep, + if (huge_pte_none_mostly(entry)) + /* + * hugetlb_no_page will drop vma lock and hugetlb fault + * mutex internally, which make us return immediately. + */ + return hugetlb_no_page(mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret = 0; @@ -6904,12 +6907,13 @@ } struct page * __weak -follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags) +follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, int flags) { + struct hstate *h = hstate_vma(vma); + struct mm_struct *mm = vma->vm_mm; struct page *page = NULL; spinlock_t *ptl; - pte_t pte; + pte_t *ptep, pte; /* * FOLL_PIN is not supported for follow_page(). Ordinary GUP goes via @@ -6919,17 +6923,15 @@ return NULL; retry: - ptl = pmd_lockptr(mm, pmd); - spin_lock(ptl); - /* - * make sure that the address range covered by this pmd is not - * unmapped from other threads. - */ - if (!pmd_huge(*pmd)) - goto out; - pte = huge_ptep_get((pte_t *)pmd); + ptep = huge_pte_offset(mm, address, huge_page_size(h)); + if (!ptep) + return NULL; + + ptl = huge_pte_lock(h, mm, ptep); + pte = huge_ptep_get(ptep); if (pte_present(pte)) { - page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT); + page = pte_page(pte) + + ((address & ~huge_page_mask(h)) >> PAGE_SHIFT); /* * try_grab_page() should always succeed here, because: a) we * hold the pmd (ptl) lock, and b) we've just checked that the @@ -6945,7 +6947,7 @@ } else { if (is_hugetlb_entry_migration(pte)) { spin_unlock(ptl); - __migration_entry_wait_huge((pte_t *)pmd, ptl); + __migration_entry_wait_huge(ptep, ptl); goto retry; } /* diff -Nru linux-aws-5.19.0/mm/khugepaged.c linux-aws-5.19.0/mm/khugepaged.c --- linux-aws-5.19.0/mm/khugepaged.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/khugepaged.c 2022-11-29 07:06:46.000000000 +0000 @@ -1121,10 +1121,12 @@ pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */ /* - * After this gup_fast can't run anymore. This also removes - * any huge TLB entry from the CPU so we won't allow - * huge and small TLB entries for the same virtual address - * to avoid the risk of CPU bugs in that area. + * This removes any huge TLB entry from the CPU so we won't allow + * huge and small TLB entries for the same virtual address to + * avoid the risk of CPU bugs in that area. + * + * Parallel fast GUP is fine since fast GUP will back off when + * it detects PMD is changed. */ _pmd = pmdp_collapse_flush(vma, address, pmd); spin_unlock(pmd_ptl); diff -Nru linux-aws-5.19.0/mm/kmemleak.c linux-aws-5.19.0/mm/kmemleak.c --- linux-aws-5.19.0/mm/kmemleak.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/kmemleak.c 2022-11-29 07:06:46.000000000 +0000 @@ -1132,7 +1132,7 @@ void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, int min_count, gfp_t gfp) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_alloc(__va(phys), size, min_count, gfp); } EXPORT_SYMBOL(kmemleak_alloc_phys); @@ -1146,7 +1146,7 @@ */ void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_free_part(__va(phys), size); } EXPORT_SYMBOL(kmemleak_free_part_phys); @@ -1158,7 +1158,7 @@ */ void __ref kmemleak_not_leak_phys(phys_addr_t phys) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_not_leak(__va(phys)); } EXPORT_SYMBOL(kmemleak_not_leak_phys); @@ -1170,7 +1170,7 @@ */ void __ref kmemleak_ignore_phys(phys_addr_t phys) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_ignore(__va(phys)); } EXPORT_SYMBOL(kmemleak_ignore_phys); diff -Nru linux-aws-5.19.0/mm/madvise.c linux-aws-5.19.0/mm/madvise.c --- linux-aws-5.19.0/mm/madvise.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/madvise.c 2022-11-29 07:06:46.000000000 +0000 @@ -451,8 +451,11 @@ continue; } - /* Do not interfere with other mappings of this page */ - if (page_mapcount(page) != 1) + /* + * Do not interfere with other mappings of this page and + * non-LRU page. + */ + if (!PageLRU(page) || page_mapcount(page) != 1) continue; VM_BUG_ON_PAGE(PageTransCompound(page), page); diff -Nru linux-aws-5.19.0/mm/memory.c linux-aws-5.19.0/mm/memory.c --- linux-aws-5.19.0/mm/memory.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/memory.c 2022-11-29 07:06:46.000000000 +0000 @@ -1385,10 +1385,12 @@ unsigned long addr, pte_t *pte, struct zap_details *details, pte_t pteval) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (zap_drop_file_uffd_wp(details)) return; pte_install_uffd_wp_if_needed(vma, addr, pte, pteval); +#endif } static unsigned long zap_pte_range(struct mmu_gather *tlb, @@ -4379,14 +4381,20 @@ vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - ret = 0; + /* Re-check under ptl */ - if (likely(!vmf_pte_changed(vmf))) + if (likely(!vmf_pte_changed(vmf))) { do_set_pte(vmf, page, vmf->address); - else + + /* no need to invalidate: a not-present page won't be cached */ + update_mmu_cache(vma, vmf->address, vmf->pte); + + ret = 0; + } else { + update_mmu_tlb(vma, vmf->address, vmf->pte); ret = VM_FAULT_NOPAGE; + } - update_mmu_tlb(vma, vmf->address, vmf->pte); pte_unmap_unlock(vmf->pte, vmf->ptl); return ret; } diff -Nru linux-aws-5.19.0/mm/memory-failure.c linux-aws-5.19.0/mm/memory-failure.c --- linux-aws-5.19.0/mm/memory-failure.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/memory-failure.c 2022-11-29 07:06:46.000000000 +0000 @@ -697,6 +697,9 @@ }; priv.tk.tsk = p; + if (!p->mm) + return -EFAULT; + mmap_read_lock(p->mm); ret = walk_page_range(p->mm, 0, TASK_SIZE, &hwp_walk_ops, (void *)&priv); diff -Nru linux-aws-5.19.0/mm/migrate_device.c linux-aws-5.19.0/mm/migrate_device.c --- linux-aws-5.19.0/mm/migrate_device.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/migrate_device.c 2022-11-29 07:06:46.000000000 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -187,10 +188,10 @@ bool anon_exclusive; pte_t swp_pte; + flush_cache_page(vma, addr, pte_pfn(*ptep)); anon_exclusive = PageAnon(page) && PageAnonExclusive(page); if (anon_exclusive) { - flush_cache_page(vma, addr, pte_pfn(*ptep)); - ptep_clear_flush(vma, addr, ptep); + pte = ptep_clear_flush(vma, addr, ptep); if (page_try_share_anon_rmap(page)) { set_pte_at(mm, addr, ptep, pte); @@ -200,11 +201,15 @@ goto next; } } else { - ptep_get_and_clear(mm, addr, ptep); + pte = ptep_get_and_clear(mm, addr, ptep); } migrate->cpages++; + /* Set the dirty flag on the folio now the pte is gone. */ + if (pte_dirty(pte)) + folio_mark_dirty(page_folio(page)); + /* Setup special migration page table entry */ if (mpfn & MIGRATE_PFN_WRITE) entry = make_writable_migration_entry( @@ -248,13 +253,14 @@ migrate->dst[migrate->npages] = 0; migrate->src[migrate->npages++] = mpfn; } - arch_leave_lazy_mmu_mode(); - pte_unmap_unlock(ptep - 1, ptl); /* Only flush the TLB if we actually modified any entries */ if (unmapped) flush_tlb_range(walk->vma, start, end); + arch_leave_lazy_mmu_mode(); + pte_unmap_unlock(ptep - 1, ptl); + return 0; } diff -Nru linux-aws-5.19.0/mm/mmap.c linux-aws-5.19.0/mm/mmap.c --- linux-aws-5.19.0/mm/mmap.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/mmap.c 2022-11-29 07:06:46.000000000 +0000 @@ -1845,7 +1845,7 @@ if (!arch_validate_flags(vma->vm_flags)) { error = -EINVAL; if (file) - goto unmap_and_free_vma; + goto close_and_free_vma; else goto free_vma; } @@ -1892,6 +1892,9 @@ return addr; +close_and_free_vma: + if (vma->vm_ops && vma->vm_ops->close) + vma->vm_ops->close(vma); unmap_and_free_vma: vma_fput(vma); vma->vm_file = NULL; diff -Nru linux-aws-5.19.0/mm/mprotect.c linux-aws-5.19.0/mm/mprotect.c --- linux-aws-5.19.0/mm/mprotect.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/mprotect.c 2022-11-29 07:06:46.000000000 +0000 @@ -222,6 +222,7 @@ } else { /* It must be an none page, or what else?.. */ WARN_ON_ONCE(!pte_none(oldpte)); +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (unlikely(uffd_wp && !vma_is_anonymous(vma))) { /* * For file-backed mem, we need to be able to @@ -233,6 +234,7 @@ make_pte_marker(PTE_MARKER_UFFD_WP)); pages++; } +#endif } } while (pte++, addr += PAGE_SIZE, addr != end); arch_leave_lazy_mmu_mode(); diff -Nru linux-aws-5.19.0/mm/page_alloc.c linux-aws-5.19.0/mm/page_alloc.c --- linux-aws-5.19.0/mm/page_alloc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/mm/page_alloc.c 2022-11-29 07:06:46.000000000 +0000 @@ -4623,6 +4623,30 @@ EXPORT_SYMBOL_GPL(fs_reclaim_release); #endif +/* + * Zonelists may change due to hotplug during allocation. Detect when zonelists + * have been rebuilt so allocation retries. Reader side does not lock and + * retries the allocation if zonelist changes. Writer side is protected by the + * embedded spin_lock. + */ +static DEFINE_SEQLOCK(zonelist_update_seq); + +static unsigned int zonelist_iter_begin(void) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqbegin(&zonelist_update_seq); + + return 0; +} + +static unsigned int check_retry_zonelist(unsigned int seq) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqretry(&zonelist_update_seq, seq); + + return seq; +} + /* Perform direct synchronous page reclaim */ static unsigned long __perform_reclaim(gfp_t gfp_mask, unsigned int order, @@ -4916,6 +4940,7 @@ int compaction_retries; int no_progress_loops; unsigned int cpuset_mems_cookie; + unsigned int zonelist_iter_cookie; int reserve_flags; /* @@ -4926,11 +4951,12 @@ (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM))) gfp_mask &= ~__GFP_ATOMIC; -retry_cpuset: +restart: compaction_retries = 0; no_progress_loops = 0; compact_priority = DEF_COMPACT_PRIORITY; cpuset_mems_cookie = read_mems_allowed_begin(); + zonelist_iter_cookie = zonelist_iter_begin(); /* * The fast path uses conservative alloc_flags to succeed only until @@ -5102,9 +5128,13 @@ goto retry; - /* Deal with possible cpuset update races before we start OOM killing */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; /* Reclaim has failed us, start killing things */ page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); @@ -5124,9 +5154,13 @@ } nopage: - /* Deal with possible cpuset update races before we fail */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; /* * Make sure that __GFP_NOFAIL request doesn't leak out and make sure @@ -5617,6 +5651,18 @@ /* reset page count bias and offset to start of new frag */ nc->pagecnt_bias = PAGE_FRAG_CACHE_MAX_SIZE + 1; offset = size - fragsz; + if (unlikely(offset < 0)) { + /* + * The caller is trying to allocate a fragment + * with fragsz > PAGE_SIZE but the cache isn't big + * enough to satisfy the request, this may + * happen in low memory conditions. + * We don't release the cache page because + * it could make memory pressure worse + * so we simply return NULL here. + */ + return NULL; + } } nc->pagecnt_bias--; @@ -6421,9 +6467,8 @@ int nid; int __maybe_unused cpu; pg_data_t *self = data; - static DEFINE_SPINLOCK(lock); - spin_lock(&lock); + write_seqlock(&zonelist_update_seq); #ifdef CONFIG_NUMA memset(node_load, 0, sizeof(node_load)); @@ -6460,7 +6505,7 @@ #endif } - spin_unlock(&lock); + write_sequnlock(&zonelist_update_seq); } static noinline void __init diff -Nru linux-aws-5.19.0/mm/page_isolation.c linux-aws-5.19.0/mm/page_isolation.c --- linux-aws-5.19.0/mm/page_isolation.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/page_isolation.c 2022-11-29 07:06:46.000000000 +0000 @@ -288,6 +288,7 @@ * @isolate_before: isolate the pageblock before the boundary_pfn * @skip_isolation: the flag to skip the pageblock isolation in second * isolate_single_pageblock() + * @migratetype: migrate type to set in error recovery. * * Free and in-use pages can be as big as MAX_ORDER-1 and contain more than one * pageblock. When not all pageblocks within a page are isolated at the same @@ -302,9 +303,9 @@ * the in-use page then splitting the free page. */ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, - gfp_t gfp_flags, bool isolate_before, bool skip_isolation) + gfp_t gfp_flags, bool isolate_before, bool skip_isolation, + int migratetype) { - unsigned char saved_mt; unsigned long start_pfn; unsigned long isolate_pageblock; unsigned long pfn; @@ -328,13 +329,13 @@ start_pfn = max(ALIGN_DOWN(isolate_pageblock, MAX_ORDER_NR_PAGES), zone->zone_start_pfn); - saved_mt = get_pageblock_migratetype(pfn_to_page(isolate_pageblock)); + if (skip_isolation) { + int mt = get_pageblock_migratetype(pfn_to_page(isolate_pageblock)); - if (skip_isolation) - VM_BUG_ON(!is_migrate_isolate(saved_mt)); - else { - ret = set_migratetype_isolate(pfn_to_page(isolate_pageblock), saved_mt, flags, - isolate_pageblock, isolate_pageblock + pageblock_nr_pages); + VM_BUG_ON(!is_migrate_isolate(mt)); + } else { + ret = set_migratetype_isolate(pfn_to_page(isolate_pageblock), migratetype, + flags, isolate_pageblock, isolate_pageblock + pageblock_nr_pages); if (ret) return ret; @@ -475,7 +476,7 @@ failed: /* restore the original migratetype */ if (!skip_isolation) - unset_migratetype_isolate(pfn_to_page(isolate_pageblock), saved_mt); + unset_migratetype_isolate(pfn_to_page(isolate_pageblock), migratetype); return -EBUSY; } @@ -537,7 +538,8 @@ bool skip_isolation = false; /* isolate [isolate_start, isolate_start + pageblock_nr_pages) pageblock */ - ret = isolate_single_pageblock(isolate_start, flags, gfp_flags, false, skip_isolation); + ret = isolate_single_pageblock(isolate_start, flags, gfp_flags, false, + skip_isolation, migratetype); if (ret) return ret; @@ -545,7 +547,8 @@ skip_isolation = true; /* isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock */ - ret = isolate_single_pageblock(isolate_end, flags, gfp_flags, true, skip_isolation); + ret = isolate_single_pageblock(isolate_end, flags, gfp_flags, true, + skip_isolation, migratetype); if (ret) { unset_migratetype_isolate(pfn_to_page(isolate_start), migratetype); return ret; diff -Nru linux-aws-5.19.0/mm/pagewalk.c linux-aws-5.19.0/mm/pagewalk.c --- linux-aws-5.19.0/mm/pagewalk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/pagewalk.c 2022-11-29 07:06:46.000000000 +0000 @@ -110,7 +110,7 @@ do { again: next = pmd_addr_end(addr, end); - if (pmd_none(*pmd) || (!walk->vma && !walk->no_vma)) { + if (pmd_none(*pmd)) { if (ops->pte_hole) err = ops->pte_hole(addr, next, depth, walk); if (err) @@ -171,7 +171,7 @@ do { again: next = pud_addr_end(addr, end); - if (pud_none(*pud) || (!walk->vma && !walk->no_vma)) { + if (pud_none(*pud)) { if (ops->pte_hole) err = ops->pte_hole(addr, next, depth, walk); if (err) @@ -366,19 +366,19 @@ struct vm_area_struct *vma = walk->vma; const struct mm_walk_ops *ops = walk->ops; - if (vma && ops->pre_vma) { + if (ops->pre_vma) { err = ops->pre_vma(start, end, walk); if (err) return err; } - if (vma && is_vm_hugetlb_page(vma)) { + if (is_vm_hugetlb_page(vma)) { if (ops->hugetlb_entry) err = walk_hugetlb_range(start, end, walk); } else err = walk_pgd_range(start, end, walk); - if (vma && ops->post_vma) + if (ops->post_vma) ops->post_vma(walk); return err; @@ -450,9 +450,13 @@ if (!vma) { /* after the last vma */ walk.vma = NULL; next = end; + if (ops->pte_hole) + err = ops->pte_hole(start, next, -1, &walk); } else if (start < vma->vm_start) { /* outside vma */ walk.vma = NULL; next = min(end, vma->vm_start); + if (ops->pte_hole) + err = ops->pte_hole(start, next, -1, &walk); } else { /* inside vma */ walk.vma = vma; next = min(end, vma->vm_end); @@ -470,9 +474,8 @@ } if (err < 0) break; - } - if (walk.vma || walk.ops->pte_hole) err = __walk_page_range(start, next, &walk); + } if (err) break; } while (start = next, start < end); @@ -501,9 +504,9 @@ if (start >= end || !walk.mm) return -EINVAL; - mmap_assert_locked(walk.mm); + mmap_assert_write_locked(walk.mm); - return __walk_page_range(start, end, &walk); + return walk_pgd_range(start, end, &walk); } int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, diff -Nru linux-aws-5.19.0/mm/ptdump.c linux-aws-5.19.0/mm/ptdump.c --- linux-aws-5.19.0/mm/ptdump.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/ptdump.c 2022-11-29 07:06:46.000000000 +0000 @@ -152,13 +152,13 @@ { const struct ptdump_range *range = st->range; - mmap_read_lock(mm); + mmap_write_lock(mm); while (range->start != range->end) { walk_page_range_novma(mm, range->start, range->end, &ptdump_ops, pgd, st); range++; } - mmap_read_unlock(mm); + mmap_write_unlock(mm); /* Flush out the last page */ st->note_page(st, 0, -1, 0); diff -Nru linux-aws-5.19.0/mm/secretmem.c linux-aws-5.19.0/mm/secretmem.c --- linux-aws-5.19.0/mm/secretmem.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/secretmem.c 2022-11-29 07:06:46.000000000 +0000 @@ -283,7 +283,7 @@ secretmem_mnt = kern_mount(&secretmem_fs); if (IS_ERR(secretmem_mnt)) - ret = PTR_ERR(secretmem_mnt); + return PTR_ERR(secretmem_mnt); /* prevent secretmem mappings from ever getting PROT_EXEC */ secretmem_mnt->mnt_flags |= MNT_NOEXEC; diff -Nru linux-aws-5.19.0/mm/slab_common.c linux-aws-5.19.0/mm/slab_common.c --- linux-aws-5.19.0/mm/slab_common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/slab_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -420,6 +420,28 @@ } EXPORT_SYMBOL(kmem_cache_create); +#ifdef SLAB_SUPPORTS_SYSFS +/* + * For a given kmem_cache, kmem_cache_destroy() should only be called + * once or there will be a use-after-free problem. The actual deletion + * and release of the kobject does not need slab_mutex or cpu_hotplug_lock + * protection. So they are now done without holding those locks. + * + * Note that there will be a slight delay in the deletion of sysfs files + * if kmem_cache_release() is called indrectly from a work function. + */ +static void kmem_cache_release(struct kmem_cache *s) +{ + sysfs_slab_unlink(s); + sysfs_slab_release(s); +} +#else +static void kmem_cache_release(struct kmem_cache *s) +{ + slab_kmem_cache_release(s); +} +#endif + static void slab_caches_to_rcu_destroy_workfn(struct work_struct *work) { LIST_HEAD(to_destroy); @@ -446,11 +468,7 @@ list_for_each_entry_safe(s, s2, &to_destroy, list) { debugfs_slab_release(s); kfence_shutdown_cache(s); -#ifdef SLAB_SUPPORTS_SYSFS - sysfs_slab_release(s); -#else - slab_kmem_cache_release(s); -#endif + kmem_cache_release(s); } } @@ -465,20 +483,11 @@ list_del(&s->list); if (s->flags & SLAB_TYPESAFE_BY_RCU) { -#ifdef SLAB_SUPPORTS_SYSFS - sysfs_slab_unlink(s); -#endif list_add_tail(&s->list, &slab_caches_to_rcu_destroy); schedule_work(&slab_caches_to_rcu_destroy_work); } else { kfence_shutdown_cache(s); debugfs_slab_release(s); -#ifdef SLAB_SUPPORTS_SYSFS - sysfs_slab_unlink(s); - sysfs_slab_release(s); -#else - slab_kmem_cache_release(s); -#endif } return 0; @@ -493,14 +502,19 @@ void kmem_cache_destroy(struct kmem_cache *s) { + int refcnt; + bool rcu_set; + if (unlikely(!s) || !kasan_check_byte(s)) return; cpus_read_lock(); mutex_lock(&slab_mutex); - s->refcount--; - if (s->refcount) + rcu_set = s->flags & SLAB_TYPESAFE_BY_RCU; + + refcnt = --s->refcount; + if (refcnt) goto out_unlock; WARN(shutdown_cache(s), @@ -509,6 +523,8 @@ out_unlock: mutex_unlock(&slab_mutex); cpus_read_unlock(); + if (!refcnt && !rcu_set) + kmem_cache_release(s); } EXPORT_SYMBOL(kmem_cache_destroy); diff -Nru linux-aws-5.19.0/mm/slub.c linux-aws-5.19.0/mm/slub.c --- linux-aws-5.19.0/mm/slub.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/slub.c 2022-11-29 07:06:46.000000000 +0000 @@ -310,6 +310,11 @@ */ static nodemask_t slab_nodes; +/* + * Workqueue used for flush_cpu_slab(). + */ +static struct workqueue_struct *flushwq; + /******************************************************************** * Core slab cache functions *******************************************************************/ @@ -2730,7 +2735,7 @@ INIT_WORK(&sfw->work, flush_cpu_slab); sfw->skip = false; sfw->s = s; - schedule_work_on(cpu, &sfw->work); + queue_work_on(cpu, flushwq, &sfw->work); } for_each_online_cpu(cpu) { @@ -4880,6 +4885,8 @@ void __init kmem_cache_init_late(void) { + flushwq = alloc_workqueue("slub_flushwq", WQ_MEM_RECLAIM, 0); + WARN_ON(!flushwq); } struct kmem_cache * @@ -4950,6 +4957,8 @@ /* Honor the call site pointer we received. */ trace_kmalloc(caller, ret, size, s->size, gfpflags); + ret = kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_track_caller); @@ -4981,6 +4990,8 @@ /* Honor the call site pointer we received. */ trace_kmalloc_node(caller, ret, size, s->size, gfpflags, node); + ret = kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_node_track_caller); @@ -5914,7 +5925,8 @@ char *name = kmalloc(ID_STR_LENGTH, GFP_KERNEL); char *p = name; - BUG_ON(!name); + if (!name) + return ERR_PTR(-ENOMEM); *p++ = ':'; /* @@ -5972,6 +5984,8 @@ * for the symlinks. */ name = create_unique_id(s); + if (IS_ERR(name)) + return PTR_ERR(name); } s->kobj.kset = kset; diff -Nru linux-aws-5.19.0/mm/util.c linux-aws-5.19.0/mm/util.c --- linux-aws-5.19.0/mm/util.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/mm/util.c 2022-11-29 07:06:46.000000000 +0000 @@ -619,6 +619,10 @@ if (ret || size <= PAGE_SIZE) return ret; + /* non-sleeping allocations are not supported by vmalloc */ + if (!gfpflags_allow_blocking(flags)) + return NULL; + /* Don't even allow crazy sizes */ if (unlikely(size > INT_MAX)) { WARN_ON_ONCE(!(flags & __GFP_NOWARN)); diff -Nru linux-aws-5.19.0/net/batman-adv/hard-interface.c linux-aws-5.19.0/net/batman-adv/hard-interface.c --- linux-aws-5.19.0/net/batman-adv/hard-interface.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/batman-adv/hard-interface.c 2022-11-29 07:06:46.000000000 +0000 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -700,6 +701,9 @@ int max_header_len = batadv_max_header_len(); int ret; + if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len) + return -EINVAL; + if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) goto out; diff -Nru linux-aws-5.19.0/net/bluetooth/hci_core.c linux-aws-5.19.0/net/bluetooth/hci_core.c --- linux-aws-5.19.0/net/bluetooth/hci_core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/hci_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -596,6 +596,15 @@ /* Cancel these to avoid queueing non-chained pending work */ hci_dev_set_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE); + /* Wait for + * + * if (!hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) + * queue_delayed_work(&hdev->{cmd,ncmd}_timer) + * + * inside RCU section to see the flag or complete scheduling. + */ + synchronize_rcu(); + /* Explicitly cancel works in case scheduled after setting the flag. */ cancel_delayed_work(&hdev->cmd_timer); cancel_delayed_work(&hdev->ncmd_timer); @@ -3361,15 +3370,27 @@ return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); } -static void __check_timeout(struct hci_dev *hdev, unsigned int cnt) +static void __check_timeout(struct hci_dev *hdev, unsigned int cnt, u8 type) { - if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { - /* ACL tx timeout must be longer than maximum - * link supervision timeout (40.9 seconds) */ - if (!cnt && time_after(jiffies, hdev->acl_last_tx + - HCI_ACL_TX_TIMEOUT)) - hci_link_tx_to(hdev, ACL_LINK); + unsigned long last_tx; + + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) + return; + + switch (type) { + case LE_LINK: + last_tx = hdev->le_last_tx; + break; + default: + last_tx = hdev->acl_last_tx; + break; } + + /* tx timeout must be longer than maximum link supervision timeout + * (40.9 seconds) + */ + if (!cnt && time_after(jiffies, last_tx + HCI_ACL_TX_TIMEOUT)) + hci_link_tx_to(hdev, type); } /* Schedule SCO */ @@ -3427,7 +3448,7 @@ struct sk_buff *skb; int quote; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, ACL_LINK); while (hdev->acl_cnt && (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { @@ -3470,8 +3491,6 @@ int quote; u8 type; - __check_timeout(hdev, cnt); - BT_DBG("%s", hdev->name); if (hdev->dev_type == HCI_AMP) @@ -3479,6 +3498,8 @@ else type = ACL_LINK; + __check_timeout(hdev, cnt, type); + while (hdev->block_cnt > 0 && (chan = hci_chan_sent(hdev, type, "e))) { u32 priority = (skb_peek(&chan->data_q))->priority; @@ -3552,7 +3573,7 @@ cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, LE_LINK); tmp = cnt; while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) { @@ -3871,12 +3892,14 @@ if (res < 0) __hci_cmd_sync_cancel(hdev, -res); + rcu_read_lock(); if (test_bit(HCI_RESET, &hdev->flags) || hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) cancel_delayed_work(&hdev->cmd_timer); else - schedule_delayed_work(&hdev->cmd_timer, - HCI_CMD_TIMEOUT); + queue_delayed_work(hdev->workqueue, &hdev->cmd_timer, + HCI_CMD_TIMEOUT); + rcu_read_unlock(); } else { skb_queue_head(&hdev->cmd_q, skb); queue_work(hdev->workqueue, &hdev->cmd_work); diff -Nru linux-aws-5.19.0/net/bluetooth/hci_event.c linux-aws-5.19.0/net/bluetooth/hci_event.c --- linux-aws-5.19.0/net/bluetooth/hci_event.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/hci_event.c 2022-11-29 07:06:46.000000000 +0000 @@ -3763,16 +3763,18 @@ { cancel_delayed_work(&hdev->cmd_timer); + rcu_read_lock(); if (!test_bit(HCI_RESET, &hdev->flags)) { if (ncmd) { cancel_delayed_work(&hdev->ncmd_timer); atomic_set(&hdev->cmd_cnt, 1); } else { if (!hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) - schedule_delayed_work(&hdev->ncmd_timer, - HCI_NCMD_TIMEOUT); + queue_delayed_work(hdev->workqueue, &hdev->ncmd_timer, + HCI_NCMD_TIMEOUT); } } + rcu_read_unlock(); } #define HCI_CC_VL(_op, _func, _min, _max) \ @@ -3998,6 +4000,17 @@ } } + if (i == ARRAY_SIZE(hci_cc_table)) { + /* Unknown opcode, assume byte 0 contains the status, so + * that e.g. __hci_cmd_sync() properly returns errors + * for vendor specific commands send by HCI drivers. + * If a vendor doesn't actually follow this convention we may + * need to introduce a vendor CC table in order to properly set + * the status. + */ + *status = skb->data[0]; + } + handle_cmd_cnt_and_timer(hdev, ev->ncmd); hci_req_cmd_complete(hdev, *opcode, *status, req_complete, @@ -5557,7 +5570,7 @@ */ hci_dev_clear_flag(hdev, HCI_LE_ADV); - conn = hci_lookup_le_connect(hdev); + conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr); if (!conn) { /* In case of error status and there is no connection pending * just unlock as there is nothing to cleanup. diff -Nru linux-aws-5.19.0/net/bluetooth/hci_sync.c linux-aws-5.19.0/net/bluetooth/hci_sync.c --- linux-aws-5.19.0/net/bluetooth/hci_sync.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/hci_sync.c 2022-11-29 07:06:46.000000000 +0000 @@ -4033,6 +4033,7 @@ hci_dev_test_flag(hdev, HCI_MGMT) && hdev->dev_type == HCI_PRIMARY) { ret = hci_powered_update_sync(hdev); + mgmt_power_on(hdev, ret); } } else { /* Init failed, cleanup */ @@ -4452,9 +4453,11 @@ /* Cleanup hci_conn object if it cannot be cancelled as it * likelly means the controller and host stack are out of sync. */ - if (err) + if (err) { + hci_dev_lock(hdev); hci_conn_failed(conn, err); - + hci_dev_unlock(hdev); + } return err; case BT_CONNECT2: return hci_reject_conn_sync(hdev, conn, reason); @@ -4967,17 +4970,21 @@ /* Prevent disconnects from causing scanning to be re-enabled */ hci_pause_scan_sync(hdev); - /* Soft disconnect everything (power off) */ - err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF); - if (err) { - /* Set state to BT_RUNNING so resume doesn't notify */ - hdev->suspend_state = BT_RUNNING; - hci_resume_sync(hdev); - return err; - } + if (hci_conn_count(hdev)) { + /* Soft disconnect everything (power off) */ + err = hci_disconnect_all_sync(hdev, HCI_ERROR_REMOTE_POWER_OFF); + if (err) { + /* Set state to BT_RUNNING so resume doesn't notify */ + hdev->suspend_state = BT_RUNNING; + hci_resume_sync(hdev); + return err; + } - /* Update event mask so only the allowed event can wakeup the host */ - hci_set_event_mask_sync(hdev); + /* Update event mask so only the allowed event can wakeup the + * host. + */ + hci_set_event_mask_sync(hdev); + } /* Only configure accept list if disconnect succeeded and wake * isn't being prevented. diff -Nru linux-aws-5.19.0/net/bluetooth/hci_sysfs.c linux-aws-5.19.0/net/bluetooth/hci_sysfs.c --- linux-aws-5.19.0/net/bluetooth/hci_sysfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/hci_sysfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -48,6 +48,9 @@ BT_DBG("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) { diff -Nru linux-aws-5.19.0/net/bluetooth/l2cap_core.c linux-aws-5.19.0/net/bluetooth/l2cap_core.c --- linux-aws-5.19.0/net/bluetooth/l2cap_core.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/l2cap_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -61,6 +61,9 @@ static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control, struct sk_buff_head *skbs, u8 event); +static void l2cap_retrans_timeout(struct work_struct *work); +static void l2cap_monitor_timeout(struct work_struct *work); +static void l2cap_ack_timeout(struct work_struct *work); static inline u8 bdaddr_type(u8 link_type, u8 bdaddr_type) { @@ -476,6 +479,9 @@ write_unlock(&chan_list_lock); INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout); + INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); + INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); + INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); chan->state = BT_OPEN; @@ -3319,10 +3325,6 @@ chan->rx_state = L2CAP_RX_STATE_RECV; chan->tx_state = L2CAP_TX_STATE_XMIT; - INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); - INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); - INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); - skb_queue_head_init(&chan->srej_q); err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win); @@ -4306,6 +4308,12 @@ } } + chan = l2cap_chan_hold_unless_zero(chan); + if (!chan) { + err = -EBADSLT; + goto unlock; + } + err = 0; l2cap_chan_lock(chan); @@ -4335,6 +4343,7 @@ } l2cap_chan_unlock(chan); + l2cap_chan_put(chan); unlock: mutex_unlock(&conn->chan_lock); diff -Nru linux-aws-5.19.0/net/bluetooth/mgmt.c linux-aws-5.19.0/net/bluetooth/mgmt.c --- linux-aws-5.19.0/net/bluetooth/mgmt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/mgmt.c 2022-11-29 07:06:46.000000000 +0000 @@ -4420,6 +4420,22 @@ MGMT_STATUS_NOT_SUPPORTED); } +static u32 get_params_flags(struct hci_dev *hdev, + struct hci_conn_params *params) +{ + u32 flags = hdev->conn_flags; + + /* Devices using RPAs can only be programmed in the acceptlist if + * LL Privacy has been enable otherwise they cannot mark + * HCI_CONN_FLAG_REMOTE_WAKEUP. + */ + if ((flags & HCI_CONN_FLAG_REMOTE_WAKEUP) && !use_ll_privacy(hdev) && + hci_find_irk_by_addr(hdev, ¶ms->addr, params->addr_type)) + flags &= ~HCI_CONN_FLAG_REMOTE_WAKEUP; + + return flags; +} + static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data, u16 data_len) { @@ -4451,10 +4467,10 @@ } else { params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr, le_addr_type(cp->addr.type)); - if (!params) goto done; + supported_flags = get_params_flags(hdev, params); current_flags = params->flags; } @@ -4523,38 +4539,35 @@ bt_dev_warn(hdev, "No such BR/EDR device %pMR (0x%x)", &cp->addr.bdaddr, cp->addr.type); } - } else { - params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr, - le_addr_type(cp->addr.type)); - if (params) { - /* Devices using RPAs can only be programmed in the - * acceptlist LL Privacy has been enable otherwise they - * cannot mark HCI_CONN_FLAG_REMOTE_WAKEUP. - */ - if ((current_flags & HCI_CONN_FLAG_REMOTE_WAKEUP) && - !use_ll_privacy(hdev) && - hci_find_irk_by_addr(hdev, ¶ms->addr, - params->addr_type)) { - bt_dev_warn(hdev, - "Cannot set wakeable for RPA"); - goto unlock; - } - params->flags = current_flags; - status = MGMT_STATUS_SUCCESS; + goto unlock; + } - /* Update passive scan if HCI_CONN_FLAG_DEVICE_PRIVACY - * has been set. - */ - if (params->flags & HCI_CONN_FLAG_DEVICE_PRIVACY) - hci_update_passive_scan(hdev); - } else { - bt_dev_warn(hdev, "No such LE device %pMR (0x%x)", - &cp->addr.bdaddr, - le_addr_type(cp->addr.type)); - } + params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr, + le_addr_type(cp->addr.type)); + if (!params) { + bt_dev_warn(hdev, "No such LE device %pMR (0x%x)", + &cp->addr.bdaddr, le_addr_type(cp->addr.type)); + goto unlock; } + supported_flags = get_params_flags(hdev, params); + + if ((supported_flags | current_flags) != supported_flags) { + bt_dev_warn(hdev, "Bad flag given (0x%x) vs supported (0x%0x)", + current_flags, supported_flags); + goto unlock; + } + + params->flags = current_flags; + status = MGMT_STATUS_SUCCESS; + + /* Update passive scan if HCI_CONN_FLAG_DEVICE_PRIVACY + * has been set. + */ + if (params->flags & HCI_CONN_FLAG_DEVICE_PRIVACY) + hci_update_passive_scan(hdev); + unlock: hci_dev_unlock(hdev); diff -Nru linux-aws-5.19.0/net/bluetooth/rfcomm/sock.c linux-aws-5.19.0/net/bluetooth/rfcomm/sock.c --- linux-aws-5.19.0/net/bluetooth/rfcomm/sock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/bluetooth/rfcomm/sock.c 2022-11-29 07:06:46.000000000 +0000 @@ -902,7 +902,10 @@ lock_sock(sk); if (!sk->sk_shutdown) { sk->sk_shutdown = SHUTDOWN_MASK; + + release_sock(sk); __rfcomm_sock_close(sk); + lock_sock(sk); if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && !(current->flags & PF_EXITING)) diff -Nru linux-aws-5.19.0/net/bridge/br_netfilter_hooks.c linux-aws-5.19.0/net/bridge/br_netfilter_hooks.c --- linux-aws-5.19.0/net/bridge/br_netfilter_hooks.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/bridge/br_netfilter_hooks.c 2022-11-29 07:06:46.000000000 +0000 @@ -384,6 +384,7 @@ /* - Bridged-and-DNAT'ed traffic doesn't * require ip_forwarding. */ if (rt->dst.dev == dev) { + skb_dst_drop(skb); skb_dst_set(skb, &rt->dst); goto bridged_dnat; } @@ -413,6 +414,7 @@ kfree_skb(skb); return 0; } + skb_dst_drop(skb); skb_dst_set_noref(skb, &rt->dst); } diff -Nru linux-aws-5.19.0/net/bridge/br_netfilter_ipv6.c linux-aws-5.19.0/net/bridge/br_netfilter_ipv6.c --- linux-aws-5.19.0/net/bridge/br_netfilter_ipv6.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/bridge/br_netfilter_ipv6.c 2022-11-29 07:06:46.000000000 +0000 @@ -197,6 +197,7 @@ kfree_skb(skb); return 0; } + skb_dst_drop(skb); skb_dst_set_noref(skb, &rt->dst); } diff -Nru linux-aws-5.19.0/net/bridge/netfilter/ebtables.c linux-aws-5.19.0/net/bridge/netfilter/ebtables.c --- linux-aws-5.19.0/net/bridge/netfilter/ebtables.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/bridge/netfilter/ebtables.c 2022-11-29 07:06:46.000000000 +0000 @@ -1040,8 +1040,10 @@ goto free_iterate; } - if (repl->valid_hooks != t->valid_hooks) + if (repl->valid_hooks != t->valid_hooks) { + ret = -EINVAL; goto free_unlock; + } if (repl->num_counters && repl->num_counters != t->private->nentries) { ret = -EINVAL; diff -Nru linux-aws-5.19.0/net/can/bcm.c linux-aws-5.19.0/net/can/bcm.c --- linux-aws-5.19.0/net/can/bcm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/can/bcm.c 2022-11-29 07:06:46.000000000 +0000 @@ -274,6 +274,7 @@ struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; + int err; /* no target device? => exit */ if (!op->ifindex) @@ -298,11 +299,11 @@ /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) diff -Nru linux-aws-5.19.0/net/core/datagram.c linux-aws-5.19.0/net/core/datagram.c --- linux-aws-5.19.0/net/core/datagram.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/core/datagram.c 2022-11-29 07:06:46.000000000 +0000 @@ -675,7 +675,7 @@ page_ref_sub(last_head, refs); refs = 0; } - skb_fill_page_desc(skb, frag++, head, start, size); + skb_fill_page_desc_noacc(skb, frag++, head, start, size); } if (refs) page_ref_sub(last_head, refs); diff -Nru linux-aws-5.19.0/net/core/flow_dissector.c linux-aws-5.19.0/net/core/flow_dissector.c --- linux-aws-5.19.0/net/core/flow_dissector.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/core/flow_dissector.c 2022-11-29 07:06:46.000000000 +0000 @@ -1168,8 +1168,8 @@ nhoff += sizeof(*vlan); } - if (dissector_uses_key(flow_dissector, - FLOW_DISSECTOR_KEY_NUM_OF_VLANS)) { + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_NUM_OF_VLANS) && + !(key_control->flags & FLOW_DIS_ENCAPSULATION)) { struct flow_dissector_key_num_of_vlans *key_nvs; key_nvs = skb_flow_dissector_target(flow_dissector, @@ -1572,9 +1572,8 @@ switch (keys->control.addr_type) { case FLOW_DISSECTOR_KEY_IPV4_ADDRS: - addr_diff = (__force u32)keys->addrs.v4addrs.dst - - (__force u32)keys->addrs.v4addrs.src; - if (addr_diff < 0) + if ((__force u32)keys->addrs.v4addrs.dst < + (__force u32)keys->addrs.v4addrs.src) swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst); if ((__force u16)keys->ports.dst < diff -Nru linux-aws-5.19.0/net/core/skbuff.c linux-aws-5.19.0/net/core/skbuff.c --- linux-aws-5.19.0/net/core/skbuff.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/core/skbuff.c 2022-11-29 07:06:46.000000000 +0000 @@ -4179,9 +4179,8 @@ SKB_GSO_CB(nskb)->csum_start = skb_headroom(nskb) + doffset; } else { - skb_copy_bits(head_skb, offset, - skb_put(nskb, len), - len); + if (skb_copy_bits(head_skb, offset, skb_put(nskb, len), len)) + goto err; } continue; } diff -Nru linux-aws-5.19.0/net/core/skmsg.c linux-aws-5.19.0/net/core/skmsg.c --- linux-aws-5.19.0/net/core/skmsg.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/core/skmsg.c 2022-11-29 07:06:46.000000000 +0000 @@ -435,8 +435,10 @@ if (copied + copy > len) copy = len - copied; copy = copy_page_to_iter(page, sge->offset, copy, iter); - if (!copy) - return copied ? copied : -EFAULT; + if (!copy) { + copied = copied ? copied : -EFAULT; + goto out; + } copied += copy; if (likely(!peek)) { @@ -456,13 +458,13 @@ * didn't copy the entire length lets just break. */ if (copy != sge->length) - return copied; + goto out; sk_msg_iter_var_next(i); } if (copied == len) break; - } while (!sg_is_last(sge)); + } while ((i != msg_rx->sg.end) && !sg_is_last(sge)); if (unlikely(peek)) { msg_rx = sk_psock_next_msg(psock, msg_rx); @@ -472,13 +474,15 @@ } msg_rx->sg.start = i; - if (!sge->length && sg_is_last(sge)) { + if (!sge->length && (i == msg_rx->sg.end || sg_is_last(sge))) { msg_rx = sk_psock_dequeue_msg(psock); kfree_sk_msg(msg_rx); } msg_rx = sk_psock_peek_msg(psock); } - +out: + if (psock->work_state.skb && copied > 0) + schedule_work(&psock->work); return copied; } EXPORT_SYMBOL_GPL(sk_msg_recvmsg); diff -Nru linux-aws-5.19.0/net/core/stream.c linux-aws-5.19.0/net/core/stream.c --- linux-aws-5.19.0/net/core/stream.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/core/stream.c 2022-11-29 07:06:46.000000000 +0000 @@ -159,7 +159,8 @@ *timeo_p = current_timeo; } out: - remove_wait_queue(sk_sleep(sk), &wait); + if (!sock_flag(sk, SOCK_DEAD)) + remove_wait_queue(sk_sleep(sk), &wait); return err; do_error: diff -Nru linux-aws-5.19.0/net/dsa/tag_hellcreek.c linux-aws-5.19.0/net/dsa/tag_hellcreek.c --- linux-aws-5.19.0/net/dsa/tag_hellcreek.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/dsa/tag_hellcreek.c 2022-11-29 07:06:46.000000000 +0000 @@ -45,7 +45,7 @@ skb->dev = dsa_master_find_slave(dev, 0, port); if (!skb->dev) { - netdev_warn(dev, "Failed to get source port: %d\n", port); + netdev_warn_once(dev, "Failed to get source port: %d\n", port); return NULL; } diff -Nru linux-aws-5.19.0/net/ieee802154/socket.c linux-aws-5.19.0/net/ieee802154/socket.c --- linux-aws-5.19.0/net/ieee802154/socket.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ieee802154/socket.c 2022-11-29 07:06:46.000000000 +0000 @@ -200,8 +200,9 @@ int err = 0; struct net_device *dev = NULL; - if (len < sizeof(*uaddr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(uaddr, len); + if (err < 0) + return err; uaddr = (struct sockaddr_ieee802154 *)_uaddr; if (uaddr->family != AF_IEEE802154) @@ -271,6 +272,10 @@ err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; @@ -493,7 +498,8 @@ ro->bound = 0; - if (len < sizeof(*addr)) + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) goto out; if (addr->family != AF_IEEE802154) @@ -564,8 +570,9 @@ struct dgram_sock *ro = dgram_sk(sk); int err = 0; - if (len < sizeof(*addr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) + return err; if (addr->family != AF_IEEE802154) return -EINVAL; @@ -604,6 +611,7 @@ struct ieee802154_mac_cb *cb; struct dgram_sock *ro = dgram_sk(sk); struct ieee802154_addr dst_addr; + DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); int hlen, tlen; int err; @@ -612,10 +620,20 @@ return -EOPNOTSUPP; } - if (!ro->connected && !msg->msg_name) - return -EDESTADDRREQ; - else if (ro->connected && msg->msg_name) - return -EISCONN; + if (msg->msg_name) { + if (ro->connected) + return -EISCONN; + if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) + return -EINVAL; + err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); + if (err < 0) + return err; + ieee802154_addr_from_sa(&dst_addr, &daddr->addr); + } else { + if (!ro->connected) + return -EDESTADDRREQ; + dst_addr = ro->dst_addr; + } if (!ro->bound) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); @@ -651,16 +669,6 @@ cb = mac_cb_init(skb); cb->type = IEEE802154_FC_TYPE_DATA; cb->ackreq = ro->want_ack; - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_ieee802154*, - daddr, msg->msg_name); - - ieee802154_addr_from_sa(&dst_addr, &daddr->addr); - } else { - dst_addr = ro->dst_addr; - } - cb->secen = ro->secen; cb->secen_override = ro->secen_override; cb->seclevel = ro->seclevel; diff -Nru linux-aws-5.19.0/net/ipv4/datagram.c linux-aws-5.19.0/net/ipv4/datagram.c --- linux-aws-5.19.0/net/ipv4/datagram.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/datagram.c 2022-11-29 07:06:46.000000000 +0000 @@ -42,6 +42,8 @@ oif = inet->mc_index; if (!saddr) saddr = inet->mc_addr; + } else if (!oif) { + oif = inet->uc_index; } fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif, diff -Nru linux-aws-5.19.0/net/ipv4/esp4_offload.c linux-aws-5.19.0/net/ipv4/esp4_offload.c --- linux-aws-5.19.0/net/ipv4/esp4_offload.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/esp4_offload.c 2022-11-29 07:06:46.000000000 +0000 @@ -110,7 +110,10 @@ struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IP)); + __be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6) + : htons(ETH_P_IP); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm4_transport_gso_segment(struct xfrm_state *x, diff -Nru linux-aws-5.19.0/net/ipv4/fib_frontend.c linux-aws-5.19.0/net/ipv4/fib_frontend.c --- linux-aws-5.19.0/net/ipv4/fib_frontend.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/fib_frontend.c 2022-11-29 07:06:46.000000000 +0000 @@ -389,7 +389,7 @@ dev_match = dev_match || (res.type == RTN_LOCAL && dev == net->loopback_dev); if (dev_match) { - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; return ret; } if (no_addr) @@ -401,7 +401,7 @@ ret = 0; if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) { if (res.type == RTN_UNICAST) - ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_HOST; + ret = FIB_RES_NHC(res)->nhc_scope >= RT_SCOPE_LINK; } return ret; diff -Nru linux-aws-5.19.0/net/ipv4/inet_hashtables.c linux-aws-5.19.0/net/ipv4/inet_hashtables.c --- linux-aws-5.19.0/net/ipv4/inet_hashtables.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/inet_hashtables.c 2022-11-29 07:06:46.000000000 +0000 @@ -729,8 +729,8 @@ if (likely(remaining > 1)) remaining &= ~1U; - net_get_random_once(table_perturb, - INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); + get_random_slow_once(table_perturb, + INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); index = port_offset & (INET_TABLE_PERTURB_SIZE - 1); offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); diff -Nru linux-aws-5.19.0/net/ipv4/ip_gre.c linux-aws-5.19.0/net/ipv4/ip_gre.c --- linux-aws-5.19.0/net/ipv4/ip_gre.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/ip_gre.c 2022-11-29 07:06:46.000000000 +0000 @@ -609,7 +609,7 @@ ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, tunnel_id_to_key32(key->tun_id), key->tos & ~INET_ECN_MASK, dev_net(dev), 0, - skb->mark, skb_get_hash(skb)); + skb->mark, skb_get_hash(skb), key->flow_flags); rt = ip_route_output_key(dev_net(dev), &fl4); if (IS_ERR(rt)) return PTR_ERR(rt); diff -Nru linux-aws-5.19.0/net/ipv4/ip_output.c linux-aws-5.19.0/net/ipv4/ip_output.c --- linux-aws-5.19.0/net/ipv4/ip_output.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/ip_output.c 2022-11-29 07:06:46.000000000 +0000 @@ -1704,7 +1704,7 @@ tcp_hdr(skb)->source, tcp_hdr(skb)->dest, arg->uid); security_skb_classify_flow(skb, flowi4_to_flowi_common(&fl4)); - rt = ip_route_output_key(net, &fl4); + rt = ip_route_output_flow(net, &fl4, sk); if (IS_ERR(rt)) return; diff -Nru linux-aws-5.19.0/net/ipv4/ip_tunnel.c linux-aws-5.19.0/net/ipv4/ip_tunnel.c --- linux-aws-5.19.0/net/ipv4/ip_tunnel.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/ip_tunnel.c 2022-11-29 07:06:46.000000000 +0000 @@ -295,7 +295,7 @@ ip_tunnel_init_flow(&fl4, iph->protocol, iph->daddr, iph->saddr, tunnel->parms.o_key, RT_TOS(iph->tos), dev_net(dev), - tunnel->parms.link, tunnel->fwmark, 0); + tunnel->parms.link, tunnel->fwmark, 0, 0); rt = ip_route_output_key(tunnel->net, &fl4); if (!IS_ERR(rt)) { @@ -570,7 +570,8 @@ } ip_tunnel_init_flow(&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src, tunnel_id_to_key32(key->tun_id), RT_TOS(tos), - dev_net(dev), 0, skb->mark, skb_get_hash(skb)); + dev_net(dev), 0, skb->mark, skb_get_hash(skb), + key->flow_flags); if (tunnel->encap.type != TUNNEL_ENCAP_NONE) goto tx_error; @@ -728,7 +729,7 @@ ip_tunnel_init_flow(&fl4, protocol, dst, tnl_params->saddr, tunnel->parms.o_key, RT_TOS(tos), dev_net(dev), tunnel->parms.link, - tunnel->fwmark, skb_get_hash(skb)); + tunnel->fwmark, skb_get_hash(skb), 0); if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0) goto tx_error; diff -Nru linux-aws-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c linux-aws-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c --- linux-aws-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c 2022-11-29 07:06:46.000000000 +0000 @@ -83,6 +83,9 @@ else oif = NULL; + if (priv->flags & NFTA_FIB_F_IIF) + fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif); + if (nft_hook(pkt) == NF_INET_PRE_ROUTING && nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { nft_fib_store_result(dest, priv, nft_in(pkt)); diff -Nru linux-aws-5.19.0/net/ipv4/tcp.c linux-aws-5.19.0/net/ipv4/tcp.c --- linux-aws-5.19.0/net/ipv4/tcp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1015,7 +1015,7 @@ skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); } else { get_page(page); - skb_fill_page_desc(skb, i, page, offset, copy); + skb_fill_page_desc_noacc(skb, i, page, offset, copy); } if (!(flags & MSG_NO_SHARED_FRAGS)) @@ -3042,6 +3042,8 @@ tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tcp_snd_cwnd_set(tp, TCP_INIT_CWND); tp->snd_cwnd_cnt = 0; + tp->is_cwnd_limited = 0; + tp->max_packets_out = 0; tp->window_clamp = 0; tp->delivered = 0; tp->delivered_ce = 0; @@ -4349,12 +4351,16 @@ * to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb(); - tcp_md5sig_pool_populated = true; + /* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() + * and tcp_get_md5sig_pool(). + */ + WRITE_ONCE(tcp_md5sig_pool_populated, true); } bool tcp_alloc_md5sig_pool(void) { - if (unlikely(!tcp_md5sig_pool_populated)) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (unlikely(!READ_ONCE(tcp_md5sig_pool_populated))) { mutex_lock(&tcp_md5sig_mutex); if (!tcp_md5sig_pool_populated) { @@ -4365,7 +4371,8 @@ mutex_unlock(&tcp_md5sig_mutex); } - return tcp_md5sig_pool_populated; + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + return READ_ONCE(tcp_md5sig_pool_populated); } EXPORT_SYMBOL(tcp_alloc_md5sig_pool); @@ -4381,7 +4388,8 @@ { local_bh_disable(); - if (tcp_md5sig_pool_populated) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (READ_ONCE(tcp_md5sig_pool_populated)) { /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb(); return this_cpu_ptr(&tcp_md5sig_pool); diff -Nru linux-aws-5.19.0/net/ipv4/tcp_input.c linux-aws-5.19.0/net/ipv4/tcp_input.c --- linux-aws-5.19.0/net/ipv4/tcp_input.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/tcp_input.c 2022-11-29 07:06:46.000000000 +0000 @@ -2514,6 +2514,21 @@ return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp)); } +static bool tcp_is_non_sack_preventing_reopen(struct sock *sk) +{ + struct tcp_sock *tp = tcp_sk(sk); + + if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { + /* Hold old state until something *above* high_seq + * is ACKed. For Reno it is MUST to prevent false + * fast retransmits (RFC2582). SACK TCP is safe. */ + if (!tcp_any_retrans_done(sk)) + tp->retrans_stamp = 0; + return true; + } + return false; +} + /* People celebrate: "We love our President!" */ static bool tcp_try_undo_recovery(struct sock *sk) { @@ -2536,14 +2551,8 @@ } else if (tp->rack.reo_wnd_persist) { tp->rack.reo_wnd_persist--; } - if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { - /* Hold old state until something *above* high_seq - * is ACKed. For Reno it is MUST to prevent false - * fast retransmits (RFC2582). SACK TCP is safe. */ - if (!tcp_any_retrans_done(sk)) - tp->retrans_stamp = 0; + if (tcp_is_non_sack_preventing_reopen(sk)) return true; - } tcp_set_ca_state(sk, TCP_CA_Open); tp->is_sack_reneg = 0; return false; @@ -2579,6 +2588,8 @@ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSPURIOUSRTOS); inet_csk(sk)->icsk_retransmits = 0; + if (tcp_is_non_sack_preventing_reopen(sk)) + return true; if (frto_undo || tcp_is_sack(tp)) { tcp_set_ca_state(sk, TCP_CA_Open); tp->is_sack_reneg = 0; @@ -3630,11 +3641,11 @@ /* Then check host-wide RFC 5961 rate limit. */ now = jiffies / HZ; - if (now != challenge_timestamp) { + if (now != READ_ONCE(challenge_timestamp)) { u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit); u32 half = (ack_limit + 1) >> 1; - challenge_timestamp = now; + WRITE_ONCE(challenge_timestamp, now); WRITE_ONCE(challenge_count, half + prandom_u32_max(ack_limit)); } count = READ_ONCE(challenge_count); diff -Nru linux-aws-5.19.0/net/ipv4/tcp_ipv4.c linux-aws-5.19.0/net/ipv4/tcp_ipv4.c --- linux-aws-5.19.0/net/ipv4/tcp_ipv4.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/tcp_ipv4.c 2022-11-29 07:06:46.000000000 +0000 @@ -819,6 +819,7 @@ ctl_sk->sk_priority = (sk->sk_state == TCP_TIME_WAIT) ? inet_twsk(sk)->tw_priority : sk->sk_priority; transmit_time = tcp_transmit_time(sk); + xfrm_sk_clone_policy(ctl_sk, sk); } ip_send_unicast_reply(ctl_sk, skb, &TCP_SKB_CB(skb)->header.h4.opt, @@ -827,6 +828,7 @@ transmit_time); ctl_sk->sk_mark = 0; + xfrm_sk_free_policy(ctl_sk); sock_net_set(ctl_sk, &init_net); __TCP_INC_STATS(net, TCP_MIB_OUTSEGS); __TCP_INC_STATS(net, TCP_MIB_OUTRSTS); diff -Nru linux-aws-5.19.0/net/ipv4/tcp_output.c linux-aws-5.19.0/net/ipv4/tcp_output.c --- linux-aws-5.19.0/net/ipv4/tcp_output.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/tcp_output.c 2022-11-29 07:06:46.000000000 +0000 @@ -1875,15 +1875,20 @@ const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; struct tcp_sock *tp = tcp_sk(sk); - /* Track the maximum number of outstanding packets in each - * window, and remember whether we were cwnd-limited then. + /* Track the strongest available signal of the degree to which the cwnd + * is fully utilized. If cwnd-limited then remember that fact for the + * current window. If not cwnd-limited then track the maximum number of + * outstanding packets in the current window. (If cwnd-limited then we + * chose to not update tp->max_packets_out to avoid an extra else + * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->max_packets_seq) || - tp->packets_out > tp->max_packets_out || - is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; + if (!before(tp->snd_una, tp->cwnd_usage_seq) || + is_cwnd_limited || + (!tp->is_cwnd_limited && + tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; + tp->max_packets_out = tp->packets_out; + tp->cwnd_usage_seq = tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) { diff -Nru linux-aws-5.19.0/net/ipv4/udp.c linux-aws-5.19.0/net/ipv4/udp.c --- linux-aws-5.19.0/net/ipv4/udp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/udp.c 2022-11-29 07:06:46.000000000 +0000 @@ -781,6 +781,8 @@ */ if (tunnel) { /* ...not for tunnels though: we don't have a sending socket */ + if (udp_sk(sk)->encap_err_rcv) + udp_sk(sk)->encap_err_rcv(sk, skb, iph->ihl << 2); goto out; } if (!inet->recverr) { diff -Nru linux-aws-5.19.0/net/ipv4/udp_tunnel_core.c linux-aws-5.19.0/net/ipv4/udp_tunnel_core.c --- linux-aws-5.19.0/net/ipv4/udp_tunnel_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv4/udp_tunnel_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -72,6 +72,7 @@ udp_sk(sk)->encap_type = cfg->encap_type; udp_sk(sk)->encap_rcv = cfg->encap_rcv; + udp_sk(sk)->encap_err_rcv = cfg->encap_err_rcv; udp_sk(sk)->encap_err_lookup = cfg->encap_err_lookup; udp_sk(sk)->encap_destroy = cfg->encap_destroy; udp_sk(sk)->gro_receive = cfg->gro_receive; diff -Nru linux-aws-5.19.0/net/ipv6/addrconf.c linux-aws-5.19.0/net/ipv6/addrconf.c --- linux-aws-5.19.0/net/ipv6/addrconf.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/addrconf.c 2022-11-29 07:06:46.000000000 +0000 @@ -3557,11 +3557,15 @@ fallthrough; case NETDEV_UP: case NETDEV_CHANGE: - if (dev->flags & IFF_SLAVE) + if (idev && idev->cnf.disable_ipv6) break; - if (idev && idev->cnf.disable_ipv6) + if (dev->flags & IFF_SLAVE) { + if (event == NETDEV_UP && !IS_ERR_OR_NULL(idev) && + dev->flags & IFF_UP && dev->flags & IFF_MULTICAST) + ipv6_mc_up(idev); break; + } if (event == NETDEV_UP) { /* restore routes for permanent addresses */ diff -Nru linux-aws-5.19.0/net/ipv6/af_inet6.c linux-aws-5.19.0/net/ipv6/af_inet6.c --- linux-aws-5.19.0/net/ipv6/af_inet6.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/af_inet6.c 2022-11-29 07:06:46.000000000 +0000 @@ -1069,13 +1069,13 @@ for (r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) INIT_LIST_HEAD(r); + raw_hashinfo_init(&raw_v6_hashinfo); + if (disable_ipv6_mod) { pr_info("Loaded, but administratively disabled, reboot required to enable\n"); goto out; } - raw_hashinfo_init(&raw_v6_hashinfo); - err = proto_register(&tcpv6_prot, 1); if (err) goto out; diff -Nru linux-aws-5.19.0/net/ipv6/esp6_offload.c linux-aws-5.19.0/net/ipv6/esp6_offload.c --- linux-aws-5.19.0/net/ipv6/esp6_offload.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/esp6_offload.c 2022-11-29 07:06:46.000000000 +0000 @@ -145,7 +145,10 @@ struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IPV6)); + __be16 type = x->inner_mode.family == AF_INET ? htons(ETH_P_IP) + : htons(ETH_P_IPV6); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm6_transport_gso_segment(struct xfrm_state *x, diff -Nru linux-aws-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c linux-aws-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c --- linux-aws-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c 2022-11-29 07:06:46.000000000 +0000 @@ -41,6 +41,9 @@ if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); + } else if ((priv->flags & NFTA_FIB_F_IIF) && + (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) { + fl6->flowi6_oif = dev->ifindex; } if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) @@ -197,7 +200,8 @@ if (rt->rt6i_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) goto put_rt_err; - if (oif && oif != rt->rt6i_idev->dev) + if (oif && oif != rt->rt6i_idev->dev && + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err; nft_fib_store_result(dest, priv, rt->rt6i_idev->dev); diff -Nru linux-aws-5.19.0/net/ipv6/seg6.c linux-aws-5.19.0/net/ipv6/seg6.c --- linux-aws-5.19.0/net/ipv6/seg6.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/seg6.c 2022-11-29 07:06:46.000000000 +0000 @@ -191,6 +191,11 @@ goto out_unlock; } + if (slen > nla_len(info->attrs[SEG6_ATTR_SECRET])) { + err = -EINVAL; + goto out_unlock; + } + if (hinfo) { err = seg6_hmac_info_del(net, hmackeyid); if (err) diff -Nru linux-aws-5.19.0/net/ipv6/tcp_ipv6.c linux-aws-5.19.0/net/ipv6/tcp_ipv6.c --- linux-aws-5.19.0/net/ipv6/tcp_ipv6.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/tcp_ipv6.c 2022-11-29 07:06:46.000000000 +0000 @@ -954,7 +954,10 @@ * Underlying function will use this to retrieve the network * namespace */ - dst = ip6_dst_lookup_flow(sock_net(ctl_sk), ctl_sk, &fl6, NULL); + if (sk && sk->sk_state != TCP_TIME_WAIT) + dst = ip6_dst_lookup_flow(net, sk, &fl6, NULL); /*sk's xfrm_policy can be referred*/ + else + dst = ip6_dst_lookup_flow(net, ctl_sk, &fl6, NULL); if (!IS_ERR(dst)) { skb_dst_set(buff, dst); ip6_xmit(ctl_sk, buff, &fl6, fl6.flowi6_mark, NULL, diff -Nru linux-aws-5.19.0/net/ipv6/udp.c linux-aws-5.19.0/net/ipv6/udp.c --- linux-aws-5.19.0/net/ipv6/udp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/ipv6/udp.c 2022-11-29 07:06:46.000000000 +0000 @@ -616,8 +616,11 @@ } /* Tunnels don't have an application socket: don't pass errors back */ - if (tunnel) + if (tunnel) { + if (udp_sk(sk)->encap_err_rcv) + udp_sk(sk)->encap_err_rcv(sk, skb, offset); goto out; + } if (!np->recverr) { if (!harderr || sk->sk_state != TCP_ESTABLISHED) diff -Nru linux-aws-5.19.0/net/kcm/kcmsock.c linux-aws-5.19.0/net/kcm/kcmsock.c --- linux-aws-5.19.0/net/kcm/kcmsock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/kcm/kcmsock.c 2022-11-29 07:06:46.000000000 +0000 @@ -1412,12 +1412,6 @@ psock->sk = csk; psock->bpf_prog = prog; - err = strp_init(&psock->strp, csk, &cb); - if (err) { - kmem_cache_free(kcm_psockp, psock); - goto out; - } - write_lock_bh(&csk->sk_callback_lock); /* Check if sk_user_data is already by KCM or someone else. @@ -1425,13 +1419,18 @@ */ if (csk->sk_user_data) { write_unlock_bh(&csk->sk_callback_lock); - strp_stop(&psock->strp); - strp_done(&psock->strp); kmem_cache_free(kcm_psockp, psock); err = -EALREADY; goto out; } + err = strp_init(&psock->strp, csk, &cb); + if (err) { + write_unlock_bh(&csk->sk_callback_lock); + kmem_cache_free(kcm_psockp, psock); + goto out; + } + psock->save_data_ready = csk->sk_data_ready; psock->save_write_space = csk->sk_write_space; psock->save_state_change = csk->sk_state_change; diff -Nru linux-aws-5.19.0/net/mac80211/cfg.c linux-aws-5.19.0/net/mac80211/cfg.c --- linux-aws-5.19.0/net/mac80211/cfg.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/cfg.c 2022-11-29 07:06:46.000000000 +0000 @@ -3545,9 +3545,6 @@ case NL80211_IFTYPE_MESH_POINT: { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - if (params->chandef.width != sdata->vif.bss_conf.chandef.width) - return -EINVAL; - /* changes into another band are not supported */ if (sdata->vif.bss_conf.chandef.chan->band != params->chandef.chan->band) diff -Nru linux-aws-5.19.0/net/mac80211/ibss.c linux-aws-5.19.0/net/mac80211/ibss.c --- linux-aws-5.19.0/net/mac80211/ibss.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/ibss.c 2022-11-29 07:06:46.000000000 +0000 @@ -534,6 +534,10 @@ sdata_assert_lock(sdata); + /* When not connected/joined, sending CSA doesn't make sense. */ + if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) + return -ENOLINK; + /* update cfg80211 bss information with the new channel */ if (!is_zero_ether_addr(ifibss->bssid)) { cbss = cfg80211_get_bss(sdata->local->hw.wiphy, diff -Nru linux-aws-5.19.0/net/mac80211/rc80211_minstrel_ht.c linux-aws-5.19.0/net/mac80211/rc80211_minstrel_ht.c --- linux-aws-5.19.0/net/mac80211/rc80211_minstrel_ht.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/rc80211_minstrel_ht.c 2022-11-29 07:06:46.000000000 +0000 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "rate.h" #include "sta_info.h" @@ -1550,6 +1551,7 @@ { struct ieee80211_sta_rates *rates; int i = 0; + int max_rates = min_t(int, mp->hw->max_rates, IEEE80211_TX_RATE_TABLE_SIZE); rates = kzalloc(sizeof(*rates), GFP_ATOMIC); if (!rates) @@ -1559,10 +1561,10 @@ minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]); /* Fill up remaining, keep one entry for max_probe_rate */ - for (; i < (mp->hw->max_rates - 1); i++) + for (; i < (max_rates - 1); i++) minstrel_ht_set_rate(mp, mi, rates, i, mi->max_tp_rate[i]); - if (i < mp->hw->max_rates) + if (i < max_rates) minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate); if (i < IEEE80211_TX_RATE_TABLE_SIZE) diff -Nru linux-aws-5.19.0/net/mac80211/scan.c linux-aws-5.19.0/net/mac80211/scan.c --- linux-aws-5.19.0/net/mac80211/scan.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/scan.c 2022-11-29 07:06:46.000000000 +0000 @@ -465,16 +465,19 @@ scan_req = rcu_dereference_protected(local->scan_req, lockdep_is_held(&local->mtx)); - if (scan_req != local->int_scan_req) { - local->scan_info.aborted = aborted; - cfg80211_scan_done(scan_req, &local->scan_info); - } RCU_INIT_POINTER(local->scan_req, NULL); RCU_INIT_POINTER(local->scan_sdata, NULL); local->scanning = 0; local->scan_chandef.chan = NULL; + synchronize_rcu(); + + if (scan_req != local->int_scan_req) { + local->scan_info.aborted = aborted; + cfg80211_scan_done(scan_req, &local->scan_info); + } + /* Set power back to normal operating levels. */ ieee80211_hw_config(local, 0); diff -Nru linux-aws-5.19.0/net/mac80211/sta_info.c linux-aws-5.19.0/net/mac80211/sta_info.c --- linux-aws-5.19.0/net/mac80211/sta_info.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/sta_info.c 2022-11-29 07:06:46.000000000 +0000 @@ -2221,9 +2221,9 @@ u64 value; do { - start = u64_stats_fetch_begin(&rxstats->syncp); + start = u64_stats_fetch_begin_irq(&rxstats->syncp); value = rxstats->msdu[tid]; - } while (u64_stats_fetch_retry(&rxstats->syncp, start)); + } while (u64_stats_fetch_retry_irq(&rxstats->syncp, start)); return value; } @@ -2289,9 +2289,9 @@ u64 value; do { - start = u64_stats_fetch_begin(&rxstats->syncp); + start = u64_stats_fetch_begin_irq(&rxstats->syncp); value = rxstats->bytes; - } while (u64_stats_fetch_retry(&rxstats->syncp, start)); + } while (u64_stats_fetch_retry_irq(&rxstats->syncp, start)); return value; } diff -Nru linux-aws-5.19.0/net/mac80211/tx.c linux-aws-5.19.0/net/mac80211/tx.c --- linux-aws-5.19.0/net/mac80211/tx.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/tx.c 2022-11-29 07:06:46.000000000 +0000 @@ -5761,6 +5761,9 @@ skb_reset_network_header(skb); skb_reset_mac_header(skb); + if (local->hw.queues < IEEE80211_NUM_ACS) + goto start_xmit; + /* update QoS header to prioritize control port frames if possible, * priorization also happens for control port frames send over * AF_PACKET @@ -5776,6 +5779,7 @@ rcu_read_unlock(); +start_xmit: /* mutex lock is only needed for incrementing the cookie counter */ mutex_lock(&local->mtx); diff -Nru linux-aws-5.19.0/net/mac80211/util.c linux-aws-5.19.0/net/mac80211/util.c --- linux-aws-5.19.0/net/mac80211/util.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mac80211/util.c 2022-11-29 07:06:46.000000000 +0000 @@ -301,14 +301,14 @@ local_bh_disable(); spin_lock(&fq->lock); + sdata->vif.txqs_stopped[ac] = false; + if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) goto out; if (sdata->vif.type == NL80211_IFTYPE_AP) ps = &sdata->bss->ps; - sdata->vif.txqs_stopped[ac] = false; - list_for_each_entry_rcu(sta, &local->sta_list, list) { if (sdata != sta->sdata) continue; diff -Nru linux-aws-5.19.0/net/mac802154/rx.c linux-aws-5.19.0/net/mac802154/rx.c --- linux-aws-5.19.0/net/mac802154/rx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mac802154/rx.c 2022-11-29 07:06:46.000000000 +0000 @@ -44,7 +44,7 @@ switch (mac_cb(skb)->dest.mode) { case IEEE802154_ADDR_NONE: - if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE) + if (hdr->source.mode != IEEE802154_ADDR_NONE) /* FIXME: check if we are PAN coordinator */ skb->pkt_type = PACKET_OTHERHOST; else diff -Nru linux-aws-5.19.0/net/mctp/af_mctp.c linux-aws-5.19.0/net/mctp/af_mctp.c --- linux-aws-5.19.0/net/mctp/af_mctp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mctp/af_mctp.c 2022-11-29 07:06:46.000000000 +0000 @@ -295,11 +295,12 @@ mctp_dev_release_key(key->dev, key); spin_unlock_irqrestore(&key->lock, flags); - hlist_del(&key->hlist); - hlist_del(&key->sklist); - - /* unref for the lists */ - mctp_key_unref(key); + if (!hlist_unhashed(&key->hlist)) { + hlist_del_init(&key->hlist); + hlist_del_init(&key->sklist); + /* unref for the lists */ + mctp_key_unref(key); + } kfree_skb(skb); } @@ -373,9 +374,17 @@ ctl.tag = tag | MCTP_TAG_OWNER | MCTP_TAG_PREALLOC; if (copy_to_user((void __user *)arg, &ctl, sizeof(ctl))) { - spin_lock_irqsave(&key->lock, flags); - __mctp_key_remove(key, net, flags, MCTP_TRACE_KEY_DROPPED); + unsigned long fl2; + /* Unwind our key allocation: the keys list lock needs to be + * taken before the individual key locks, and we need a valid + * flags value (fl2) to pass to __mctp_key_remove, hence the + * second spin_lock_irqsave() rather than a plain spin_lock(). + */ + spin_lock_irqsave(&net->mctp.keys_lock, flags); + spin_lock_irqsave(&key->lock, fl2); + __mctp_key_remove(key, net, fl2, MCTP_TRACE_KEY_DROPPED); mctp_key_unref(key); + spin_unlock_irqrestore(&net->mctp.keys_lock, flags); return -EFAULT; } diff -Nru linux-aws-5.19.0/net/mctp/route.c linux-aws-5.19.0/net/mctp/route.c --- linux-aws-5.19.0/net/mctp/route.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mctp/route.c 2022-11-29 07:06:46.000000000 +0000 @@ -228,12 +228,12 @@ if (!key->manual_alloc) { spin_lock_irqsave(&net->mctp.keys_lock, flags); - hlist_del(&key->hlist); - hlist_del(&key->sklist); + if (!hlist_unhashed(&key->hlist)) { + hlist_del_init(&key->hlist); + hlist_del_init(&key->sklist); + mctp_key_unref(key); + } spin_unlock_irqrestore(&net->mctp.keys_lock, flags); - - /* unref for the lists */ - mctp_key_unref(key); } /* and one for the local reference */ diff -Nru linux-aws-5.19.0/net/mpls/af_mpls.c linux-aws-5.19.0/net/mpls/af_mpls.c --- linux-aws-5.19.0/net/mpls/af_mpls.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/mpls/af_mpls.c 2022-11-29 07:06:46.000000000 +0000 @@ -1079,9 +1079,9 @@ p = per_cpu_ptr(mdev->stats, i); do { - start = u64_stats_fetch_begin(&p->syncp); + start = u64_stats_fetch_begin_irq(&p->syncp); local = p->stats; - } while (u64_stats_fetch_retry(&p->syncp, start)); + } while (u64_stats_fetch_retry_irq(&p->syncp, start)); stats->rx_packets += local.rx_packets; stats->rx_bytes += local.rx_bytes; diff -Nru linux-aws-5.19.0/net/mptcp/protocol.c linux-aws-5.19.0/net/mptcp/protocol.c --- linux-aws-5.19.0/net/mptcp/protocol.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mptcp/protocol.c 2022-11-29 07:06:46.000000000 +0000 @@ -2692,7 +2692,7 @@ dfrag_clear(sk, dfrag); } -static void mptcp_cancel_work(struct sock *sk) +void mptcp_cancel_work(struct sock *sk) { struct mptcp_sock *msk = mptcp_sk(sk); @@ -2832,13 +2832,12 @@ sock_put(sk); } -static void mptcp_close(struct sock *sk, long timeout) +bool __mptcp_close(struct sock *sk, long timeout) { struct mptcp_subflow_context *subflow; struct mptcp_sock *msk = mptcp_sk(sk); bool do_cancel_work = false; - lock_sock(sk); sk->sk_shutdown = SHUTDOWN_MASK; if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { @@ -2880,6 +2879,17 @@ } else { mptcp_reset_timeout(msk, 0); } + + return do_cancel_work; +} + +static void mptcp_close(struct sock *sk, long timeout) +{ + bool do_cancel_work; + + lock_sock(sk); + + do_cancel_work = __mptcp_close(sk, timeout); release_sock(sk); if (do_cancel_work) mptcp_cancel_work(sk); diff -Nru linux-aws-5.19.0/net/mptcp/protocol.h linux-aws-5.19.0/net/mptcp/protocol.h --- linux-aws-5.19.0/net/mptcp/protocol.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mptcp/protocol.h 2022-11-29 07:06:46.000000000 +0000 @@ -613,6 +613,8 @@ void mptcp_subflow_queue_clean(struct sock *ssk); void mptcp_sock_graft(struct sock *sk, struct socket *parent); struct socket *__mptcp_nmpc_socket(const struct mptcp_sock *msk); +bool __mptcp_close(struct sock *sk, long timeout); +void mptcp_cancel_work(struct sock *sk); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, const struct mptcp_addr_info *b, bool use_port); diff -Nru linux-aws-5.19.0/net/mptcp/subflow.c linux-aws-5.19.0/net/mptcp/subflow.c --- linux-aws-5.19.0/net/mptcp/subflow.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/mptcp/subflow.c 2022-11-29 07:06:46.000000000 +0000 @@ -602,30 +602,6 @@ return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); } -static void mptcp_sock_destruct(struct sock *sk) -{ - /* if new mptcp socket isn't accepted, it is free'd - * from the tcp listener sockets request queue, linked - * from req->sk. The tcp socket is released. - * This calls the ULP release function which will - * also remove the mptcp socket, via - * sock_put(ctx->conn). - * - * Problem is that the mptcp socket will be in - * ESTABLISHED state and will not have the SOCK_DEAD flag. - * Both result in warnings from inet_sock_destruct. - */ - if ((1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { - sk->sk_state = TCP_CLOSE; - WARN_ON_ONCE(sk->sk_socket); - sock_orphan(sk); - } - - /* We don't need to clear msk->subflow, as it's still NULL at this point */ - mptcp_destroy_common(mptcp_sk(sk), 0); - inet_sock_destruct(sk); -} - static void mptcp_force_close(struct sock *sk) { /* the msk is not yet exposed to user-space */ @@ -768,7 +744,6 @@ /* new mpc subflow takes ownership of the newly * created mptcp socket */ - new_msk->sk_destruct = mptcp_sock_destruct; mptcp_sk(new_msk)->setsockopt_seq = ctx->setsockopt_seq; mptcp_pm_new_connection(mptcp_sk(new_msk), child, 1); mptcp_token_accept(subflow_req, mptcp_sk(new_msk)); @@ -1763,13 +1738,19 @@ for (msk = head; msk; msk = next) { struct sock *sk = (struct sock *)msk; - bool slow; + bool slow, do_cancel_work; + sock_hold(sk); slow = lock_sock_fast_nested(sk); next = msk->dl_next; msk->first = NULL; msk->dl_next = NULL; + + do_cancel_work = __mptcp_close(sk, 0); unlock_sock_fast(sk, slow); + if (do_cancel_work) + mptcp_cancel_work(sk); + sock_put(sk); } /* we are still under the listener msk socket lock */ diff -Nru linux-aws-5.19.0/net/netfilter/nf_conntrack_core.c linux-aws-5.19.0/net/netfilter/nf_conntrack_core.c --- linux-aws-5.19.0/net/netfilter/nf_conntrack_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_conntrack_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -67,6 +67,7 @@ struct delayed_work dwork; u32 next_bucket; u32 avg_timeout; + u32 count; u32 start_time; bool exiting; bool early_drop; @@ -85,10 +86,12 @@ /* clamp timeouts to this value (TCP unacked) */ #define GC_SCAN_INTERVAL_CLAMP (300ul * HZ) -/* large initial bias so that we don't scan often just because we have - * three entries with a 1s timeout. +/* Initial bias pretending we have 100 entries at the upper bound so we don't + * wakeup often just because we have three entries with a 1s timeout while still + * allowing non-idle machines to wakeup more often when needed. */ -#define GC_SCAN_INTERVAL_INIT INT_MAX +#define GC_SCAN_INITIAL_COUNT 100 +#define GC_SCAN_INTERVAL_INIT GC_SCAN_INTERVAL_MAX #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) #define GC_SCAN_EXPIRED_MAX (64000u / HZ) @@ -1468,6 +1471,7 @@ unsigned int expired_count = 0; unsigned long next_run; s32 delta_time; + long count; gc_work = container_of(work, struct conntrack_gc_work, dwork.work); @@ -1477,10 +1481,12 @@ if (i == 0) { gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; + gc_work->count = GC_SCAN_INITIAL_COUNT; gc_work->start_time = start_time; } next_run = gc_work->avg_timeout; + count = gc_work->count; end_time = start_time + GC_SCAN_MAX_DURATION; @@ -1500,8 +1506,8 @@ hlist_nulls_for_each_entry_rcu(h, n, &ct_hash[i], hnnode) { struct nf_conntrack_net *cnet; - unsigned long expires; struct net *net; + long expires; tmp = nf_ct_tuplehash_to_ctrack(h); @@ -1515,6 +1521,7 @@ gc_work->next_bucket = i; gc_work->avg_timeout = next_run; + gc_work->count = count; delta_time = nfct_time_stamp - gc_work->start_time; @@ -1530,8 +1537,8 @@ } expires = clamp(nf_ct_expires(tmp), GC_SCAN_INTERVAL_MIN, GC_SCAN_INTERVAL_CLAMP); + expires = (expires - (long)next_run) / ++count; next_run += expires; - next_run /= 2u; if (nf_conntrack_max95 == 0 || gc_worker_skip_ct(tmp)) continue; @@ -1572,6 +1579,7 @@ delta_time = nfct_time_stamp - end_time; if (delta_time > 0 && i < hashsz) { gc_work->avg_timeout = next_run; + gc_work->count = count; gc_work->next_bucket = i; next_run = 0; goto early_exit; diff -Nru linux-aws-5.19.0/net/netfilter/nf_conntrack_ftp.c linux-aws-5.19.0/net/netfilter/nf_conntrack_ftp.c --- linux-aws-5.19.0/net/netfilter/nf_conntrack_ftp.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_conntrack_ftp.c 2022-11-29 07:06:46.000000000 +0000 @@ -33,6 +33,7 @@ MODULE_DESCRIPTION("ftp connection tracking helper"); MODULE_ALIAS("ip_conntrack_ftp"); MODULE_ALIAS_NFCT_HELPER(HELPER_NAME); +static DEFINE_SPINLOCK(nf_ftp_lock); #define MAX_PORTS 8 static u_int16_t ports[MAX_PORTS]; @@ -409,7 +410,8 @@ } datalen = skb->len - dataoff; - spin_lock_bh(&ct->lock); + /* seqadj (nat) uses ct->lock internally, nf_nat_ftp would cause deadlock */ + spin_lock_bh(&nf_ftp_lock); fb_ptr = skb->data + dataoff; ends_in_nl = (fb_ptr[datalen - 1] == '\n'); @@ -538,7 +540,7 @@ if (ends_in_nl) update_nl_seq(ct, seq, ct_ftp_info, dir, skb); out: - spin_unlock_bh(&ct->lock); + spin_unlock_bh(&nf_ftp_lock); return ret; } diff -Nru linux-aws-5.19.0/net/netfilter/nf_conntrack_irc.c linux-aws-5.19.0/net/netfilter/nf_conntrack_irc.c --- linux-aws-5.19.0/net/netfilter/nf_conntrack_irc.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_conntrack_irc.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,15 +157,37 @@ data = ib_ptr; data_limit = ib_ptr + datalen; - /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=24 - * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=14 */ - while (data < data_limit - (19 + MINMATCHLEN)) { - if (memcmp(data, "\1DCC ", 5)) { + /* Skip any whitespace */ + while (data < data_limit - 10) { + if (*data == ' ' || *data == '\r' || *data == '\n') + data++; + else + break; + } + + /* strlen("PRIVMSG x ")=10 */ + if (data < data_limit - 10) { + if (strncasecmp("PRIVMSG ", data, 8)) + goto out; + data += 8; + } + + /* strlen(" :\1DCC SENT t AAAAAAAA P\1\n")=26 + * 7+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=26 + */ + while (data < data_limit - (21 + MINMATCHLEN)) { + /* Find first " :", the start of message */ + if (memcmp(data, " :", 2)) { data++; continue; } + data += 2; + + /* then check that place only for the DCC command */ + if (memcmp(data, "\1DCC ", 5)) + goto out; data += 5; - /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ + /* we have at least (21+MINMATCHLEN)-(2+5) bytes valid data left */ iph = ip_hdr(skb); pr_debug("DCC found in master %pI4:%u %pI4:%u\n", @@ -181,7 +203,7 @@ pr_debug("DCC %s detected\n", dccprotos[i]); /* we have at least - * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid + * (21+MINMATCHLEN)-7-dccprotos[i].matchlen bytes valid * data left (== 14/13 bytes) */ if (parse_dcc(data, data_limit, &dcc_ip, &dcc_port, &addr_beg_p, &addr_end_p)) { @@ -194,8 +216,9 @@ /* dcc_ip can be the internal OR external (NAT'ed) IP */ tuple = &ct->tuplehash[dir].tuple; - if (tuple->src.u3.ip != dcc_ip && - tuple->dst.u3.ip != dcc_ip) { + if ((tuple->src.u3.ip != dcc_ip && + ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) || + dcc_port == 0) { net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n", &tuple->src.u3.ip, &dcc_ip, dcc_port); diff -Nru linux-aws-5.19.0/net/netfilter/nf_conntrack_proto_tcp.c linux-aws-5.19.0/net/netfilter/nf_conntrack_proto_tcp.c --- linux-aws-5.19.0/net/netfilter/nf_conntrack_proto_tcp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_conntrack_proto_tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -655,6 +655,37 @@ tn->tcp_be_liberal) res = true; if (!res) { + bool seq_ok = before(seq, sender->td_maxend + 1); + + if (!seq_ok) { + u32 overshot = end - sender->td_maxend + 1; + bool ack_ok; + + ack_ok = after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1); + + if (in_recv_win && + ack_ok && + overshot <= receiver->td_maxwin && + before(sack, receiver->td_end + 1)) { + /* Work around TCPs that send more bytes than allowed by + * the receive window. + * + * If the (marked as invalid) packet is allowed to pass by + * the ruleset and the peer acks this data, then its possible + * all future packets will trigger 'ACK is over upper bound' check. + * + * Thus if only the sequence check fails then do update td_end so + * possible ACK for this data can update internal state. + */ + sender->td_end = end; + sender->flags |= IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED; + + nf_ct_l4proto_log_invalid(skb, ct, hook_state, + "%u bytes more than expected", overshot); + return res; + } + } + nf_ct_l4proto_log_invalid(skb, ct, hook_state, "%s", before(seq, sender->td_maxend + 1) ? diff -Nru linux-aws-5.19.0/net/netfilter/nf_conntrack_sip.c linux-aws-5.19.0/net/netfilter/nf_conntrack_sip.c --- linux-aws-5.19.0/net/netfilter/nf_conntrack_sip.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_conntrack_sip.c 2022-11-29 07:06:46.000000000 +0000 @@ -477,7 +477,7 @@ return ret; if (ret == 0) break; - dataoff += *matchoff; + dataoff = *matchoff; } *in_header = 0; } @@ -489,7 +489,7 @@ break; if (ret == 0) return ret; - dataoff += *matchoff; + dataoff = *matchoff; } if (in_header) diff -Nru linux-aws-5.19.0/net/netfilter/nfnetlink_osf.c linux-aws-5.19.0/net/netfilter/nfnetlink_osf.c --- linux-aws-5.19.0/net/netfilter/nfnetlink_osf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nfnetlink_osf.c 2022-11-29 07:06:46.000000000 +0000 @@ -269,6 +269,7 @@ struct nf_osf_hdr_ctx ctx; const struct tcphdr *tcp; struct tcphdr _tcph; + bool found = false; memset(&ctx, 0, sizeof(ctx)); @@ -283,10 +284,11 @@ data->genre = f->genre; data->version = f->version; + found = true; break; } - return true; + return found; } EXPORT_SYMBOL_GPL(nf_osf_find); diff -Nru linux-aws-5.19.0/net/netfilter/nf_tables_api.c linux-aws-5.19.0/net/netfilter/nf_tables_api.c --- linux-aws-5.19.0/net/netfilter/nf_tables_api.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/netfilter/nf_tables_api.c 2022-11-29 07:06:46.000000000 +0000 @@ -2166,8 +2166,10 @@ chain->flags |= NFT_CHAIN_BASE | flags; basechain->policy = NF_ACCEPT; if (chain->flags & NFT_CHAIN_HW_OFFLOAD && - !nft_chain_offload_support(basechain)) + !nft_chain_offload_support(basechain)) { + list_splice_init(&basechain->hook_list, &hook->list); return -EOPNOTSUPP; + } flow_block_init(&basechain->flow_block); @@ -2195,7 +2197,6 @@ struct netlink_ext_ack *extack) { const struct nlattr * const *nla = ctx->nla; - struct nft_stats __percpu *stats = NULL; struct nft_table *table = ctx->table; struct nft_base_chain *basechain; struct net *net = ctx->net; @@ -2210,6 +2211,7 @@ return -EOVERFLOW; if (nla[NFTA_CHAIN_HOOK]) { + struct nft_stats __percpu *stats = NULL; struct nft_chain_hook hook; if (flags & NFT_CHAIN_BINDING) @@ -2241,8 +2243,11 @@ if (err < 0) { nft_chain_release_hook(&hook); kfree(basechain); + free_percpu(stats); return err; } + if (stats) + static_branch_inc(&nft_counters_enabled); } else { if (flags & NFT_CHAIN_BASE) return -EINVAL; @@ -2317,9 +2322,6 @@ goto err_unregister_hook; } - if (stats) - static_branch_inc(&nft_counters_enabled); - table->use++; return 0; diff -Nru linux-aws-5.19.0/net/openvswitch/datapath.c linux-aws-5.19.0/net/openvswitch/datapath.c --- linux-aws-5.19.0/net/openvswitch/datapath.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/openvswitch/datapath.c 2022-11-29 07:06:46.000000000 +0000 @@ -252,10 +252,17 @@ upcall.mru = OVS_CB(skb)->mru; error = ovs_dp_upcall(dp, skb, key, &upcall, 0); - if (unlikely(error)) - kfree_skb(skb); - else + switch (error) { + case 0: + case -EAGAIN: + case -ERESTARTSYS: + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter = &stats->n_missed; goto out; } @@ -551,8 +558,9 @@ out: if (err) skb_tx_error(skb); - kfree_skb(user_skb); - kfree_skb(nskb); + consume_skb(user_skb); + consume_skb(nskb); + return err; } @@ -1802,7 +1810,7 @@ ovs_dp_reset_user_features(skb, info); } - goto err_unlock_and_destroy_meters; + goto err_destroy_portids; } err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, @@ -1817,6 +1825,8 @@ ovs_notify(&dp_datapath_genl_family, reply, info); return 0; +err_destroy_portids: + kfree(rcu_dereference_raw(dp->upcall_portids)); err_unlock_and_destroy_meters: ovs_unlock(); ovs_meters_exit(dp); diff -Nru linux-aws-5.19.0/net/rds/tcp.c linux-aws-5.19.0/net/rds/tcp.c --- linux-aws-5.19.0/net/rds/tcp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/rds/tcp.c 2022-11-29 07:06:46.000000000 +0000 @@ -166,10 +166,10 @@ */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL; diff -Nru linux-aws-5.19.0/net/rxrpc/ar-internal.h linux-aws-5.19.0/net/rxrpc/ar-internal.h --- linux-aws-5.19.0/net/rxrpc/ar-internal.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/rxrpc/ar-internal.h 2022-11-29 07:06:46.000000000 +0000 @@ -982,6 +982,7 @@ /* * peer_event.c */ +void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset); void rxrpc_error_report(struct sock *); void rxrpc_peer_keepalive_worker(struct work_struct *); diff -Nru linux-aws-5.19.0/net/rxrpc/local_object.c linux-aws-5.19.0/net/rxrpc/local_object.c --- linux-aws-5.19.0/net/rxrpc/local_object.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/rxrpc/local_object.c 2022-11-29 07:06:46.000000000 +0000 @@ -137,6 +137,7 @@ tuncfg.encap_type = UDP_ENCAP_RXRPC; tuncfg.encap_rcv = rxrpc_input_packet; + tuncfg.encap_err_rcv = rxrpc_encap_err_rcv; tuncfg.sk_user_data = local; setup_udp_tunnel_sock(net, local->socket, &tuncfg); diff -Nru linux-aws-5.19.0/net/rxrpc/peer_event.c linux-aws-5.19.0/net/rxrpc/peer_event.c --- linux-aws-5.19.0/net/rxrpc/peer_event.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/rxrpc/peer_event.c 2022-11-29 07:06:46.000000000 +0000 @@ -16,22 +16,105 @@ #include #include #include +#include #include "ar-internal.h" +static void rxrpc_adjust_mtu(struct rxrpc_peer *, unsigned int); static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *); static void rxrpc_distribute_error(struct rxrpc_peer *, int, enum rxrpc_call_completion); /* - * Find the peer associated with an ICMP packet. + * Find the peer associated with an ICMPv4 packet. */ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, - const struct sk_buff *skb, + struct sk_buff *skb, + unsigned int udp_offset, + unsigned int *info, struct sockaddr_rxrpc *srx) { - struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); + struct iphdr *ip, *ip0 = ip_hdr(skb); + struct icmphdr *icmp = icmp_hdr(skb); + struct udphdr *udp = (struct udphdr *)(skb->data + udp_offset); + + _enter("%u,%u,%u", ip0->protocol, icmp->type, icmp->code); + + switch (icmp->type) { + case ICMP_DEST_UNREACH: + *info = ntohs(icmp->un.frag.mtu); + fallthrough; + case ICMP_TIME_EXCEEDED: + case ICMP_PARAMETERPROB: + ip = (struct iphdr *)((void *)icmp + 8); + break; + default: + return NULL; + } - _enter(""); + memset(srx, 0, sizeof(*srx)); + srx->transport_type = local->srx.transport_type; + srx->transport_len = local->srx.transport_len; + srx->transport.family = local->srx.transport.family; + + /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice + * versa? + */ + switch (srx->transport.family) { + case AF_INET: + srx->transport_len = sizeof(srx->transport.sin); + srx->transport.family = AF_INET; + srx->transport.sin.sin_port = udp->dest; + memcpy(&srx->transport.sin.sin_addr, &ip->daddr, + sizeof(struct in_addr)); + break; + +#ifdef CONFIG_AF_RXRPC_IPV6 + case AF_INET6: + srx->transport_len = sizeof(srx->transport.sin); + srx->transport.family = AF_INET; + srx->transport.sin.sin_port = udp->dest; + memcpy(&srx->transport.sin.sin_addr, &ip->daddr, + sizeof(struct in_addr)); + break; +#endif + + default: + WARN_ON_ONCE(1); + return NULL; + } + + _net("ICMP {%pISp}", &srx->transport); + return rxrpc_lookup_peer_rcu(local, srx); +} + +#ifdef CONFIG_AF_RXRPC_IPV6 +/* + * Find the peer associated with an ICMPv6 packet. + */ +static struct rxrpc_peer *rxrpc_lookup_peer_icmp6_rcu(struct rxrpc_local *local, + struct sk_buff *skb, + unsigned int udp_offset, + unsigned int *info, + struct sockaddr_rxrpc *srx) +{ + struct icmp6hdr *icmp = icmp6_hdr(skb); + struct ipv6hdr *ip, *ip0 = ipv6_hdr(skb); + struct udphdr *udp = (struct udphdr *)(skb->data + udp_offset); + + _enter("%u,%u,%u", ip0->nexthdr, icmp->icmp6_type, icmp->icmp6_code); + + switch (icmp->icmp6_type) { + case ICMPV6_DEST_UNREACH: + *info = ntohl(icmp->icmp6_mtu); + fallthrough; + case ICMPV6_PKT_TOOBIG: + case ICMPV6_TIME_EXCEED: + case ICMPV6_PARAMPROB: + ip = (struct ipv6hdr *)((void *)icmp + 8); + break; + default: + return NULL; + } memset(srx, 0, sizeof(*srx)); srx->transport_type = local->srx.transport_type; @@ -43,6 +126,165 @@ */ switch (srx->transport.family) { case AF_INET: + _net("Rx ICMP6 on v4 sock"); + srx->transport_len = sizeof(srx->transport.sin); + srx->transport.family = AF_INET; + srx->transport.sin.sin_port = udp->dest; + memcpy(&srx->transport.sin.sin_addr, + &ip->daddr.s6_addr32[3], sizeof(struct in_addr)); + break; + case AF_INET6: + _net("Rx ICMP6"); + srx->transport.sin.sin_port = udp->dest; + memcpy(&srx->transport.sin6.sin6_addr, &ip->daddr, + sizeof(struct in6_addr)); + break; + default: + WARN_ON_ONCE(1); + return NULL; + } + + _net("ICMP {%pISp}", &srx->transport); + return rxrpc_lookup_peer_rcu(local, srx); +} +#endif /* CONFIG_AF_RXRPC_IPV6 */ + +/* + * Handle an error received on the local endpoint as a tunnel. + */ +void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, + unsigned int udp_offset) +{ + struct sock_extended_err ee; + struct sockaddr_rxrpc srx; + struct rxrpc_local *local; + struct rxrpc_peer *peer; + unsigned int info = 0; + int err; + u8 version = ip_hdr(skb)->version; + u8 type = icmp_hdr(skb)->type; + u8 code = icmp_hdr(skb)->code; + + rcu_read_lock(); + local = rcu_dereference_sk_user_data(sk); + if (unlikely(!local)) { + rcu_read_unlock(); + return; + } + + rxrpc_new_skb(skb, rxrpc_skb_received); + + switch (ip_hdr(skb)->version) { + case IPVERSION: + peer = rxrpc_lookup_peer_icmp_rcu(local, skb, udp_offset, + &info, &srx); + break; +#ifdef CONFIG_AF_RXRPC_IPV6 + case 6: + peer = rxrpc_lookup_peer_icmp6_rcu(local, skb, udp_offset, + &info, &srx); + break; +#endif + default: + rcu_read_unlock(); + return; + } + + if (peer && !rxrpc_get_peer_maybe(peer)) + peer = NULL; + if (!peer) { + rcu_read_unlock(); + return; + } + + memset(&ee, 0, sizeof(ee)); + + switch (version) { + case IPVERSION: + switch (type) { + case ICMP_DEST_UNREACH: + switch (code) { + case ICMP_FRAG_NEEDED: + rxrpc_adjust_mtu(peer, info); + rcu_read_unlock(); + rxrpc_put_peer(peer); + return; + default: + break; + } + + err = EHOSTUNREACH; + if (code <= NR_ICMP_UNREACH) { + /* Might want to do something different with + * non-fatal errors + */ + //harderr = icmp_err_convert[code].fatal; + err = icmp_err_convert[code].errno; + } + break; + + case ICMP_TIME_EXCEEDED: + err = EHOSTUNREACH; + break; + default: + err = EPROTO; + break; + } + + ee.ee_origin = SO_EE_ORIGIN_ICMP; + ee.ee_type = type; + ee.ee_code = code; + ee.ee_errno = err; + break; + +#ifdef CONFIG_AF_RXRPC_IPV6 + case 6: + switch (type) { + case ICMPV6_PKT_TOOBIG: + rxrpc_adjust_mtu(peer, info); + rcu_read_unlock(); + rxrpc_put_peer(peer); + return; + } + + icmpv6_err_convert(type, code, &err); + + if (err == EACCES) + err = EHOSTUNREACH; + + ee.ee_origin = SO_EE_ORIGIN_ICMP6; + ee.ee_type = type; + ee.ee_code = code; + ee.ee_errno = err; + break; +#endif + } + + trace_rxrpc_rx_icmp(peer, &ee, &srx); + + rxrpc_distribute_error(peer, err, RXRPC_CALL_NETWORK_ERROR); + rcu_read_unlock(); + rxrpc_put_peer(peer); +} + +/* + * Find the peer associated with a local error. + */ +static struct rxrpc_peer *rxrpc_lookup_peer_local_rcu(struct rxrpc_local *local, + const struct sk_buff *skb, + struct sockaddr_rxrpc *srx) +{ + struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); + + _enter(""); + + memset(srx, 0, sizeof(*srx)); + srx->transport_type = local->srx.transport_type; + srx->transport_len = local->srx.transport_len; + srx->transport.family = local->srx.transport.family; + + switch (srx->transport.family) { + case AF_INET: srx->transport_len = sizeof(srx->transport.sin); srx->transport.family = AF_INET; srx->transport.sin.sin_port = serr->port; @@ -104,10 +346,8 @@ /* * Handle an MTU/fragmentation problem. */ -static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, struct sock_exterr_skb *serr) +static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu) { - u32 mtu = serr->ee.ee_info; - _net("Rx ICMP Fragmentation Needed (%d)", mtu); /* wind down the local interface MTU */ @@ -148,7 +388,7 @@ struct sock_exterr_skb *serr; struct sockaddr_rxrpc srx; struct rxrpc_local *local; - struct rxrpc_peer *peer; + struct rxrpc_peer *peer = NULL; struct sk_buff *skb; rcu_read_lock(); @@ -172,41 +412,20 @@ } rxrpc_new_skb(skb, rxrpc_skb_received); serr = SKB_EXT_ERR(skb); - if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { - _leave("UDP empty message"); - rcu_read_unlock(); - rxrpc_free_skb(skb, rxrpc_skb_freed); - return; - } - peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); - if (peer && !rxrpc_get_peer_maybe(peer)) - peer = NULL; - if (!peer) { - rcu_read_unlock(); - rxrpc_free_skb(skb, rxrpc_skb_freed); - _leave(" [no peer]"); - return; - } - - trace_rxrpc_rx_icmp(peer, &serr->ee, &srx); - - if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP && - serr->ee.ee_type == ICMP_DEST_UNREACH && - serr->ee.ee_code == ICMP_FRAG_NEEDED)) { - rxrpc_adjust_mtu(peer, serr); - rcu_read_unlock(); - rxrpc_free_skb(skb, rxrpc_skb_freed); - rxrpc_put_peer(peer); - _leave(" [MTU update]"); - return; + if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) { + peer = rxrpc_lookup_peer_local_rcu(local, skb, &srx); + if (peer && !rxrpc_get_peer_maybe(peer)) + peer = NULL; + if (peer) { + trace_rxrpc_rx_icmp(peer, &serr->ee, &srx); + rxrpc_store_error(peer, serr); + } } - rxrpc_store_error(peer, serr); rcu_read_unlock(); rxrpc_free_skb(skb, rxrpc_skb_freed); rxrpc_put_peer(peer); - _leave(""); } diff -Nru linux-aws-5.19.0/net/rxrpc/rxkad.c linux-aws-5.19.0/net/rxrpc/rxkad.c --- linux-aws-5.19.0/net/rxrpc/rxkad.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/rxrpc/rxkad.c 2022-11-29 07:06:46.000000000 +0000 @@ -540,7 +540,7 @@ * directly into the target buffer. */ sg = _sg; - nsg = skb_shinfo(skb)->nr_frags; + nsg = skb_shinfo(skb)->nr_frags + 1; if (nsg <= 4) { nsg = 4; } else { diff -Nru linux-aws-5.19.0/net/sched/act_ct.c linux-aws-5.19.0/net/sched/act_ct.c --- linux-aws-5.19.0/net/sched/act_ct.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sched/act_ct.c 2022-11-29 07:06:46.000000000 +0000 @@ -1393,7 +1393,7 @@ err = tcf_ct_flow_table_get(params); if (err) - goto cleanup; + goto cleanup_params; spin_lock_bh(&c->tcf_lock); goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch); @@ -1408,6 +1408,9 @@ return res; +cleanup_params: + if (params->tmpl) + nf_ct_put(params->tmpl); cleanup: if (goto_ch) tcf_chain_put_by_act(goto_ch); diff -Nru linux-aws-5.19.0/net/sched/cls_api.c linux-aws-5.19.0/net/sched/cls_api.c --- linux-aws-5.19.0/net/sched/cls_api.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sched/cls_api.c 2022-11-29 07:06:46.000000000 +0000 @@ -2136,6 +2136,7 @@ } if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { + tfilter_put(tp, fh); NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); err = -EINVAL; goto errout; diff -Nru linux-aws-5.19.0/net/sched/sch_generic.c linux-aws-5.19.0/net/sched/sch_generic.c --- linux-aws-5.19.0/net/sched/sch_generic.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/sched/sch_generic.c 2022-11-29 07:06:46.000000000 +0000 @@ -1125,6 +1125,21 @@ } EXPORT_SYMBOL(dev_graft_qdisc); +static void shutdown_scheduler_queue(struct net_device *dev, + struct netdev_queue *dev_queue, + void *_qdisc_default) +{ + struct Qdisc *qdisc = dev_queue->qdisc_sleeping; + struct Qdisc *qdisc_default = _qdisc_default; + + if (qdisc) { + rcu_assign_pointer(dev_queue->qdisc, qdisc_default); + dev_queue->qdisc_sleeping = qdisc_default; + + qdisc_put(qdisc); + } +} + static void attach_one_default_qdisc(struct net_device *dev, struct netdev_queue *dev_queue, void *_unused) @@ -1172,6 +1187,7 @@ if (qdisc == &noop_qdisc) { netdev_warn(dev, "default qdisc (%s) fail, fallback to %s\n", default_qdisc_ops->id, noqueue_qdisc_ops.id); + netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); dev->priv_flags |= IFF_NO_QUEUE; netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); qdisc = txq->qdisc_sleeping; @@ -1450,21 +1466,6 @@ timer_setup(&dev->watchdog_timer, dev_watchdog, 0); } -static void shutdown_scheduler_queue(struct net_device *dev, - struct netdev_queue *dev_queue, - void *_qdisc_default) -{ - struct Qdisc *qdisc = dev_queue->qdisc_sleeping; - struct Qdisc *qdisc_default = _qdisc_default; - - if (qdisc) { - rcu_assign_pointer(dev_queue->qdisc, qdisc_default); - dev_queue->qdisc_sleeping = qdisc_default; - - qdisc_put(qdisc); - } -} - void dev_shutdown(struct net_device *dev) { netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); diff -Nru linux-aws-5.19.0/net/sched/sch_sfb.c linux-aws-5.19.0/net/sched/sch_sfb.c --- linux-aws-5.19.0/net/sched/sch_sfb.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sched/sch_sfb.c 2022-11-29 07:06:46.000000000 +0000 @@ -135,15 +135,15 @@ } } -static void increment_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) +static void increment_qlen(const struct sfb_skb_cb *cb, struct sfb_sched_data *q) { u32 sfbhash; - sfbhash = sfb_hash(skb, 0); + sfbhash = cb->hashes[0]; if (sfbhash) increment_one_qlen(sfbhash, 0, q); - sfbhash = sfb_hash(skb, 1); + sfbhash = cb->hashes[1]; if (sfbhash) increment_one_qlen(sfbhash, 1, q); } @@ -281,8 +281,10 @@ { struct sfb_sched_data *q = qdisc_priv(sch); + unsigned int len = qdisc_pkt_len(skb); struct Qdisc *child = q->qdisc; struct tcf_proto *fl; + struct sfb_skb_cb cb; int i; u32 p_min = ~0; u32 minqlen = ~0; @@ -399,11 +401,12 @@ } enqueue: + memcpy(&cb, sfb_skb_cb(skb), sizeof(cb)); ret = qdisc_enqueue(skb, child, to_free); if (likely(ret == NET_XMIT_SUCCESS)) { - qdisc_qstats_backlog_inc(sch, skb); + sch->qstats.backlog += len; sch->q.qlen++; - increment_qlen(skb, q); + increment_qlen(&cb, q); } else if (net_xmit_drop_count(ret)) { q->stats.childdrop++; qdisc_qstats_drop(sch); diff -Nru linux-aws-5.19.0/net/sched/sch_taprio.c linux-aws-5.19.0/net/sched/sch_taprio.c --- linux-aws-5.19.0/net/sched/sch_taprio.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sched/sch_taprio.c 2022-11-29 07:06:46.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,7 @@ u32 flags; enum tk_offsets tk_offset; int clockid; + bool offloaded; atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+ * speeds it's sub-nanoseconds per byte */ @@ -176,7 +178,7 @@ static int length_to_duration(struct taprio_sched *q, int len) { - return div_u64(len * atomic64_read(&q->picos_per_byte), 1000); + return div_u64(len * atomic64_read(&q->picos_per_byte), PSEC_PER_NSEC); } /* Returns the entry corresponding to next available interval. If @@ -551,7 +553,7 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) { atomic_set(&entry->budget, - div64_u64((u64)entry->interval * 1000, + div64_u64((u64)entry->interval * PSEC_PER_NSEC, atomic64_read(&q->picos_per_byte))); } @@ -1278,6 +1280,8 @@ goto done; } + q->offloaded = true; + done: taprio_offload_free(offload); @@ -1292,12 +1296,9 @@ struct tc_taprio_qopt_offload *offload; int err; - if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) + if (!q->offloaded) return 0; - if (!ops->ndo_setup_tc) - return -EOPNOTSUPP; - offload = taprio_offload_alloc(0); if (!offload) { NL_SET_ERR_MSG(extack, @@ -1313,6 +1314,8 @@ goto out; } + q->offloaded = false; + out: taprio_offload_free(offload); @@ -1948,12 +1951,14 @@ static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) { - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); + struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + unsigned int ntx = cl - 1; - if (!dev_queue) + if (ntx >= dev->num_tx_queues) return NULL; - return dev_queue->qdisc_sleeping; + return q->qdiscs[ntx]; } static unsigned long taprio_find(struct Qdisc *sch, u32 classid) diff -Nru linux-aws-5.19.0/net/sched/sch_tbf.c linux-aws-5.19.0/net/sched/sch_tbf.c --- linux-aws-5.19.0/net/sched/sch_tbf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sched/sch_tbf.c 2022-11-29 07:06:46.000000000 +0000 @@ -356,6 +356,7 @@ struct nlattr *tb[TCA_TBF_MAX + 1]; struct tc_tbf_qopt *qopt; struct Qdisc *child = NULL; + struct Qdisc *old = NULL; struct psched_ratecfg rate; struct psched_ratecfg peak; u64 max_size; @@ -447,7 +448,7 @@ sch_tree_lock(sch); if (child) { qdisc_tree_flush_backlog(q->qdisc); - qdisc_put(q->qdisc); + old = q->qdisc; q->qdisc = child; } q->limit = qopt->limit; @@ -467,6 +468,7 @@ memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); sch_tree_unlock(sch); + qdisc_put(old); err = 0; tbf_offload_change(sch); diff -Nru linux-aws-5.19.0/net/sctp/auth.c linux-aws-5.19.0/net/sctp/auth.c --- linux-aws-5.19.0/net/sctp/auth.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/sctp/auth.c 2022-11-29 07:06:46.000000000 +0000 @@ -863,12 +863,17 @@ } list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); list_add(&cur_key->key_list, sh_keys); - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (asoc && asoc->active_key_id == auth_key->sca_keynumber && + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + list_del_init(&cur_key->key_list); + sctp_auth_shkey_release(cur_key); + list_add(&shkey->key_list, sh_keys); + return -ENOMEM; + } + sctp_auth_shkey_release(shkey); return 0; } @@ -902,8 +907,13 @@ return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; diff -Nru linux-aws-5.19.0/net/smc/af_smc.c linux-aws-5.19.0/net/smc/af_smc.c --- linux-aws-5.19.0/net/smc/af_smc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/smc/af_smc.c 2022-11-29 07:06:46.000000000 +0000 @@ -1812,7 +1812,6 @@ { struct sock *newsmcsk = &new_smc->sk; - sk_refcnt_debug_inc(newsmcsk); if (newsmcsk->sk_state == SMC_INIT) newsmcsk->sk_state = SMC_ACTIVE; diff -Nru linux-aws-5.19.0/net/smc/smc_core.c linux-aws-5.19.0/net/smc/smc_core.c --- linux-aws-5.19.0/net/smc/smc_core.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/smc/smc_core.c 2022-11-29 07:06:46.000000000 +0000 @@ -755,6 +755,7 @@ lnk->lgr = lgr; smc_lgr_hold(lgr); /* lgr_put in smcr_link_clear() */ lnk->link_idx = link_idx; + lnk->wr_rx_id_compl = 0; smc_ibdev_cnt_inc(lnk); smcr_copy_dev_info_to_link(lnk); atomic_set(&lnk->conn_cnt, 0); @@ -2147,7 +2148,7 @@ static int smcr_buf_map_usable_links(struct smc_link_group *lgr, struct smc_buf_desc *buf_desc, bool is_rmb) { - int i, rc = 0; + int i, rc = 0, cnt = 0; /* protect against parallel link reconfiguration */ mutex_lock(&lgr->llc_conf_mutex); @@ -2160,9 +2161,12 @@ rc = -ENOMEM; goto out; } + cnt++; } out: mutex_unlock(&lgr->llc_conf_mutex); + if (!rc && !cnt) + rc = -EINVAL; return rc; } diff -Nru linux-aws-5.19.0/net/smc/smc_core.h linux-aws-5.19.0/net/smc/smc_core.h --- linux-aws-5.19.0/net/smc/smc_core.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/smc/smc_core.h 2022-11-29 07:06:46.000000000 +0000 @@ -115,8 +115,10 @@ dma_addr_t wr_rx_dma_addr; /* DMA address of wr_rx_bufs */ dma_addr_t wr_rx_v2_dma_addr; /* DMA address of v2 rx buf*/ u64 wr_rx_id; /* seq # of last recv WR */ + u64 wr_rx_id_compl; /* seq # of last completed WR */ u32 wr_rx_cnt; /* number of WR recv buffers */ unsigned long wr_rx_tstamp; /* jiffies when last buf rx */ + wait_queue_head_t wr_rx_empty_wait; /* wait for RQ empty */ struct ib_reg_wr wr_reg; /* WR register memory region */ wait_queue_head_t wr_reg_wait; /* wait for wr_reg result */ diff -Nru linux-aws-5.19.0/net/smc/smc_wr.c linux-aws-5.19.0/net/smc/smc_wr.c --- linux-aws-5.19.0/net/smc/smc_wr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/smc/smc_wr.c 2022-11-29 07:06:46.000000000 +0000 @@ -454,6 +454,7 @@ for (i = 0; i < num; i++) { link = wc[i].qp->qp_context; + link->wr_rx_id_compl = wc[i].wr_id; if (wc[i].status == IB_WC_SUCCESS) { link->wr_rx_tstamp = jiffies; smc_wr_rx_demultiplex(&wc[i]); @@ -465,6 +466,8 @@ case IB_WC_RNR_RETRY_EXC_ERR: case IB_WC_WR_FLUSH_ERR: smcr_link_down_cond_sched(link); + if (link->wr_rx_id_compl == link->wr_rx_id) + wake_up(&link->wr_rx_empty_wait); break; default: smc_wr_rx_post(link); /* refill WR RX */ @@ -639,6 +642,7 @@ return; ibdev = lnk->smcibdev->ibdev; + smc_wr_drain_cq(lnk); smc_wr_wakeup_reg_wait(lnk); smc_wr_wakeup_tx_wait(lnk); @@ -889,6 +893,7 @@ atomic_set(&lnk->wr_tx_refcnt, 0); init_waitqueue_head(&lnk->wr_reg_wait); atomic_set(&lnk->wr_reg_refcnt, 0); + init_waitqueue_head(&lnk->wr_rx_empty_wait); return rc; dma_unmap: diff -Nru linux-aws-5.19.0/net/smc/smc_wr.h linux-aws-5.19.0/net/smc/smc_wr.h --- linux-aws-5.19.0/net/smc/smc_wr.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/smc/smc_wr.h 2022-11-29 07:06:46.000000000 +0000 @@ -73,6 +73,11 @@ wake_up_all(&link->wr_tx_wait); } +static inline void smc_wr_drain_cq(struct smc_link *lnk) +{ + wait_event(lnk->wr_rx_empty_wait, lnk->wr_rx_id_compl == lnk->wr_rx_id); +} + static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk) { wake_up_all(&lnk->wr_tx_wait); diff -Nru linux-aws-5.19.0/net/sunrpc/clnt.c linux-aws-5.19.0/net/sunrpc/clnt.c --- linux-aws-5.19.0/net/sunrpc/clnt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/sunrpc/clnt.c 2022-11-29 07:06:46.000000000 +0000 @@ -2858,6 +2858,9 @@ task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC, &rpc_cb_add_xprt_call_ops, data); + if (IS_ERR(task)) + return PTR_ERR(task); + data->xps->xps_nunique_destaddr_xprts++; rpc_put_task(task); success: diff -Nru linux-aws-5.19.0/net/sunrpc/xprt.c linux-aws-5.19.0/net/sunrpc/xprt.c --- linux-aws-5.19.0/net/sunrpc/xprt.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/sunrpc/xprt.c 2022-11-29 07:06:46.000000000 +0000 @@ -1179,11 +1179,8 @@ { struct rpc_rqst *req = task->tk_rqstp; - if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { + if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) xprt_request_rb_remove(req->rq_xprt, req); - xdr_free_bvec(&req->rq_rcv_buf); - req->rq_private_buf.bvec = NULL; - } } /** @@ -1221,6 +1218,8 @@ xprt->stat.recvs++; + xdr_free_bvec(&req->rq_rcv_buf); + req->rq_private_buf.bvec = NULL; req->rq_private_buf.len = copied; /* Ensure all writes are done before we update */ /* req->rq_reply_bytes_recvd */ @@ -1453,6 +1452,7 @@ xprt_request_dequeue_transmit_locked(task); xprt_request_dequeue_receive_locked(task); spin_unlock(&xprt->queue_lock); + xdr_free_bvec(&req->rq_rcv_buf); } } diff -Nru linux-aws-5.19.0/net/tipc/monitor.c linux-aws-5.19.0/net/tipc/monitor.c --- linux-aws-5.19.0/net/tipc/monitor.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/tipc/monitor.c 2022-11-29 07:06:46.000000000 +0000 @@ -160,7 +160,7 @@ static int map_get(u64 up_map, int i) { - return (up_map & (1 << i)) >> i; + return (up_map & (1ULL << i)) >> i; } static struct tipc_peer *peer_prev(struct tipc_peer *peer) diff -Nru linux-aws-5.19.0/net/unix/af_unix.c linux-aws-5.19.0/net/unix/af_unix.c --- linux-aws-5.19.0/net/unix/af_unix.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/unix/af_unix.c 2022-11-29 07:06:46.000000000 +0000 @@ -548,12 +548,6 @@ skb_queue_purge(&sk->sk_receive_queue); -#if IS_ENABLED(CONFIG_AF_UNIX_OOB) - if (u->oob_skb) { - kfree_skb(u->oob_skb); - u->oob_skb = NULL; - } -#endif WARN_ON(refcount_read(&sk->sk_wmem_alloc)); WARN_ON(!sk_unhashed(sk)); WARN_ON(sk->sk_socket); @@ -598,6 +592,13 @@ unix_state_unlock(sk); +#if IS_ENABLED(CONFIG_AF_UNIX_OOB) + if (u->oob_skb) { + kfree_skb(u->oob_skb); + u->oob_skb = NULL; + } +#endif + wake_up_interruptible_all(&u->peer_wait); if (skpair != NULL) { diff -Nru linux-aws-5.19.0/net/vmw_vsock/virtio_transport_common.c linux-aws-5.19.0/net/vmw_vsock/virtio_transport_common.c --- linux-aws-5.19.0/net/vmw_vsock/virtio_transport_common.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/vmw_vsock/virtio_transport_common.c 2022-11-29 07:06:46.000000000 +0000 @@ -1342,7 +1342,7 @@ void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt); diff -Nru linux-aws-5.19.0/net/wireless/debugfs.c linux-aws-5.19.0/net/wireless/debugfs.c --- linux-aws-5.19.0/net/wireless/debugfs.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/wireless/debugfs.c 2022-11-29 07:06:46.000000000 +0000 @@ -65,9 +65,10 @@ { struct wiphy *wiphy = file->private_data; char *buf; - unsigned int offset = 0, buf_size = PAGE_SIZE, i, r; + unsigned int offset = 0, buf_size = PAGE_SIZE, i; enum nl80211_band band; struct ieee80211_supported_band *sband; + ssize_t r; buf = kzalloc(buf_size, GFP_KERNEL); if (!buf) diff -Nru linux-aws-5.19.0/net/wireless/reg.c linux-aws-5.19.0/net/wireless/reg.c --- linux-aws-5.19.0/net/wireless/reg.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/wireless/reg.c 2022-11-29 07:06:46.000000000 +0000 @@ -2389,6 +2389,10 @@ switch (iftype) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: + if (!wdev->links[link].ap.beacon_interval) + continue; + chandef = wdev->links[link].ap.chandef; + break; case NL80211_IFTYPE_MESH_POINT: if (!wdev->u.mesh.beacon_interval) continue; diff -Nru linux-aws-5.19.0/net/wireless/util.c linux-aws-5.19.0/net/wireless/util.c --- linux-aws-5.19.0/net/wireless/util.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/wireless/util.c 2022-11-29 07:06:46.000000000 +0000 @@ -1361,7 +1361,7 @@ 25599, /* 4.166666... */ 17067, /* 2.777777... */ 12801, /* 2.083333... */ - 11769, /* 1.851851... */ + 11377, /* 1.851725... */ 10239, /* 1.666666... */ 8532, /* 1.388888... */ 7680, /* 1.250000... */ @@ -1444,7 +1444,7 @@ 25599, /* 4.166666... */ 17067, /* 2.777777... */ 12801, /* 2.083333... */ - 11769, /* 1.851851... */ + 11377, /* 1.851725... */ 10239, /* 1.666666... */ 8532, /* 1.388888... */ 7680, /* 1.250000... */ diff -Nru linux-aws-5.19.0/net/xdp/xsk_buff_pool.c linux-aws-5.19.0/net/xdp/xsk_buff_pool.c --- linux-aws-5.19.0/net/xdp/xsk_buff_pool.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/xdp/xsk_buff_pool.c 2022-11-29 07:06:46.000000000 +0000 @@ -212,17 +212,18 @@ return err; } -int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_umem *umem, +int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs, struct net_device *dev, u16 queue_id) { u16 flags; + struct xdp_umem *umem = umem_xs->umem; /* One fill and completion ring required for each queue id. */ if (!pool->fq || !pool->cq) return -EINVAL; flags = umem->zc ? XDP_ZEROCOPY : XDP_COPY; - if (pool->uses_need_wakeup) + if (umem_xs->pool->uses_need_wakeup) flags |= XDP_USE_NEED_WAKEUP; return xp_assign_dev(pool, dev, queue_id, flags); @@ -379,6 +380,16 @@ static int xp_init_dma_info(struct xsk_buff_pool *pool, struct xsk_dma_map *dma_map) { + if (!pool->unaligned) { + u32 i; + + for (i = 0; i < pool->heads_cnt; i++) { + struct xdp_buff_xsk *xskb = &pool->heads[i]; + + xp_init_xskb_dma(xskb, pool, dma_map->dma_pages, xskb->orig_addr); + } + } + pool->dma_pages = kvcalloc(dma_map->dma_pages_cnt, sizeof(*pool->dma_pages), GFP_KERNEL); if (!pool->dma_pages) return -ENOMEM; @@ -428,12 +439,6 @@ if (pool->unaligned) xp_check_dma_contiguity(dma_map); - else - for (i = 0; i < pool->heads_cnt; i++) { - struct xdp_buff_xsk *xskb = &pool->heads[i]; - - xp_init_xskb_dma(xskb, pool, dma_map->dma_pages, xskb->orig_addr); - } err = xp_init_dma_info(pool, dma_map); if (err) { diff -Nru linux-aws-5.19.0/net/xdp/xsk.c linux-aws-5.19.0/net/xdp/xsk.c --- linux-aws-5.19.0/net/xdp/xsk.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/xdp/xsk.c 2022-11-29 07:06:46.000000000 +0000 @@ -355,16 +355,15 @@ return nb_pkts; } -u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) +u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 nb_pkts) { struct xdp_sock *xs; - u32 nb_pkts; rcu_read_lock(); if (!list_is_singular(&pool->xsk_tx_list)) { /* Fallback to the non-batched version */ rcu_read_unlock(); - return xsk_tx_peek_release_fallback(pool, max_entries); + return xsk_tx_peek_release_fallback(pool, nb_pkts); } xs = list_first_or_null_rcu(&pool->xsk_tx_list, struct xdp_sock, tx_list); @@ -373,12 +372,7 @@ goto out; } - max_entries = xskq_cons_nb_entries(xs->tx, max_entries); - nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, max_entries); - if (!nb_pkts) { - xs->tx->queue_empty_descs++; - goto out; - } + nb_pkts = xskq_cons_nb_entries(xs->tx, nb_pkts); /* This is the backpressure mechanism for the Tx path. Try to * reserve space in the completion queue for all packets, but @@ -386,12 +380,18 @@ * packets. This avoids having to implement any buffering in * the Tx path. */ - nb_pkts = xskq_prod_reserve_addr_batch(pool->cq, pool->tx_descs, nb_pkts); + nb_pkts = xskq_prod_nb_free(pool->cq, nb_pkts); if (!nb_pkts) goto out; - xskq_cons_release_n(xs->tx, max_entries); + nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, nb_pkts); + if (!nb_pkts) { + xs->tx->queue_empty_descs++; + goto out; + } + __xskq_cons_release(xs->tx); + xskq_prod_write_addr_batch(pool->cq, pool->tx_descs, nb_pkts); xs->sk.sk_write_space(&xs->sk); out: @@ -951,8 +951,8 @@ goto out_unlock; } - err = xp_assign_dev_shared(xs->pool, umem_xs->umem, - dev, qid); + err = xp_assign_dev_shared(xs->pool, umem_xs, dev, + qid); if (err) { xp_destroy(xs->pool); xs->pool = NULL; diff -Nru linux-aws-5.19.0/net/xdp/xsk_queue.h linux-aws-5.19.0/net/xdp/xsk_queue.h --- linux-aws-5.19.0/net/xdp/xsk_queue.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/xdp/xsk_queue.h 2022-11-29 07:06:46.000000000 +0000 @@ -205,6 +205,11 @@ return false; } +static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) +{ + q->cached_cons += cnt; +} + static inline u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff_pool *pool, u32 max) { @@ -226,6 +231,8 @@ cached_cons++; } + /* Release valid plus any invalid entries */ + xskq_cons_release_n(q, cached_cons - q->cached_cons); return nb_entries; } @@ -291,11 +298,6 @@ q->cached_cons++; } -static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) -{ - q->cached_cons += cnt; -} - static inline u32 xskq_cons_present_entries(struct xsk_queue *q) { /* No barriers needed since data is not accessed */ @@ -350,21 +352,17 @@ return 0; } -static inline u32 xskq_prod_reserve_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, - u32 max) +static inline void xskq_prod_write_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, + u32 nb_entries) { struct xdp_umem_ring *ring = (struct xdp_umem_ring *)q->ring; - u32 nb_entries, i, cached_prod; - - nb_entries = xskq_prod_nb_free(q, max); + u32 i, cached_prod; /* A, matches D */ cached_prod = q->cached_prod; for (i = 0; i < nb_entries; i++) ring->desc[cached_prod++ & q->ring_mask] = descs[i].addr; q->cached_prod = cached_prod; - - return nb_entries; } static inline int xskq_prod_reserve_desc(struct xsk_queue *q, diff -Nru linux-aws-5.19.0/net/xfrm/xfrm_input.c linux-aws-5.19.0/net/xfrm/xfrm_input.c --- linux-aws-5.19.0/net/xfrm/xfrm_input.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/net/xfrm/xfrm_input.c 2022-11-29 07:06:46.000000000 +0000 @@ -24,7 +24,8 @@ #include "xfrm_inout.h" struct xfrm_trans_tasklet { - struct tasklet_struct tasklet; + struct work_struct work; + spinlock_t queue_lock; struct sk_buff_head queue; }; @@ -760,18 +761,22 @@ } EXPORT_SYMBOL(xfrm_input_resume); -static void xfrm_trans_reinject(struct tasklet_struct *t) +static void xfrm_trans_reinject(struct work_struct *work) { - struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet); + struct xfrm_trans_tasklet *trans = container_of(work, struct xfrm_trans_tasklet, work); struct sk_buff_head queue; struct sk_buff *skb; __skb_queue_head_init(&queue); + spin_lock_bh(&trans->queue_lock); skb_queue_splice_init(&trans->queue, &queue); + spin_unlock_bh(&trans->queue_lock); + local_bh_disable(); while ((skb = __skb_dequeue(&queue))) XFRM_TRANS_SKB_CB(skb)->finish(XFRM_TRANS_SKB_CB(skb)->net, NULL, skb); + local_bh_enable(); } int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, @@ -789,8 +794,10 @@ XFRM_TRANS_SKB_CB(skb)->finish = finish; XFRM_TRANS_SKB_CB(skb)->net = net; + spin_lock_bh(&trans->queue_lock); __skb_queue_tail(&trans->queue, skb); - tasklet_schedule(&trans->tasklet); + spin_unlock_bh(&trans->queue_lock); + schedule_work(&trans->work); return 0; } EXPORT_SYMBOL(xfrm_trans_queue_net); @@ -817,7 +824,8 @@ struct xfrm_trans_tasklet *trans; trans = &per_cpu(xfrm_trans_tasklet, i); + spin_lock_init(&trans->queue_lock); __skb_queue_head_init(&trans->queue); - tasklet_setup(&trans->tasklet, xfrm_trans_reinject); + INIT_WORK(&trans->work, xfrm_trans_reinject); } } diff -Nru linux-aws-5.19.0/net/xfrm/xfrm_ipcomp.c linux-aws-5.19.0/net/xfrm/xfrm_ipcomp.c --- linux-aws-5.19.0/net/xfrm/xfrm_ipcomp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/net/xfrm/xfrm_ipcomp.c 2022-11-29 07:06:46.000000000 +0000 @@ -203,6 +203,7 @@ vfree(*per_cpu_ptr(scratches, i)); free_percpu(scratches); + ipcomp_scratches = NULL; } static void * __percpu *ipcomp_alloc_scratches(void) diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am33xx-l4.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am33xx-l4.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am33xx-l4.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am33xx-l4.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1502,8 +1502,7 @@ mmc1: mmc@0 { compatible = "ti,am335-sdhci"; ti,needs-special-reset; - dmas = <&edma_xbar 24 0 0 - &edma_xbar 25 0 0>; + dmas = <&edma 24 0>, <&edma 25 0>; dma-names = "tx", "rx"; interrupts = <64>; reg = <0x0 0x1000>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am5748.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am5748.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am5748.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/am5748.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -25,6 +25,10 @@ status = "disabled"; }; +&usb4_tm { + status = "disabled"; +}; + &atl_tm { status = "disabled"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/armada-385-turris-omnia.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/armada-385-turris-omnia.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/armada-385-turris-omnia.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/armada-385-turris-omnia.dts 2022-11-29 07:06:46.000000000 +0000 @@ -478,7 +478,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -513,7 +513,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d27_wlsom1.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d27_wlsom1.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d27_wlsom1.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d27_wlsom1.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -76,8 +76,8 @@ regulators { vdd_3v3: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -95,8 +95,8 @@ vddio_ddr: VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -118,8 +118,8 @@ vdd_core: VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -160,8 +160,8 @@ LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-always-on; regulator-state-standby { @@ -175,9 +175,8 @@ LDO2 { regulator-name = "LDO2"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; - regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; regulator-state-standby { regulator-on-in-suspend; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d2_icp.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d2_icp.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d2_icp.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama5d2_icp.dts 2022-11-29 07:06:46.000000000 +0000 @@ -197,8 +197,8 @@ regulators { vdd_io_reg: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -216,8 +216,8 @@ VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -235,8 +235,8 @@ VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -258,7 +258,6 @@ regulator-max-microvolt = <1850000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; - regulator-always-on; regulator-state-standby { regulator-on-in-suspend; @@ -273,8 +272,8 @@ LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; regulator-always-on; regulator-state-standby { @@ -288,8 +287,8 @@ LDO2 { regulator-name = "LDO2"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-always-on; regulator-state-standby { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama7g5ek.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama7g5ek.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama7g5ek.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/at91-sama7g5ek.dts 2022-11-29 07:06:46.000000000 +0000 @@ -244,8 +244,8 @@ regulators { vdd_3v3: VDD_IO { regulator-name = "VDD_IO"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -264,8 +264,8 @@ vddioddr: VDD_DDR { regulator-name = "VDD_DDR"; - regulator-min-microvolt = <1300000>; - regulator-max-microvolt = <1450000>; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -285,8 +285,8 @@ vddcore: VDD_CORE { regulator-name = "VDD_CORE"; - regulator-min-microvolt = <1100000>; - regulator-max-microvolt = <1850000>; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-always-on; @@ -306,7 +306,7 @@ vddcpu: VDD_OTHER { regulator-name = "VDD_OTHER"; regulator-min-microvolt = <1050000>; - regulator-max-microvolt = <1850000>; + regulator-max-microvolt = <1250000>; regulator-initial-mode = <2>; regulator-allowed-modes = <2>, <4>; regulator-ramp-delay = <3125>; @@ -326,8 +326,8 @@ vldo1: LDO1 { regulator-name = "LDO1"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3700000>; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; regulator-always-on; regulator-state-standby { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-midas.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-midas.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-midas.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-midas.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -585,7 +585,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-origen.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-origen.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-origen.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/exynos4412-origen.dts 2022-11-29 07:06:46.000000000 +0000 @@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl-riotboard.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl-riotboard.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl-riotboard.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6dl-riotboard.dts 2022-11-29 07:06:46.000000000 +0000 @@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-arm2.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-arm2.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-arm2.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-arm2.dts 2022-11-29 07:06:46.000000000 +0000 @@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-kontron-samx6i.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-kontron-samx6i.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-kontron-samx6i.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-kontron-samx6i.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -51,16 +51,6 @@ vin-supply = <®_3p3v_s5>; }; - reg_3p3v_s0: regulator-3p3v-s0 { - compatible = "regulator-fixed"; - regulator-name = "V_3V3_S0"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - regulator-boot-on; - vin-supply = <®_3p3v_s5>; - }; - reg_3p3v_s5: regulator-3p3v-s5 { compatible = "regulator-fixed"; regulator-name = "V_3V3_S5"; @@ -259,7 +249,7 @@ /* default boot source: workaround #1 for errata ERR006282 */ smarc_flash: flash@0 { - compatible = "winbond,w25q16dw", "jedec,spi-nor"; + compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <20000000>; }; @@ -273,6 +263,10 @@ phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; }; +&hdmi { + ddc-i2c-bus = <&i2c2>; +}; + &i2c_intern { pmic@8 { compatible = "fsl,pfuze100"; @@ -397,7 +391,7 @@ /* HDMI_CTRL */ &i2c2 { - clock-frequency = <375000>; + clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nit6xlite.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nit6xlite.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nit6xlite.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nit6xlite.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_max.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_max.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_max.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_max.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_som2.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_som2.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_som2.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6_som2.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6x.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6x.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6x.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-nitrogen6x.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-sabreauto.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-sabreauto.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-sabreauto.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-sabreauto.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-tqma6a.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-tqma6a.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-tqma6a.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-tqma6a.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -7,6 +7,7 @@ #include &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-ts7970.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-ts7970.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-ts7970.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-ts7970.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-vicut1.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-vicut1.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-vicut1.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qdl-vicut1.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -28,7 +28,7 @@ enable-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>; }; - backlight_led: backlight_led { + backlight_led: backlight-led { compatible = "pwm-backlight"; pwms = <&pwm3 0 5000000 0>; brightness-levels = <0 16 64 255>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-evi.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-evi.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-evi.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-evi.dts 2022-11-29 07:06:46.000000000 +0000 @@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-mccmon6.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-mccmon6.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-mccmon6.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6q-mccmon6.dts 2022-11-29 07:06:46.000000000 +0000 @@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qp.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qp.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6qp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sl.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sl.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; @@ -222,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -235,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -248,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -309,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -322,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -711,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sll.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sll.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sll.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sll.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx-udoo-neo.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx-udoo-neo.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx-udoo-neo.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx6sx-udoo-neo.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - ; + ; }; pinctrl_enet1: enet1grp { @@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = , @@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - ; + ; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - ; + ; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - , - ; + , + ; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - ; + ; }; pinctrl_usdhc2: usdhc2grp { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx7d-sdb.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx7d-sdb.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx7d-sdb.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/imx7d-sdb.dts 2022-11-29 07:06:46.000000000 +0000 @@ -206,12 +206,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/integratorap.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/integratorap.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/integratorap.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/integratorap.dts 2022-11-29 07:06:46.000000000 +0000 @@ -160,6 +160,7 @@ pci: pciv3@62000000 { compatible = "arm,integrator-ap-pci", "v3,v360epc-pci"; + device_type = "pci"; #interrupt-cells = <1>; #size-cells = <2>; #address-cells = <3>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/kirkwood-lsxl.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/kirkwood-lsxl.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/kirkwood-lsxl.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/kirkwood-lsxl.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; @@ -213,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/lan966x.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/lan966x.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/lan966x.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/lan966x.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -515,13 +515,13 @@ phy0: ethernet-phy@1 { reg = <1>; - interrupts = ; + interrupts = ; status = "disabled"; }; phy1: ethernet-phy@2 { reg = <2>; - interrupts = ; + interrupts = ; status = "disabled"; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -93,8 +93,8 @@ clock-names = "PCLK"; }; - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_apb>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart-uc7112lx.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart-uc7112lx.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart-uc7112lx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm/moxart-uc7112lx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -79,7 +79,7 @@ clocks = <&ref12>; }; -&sdhci { +&mmc { status = "okay"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/fsl-ls1028a-qds-65bb.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/fsl-ls1028a-qds-65bb.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/fsl-ls1028a-qds-65bb.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/fsl-ls1028a-qds-65bb.dts 2022-11-29 07:06:46.000000000 +0000 @@ -25,7 +25,6 @@ &enetc_port0 { phy-handle = <&slot1_sgmii>; phy-mode = "2500base-x"; - managed = "in-band-status"; status = "okay"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-s.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-s.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-s.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-s.dts 2022-11-29 07:06:46.000000000 +0000 @@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-som.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-som.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-som.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-kontron-n801x-som.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 { @@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-mx8menlo.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-mx8menlo.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-mx8menlo.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-mx8menlo.dts 2022-11-29 07:06:46.000000000 +0000 @@ -152,11 +152,11 @@ * CPLD_reset is RESET_SOFT in schematic */ gpio-line-names = - "CPLD_D[1]", "CPLD_int", "CPLD_reset", "", - "", "CPLD_D[0]", "", "", - "", "", "", "CPLD_D[2]", - "CPLD_D[3]", "CPLD_D[4]", "CPLD_D[5]", "CPLD_D[6]", - "CPLD_D[7]", "", "", "", + "CPLD_D[6]", "CPLD_int", "CPLD_reset", "", + "", "CPLD_D[7]", "", "", + "", "", "", "CPLD_D[5]", + "CPLD_D[4]", "CPLD_D[3]", "CPLD_D[2]", "CPLD_D[1]", + "CPLD_D[0]", "", "", "", "", "", "", "", "", "", "", "KBD_intK", "", "", "", ""; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -3,6 +3,7 @@ * Copyright 2020-2021 TQ-Systems GmbH */ +#include #include "imx8mm.dtsi" / { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml-mba8mx.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml-mba8mx.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml-mba8mx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-tqma8mqml-mba8mx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -5,7 +5,6 @@ /dts-v1/; -#include #include "imx8mm-tqma8mqml.dtsi" #include "mba8mx.dtsi" diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-venice-gw7901.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-venice-gw7901.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-venice-gw7901.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-venice-gw7901.dts 2022-11-29 07:06:46.000000000 +0000 @@ -626,24 +626,28 @@ lan1: port@0 { reg = <0>; label = "lan1"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan2: port@1 { reg = <1>; label = "lan2"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan3: port@2 { reg = <2>; label = "lan3"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan4: port@3 { reg = <3>; label = "lan4"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-verdin.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-verdin.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-verdin.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mm-verdin.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -32,10 +32,10 @@ }; /* Fixed clock dedicated to SPI CAN controller */ - clk20m: oscillator { + clk40m: oscillator { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <20000000>; + clock-frequency = <40000000>; }; gpio-keys { @@ -194,8 +194,8 @@ can1: can@0 { compatible = "microchip,mcp251xfd"; - clocks = <&clk20m>; - interrupts-extended = <&gpio1 6 IRQ_TYPE_EDGE_FALLING>; + clocks = <&clk40m>; + interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_can1_int>; reg = <0>; @@ -359,8 +359,8 @@ nxp,dvs-standby-voltage = <850000>; regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <950000>; - regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1050000>; + regulator-min-microvolt = <805000>; regulator-name = "On-module +VDD_ARM (BUCK2)"; regulator-ramp-delay = <3125>; }; @@ -368,8 +368,8 @@ reg_vdd_dram: BUCK3 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <950000>; - regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1000000>; + regulator-min-microvolt = <805000>; regulator-name = "On-module +VDD_GPU_VPU_DDR (BUCK3)"; }; @@ -408,7 +408,7 @@ reg_vdd_snvs: LDO2 { regulator-always-on; regulator-boot-on; - regulator-max-microvolt = <900000>; + regulator-max-microvolt = <800000>; regulator-min-microvolt = <800000>; regulator-name = "On-module +V0.8_SNVS (LDO2)"; }; @@ -595,7 +595,7 @@ pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; reg = <0x4a>; /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ - reset-gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; status = "disabled"; }; @@ -737,6 +737,7 @@ }; &usbphynop2 { + power-domains = <&pgc_otg2>; vcc-supply = <®_vdd_3v3>; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mn.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mn.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mn.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mn.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -672,7 +672,6 @@ <&clk IMX8MN_CLK_GPU_SHADER>, <&clk IMX8MN_CLK_GPU_BUS_ROOT>, <&clk IMX8MN_CLK_GPU_AHB>; - resets = <&src IMX8MQ_RESET_GPU_RESET>; }; pgc_dispmix: power-domain@3 { diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1168,7 +1168,7 @@ interrupts = ; phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; @@ -1210,7 +1210,7 @@ interrupts = ; phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-venice-gw74xx.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-venice-gw74xx.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-venice-gw74xx.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-venice-gw74xx.dts 2022-11-29 07:06:46.000000000 +0000 @@ -123,8 +123,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_reg_can>; regulator-name = "can2_stby"; - gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; - enable-active-high; + gpio = <&gpio3 19 GPIO_ACTIVE_LOW>; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; @@ -484,35 +483,40 @@ lan1: port@0 { reg = <0>; label = "lan1"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan2: port@1 { reg = <1>; label = "lan2"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan3: port@2 { reg = <2>; label = "lan3"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan4: port@3 { reg = <3>; label = "lan4"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; lan5: port@4 { reg = <4>; label = "lan5"; + phy-mode = "internal"; local-mac-address = [00 00 00 00 00 00]; }; - port@6 { - reg = <6>; + port@5 { + reg = <5>; label = "cpu"; ethernet = <&fec>; phy-mode = "rgmii-id"; @@ -770,10 +774,10 @@ pinctrl_sai2: sai2grp { fsl,pins = < - MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC - MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 - MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK - MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK + MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC 0xd6 + MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0xd6 + MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0xd6 + MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 0xd6 >; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-verdin.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-verdin.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-verdin.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mp-verdin.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -620,7 +620,7 @@ interrupts = <5 IRQ_TYPE_EDGE_FALLING>; reg = <0x4a>; /* Verdin GPIO_2 (SODIMM 208) */ - reset-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; status = "disabled"; }; }; @@ -697,7 +697,7 @@ pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; reg = <0x4a>; /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ - reset-gpios = <&gpio5 0 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; status = "disabled"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-librem5.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-librem5.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-librem5.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-librem5.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-tqma8mq.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-tqma8mq.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-tqma8mq.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8mq-tqma8mq.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -204,7 +204,6 @@ reg = <0x51>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_rtc>; - interrupt-names = "irq"; interrupt-parent = <&gpio1>; interrupts = <1 IRQ_TYPE_EDGE_FALLING>; quartz-load-femtofarads = <7000>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8ulp.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8ulp.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8ulp.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/freescale/imx8ulp.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -172,6 +172,7 @@ compatible = "fsl,imx8ulp-pcc3"; reg = <0x292d0000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; tpm5: tpm@29340000 { @@ -270,6 +271,7 @@ compatible = "fsl,imx8ulp-pcc4"; reg = <0x29800000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; lpi2c6: i2c@29840000 { @@ -414,6 +416,7 @@ compatible = "fsl,imx8ulp-pcc5"; reg = <0x2da70000 0x10000>; #clock-cells = <1>; + #reset-cells = <1>; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sdm845-mtp.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sdm845-mtp.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sdm845-mtp.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sdm845-mtp.dts 2022-11-29 07:06:46.000000000 +0000 @@ -536,42 +536,42 @@ reg = ; label = "xo_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4d { reg = ; label = "msm_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4f { reg = ; label = "pa_therm1"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@51 { reg = ; label = "quiet_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@83 { reg = ; label = "vph_pwr"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@85 { reg = ; label = "vcoin"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sm8350.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sm8350.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sm8350.dtsi 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/qcom/sm8350.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -2128,7 +2128,7 @@ ufs_mem_phy: phy@1d87000 { compatible = "qcom,sm8350-qmp-ufs-phy"; - reg = <0 0x01d87000 0 0xe10>; + reg = <0 0x01d87000 0 0x1c4>; #address-cells = <2>; #size-cells = <2>; ranges; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r8a779g0.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r8a779g0.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r8a779g0.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r8a779g0.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -85,7 +85,7 @@ "renesas,rcar-gen4-hscif", "renesas,hscif"; reg = <0 0xe6540000 0 96>; - interrupts = ; + interrupts = ; clocks = <&cpg CPG_MOD 514>, <&cpg CPG_CORE R8A779G0_CLK_S0D3_PER>, <&scif_clk>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g043.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g043.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g043.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g043.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -334,8 +334,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI0_CLKP>; @@ -349,8 +349,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g044.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g044.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g044.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g044.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -394,8 +394,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI0_CLKP>; @@ -409,8 +409,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g054.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g054.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g054.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/renesas/r9a07g054.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -399,8 +399,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI0_CLKP>; @@ -414,8 +414,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI1_CLKP>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/px30-engicam-px30-core.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/px30-engicam-px30-core.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/px30-engicam-px30-core.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/px30-engicam-px30-core.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -2,8 +2,8 @@ /* * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd * Copyright (c) 2020 Engicam srl - * Copyright (c) 2020 Amarula Solutons - * Copyright (c) 2020 Amarula Solutons(India) + * Copyright (c) 2020 Amarula Solutions + * Copyright (c) 2020 Amarula Solutions(India) */ #include diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-bob.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-bob.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-bob.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-bob.dts 2022-11-29 07:06:46.000000000 +0000 @@ -88,3 +88,8 @@ }; }; }; + +&wlan_host_wake_l { + /* Kevin has an external pull up, but Bob does not. */ + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; +}; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-chromebook.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-chromebook.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-chromebook.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-gru-chromebook.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -244,6 +244,14 @@ &edp { status = "okay"; + /* + * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only + * set this here, because rk3399-gru.dtsi ensures we can generate this + * off GPLL=600MHz, whereas some other RK3399 boards may not. + */ + assigned-clocks = <&cru PCLK_EDP>; + assigned-clock-rates = <24000000>; + ports { edp_out: port@1 { reg = <1>; @@ -578,6 +586,7 @@ }; wlan_host_wake_l: wlan-host-wake-l { + /* Kevin has an external pull up, but Bob does not */ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-puma.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-puma.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-puma.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3399-puma.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -62,7 +62,6 @@ vcc5v0_host: vcc5v0-host-regulator { compatible = "regulator-fixed"; gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; - enable-active-low; pinctrl-names = "default"; pinctrl-0 = <&vcc5v0_host_en>; regulator-name = "vcc5v0_host"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-a.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-a.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-a.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-a.dts 2022-11-29 07:06:46.000000000 +0000 @@ -163,7 +163,6 @@ vcc3v3_sd: vcc3v3_sd { compatible = "regulator-fixed"; - enable-active-low; gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&vcc_sd_h>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-b.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-b.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-b.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3566-quartz64-b.dts 2022-11-29 07:06:46.000000000 +0000 @@ -506,7 +506,7 @@ disable-wp; pinctrl-names = "default"; pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; - sd-uhs-sdr104; + sd-uhs-sdr50; vmmc-supply = <&vcc3v3_sd>; vqmmc-supply = <&vccio_sd>; status = "okay"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-bpi-r2-pro.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-bpi-r2-pro.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-bpi-r2-pro.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-bpi-r2-pro.dts 2022-11-29 07:06:46.000000000 +0000 @@ -558,7 +558,7 @@ }; &usb_host0_xhci { - extcon = <&usb2phy0>; + dr_mode = "host"; status = "okay"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-evb1-v10.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-evb1-v10.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-evb1-v10.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-evb1-v10.dts 2022-11-29 07:06:46.000000000 +0000 @@ -618,7 +618,7 @@ }; &usb2phy0_otg { - vbus-supply = <&vcc5v0_usb_otg>; + phy-supply = <&vcc5v0_usb_otg>; status = "okay"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-rock-3a.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-rock-3a.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-rock-3a.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-rock-3a.dts 2022-11-29 07:06:46.000000000 +0000 @@ -543,7 +543,7 @@ }; &usb2phy0_otg { - vbus-supply = <&vcc5v0_usb_otg>; + phy-supply = <&vcc5v0_usb_otg>; status = "okay"; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-common-proc-board.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-common-proc-board.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-common-proc-board.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-common-proc-board.dts 2022-11-29 07:06:46.000000000 +0000 @@ -134,15 +134,17 @@ >; }; - main_usbss0_pins_default: main-usbss0-pins-default { + vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ + J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ >; }; +}; - vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { +&main_pmx1 { + main_usbss0_pins_default: main-usbss0-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ + J721E_IOPAD(0x04, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ >; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-main.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-main.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-main.dtsi 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/arm64/ti/k3-j7200-main.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -295,7 +295,16 @@ main_pmx0: pinctrl@11c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x11c000 0x00 0x2b4>; + reg = <0x00 0x11c000 0x00 0x10c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + main_pmx1: pinctrl@11c11c { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x11c11c 0x00 0xc>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/dt-bindings/clock/samsung,exynosautov9.h linux-aws-5.19.0/scripts/dtc/include-prefixes/dt-bindings/clock/samsung,exynosautov9.h --- linux-aws-5.19.0/scripts/dtc/include-prefixes/dt-bindings/clock/samsung,exynosautov9.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/dt-bindings/clock/samsung,exynosautov9.h 2022-11-29 07:06:46.000000000 +0000 @@ -226,21 +226,21 @@ #define CLK_GOUT_PERIC0_IPCLK_8 28 #define CLK_GOUT_PERIC0_IPCLK_9 29 #define CLK_GOUT_PERIC0_IPCLK_10 30 -#define CLK_GOUT_PERIC0_IPCLK_11 30 -#define CLK_GOUT_PERIC0_PCLK_0 31 -#define CLK_GOUT_PERIC0_PCLK_1 32 -#define CLK_GOUT_PERIC0_PCLK_2 33 -#define CLK_GOUT_PERIC0_PCLK_3 34 -#define CLK_GOUT_PERIC0_PCLK_4 35 -#define CLK_GOUT_PERIC0_PCLK_5 36 -#define CLK_GOUT_PERIC0_PCLK_6 37 -#define CLK_GOUT_PERIC0_PCLK_7 38 -#define CLK_GOUT_PERIC0_PCLK_8 39 -#define CLK_GOUT_PERIC0_PCLK_9 40 -#define CLK_GOUT_PERIC0_PCLK_10 41 -#define CLK_GOUT_PERIC0_PCLK_11 42 +#define CLK_GOUT_PERIC0_IPCLK_11 31 +#define CLK_GOUT_PERIC0_PCLK_0 32 +#define CLK_GOUT_PERIC0_PCLK_1 33 +#define CLK_GOUT_PERIC0_PCLK_2 34 +#define CLK_GOUT_PERIC0_PCLK_3 35 +#define CLK_GOUT_PERIC0_PCLK_4 36 +#define CLK_GOUT_PERIC0_PCLK_5 37 +#define CLK_GOUT_PERIC0_PCLK_6 38 +#define CLK_GOUT_PERIC0_PCLK_7 39 +#define CLK_GOUT_PERIC0_PCLK_8 40 +#define CLK_GOUT_PERIC0_PCLK_9 41 +#define CLK_GOUT_PERIC0_PCLK_10 42 +#define CLK_GOUT_PERIC0_PCLK_11 43 -#define PERIC0_NR_CLK 43 +#define PERIC0_NR_CLK 44 /* CMU_PERIC1 */ #define CLK_MOUT_PERIC1_BUS_USER 1 @@ -272,21 +272,21 @@ #define CLK_GOUT_PERIC1_IPCLK_8 28 #define CLK_GOUT_PERIC1_IPCLK_9 29 #define CLK_GOUT_PERIC1_IPCLK_10 30 -#define CLK_GOUT_PERIC1_IPCLK_11 30 -#define CLK_GOUT_PERIC1_PCLK_0 31 -#define CLK_GOUT_PERIC1_PCLK_1 32 -#define CLK_GOUT_PERIC1_PCLK_2 33 -#define CLK_GOUT_PERIC1_PCLK_3 34 -#define CLK_GOUT_PERIC1_PCLK_4 35 -#define CLK_GOUT_PERIC1_PCLK_5 36 -#define CLK_GOUT_PERIC1_PCLK_6 37 -#define CLK_GOUT_PERIC1_PCLK_7 38 -#define CLK_GOUT_PERIC1_PCLK_8 39 -#define CLK_GOUT_PERIC1_PCLK_9 40 -#define CLK_GOUT_PERIC1_PCLK_10 41 -#define CLK_GOUT_PERIC1_PCLK_11 42 +#define CLK_GOUT_PERIC1_IPCLK_11 31 +#define CLK_GOUT_PERIC1_PCLK_0 32 +#define CLK_GOUT_PERIC1_PCLK_1 33 +#define CLK_GOUT_PERIC1_PCLK_2 34 +#define CLK_GOUT_PERIC1_PCLK_3 35 +#define CLK_GOUT_PERIC1_PCLK_4 36 +#define CLK_GOUT_PERIC1_PCLK_5 37 +#define CLK_GOUT_PERIC1_PCLK_6 38 +#define CLK_GOUT_PERIC1_PCLK_7 39 +#define CLK_GOUT_PERIC1_PCLK_8 40 +#define CLK_GOUT_PERIC1_PCLK_9 41 +#define CLK_GOUT_PERIC1_PCLK_10 42 +#define CLK_GOUT_PERIC1_PCLK_11 43 -#define PERIC1_NR_CLK 43 +#define PERIC1_NR_CLK 44 /* CMU_PERIS */ #define CLK_MOUT_PERIS_BUS_USER 1 diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/mips/ralink/mt7621-gnubee-gb-pc2.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/mips/ralink/mt7621-gnubee-gb-pc2.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/mips/ralink/mt7621-gnubee-gb-pc2.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/mips/ralink/mt7621-gnubee-gb-pc2.dts 2022-11-29 07:06:46.000000000 +0000 @@ -83,12 +83,12 @@ &gmac1 { status = "okay"; - phy-handle = <ðphy7>; + phy-handle = <ðphy5>; }; &mdio { - ethphy7: ethernet-phy@7 { - reg = <7>; + ethphy5: ethernet-phy@5 { + reg = <5>; phy-mode = "rgmii-rxid"; }; }; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/e500v1_power_isa.dtsi linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/e500v1_power_isa.dtsi --- linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/e500v1_power_isa.dtsi 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/e500v1_power_isa.dtsi 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +}; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8540ads.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8540ads.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8540ads.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8540ads.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8541cds.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8541cds.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8541cds.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8541cds.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8555cds.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8555cds.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8555cds.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8555cds.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS"; diff -Nru linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8560ads.dts linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8560ads.dts --- linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8560ads.dts 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/dtc/include-prefixes/powerpc/fsl/mpc8560ads.dts 2022-11-29 07:06:46.000000000 +0000 @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; diff -Nru linux-aws-5.19.0/scripts/Kbuild.include linux-aws-5.19.0/scripts/Kbuild.include --- linux-aws-5.19.0/scripts/Kbuild.include 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/Kbuild.include 2022-11-29 07:06:46.000000000 +0000 @@ -100,8 +100,29 @@ quiet_redirect := silent_redirect := exec >/dev/null; +# Delete the target on interruption +# +# GNU Make automatically deletes the target if it has already been changed by +# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make +# will delete incomplete targets), and resume it later. +# +# However, this does not work when the stderr is piped to another program, like +# $ make >&2 | tee log +# Make dies with SIGPIPE before cleaning the targets. +# +# To address it, we clean the target in signal traps. +# +# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. +# So, we cover them, and also SIGPIPE just in case. +# +# Of course, this is unneeded for phony targets. +delete-on-interrupt = \ + $(if $(filter-out $(PHONY), $@), \ + $(foreach sig, HUP INT QUIT TERM PIPE, \ + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) + # printing commands -cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1)) +cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1)) ### # if_changed - execute command if any prerequisite is newer than diff -Nru linux-aws-5.19.0/scripts/Makefile.debug linux-aws-5.19.0/scripts/Makefile.debug --- linux-aws-5.19.0/scripts/Makefile.debug 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/Makefile.debug 2022-11-29 07:06:46.000000000 +0000 @@ -1,20 +1,19 @@ DEBUG_CFLAGS := +debug-flags-y := -g ifdef CONFIG_DEBUG_INFO_SPLIT DEBUG_CFLAGS += -gsplit-dwarf -else -DEBUG_CFLAGS += -g endif -ifndef CONFIG_AS_IS_LLVM -KBUILD_AFLAGS += -Wa,-gdwarf-2 -endif - -ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 -dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 -DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) +debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 +debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) +# Clang does not pass -g or -gdwarf-* option down to GAS. +# Add -Wa, prefix to explicitly specify the flags. +KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) endif +DEBUG_CFLAGS += $(debug-flags-y) +KBUILD_AFLAGS += $(debug-flags-y) ifdef CONFIG_DEBUG_INFO_REDUCED DEBUG_CFLAGS += -fno-var-tracking @@ -29,5 +28,5 @@ KBUILD_LDFLAGS += --compress-debug-sections=zlib endif -KBUILD_CFLAGS += $(DEBUG_CFLAGS) +KBUILD_CFLAGS += $(DEBUG_CFLAGS) export DEBUG_CFLAGS diff -Nru linux-aws-5.19.0/scripts/Makefile.extrawarn linux-aws-5.19.0/scripts/Makefile.extrawarn --- linux-aws-5.19.0/scripts/Makefile.extrawarn 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/Makefile.extrawarn 2022-11-29 07:06:46.000000000 +0000 @@ -53,6 +53,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) +KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) endif endif diff -Nru linux-aws-5.19.0/scripts/package/mkspec linux-aws-5.19.0/scripts/package/mkspec --- linux-aws-5.19.0/scripts/package/mkspec 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/package/mkspec 2022-11-29 07:06:46.000000000 +0000 @@ -85,10 +85,10 @@ mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install diff -Nru linux-aws-5.19.0/scripts/pahole-flags.sh linux-aws-5.19.0/scripts/pahole-flags.sh --- linux-aws-5.19.0/scripts/pahole-flags.sh 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/pahole-flags.sh 2022-11-29 07:06:46.000000000 +0000 @@ -20,4 +20,8 @@ extra_paholeopt="${extra_paholeopt} -j" fi +if [ "${pahole_ver}" -ge "124" ]; then + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64" +fi + echo ${extra_paholeopt} diff -Nru linux-aws-5.19.0/scripts/selinux/install_policy.sh linux-aws-5.19.0/scripts/selinux/install_policy.sh --- linux-aws-5.19.0/scripts/selinux/install_policy.sh 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/scripts/selinux/install_policy.sh 2022-11-29 07:06:46.000000000 +0000 @@ -78,7 +78,7 @@ $SF -F file_contexts / mounts=`cat /proc/$$/mounts | \ - egrep "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ + grep -E "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ awk '{ print $2 '}` $SF -F file_contexts $mounts diff -Nru linux-aws-5.19.0/security/integrity/ima/ima_appraise.c linux-aws-5.19.0/security/integrity/ima/ima_appraise.c --- linux-aws-5.19.0/security/integrity/ima/ima_appraise.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/security/integrity/ima/ima_appraise.c 2022-11-29 07:06:46.000000000 +0000 @@ -751,22 +751,26 @@ const struct evm_ima_xattr_data *xvalue = xattr_value; int digsig = 0; int result; + int err; result = ima_protect_xattr(dentry, xattr_name, xattr_value, xattr_value_len); if (result == 1) { if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) return -EINVAL; + + err = validate_hash_algo(dentry, xvalue, xattr_value_len); + if (err) + return err; + digsig = (xvalue->type == EVM_IMA_XATTR_DIGSIG); } else if (!strcmp(xattr_name, XATTR_NAME_EVM) && xattr_value_len > 0) { digsig = (xvalue->type == EVM_XATTR_PORTABLE_DIGSIG); } if (result == 1 || evm_revalidate_status(xattr_name)) { - result = validate_hash_algo(dentry, xvalue, xattr_value_len); - if (result) - return result; - ima_reset_appraise_flags(d_backing_inode(dentry), digsig); + if (result == 1) + result = 0; } return result; } diff -Nru linux-aws-5.19.0/security/integrity/platform_certs/load_uefi.c linux-aws-5.19.0/security/integrity/platform_certs/load_uefi.c --- linux-aws-5.19.0/security/integrity/platform_certs/load_uefi.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/security/integrity/platform_certs/load_uefi.c 2022-11-29 07:06:46.000000000 +0000 @@ -31,7 +31,7 @@ { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,1") }, { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir8,2") }, { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacBookAir9,1") }, - { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacMini8,1") }, + { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "Macmini8,1") }, { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "MacPro7,1") }, { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,1") }, { UEFI_QUIRK_SKIP_CERT("Apple Inc.", "iMac20,2") }, diff -Nru linux-aws-5.19.0/security/Kconfig.hardening linux-aws-5.19.0/security/Kconfig.hardening --- linux-aws-5.19.0/security/Kconfig.hardening 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/security/Kconfig.hardening 2022-11-29 07:06:46.000000000 +0000 @@ -22,11 +22,17 @@ config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=pattern) -config CC_HAS_AUTO_VAR_INIT_ZERO - # GCC ignores the -enable flag, so we can test for the feature with - # a single invocation using the flag, but drop it as appropriate in - # the Makefile, depending on the presence of Clang. +config CC_HAS_AUTO_VAR_INIT_ZERO_BARE + def_bool $(cc-option,-ftrivial-auto-var-init=zero) + +config CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + # Clang 16 and later warn about using the -enable flag, but it + # is required before then. def_bool $(cc-option,-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) + depends on !CC_HAS_AUTO_VAR_INIT_ZERO_BARE + +config CC_HAS_AUTO_VAR_INIT_ZERO + def_bool CC_HAS_AUTO_VAR_INIT_ZERO_BARE || CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER choice prompt "Initialize kernel stack variables at function entry" diff -Nru linux-aws-5.19.0/security/landlock/fs.c linux-aws-5.19.0/security/landlock/fs.c --- linux-aws-5.19.0/security/landlock/fs.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/security/landlock/fs.c 2022-11-29 07:06:46.000000000 +0000 @@ -150,6 +150,16 @@ /* clang-format on */ /* + * All access rights that are denied by default whether they are handled or not + * by a ruleset/layer. This must be ORed with all ruleset->fs_access_masks[] + * entries when we need to get the absolute handled access masks. + */ +/* clang-format off */ +#define ACCESS_INITIALLY_DENIED ( \ + LANDLOCK_ACCESS_FS_REFER) +/* clang-format on */ + +/* * @path: Should have been checked by get_path_from_fd(). */ int landlock_append_fs_rule(struct landlock_ruleset *const ruleset, @@ -167,7 +177,9 @@ return -EINVAL; /* Transforms relative access rights to absolute ones. */ - access_rights |= LANDLOCK_MASK_ACCESS_FS & ~ruleset->fs_access_masks[0]; + access_rights |= + LANDLOCK_MASK_ACCESS_FS & + ~(ruleset->fs_access_masks[0] | ACCESS_INITIALLY_DENIED); object = get_inode_object(d_backing_inode(path->dentry)); if (IS_ERR(object)) return PTR_ERR(object); @@ -277,23 +289,12 @@ static inline access_mask_t get_handled_accesses(const struct landlock_ruleset *const domain) { - access_mask_t access_dom = 0; - unsigned long access_bit; - - for (access_bit = 0; access_bit < LANDLOCK_NUM_ACCESS_FS; - access_bit++) { - size_t layer_level; + access_mask_t access_dom = ACCESS_INITIALLY_DENIED; + size_t layer_level; - for (layer_level = 0; layer_level < domain->num_layers; - layer_level++) { - if (domain->fs_access_masks[layer_level] & - BIT_ULL(access_bit)) { - access_dom |= BIT_ULL(access_bit); - break; - } - } - } - return access_dom; + for (layer_level = 0; layer_level < domain->num_layers; layer_level++) + access_dom |= domain->fs_access_masks[layer_level]; + return access_dom & LANDLOCK_MASK_ACCESS_FS; } static inline access_mask_t @@ -316,8 +317,13 @@ for_each_set_bit(access_bit, &access_req, ARRAY_SIZE(*layer_masks)) { - if (domain->fs_access_masks[layer_level] & - BIT_ULL(access_bit)) { + /* + * Artificially handles all initially denied by default + * access rights. + */ + if (BIT_ULL(access_bit) & + (domain->fs_access_masks[layer_level] | + ACCESS_INITIALLY_DENIED)) { (*layer_masks)[access_bit] |= BIT_ULL(layer_level); handled_accesses |= BIT_ULL(access_bit); @@ -857,10 +863,6 @@ NULL, NULL); } - /* Backward compatibility: no reparenting support. */ - if (!(get_handled_accesses(dom) & LANDLOCK_ACCESS_FS_REFER)) - return -EXDEV; - access_request_parent1 |= LANDLOCK_ACCESS_FS_REFER; access_request_parent2 |= LANDLOCK_ACCESS_FS_REFER; diff -Nru linux-aws-5.19.0/sound/core/init.c linux-aws-5.19.0/sound/core/init.c --- linux-aws-5.19.0/sound/core/init.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/init.c 2022-11-29 07:06:46.000000000 +0000 @@ -178,10 +178,8 @@ return -ENOMEM; err = snd_card_init(card, parent, idx, xid, module, extra_size); - if (err < 0) { - kfree(card); - return err; - } + if (err < 0) + return err; /* card is freed by error handler */ *card_ret = card; return 0; @@ -231,7 +229,7 @@ card->managed = true; err = snd_card_init(card, parent, idx, xid, module, extra_size); if (err < 0) { - devres_free(card); + devres_free(card); /* in managed mode, we need to free manually */ return err; } @@ -293,6 +291,8 @@ mutex_unlock(&snd_card_mutex); dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n", idx, snd_ecards_limit - 1, err); + if (!card->managed) + kfree(card); /* manually free here, as no destructor called */ return err; } set_bit(idx, snd_cards_lock); /* lock it */ diff -Nru linux-aws-5.19.0/sound/core/memalloc.c linux-aws-5.19.0/sound/core/memalloc.c --- linux-aws-5.19.0/sound/core/memalloc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/memalloc.c 2022-11-29 07:06:46.000000000 +0000 @@ -20,6 +20,13 @@ static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab); +#ifdef CONFIG_SND_DMA_SGBUF +static void *do_alloc_fallback_pages(struct device *dev, size_t size, + dma_addr_t *addr, bool wc); +static void do_free_fallback_pages(void *p, size_t size, bool wc); +static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size); +#endif + /* a cast to gfp flag from the dev pointer; for CONTINUOUS and VMALLOC types */ static inline gfp_t snd_mem_get_gfp_flags(const struct snd_dma_buffer *dmab, gfp_t default_gfp) @@ -269,16 +276,21 @@ /* * Continuous pages allocator */ -static void *snd_dma_continuous_alloc(struct snd_dma_buffer *dmab, size_t size) +static void *do_alloc_pages(size_t size, dma_addr_t *addr, gfp_t gfp) { - gfp_t gfp = snd_mem_get_gfp_flags(dmab, GFP_KERNEL); void *p = alloc_pages_exact(size, gfp); if (p) - dmab->addr = page_to_phys(virt_to_page(p)); + *addr = page_to_phys(virt_to_page(p)); return p; } +static void *snd_dma_continuous_alloc(struct snd_dma_buffer *dmab, size_t size) +{ + return do_alloc_pages(size, &dmab->addr, + snd_mem_get_gfp_flags(dmab, GFP_KERNEL)); +} + static void snd_dma_continuous_free(struct snd_dma_buffer *dmab) { free_pages_exact(dmab->area, dmab->bytes); @@ -455,6 +467,25 @@ /* * Write-combined pages */ +/* x86-specific allocations */ +#ifdef CONFIG_SND_DMA_SGBUF +static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size) +{ + return do_alloc_fallback_pages(dmab->dev.dev, size, &dmab->addr, true); +} + +static void snd_dma_wc_free(struct snd_dma_buffer *dmab) +{ + do_free_fallback_pages(dmab->area, dmab->bytes, true); +} + +static int snd_dma_wc_mmap(struct snd_dma_buffer *dmab, + struct vm_area_struct *area) +{ + area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); + return snd_dma_continuous_mmap(dmab, area); +} +#else static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size) { return dma_alloc_wc(dmab->dev.dev, size, &dmab->addr, DEFAULT_GFP); @@ -471,6 +502,7 @@ return dma_mmap_wc(dmab->dev.dev, area, dmab->area, dmab->addr, dmab->bytes); } +#endif /* CONFIG_SND_DMA_SGBUF */ static const struct snd_malloc_ops snd_dma_wc_ops = { .alloc = snd_dma_wc_alloc, @@ -478,10 +510,6 @@ .mmap = snd_dma_wc_mmap, }; -#ifdef CONFIG_SND_DMA_SGBUF -static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size); -#endif - /* * Non-contiguous pages allocator */ @@ -507,10 +535,13 @@ dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, sg_dma_address(sgt->sgl)); p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt); - if (p) + if (p) { dmab->private_data = sgt; - else + /* store the first page address for convenience */ + dmab->addr = snd_sgbuf_get_addr(dmab, 0); + } else { dma_free_noncontiguous(dmab->dev.dev, size, sgt, dmab->dev.dir); + } return p; } @@ -661,6 +692,37 @@ .get_chunk_size = snd_dma_noncontig_get_chunk_size, }; +/* manual page allocations with wc setup */ +static void *do_alloc_fallback_pages(struct device *dev, size_t size, + dma_addr_t *addr, bool wc) +{ + gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN; + void *p; + + again: + p = do_alloc_pages(size, addr, gfp); + if (!p || (*addr + size - 1) & ~dev->coherent_dma_mask) { + if (IS_ENABLED(CONFIG_ZONE_DMA32) && !(gfp & GFP_DMA32)) { + gfp |= GFP_DMA32; + goto again; + } + if (IS_ENABLED(CONFIG_ZONE_DMA) && !(gfp & GFP_DMA)) { + gfp = (gfp & ~GFP_DMA32) | GFP_DMA; + goto again; + } + } + if (p && wc) + set_memory_wc((unsigned long)(p), size >> PAGE_SHIFT); + return p; +} + +static void do_free_fallback_pages(void *p, size_t size, bool wc) +{ + if (wc) + set_memory_wb((unsigned long)(p), size >> PAGE_SHIFT); + free_pages_exact(p, size); +} + /* Fallback SG-buffer allocations for x86 */ struct snd_dma_sg_fallback { size_t count; @@ -671,14 +733,11 @@ static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab, struct snd_dma_sg_fallback *sgbuf) { + bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK; size_t i; - if (sgbuf->count && dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK) - set_pages_array_wb(sgbuf->pages, sgbuf->count); for (i = 0; i < sgbuf->count && sgbuf->pages[i]; i++) - dma_free_coherent(dmab->dev.dev, PAGE_SIZE, - page_address(sgbuf->pages[i]), - sgbuf->addrs[i]); + do_free_fallback_pages(page_address(sgbuf->pages[i]), PAGE_SIZE, wc); kvfree(sgbuf->pages); kvfree(sgbuf->addrs); kfree(sgbuf); @@ -690,6 +749,7 @@ struct page **pages; size_t i, count; void *p; + bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK; sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL); if (!sgbuf) @@ -704,19 +764,19 @@ goto error; for (i = 0; i < count; sgbuf->count++, i++) { - p = dma_alloc_coherent(dmab->dev.dev, PAGE_SIZE, - &sgbuf->addrs[i], DEFAULT_GFP); + p = do_alloc_fallback_pages(dmab->dev.dev, PAGE_SIZE, + &sgbuf->addrs[i], wc); if (!p) goto error; sgbuf->pages[i] = virt_to_page(p); } - if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK) - set_pages_array_wc(pages, count); p = vmap(pages, count, VM_MAP, PAGE_KERNEL); if (!p) goto error; dmab->private_data = sgbuf; + /* store the first page address for convenience */ + dmab->addr = snd_sgbuf_get_addr(dmab, 0); return p; error: diff -Nru linux-aws-5.19.0/sound/core/oss/pcm_oss.c linux-aws-5.19.0/sound/core/oss/pcm_oss.c --- linux-aws-5.19.0/sound/core/oss/pcm_oss.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/oss/pcm_oss.c 2022-11-29 07:06:46.000000000 +0000 @@ -1672,14 +1672,14 @@ runtime = substream->runtime; if (atomic_read(&substream->mmap_count)) goto __direct; - err = snd_pcm_oss_make_ready(substream); - if (err < 0) - return err; atomic_inc(&runtime->oss.rw_ref); if (mutex_lock_interruptible(&runtime->oss.params_lock)) { atomic_dec(&runtime->oss.rw_ref); return -ERESTARTSYS; } + err = snd_pcm_oss_make_ready_locked(substream); + if (err < 0) + goto unlock; format = snd_pcm_oss_format_from(runtime->oss.format); width = snd_pcm_format_physical_width(format); if (runtime->oss.buffer_used > 0) { diff -Nru linux-aws-5.19.0/sound/core/pcm_dmaengine.c linux-aws-5.19.0/sound/core/pcm_dmaengine.c --- linux-aws-5.19.0/sound/core/pcm_dmaengine.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/pcm_dmaengine.c 2022-11-29 07:06:46.000000000 +0000 @@ -131,12 +131,14 @@ static void dmaengine_pcm_dma_complete(void *arg) { + unsigned int new_pos; struct snd_pcm_substream *substream = arg; struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); - prtd->pos += snd_pcm_lib_period_bytes(substream); - if (prtd->pos >= snd_pcm_lib_buffer_bytes(substream)) - prtd->pos = 0; + new_pos = prtd->pos + snd_pcm_lib_period_bytes(substream); + if (new_pos >= snd_pcm_lib_buffer_bytes(substream)) + new_pos = 0; + prtd->pos = new_pos; snd_pcm_period_elapsed(substream); } diff -Nru linux-aws-5.19.0/sound/core/rawmidi.c linux-aws-5.19.0/sound/core/rawmidi.c --- linux-aws-5.19.0/sound/core/rawmidi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/rawmidi.c 2022-11-29 07:06:46.000000000 +0000 @@ -1835,10 +1835,8 @@ snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); diff -Nru linux-aws-5.19.0/sound/core/seq/oss/seq_oss_midi.c linux-aws-5.19.0/sound/core/seq/oss/seq_oss_midi.c --- linux-aws-5.19.0/sound/core/seq/oss/seq_oss_midi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/seq/oss/seq_oss_midi.c 2022-11-29 07:06:46.000000000 +0000 @@ -270,7 +270,9 @@ void snd_seq_oss_midi_setup(struct seq_oss_devinfo *dp) { + spin_lock_irq(®ister_lock); dp->max_mididev = max_midi_devs; + spin_unlock_irq(®ister_lock); } /* diff -Nru linux-aws-5.19.0/sound/core/seq/seq_clientmgr.c linux-aws-5.19.0/sound/core/seq/seq_clientmgr.c --- linux-aws-5.19.0/sound/core/seq/seq_clientmgr.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/seq/seq_clientmgr.c 2022-11-29 07:06:46.000000000 +0000 @@ -121,13 +121,13 @@ spin_unlock_irqrestore(&clients_lock, flags); #ifdef CONFIG_MODULES if (!in_interrupt()) { - static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS]; - static char card_requested[SNDRV_CARDS]; + static DECLARE_BITMAP(client_requested, SNDRV_SEQ_GLOBAL_CLIENTS); + static DECLARE_BITMAP(card_requested, SNDRV_CARDS); + if (clientid < SNDRV_SEQ_GLOBAL_CLIENTS) { int idx; - if (!client_requested[clientid]) { - client_requested[clientid] = 1; + if (!test_and_set_bit(clientid, client_requested)) { for (idx = 0; idx < 15; idx++) { if (seq_client_load[idx] < 0) break; @@ -142,10 +142,8 @@ int card = (clientid - SNDRV_SEQ_GLOBAL_CLIENTS) / SNDRV_SEQ_CLIENTS_PER_CARD; if (card < snd_ecards_limit) { - if (! card_requested[card]) { - card_requested[card] = 1; + if (!test_and_set_bit(card, card_requested)) snd_request_card(card); - } snd_seq_device_load_drivers(); } } diff -Nru linux-aws-5.19.0/sound/core/sound_oss.c linux-aws-5.19.0/sound/core/sound_oss.c --- linux-aws-5.19.0/sound/core/sound_oss.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/core/sound_oss.c 2022-11-29 07:06:46.000000000 +0000 @@ -162,7 +162,6 @@ mutex_unlock(&sound_oss_mutex); return -ENOENT; } - unregister_sound_special(minor); switch (SNDRV_MINOR_OSS_DEVICE(minor)) { case SNDRV_MINOR_OSS_PCM: track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_AUDIO); @@ -174,12 +173,18 @@ track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); break; } - if (track2 >= 0) { - unregister_sound_special(track2); + if (track2 >= 0) snd_oss_minors[track2] = NULL; - } snd_oss_minors[minor] = NULL; mutex_unlock(&sound_oss_mutex); + + /* call unregister_sound_special() outside sound_oss_mutex; + * otherwise may deadlock, as it can trigger the release of a card + */ + unregister_sound_special(minor); + if (track2 >= 0) + unregister_sound_special(track2); + kfree(mptr); return 0; } diff -Nru linux-aws-5.19.0/sound/drivers/aloop.c linux-aws-5.19.0/sound/drivers/aloop.c --- linux-aws-5.19.0/sound/drivers/aloop.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/drivers/aloop.c 2022-11-29 07:06:46.000000000 +0000 @@ -605,17 +605,18 @@ cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; struct loopback_pcm *dpcm_capt = cable->streams[SNDRV_PCM_STREAM_CAPTURE]; - unsigned long delta_play = 0, delta_capt = 0; + unsigned long delta_play = 0, delta_capt = 0, cur_jiffies; unsigned int running, count1, count2; + cur_jiffies = jiffies; running = cable->running ^ cable->pause; if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { - delta_play = jiffies - dpcm_play->last_jiffies; + delta_play = cur_jiffies - dpcm_play->last_jiffies; dpcm_play->last_jiffies += delta_play; } if (running & (1 << SNDRV_PCM_STREAM_CAPTURE)) { - delta_capt = jiffies - dpcm_capt->last_jiffies; + delta_capt = cur_jiffies - dpcm_capt->last_jiffies; dpcm_capt->last_jiffies += delta_capt; } diff -Nru linux-aws-5.19.0/sound/hda/intel-dsp-config.c linux-aws-5.19.0/sound/hda/intel-dsp-config.c --- linux-aws-5.19.0/sound/hda/intel-dsp-config.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/hda/intel-dsp-config.c 2022-11-29 07:06:46.000000000 +0000 @@ -423,6 +423,11 @@ }, /* Alderlake-PS */ { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, + { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9, }, diff -Nru linux-aws-5.19.0/sound/hda/intel-nhlt.c linux-aws-5.19.0/sound/hda/intel-nhlt.c --- linux-aws-5.19.0/sound/hda/intel-nhlt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/hda/intel-nhlt.c 2022-11-29 07:06:46.000000000 +0000 @@ -55,16 +55,22 @@ /* find max number of channels based on format_configuration */ if (fmt_configs->fmt_count) { + struct nhlt_fmt_cfg *fmt_cfg = fmt_configs->fmt_config; + dev_dbg(dev, "found %d format definitions\n", fmt_configs->fmt_count); for (i = 0; i < fmt_configs->fmt_count; i++) { struct wav_fmt_ext *fmt_ext; - fmt_ext = &fmt_configs->fmt_config[i].fmt_ext; + fmt_ext = &fmt_cfg->fmt_ext; if (fmt_ext->fmt.channels > max_ch) max_ch = fmt_ext->fmt.channels; + + /* Move to the next nhlt_fmt_cfg */ + fmt_cfg = (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps + + fmt_cfg->config.size); } dev_dbg(dev, "max channels found %d\n", max_ch); } else { diff -Nru linux-aws-5.19.0/sound/pci/emu10k1/emupcm.c linux-aws-5.19.0/sound/pci/emu10k1/emupcm.c --- linux-aws-5.19.0/sound/pci/emu10k1/emupcm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/emu10k1/emupcm.c 2022-11-29 07:06:46.000000000 +0000 @@ -124,7 +124,7 @@ epcm->voices[0]->epcm = epcm; if (voices > 1) { for (i = 1; i < voices; i++) { - epcm->voices[i] = &epcm->emu->voices[epcm->voices[0]->number + i]; + epcm->voices[i] = &epcm->emu->voices[(epcm->voices[0]->number + i) % NUM_G]; epcm->voices[i]->epcm = epcm; } } diff -Nru linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.c linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.c --- linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.c 2022-11-29 07:06:46.000000000 +0000 @@ -8,30 +8,464 @@ #include #include +#include #include +#include +#include #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h" #include "hda_generic.h" #include "hda_component.h" #include "cs35l41_hda.h" +#include "hda_cs_dsp_ctl.h" + +#define CS35L41_FIRMWARE_ROOT "cirrus/" +#define CS35L41_PART "cs35l41" + +#define HALO_STATE_DSP_CTL_NAME "HALO_STATE" +#define HALO_STATE_DSP_CTL_TYPE 5 +#define HALO_STATE_DSP_CTL_ALG 262308 +#define CAL_R_DSP_CTL_NAME "CAL_R" +#define CAL_STATUS_DSP_CTL_NAME "CAL_STATUS" +#define CAL_CHECKSUM_DSP_CTL_NAME "CAL_CHECKSUM" +#define CAL_AMBIENT_DSP_CTL_NAME "CAL_AMBIENT" +#define CAL_DSP_CTL_TYPE 5 +#define CAL_DSP_CTL_ALG 205 + +static bool firmware_autostart = 1; +module_param(firmware_autostart, bool, 0444); +MODULE_PARM_DESC(firmware_autostart, "Allow automatic firmware download on boot" + "(0=Disable, 1=Enable) (default=1); "); static const struct reg_sequence cs35l41_hda_config[] = { { CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1 + { CS35L41_DSP_CLK_CTRL, 0x00000003 }, // DSP CLK EN { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, // GLOBAL_FS = 48 kHz { CS35L41_SP_ENABLES, 0x00010000 }, // ASP_RX1_EN = 1 { CS35L41_SP_RATE_CTRL, 0x00000021 }, // ASP_BCLK_FREQ = 3.072 MHz { CS35L41_SP_FORMAT, 0x20200200 }, // 32 bits RX/TX slots, I2S, clk consumer + { CS35L41_SP_HIZ_CTRL, 0x00000002 }, // Hi-Z unused + { CS35L41_SP_TX_WL, 0x00000018 }, // 24 cycles/slot + { CS35L41_SP_RX_WL, 0x00000018 }, // 24 cycles/slot { CS35L41_DAC_PCM1_SRC, 0x00000008 }, // DACPCM1_SRC = ASPRX1 + { CS35L41_ASP_TX1_SRC, 0x00000018 }, // ASPTX1 SRC = VMON + { CS35L41_ASP_TX2_SRC, 0x00000019 }, // ASPTX2 SRC = IMON + { CS35L41_ASP_TX3_SRC, 0x00000032 }, // ASPTX3 SRC = ERRVOL + { CS35L41_ASP_TX4_SRC, 0x00000033 }, // ASPTX4 SRC = CLASSH_TGT + { CS35L41_DSP1_RX1_SRC, 0x00000008 }, // DSP1RX1 SRC = ASPRX1 + { CS35L41_DSP1_RX2_SRC, 0x00000009 }, // DSP1RX2 SRC = ASPRX2 + { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON + { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON + { CS35L41_DSP1_RX5_SRC, 0x00000020 }, // DSP1RX5 SRC = ERRVOL { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB }; +static const struct reg_sequence cs35l41_hda_config_dsp[] = { + { CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1 + { CS35L41_DSP_CLK_CTRL, 0x00000003 }, // DSP CLK EN + { CS35L41_GLOBAL_CLK_CTRL, 0x00000003 }, // GLOBAL_FS = 48 kHz + { CS35L41_SP_ENABLES, 0x00010001 }, // ASP_RX1_EN = 1, ASP_TX1_EN = 1 + { CS35L41_SP_RATE_CTRL, 0x00000021 }, // ASP_BCLK_FREQ = 3.072 MHz + { CS35L41_SP_FORMAT, 0x20200200 }, // 32 bits RX/TX slots, I2S, clk consumer + { CS35L41_SP_HIZ_CTRL, 0x00000003 }, // Hi-Z unused/disabled + { CS35L41_SP_TX_WL, 0x00000018 }, // 24 cycles/slot + { CS35L41_SP_RX_WL, 0x00000018 }, // 24 cycles/slot + { CS35L41_DAC_PCM1_SRC, 0x00000032 }, // DACPCM1_SRC = ERR_VOL + { CS35L41_ASP_TX1_SRC, 0x00000018 }, // ASPTX1 SRC = VMON + { CS35L41_ASP_TX2_SRC, 0x00000019 }, // ASPTX2 SRC = IMON + { CS35L41_ASP_TX3_SRC, 0x00000028 }, // ASPTX3 SRC = VPMON + { CS35L41_ASP_TX4_SRC, 0x00000029 }, // ASPTX4 SRC = VBSTMON + { CS35L41_DSP1_RX1_SRC, 0x00000008 }, // DSP1RX1 SRC = ASPRX1 + { CS35L41_DSP1_RX2_SRC, 0x00000008 }, // DSP1RX2 SRC = ASPRX1 + { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON + { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON + { CS35L41_DSP1_RX5_SRC, 0x00000029 }, // DSP1RX5 SRC = VBSTMON + { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB + { CS35L41_AMP_GAIN_CTRL, 0x00000233 }, // AMP_GAIN_PCM = 17.5dB AMP_GAIN_PDM = 19.5dB +}; + static const struct reg_sequence cs35l41_hda_mute[] = { { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, // AMP_GAIN_PCM 0.5 dB { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, // AMP_VOL_PCM Mute }; +static int cs35l41_control_add(struct cs_dsp_coeff_ctl *cs_ctl) +{ + struct cs35l41_hda *cs35l41 = container_of(cs_ctl->dsp, struct cs35l41_hda, cs_dsp); + struct hda_cs_dsp_ctl_info info; + + info.device_name = cs35l41->amp_name; + info.fw_type = cs35l41->firmware_type; + info.card = cs35l41->codec->card; + + return hda_cs_dsp_control_add(cs_ctl, &info); +} + +static const struct cs_dsp_client_ops client_ops = { + .control_add = cs35l41_control_add, + .control_remove = hda_cs_dsp_control_remove, +}; + +static int cs35l41_request_firmware_file(struct cs35l41_hda *cs35l41, + const struct firmware **firmware, char **filename, + const char *dir, const char *ssid, const char *amp_name, + int spkid, const char *filetype) +{ + const char * const dsp_name = cs35l41->cs_dsp.name; + char *s, c; + int ret = 0; + + if (spkid > -1 && ssid && amp_name) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-spkid%d-%s.%s", dir, CS35L41_PART, + dsp_name, hda_cs_dsp_fw_ids[cs35l41->firmware_type], + ssid, spkid, amp_name, filetype); + else if (spkid > -1 && ssid) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-spkid%d.%s", dir, CS35L41_PART, + dsp_name, hda_cs_dsp_fw_ids[cs35l41->firmware_type], + ssid, spkid, filetype); + else if (ssid && amp_name) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, hda_cs_dsp_fw_ids[cs35l41->firmware_type], + ssid, amp_name, filetype); + else if (ssid) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, hda_cs_dsp_fw_ids[cs35l41->firmware_type], + ssid, filetype); + else + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, CS35L41_PART, + dsp_name, hda_cs_dsp_fw_ids[cs35l41->firmware_type], + filetype); + + if (*filename == NULL) + return -ENOMEM; + + /* + * Make sure that filename is lower-case and any non alpha-numeric + * characters except full stop and '/' are replaced with hyphens. + */ + s = *filename; + while (*s) { + c = *s; + if (isalnum(c)) + *s = tolower(c); + else if (c != '.' && c != '/') + *s = '-'; + s++; + } + + ret = firmware_request_nowarn(firmware, *filename, cs35l41->dev); + if (ret != 0) { + dev_dbg(cs35l41->dev, "Failed to request '%s'\n", *filename); + kfree(*filename); + *filename = NULL; + } + + return ret; +} + +static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, + const struct firmware **wmfw_firmware, + char **wmfw_filename, + const struct firmware **coeff_firmware, + char **coeff_filename) +{ + int ret; + + /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + cs35l41->speaker_id, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + cs35l41->speaker_id, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, -1, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, cs35l41->speaker_id, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub<-spkidN>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + NULL, cs35l41->speaker_id, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + cs35l41->amp_name, cs35l41->speaker_id, "bin"); + if (ret) + /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + NULL, cs35l41->speaker_id, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + NULL, -1, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + cs35l41->amp_name, cs35l41->speaker_id, "bin"); + if (ret) + /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + NULL, cs35l41->speaker_id, "bin"); + return 0; + } + + /* fallback try cirrus/part-dspN-fwtype.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); + if (!ret) { + /* fallback try cirrus/part-dspN-fwtype.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); + return 0; + } + + dev_warn(cs35l41->dev, "Failed to request firmware\n"); + + return ret; +} + +static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, + const struct firmware **wmfw_firmware, + char **wmfw_filename, + const struct firmware **coeff_firmware, + char **coeff_filename) +{ + int ret; + + if (cs35l41->speaker_id > -1) + return cs35l41_request_firmware_files_spkid(cs35l41, wmfw_firmware, wmfw_filename, + coeff_firmware, coeff_filename); + + /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, -1, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + cs35l41->amp_name, -1, "bin"); + return 0; + } + + /* try cirrus/part-dspN-fwtype-sub.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, + NULL, -1, "wmfw"); + if (!ret) { + /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + cs35l41->amp_name, -1, "bin"); + if (ret) + /* try cirrus/part-dspN-fwtype-sub.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, + NULL, -1, "bin"); + return 0; + } + + /* fallback try cirrus/part-dspN-fwtype.wmfw */ + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); + if (!ret) { + /* fallback try cirrus/part-dspN-fwtype.bin */ + cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); + return 0; + } + + dev_warn(cs35l41->dev, "Failed to request firmware\n"); + + return ret; +} + +#if IS_ENABLED(CONFIG_EFI) +static int cs35l41_apply_calibration(struct cs35l41_hda *cs35l41, unsigned int ambient, + unsigned int r0, unsigned int status, unsigned int checksum) +{ + int ret; + + ret = hda_cs_dsp_write_ctl(&cs35l41->cs_dsp, CAL_AMBIENT_DSP_CTL_NAME, CAL_DSP_CTL_TYPE, + CAL_DSP_CTL_ALG, &ambient, 4); + if (ret) { + dev_err(cs35l41->dev, "Cannot Write Control: %s - %d\n", CAL_AMBIENT_DSP_CTL_NAME, + ret); + return ret; + } + ret = hda_cs_dsp_write_ctl(&cs35l41->cs_dsp, CAL_R_DSP_CTL_NAME, CAL_DSP_CTL_TYPE, + CAL_DSP_CTL_ALG, &r0, 4); + if (ret) { + dev_err(cs35l41->dev, "Cannot Write Control: %s - %d\n", CAL_R_DSP_CTL_NAME, ret); + return ret; + } + ret = hda_cs_dsp_write_ctl(&cs35l41->cs_dsp, CAL_STATUS_DSP_CTL_NAME, CAL_DSP_CTL_TYPE, + CAL_DSP_CTL_ALG, &status, 4); + if (ret) { + dev_err(cs35l41->dev, "Cannot Write Control: %s - %d\n", CAL_STATUS_DSP_CTL_NAME, + ret); + return ret; + } + ret = hda_cs_dsp_write_ctl(&cs35l41->cs_dsp, CAL_CHECKSUM_DSP_CTL_NAME, CAL_DSP_CTL_TYPE, + CAL_DSP_CTL_ALG, &checksum, 4); + if (ret) { + dev_err(cs35l41->dev, "Cannot Write Control: %s - %d\n", CAL_CHECKSUM_DSP_CTL_NAME, + ret); + return ret; + } + + return 0; +} + +static int cs35l41_save_calibration(struct cs35l41_hda *cs35l41) +{ + static efi_guid_t efi_guid = EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, + 0x5a, 0xa3, 0x5d, 0xb3); + static efi_char16_t efi_name[] = L"CirrusSmartAmpCalibrationData"; + const struct cs35l41_amp_efi_data *efi_data; + const struct cs35l41_amp_cal_data *cl; + unsigned long data_size = 0; + efi_status_t status; + int ret = 0; + u8 *data = NULL; + u32 attr; + + /* Get real size of UEFI variable */ + status = efi.get_variable(efi_name, &efi_guid, &attr, &data_size, data); + if (status == EFI_BUFFER_TOO_SMALL) { + ret = -ENODEV; + /* Allocate data buffer of data_size bytes */ + data = vmalloc(data_size); + if (!data) + return -ENOMEM; + /* Get variable contents into buffer */ + status = efi.get_variable(efi_name, &efi_guid, &attr, &data_size, data); + if (status == EFI_SUCCESS) { + efi_data = (struct cs35l41_amp_efi_data *)data; + dev_dbg(cs35l41->dev, "Calibration: Size=%d, Amp Count=%d\n", + efi_data->size, efi_data->count); + if (efi_data->count > cs35l41->index) { + cl = &efi_data->data[cs35l41->index]; + dev_dbg(cs35l41->dev, + "Calibration: Ambient=%02x, Status=%02x, R0=%d\n", + cl->calAmbient, cl->calStatus, cl->calR); + + /* Calibration can only be applied whilst the DSP is not running */ + ret = cs35l41_apply_calibration(cs35l41, + cpu_to_be32(cl->calAmbient), + cpu_to_be32(cl->calR), + cpu_to_be32(cl->calStatus), + cpu_to_be32(cl->calR + 1)); + } + } + vfree(data); + } + return ret; +} +#else +static int cs35l41_save_calibration(struct cs35l41_hda *cs35l41) +{ + dev_warn(cs35l41->dev, "Calibration not supported without EFI support.\n"); + return 0; +} +#endif + +static int cs35l41_init_dsp(struct cs35l41_hda *cs35l41) +{ + const struct firmware *coeff_firmware = NULL; + const struct firmware *wmfw_firmware = NULL; + struct cs_dsp *dsp = &cs35l41->cs_dsp; + char *coeff_filename = NULL; + char *wmfw_filename = NULL; + int ret; + + if (!cs35l41->halo_initialized) { + cs35l41_configure_cs_dsp(cs35l41->dev, cs35l41->regmap, dsp); + dsp->client_ops = &client_ops; + + ret = cs_dsp_halo_init(&cs35l41->cs_dsp); + if (ret) + return ret; + cs35l41->halo_initialized = true; + } + + ret = cs35l41_request_firmware_files(cs35l41, &wmfw_firmware, &wmfw_filename, + &coeff_firmware, &coeff_filename); + if (ret < 0) + return ret; + + dev_dbg(cs35l41->dev, "Loading WMFW Firmware: %s\n", wmfw_filename); + if (coeff_filename) + dev_dbg(cs35l41->dev, "Loading Coefficient File: %s\n", coeff_filename); + else + dev_warn(cs35l41->dev, "No Coefficient File available.\n"); + + ret = cs_dsp_power_up(dsp, wmfw_firmware, wmfw_filename, coeff_firmware, coeff_filename, + hda_cs_dsp_fw_ids[cs35l41->firmware_type]); + if (ret) + goto err_release; + + ret = cs35l41_save_calibration(cs35l41); + +err_release: + release_firmware(wmfw_firmware); + release_firmware(coeff_firmware); + kfree(wmfw_filename); + kfree(coeff_filename); + + return ret; +} + +static void cs35l41_shutdown_dsp(struct cs35l41_hda *cs35l41) +{ + struct cs_dsp *dsp = &cs35l41->cs_dsp; + + cs_dsp_stop(dsp); + cs_dsp_power_down(dsp); + cs35l41->firmware_running = false; + dev_dbg(cs35l41->dev, "Unloaded Firmware\n"); +} + +static void cs35l41_remove_dsp(struct cs35l41_hda *cs35l41) +{ + struct cs_dsp *dsp = &cs35l41->cs_dsp; + + cancel_work_sync(&cs35l41->fw_load_work); + cs35l41_shutdown_dsp(cs35l41); + cs_dsp_remove(dsp); + cs35l41->halo_initialized = false; +} + /* Protection release cycle to get the speaker out of Safe-Mode */ static void cs35l41_error_release(struct device *dev, struct regmap *regmap, unsigned int mask) { @@ -53,9 +487,23 @@ struct regmap *reg = cs35l41->regmap; int ret = 0; + mutex_lock(&cs35l41->fw_mutex); + switch (action) { case HDA_GEN_PCM_ACT_OPEN: - regmap_multi_reg_write(reg, cs35l41_hda_config, ARRAY_SIZE(cs35l41_hda_config)); + cs35l41->playback_started = true; + if (cs35l41->firmware_running) { + regmap_multi_reg_write(reg, cs35l41_hda_config_dsp, + ARRAY_SIZE(cs35l41_hda_config_dsp)); + regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2, + CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK, + 1 << CS35L41_VMON_EN_SHIFT | 1 << CS35L41_IMON_EN_SHIFT); + cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, + CSPL_MBOX_CMD_RESUME); + } else { + regmap_multi_reg_write(reg, cs35l41_hda_config, + ARRAY_SIZE(cs35l41_hda_config)); + } ret = regmap_update_bits(reg, CS35L41_PWR_CTRL2, CS35L41_AMP_EN_MASK, 1 << CS35L41_AMP_EN_SHIFT); if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) @@ -73,13 +521,23 @@ CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT); if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00000001); + if (cs35l41->firmware_running) { + cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, + CSPL_MBOX_CMD_PAUSE); + regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2, + CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK, + 0 << CS35L41_VMON_EN_SHIFT | 0 << CS35L41_IMON_EN_SHIFT); + } cs35l41_irq_release(cs35l41); + cs35l41->playback_started = false; break; default: dev_warn(cs35l41->dev, "Playback action not supported: %d\n", action); break; } + mutex_unlock(&cs35l41->fw_mutex); + if (ret) dev_err(cs35l41->dev, "Regmap access fail: %d\n", ret); } @@ -104,10 +562,274 @@ rx_slot); } +static int cs35l41_runtime_suspend(struct device *dev) +{ + struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); + + dev_dbg(cs35l41->dev, "Suspend\n"); + + if (!cs35l41->firmware_running) + return 0; + + if (cs35l41_enter_hibernate(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type) < 0) + return 0; + + regcache_cache_only(cs35l41->regmap, true); + regcache_mark_dirty(cs35l41->regmap); + + return 0; +} + +static int cs35l41_runtime_resume(struct device *dev) +{ + struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); + int ret; + + dev_dbg(cs35l41->dev, "Resume.\n"); + + if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH) { + dev_dbg(cs35l41->dev, "System does not support Resume\n"); + return 0; + } + + if (!cs35l41->firmware_running) + return 0; + + regcache_cache_only(cs35l41->regmap, false); + + ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap); + if (ret) { + regcache_cache_only(cs35l41->regmap, true); + return ret; + } + + /* Test key needs to be unlocked to allow the OTP settings to re-apply */ + cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap); + ret = regcache_sync(cs35l41->regmap); + cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap); + if (ret) { + dev_err(cs35l41->dev, "Failed to restore register cache: %d\n", ret); + return ret; + } + + if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) + cs35l41_init_boost(cs35l41->dev, cs35l41->regmap, &cs35l41->hw_cfg); + + return 0; +} + +static int cs35l41_hda_suspend_hook(struct device *dev) +{ + dev_dbg(dev, "Request Suspend\n"); + pm_runtime_mark_last_busy(dev); + return pm_runtime_put_autosuspend(dev); +} + +static int cs35l41_hda_resume_hook(struct device *dev) +{ + dev_dbg(dev, "Request Resume\n"); + return pm_runtime_get_sync(dev); +} + +static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41) +{ + int halo_sts; + int ret; + + ret = cs35l41_init_dsp(cs35l41); + if (ret) { + dev_warn(cs35l41->dev, "Cannot Initialize Firmware. Error: %d\n", ret); + goto clean_dsp; + } + + ret = cs35l41_write_fs_errata(cs35l41->dev, cs35l41->regmap); + if (ret) { + dev_err(cs35l41->dev, "Cannot Write FS Errata: %d\n", ret); + goto clean_dsp; + } + + ret = cs_dsp_run(&cs35l41->cs_dsp); + if (ret) { + dev_err(cs35l41->dev, "Fail to start dsp: %d\n", ret); + goto clean_dsp; + } + + ret = read_poll_timeout(hda_cs_dsp_read_ctl, ret, + be32_to_cpu(halo_sts) == HALO_STATE_CODE_RUN, + 1000, 15000, false, &cs35l41->cs_dsp, HALO_STATE_DSP_CTL_NAME, + HALO_STATE_DSP_CTL_TYPE, HALO_STATE_DSP_CTL_ALG, + &halo_sts, sizeof(halo_sts)); + + if (ret) { + dev_err(cs35l41->dev, "Timeout waiting for HALO Core to start. State: %d\n", + halo_sts); + goto clean_dsp; + } + + cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, CSPL_MBOX_CMD_PAUSE); + cs35l41->firmware_running = true; + + return 0; + +clean_dsp: + cs35l41_shutdown_dsp(cs35l41); + return ret; +} + +static void cs35l41_load_firmware(struct cs35l41_hda *cs35l41, bool load) +{ + pm_runtime_get_sync(cs35l41->dev); + + if (cs35l41->firmware_running && !load) { + dev_dbg(cs35l41->dev, "Unloading Firmware\n"); + cs35l41_shutdown_dsp(cs35l41); + } else if (!cs35l41->firmware_running && load) { + dev_dbg(cs35l41->dev, "Loading Firmware\n"); + cs35l41_smart_amp(cs35l41); + } else { + dev_dbg(cs35l41->dev, "Unable to Load firmware.\n"); + } + + pm_runtime_mark_last_busy(cs35l41->dev); + pm_runtime_put_autosuspend(cs35l41->dev); +} + +static int cs35l41_fw_load_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct cs35l41_hda *cs35l41 = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = cs35l41->request_fw_load; + return 0; +} + +static void cs35l41_fw_load_work(struct work_struct *work) +{ + struct cs35l41_hda *cs35l41 = container_of(work, struct cs35l41_hda, fw_load_work); + + mutex_lock(&cs35l41->fw_mutex); + + /* Recheck if playback is ongoing, mutex will block playback during firmware loading */ + if (cs35l41->playback_started) + dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback\n"); + else + cs35l41_load_firmware(cs35l41, cs35l41->request_fw_load); + + cs35l41->fw_request_ongoing = false; + mutex_unlock(&cs35l41->fw_mutex); +} + +static int cs35l41_fw_load_ctl_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct cs35l41_hda *cs35l41 = snd_kcontrol_chip(kcontrol); + unsigned int ret = 0; + + mutex_lock(&cs35l41->fw_mutex); + + if (cs35l41->request_fw_load == ucontrol->value.integer.value[0]) + goto err; + + if (cs35l41->fw_request_ongoing) { + dev_dbg(cs35l41->dev, "Existing request not complete\n"); + ret = -EBUSY; + goto err; + } + + /* Check if playback is ongoing when initial request is made */ + if (cs35l41->playback_started) { + dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback\n"); + ret = -EBUSY; + goto err; + } + + cs35l41->fw_request_ongoing = true; + cs35l41->request_fw_load = ucontrol->value.integer.value[0]; + schedule_work(&cs35l41->fw_load_work); + +err: + mutex_unlock(&cs35l41->fw_mutex); + + return ret; +} + +static int cs35l41_fw_type_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct cs35l41_hda *cs35l41 = snd_kcontrol_chip(kcontrol); + + ucontrol->value.enumerated.item[0] = cs35l41->firmware_type; + + return 0; +} + +static int cs35l41_fw_type_ctl_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct cs35l41_hda *cs35l41 = snd_kcontrol_chip(kcontrol); + + if (ucontrol->value.enumerated.item[0] < HDA_CS_DSP_NUM_FW) { + cs35l41->firmware_type = ucontrol->value.enumerated.item[0]; + return 0; + } + + return -EINVAL; +} + +static int cs35l41_fw_type_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) +{ + return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(hda_cs_dsp_fw_ids), hda_cs_dsp_fw_ids); +} + +static int cs35l41_create_controls(struct cs35l41_hda *cs35l41) +{ + char fw_type_ctl_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; + char fw_load_ctl_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; + struct snd_kcontrol_new fw_type_ctl = { + .name = fw_type_ctl_name, + .iface = SNDRV_CTL_ELEM_IFACE_CARD, + .info = cs35l41_fw_type_ctl_info, + .get = cs35l41_fw_type_ctl_get, + .put = cs35l41_fw_type_ctl_put, + }; + struct snd_kcontrol_new fw_load_ctl = { + .name = fw_load_ctl_name, + .iface = SNDRV_CTL_ELEM_IFACE_CARD, + .info = snd_ctl_boolean_mono_info, + .get = cs35l41_fw_load_ctl_get, + .put = cs35l41_fw_load_ctl_put, + }; + int ret; + + scnprintf(fw_type_ctl_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s DSP1 Firmware Type", + cs35l41->amp_name); + scnprintf(fw_load_ctl_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s DSP1 Firmware Load", + cs35l41->amp_name); + + ret = snd_ctl_add(cs35l41->codec->card, snd_ctl_new1(&fw_type_ctl, cs35l41)); + if (ret) { + dev_err(cs35l41->dev, "Failed to add KControl %s = %d\n", fw_type_ctl.name, ret); + return ret; + } + + dev_dbg(cs35l41->dev, "Added Control %s\n", fw_type_ctl.name); + + ret = snd_ctl_add(cs35l41->codec->card, snd_ctl_new1(&fw_load_ctl, cs35l41)); + if (ret) { + dev_err(cs35l41->dev, "Failed to add KControl %s = %d\n", fw_load_ctl.name, ret); + return ret; + } + + dev_dbg(cs35l41->dev, "Added Control %s\n", fw_load_ctl.name); + + return 0; +} + static int cs35l41_hda_bind(struct device *dev, struct device *master, void *master_data) { struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); struct hda_component *comps = master_data; + int ret = 0; if (!comps || cs35l41->index < 0 || cs35l41->index >= HDA_MAX_COMPONENTS) return -EINVAL; @@ -116,11 +838,38 @@ if (comps->dev) return -EBUSY; + pm_runtime_get_sync(dev); + comps->dev = dev; + if (!cs35l41->acpi_subsystem_id) + cs35l41->acpi_subsystem_id = devm_kasprintf(dev, GFP_KERNEL, "%.8x", + comps->codec->core.subsystem_id); + cs35l41->codec = comps->codec; strscpy(comps->name, dev_name(dev), sizeof(comps->name)); + + cs35l41->firmware_type = HDA_CS_DSP_FW_SPK_PROT; + + if (firmware_autostart) { + dev_dbg(cs35l41->dev, "Firmware Autostart.\n"); + cs35l41->request_fw_load = true; + mutex_lock(&cs35l41->fw_mutex); + if (cs35l41_smart_amp(cs35l41) < 0) + dev_warn(cs35l41->dev, "Cannot Run Firmware, reverting to dsp bypass...\n"); + mutex_unlock(&cs35l41->fw_mutex); + } else { + dev_dbg(cs35l41->dev, "Firmware Autostart is disabled.\n"); + } + + ret = cs35l41_create_controls(cs35l41); + comps->playback_hook = cs35l41_hda_playback_hook; + comps->suspend_hook = cs35l41_hda_suspend_hook; + comps->resume_hook = cs35l41_hda_resume_hook; - return 0; + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + + return ret; } static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *master_data) @@ -215,7 +964,7 @@ CS35L41_REG_IRQ(IRQ1_STATUS1, AMP_SHORT_ERR), }; -static const struct regmap_irq_chip cs35l41_regmap_irq_chip = { +static struct regmap_irq_chip cs35l41_regmap_irq_chip = { .name = "cs35l41 IRQ1 Controller", .status_base = CS35L41_IRQ1_STATUS1, .mask_base = CS35L41_IRQ1_MASK1, @@ -223,6 +972,7 @@ .num_regs = 4, .irqs = cs35l41_reg_irqs, .num_irqs = ARRAY_SIZE(cs35l41_reg_irqs), + .runtime_pm = true, }; static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41) @@ -297,6 +1047,91 @@ return cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, &hw_cfg->spk_pos); } +static int cs35l41_get_acpi_sub_string(struct device *dev, struct acpi_device *adev, + const char **subsysid) +{ + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; + acpi_status status; + int ret = 0; + + status = acpi_evaluate_object(adev->handle, "_SUB", NULL, &buffer); + if (ACPI_SUCCESS(status)) { + obj = buffer.pointer; + if (obj->type == ACPI_TYPE_STRING) { + *subsysid = devm_kstrdup(dev, obj->string.pointer, GFP_KERNEL); + if (*subsysid == NULL) { + dev_err(dev, "Cannot allocate Subsystem ID"); + ret = -ENOMEM; + } + } else { + dev_warn(dev, "Warning ACPI _SUB did not return a string\n"); + ret = -ENODEV; + } + acpi_os_free(buffer.pointer); + } else { + dev_dbg(dev, "Warning ACPI _SUB failed: %#x\n", status); + ret = -ENODEV; + } + + return ret; +} + +static int cs35l41_get_speaker_id(struct device *dev, int amp_index, + int num_amps, int fixed_gpio_id) +{ + struct gpio_desc *speaker_id_desc; + int speaker_id = -ENODEV; + + if (fixed_gpio_id >= 0) { + dev_dbg(dev, "Found Fixed Speaker ID GPIO (index = %d)\n", fixed_gpio_id); + speaker_id_desc = gpiod_get_index(dev, NULL, fixed_gpio_id, GPIOD_IN); + if (IS_ERR(speaker_id_desc)) { + speaker_id = PTR_ERR(speaker_id_desc); + return speaker_id; + } + speaker_id = gpiod_get_value_cansleep(speaker_id_desc); + gpiod_put(speaker_id_desc); + dev_dbg(dev, "Speaker ID = %d\n", speaker_id); + } else { + int base_index; + int gpios_per_amp; + int count; + int tmp; + int i; + + count = gpiod_count(dev, "spk-id"); + if (count > 0) { + speaker_id = 0; + gpios_per_amp = count / num_amps; + base_index = gpios_per_amp * amp_index; + + if (count % num_amps) + return -EINVAL; + + dev_dbg(dev, "Found %d Speaker ID GPIOs per Amp\n", gpios_per_amp); + + for (i = 0; i < gpios_per_amp; i++) { + speaker_id_desc = gpiod_get_index(dev, "spk-id", i + base_index, + GPIOD_IN); + if (IS_ERR(speaker_id_desc)) { + speaker_id = PTR_ERR(speaker_id_desc); + break; + } + tmp = gpiod_get_value_cansleep(speaker_id_desc); + gpiod_put(speaker_id_desc); + if (tmp < 0) { + speaker_id = tmp; + break; + } + speaker_id |= tmp << i; + } + dev_dbg(dev, "Speaker ID = %d\n", speaker_id); + } + } + return speaker_id; +} + static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, int id) { struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg; @@ -316,6 +1151,12 @@ physdev = get_device(acpi_get_first_physical_node(adev)); acpi_dev_put(adev); + ret = cs35l41_get_acpi_sub_string(cs35l41->dev, adev, &cs35l41->acpi_subsystem_id); + if (ret) + dev_info(cs35l41->dev, "No Subsystem ID found in ACPI: %d", ret); + else + dev_dbg(cs35l41->dev, "Subsystem ID %s found", cs35l41->acpi_subsystem_id); + property = "cirrus,dev-index"; ret = device_property_count_u32(physdev, property); if (ret <= 0) @@ -347,7 +1188,7 @@ /* To use the same release code for all laptop variants we can't use devm_ version of * gpiod_get here, as CLSA010* don't have a fully functional bios with an _DSD node */ - cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index, + cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(adev), "reset", cs35l41->index, GPIOD_OUT_LOW, "cs35l41-reset"); property = "cirrus,speaker-position"; @@ -396,6 +1237,8 @@ else hw_cfg->bst_cap = -1; + cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, nval, -1); + if (hw_cfg->bst_ind > 0 || hw_cfg->bst_cap > 0 || hw_cfg->bst_ipk > 0) hw_cfg->bst_type = CS35L41_INT_BOOST; else @@ -429,6 +1272,7 @@ cs35l41->channel_index = 0; cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); cs35l41->hw_cfg.bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH; + cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); hw_cfg->gpio2.func = CS35L41_GPIO2_INT_OPEN_DRAIN; hw_cfg->gpio2.valid = true; cs35l41->hw_cfg.valid = true; @@ -536,13 +1380,26 @@ if (ret) goto err; + INIT_WORK(&cs35l41->fw_load_work, cs35l41_fw_load_work); + mutex_init(&cs35l41->fw_mutex); + + pm_runtime_set_autosuspend_delay(cs35l41->dev, 3000); + pm_runtime_use_autosuspend(cs35l41->dev); + pm_runtime_mark_last_busy(cs35l41->dev); + pm_runtime_set_active(cs35l41->dev); + pm_runtime_get_noresume(cs35l41->dev); + pm_runtime_enable(cs35l41->dev); + ret = cs35l41_hda_apply_properties(cs35l41); if (ret) - goto err; + goto err_pm; + + pm_runtime_put_autosuspend(cs35l41->dev); ret = component_add(cs35l41->dev, &cs35l41_hda_comp_ops); if (ret) { dev_err(cs35l41->dev, "Register component failed: %d\n", ret); + pm_runtime_disable(cs35l41->dev); goto err; } @@ -550,6 +1407,10 @@ return 0; +err_pm: + pm_runtime_disable(cs35l41->dev); + pm_runtime_put_noidle(cs35l41->dev); + err: if (cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type)) gpiod_set_value_cansleep(cs35l41->reset_gpio, 0); @@ -563,14 +1424,28 @@ { struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev); + pm_runtime_get_sync(cs35l41->dev); + pm_runtime_disable(cs35l41->dev); + + if (cs35l41->halo_initialized) + cs35l41_remove_dsp(cs35l41); + component_del(cs35l41->dev, &cs35l41_hda_comp_ops); + pm_runtime_put_noidle(cs35l41->dev); + if (cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type)) gpiod_set_value_cansleep(cs35l41->reset_gpio, 0); gpiod_put(cs35l41->reset_gpio); } EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41); +const struct dev_pm_ops cs35l41_hda_pm_ops = { + SET_RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume, NULL) +}; +EXPORT_SYMBOL_NS_GPL(cs35l41_hda_pm_ops, SND_HDA_SCODEC_CS35L41); + MODULE_DESCRIPTION("CS35L41 HDA Driver"); +MODULE_IMPORT_NS(SND_HDA_CS_DSP_CONTROLS); MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, "); MODULE_LICENSE("GPL"); diff -Nru linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.h linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.h --- linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/cs35l41_hda.h 2022-11-29 07:06:46.000000000 +0000 @@ -10,11 +10,29 @@ #ifndef __CS35L41_HDA_H__ #define __CS35L41_HDA_H__ +#include #include #include #include #include +#include +#include + +struct cs35l41_amp_cal_data { + u32 calTarget[2]; + u32 calTime[2]; + s8 calAmbient; + u8 calStatus; + u16 calR; +} __packed; + +struct cs35l41_amp_efi_data { + u32 size; + u32 count; + struct cs35l41_amp_cal_data data[]; +} __packed; + enum cs35l41_hda_spk_pos { CS35l41_LEFT, CS35l41_RIGHT, @@ -32,15 +50,36 @@ struct regmap *regmap; struct gpio_desc *reset_gpio; struct cs35l41_hw_cfg hw_cfg; + struct hda_codec *codec; int irq; int index; int channel_index; unsigned volatile long irq_errors; const char *amp_name; + const char *acpi_subsystem_id; + int firmware_type; + int speaker_id; + struct mutex fw_mutex; + struct work_struct fw_load_work; + struct regmap_irq_chip_data *irq_data; + bool firmware_running; + bool request_fw_load; + bool fw_request_ongoing; + bool halo_initialized; + bool playback_started; + struct cs_dsp cs_dsp; }; +enum halo_state { + HALO_STATE_CODE_INIT_DOWNLOAD = 0, + HALO_STATE_CODE_START, + HALO_STATE_CODE_RUN +}; + +extern const struct dev_pm_ops cs35l41_hda_pm_ops; + int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq, struct regmap *regmap); void cs35l41_hda_remove(struct device *dev); diff -Nru linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_i2c.c linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_i2c.c --- linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_i2c.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_i2c.c 2022-11-29 07:06:46.000000000 +0000 @@ -6,9 +6,9 @@ // // Author: Lucas Tanure +#include #include #include -#include #include "cs35l41_hda.h" @@ -42,19 +42,18 @@ {} }; -#ifdef CONFIG_ACPI static const struct acpi_device_id cs35l41_acpi_hda_match[] = { {"CLSA0100", 0 }, {"CSC3551", 0 }, - { }, + {} }; MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match); -#endif static struct i2c_driver cs35l41_i2c_driver = { .driver = { .name = "cs35l41-hda", - .acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match), + .acpi_match_table = cs35l41_acpi_hda_match, + .pm = &cs35l41_hda_pm_ops, }, .id_table = cs35l41_hda_i2c_id, .probe = cs35l41_hda_i2c_probe, diff -Nru linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_spi.c linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_spi.c --- linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_spi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/cs35l41_hda_spi.c 2022-11-29 07:06:46.000000000 +0000 @@ -6,7 +6,7 @@ // // Author: Lucas Tanure -#include +#include #include #include @@ -38,18 +38,17 @@ {} }; -#ifdef CONFIG_ACPI static const struct acpi_device_id cs35l41_acpi_hda_match[] = { { "CSC3551", 0 }, - {}, + {} }; MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match); -#endif static struct spi_driver cs35l41_spi_driver = { .driver = { .name = "cs35l41-hda", - .acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match), + .acpi_match_table = cs35l41_acpi_hda_match, + .pm = &cs35l41_hda_pm_ops, }, .id_table = cs35l41_hda_spi_id, .probe = cs35l41_hda_spi_probe, diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_beep.c linux-aws-5.19.0/sound/pci/hda/hda_beep.c --- linux-aws-5.19.0/sound/pci/hda/hda_beep.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_beep.c 2022-11-29 07:06:46.000000000 +0000 @@ -118,6 +118,12 @@ return 0; } +static void turn_on_beep(struct hda_beep *beep) +{ + if (beep->keep_power_at_enable) + snd_hda_power_up_pm(beep->codec); +} + static void turn_off_beep(struct hda_beep *beep) { cancel_work_sync(&beep->beep_work); @@ -125,6 +131,8 @@ /* turn off beep */ generate_tone(beep, 0); } + if (beep->keep_power_at_enable) + snd_hda_power_down_pm(beep->codec); } /** @@ -140,7 +148,9 @@ enable = !!enable; if (beep->enabled != enable) { beep->enabled = enable; - if (!enable) + if (enable) + turn_on_beep(beep); + else turn_off_beep(beep); return 1; } @@ -167,7 +177,8 @@ input_unregister_device(beep->dev); else input_free_device(beep->dev); - turn_off_beep(beep); + if (beep->enabled) + turn_off_beep(beep); return 0; } diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_beep.h linux-aws-5.19.0/sound/pci/hda/hda_beep.h --- linux-aws-5.19.0/sound/pci/hda/hda_beep.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_beep.h 2022-11-29 07:06:46.000000000 +0000 @@ -25,6 +25,7 @@ unsigned int enabled:1; unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ unsigned int playing:1; + unsigned int keep_power_at_enable:1; /* set by driver */ struct work_struct beep_work; /* scheduled task for beep event */ struct mutex mutex; void (*power_hook)(struct hda_beep *beep, bool on); diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_bind.c linux-aws-5.19.0/sound/pci/hda/hda_bind.c --- linux-aws-5.19.0/sound/pci/hda/hda_bind.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_bind.c 2022-11-29 07:06:46.000000000 +0000 @@ -157,10 +157,10 @@ return codec->bus->core.ext_ops->hdev_detach(&codec->core); } - refcount_dec(&codec->pcm_ref); snd_hda_codec_disconnect_pcms(codec); snd_hda_jack_tbl_disconnect(codec); - wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); + if (!refcount_dec_and_test(&codec->pcm_ref)) + wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); snd_power_sync_ref(codec->bus->card); if (codec->patch_ops.free) diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_component.h linux-aws-5.19.0/sound/pci/hda/hda_component.h --- linux-aws-5.19.0/sound/pci/hda/hda_component.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_component.h 2022-11-29 07:06:46.000000000 +0000 @@ -14,5 +14,8 @@ struct hda_component { struct device *dev; char name[HDA_MAX_NAME_SIZE]; + struct hda_codec *codec; void (*playback_hook)(struct device *dev, int action); + int (*suspend_hook)(struct device *dev); + int (*resume_hook)(struct device *dev); }; diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.c linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.c --- linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.c 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.c 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,240 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// HDA DSP ALSA Control Driver +// +// Copyright 2022 Cirrus Logic, Inc. +// +// Author: Stefan Binding + +#include +#include +#include +#include +#include "hda_cs_dsp_ctl.h" + +#define ADSP_MAX_STD_CTRL_SIZE 512 + +struct hda_cs_dsp_coeff_ctl { + struct cs_dsp_coeff_ctl *cs_ctl; + struct snd_card *card; + struct snd_kcontrol *kctl; +}; + +static const char * const hda_cs_dsp_fw_text[HDA_CS_DSP_NUM_FW] = { + [HDA_CS_DSP_FW_SPK_PROT] = "Prot", + [HDA_CS_DSP_FW_SPK_CALI] = "Cali", + [HDA_CS_DSP_FW_SPK_DIAG] = "Diag", + [HDA_CS_DSP_FW_MISC] = "Misc", +}; + +const char * const hda_cs_dsp_fw_ids[HDA_CS_DSP_NUM_FW] = { + [HDA_CS_DSP_FW_SPK_PROT] = "spk-prot", + [HDA_CS_DSP_FW_SPK_CALI] = "spk-cali", + [HDA_CS_DSP_FW_SPK_DIAG] = "spk-diag", + [HDA_CS_DSP_FW_MISC] = "misc", +}; +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_fw_ids, SND_HDA_CS_DSP_CONTROLS); + +static int hda_cs_dsp_coeff_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo) +{ + struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip(kctl); + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; + + uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; + uinfo->count = cs_ctl->len; + + return 0; +} + +static int hda_cs_dsp_coeff_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) +{ + struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip(kctl); + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; + char *p = ucontrol->value.bytes.data; + int ret = 0; + + mutex_lock(&cs_ctl->dsp->pwr_lock); + ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, p, cs_ctl->len); + mutex_unlock(&cs_ctl->dsp->pwr_lock); + + return ret; +} + +static int hda_cs_dsp_coeff_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) +{ + struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip(kctl); + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; + char *p = ucontrol->value.bytes.data; + int ret; + + mutex_lock(&cs_ctl->dsp->pwr_lock); + ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, p, cs_ctl->len); + mutex_unlock(&cs_ctl->dsp->pwr_lock); + + return ret; +} + +static unsigned int wmfw_convert_flags(unsigned int in) +{ + unsigned int out, rd, wr, vol; + + rd = SNDRV_CTL_ELEM_ACCESS_READ; + wr = SNDRV_CTL_ELEM_ACCESS_WRITE; + vol = SNDRV_CTL_ELEM_ACCESS_VOLATILE; + + out = 0; + + if (in) { + out |= rd; + if (in & WMFW_CTL_FLAG_WRITEABLE) + out |= wr; + if (in & WMFW_CTL_FLAG_VOLATILE) + out |= vol; + } else { + out |= rd | wr | vol; + } + + return out; +} + +static int hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char *name) +{ + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; + struct snd_kcontrol_new kcontrol = {0}; + struct snd_kcontrol *kctl; + int ret = 0; + + if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) { + dev_err(cs_ctl->dsp->dev, "KControl %s: length %zu exceeds maximum %d\n", name, + cs_ctl->len, ADSP_MAX_STD_CTRL_SIZE); + return -EINVAL; + } + + kcontrol.name = name; + kcontrol.info = hda_cs_dsp_coeff_info; + kcontrol.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + kcontrol.access = wmfw_convert_flags(cs_ctl->flags); + kcontrol.get = hda_cs_dsp_coeff_get; + kcontrol.put = hda_cs_dsp_coeff_put; + + /* Save ctl inside private_data, ctl is owned by cs_dsp, + * and will be freed when cs_dsp removes the control */ + kctl = snd_ctl_new1(&kcontrol, (void *)ctl); + if (!kctl) { + ret = -ENOMEM; + return ret; + } + + ret = snd_ctl_add(ctl->card, kctl); + if (ret) { + dev_err(cs_ctl->dsp->dev, "Failed to add KControl %s = %d\n", kcontrol.name, ret); + return ret; + } + + dev_dbg(cs_ctl->dsp->dev, "Added KControl: %s\n", kcontrol.name); + ctl->kctl = kctl; + + return 0; +} + +int hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, struct hda_cs_dsp_ctl_info *info) +{ + struct cs_dsp *cs_dsp = cs_ctl->dsp; + char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; + struct hda_cs_dsp_coeff_ctl *ctl; + const char *region_name; + int ret; + + if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) + return 0; + + region_name = cs_dsp_mem_region_name(cs_ctl->alg_region.type); + if (!region_name) { + dev_err(cs_dsp->dev, "Unknown region type: %d\n", cs_ctl->alg_region.type); + return -EINVAL; + } + + ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s %s %.12s %x", info->device_name, + cs_dsp->name, hda_cs_dsp_fw_text[info->fw_type], cs_ctl->alg_region.alg); + + if (cs_ctl->subname) { + int avail = SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret - 2; + int skip = 0; + + /* Truncate the subname from the start if it is too long */ + if (cs_ctl->subname_len > avail) + skip = cs_ctl->subname_len - avail; + + snprintf(name + ret, SNDRV_CTL_ELEM_ID_NAME_MAXLEN - ret, + " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip); + } + + ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); + if (!ctl) + return -ENOMEM; + + ctl->cs_ctl = cs_ctl; + ctl->card = info->card; + cs_ctl->priv = ctl; + + ret = hda_cs_dsp_add_kcontrol(ctl, name); + if (ret) { + dev_err(cs_dsp->dev, "Error (%d) adding control %s\n", ret, name); + kfree(ctl); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_add, SND_HDA_CS_DSP_CONTROLS); + +void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) +{ + struct hda_cs_dsp_coeff_ctl *ctl = cs_ctl->priv; + + kfree(ctl); +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS); + +int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, const void *buf, size_t len) +{ + struct cs_dsp_coeff_ctl *cs_ctl; + struct hda_cs_dsp_coeff_ctl *ctl; + int ret; + + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); + if (!cs_ctl) + return -EINVAL; + + ctl = cs_ctl->priv; + + ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); + if (ret) + return ret; + + if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) + return 0; + + snd_ctl_notify(ctl->card, SNDRV_CTL_EVENT_MASK_VALUE, &ctl->kctl->id); + + return 0; +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_write_ctl, SND_HDA_CS_DSP_CONTROLS); + +int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, void *buf, size_t len) +{ + struct cs_dsp_coeff_ctl *cs_ctl; + + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); + if (!cs_ctl) + return -EINVAL; + + return cs_dsp_coeff_read_ctrl(cs_ctl, 0, buf, len); +} +EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_read_ctl, SND_HDA_CS_DSP_CONTROLS); + +MODULE_DESCRIPTION("CS_DSP ALSA Control HDA Library"); +MODULE_AUTHOR("Stefan Binding, "); +MODULE_LICENSE("GPL"); diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.h linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.h --- linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.h 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_cs_dsp_ctl.h 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * HDA DSP ALSA Control Driver + * + * Copyright 2022 Cirrus Logic, Inc. + * + * Author: Stefan Binding + */ + +#ifndef __HDA_CS_DSP_CTL_H__ +#define __HDA_CS_DSP_CTL_H__ + +#include +#include + +enum hda_cs_dsp_fw_id { + HDA_CS_DSP_FW_SPK_PROT, + HDA_CS_DSP_FW_SPK_CALI, + HDA_CS_DSP_FW_SPK_DIAG, + HDA_CS_DSP_FW_MISC, + HDA_CS_DSP_NUM_FW +}; + +struct hda_cs_dsp_ctl_info { + struct snd_card *card; + enum hda_cs_dsp_fw_id fw_type; + const char *device_name; +}; + +extern const char * const hda_cs_dsp_fw_ids[HDA_CS_DSP_NUM_FW]; + +int hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, struct hda_cs_dsp_ctl_info *info); +void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl); +int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, const void *buf, size_t len); +int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, + unsigned int alg, void *buf, size_t len); + +#endif /*__HDA_CS_DSP_CTL_H__*/ diff -Nru linux-aws-5.19.0/sound/pci/hda/hda_intel.c linux-aws-5.19.0/sound/pci/hda/hda_intel.c --- linux-aws-5.19.0/sound/pci/hda/hda_intel.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/hda_intel.c 2022-11-29 07:06:46.000000000 +0000 @@ -1817,7 +1817,7 @@ /* use the non-cached pages in non-snoop mode */ if (!azx_snoop(chip)) - azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; + azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC_SG; if (chip->driver_type == AZX_DRIVER_NVIDIA) { dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); @@ -2550,9 +2550,12 @@ /* 5 Series/3400 */ { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, + { PCI_DEVICE(0x8086, 0x3b57), + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x811b), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE | + AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */ { PCI_DEVICE(0x8086, 0x080a), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, diff -Nru linux-aws-5.19.0/sound/pci/hda/Kconfig linux-aws-5.19.0/sound/pci/hda/Kconfig --- linux-aws-5.19.0/sound/pci/hda/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -93,16 +93,21 @@ config SND_HDA_SCODEC_CS35L41 tristate + select SND_HDA_GENERIC + select REGMAP_IRQ + +config SND_HDA_CS_DSP_CONTROLS + tristate + select CS_DSP config SND_HDA_SCODEC_CS35L41_I2C tristate "Build CS35L41 HD-audio side codec support for I2C Bus" depends on I2C depends on ACPI depends on SND_SOC - select SND_HDA_GENERIC select SND_SOC_CS35L41_LIB select SND_HDA_SCODEC_CS35L41 - select REGMAP_IRQ + select SND_HDA_CS_DSP_CONTROLS help Say Y or M here to include CS35L41 I2C HD-audio side codec support in snd-hda-intel driver, such as ALC287. @@ -115,10 +120,9 @@ depends on SPI_MASTER depends on ACPI depends on SND_SOC - select SND_HDA_GENERIC select SND_SOC_CS35L41_LIB select SND_HDA_SCODEC_CS35L41 - select REGMAP_IRQ + select SND_HDA_CS_DSP_CONTROLS help Say Y or M here to include CS35L41 SPI HD-audio side codec support in snd-hda-intel driver, such as ALC287. diff -Nru linux-aws-5.19.0/sound/pci/hda/Makefile linux-aws-5.19.0/sound/pci/hda/Makefile --- linux-aws-5.19.0/sound/pci/hda/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -31,6 +31,7 @@ snd-hda-scodec-cs35l41-objs := cs35l41_hda.o snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o +snd-hda-cs-dsp-ctls-objs := hda_cs_dsp_ctl.o # common driver obj-$(CONFIG_SND_HDA) := snd-hda-codec.o @@ -54,6 +55,7 @@ obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o +obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o # this must be the last entry after codec drivers; # otherwise the codec patches won't be hooked before the PCI probe diff -Nru linux-aws-5.19.0/sound/pci/hda/patch_hdmi.c linux-aws-5.19.0/sound/pci/hda/patch_hdmi.c --- linux-aws-5.19.0/sound/pci/hda/patch_hdmi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/patch_hdmi.c 2022-11-29 07:06:46.000000000 +0000 @@ -170,6 +170,8 @@ bool dyn_pcm_no_legacy; /* hdmi interrupt trigger control flag for Nvidia codec */ bool hdmi_intr_trig_ctrl; + bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */ + bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ /* * Non-generic VIA/NVIDIA specific @@ -679,15 +681,24 @@ int ca, int active_channels, int conn_type) { + struct hdmi_spec *spec = codec->spec; union audio_infoframe ai; memset(&ai, 0, sizeof(ai)); - if (conn_type == 0) { /* HDMI */ + if ((conn_type == 0) || /* HDMI */ + /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ + (conn_type == 1 && spec->nv_dp_workaround)) { struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi; - hdmi_ai->type = 0x84; - hdmi_ai->ver = 0x01; - hdmi_ai->len = 0x0a; + if (conn_type == 0) { /* HDMI */ + hdmi_ai->type = 0x84; + hdmi_ai->ver = 0x01; + hdmi_ai->len = 0x0a; + } else {/* Nvidia DP */ + hdmi_ai->type = 0x84; + hdmi_ai->ver = 0x1b; + hdmi_ai->len = 0x11 << 2; + } hdmi_ai->CC02_CT47 = active_channels - 1; hdmi_ai->CA = ca; hdmi_checksum_audio_infoframe(hdmi_ai); @@ -1267,6 +1278,7 @@ set_bit(pcm_idx, &spec->pcm_in_use); per_pin = get_pin(spec, pin_idx); per_pin->cvt_nid = per_cvt->cvt_nid; + per_pin->silent_stream = false; hinfo->nid = per_cvt->cvt_nid; /* flip stripe flag for the assigned stream if supported */ @@ -2735,9 +2747,6 @@ */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; check_presence_and_report(codec, pin_nid, dev_id); } @@ -2921,9 +2930,6 @@ */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; snd_hdac_i915_set_bclk(&codec->bus->core); check_presence_and_report(codec, pin_nid, dev_id); @@ -3617,6 +3623,7 @@ spec->pcm_playback.rates = SUPPORTED_RATES; spec->pcm_playback.maxbps = SUPPORTED_MAXBPS; spec->pcm_playback.formats = SUPPORTED_FORMATS; + spec->nv_dp_workaround = true; return 0; } @@ -3756,6 +3763,7 @@ spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->nv_dp_workaround = true; codec->link_down_at_suspend = 1; @@ -3779,6 +3787,7 @@ spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->nv_dp_workaround = true; codec->link_down_at_suspend = 1; @@ -3984,6 +3993,7 @@ generic_hdmi_init_per_pins(codec); + codec->depop_delay = 10; codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; @@ -3992,6 +4002,7 @@ spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->nv_dp_workaround = true; return 0; } diff -Nru linux-aws-5.19.0/sound/pci/hda/patch_realtek.c linux-aws-5.19.0/sound/pci/hda/patch_realtek.c --- linux-aws-5.19.0/sound/pci/hda/patch_realtek.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/patch_realtek.c 2022-11-29 07:06:46.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -4021,15 +4022,22 @@ static int alc269_suspend(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; + int i; if (spec->has_alc5505_dsp) alc5505_dsp_suspend(codec); + + for (i = 0; i < HDA_MAX_COMPONENTS; i++) + if (spec->comps[i].suspend_hook) + spec->comps[i].suspend_hook(spec->comps[i].dev); + return alc_suspend(codec); } static int alc269_resume(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; + int i; if (spec->codec_variant == ALC269_TYPE_ALC269VB) alc269vb_toggle_power_output(codec, 0); @@ -4060,6 +4068,10 @@ if (spec->has_alc5505_dsp) alc5505_dsp_resume(codec); + for (i = 0; i < HDA_MAX_COMPONENTS; i++) + if (spec->comps[i].resume_hook) + spec->comps[i].resume_hook(spec->comps[i].dev); + return 0; } #endif /* CONFIG_PM */ @@ -4689,6 +4701,48 @@ alc236_fixup_hp_micmute_led_vref(codec, fix, action); } +static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, + const unsigned short coefs[2]) +{ + alc_write_coef_idx(codec, 0x23, coefs[0]); + alc_write_coef_idx(codec, 0x25, coefs[1]); + alc_write_coef_idx(codec, 0x26, 0xb011); +} + +struct alc298_samsung_amp_desc { + unsigned char nid; + unsigned short init_seq[2][2]; +}; + +static void alc298_fixup_samsung_amp(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + int i, j; + static const unsigned short init_seq[][2] = { + { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 }, + { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 }, + { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e }, + { 0x41, 0x07 }, { 0x400, 0x1 } + }; + static const struct alc298_samsung_amp_desc amps[] = { + { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } }, + { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } } + }; + + if (action != HDA_FIXUP_ACT_INIT) + return; + + for (i = 0; i < ARRAY_SIZE(amps); i++) { + alc_write_coef_idx(codec, 0x22, amps[i].nid); + + for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++) + alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); + + for (j = 0; j < ARRAY_SIZE(init_seq); j++) + alc298_samsung_write_coef_pack(codec, init_seq[j]); + } +} + #if IS_REACHABLE(CONFIG_INPUT) static void gpio2_mic_hotkey_event(struct hda_codec *codec, struct hda_jack_callback *event) @@ -6610,8 +6664,20 @@ { struct hda_codec *cdc = dev_to_hda_codec(dev); struct alc_spec *spec = cdc->spec; + int ret, i; - return component_bind_all(dev, spec->comps); + ret = component_bind_all(dev, spec->comps); + if (ret) + return ret; + + if (snd_hdac_is_power_on(&cdc->core)) { + codec_dbg(cdc, "Resuming after bind.\n"); + for (i = 0; i < HDA_MAX_COMPONENTS; i++) + if (spec->comps[i].resume_hook) + spec->comps[i].resume_hook(spec->comps[i].dev); + } + + return 0; } static void comp_unbind(struct device *dev) @@ -6639,22 +6705,51 @@ } } +struct cs35l41_dev_name { + const char *bus; + const char *hid; + int index; +}; + +/* match the device name in a slightly relaxed manner */ +static int comp_match_cs35l41_dev_name(struct device *dev, void *data) +{ + struct cs35l41_dev_name *p = data; + const char *d = dev_name(dev); + int n = strlen(p->bus); + char tmp[32]; + + /* check the bus name */ + if (strncmp(d, p->bus, n)) + return 0; + /* skip the bus number */ + if (isdigit(d[n])) + n++; + /* the rest must be exact matching */ + snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index); + return !strcmp(d + n, tmp); +} + static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus, const char *hid, int count) { struct device *dev = hda_codec_dev(cdc); struct alc_spec *spec = cdc->spec; - char *name; + struct cs35l41_dev_name *rec; int ret, i; switch (action) { case HDA_FIXUP_ACT_PRE_PROBE: for (i = 0; i < count; i++) { - name = devm_kasprintf(dev, GFP_KERNEL, - "%s-%s:00-cs35l41-hda.%d", bus, hid, i); - if (!name) + rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL); + if (!rec) return; - component_match_add(dev, &spec->match, component_compare_dev_name, name); + rec->bus = bus; + rec->hid = hid; + rec->index = i; + spec->comps[i].codec = cdc; + component_match_add(dev, &spec->match, + comp_match_cs35l41_dev_name, rec); } ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); if (ret) @@ -6672,12 +6767,12 @@ static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 2); + cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2); } static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 4); + cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4); } static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix, @@ -6995,11 +7090,14 @@ ALC294_FIXUP_ASUS_GU502_HP, ALC294_FIXUP_ASUS_GU502_PINS, ALC294_FIXUP_ASUS_GU502_VERBS, + ALC294_FIXUP_ASUS_G513_PINS, + ALC285_FIXUP_ASUS_G533Z_PINS, ALC285_FIXUP_HP_GPIO_LED, ALC285_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_GPIO_LED, ALC236_FIXUP_HP_MUTE_LED, ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, + ALC298_FIXUP_SAMSUNG_AMP, ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, @@ -8332,6 +8430,26 @@ .type = HDA_FIXUP_FUNC, .v.func = alc294_fixup_gu502_hp, }, + [ALC294_FIXUP_ASUS_G513_PINS] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x19, 0x03a11050 }, /* front HP mic */ + { 0x1a, 0x03a11c30 }, /* rear external mic */ + { 0x21, 0x03211420 }, /* front HP out */ + { } + }, + }, + [ALC285_FIXUP_ASUS_G533Z_PINS] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */ + { 0x19, 0x03a19020 }, /* Mic Boost Volume */ + { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */ + { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */ + { 0x21, 0x03211420 }, + { } + }, + }, [ALC294_FIXUP_ASUS_COEF_1B] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { @@ -8365,6 +8483,12 @@ .type = HDA_FIXUP_FUNC, .v.func = alc236_fixup_hp_mute_led_micmute_vref, }, + [ALC298_FIXUP_SAMSUNG_AMP] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc298_fixup_samsung_amp, + .chained = true, + .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET + }, [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { .type = HDA_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { @@ -9081,6 +9205,7 @@ SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), @@ -9208,6 +9333,7 @@ SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), @@ -9234,6 +9360,7 @@ SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), @@ -9255,10 +9382,11 @@ SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), + SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), - SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), @@ -9274,14 +9402,17 @@ SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS), SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), - SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), - SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), @@ -9303,17 +9434,18 @@ SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), - SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), - SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), - SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), - SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP), + SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP), + SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP), + SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP), SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), - SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), - SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), + SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP), + SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP), SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), @@ -9483,6 +9615,7 @@ SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK), SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS), + SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101), @@ -9679,7 +9812,7 @@ {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"}, {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, - {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, + {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"}, {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"}, {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, diff -Nru linux-aws-5.19.0/sound/pci/hda/patch_sigmatel.c linux-aws-5.19.0/sound/pci/hda/patch_sigmatel.c --- linux-aws-5.19.0/sound/pci/hda/patch_sigmatel.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/pci/hda/patch_sigmatel.c 2022-11-29 07:06:46.000000000 +0000 @@ -209,6 +209,7 @@ /* beep widgets */ hda_nid_t anabeep_nid; + bool beep_power_on; /* SPDIF-out mux */ const char * const *spdif_labels; @@ -4310,6 +4311,8 @@ if (codec->beep) { /* IDT/STAC codecs have linear beep tone parameter */ codec->beep->linear_tone = spec->linear_tone_beep; + /* keep power up while beep is enabled */ + codec->beep->keep_power_at_enable = 1; /* if no beep switch is available, make its own one */ caps = query_amp_caps(codec, nid, HDA_OUTPUT); if (!(caps & AC_AMPCAP_MUTE)) { diff -Nru linux-aws-5.19.0/sound/soc/atmel/mchp-spdiftx.c linux-aws-5.19.0/sound/soc/atmel/mchp-spdiftx.c --- linux-aws-5.19.0/sound/soc/atmel/mchp-spdiftx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/atmel/mchp-spdiftx.c 2022-11-29 07:06:46.000000000 +0000 @@ -196,8 +196,7 @@ struct clk *pclk; struct clk *gclk; unsigned int fmt; - const struct mchp_i2s_caps *caps; - int gclk_enabled:1; + unsigned int gclk_enabled:1; }; static inline int mchp_spdiftx_is_running(struct mchp_spdiftx_dev *dev) @@ -766,8 +765,6 @@ MODULE_DEVICE_TABLE(of, mchp_spdiftx_dt_ids); static int mchp_spdiftx_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; - const struct of_device_id *match; struct mchp_spdiftx_dev *dev; struct resource *mem; struct regmap *regmap; @@ -781,11 +778,6 @@ if (!dev) return -ENOMEM; - /* Get hardware capabilities. */ - match = of_match_node(mchp_spdiftx_dt_ids, np); - if (match) - dev->caps = match->data; - /* Map I/O registers. */ base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(base)) diff -Nru linux-aws-5.19.0/sound/soc/codecs/cs35l41.c linux-aws-5.19.0/sound/soc/codecs/cs35l41.c --- linux-aws-5.19.0/sound/soc/codecs/cs35l41.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/cs35l41.c 2022-11-29 07:06:46.000000000 +0000 @@ -1335,15 +1335,7 @@ if (!cs35l41->dsp.preloaded || !cs35l41->dsp.cs_dsp.running) return 0; - dev_dbg(cs35l41->dev, "Enter hibernate\n"); - - cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type); - regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0088); - regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0188); - - // Don't wait for ACK since bus activity would wake the device - regmap_write(cs35l41->regmap, CS35L41_DSP_VIRT1_MBOX_1, - CSPL_MBOX_CMD_HIBERNATE); + cs35l41_enter_hibernate(dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type); regcache_cache_only(cs35l41->regmap, true); regcache_mark_dirty(cs35l41->regmap); @@ -1351,65 +1343,6 @@ return 0; } -static void cs35l41_wait_for_pwrmgt_sts(struct cs35l41_private *cs35l41) -{ - const int pwrmgt_retries = 10; - unsigned int sts; - int i, ret; - - for (i = 0; i < pwrmgt_retries; i++) { - ret = regmap_read(cs35l41->regmap, CS35L41_PWRMGT_STS, &sts); - if (ret) - dev_err(cs35l41->dev, "Failed to read PWRMGT_STS: %d\n", ret); - else if (!(sts & CS35L41_WR_PEND_STS_MASK)) - return; - - udelay(20); - } - - dev_err(cs35l41->dev, "Timed out reading PWRMGT_STS\n"); -} - -static int cs35l41_exit_hibernate(struct cs35l41_private *cs35l41) -{ - const int wake_retries = 20; - const int sleep_retries = 5; - int ret, i, j; - - for (i = 0; i < sleep_retries; i++) { - dev_dbg(cs35l41->dev, "Exit hibernate\n"); - - for (j = 0; j < wake_retries; j++) { - ret = cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, - CSPL_MBOX_CMD_OUT_OF_HIBERNATE); - if (!ret) - break; - - usleep_range(100, 200); - } - - if (j < wake_retries) { - dev_dbg(cs35l41->dev, "Wake success at cycle: %d\n", j); - return 0; - } - - dev_err(cs35l41->dev, "Wake failed, re-enter hibernate: %d\n", ret); - - cs35l41_wait_for_pwrmgt_sts(cs35l41); - regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0088); - - cs35l41_wait_for_pwrmgt_sts(cs35l41); - regmap_write(cs35l41->regmap, CS35L41_WAKESRC_CTL, 0x0188); - - cs35l41_wait_for_pwrmgt_sts(cs35l41); - regmap_write(cs35l41->regmap, CS35L41_PWRMGT_CTL, 0x3); - } - - dev_err(cs35l41->dev, "Timed out waking device\n"); - - return -ETIMEDOUT; -} - static int __maybe_unused cs35l41_runtime_resume(struct device *dev) { struct cs35l41_private *cs35l41 = dev_get_drvdata(dev); @@ -1422,7 +1355,7 @@ regcache_cache_only(cs35l41->regmap, false); - ret = cs35l41_exit_hibernate(cs35l41); + ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap); if (ret) return ret; diff -Nru linux-aws-5.19.0/sound/soc/codecs/cs35l41-lib.c linux-aws-5.19.0/sound/soc/codecs/cs35l41-lib.c --- linux-aws-5.19.0/sound/soc/codecs/cs35l41-lib.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/cs35l41-lib.c 2022-11-29 07:06:46.000000000 +0000 @@ -1308,7 +1308,8 @@ return 0; } - dev_err(dev, "Failed to set mailbox cmd %u (status %u)\n", cmd, sts); + if (cmd != CSPL_MBOX_CMD_OUT_OF_HIBERNATE) + dev_err(dev, "Failed to set mailbox cmd %u (status %u)\n", cmd, sts); return -ENOMSG; } @@ -1327,6 +1328,85 @@ } EXPORT_SYMBOL_GPL(cs35l41_write_fs_errata); +int cs35l41_enter_hibernate(struct device *dev, struct regmap *regmap, + enum cs35l41_boost_type b_type) +{ + if (!cs35l41_safe_reset(regmap, b_type)) { + dev_dbg(dev, "System does not support Suspend\n"); + return -EINVAL; + } + + dev_dbg(dev, "Enter hibernate\n"); + regmap_write(regmap, CS35L41_WAKESRC_CTL, 0x0088); + regmap_write(regmap, CS35L41_WAKESRC_CTL, 0x0188); + + // Don't wait for ACK since bus activity would wake the device + regmap_write(regmap, CS35L41_DSP_VIRT1_MBOX_1, CSPL_MBOX_CMD_HIBERNATE); + + return 0; +} +EXPORT_SYMBOL_GPL(cs35l41_enter_hibernate); + +static void cs35l41_wait_for_pwrmgt_sts(struct device *dev, struct regmap *regmap) +{ + const int pwrmgt_retries = 10; + unsigned int sts; + int i, ret; + + for (i = 0; i < pwrmgt_retries; i++) { + ret = regmap_read(regmap, CS35L41_PWRMGT_STS, &sts); + if (ret) + dev_err(dev, "Failed to read PWRMGT_STS: %d\n", ret); + else if (!(sts & CS35L41_WR_PEND_STS_MASK)) + return; + + udelay(20); + } + + dev_err(dev, "Timed out reading PWRMGT_STS\n"); +} + +int cs35l41_exit_hibernate(struct device *dev, struct regmap *regmap) +{ + const int wake_retries = 20; + const int sleep_retries = 5; + int ret, i, j; + + for (i = 0; i < sleep_retries; i++) { + dev_dbg(dev, "Exit hibernate\n"); + + for (j = 0; j < wake_retries; j++) { + ret = cs35l41_set_cspl_mbox_cmd(dev, regmap, + CSPL_MBOX_CMD_OUT_OF_HIBERNATE); + if (!ret) + break; + + usleep_range(100, 200); + } + + if (j < wake_retries) { + dev_dbg(dev, "Wake success at cycle: %d\n", j); + return 0; + } + + dev_err(dev, "Wake failed, re-enter hibernate: %d\n", ret); + + cs35l41_wait_for_pwrmgt_sts(dev, regmap); + regmap_write(regmap, CS35L41_WAKESRC_CTL, 0x0088); + + cs35l41_wait_for_pwrmgt_sts(dev, regmap); + regmap_write(regmap, CS35L41_WAKESRC_CTL, 0x0188); + + cs35l41_wait_for_pwrmgt_sts(dev, regmap); + regmap_write(regmap, CS35L41_PWRMGT_CTL, 0x3); + } + + dev_err(dev, "Timed out waking device\n"); + + return -ETIMEDOUT; +} +EXPORT_SYMBOL_GPL(cs35l41_exit_hibernate); + MODULE_DESCRIPTION("CS35L41 library"); MODULE_AUTHOR("David Rhodes, Cirrus Logic Inc, "); MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, "); diff -Nru linux-aws-5.19.0/sound/soc/codecs/cs42l42.c linux-aws-5.19.0/sound/soc/codecs/cs42l42.c --- linux-aws-5.19.0/sound/soc/codecs/cs42l42.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/cs42l42.c 2022-11-29 07:06:46.000000000 +0000 @@ -1618,7 +1618,6 @@ unsigned int current_plug_status; unsigned int current_button_status; unsigned int i; - int report = 0; mutex_lock(&cs42l42->irq_lock); if (cs42l42->suspended) { @@ -1713,13 +1712,15 @@ if (current_button_status & CS42L42_M_DETECT_TF_MASK) { dev_dbg(cs42l42->dev, "Button released\n"); - report = 0; + snd_soc_jack_report(cs42l42->jack, 0, + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3); } else if (current_button_status & CS42L42_M_DETECT_FT_MASK) { - report = cs42l42_handle_button_press(cs42l42); - + snd_soc_jack_report(cs42l42->jack, + cs42l42_handle_button_press(cs42l42), + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3); } - snd_soc_jack_report(cs42l42->jack, report, SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3); } } diff -Nru linux-aws-5.19.0/sound/soc/codecs/da7219.c linux-aws-5.19.0/sound/soc/codecs/da7219.c --- linux-aws-5.19.0/sound/soc/codecs/da7219.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/da7219.c 2022-11-29 07:06:46.000000000 +0000 @@ -2196,6 +2196,7 @@ dai_clk_lookup = clkdev_hw_create(dai_clk_hw, init.name, "%s", dev_name(dev)); if (!dai_clk_lookup) { + clk_hw_unregister(dai_clk_hw); ret = -ENOMEM; goto err; } else { @@ -2217,12 +2218,12 @@ return 0; err: - do { + while (--i >= 0) { if (da7219->dai_clks_lookup[i]) clkdev_drop(da7219->dai_clks_lookup[i]); clk_hw_unregister(&da7219->dai_clks_hw[i]); - } while (i-- > 0); + } if (np) kfree(da7219->clk_hw_data); diff -Nru linux-aws-5.19.0/sound/soc/codecs/lpass-tx-macro.c linux-aws-5.19.0/sound/soc/codecs/lpass-tx-macro.c --- linux-aws-5.19.0/sound/soc/codecs/lpass-tx-macro.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/lpass-tx-macro.c 2022-11-29 07:06:46.000000000 +0000 @@ -823,17 +823,23 @@ struct tx_macro *tx = snd_soc_component_get_drvdata(component); if (enable) { + if (tx->active_decimator[dai_id] == dec_id) + return 0; + set_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_ch_cnt[dai_id]++; tx->active_decimator[dai_id] = dec_id; } else { + if (tx->active_decimator[dai_id] == -1) + return 0; + tx->active_ch_cnt[dai_id]--; clear_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_decimator[dai_id] = -1; } snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update); - return 0; + return 1; } static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, @@ -1019,9 +1025,12 @@ int path = e->shift_l; struct tx_macro *tx = snd_soc_component_get_drvdata(component); + if (tx->dec_mode[path] == value) + return 0; + tx->dec_mode[path] = value; - return 0; + return 1; } static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, diff -Nru linux-aws-5.19.0/sound/soc/codecs/mt6359-accdet.c linux-aws-5.19.0/sound/soc/codecs/mt6359-accdet.c --- linux-aws-5.19.0/sound/soc/codecs/mt6359-accdet.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/mt6359-accdet.c 2022-11-29 07:06:46.000000000 +0000 @@ -965,7 +965,7 @@ mutex_init(&priv->res_lock); priv->accdet_irq = platform_get_irq(pdev, 0); - if (priv->accdet_irq) { + if (priv->accdet_irq >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_irq, NULL, mt6359_accdet_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, @@ -979,7 +979,7 @@ if (priv->caps & ACCDET_PMIC_EINT0) { priv->accdet_eint0 = platform_get_irq(pdev, 1); - if (priv->accdet_eint0) { + if (priv->accdet_eint0 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint0, NULL, mt6359_accdet_irq, @@ -994,7 +994,7 @@ } } else if (priv->caps & ACCDET_PMIC_EINT1) { priv->accdet_eint1 = platform_get_irq(pdev, 2); - if (priv->accdet_eint1) { + if (priv->accdet_eint1 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint1, NULL, mt6359_accdet_irq, diff -Nru linux-aws-5.19.0/sound/soc/codecs/mt6660.c linux-aws-5.19.0/sound/soc/codecs/mt6660.c --- linux-aws-5.19.0/sound/soc/codecs/mt6660.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/mt6660.c 2022-11-29 07:06:46.000000000 +0000 @@ -503,13 +503,17 @@ dev_err(chip->dev, "read chip revision fail\n"); goto probe_fail; } - pm_runtime_set_active(chip->dev); - pm_runtime_enable(chip->dev); ret = devm_snd_soc_register_component(chip->dev, &mt6660_component_driver, &mt6660_codec_dai, 1); + if (!ret) { + pm_runtime_set_active(chip->dev); + pm_runtime_enable(chip->dev); + } + return ret; + probe_fail: _mt6660_chip_power_on(chip, 0); mutex_destroy(&chip->io_lock); diff -Nru linux-aws-5.19.0/sound/soc/codecs/tas2764.c linux-aws-5.19.0/sound/soc/codecs/tas2764.c --- linux-aws-5.19.0/sound/soc/codecs/tas2764.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/tas2764.c 2022-11-29 07:06:46.000000000 +0000 @@ -34,6 +34,9 @@ int v_sense_slot; int i_sense_slot; + + bool dac_powered; + bool unmuted; }; static void tas2764_reset(struct tas2764_priv *tas2764) @@ -50,34 +53,22 @@ usleep_range(1000, 2000); } -static int tas2764_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) +static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) { - struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); + struct snd_soc_component *component = tas2764->component; + unsigned int val; + int ret; - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); - break; + if (tas2764->dac_powered) + val = tas2764->unmuted ? + TAS2764_PWR_CTRL_ACTIVE : TAS2764_PWR_CTRL_MUTE; + else + val = TAS2764_PWR_CTRL_SHUTDOWN; - default: - dev_err(tas2764->dev, - "wrong power level setting %d\n", level); - return -EINVAL; - } + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; return 0; } @@ -114,9 +105,7 @@ usleep_range(1000, 2000); } - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); + ret = tas2764_update_pwr_ctrl(tas2764); if (ret < 0) return ret; @@ -150,14 +139,12 @@ switch (event) { case SND_SOC_DAPM_POST_PMU: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); + tas2764->dac_powered = true; + ret = tas2764_update_pwr_ctrl(tas2764); break; case SND_SOC_DAPM_PRE_PMD: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); + tas2764->dac_powered = false; + ret = tas2764_update_pwr_ctrl(tas2764); break; default: dev_err(tas2764->dev, "Unsupported event\n"); @@ -202,17 +189,11 @@ static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) { - struct snd_soc_component *component = dai->component; - int ret; - - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - mute ? TAS2764_PWR_CTRL_MUTE : 0); - - if (ret < 0) - return ret; + struct tas2764_priv *tas2764 = + snd_soc_component_get_drvdata(dai->component); - return 0; + tas2764->unmuted = !mute; + return tas2764_update_pwr_ctrl(tas2764); } static int tas2764_set_bitwidth(struct tas2764_priv *tas2764, int bitwidth) @@ -485,7 +466,7 @@ .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS, @@ -526,12 +507,6 @@ if (ret < 0) return ret; - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - if (ret < 0) - return ret; - return 0; } @@ -549,7 +524,6 @@ .probe = tas2764_codec_probe, .suspend = tas2764_codec_suspend, .resume = tas2764_codec_resume, - .set_bias_level = tas2764_set_bias_level, .controls = tas2764_snd_controls, .num_controls = ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets = tas2764_dapm_widgets, diff -Nru linux-aws-5.19.0/sound/soc/codecs/tas2770.c linux-aws-5.19.0/sound/soc/codecs/tas2770.c --- linux-aws-5.19.0/sound/soc/codecs/tas2770.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/tas2770.c 2022-11-29 07:06:46.000000000 +0000 @@ -495,6 +495,8 @@ }, }; +static const struct regmap_config tas2770_i2c_regmap; + static int tas2770_codec_probe(struct snd_soc_component *component) { struct tas2770_priv *tas2770 = @@ -508,6 +510,7 @@ } tas2770_reset(tas2770); + regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); return 0; } diff -Nru linux-aws-5.19.0/sound/soc/codecs/wcd9335.c linux-aws-5.19.0/sound/soc/codecs/wcd9335.c --- linux-aws-5.19.0/sound/soc/codecs/wcd9335.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wcd9335.c 2022-11-29 07:06:46.000000000 +0000 @@ -1983,8 +1983,8 @@ case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; diff -Nru linux-aws-5.19.0/sound/soc/codecs/wcd934x.c linux-aws-5.19.0/sound/soc/codecs/wcd934x.c --- linux-aws-5.19.0/sound/soc/codecs/wcd934x.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wcd934x.c 2022-11-29 07:06:46.000000000 +0000 @@ -1913,8 +1913,8 @@ case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; diff -Nru linux-aws-5.19.0/sound/soc/codecs/wm5102.c linux-aws-5.19.0/sound/soc/codecs/wm5102.c --- linux-aws-5.19.0/sound/soc/codecs/wm5102.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wm5102.c 2022-11-29 07:06:46.000000000 +0000 @@ -2100,9 +2100,6 @@ regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], WM5102_DIG_VU, WM5102_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5102_adsp2_irq, wm5102); @@ -2135,6 +2132,9 @@ goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: diff -Nru linux-aws-5.19.0/sound/soc/codecs/wm5110.c linux-aws-5.19.0/sound/soc/codecs/wm5110.c --- linux-aws-5.19.0/sound/soc/codecs/wm5110.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wm5110.c 2022-11-29 07:06:46.000000000 +0000 @@ -2458,9 +2458,6 @@ regmap_update_bits(arizona->regmap, wm5110_digital_vu[i], WM5110_DIG_VU, WM5110_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5110_adsp2_irq, wm5110); @@ -2493,6 +2490,9 @@ goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: diff -Nru linux-aws-5.19.0/sound/soc/codecs/wm8997.c linux-aws-5.19.0/sound/soc/codecs/wm8997.c --- linux-aws-5.19.0/sound/soc/codecs/wm8997.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wm8997.c 2022-11-29 07:06:46.000000000 +0000 @@ -1162,9 +1162,6 @@ regmap_update_bits(arizona->regmap, wm8997_digital_vu[i], WM8997_DIG_VU, WM8997_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - arizona_init_common(arizona); ret = arizona_init_vol_limit(arizona); @@ -1183,6 +1180,9 @@ goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: diff -Nru linux-aws-5.19.0/sound/soc/codecs/wm_adsp.c linux-aws-5.19.0/sound/soc/codecs/wm_adsp.c --- linux-aws-5.19.0/sound/soc/codecs/wm_adsp.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/codecs/wm_adsp.c 2022-11-29 07:06:46.000000000 +0000 @@ -1617,7 +1617,9 @@ if (list_empty(&dsp->buffer_list)) { /* Fall back to legacy support */ ret = wm_adsp_buffer_parse_legacy(dsp); - if (ret) + if (ret == -ENODEV) + adsp_info(dsp, "Legacy support not available\n"); + else if (ret) adsp_warn(dsp, "Failed to parse legacy: %d\n", ret); } diff -Nru linux-aws-5.19.0/sound/soc/fsl/eukrea-tlv320.c linux-aws-5.19.0/sound/soc/fsl/eukrea-tlv320.c --- linux-aws-5.19.0/sound/soc/fsl/eukrea-tlv320.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/fsl/eukrea-tlv320.c 2022-11-29 07:06:46.000000000 +0000 @@ -86,7 +86,7 @@ int ret; int int_port = 0, ext_port; struct device_node *np = pdev->dev.of_node; - struct device_node *ssi_np = NULL, *codec_np = NULL; + struct device_node *ssi_np = NULL, *codec_np = NULL, *tmp_np = NULL; eukrea_tlv320.dev = &pdev->dev; if (np) { @@ -143,7 +143,7 @@ } if (machine_is_eukrea_cpuimx27() || - of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux"))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR | @@ -158,10 +158,11 @@ IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) ); + of_node_put(tmp_np); } else if (machine_is_eukrea_cpuimx25sd() || machine_is_eukrea_cpuimx35sd() || machine_is_eukrea_cpuimx51sd() || - of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux"))) { if (!np) ext_port = machine_is_eukrea_cpuimx25sd() ? 4 : 3; @@ -178,6 +179,7 @@ IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) ); + of_node_put(tmp_np); } else { if (np) { /* The eukrea,asoc-tlv320 driver was explicitly diff -Nru linux-aws-5.19.0/sound/soc/fsl/imx-card.c linux-aws-5.19.0/sound/soc/fsl/imx-card.c --- linux-aws-5.19.0/sound/soc/fsl/imx-card.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/fsl/imx-card.c 2022-11-29 07:06:46.000000000 +0000 @@ -698,6 +698,10 @@ of_node_put(cpu); of_node_put(codec); of_node_put(platform); + + cpu = NULL; + codec = NULL; + platform = NULL; } return 0; diff -Nru linux-aws-5.19.0/sound/soc/qcom/sm8250.c linux-aws-5.19.0/sound/soc/qcom/sm8250.c --- linux-aws-5.19.0/sound/soc/qcom/sm8250.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/qcom/sm8250.c 2022-11-29 07:06:46.000000000 +0000 @@ -270,6 +270,7 @@ if (!card) return -ENOMEM; + card->owner = THIS_MODULE; /* Allocate the private data */ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) diff -Nru linux-aws-5.19.0/sound/soc/sh/rcar/ctu.c linux-aws-5.19.0/sound/soc/sh/rcar/ctu.c --- linux-aws-5.19.0/sound/soc/sh/rcar/ctu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sh/rcar/ctu.c 2022-11-29 07:06:46.000000000 +0000 @@ -171,7 +171,11 @@ struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ctu_activation(mod); diff -Nru linux-aws-5.19.0/sound/soc/sh/rcar/dvc.c linux-aws-5.19.0/sound/soc/sh/rcar/dvc.c --- linux-aws-5.19.0/sound/soc/sh/rcar/dvc.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sh/rcar/dvc.c 2022-11-29 07:06:46.000000000 +0000 @@ -186,7 +186,11 @@ struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_dvc_activation(mod); diff -Nru linux-aws-5.19.0/sound/soc/sh/rcar/mix.c linux-aws-5.19.0/sound/soc/sh/rcar/mix.c --- linux-aws-5.19.0/sound/soc/sh/rcar/mix.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sh/rcar/mix.c 2022-11-29 07:06:46.000000000 +0000 @@ -146,7 +146,11 @@ struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_mix_activation(mod); diff -Nru linux-aws-5.19.0/sound/soc/sh/rcar/src.c linux-aws-5.19.0/sound/soc/sh/rcar/src.c --- linux-aws-5.19.0/sound/soc/sh/rcar/src.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sh/rcar/src.c 2022-11-29 07:06:46.000000000 +0000 @@ -463,11 +463,14 @@ struct rsnd_priv *priv) { struct rsnd_src *src = rsnd_mod_to_src(mod); + int ret; /* reset sync convert_rate */ src->sync.val = 0; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_src_activation(mod); diff -Nru linux-aws-5.19.0/sound/soc/sh/rcar/ssi.c linux-aws-5.19.0/sound/soc/sh/rcar/ssi.c --- linux-aws-5.19.0/sound/soc/sh/rcar/ssi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sh/rcar/ssi.c 2022-11-29 07:06:46.000000000 +0000 @@ -480,7 +480,9 @@ ssi->usrcnt++; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ssi_config_init(mod, io); diff -Nru linux-aws-5.19.0/sound/soc/soc-pcm.c linux-aws-5.19.0/sound/soc/soc-pcm.c --- linux-aws-5.19.0/sound/soc/soc-pcm.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/soc-pcm.c 2022-11-29 07:06:46.000000000 +0000 @@ -723,7 +723,7 @@ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); snd_soc_dpcm_mutex_lock(rtd); - soc_pcm_clean(rtd, substream, 0); + __soc_pcm_close(rtd, substream); snd_soc_dpcm_mutex_unlock(rtd); return 0; } diff -Nru linux-aws-5.19.0/sound/soc/sof/intel/hda.c linux-aws-5.19.0/sound/soc/sof/intel/hda.c --- linux-aws-5.19.0/sound/soc/sof/intel/hda.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/intel/hda.c 2022-11-29 07:06:46.000000000 +0000 @@ -376,6 +376,10 @@ module_param_named(dmic_num, dmic_num_override, int, 0444); MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number"); +static int mclk_id_override = -1; +module_param_named(mclk_id, mclk_id_override, int, 0444); +MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); @@ -1433,6 +1437,13 @@ sof_pdata->tplg_filename = tplg_filename; } + + /* check if mclk_id should be modified from topology defaults */ + if (mclk_id_override >= 0) { + dev_info(sdev->dev, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } } /* diff -Nru linux-aws-5.19.0/sound/soc/sof/ipc3-topology.c linux-aws-5.19.0/sound/soc/sof/ipc3-topology.c --- linux-aws-5.19.0/sound/soc/sof/ipc3-topology.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/ipc3-topology.c 2022-11-29 07:06:46.000000000 +0000 @@ -1233,6 +1233,7 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) { + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs; struct sof_dai_private_data *private = dai->private; u32 size = sizeof(*config); @@ -1257,6 +1258,12 @@ config[i].hdr.size = size; + if (sdev->mclk_id_override) { + dev_dbg(scomp->dev, "tplg: overriding topology mclk_id %d by quirk %d\n", + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } + /* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate = le32_to_cpu(hw_config[i].mclk_rate); config[i].ssp.bclk_rate = le32_to_cpu(hw_config[i].bclk_rate); diff -Nru linux-aws-5.19.0/sound/soc/sof/Kconfig linux-aws-5.19.0/sound/soc/sof/Kconfig --- linux-aws-5.19.0/sound/soc/sof/Kconfig 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/Kconfig 2022-11-29 07:06:46.000000000 +0000 @@ -196,6 +196,7 @@ config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST tristate "SOF enable IPC flood test" + depends on SND_SOC_SOF select SND_SOC_SOF_CLIENT help This option enables a separate client device for IPC flood test @@ -214,6 +215,7 @@ config SND_SOC_SOF_DEBUG_IPC_MSG_INJECTOR tristate "SOF enable IPC message injector" + depends on SND_SOC_SOF select SND_SOC_SOF_CLIENT help This option enables the IPC message injector which can be used to send diff -Nru linux-aws-5.19.0/sound/soc/sof/mediatek/mt8195/mt8195.c linux-aws-5.19.0/sound/soc/sof/mediatek/mt8195/mt8195.c --- linux-aws-5.19.0/sound/soc/sof/mediatek/mt8195/mt8195.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/mediatek/mt8195/mt8195.c 2022-11-29 07:06:46.000000000 +0000 @@ -634,4 +634,5 @@ module_platform_driver(snd_sof_of_mt8195_driver); MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); +MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); MODULE_LICENSE("Dual BSD/GPL"); diff -Nru linux-aws-5.19.0/sound/soc/sof/sof-pci-dev.c linux-aws-5.19.0/sound/soc/sof/sof-pci-dev.c --- linux-aws-5.19.0/sound/soc/sof/sof-pci-dev.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/sof-pci-dev.c 2022-11-29 07:06:46.000000000 +0000 @@ -138,7 +138,7 @@ .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, diff -Nru linux-aws-5.19.0/sound/soc/sof/sof-priv.h linux-aws-5.19.0/sound/soc/sof/sof-priv.h --- linux-aws-5.19.0/sound/soc/sof/sof-priv.h 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/sof/sof-priv.h 2022-11-29 07:06:46.000000000 +0000 @@ -585,6 +585,10 @@ /* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; + /* quirks to override topology values */ + bool mclk_id_override; + u16 mclk_id_quirk; /* same size as in IPC3 definitions */ + void *private; /* core does not touch this */ }; diff -Nru linux-aws-5.19.0/sound/soc/stm/stm32_adfsdm.c linux-aws-5.19.0/sound/soc/stm/stm32_adfsdm.c --- linux-aws-5.19.0/sound/soc/stm/stm32_adfsdm.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/stm/stm32_adfsdm.c 2022-11-29 07:06:46.000000000 +0000 @@ -334,8 +334,6 @@ dev_set_drvdata(&pdev->dev, priv); - pm_runtime_enable(&pdev->dev); - ret = devm_snd_soc_register_component(&pdev->dev, &stm32_adfsdm_dai_component, &priv->dai_drv, 1); @@ -365,9 +363,13 @@ #endif ret = snd_soc_add_component(component, NULL, 0); - if (ret < 0) + if (ret < 0) { dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", __func__); + return ret; + } + + pm_runtime_enable(&pdev->dev); return ret; } diff -Nru linux-aws-5.19.0/sound/soc/stm/stm32_i2s.c linux-aws-5.19.0/sound/soc/stm/stm32_i2s.c --- linux-aws-5.19.0/sound/soc/stm/stm32_i2s.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/stm/stm32_i2s.c 2022-11-29 07:06:46.000000000 +0000 @@ -1135,8 +1135,6 @@ return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "Regmap init error\n"); - pm_runtime_enable(&pdev->dev); - ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0); if (ret) return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n"); @@ -1179,6 +1177,8 @@ FIELD_GET(I2S_VERR_MIN_MASK, val)); } + pm_runtime_enable(&pdev->dev); + return ret; error: diff -Nru linux-aws-5.19.0/sound/soc/stm/stm32_spdifrx.c linux-aws-5.19.0/sound/soc/stm/stm32_spdifrx.c --- linux-aws-5.19.0/sound/soc/stm/stm32_spdifrx.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/soc/stm/stm32_spdifrx.c 2022-11-29 07:06:46.000000000 +0000 @@ -1001,8 +1001,6 @@ udelay(2); reset_control_deassert(rst); - pm_runtime_enable(&pdev->dev); - pcm_config = &stm32_spdifrx_pcm_config; ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, 0); if (ret) @@ -1035,6 +1033,8 @@ FIELD_GET(SPDIFRX_VERR_MIN_MASK, ver)); } + pm_runtime_enable(&pdev->dev); + return ret; error: diff -Nru linux-aws-5.19.0/sound/usb/card.c linux-aws-5.19.0/sound/usb/card.c --- linux-aws-5.19.0/sound/usb/card.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/card.c 2022-11-29 07:06:46.000000000 +0000 @@ -690,7 +690,7 @@ return false; } -static bool check_delayed_register_option(struct snd_usb_audio *chip, int iface) +static int check_delayed_register_option(struct snd_usb_audio *chip) { int i; unsigned int id, inum; @@ -699,14 +699,31 @@ if (delayed_register[i] && sscanf(delayed_register[i], "%x:%x", &id, &inum) == 2 && id == chip->usb_id) - return inum != iface; + return inum; } - return false; + return -1; } static const struct usb_device_id usb_audio_ids[]; /* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface(struct snd_usb_audio *chip) +{ + struct usb_host_config *config = chip->dev->actconfig; + struct usb_interface *intf; + int i; + + if (!config) + return; + for (i = 0; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; + if (usb_match_id(intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0].desc.bInterfaceNumber; + } + usb_audio_dbg(chip, "Found last interface = %d\n", chip->last_iface); +} + /* look for the corresponding quirk */ static const struct snd_usb_audio_quirk * get_alias_quirk(struct usb_device *dev, unsigned int id) @@ -813,6 +830,7 @@ err = -ENODEV; goto __error; } + find_last_interface(chip); } if (chip->num_interfaces >= MAX_CARD_INTERFACES) { @@ -862,11 +880,11 @@ chip->need_delayed_register = false; /* clear again */ } - /* we are allowed to call snd_card_register() many times, but first - * check to see if a device needs to skip it or do anything special + /* register card if we reach to the last interface or to the specified + * one given via option */ - if (!snd_usb_registration_quirk(chip, ifnum) && - !check_delayed_register_option(chip, ifnum)) { + if (check_delayed_register_option(chip) == ifnum || + usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) { err = snd_card_register(chip->card); if (err < 0) goto __error; diff -Nru linux-aws-5.19.0/sound/usb/endpoint.c linux-aws-5.19.0/sound/usb/endpoint.c --- linux-aws-5.19.0/sound/usb/endpoint.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/endpoint.c 2022-11-29 07:06:46.000000000 +0000 @@ -39,6 +39,7 @@ struct snd_usb_clock_ref { unsigned char clock; atomic_t locked; + int opened; int rate; struct list_head list; }; @@ -93,12 +94,13 @@ */ static void release_urb_ctx(struct snd_urb_ctx *u) { - if (u->buffer_size) + if (u->urb && u->buffer_size) usb_free_coherent(u->ep->chip->dev, u->buffer_size, u->urb->transfer_buffer, u->urb->transfer_dma); usb_free_urb(u->urb); u->urb = NULL; + u->buffer_size = 0; } static const char *usb_error_string(int err) @@ -801,6 +803,7 @@ ep = NULL; goto unlock; } + ep->clock_ref->opened++; } ep->cur_audiofmt = fp; @@ -924,6 +927,10 @@ endpoint_set_interface(chip, ep, false); if (!--ep->opened) { + if (ep->clock_ref) { + if (!--ep->clock_ref->opened) + ep->clock_ref->rate = 0; + } ep->iface = 0; ep->altsetting = 0; ep->cur_audiofmt = NULL; @@ -1259,6 +1266,7 @@ if (!ep->syncbuf) return -ENOMEM; + ep->nurbs = SYNC_URBS; for (i = 0; i < SYNC_URBS; i++) { struct snd_urb_ctx *u = &ep->urb[i]; u->index = i; @@ -1278,8 +1286,6 @@ u->urb->complete = snd_complete_urb; } - ep->nurbs = SYNC_URBS; - return 0; out_of_memory: @@ -1631,8 +1637,7 @@ WRITE_ONCE(ep->sync_source->sync_sink, NULL); stop_urbs(ep, false, keep_pending); if (ep->clock_ref) - if (!atomic_dec_return(&ep->clock_ref->locked)) - ep->clock_ref->rate = 0; + atomic_dec(&ep->clock_ref->locked); } } diff -Nru linux-aws-5.19.0/sound/usb/quirks.c linux-aws-5.19.0/sound/usb/quirks.c --- linux-aws-5.19.0/sound/usb/quirks.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/quirks.c 2022-11-29 07:06:46.000000000 +0000 @@ -1729,48 +1729,6 @@ } /* - * registration quirk: - * the registration is skipped if a device matches with the given ID, - * unless the interface reaches to the defined one. This is for delaying - * the registration until the last known interface, so that the card and - * devices appear at the same time. - */ - -struct registration_quirk { - unsigned int usb_id; /* composed via USB_ID() */ - unsigned int interface; /* the interface to trigger register */ -}; - -#define REG_QUIRK_ENTRY(vendor, product, iface) \ - { .usb_id = USB_ID(vendor, product), .interface = (iface) } - -static const struct registration_quirk registration_quirks[] = { - REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ - REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ - REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f47, 2), /* JBL Quantum 800 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f4c, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ - { 0 } /* terminator */ -}; - -/* return true if skipping registration */ -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface) -{ - const struct registration_quirk *q; - - for (q = registration_quirks; q->usb_id; q++) - if (chip->usb_id == q->usb_id) - return iface != q->interface; - - /* Register as normal */ - return false; -} - -/* * driver behavior quirk flags */ struct usb_audio_quirk_flags_table { diff -Nru linux-aws-5.19.0/sound/usb/quirks.h linux-aws-5.19.0/sound/usb/quirks.h --- linux-aws-5.19.0/sound/usb/quirks.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/quirks.h 2022-11-29 07:06:46.000000000 +0000 @@ -48,8 +48,6 @@ struct audioformat *fp, int stream); -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface); - void snd_usb_init_quirk_flags(struct snd_usb_audio *chip); #endif /* __USBAUDIO_QUIRKS_H */ diff -Nru linux-aws-5.19.0/sound/usb/stream.c linux-aws-5.19.0/sound/usb/stream.c --- linux-aws-5.19.0/sound/usb/stream.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/stream.c 2022-11-29 07:06:46.000000000 +0000 @@ -495,6 +495,10 @@ return 0; } } + + if (chip->card->registered) + chip->need_delayed_register = true; + /* look for an empty stream */ list_for_each_entry(as, &chip->pcm_list, list) { if (as->fmt_type != fp->fmt_type) @@ -502,9 +506,6 @@ subs = &as->substream[stream]; if (subs->ep_num) continue; - if (snd_device_get_state(chip->card, as->pcm) != - SNDRV_DEV_BUILD) - chip->need_delayed_register = true; err = snd_pcm_new_stream(as->pcm, stream, 1); if (err < 0) return err; @@ -1105,7 +1106,7 @@ * Dallas DS4201 workaround: It presents 5 altsettings, but the last * one misses syncpipe, and does not produce any sound. */ - if (chip->usb_id == USB_ID(0x04fa, 0x4201)) + if (chip->usb_id == USB_ID(0x04fa, 0x4201) && num >= 4) num = 4; for (i = 0; i < num; i++) { diff -Nru linux-aws-5.19.0/sound/usb/usbaudio.h linux-aws-5.19.0/sound/usb/usbaudio.h --- linux-aws-5.19.0/sound/usb/usbaudio.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/sound/usb/usbaudio.h 2022-11-29 07:06:46.000000000 +0000 @@ -37,6 +37,7 @@ unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */ int num_interfaces; + int last_iface; int num_suspended_intf; int sample_rate_read_error; diff -Nru linux-aws-5.19.0/tools/bpf/bpftool/btf_dumper.c linux-aws-5.19.0/tools/bpf/bpftool/btf_dumper.c --- linux-aws-5.19.0/tools/bpf/bpftool/btf_dumper.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/bpf/bpftool/btf_dumper.c 2022-11-29 07:06:46.000000000 +0000 @@ -426,7 +426,7 @@ *(char *)data); break; case BTF_INT_BOOL: - jsonw_bool(jw, *(int *)data); + jsonw_bool(jw, *(bool *)data); break; default: /* shouldn't happen */ diff -Nru linux-aws-5.19.0/tools/bpf/bpftool/main.c linux-aws-5.19.0/tools/bpf/bpftool/main.c --- linux-aws-5.19.0/tools/bpf/bpftool/main.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/bpf/bpftool/main.c 2022-11-29 07:06:46.000000000 +0000 @@ -435,6 +435,16 @@ setlinebuf(stdout); +#ifdef USE_LIBCAP + /* Libcap < 2.63 hooks before main() to compute the number of + * capabilities of the running kernel, and doing so it calls prctl() + * which may fail and set errno to non-zero. + * Let's reset errno to make sure this does not interfere with the + * batch mode. + */ + errno = 0; +#endif + last_do_help = do_help; pretty_output = false; json_output = false; diff -Nru linux-aws-5.19.0/tools/include/uapi/asm/errno.h linux-aws-5.19.0/tools/include/uapi/asm/errno.h --- linux-aws-5.19.0/tools/include/uapi/asm/errno.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/include/uapi/asm/errno.h 2022-11-29 07:06:46.000000000 +0000 @@ -9,8 +9,8 @@ #include "../../../arch/alpha/include/uapi/asm/errno.h" #elif defined(__mips__) #include "../../../arch/mips/include/uapi/asm/errno.h" -#elif defined(__xtensa__) -#include "../../../arch/xtensa/include/uapi/asm/errno.h" +#elif defined(__hppa__) +#include "../../../arch/parisc/include/uapi/asm/errno.h" #else #include #endif diff -Nru linux-aws-5.19.0/tools/lib/bpf/xsk.c linux-aws-5.19.0/tools/lib/bpf/xsk.c --- linux-aws-5.19.0/tools/lib/bpf/xsk.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/lib/bpf/xsk.c 2022-11-29 07:06:46.000000000 +0000 @@ -1228,15 +1228,15 @@ ctx = xsk->ctx; umem = ctx->umem; - xsk_put_ctx(ctx, true); - - if (!ctx->refcount) { + if (ctx->refcount == 1) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); if (ctx->has_bpf_link) close(ctx->link_fd); } + xsk_put_ctx(ctx, true); + err = xsk_get_mmap_offsets(xsk->fd, &off); if (!err) { if (xsk->rx) { diff -Nru linux-aws-5.19.0/tools/lib/perf/evlist.c linux-aws-5.19.0/tools/lib/perf/evlist.c --- linux-aws-5.19.0/tools/lib/perf/evlist.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/lib/perf/evlist.c 2022-11-29 07:06:46.000000000 +0000 @@ -441,6 +441,7 @@ perf_evlist__for_each_entry(evlist, evsel) { bool overwrite = evsel->attr.write_backward; + enum fdarray_flags flgs; struct perf_mmap *map; int *output, fd, cpu; @@ -486,6 +487,7 @@ if (ops->idx) ops->idx(evlist, evsel, mp, idx); + pr_debug("idx %d: mmapping fd %d\n", idx, *output); if (ops->mmap(map, mp, *output, evlist_cpu) < 0) return -1; @@ -494,6 +496,7 @@ if (!idx) perf_evlist__set_mmap_first(evlist, map, overwrite); } else { + pr_debug("idx %d: set output fd %d -> %d\n", idx, fd, *output); if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0) return -1; @@ -502,8 +505,8 @@ revent = !overwrite ? POLLIN : 0; - if (!evsel->system_wide && - perf_evlist__add_pollfd(evlist, fd, map, revent, fdarray_flag__default) < 0) { + flgs = evsel->system_wide ? fdarray_flag__nonfilterable : fdarray_flag__default; + if (perf_evlist__add_pollfd(evlist, fd, map, revent, flgs) < 0) { perf_mmap__put(map); return -1; } @@ -520,6 +523,48 @@ } static int +mmap_per_thread(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops, + struct perf_mmap_param *mp) +{ + int nr_threads = perf_thread_map__nr(evlist->threads); + int nr_cpus = perf_cpu_map__nr(evlist->all_cpus); + int cpu, thread, idx = 0; + int nr_mmaps = 0; + + pr_debug("%s: nr cpu values (may include -1) %d nr threads %d\n", + __func__, nr_cpus, nr_threads); + + /* per-thread mmaps */ + for (thread = 0; thread < nr_threads; thread++, idx++) { + int output = -1; + int output_overwrite = -1; + + if (mmap_per_evsel(evlist, ops, idx, mp, 0, thread, &output, + &output_overwrite, &nr_mmaps)) + goto out_unmap; + } + + /* system-wide mmaps i.e. per-cpu */ + for (cpu = 1; cpu < nr_cpus; cpu++, idx++) { + int output = -1; + int output_overwrite = -1; + + if (mmap_per_evsel(evlist, ops, idx, mp, cpu, 0, &output, + &output_overwrite, &nr_mmaps)) + goto out_unmap; + } + + if (nr_mmaps != evlist->nr_mmaps) + pr_err("Miscounted nr_mmaps %d vs %d\n", nr_mmaps, evlist->nr_mmaps); + + return 0; + +out_unmap: + perf_evlist__munmap(evlist); + return -1; +} + +static int mmap_per_cpu(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops, struct perf_mmap_param *mp) { @@ -528,6 +573,8 @@ int nr_mmaps = 0; int cpu, thread; + pr_debug("%s: nr cpu values %d nr threads %d\n", __func__, nr_cpus, nr_threads); + for (cpu = 0; cpu < nr_cpus; cpu++) { int output = -1; int output_overwrite = -1; @@ -569,6 +616,7 @@ struct perf_evlist_mmap_ops *ops, struct perf_mmap_param *mp) { + const struct perf_cpu_map *cpus = evlist->all_cpus; struct perf_evsel *evsel; if (!ops || !ops->get || !ops->mmap) @@ -588,6 +636,9 @@ if (evlist->pollfd.entries == NULL && perf_evlist__alloc_pollfd(evlist) < 0) return -ENOMEM; + if (perf_cpu_map__empty(cpus)) + return mmap_per_thread(evlist, ops, mp); + return mmap_per_cpu(evlist, ops, mp); } diff -Nru linux-aws-5.19.0/tools/objtool/check.c linux-aws-5.19.0/tools/objtool/check.c --- linux-aws-5.19.0/tools/objtool/check.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/objtool/check.c 2022-11-29 07:06:46.000000000 +0000 @@ -162,32 +162,34 @@ /* * Unfortunately these have to be hard coded because the noreturn - * attribute isn't provided in ELF data. + * attribute isn't provided in ELF data. Keep 'em sorted. */ static const char * const global_noreturns[] = { + "__invalid_creds", + "__module_put_and_kthread_exit", + "__reiserfs_panic", "__stack_chk_fail", - "panic", + "__ubsan_handle_builtin_unreachable", + "cpu_bringup_and_idle", + "cpu_startup_entry", "do_exit", + "do_group_exit", "do_task_dead", - "kthread_exit", - "make_task_dead", - "__module_put_and_kthread_exit", + "ex_handler_msr_mce", + "fortify_panic", "kthread_complete_and_exit", - "__reiserfs_panic", + "kthread_exit", + "kunit_try_catch_throw", "lbug_with_loc", - "fortify_panic", - "usercopy_abort", "machine_real_restart", + "make_task_dead", + "panic", "rewind_stack_and_make_dead", - "kunit_try_catch_throw", - "xen_start_kernel", - "cpu_bringup_and_idle", - "do_group_exit", + "sev_es_terminate", + "snp_abort", "stop_this_cpu", - "__invalid_creds", - "cpu_startup_entry", - "__ubsan_handle_builtin_unreachable", - "ex_handler_msr_mce", + "usercopy_abort", + "xen_start_kernel", }; if (!func) diff -Nru linux-aws-5.19.0/tools/objtool/elf.c linux-aws-5.19.0/tools/objtool/elf.c --- linux-aws-5.19.0/tools/objtool/elf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/objtool/elf.c 2022-11-29 07:06:46.000000000 +0000 @@ -619,6 +619,11 @@ Elf64_Xword entsize = symtab->sh.sh_entsize; int max_idx, idx = sym->idx; Elf_Scn *s, *t = NULL; + bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && + sym->sym.st_shndx != SHN_XINDEX; + + if (is_special_shndx) + shndx = sym->sym.st_shndx; s = elf_getscn(elf->elf, symtab->idx); if (!s) { @@ -704,7 +709,7 @@ } /* setup extended section index magic and write the symbol */ - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { + if ((shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) || is_special_shndx) { sym->sym.st_shndx = shndx; if (!shndx_data) shndx = 0; diff -Nru linux-aws-5.19.0/tools/perf/arch/x86/util/evlist.c linux-aws-5.19.0/tools/perf/arch/x86/util/evlist.c --- linux-aws-5.19.0/tools/perf/arch/x86/util/evlist.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/arch/x86/util/evlist.c 2022-11-29 07:06:46.000000000 +0000 @@ -8,8 +8,13 @@ #define TOPDOWN_L1_EVENTS "{slots,topdown-retiring,topdown-bad-spec,topdown-fe-bound,topdown-be-bound}" #define TOPDOWN_L2_EVENTS "{slots,topdown-retiring,topdown-bad-spec,topdown-fe-bound,topdown-be-bound,topdown-heavy-ops,topdown-br-mispredict,topdown-fetch-lat,topdown-mem-bound}" -int arch_evlist__add_default_attrs(struct evlist *evlist) +int arch_evlist__add_default_attrs(struct evlist *evlist, + struct perf_event_attr *attrs, + size_t nr_attrs) { + if (nr_attrs) + return __evlist__add_default_attrs(evlist, attrs, nr_attrs); + if (!pmu_have_event("cpu", "slots")) return 0; diff -Nru linux-aws-5.19.0/tools/perf/arch/x86/util/intel-pt.c linux-aws-5.19.0/tools/perf/arch/x86/util/intel-pt.c --- linux-aws-5.19.0/tools/perf/arch/x86/util/intel-pt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/arch/x86/util/intel-pt.c 2022-11-29 07:06:46.000000000 +0000 @@ -871,7 +871,7 @@ * User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel = evlist__add_aux_dummy(evlist, need_system_wide_tracking); diff -Nru linux-aws-5.19.0/tools/perf/builtin-list.c linux-aws-5.19.0/tools/perf/builtin-list.c --- linux-aws-5.19.0/tools/perf/builtin-list.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-list.c 2022-11-29 07:06:46.000000000 +0000 @@ -10,7 +10,7 @@ */ #include "builtin.h" -#include "util/parse-events.h" +#include "util/print-events.h" #include "util/pmu.h" #include "util/pmu-hybrid.h" #include "util/debug.h" diff -Nru linux-aws-5.19.0/tools/perf/builtin-lock.c linux-aws-5.19.0/tools/perf/builtin-lock.c --- linux-aws-5.19.0/tools/perf/builtin-lock.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-lock.c 2022-11-29 07:06:46.000000000 +0000 @@ -13,6 +13,7 @@ #include #include #include "util/trace-event.h" +#include "util/tracepoint.h" #include "util/debug.h" #include "util/session.h" diff -Nru linux-aws-5.19.0/tools/perf/builtin-record.c linux-aws-5.19.0/tools/perf/builtin-record.c --- linux-aws-5.19.0/tools/perf/builtin-record.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-record.c 2022-11-29 07:06:46.000000000 +0000 @@ -1892,14 +1892,18 @@ err = perf_event__synthesize_bpf_events(session, process_synthesized_event, machine, opts); - if (err < 0) + if (err < 0) { pr_warning("Couldn't synthesize bpf events.\n"); + err = 0; + } if (rec->opts.synth & PERF_SYNTH_CGROUP) { err = perf_event__synthesize_cgroups(tool, process_synthesized_event, machine); - if (err < 0) + if (err < 0) { pr_warning("Couldn't synthesize cgroup events.\n"); + err = 0; + } } if (rec->opts.nr_threads_synthesize > 1) { @@ -3331,16 +3335,24 @@ struct option *record_options = __record_options; -static void record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_cpu_map *cpus) +static int record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_cpu_map *cpus) { struct perf_cpu cpu; int idx; if (cpu_map__is_dummy(cpus)) - return; + return 0; - perf_cpu_map__for_each_cpu(cpu, idx, cpus) + perf_cpu_map__for_each_cpu(cpu, idx, cpus) { + if (cpu.cpu == -1) + continue; + /* Return ENODEV is input cpu is greater than max cpu */ + if ((unsigned long)cpu.cpu > mask->nbits) + return -ENODEV; set_bit(cpu.cpu, mask->bits); + } + + return 0; } static int record__mmap_cpu_mask_init_spec(struct mmap_cpu_mask *mask, const char *mask_spec) @@ -3352,7 +3364,9 @@ return -ENOMEM; bitmap_zero(mask->bits, mask->nbits); - record__mmap_cpu_mask_init(mask, cpus); + if (record__mmap_cpu_mask_init(mask, cpus)) + return -ENODEV; + perf_cpu_map__put(cpus); return 0; @@ -3434,7 +3448,12 @@ pr_err("Failed to allocate CPUs mask\n"); return ret; } - record__mmap_cpu_mask_init(&cpus_mask, cpus); + + ret = record__mmap_cpu_mask_init(&cpus_mask, cpus); + if (ret) { + pr_err("Failed to init cpu mask\n"); + goto out_free_cpu_mask; + } ret = record__thread_mask_alloc(&full_mask, cpu__max_cpu().cpu); if (ret) { @@ -3675,7 +3694,8 @@ if (ret) return ret; - record__mmap_cpu_mask_init(&rec->thread_masks->maps, cpus); + if (record__mmap_cpu_mask_init(&rec->thread_masks->maps, cpus)) + return -ENODEV; rec->nr_threads = 1; diff -Nru linux-aws-5.19.0/tools/perf/builtin-script.c linux-aws-5.19.0/tools/perf/builtin-script.c --- linux-aws-5.19.0/tools/perf/builtin-script.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-script.c 2022-11-29 07:06:46.000000000 +0000 @@ -441,6 +441,9 @@ struct perf_event_attr *attr = &evsel->core.attr; bool allow_user_set; + if (evsel__is_dummy_event(evsel)) + return 0; + if (perf_header__has_feat(&session->header, HEADER_STAT)) return 0; diff -Nru linux-aws-5.19.0/tools/perf/builtin-stat.c linux-aws-5.19.0/tools/perf/builtin-stat.c --- linux-aws-5.19.0/tools/perf/builtin-stat.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-stat.c 2022-11-29 07:06:46.000000000 +0000 @@ -1778,6 +1778,9 @@ (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16) }, }; + + struct perf_event_attr default_null_attrs[] = {}; + /* Set attrs if no event is selected and !null_run: */ if (stat_config.null_run) return 0; @@ -1941,6 +1944,9 @@ free(str); } + if (!stat_config.topdown_level) + stat_config.topdown_level = TOPDOWN_MAX_LEVEL; + if (!evsel_list->core.nr_entries) { if (target__has_cpu(&target)) default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK; @@ -1957,9 +1963,8 @@ } if (evlist__add_default_attrs(evsel_list, default_attrs1) < 0) return -1; - - stat_config.topdown_level = TOPDOWN_MAX_LEVEL; - if (arch_evlist__add_default_attrs(evsel_list) < 0) + /* Platform specific attrs */ + if (evlist__add_default_attrs(evsel_list, default_null_attrs) < 0) return -1; } diff -Nru linux-aws-5.19.0/tools/perf/builtin-timechart.c linux-aws-5.19.0/tools/perf/builtin-timechart.c --- linux-aws-5.19.0/tools/perf/builtin-timechart.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-timechart.c 2022-11-29 07:06:46.000000000 +0000 @@ -36,6 +36,7 @@ #include "util/data.h" #include "util/debug.h" #include "util/string2.h" +#include "util/tracepoint.h" #include #ifdef LACKS_OPEN_MEMSTREAM_PROTOTYPE diff -Nru linux-aws-5.19.0/tools/perf/builtin-trace.c linux-aws-5.19.0/tools/perf/builtin-trace.c --- linux-aws-5.19.0/tools/perf/builtin-trace.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/builtin-trace.c 2022-11-29 07:06:46.000000000 +0000 @@ -53,6 +53,7 @@ #include "trace-event.h" #include "util/parse-events.h" #include "util/bpf-loader.h" +#include "util/tracepoint.h" #include "callchain.h" #include "print_binary.h" #include "string2.h" diff -Nru linux-aws-5.19.0/tools/perf/dlfilters/dlfilter-show-cycles.c linux-aws-5.19.0/tools/perf/dlfilters/dlfilter-show-cycles.c --- linux-aws-5.19.0/tools/perf/dlfilters/dlfilter-show-cycles.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/dlfilters/dlfilter-show-cycles.c 2022-11-29 07:06:46.000000000 +0000 @@ -98,9 +98,9 @@ static void print_vals(__u64 cycles, __u64 delta) { if (delta) - printf("%10llu %10llu ", cycles, delta); + printf("%10llu %10llu ", (unsigned long long)cycles, (unsigned long long)delta); else - printf("%10llu %10s ", cycles, ""); + printf("%10llu %10s ", (unsigned long long)cycles, ""); } int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx) diff -Nru linux-aws-5.19.0/tools/perf/tests/perf-record.c linux-aws-5.19.0/tools/perf/tests/perf-record.c --- linux-aws-5.19.0/tools/perf/tests/perf-record.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/tests/perf-record.c 2022-11-29 07:06:46.000000000 +0000 @@ -332,7 +332,7 @@ out: if (err == -EACCES) return TEST_SKIP; - if (err < 0) + if (err < 0 || errs != 0) return TEST_FAIL; return TEST_OK; } diff -Nru linux-aws-5.19.0/tools/perf/tests/shell/record.sh linux-aws-5.19.0/tools/perf/tests/shell/record.sh --- linux-aws-5.19.0/tools/perf/tests/shell/record.sh 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/tests/shell/record.sh 2022-11-29 07:06:46.000000000 +0000 @@ -61,7 +61,7 @@ echo "Register capture test [Skipped missing registers]" return fi - if ! perf record -o - --intr-regs=di,r8,dx,cx -e cpu/br_inst_retired.near_call/p \ + if ! perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p \ -c 1000 --per-thread true 2> /dev/null \ | perf script -F ip,sym,iregs -i - 2> /dev/null \ | egrep -q "DI:" diff -Nru linux-aws-5.19.0/tools/perf/util/bpf_counter_cgroup.c linux-aws-5.19.0/tools/perf/util/bpf_counter_cgroup.c --- linux-aws-5.19.0/tools/perf/util/bpf_counter_cgroup.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/bpf_counter_cgroup.c 2022-11-29 07:06:46.000000000 +0000 @@ -95,7 +95,7 @@ perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) { link = bpf_program__attach_perf_event(skel->progs.on_cgrp_switch, - FD(cgrp_switch, cpu.cpu)); + FD(cgrp_switch, i)); if (IS_ERR(link)) { pr_err("Failed to attach cgroup program\n"); err = PTR_ERR(link); @@ -123,7 +123,7 @@ map_fd = bpf_map__fd(skel->maps.events); perf_cpu_map__for_each_cpu(cpu, j, evlist->core.all_cpus) { - int fd = FD(evsel, cpu.cpu); + int fd = FD(evsel, j); __u32 idx = evsel->core.idx * total_cpus + cpu.cpu; err = bpf_map_update_elem(map_fd, &idx, &fd, diff -Nru linux-aws-5.19.0/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c linux-aws-5.19.0/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c --- linux-aws-5.19.0/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/bpf_skel/bperf_cgroup.bpf.c 2022-11-29 07:06:46.000000000 +0000 @@ -176,7 +176,7 @@ } // This will be attached to cgroup-switches event for each cpu -SEC("perf_events") +SEC("perf_event") int BPF_PROG(on_cgrp_switch) { return bperf_cgroup_count(); diff -Nru linux-aws-5.19.0/tools/perf/util/Build linux-aws-5.19.0/tools/perf/util/Build --- linux-aws-5.19.0/tools/perf/util/Build 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/Build 2022-11-29 07:06:46.000000000 +0000 @@ -26,6 +26,8 @@ perf-y += memswap.o perf-y += parse-events.o perf-y += parse-events-hybrid.o +perf-y += print-events.o +perf-y += tracepoint.o perf-y += perf_regs.o perf-y += path.o perf-y += print_binary.o diff -Nru linux-aws-5.19.0/tools/perf/util/evlist.c linux-aws-5.19.0/tools/perf/util/evlist.c --- linux-aws-5.19.0/tools/perf/util/evlist.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/evlist.c 2022-11-29 07:06:46.000000000 +0000 @@ -342,9 +342,14 @@ return evlist__add_attrs(evlist, attrs, nr_attrs); } -__weak int arch_evlist__add_default_attrs(struct evlist *evlist __maybe_unused) +__weak int arch_evlist__add_default_attrs(struct evlist *evlist, + struct perf_event_attr *attrs, + size_t nr_attrs) { - return 0; + if (!nr_attrs) + return 0; + + return __evlist__add_default_attrs(evlist, attrs, nr_attrs); } struct evsel *evlist__find_tracepoint_by_id(struct evlist *evlist, int id) diff -Nru linux-aws-5.19.0/tools/perf/util/evlist.h linux-aws-5.19.0/tools/perf/util/evlist.h --- linux-aws-5.19.0/tools/perf/util/evlist.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/evlist.h 2022-11-29 07:06:46.000000000 +0000 @@ -107,10 +107,13 @@ int __evlist__add_default_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs); +int arch_evlist__add_default_attrs(struct evlist *evlist, + struct perf_event_attr *attrs, + size_t nr_attrs); + #define evlist__add_default_attrs(evlist, array) \ - __evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) + arch_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) -int arch_evlist__add_default_attrs(struct evlist *evlist); struct evsel *arch_evlist__leader(struct list_head *list); int evlist__add_dummy(struct evlist *evlist); diff -Nru linux-aws-5.19.0/tools/perf/util/genelf.c linux-aws-5.19.0/tools/perf/util/genelf.c --- linux-aws-5.19.0/tools/perf/util/genelf.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/genelf.c 2022-11-29 07:06:46.000000000 +0000 @@ -251,6 +251,7 @@ Elf_Data *d; Elf_Scn *scn; Elf_Ehdr *ehdr; + Elf_Phdr *phdr; Elf_Shdr *shdr; uint64_t eh_frame_base_offset; char *strsym = NULL; @@ -286,6 +287,19 @@ ehdr->e_shstrndx= unwinding ? 4 : 2; /* shdr index for section name */ /* + * setup program header + */ + phdr = elf_newphdr(e, 1); + phdr[0].p_type = PT_LOAD; + phdr[0].p_offset = 0; + phdr[0].p_vaddr = 0; + phdr[0].p_paddr = 0; + phdr[0].p_filesz = csize; + phdr[0].p_memsz = csize; + phdr[0].p_flags = PF_X | PF_R; + phdr[0].p_align = 8; + + /* * setup text section */ scn = elf_newscn(e); diff -Nru linux-aws-5.19.0/tools/perf/util/genelf.h linux-aws-5.19.0/tools/perf/util/genelf.h --- linux-aws-5.19.0/tools/perf/util/genelf.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/genelf.h 2022-11-29 07:06:46.000000000 +0000 @@ -53,8 +53,10 @@ #if GEN_ELF_CLASS == ELFCLASS64 #define elf_newehdr elf64_newehdr +#define elf_newphdr elf64_newphdr #define elf_getshdr elf64_getshdr #define Elf_Ehdr Elf64_Ehdr +#define Elf_Phdr Elf64_Phdr #define Elf_Shdr Elf64_Shdr #define Elf_Sym Elf64_Sym #define ELF_ST_TYPE(a) ELF64_ST_TYPE(a) @@ -62,8 +64,10 @@ #define ELF_ST_VIS(a) ELF64_ST_VISIBILITY(a) #else #define elf_newehdr elf32_newehdr +#define elf_newphdr elf32_newphdr #define elf_getshdr elf32_getshdr #define Elf_Ehdr Elf32_Ehdr +#define Elf_Phdr Elf32_Phdr #define Elf_Shdr Elf32_Shdr #define Elf_Sym Elf32_Sym #define ELF_ST_TYPE(a) ELF32_ST_TYPE(a) diff -Nru linux-aws-5.19.0/tools/perf/util/intel-pt.c linux-aws-5.19.0/tools/perf/util/intel-pt.c --- linux-aws-5.19.0/tools/perf/util/intel-pt.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/intel-pt.c 2022-11-29 07:06:46.000000000 +0000 @@ -3878,6 +3878,7 @@ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", @@ -3892,8 +3893,12 @@ if (!dump_trace) return; - for (i = start; i <= finish; i++) - fprintf(stdout, intel_pt_info_fmts[i], arr[i]); + for (i = start; i <= finish; i++) { + const char *fmt = intel_pt_info_fmts[i]; + + if (fmt) + fprintf(stdout, fmt, arr[i]); + } } static void intel_pt_print_info_str(const char *name, const char *str) diff -Nru linux-aws-5.19.0/tools/perf/util/parse-events.c linux-aws-5.19.0/tools/perf/util/parse-events.c --- linux-aws-5.19.0/tools/perf/util/parse-events.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/parse-events.c 2022-11-29 07:06:46.000000000 +0000 @@ -5,18 +5,12 @@ #include #include #include -#include -#include -#include #include #include "term.h" -#include "build-id.h" #include "evlist.h" #include "evsel.h" -#include #include #include "parse-events.h" -#include #include "string2.h" #include "strlist.h" #include "bpf-loader.h" @@ -27,20 +21,23 @@ #define YY_EXTRA_TYPE void* #include "parse-events-flex.h" #include "pmu.h" -#include "thread_map.h" -#include "probe-file.h" #include "asm/bug.h" #include "util/parse-branch-options.h" -#include "metricgroup.h" #include "util/evsel_config.h" #include "util/event.h" -#include "util/pfm.h" +#include "perf.h" #include "util/parse-events-hybrid.h" #include "util/pmu-hybrid.h" -#include "perf.h" +#include "tracepoint.h" +#include "thread_map.h" #define MAX_NAME_LEN 100 +struct perf_pmu_event_symbol { + char *symbol; + enum perf_pmu_event_symbol_type type; +}; + #ifdef PARSER_DEBUG extern int parse_events_debug; #endif @@ -154,21 +151,6 @@ }, }; -struct event_symbol event_symbols_tool[PERF_TOOL_MAX] = { - [PERF_TOOL_DURATION_TIME] = { - .symbol = "duration_time", - .alias = "", - }, - [PERF_TOOL_USER_TIME] = { - .symbol = "user_time", - .alias = "", - }, - [PERF_TOOL_SYSTEM_TIME] = { - .symbol = "system_time", - .alias = "", - }, -}; - #define __PERF_EVENT_FIELD(config, name) \ ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) @@ -177,119 +159,42 @@ #define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE) #define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT) -#define for_each_subsystem(sys_dir, sys_dirent) \ - while ((sys_dirent = readdir(sys_dir)) != NULL) \ - if (sys_dirent->d_type == DT_DIR && \ - (strcmp(sys_dirent->d_name, ".")) && \ - (strcmp(sys_dirent->d_name, ".."))) - -static int tp_event_has_id(const char *dir_path, struct dirent *evt_dir) -{ - char evt_path[MAXPATHLEN]; - int fd; - - snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, evt_dir->d_name); - fd = open(evt_path, O_RDONLY); - if (fd < 0) - return -EINVAL; - close(fd); - - return 0; -} - -#define for_each_event(dir_path, evt_dir, evt_dirent) \ - while ((evt_dirent = readdir(evt_dir)) != NULL) \ - if (evt_dirent->d_type == DT_DIR && \ - (strcmp(evt_dirent->d_name, ".")) && \ - (strcmp(evt_dirent->d_name, "..")) && \ - (!tp_event_has_id(dir_path, evt_dirent))) - -#define MAX_EVENT_LENGTH 512 - -struct tracepoint_path *tracepoint_id_to_path(u64 config) -{ - struct tracepoint_path *path = NULL; - DIR *sys_dir, *evt_dir; - struct dirent *sys_dirent, *evt_dirent; - char id_buf[24]; - int fd; - u64 id; - char evt_path[MAXPATHLEN]; - char *dir_path; - - sys_dir = tracing_events__opendir(); - if (!sys_dir) - return NULL; - - for_each_subsystem(sys_dir, sys_dirent) { - dir_path = get_events_file(sys_dirent->d_name); - if (!dir_path) - continue; - evt_dir = opendir(dir_path); - if (!evt_dir) - goto next; - - for_each_event(dir_path, evt_dir, evt_dirent) { - - scnprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, - evt_dirent->d_name); - fd = open(evt_path, O_RDONLY); - if (fd < 0) - continue; - if (read(fd, id_buf, sizeof(id_buf)) < 0) { - close(fd); - continue; - } - close(fd); - id = atoll(id_buf); - if (id == config) { - put_events_file(dir_path); - closedir(evt_dir); - closedir(sys_dir); - path = zalloc(sizeof(*path)); - if (!path) - return NULL; - if (asprintf(&path->system, "%.*s", MAX_EVENT_LENGTH, sys_dirent->d_name) < 0) { - free(path); - return NULL; - } - if (asprintf(&path->name, "%.*s", MAX_EVENT_LENGTH, evt_dirent->d_name) < 0) { - zfree(&path->system); - free(path); - return NULL; - } - return path; - } - } - closedir(evt_dir); -next: - put_events_file(dir_path); - } - - closedir(sys_dir); - return NULL; -} - -struct tracepoint_path *tracepoint_name_to_path(const char *name) +bool is_event_supported(u8 type, u64 config) { - struct tracepoint_path *path = zalloc(sizeof(*path)); - char *str = strchr(name, ':'); + bool ret = true; + int open_return; + struct evsel *evsel; + struct perf_event_attr attr = { + .type = type, + .config = config, + .disabled = 1, + }; + struct perf_thread_map *tmap = thread_map__new_by_tid(0); - if (path == NULL || str == NULL) { - free(path); - return NULL; - } + if (tmap == NULL) + return false; - path->system = strndup(name, str - name); - path->name = strdup(str+1); + evsel = evsel__new(&attr); + if (evsel) { + open_return = evsel__open(evsel, NULL, tmap); + ret = open_return >= 0; - if (path->system == NULL || path->name == NULL) { - zfree(&path->system); - zfree(&path->name); - zfree(&path); + if (open_return == -EACCES) { + /* + * This happens if the paranoid value + * /proc/sys/kernel/perf_event_paranoid is set to 2 + * Re-run with exclude_kernel set; we don't do that + * by default as some ARM machines do not support it. + * + */ + evsel->core.attr.exclude_kernel = 1; + ret = evsel__open(evsel, NULL, tmap) >= 0; + } + evsel__delete(evsel); } - return path; + perf_thread_map__put(tmap); + return ret; } const char *event_type(int type) @@ -350,6 +255,9 @@ struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : cpu_list ? perf_cpu_map__new(cpu_list) : NULL; + if (pmu) + perf_pmu__warn_invalid_formats(pmu); + if (pmu && attr->type == PERF_TYPE_RAW) perf_pmu__warn_invalid_config(pmu, attr->config, name); @@ -2674,571 +2582,6 @@ NULL); } -static const char * const event_type_descriptors[] = { - "Hardware event", - "Software event", - "Tracepoint event", - "Hardware cache event", - "Raw hardware event descriptor", - "Hardware breakpoint", -}; - -static int cmp_string(const void *a, const void *b) -{ - const char * const *as = a; - const char * const *bs = b; - - return strcmp(*as, *bs); -} - -/* - * Print the events from /tracing/events - */ - -void print_tracepoint_events(const char *subsys_glob, const char *event_glob, - bool name_only) -{ - DIR *sys_dir, *evt_dir; - struct dirent *sys_dirent, *evt_dirent; - char evt_path[MAXPATHLEN]; - char *dir_path; - char **evt_list = NULL; - unsigned int evt_i = 0, evt_num = 0; - bool evt_num_known = false; - -restart: - sys_dir = tracing_events__opendir(); - if (!sys_dir) - return; - - if (evt_num_known) { - evt_list = zalloc(sizeof(char *) * evt_num); - if (!evt_list) - goto out_close_sys_dir; - } - - for_each_subsystem(sys_dir, sys_dirent) { - if (subsys_glob != NULL && - !strglobmatch(sys_dirent->d_name, subsys_glob)) - continue; - - dir_path = get_events_file(sys_dirent->d_name); - if (!dir_path) - continue; - evt_dir = opendir(dir_path); - if (!evt_dir) - goto next; - - for_each_event(dir_path, evt_dir, evt_dirent) { - if (event_glob != NULL && - !strglobmatch(evt_dirent->d_name, event_glob)) - continue; - - if (!evt_num_known) { - evt_num++; - continue; - } - - snprintf(evt_path, MAXPATHLEN, "%s:%s", - sys_dirent->d_name, evt_dirent->d_name); - - evt_list[evt_i] = strdup(evt_path); - if (evt_list[evt_i] == NULL) { - put_events_file(dir_path); - goto out_close_evt_dir; - } - evt_i++; - } - closedir(evt_dir); -next: - put_events_file(dir_path); - } - closedir(sys_dir); - - if (!evt_num_known) { - evt_num_known = true; - goto restart; - } - qsort(evt_list, evt_num, sizeof(char *), cmp_string); - evt_i = 0; - while (evt_i < evt_num) { - if (name_only) { - printf("%s ", evt_list[evt_i++]); - continue; - } - printf(" %-50s [%s]\n", evt_list[evt_i++], - event_type_descriptors[PERF_TYPE_TRACEPOINT]); - } - if (evt_num && pager_in_use()) - printf("\n"); - -out_free: - evt_num = evt_i; - for (evt_i = 0; evt_i < evt_num; evt_i++) - zfree(&evt_list[evt_i]); - zfree(&evt_list); - return; - -out_close_evt_dir: - closedir(evt_dir); -out_close_sys_dir: - closedir(sys_dir); - - printf("FATAL: not enough memory to print %s\n", - event_type_descriptors[PERF_TYPE_TRACEPOINT]); - if (evt_list) - goto out_free; -} - -/* - * Check whether event is in /tracing/events - */ - -int is_valid_tracepoint(const char *event_string) -{ - DIR *sys_dir, *evt_dir; - struct dirent *sys_dirent, *evt_dirent; - char evt_path[MAXPATHLEN]; - char *dir_path; - - sys_dir = tracing_events__opendir(); - if (!sys_dir) - return 0; - - for_each_subsystem(sys_dir, sys_dirent) { - dir_path = get_events_file(sys_dirent->d_name); - if (!dir_path) - continue; - evt_dir = opendir(dir_path); - if (!evt_dir) - goto next; - - for_each_event(dir_path, evt_dir, evt_dirent) { - snprintf(evt_path, MAXPATHLEN, "%s:%s", - sys_dirent->d_name, evt_dirent->d_name); - if (!strcmp(evt_path, event_string)) { - closedir(evt_dir); - closedir(sys_dir); - return 1; - } - } - closedir(evt_dir); -next: - put_events_file(dir_path); - } - closedir(sys_dir); - return 0; -} - -static bool is_event_supported(u8 type, u64 config) -{ - bool ret = true; - int open_return; - struct evsel *evsel; - struct perf_event_attr attr = { - .type = type, - .config = config, - .disabled = 1, - }; - struct perf_thread_map *tmap = thread_map__new_by_tid(0); - - if (tmap == NULL) - return false; - - evsel = evsel__new(&attr); - if (evsel) { - open_return = evsel__open(evsel, NULL, tmap); - ret = open_return >= 0; - - if (open_return == -EACCES) { - /* - * This happens if the paranoid value - * /proc/sys/kernel/perf_event_paranoid is set to 2 - * Re-run with exclude_kernel set; we don't do that - * by default as some ARM machines do not support it. - * - */ - evsel->core.attr.exclude_kernel = 1; - ret = evsel__open(evsel, NULL, tmap) >= 0; - } - evsel__delete(evsel); - } - - perf_thread_map__put(tmap); - return ret; -} - -void print_sdt_events(const char *subsys_glob, const char *event_glob, - bool name_only) -{ - struct probe_cache *pcache; - struct probe_cache_entry *ent; - struct strlist *bidlist, *sdtlist; - struct strlist_config cfg = {.dont_dupstr = true}; - struct str_node *nd, *nd2; - char *buf, *path, *ptr = NULL; - bool show_detail = false; - int ret; - - sdtlist = strlist__new(NULL, &cfg); - if (!sdtlist) { - pr_debug("Failed to allocate new strlist for SDT\n"); - return; - } - bidlist = build_id_cache__list_all(true); - if (!bidlist) { - pr_debug("Failed to get buildids: %d\n", errno); - return; - } - strlist__for_each_entry(nd, bidlist) { - pcache = probe_cache__new(nd->s, NULL); - if (!pcache) - continue; - list_for_each_entry(ent, &pcache->entries, node) { - if (!ent->sdt) - continue; - if (subsys_glob && - !strglobmatch(ent->pev.group, subsys_glob)) - continue; - if (event_glob && - !strglobmatch(ent->pev.event, event_glob)) - continue; - ret = asprintf(&buf, "%s:%s@%s", ent->pev.group, - ent->pev.event, nd->s); - if (ret > 0) - strlist__add(sdtlist, buf); - } - probe_cache__delete(pcache); - } - strlist__delete(bidlist); - - strlist__for_each_entry(nd, sdtlist) { - buf = strchr(nd->s, '@'); - if (buf) - *(buf++) = '\0'; - if (name_only) { - printf("%s ", nd->s); - continue; - } - nd2 = strlist__next(nd); - if (nd2) { - ptr = strchr(nd2->s, '@'); - if (ptr) - *ptr = '\0'; - if (strcmp(nd->s, nd2->s) == 0) - show_detail = true; - } - if (show_detail) { - path = build_id_cache__origname(buf); - ret = asprintf(&buf, "%s@%s(%.12s)", nd->s, path, buf); - if (ret > 0) { - printf(" %-50s [%s]\n", buf, "SDT event"); - free(buf); - } - free(path); - } else - printf(" %-50s [%s]\n", nd->s, "SDT event"); - if (nd2) { - if (strcmp(nd->s, nd2->s) != 0) - show_detail = false; - if (ptr) - *ptr = '@'; - } - } - strlist__delete(sdtlist); -} - -int print_hwcache_events(const char *event_glob, bool name_only) -{ - unsigned int type, op, i, evt_i = 0, evt_num = 0, npmus = 0; - char name[64], new_name[128]; - char **evt_list = NULL, **evt_pmus = NULL; - bool evt_num_known = false; - struct perf_pmu *pmu = NULL; - - if (perf_pmu__has_hybrid()) { - npmus = perf_pmu__hybrid_pmu_num(); - evt_pmus = zalloc(sizeof(char *) * npmus); - if (!evt_pmus) - goto out_enomem; - } - -restart: - if (evt_num_known) { - evt_list = zalloc(sizeof(char *) * evt_num); - if (!evt_list) - goto out_enomem; - } - - for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { - for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { - /* skip invalid cache type */ - if (!evsel__is_cache_op_valid(type, op)) - continue; - - for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { - unsigned int hybrid_supported = 0, j; - bool supported; - - __evsel__hw_cache_type_op_res_name(type, op, i, name, sizeof(name)); - if (event_glob != NULL && !strglobmatch(name, event_glob)) - continue; - - if (!perf_pmu__has_hybrid()) { - if (!is_event_supported(PERF_TYPE_HW_CACHE, - type | (op << 8) | (i << 16))) { - continue; - } - } else { - perf_pmu__for_each_hybrid_pmu(pmu) { - if (!evt_num_known) { - evt_num++; - continue; - } - - supported = is_event_supported( - PERF_TYPE_HW_CACHE, - type | (op << 8) | (i << 16) | - ((__u64)pmu->type << PERF_PMU_TYPE_SHIFT)); - if (supported) { - snprintf(new_name, sizeof(new_name), "%s/%s/", - pmu->name, name); - evt_pmus[hybrid_supported] = strdup(new_name); - hybrid_supported++; - } - } - - if (hybrid_supported == 0) - continue; - } - - if (!evt_num_known) { - evt_num++; - continue; - } - - if ((hybrid_supported == 0) || - (hybrid_supported == npmus)) { - evt_list[evt_i] = strdup(name); - if (npmus > 0) { - for (j = 0; j < npmus; j++) - zfree(&evt_pmus[j]); - } - } else { - for (j = 0; j < hybrid_supported; j++) { - evt_list[evt_i++] = evt_pmus[j]; - evt_pmus[j] = NULL; - } - continue; - } - - if (evt_list[evt_i] == NULL) - goto out_enomem; - evt_i++; - } - } - } - - if (!evt_num_known) { - evt_num_known = true; - goto restart; - } - - for (evt_i = 0; evt_i < evt_num; evt_i++) { - if (!evt_list[evt_i]) - break; - } - - evt_num = evt_i; - qsort(evt_list, evt_num, sizeof(char *), cmp_string); - evt_i = 0; - while (evt_i < evt_num) { - if (name_only) { - printf("%s ", evt_list[evt_i++]); - continue; - } - printf(" %-50s [%s]\n", evt_list[evt_i++], - event_type_descriptors[PERF_TYPE_HW_CACHE]); - } - if (evt_num && pager_in_use()) - printf("\n"); - -out_free: - evt_num = evt_i; - for (evt_i = 0; evt_i < evt_num; evt_i++) - zfree(&evt_list[evt_i]); - zfree(&evt_list); - - for (evt_i = 0; evt_i < npmus; evt_i++) - zfree(&evt_pmus[evt_i]); - zfree(&evt_pmus); - return evt_num; - -out_enomem: - printf("FATAL: not enough memory to print %s\n", event_type_descriptors[PERF_TYPE_HW_CACHE]); - if (evt_list) - goto out_free; - return evt_num; -} - -static void print_tool_event(const struct event_symbol *syms, const char *event_glob, - bool name_only) -{ - if (syms->symbol == NULL) - return; - - if (event_glob && !(strglobmatch(syms->symbol, event_glob) || - (syms->alias && strglobmatch(syms->alias, event_glob)))) - return; - - if (name_only) - printf("%s ", syms->symbol); - else { - char name[MAX_NAME_LEN]; - if (syms->alias && strlen(syms->alias)) - snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); - else - strlcpy(name, syms->symbol, MAX_NAME_LEN); - printf(" %-50s [%s]\n", name, "Tool event"); - } -} - -void print_tool_events(const char *event_glob, bool name_only) -{ - // Start at 1 because the first enum entry symbols no tool event - for (int i = 1; i < PERF_TOOL_MAX; ++i) { - print_tool_event(event_symbols_tool + i, event_glob, name_only); - } - if (pager_in_use()) - printf("\n"); -} - -void print_symbol_events(const char *event_glob, unsigned type, - struct event_symbol *syms, unsigned max, - bool name_only) -{ - unsigned int i, evt_i = 0, evt_num = 0; - char name[MAX_NAME_LEN]; - char **evt_list = NULL; - bool evt_num_known = false; - -restart: - if (evt_num_known) { - evt_list = zalloc(sizeof(char *) * evt_num); - if (!evt_list) - goto out_enomem; - syms -= max; - } - - for (i = 0; i < max; i++, syms++) { - /* - * New attr.config still not supported here, the latest - * example was PERF_COUNT_SW_CGROUP_SWITCHES - */ - if (syms->symbol == NULL) - continue; - - if (event_glob != NULL && !(strglobmatch(syms->symbol, event_glob) || - (syms->alias && strglobmatch(syms->alias, event_glob)))) - continue; - - if (!is_event_supported(type, i)) - continue; - - if (!evt_num_known) { - evt_num++; - continue; - } - - if (!name_only && strlen(syms->alias)) - snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); - else - strlcpy(name, syms->symbol, MAX_NAME_LEN); - - evt_list[evt_i] = strdup(name); - if (evt_list[evt_i] == NULL) - goto out_enomem; - evt_i++; - } - - if (!evt_num_known) { - evt_num_known = true; - goto restart; - } - qsort(evt_list, evt_num, sizeof(char *), cmp_string); - evt_i = 0; - while (evt_i < evt_num) { - if (name_only) { - printf("%s ", evt_list[evt_i++]); - continue; - } - printf(" %-50s [%s]\n", evt_list[evt_i++], event_type_descriptors[type]); - } - if (evt_num && pager_in_use()) - printf("\n"); - -out_free: - evt_num = evt_i; - for (evt_i = 0; evt_i < evt_num; evt_i++) - zfree(&evt_list[evt_i]); - zfree(&evt_list); - return; - -out_enomem: - printf("FATAL: not enough memory to print %s\n", event_type_descriptors[type]); - if (evt_list) - goto out_free; -} - -/* - * Print the help text for the event symbols: - */ -void print_events(const char *event_glob, bool name_only, bool quiet_flag, - bool long_desc, bool details_flag, bool deprecated, - const char *pmu_name) -{ - print_symbol_events(event_glob, PERF_TYPE_HARDWARE, - event_symbols_hw, PERF_COUNT_HW_MAX, name_only); - - print_symbol_events(event_glob, PERF_TYPE_SOFTWARE, - event_symbols_sw, PERF_COUNT_SW_MAX, name_only); - print_tool_events(event_glob, name_only); - - print_hwcache_events(event_glob, name_only); - - print_pmu_events(event_glob, name_only, quiet_flag, long_desc, - details_flag, deprecated, pmu_name); - - if (event_glob != NULL) - return; - - if (!name_only) { - printf(" %-50s [%s]\n", - "rNNN", - event_type_descriptors[PERF_TYPE_RAW]); - printf(" %-50s [%s]\n", - "cpu/t1=v1[,t2=v2,t3 ...]/modifier", - event_type_descriptors[PERF_TYPE_RAW]); - if (pager_in_use()) - printf(" (see 'man perf-list' on how to encode it)\n\n"); - - printf(" %-50s [%s]\n", - "mem:[/len][:access]", - event_type_descriptors[PERF_TYPE_BREAKPOINT]); - if (pager_in_use()) - printf("\n"); - } - - print_tracepoint_events(NULL, NULL, name_only); - - print_sdt_events(NULL, NULL, name_only); - - metricgroup__print(true, true, NULL, name_only, details_flag, - pmu_name); - - print_libpfm_events(name_only, long_desc); -} - int parse_events__is_hardcoded_term(struct parse_events_term *term) { return term->type_term != PARSE_EVENTS__TERM_TYPE_USER; diff -Nru linux-aws-5.19.0/tools/perf/util/parse-events.h linux-aws-5.19.0/tools/perf/util/parse-events.h --- linux-aws-5.19.0/tools/perf/util/parse-events.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/parse-events.h 2022-11-29 07:06:46.000000000 +0000 @@ -11,7 +11,6 @@ #include #include -struct list_head; struct evsel; struct evlist; struct parse_events_error; @@ -19,15 +18,8 @@ struct option; struct perf_pmu; -struct tracepoint_path { - char *system; - char *name; - struct tracepoint_path *next; -}; - -struct tracepoint_path *tracepoint_id_to_path(u64 config); -struct tracepoint_path *tracepoint_name_to_path(const char *name); bool have_tracepoints(struct list_head *evlist); +bool is_event_supported(u8 type, u64 config); const char *event_type(int type); @@ -46,8 +38,6 @@ int parse_filter(const struct option *opt, const char *str, int unset); int exclude_perf(const struct option *opt, const char *arg, int unset); -#define EVENTS_HELP_MAX (128*1024) - enum perf_pmu_event_symbol_type { PMU_EVENT_SYMBOL_ERR, /* not a PMU EVENT */ PMU_EVENT_SYMBOL, /* normal style PMU event */ @@ -56,11 +46,6 @@ PMU_EVENT_SYMBOL_SUFFIX2, /* suffix of pre-suf2 style event */ }; -struct perf_pmu_event_symbol { - char *symbol; - enum perf_pmu_event_symbol_type type; -}; - enum { PARSE_EVENTS__TERM_TYPE_NUM, PARSE_EVENTS__TERM_TYPE_STR, @@ -219,28 +204,13 @@ void parse_events_evlist_error(struct parse_events_state *parse_state, int idx, const char *str); -void print_events(const char *event_glob, bool name_only, bool quiet, - bool long_desc, bool details_flag, bool deprecated, - const char *pmu_name); - struct event_symbol { const char *symbol; const char *alias; }; extern struct event_symbol event_symbols_hw[]; extern struct event_symbol event_symbols_sw[]; -void print_symbol_events(const char *event_glob, unsigned type, - struct event_symbol *syms, unsigned max, - bool name_only); -void print_tool_events(const char *event_glob, bool name_only); -void print_tracepoint_events(const char *subsys_glob, const char *event_glob, - bool name_only); -int print_hwcache_events(const char *event_glob, bool name_only); -void print_sdt_events(const char *subsys_glob, const char *event_glob, - bool name_only); -int is_valid_tracepoint(const char *event_string); -int valid_event_mount(const char *eventfs); char *parse_events_formats_error_string(char *additional_terms); void parse_events_error__init(struct parse_events_error *err); diff -Nru linux-aws-5.19.0/tools/perf/util/parse-events-hybrid.c linux-aws-5.19.0/tools/perf/util/parse-events-hybrid.c --- linux-aws-5.19.0/tools/perf/util/parse-events-hybrid.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/parse-events-hybrid.c 2022-11-29 07:06:46.000000000 +0000 @@ -33,7 +33,8 @@ * If the PMU type ID is 0, the PERF_TYPE_RAW will be applied. */ attr->type = type; - attr->config = attr->config | ((__u64)pmu_type << PERF_PMU_TYPE_SHIFT); + attr->config = (attr->config & PERF_HW_EVENT_MASK) | + ((__u64)pmu_type << PERF_PMU_TYPE_SHIFT); } static int create_event_hybrid(__u32 config_type, int *idx, @@ -48,13 +49,25 @@ __u64 config = attr->config; config_hybrid_attr(attr, config_type, pmu->type); + + /* + * Some hybrid hardware cache events are only available on one CPU + * PMU. For example, the 'L1-dcache-load-misses' is only available + * on cpu_core, while the 'L1-icache-loads' is only available on + * cpu_atom. We need to remove "not supported" hybrid cache events. + */ + if (attr->type == PERF_TYPE_HW_CACHE + && !is_event_supported(attr->type, attr->config)) + return 0; + evsel = parse_events__add_event_hybrid(list, idx, attr, name, metric_id, pmu, config_terms); - if (evsel) + if (evsel) { evsel->pmu_name = strdup(pmu->name); - else + if (!evsel->pmu_name) + return -ENOMEM; + } else return -ENOMEM; - attr->type = type; attr->config = config; return 0; diff -Nru linux-aws-5.19.0/tools/perf/util/pmu.c linux-aws-5.19.0/tools/perf/util/pmu.c --- linux-aws-5.19.0/tools/perf/util/pmu.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/pmu.c 2022-11-29 07:06:46.000000000 +0000 @@ -1048,6 +1048,23 @@ return NULL; } +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu) +{ + struct perf_pmu_format *format; + + /* fake pmu doesn't have format list */ + if (pmu == &perf_pmu__fake) + return; + + list_for_each_entry(format, &pmu->format, list) + if (format->value >= PERF_PMU_FORMAT_VALUE_CONFIG_END) { + pr_warning("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'" + "which is not supported by this version of perf!\n", + pmu->name, format->name, format->value); + return; + } +} + static struct perf_pmu *pmu_find(const char *name) { struct perf_pmu *pmu; diff -Nru linux-aws-5.19.0/tools/perf/util/pmu.h linux-aws-5.19.0/tools/perf/util/pmu.h --- linux-aws-5.19.0/tools/perf/util/pmu.h 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/pmu.h 2022-11-29 07:06:46.000000000 +0000 @@ -17,6 +17,7 @@ PERF_PMU_FORMAT_VALUE_CONFIG, PERF_PMU_FORMAT_VALUE_CONFIG1, PERF_PMU_FORMAT_VALUE_CONFIG2, + PERF_PMU_FORMAT_VALUE_CONFIG_END, }; #define PERF_PMU_FORMAT_BITS 64 @@ -139,6 +140,7 @@ void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, const char *name); +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu); bool perf_pmu__has_hybrid(void); int perf_pmu__match(char *pattern, char *name, char *tok); diff -Nru linux-aws-5.19.0/tools/perf/util/pmu.l linux-aws-5.19.0/tools/perf/util/pmu.l --- linux-aws-5.19.0/tools/perf/util/pmu.l 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/pmu.l 2022-11-29 07:06:46.000000000 +0000 @@ -27,8 +27,6 @@ {num_dec} { return value(10); } config { return PP_CONFIG; } -config1 { return PP_CONFIG1; } -config2 { return PP_CONFIG2; } - { return '-'; } : { return ':'; } , { return ','; } diff -Nru linux-aws-5.19.0/tools/perf/util/pmu.y linux-aws-5.19.0/tools/perf/util/pmu.y --- linux-aws-5.19.0/tools/perf/util/pmu.y 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/pmu.y 2022-11-29 07:06:46.000000000 +0000 @@ -20,7 +20,7 @@ %} -%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 +%token PP_CONFIG %token PP_VALUE PP_ERROR %type PP_VALUE %type bit_term @@ -47,18 +47,11 @@ $3)); } | -PP_CONFIG1 ':' bits +PP_CONFIG PP_VALUE ':' bits { ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG1, - $3)); -} -| -PP_CONFIG2 ':' bits -{ - ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG2, - $3)); + $2, + $4)); } bits: diff -Nru linux-aws-5.19.0/tools/perf/util/print-events.c linux-aws-5.19.0/tools/perf/util/print-events.c --- linux-aws-5.19.0/tools/perf/util/print-events.c 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/print-events.c 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,533 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "build-id.h" +#include "debug.h" +#include "evsel.h" +#include "metricgroup.h" +#include "parse-events.h" +#include "pmu.h" +#include "print-events.h" +#include "probe-file.h" +#include "string2.h" +#include "strlist.h" +#include "tracepoint.h" +#include "pfm.h" +#include "pmu-hybrid.h" + +#define MAX_NAME_LEN 100 + +static const char * const event_type_descriptors[] = { + "Hardware event", + "Software event", + "Tracepoint event", + "Hardware cache event", + "Raw hardware event descriptor", + "Hardware breakpoint", +}; + +static const struct event_symbol event_symbols_tool[PERF_TOOL_MAX] = { + [PERF_TOOL_DURATION_TIME] = { + .symbol = "duration_time", + .alias = "", + }, + [PERF_TOOL_USER_TIME] = { + .symbol = "user_time", + .alias = "", + }, + [PERF_TOOL_SYSTEM_TIME] = { + .symbol = "system_time", + .alias = "", + }, +}; + +static int cmp_string(const void *a, const void *b) +{ + const char * const *as = a; + const char * const *bs = b; + + return strcmp(*as, *bs); +} + +/* + * Print the events from /tracing/events + */ +void print_tracepoint_events(const char *subsys_glob, + const char *event_glob, bool name_only) +{ + DIR *sys_dir, *evt_dir; + struct dirent *sys_dirent, *evt_dirent; + char evt_path[MAXPATHLEN]; + char *dir_path; + char **evt_list = NULL; + unsigned int evt_i = 0, evt_num = 0; + bool evt_num_known = false; + +restart: + sys_dir = tracing_events__opendir(); + if (!sys_dir) + return; + + if (evt_num_known) { + evt_list = zalloc(sizeof(char *) * evt_num); + if (!evt_list) + goto out_close_sys_dir; + } + + for_each_subsystem(sys_dir, sys_dirent) { + if (subsys_glob != NULL && + !strglobmatch(sys_dirent->d_name, subsys_glob)) + continue; + + dir_path = get_events_file(sys_dirent->d_name); + if (!dir_path) + continue; + evt_dir = opendir(dir_path); + if (!evt_dir) + goto next; + + for_each_event(dir_path, evt_dir, evt_dirent) { + if (event_glob != NULL && + !strglobmatch(evt_dirent->d_name, event_glob)) + continue; + + if (!evt_num_known) { + evt_num++; + continue; + } + + snprintf(evt_path, MAXPATHLEN, "%s:%s", + sys_dirent->d_name, evt_dirent->d_name); + + evt_list[evt_i] = strdup(evt_path); + if (evt_list[evt_i] == NULL) { + put_events_file(dir_path); + goto out_close_evt_dir; + } + evt_i++; + } + closedir(evt_dir); +next: + put_events_file(dir_path); + } + closedir(sys_dir); + + if (!evt_num_known) { + evt_num_known = true; + goto restart; + } + qsort(evt_list, evt_num, sizeof(char *), cmp_string); + evt_i = 0; + while (evt_i < evt_num) { + if (name_only) { + printf("%s ", evt_list[evt_i++]); + continue; + } + printf(" %-50s [%s]\n", evt_list[evt_i++], + event_type_descriptors[PERF_TYPE_TRACEPOINT]); + } + if (evt_num && pager_in_use()) + printf("\n"); + +out_free: + evt_num = evt_i; + for (evt_i = 0; evt_i < evt_num; evt_i++) + zfree(&evt_list[evt_i]); + zfree(&evt_list); + return; + +out_close_evt_dir: + closedir(evt_dir); +out_close_sys_dir: + closedir(sys_dir); + + printf("FATAL: not enough memory to print %s\n", + event_type_descriptors[PERF_TYPE_TRACEPOINT]); + if (evt_list) + goto out_free; +} + +void print_sdt_events(const char *subsys_glob, const char *event_glob, + bool name_only) +{ + struct probe_cache *pcache; + struct probe_cache_entry *ent; + struct strlist *bidlist, *sdtlist; + struct strlist_config cfg = {.dont_dupstr = true}; + struct str_node *nd, *nd2; + char *buf, *path, *ptr = NULL; + bool show_detail = false; + int ret; + + sdtlist = strlist__new(NULL, &cfg); + if (!sdtlist) { + pr_debug("Failed to allocate new strlist for SDT\n"); + return; + } + bidlist = build_id_cache__list_all(true); + if (!bidlist) { + pr_debug("Failed to get buildids: %d\n", errno); + return; + } + strlist__for_each_entry(nd, bidlist) { + pcache = probe_cache__new(nd->s, NULL); + if (!pcache) + continue; + list_for_each_entry(ent, &pcache->entries, node) { + if (!ent->sdt) + continue; + if (subsys_glob && + !strglobmatch(ent->pev.group, subsys_glob)) + continue; + if (event_glob && + !strglobmatch(ent->pev.event, event_glob)) + continue; + ret = asprintf(&buf, "%s:%s@%s", ent->pev.group, + ent->pev.event, nd->s); + if (ret > 0) + strlist__add(sdtlist, buf); + } + probe_cache__delete(pcache); + } + strlist__delete(bidlist); + + strlist__for_each_entry(nd, sdtlist) { + buf = strchr(nd->s, '@'); + if (buf) + *(buf++) = '\0'; + if (name_only) { + printf("%s ", nd->s); + continue; + } + nd2 = strlist__next(nd); + if (nd2) { + ptr = strchr(nd2->s, '@'); + if (ptr) + *ptr = '\0'; + if (strcmp(nd->s, nd2->s) == 0) + show_detail = true; + } + if (show_detail) { + path = build_id_cache__origname(buf); + ret = asprintf(&buf, "%s@%s(%.12s)", nd->s, path, buf); + if (ret > 0) { + printf(" %-50s [%s]\n", buf, "SDT event"); + free(buf); + } + free(path); + } else + printf(" %-50s [%s]\n", nd->s, "SDT event"); + if (nd2) { + if (strcmp(nd->s, nd2->s) != 0) + show_detail = false; + if (ptr) + *ptr = '@'; + } + } + strlist__delete(sdtlist); +} + +int print_hwcache_events(const char *event_glob, bool name_only) +{ + unsigned int type, op, i, evt_i = 0, evt_num = 0, npmus = 0; + char name[64], new_name[128]; + char **evt_list = NULL, **evt_pmus = NULL; + bool evt_num_known = false; + struct perf_pmu *pmu = NULL; + + if (perf_pmu__has_hybrid()) { + npmus = perf_pmu__hybrid_pmu_num(); + evt_pmus = zalloc(sizeof(char *) * npmus); + if (!evt_pmus) + goto out_enomem; + } + +restart: + if (evt_num_known) { + evt_list = zalloc(sizeof(char *) * evt_num); + if (!evt_list) + goto out_enomem; + } + + for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { + for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { + /* skip invalid cache type */ + if (!evsel__is_cache_op_valid(type, op)) + continue; + + for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { + unsigned int hybrid_supported = 0, j; + bool supported; + + __evsel__hw_cache_type_op_res_name(type, op, i, name, sizeof(name)); + if (event_glob != NULL && !strglobmatch(name, event_glob)) + continue; + + if (!perf_pmu__has_hybrid()) { + if (!is_event_supported(PERF_TYPE_HW_CACHE, + type | (op << 8) | (i << 16))) { + continue; + } + } else { + perf_pmu__for_each_hybrid_pmu(pmu) { + if (!evt_num_known) { + evt_num++; + continue; + } + + supported = is_event_supported( + PERF_TYPE_HW_CACHE, + type | (op << 8) | (i << 16) | + ((__u64)pmu->type << PERF_PMU_TYPE_SHIFT)); + if (supported) { + snprintf(new_name, sizeof(new_name), + "%s/%s/", pmu->name, name); + evt_pmus[hybrid_supported] = + strdup(new_name); + hybrid_supported++; + } + } + + if (hybrid_supported == 0) + continue; + } + + if (!evt_num_known) { + evt_num++; + continue; + } + + if ((hybrid_supported == 0) || + (hybrid_supported == npmus)) { + evt_list[evt_i] = strdup(name); + if (npmus > 0) { + for (j = 0; j < npmus; j++) + zfree(&evt_pmus[j]); + } + } else { + for (j = 0; j < hybrid_supported; j++) { + evt_list[evt_i++] = evt_pmus[j]; + evt_pmus[j] = NULL; + } + continue; + } + + if (evt_list[evt_i] == NULL) + goto out_enomem; + evt_i++; + } + } + } + + if (!evt_num_known) { + evt_num_known = true; + goto restart; + } + + for (evt_i = 0; evt_i < evt_num; evt_i++) { + if (!evt_list[evt_i]) + break; + } + + evt_num = evt_i; + qsort(evt_list, evt_num, sizeof(char *), cmp_string); + evt_i = 0; + while (evt_i < evt_num) { + if (name_only) { + printf("%s ", evt_list[evt_i++]); + continue; + } + printf(" %-50s [%s]\n", evt_list[evt_i++], + event_type_descriptors[PERF_TYPE_HW_CACHE]); + } + if (evt_num && pager_in_use()) + printf("\n"); + +out_free: + evt_num = evt_i; + for (evt_i = 0; evt_i < evt_num; evt_i++) + zfree(&evt_list[evt_i]); + zfree(&evt_list); + + for (evt_i = 0; evt_i < npmus; evt_i++) + zfree(&evt_pmus[evt_i]); + zfree(&evt_pmus); + return evt_num; + +out_enomem: + printf("FATAL: not enough memory to print %s\n", + event_type_descriptors[PERF_TYPE_HW_CACHE]); + if (evt_list) + goto out_free; + return evt_num; +} + +static void print_tool_event(const struct event_symbol *syms, const char *event_glob, + bool name_only) +{ + if (syms->symbol == NULL) + return; + + if (event_glob && !(strglobmatch(syms->symbol, event_glob) || + (syms->alias && strglobmatch(syms->alias, event_glob)))) + return; + + if (name_only) + printf("%s ", syms->symbol); + else { + char name[MAX_NAME_LEN]; + + if (syms->alias && strlen(syms->alias)) + snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); + else + strlcpy(name, syms->symbol, MAX_NAME_LEN); + printf(" %-50s [%s]\n", name, "Tool event"); + } +} + +void print_tool_events(const char *event_glob, bool name_only) +{ + // Start at 1 because the first enum entry means no tool event. + for (int i = 1; i < PERF_TOOL_MAX; ++i) + print_tool_event(event_symbols_tool + i, event_glob, name_only); + + if (pager_in_use()) + printf("\n"); +} + +void print_symbol_events(const char *event_glob, unsigned int type, + struct event_symbol *syms, unsigned int max, + bool name_only) +{ + unsigned int i, evt_i = 0, evt_num = 0; + char name[MAX_NAME_LEN]; + char **evt_list = NULL; + bool evt_num_known = false; + +restart: + if (evt_num_known) { + evt_list = zalloc(sizeof(char *) * evt_num); + if (!evt_list) + goto out_enomem; + syms -= max; + } + + for (i = 0; i < max; i++, syms++) { + /* + * New attr.config still not supported here, the latest + * example was PERF_COUNT_SW_CGROUP_SWITCHES + */ + if (syms->symbol == NULL) + continue; + + if (event_glob != NULL && !(strglobmatch(syms->symbol, event_glob) || + (syms->alias && strglobmatch(syms->alias, event_glob)))) + continue; + + if (!is_event_supported(type, i)) + continue; + + if (!evt_num_known) { + evt_num++; + continue; + } + + if (!name_only && strlen(syms->alias)) + snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); + else + strlcpy(name, syms->symbol, MAX_NAME_LEN); + + evt_list[evt_i] = strdup(name); + if (evt_list[evt_i] == NULL) + goto out_enomem; + evt_i++; + } + + if (!evt_num_known) { + evt_num_known = true; + goto restart; + } + qsort(evt_list, evt_num, sizeof(char *), cmp_string); + evt_i = 0; + while (evt_i < evt_num) { + if (name_only) { + printf("%s ", evt_list[evt_i++]); + continue; + } + printf(" %-50s [%s]\n", evt_list[evt_i++], event_type_descriptors[type]); + } + if (evt_num && pager_in_use()) + printf("\n"); + +out_free: + evt_num = evt_i; + for (evt_i = 0; evt_i < evt_num; evt_i++) + zfree(&evt_list[evt_i]); + zfree(&evt_list); + return; + +out_enomem: + printf("FATAL: not enough memory to print %s\n", event_type_descriptors[type]); + if (evt_list) + goto out_free; +} + +/* + * Print the help text for the event symbols: + */ +void print_events(const char *event_glob, bool name_only, bool quiet_flag, + bool long_desc, bool details_flag, bool deprecated, + const char *pmu_name) +{ + print_symbol_events(event_glob, PERF_TYPE_HARDWARE, + event_symbols_hw, PERF_COUNT_HW_MAX, name_only); + + print_symbol_events(event_glob, PERF_TYPE_SOFTWARE, + event_symbols_sw, PERF_COUNT_SW_MAX, name_only); + print_tool_events(event_glob, name_only); + + print_hwcache_events(event_glob, name_only); + + print_pmu_events(event_glob, name_only, quiet_flag, long_desc, + details_flag, deprecated, pmu_name); + + if (event_glob != NULL) + return; + + if (!name_only) { + printf(" %-50s [%s]\n", + "rNNN", + event_type_descriptors[PERF_TYPE_RAW]); + printf(" %-50s [%s]\n", + "cpu/t1=v1[,t2=v2,t3 ...]/modifier", + event_type_descriptors[PERF_TYPE_RAW]); + if (pager_in_use()) + printf(" (see 'man perf-list' on how to encode it)\n\n"); + + printf(" %-50s [%s]\n", + "mem:[/len][:access]", + event_type_descriptors[PERF_TYPE_BREAKPOINT]); + if (pager_in_use()) + printf("\n"); + } + + print_tracepoint_events(NULL, NULL, name_only); + + print_sdt_events(NULL, NULL, name_only); + + metricgroup__print(true, true, NULL, name_only, details_flag, + pmu_name); + + print_libpfm_events(name_only, long_desc); +} diff -Nru linux-aws-5.19.0/tools/perf/util/print-events.h linux-aws-5.19.0/tools/perf/util/print-events.h --- linux-aws-5.19.0/tools/perf/util/print-events.h 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/print-events.h 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __PERF_PRINT_EVENTS_H +#define __PERF_PRINT_EVENTS_H + +#include + +struct event_symbol; + +void print_events(const char *event_glob, bool name_only, bool quiet_flag, + bool long_desc, bool details_flag, bool deprecated, + const char *pmu_name); +int print_hwcache_events(const char *event_glob, bool name_only); +void print_sdt_events(const char *subsys_glob, const char *event_glob, + bool name_only); +void print_symbol_events(const char *event_glob, unsigned int type, + struct event_symbol *syms, unsigned int max, + bool name_only); +void print_tool_events(const char *event_glob, bool name_only); +void print_tracepoint_events(const char *subsys_glob, const char *event_glob, + bool name_only); + +#endif /* __PERF_PRINT_EVENTS_H */ diff -Nru linux-aws-5.19.0/tools/perf/util/symbol-elf.c linux-aws-5.19.0/tools/perf/util/symbol-elf.c --- linux-aws-5.19.0/tools/perf/util/symbol-elf.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/symbol-elf.c 2022-11-29 07:06:46.000000000 +0000 @@ -2102,8 +2102,8 @@ * unusual. One significant peculiarity is that the mapping (start -> pgoff) * is not the same for the kernel map and the modules map. That happens because * the data is copied adjacently whereas the original kcore has gaps. Finally, - * kallsyms and modules files are compared with their copies to check that - * modules have not been loaded or unloaded while the copies were taking place. + * kallsyms file is compared with its copy to check that modules have not been + * loaded or unloaded while the copies were taking place. * * Return: %0 on success, %-1 on failure. */ @@ -2166,9 +2166,6 @@ goto out_extract_close; } - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) - goto out_extract_close; - if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) goto out_extract_close; diff -Nru linux-aws-5.19.0/tools/perf/util/synthetic-events.c linux-aws-5.19.0/tools/perf/util/synthetic-events.c --- linux-aws-5.19.0/tools/perf/util/synthetic-events.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/synthetic-events.c 2022-11-29 07:06:46.000000000 +0000 @@ -367,13 +367,24 @@ bool is_kernel) { struct build_id bid; + struct nsinfo *nsi; + struct nscookie nc; int rc; - if (is_kernel) + if (is_kernel) { rc = sysfs__read_build_id("/sys/kernel/notes", &bid); - else - rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; + goto out; + } + nsi = nsinfo__new(event->pid); + nsinfo__mountns_enter(nsi, &nc); + + rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; + + nsinfo__mountns_exit(&nc); + nsinfo__put(nsi); + +out: if (rc == 0) { memcpy(event->build_id, bid.data, sizeof(bid.data)); event->build_id_size = (u8) bid.size; diff -Nru linux-aws-5.19.0/tools/perf/util/trace-event-info.c linux-aws-5.19.0/tools/perf/util/trace-event-info.c --- linux-aws-5.19.0/tools/perf/util/trace-event-info.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/trace-event-info.c 2022-11-29 07:06:46.000000000 +0000 @@ -19,16 +19,24 @@ #include #include #include // page_size +#include #include "trace-event.h" +#include "tracepoint.h" #include #include "evsel.h" #include "debug.h" #define VERSION "0.6" +#define MAX_EVENT_LENGTH 512 static int output_fd; +struct tracepoint_path { + char *system; + char *name; + struct tracepoint_path *next; +}; int bigendian(void) { @@ -400,6 +408,94 @@ } } +static struct tracepoint_path *tracepoint_id_to_path(u64 config) +{ + struct tracepoint_path *path = NULL; + DIR *sys_dir, *evt_dir; + struct dirent *sys_dirent, *evt_dirent; + char id_buf[24]; + int fd; + u64 id; + char evt_path[MAXPATHLEN]; + char *dir_path; + + sys_dir = tracing_events__opendir(); + if (!sys_dir) + return NULL; + + for_each_subsystem(sys_dir, sys_dirent) { + dir_path = get_events_file(sys_dirent->d_name); + if (!dir_path) + continue; + evt_dir = opendir(dir_path); + if (!evt_dir) + goto next; + + for_each_event(dir_path, evt_dir, evt_dirent) { + + scnprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, + evt_dirent->d_name); + fd = open(evt_path, O_RDONLY); + if (fd < 0) + continue; + if (read(fd, id_buf, sizeof(id_buf)) < 0) { + close(fd); + continue; + } + close(fd); + id = atoll(id_buf); + if (id == config) { + put_events_file(dir_path); + closedir(evt_dir); + closedir(sys_dir); + path = zalloc(sizeof(*path)); + if (!path) + return NULL; + if (asprintf(&path->system, "%.*s", + MAX_EVENT_LENGTH, sys_dirent->d_name) < 0) { + free(path); + return NULL; + } + if (asprintf(&path->name, "%.*s", + MAX_EVENT_LENGTH, evt_dirent->d_name) < 0) { + zfree(&path->system); + free(path); + return NULL; + } + return path; + } + } + closedir(evt_dir); +next: + put_events_file(dir_path); + } + + closedir(sys_dir); + return NULL; +} + +static struct tracepoint_path *tracepoint_name_to_path(const char *name) +{ + struct tracepoint_path *path = zalloc(sizeof(*path)); + char *str = strchr(name, ':'); + + if (path == NULL || str == NULL) { + free(path); + return NULL; + } + + path->system = strndup(name, str - name); + path->name = strdup(str+1); + + if (path->system == NULL || path->name == NULL) { + zfree(&path->system); + zfree(&path->name); + zfree(&path); + } + + return path; +} + static struct tracepoint_path * get_tracepoints_path(struct list_head *pattrs) { diff -Nru linux-aws-5.19.0/tools/perf/util/tracepoint.c linux-aws-5.19.0/tools/perf/util/tracepoint.c --- linux-aws-5.19.0/tools/perf/util/tracepoint.c 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/tracepoint.c 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "tracepoint.h" + +#include +#include +#include +#include +#include + +#include + +int tp_event_has_id(const char *dir_path, struct dirent *evt_dir) +{ + char evt_path[MAXPATHLEN]; + int fd; + + snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, evt_dir->d_name); + fd = open(evt_path, O_RDONLY); + if (fd < 0) + return -EINVAL; + close(fd); + + return 0; +} + +/* + * Check whether event is in /tracing/events + */ +int is_valid_tracepoint(const char *event_string) +{ + DIR *sys_dir, *evt_dir; + struct dirent *sys_dirent, *evt_dirent; + char evt_path[MAXPATHLEN]; + char *dir_path; + + sys_dir = tracing_events__opendir(); + if (!sys_dir) + return 0; + + for_each_subsystem(sys_dir, sys_dirent) { + dir_path = get_events_file(sys_dirent->d_name); + if (!dir_path) + continue; + evt_dir = opendir(dir_path); + if (!evt_dir) + goto next; + + for_each_event(dir_path, evt_dir, evt_dirent) { + snprintf(evt_path, MAXPATHLEN, "%s:%s", + sys_dirent->d_name, evt_dirent->d_name); + if (!strcmp(evt_path, event_string)) { + closedir(evt_dir); + closedir(sys_dir); + return 1; + } + } + closedir(evt_dir); +next: + put_events_file(dir_path); + } + closedir(sys_dir); + return 0; +} diff -Nru linux-aws-5.19.0/tools/perf/util/tracepoint.h linux-aws-5.19.0/tools/perf/util/tracepoint.h --- linux-aws-5.19.0/tools/perf/util/tracepoint.h 1970-01-01 00:00:00.000000000 +0000 +++ linux-aws-5.19.0/tools/perf/util/tracepoint.h 2022-11-29 07:06:46.000000000 +0000 @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __PERF_TRACEPOINT_H +#define __PERF_TRACEPOINT_H + +#include +#include + +int tp_event_has_id(const char *dir_path, struct dirent *evt_dir); + +#define for_each_event(dir_path, evt_dir, evt_dirent) \ + while ((evt_dirent = readdir(evt_dir)) != NULL) \ + if (evt_dirent->d_type == DT_DIR && \ + (strcmp(evt_dirent->d_name, ".")) && \ + (strcmp(evt_dirent->d_name, "..")) && \ + (!tp_event_has_id(dir_path, evt_dirent))) + +#define for_each_subsystem(sys_dir, sys_dirent) \ + while ((sys_dirent = readdir(sys_dir)) != NULL) \ + if (sys_dirent->d_type == DT_DIR && \ + (strcmp(sys_dirent->d_name, ".")) && \ + (strcmp(sys_dirent->d_name, ".."))) + +int is_valid_tracepoint(const char *event_string); + +#endif /* __PERF_TRACEPOINT_H */ diff -Nru linux-aws-5.19.0/tools/power/x86/turbostat/turbostat.c linux-aws-5.19.0/tools/power/x86/turbostat/turbostat.c --- linux-aws-5.19.0/tools/power/x86/turbostat/turbostat.c 2022-11-29 07:06:33.000000000 +0000 +++ linux-aws-5.19.0/tools/power/x86/turbostat/turbostat.c 2022-11-29 07:06:46.000000000 +0000 @@ -5361,6 +5361,10 @@ case INTEL_FAM6_LAKEFIELD: case INTEL_FAM6_ALDERLAKE: case INTEL_FAM6_ALDERLAKE_L: + case INTEL_FAM6_ALDERLAKE_N: + case INTEL_FAM6_RAPTORLAKE: + case INTEL_FAM6_RAPTORLAKE_P: + case INTEL_FAM6_RAPTORLAKE_S: return INTEL_FAM6_CANNONLAKE_L; case INTEL_FAM6_ATOM_TREMONT_L: diff -Nru linux-aws-5.19.0/tools/testing/selftests/arm64/signal/testcases/testcases.c linux-aws-5.19.0/tools/testing/selftests/arm64/signal/testcases/testcases.c --- linux-aws-5.19.0/tools/testing/selftests/arm64/signal/testcases/testcases.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/arm64/signal/testcases/testcases.c 2022-11-29 07:06:46.000000000 +0000 @@ -33,7 +33,7 @@ return false; fprintf(stderr, "Validating EXTRA...\n"); - term = GET_RESV_NEXT_HEAD(extra); + term = GET_RESV_NEXT_HEAD(&extra->head); if (!term || term->magic || term->size) { *err = "Missing terminator after EXTRA context"; return false; diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c 2022-11-29 07:06:46.000000000 +0000 @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,7 @@ free(keys); free(values); free(visited); + close(map_fd); } static void array_map_batch_ops(void) diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c 2022-11-29 07:06:46.000000000 +0000 @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -255,6 +256,7 @@ free(visited); if (!is_pcpu) free(values); + close(map_fd); } void htab_map_batch_ops(void) diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c 2022-11-29 07:06:46.000000000 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -150,4 +151,5 @@ free(keys); free(values); free(visited); + close(map_fd); } diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/progs/kprobe_multi.c linux-aws-5.19.0/tools/testing/selftests/bpf/progs/kprobe_multi.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/progs/kprobe_multi.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/progs/kprobe_multi.c 2022-11-29 07:06:46.000000000 +0000 @@ -36,15 +36,13 @@ __u64 kretprobe_test7_result = 0; __u64 kretprobe_test8_result = 0; -extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; - static void kprobe_multi_check(void *ctx, bool is_return) { if (bpf_get_current_pid_tgid() >> 32 != pid) return; __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; - __u64 addr = bpf_get_func_ip(ctx) - (CONFIG_X86_KERNEL_IBT ? 4 : 0); + __u64 addr = bpf_get_func_ip(ctx); #define SET(__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \ diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/test_maps.c linux-aws-5.19.0/tools/testing/selftests/bpf/test_maps.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/test_maps.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/test_maps.c 2022-11-29 07:06:46.000000000 +0000 @@ -658,13 +658,13 @@ { struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break; int map_fd_msg = 0, map_fd_rx = 0, map_fd_tx = 0, map_fd_break; + struct bpf_object *parse_obj, *verdict_obj, *msg_obj; int ports[] = {50200, 50201, 50202, 50204}; int err, i, fd, udp, sfd[6] = {0xdeadbeef}; u8 buf[20] = {0x0, 0x5, 0x3, 0x2, 0x1, 0x0}; int parse_prog, verdict_prog, msg_prog; struct sockaddr_in addr; int one = 1, s, sc, rc; - struct bpf_object *obj; struct timeval to; __u32 key, value; pid_t pid[tasks]; @@ -760,6 +760,7 @@ i, udp); goto out_sockmap; } + close(udp); /* Test update without programs */ for (i = 0; i < 6; i++) { @@ -822,27 +823,27 @@ /* Load SK_SKB program and Attach */ err = bpf_prog_test_load(SOCKMAP_PARSE_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &parse_prog); + BPF_PROG_TYPE_SK_SKB, &parse_obj, &parse_prog); if (err) { printf("Failed to load SK_SKB parse prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_TCP_MSG_PROG, - BPF_PROG_TYPE_SK_MSG, &obj, &msg_prog); + BPF_PROG_TYPE_SK_MSG, &msg_obj, &msg_prog); if (err) { printf("Failed to load SK_SKB msg prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_VERDICT_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &verdict_prog); + BPF_PROG_TYPE_SK_SKB, &verdict_obj, &verdict_prog); if (err) { printf("Failed to load SK_SKB verdict prog\n"); goto out_sockmap; } - bpf_map_rx = bpf_object__find_map_by_name(obj, "sock_map_rx"); + bpf_map_rx = bpf_object__find_map_by_name(verdict_obj, "sock_map_rx"); if (!bpf_map_rx) { printf("Failed to load map rx from verdict prog\n"); goto out_sockmap; @@ -854,7 +855,7 @@ goto out_sockmap; } - bpf_map_tx = bpf_object__find_map_by_name(obj, "sock_map_tx"); + bpf_map_tx = bpf_object__find_map_by_name(verdict_obj, "sock_map_tx"); if (!bpf_map_tx) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -866,7 +867,7 @@ goto out_sockmap; } - bpf_map_msg = bpf_object__find_map_by_name(obj, "sock_map_msg"); + bpf_map_msg = bpf_object__find_map_by_name(verdict_obj, "sock_map_msg"); if (!bpf_map_msg) { printf("Failed to load map msg from msg_verdict prog\n"); goto out_sockmap; @@ -878,7 +879,7 @@ goto out_sockmap; } - bpf_map_break = bpf_object__find_map_by_name(obj, "sock_map_break"); + bpf_map_break = bpf_object__find_map_by_name(verdict_obj, "sock_map_break"); if (!bpf_map_break) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -1124,7 +1125,9 @@ } close(fd); close(map_fd_rx); - bpf_object__close(obj); + bpf_object__close(parse_obj); + bpf_object__close(msg_obj); + bpf_object__close(verdict_obj); return; out: for (i = 0; i < 6; i++) @@ -1282,8 +1285,11 @@ printf("Inner map mim.inner was not destroyed\n"); goto out_map_in_map; } + + close(fd); } + bpf_object__close(obj); return; out_map_in_map: diff -Nru linux-aws-5.19.0/tools/testing/selftests/bpf/xdpxceiver.c linux-aws-5.19.0/tools/testing/selftests/bpf/xdpxceiver.c --- linux-aws-5.19.0/tools/testing/selftests/bpf/xdpxceiver.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/bpf/xdpxceiver.c 2022-11-29 07:06:46.000000000 +0000 @@ -1589,6 +1589,8 @@ if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1600,6 +1602,8 @@ static void ifobject_delete(struct ifobject *ifobj) { + if (ifobj->ns_fd != -1) + close(ifobj->ns_fd); free(ifobj->umem); free(ifobj->xsk_arr); free(ifobj); diff -Nru linux-aws-5.19.0/tools/testing/selftests/landlock/fs_test.c linux-aws-5.19.0/tools/testing/selftests/landlock/fs_test.c --- linux-aws-5.19.0/tools/testing/selftests/landlock/fs_test.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/landlock/fs_test.c 2022-11-29 07:06:46.000000000 +0000 @@ -4,7 +4,7 @@ * * Copyright © 2017-2020 Mickaël Salaün * Copyright © 2020 ANSSI - * Copyright © 2020-2021 Microsoft Corporation + * Copyright © 2020-2022 Microsoft Corporation */ #define _GNU_SOURCE @@ -371,6 +371,13 @@ ASSERT_EQ(EINVAL, errno); path_beneath.allowed_access &= ~LANDLOCK_ACCESS_FS_EXECUTE; + /* Tests with denied-by-default access right. */ + path_beneath.allowed_access |= LANDLOCK_ACCESS_FS_REFER; + ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, + &path_beneath, 0)); + ASSERT_EQ(EINVAL, errno); + path_beneath.allowed_access &= ~LANDLOCK_ACCESS_FS_REFER; + /* Test with unknown (64-bits) value. */ path_beneath.allowed_access |= (1ULL << 60); ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, @@ -1826,6 +1833,20 @@ ASSERT_EQ(0, link(file1_s1d3, file2_s1d3)); } +static int test_rename(const char *const oldpath, const char *const newpath) +{ + if (rename(oldpath, newpath)) + return errno; + return 0; +} + +static int test_exchange(const char *const oldpath, const char *const newpath) +{ + if (renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, RENAME_EXCHANGE)) + return errno; + return 0; +} + TEST_F_FORK(layout1, rename_file) { const struct rule rules[] = { @@ -1867,10 +1888,10 @@ * to a different directory (which allows file removal). */ ASSERT_EQ(-1, rename(file1_s2d1, file1_s1d3)); - ASSERT_EQ(EXDEV, errno); + ASSERT_EQ(EACCES, errno); ASSERT_EQ(-1, renameat2(AT_FDCWD, file1_s2d1, AT_FDCWD, file1_s1d3, RENAME_EXCHANGE)); - ASSERT_EQ(EXDEV, errno); + ASSERT_EQ(EACCES, errno); ASSERT_EQ(-1, renameat2(AT_FDCWD, dir_s2d2, AT_FDCWD, file1_s1d3, RENAME_EXCHANGE)); ASSERT_EQ(EXDEV, errno); @@ -1894,7 +1915,7 @@ ASSERT_EQ(EXDEV, errno); ASSERT_EQ(0, unlink(file1_s1d3)); ASSERT_EQ(-1, rename(file1_s2d1, file1_s1d3)); - ASSERT_EQ(EXDEV, errno); + ASSERT_EQ(EACCES, errno); /* Exchanges and renames files with same parent. */ ASSERT_EQ(0, renameat2(AT_FDCWD, file2_s2d3, AT_FDCWD, file1_s2d3, @@ -2014,6 +2035,115 @@ ASSERT_EQ(0, rename(dir_s1d3, dir_s2d3)); } +/* Checks renames beneath dir_s1d1. */ +static void refer_denied_by_default(struct __test_metadata *const _metadata, + const struct rule layer1[], + const int layer1_err, + const struct rule layer2[]) +{ + int ruleset_fd; + + ASSERT_EQ(0, unlink(file1_s1d2)); + + ruleset_fd = create_ruleset(_metadata, layer1[0].access, layer1); + ASSERT_LE(0, ruleset_fd); + enforce_ruleset(_metadata, ruleset_fd); + ASSERT_EQ(0, close(ruleset_fd)); + + /* + * If the first layer handles LANDLOCK_ACCESS_FS_REFER (according to + * layer1_err), then it allows some different-parent renames and links. + */ + ASSERT_EQ(layer1_err, test_rename(file1_s1d1, file1_s1d2)); + if (layer1_err == 0) + ASSERT_EQ(layer1_err, test_rename(file1_s1d2, file1_s1d1)); + ASSERT_EQ(layer1_err, test_exchange(file2_s1d1, file2_s1d2)); + ASSERT_EQ(layer1_err, test_exchange(file2_s1d2, file2_s1d1)); + + ruleset_fd = create_ruleset(_metadata, layer2[0].access, layer2); + ASSERT_LE(0, ruleset_fd); + enforce_ruleset(_metadata, ruleset_fd); + ASSERT_EQ(0, close(ruleset_fd)); + + /* + * Now, either the first or the second layer does not handle + * LANDLOCK_ACCESS_FS_REFER, which means that any different-parent + * renames and links are denied, thus making the layer handling + * LANDLOCK_ACCESS_FS_REFER null and void. + */ + ASSERT_EQ(EXDEV, test_rename(file1_s1d1, file1_s1d2)); + ASSERT_EQ(EXDEV, test_exchange(file2_s1d1, file2_s1d2)); + ASSERT_EQ(EXDEV, test_exchange(file2_s1d2, file2_s1d1)); +} + +const struct rule layer_dir_s1d1_refer[] = { + { + .path = dir_s1d1, + .access = LANDLOCK_ACCESS_FS_REFER, + }, + {}, +}; + +const struct rule layer_dir_s1d1_execute[] = { + { + /* Matches a parent directory. */ + .path = dir_s1d1, + .access = LANDLOCK_ACCESS_FS_EXECUTE, + }, + {}, +}; + +const struct rule layer_dir_s2d1_execute[] = { + { + /* Does not match a parent directory. */ + .path = dir_s2d1, + .access = LANDLOCK_ACCESS_FS_EXECUTE, + }, + {}, +}; + +/* + * Tests precedence over renames: denied by default for different parent + * directories, *with* a rule matching a parent directory, but not directly + * denying access (with MAKE_REG nor REMOVE). + */ +TEST_F_FORK(layout1, refer_denied_by_default1) +{ + refer_denied_by_default(_metadata, layer_dir_s1d1_refer, 0, + layer_dir_s1d1_execute); +} + +/* + * Same test but this time turning around the ABI version order: the first + * layer does not handle LANDLOCK_ACCESS_FS_REFER. + */ +TEST_F_FORK(layout1, refer_denied_by_default2) +{ + refer_denied_by_default(_metadata, layer_dir_s1d1_execute, EXDEV, + layer_dir_s1d1_refer); +} + +/* + * Tests precedence over renames: denied by default for different parent + * directories, *without* a rule matching a parent directory, but not directly + * denying access (with MAKE_REG nor REMOVE). + */ +TEST_F_FORK(layout1, refer_denied_by_default3) +{ + refer_denied_by_default(_metadata, layer_dir_s1d1_refer, 0, + layer_dir_s2d1_execute); +} + +/* + * Same test but this time turning around the ABI version order: the first + * layer does not handle LANDLOCK_ACCESS_FS_REFER. + */ +TEST_F_FORK(layout1, refer_denied_by_default4) +{ + refer_denied_by_default(_metadata, layer_dir_s2d1_execute, EXDEV, + layer_dir_s1d1_refer); +} + TEST_F_FORK(layout1, reparent_link) { const struct rule layer1[] = { @@ -2336,11 +2466,12 @@ ASSERT_EQ(EXDEV, errno); /* - * However, moving the file2_s1d3 file below dir_s2d3 is allowed - * because it cannot inherit MAKE_REG nor MAKE_DIR rights (which are - * dedicated to directories). + * Moving the file2_s1d3 file below dir_s2d3 is denied because the + * second layer does not handle REFER, which is always denied by + * default. */ - ASSERT_EQ(0, rename(file2_s1d3, file1_s2d3)); + ASSERT_EQ(-1, rename(file2_s1d3, file1_s2d3)); + ASSERT_EQ(EXDEV, errno); } TEST_F_FORK(layout1, reparent_exdev_layers_rename2) @@ -2373,8 +2504,12 @@ ASSERT_EQ(EACCES, errno); ASSERT_EQ(-1, rename(file1_s1d1, file1_s2d3)); ASSERT_EQ(EXDEV, errno); - /* Modify layout! */ - ASSERT_EQ(0, rename(file2_s1d2, file1_s2d3)); + /* + * Modifying the layout is now denied because the second layer does not + * handle REFER, which is always denied by default. + */ + ASSERT_EQ(-1, rename(file2_s1d2, file1_s2d3)); + ASSERT_EQ(EXDEV, errno); /* Without REFER source, EACCES wins over EXDEV. */ ASSERT_EQ(-1, rename(dir_s1d1, file1_s2d2)); diff -Nru linux-aws-5.19.0/tools/testing/selftests/net/bpf/Makefile linux-aws-5.19.0/tools/testing/selftests/net/bpf/Makefile --- linux-aws-5.19.0/tools/testing/selftests/net/bpf/Makefile 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/net/bpf/Makefile 2022-11-29 07:06:46.000000000 +0000 @@ -5,7 +5,8 @@ CCINCLUDE += -I../../../../lib CCINCLUDE += -I../../../../../usr/include/ -TEST_CUSTOM_PROGS = $(OUTPUT)/bpf/nat6to4.o +TEST_CUSTOM_PROGS = \ + # $(OUTPUT)/bpf/nat6to4.o # Disabled for Ubuntu selftests build all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/%.o: %.c diff -Nru linux-aws-5.19.0/tools/testing/selftests/net/fcnal-test.sh linux-aws-5.19.0/tools/testing/selftests/net/fcnal-test.sh --- linux-aws-5.19.0/tools/testing/selftests/net/fcnal-test.sh 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/net/fcnal-test.sh 2022-11-29 07:06:46.000000000 +0000 @@ -1467,6 +1467,13 @@ log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF" log_start + run_cmd_nsb nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} -U + log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF, with connect()" + + + log_start show_hint "Should fail 'Connection refused'" run_cmd nettest -D -r ${a} log_test_addr ${a} $? 1 "No server, unbound client" @@ -1525,6 +1532,13 @@ run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection" + log_start + run_cmd nettest -s -D & + sleep 1 + run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U + log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + # IPv4 with device bind has really weird behavior - it overrides the # fib lookup, generates an rtable and tries to send the packet. This # causes failures for local traffic at different places @@ -1550,6 +1564,15 @@ sleep 1 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail since addresses on loopback are out of device scope" + run_cmd nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + done a=${NSA_IP} @@ -3157,6 +3180,13 @@ sleep 1 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" + run_cmd nettest -6 -D -s & + sleep 1 + run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" done a=${NSA_IP6} diff -Nru linux-aws-5.19.0/tools/testing/selftests/net/forwarding/sch_red.sh linux-aws-5.19.0/tools/testing/selftests/net/forwarding/sch_red.sh --- linux-aws-5.19.0/tools/testing/selftests/net/forwarding/sch_red.sh 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/net/forwarding/sch_red.sh 2022-11-29 07:06:46.000000000 +0000 @@ -1,3 +1,4 @@ +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # This test sends one stream of traffic from H1 through a TBF shaper, to a RED diff -Nru linux-aws-5.19.0/tools/testing/selftests/net/nettest.c linux-aws-5.19.0/tools/testing/selftests/net/nettest.c --- linux-aws-5.19.0/tools/testing/selftests/net/nettest.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/net/nettest.c 2022-11-29 07:06:46.000000000 +0000 @@ -127,6 +127,9 @@ /* ESP in UDP encap test */ int use_xfrm; + + /* use send() and connect() instead of sendto */ + int datagram_connect; }; static int server_mode; @@ -979,6 +982,11 @@ log_err_errno("write failed sending msg to peer"); return 1; } + } else if (args->datagram_connect) { + if (send(sd, msg, msglen, 0) < 0) { + log_err_errno("send failed sending msg to peer"); + return 1; + } } else if (args->ifindex && args->use_cmsg) { if (send_msg_cmsg(sd, addr, alen, args->ifindex, args->version)) return 1; @@ -1659,7 +1667,7 @@ if (args->has_local_ip && bind_socket(sd, args)) goto err; - if (args->type != SOCK_STREAM) + if (args->type != SOCK_STREAM && !args->datagram_connect) goto out; if (args->password && tcp_md5sig(sd, addr, alen, args)) @@ -1854,7 +1862,7 @@ return client_status; } -#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqf" +#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SUCi6xL:0:1:2:3:Fbqf" #define OPT_FORCE_BIND_KEY_IFINDEX 1001 #define OPT_NO_BIND_KEY_IFINDEX 1002 @@ -1891,6 +1899,7 @@ " -I dev bind socket to given device name - server mode\n" " -S use setsockopt (IP_UNICAST_IF or IP_MULTICAST_IF)\n" " to set device binding\n" + " -U Use connect() and send() for datagram sockets\n" " -f bind socket with the IP[V6]_FREEBIND option\n" " -C use cmsg and IP_PKTINFO to specify device binding\n" "\n" @@ -2074,6 +2083,9 @@ case 'x': args.use_xfrm = 1; break; + case 'U': + args.datagram_connect = 1; + break; default: print_usage(argv[0]); return 1; diff -Nru linux-aws-5.19.0/tools/testing/selftests/net/reuseport_bpf.c linux-aws-5.19.0/tools/testing/selftests/net/reuseport_bpf.c --- linux-aws-5.19.0/tools/testing/selftests/net/reuseport_bpf.c 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/net/reuseport_bpf.c 2022-11-29 07:06:46.000000000 +0000 @@ -328,7 +328,7 @@ if (bind(fd1, addr, sockaddr_size())) error(1, errno, "failed to bind recv socket 1"); - if (!bind(fd2, addr, sockaddr_size()) && errno != EADDRINUSE) + if (!bind(fd2, addr, sockaddr_size()) || errno != EADDRINUSE) error(1, errno, "bind socket 2 should fail with EADDRINUSE"); free(addr); diff -Nru linux-aws-5.19.0/tools/testing/selftests/tpm2/tpm2.py linux-aws-5.19.0/tools/testing/selftests/tpm2/tpm2.py --- linux-aws-5.19.0/tools/testing/selftests/tpm2/tpm2.py 2022-07-31 21:03:01.000000000 +0000 +++ linux-aws-5.19.0/tools/testing/selftests/tpm2/tpm2.py 2022-11-29 07:06:46.000000000 +0000 @@ -371,6 +371,10 @@ fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) self.tpm_poll = select.poll() + def __del__(self): + if self.tpm: + self.tpm.close() + def close(self): self.tpm.close()