reverted: --- linux-oem-5.17-5.17.0/Documentation/devicetree/bindings/memory-controllers/synopsys,ddrc-ecc.yaml +++ linux-oem-5.17-5.17.0.orig/Documentation/devicetree/bindings/memory-controllers/synopsys,ddrc-ecc.yaml @@ -24,9 +24,9 @@ properties: compatible: enum: - - snps,ddrc-3.80a - xlnx,zynq-ddrc-a05 - xlnx,zynqmp-ddrc-2.40a + - snps,ddrc-3.80a interrupts: maxItems: 1 @@ -43,9 +43,7 @@ properties: compatible: contains: + const: xlnx,zynqmp-ddrc-2.40a - enum: - - snps,ddrc-3.80a - - xlnx,zynqmp-ddrc-2.40a then: required: - interrupts reverted: --- linux-oem-5.17-5.17.0/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ linux-oem-5.17-5.17.0.orig/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -53,18 +53,20 @@ - allwinner,sun8i-r40-gmac - allwinner,sun8i-v3s-emac - allwinner,sun50i-a64-emac + - loongson,ls2k-dwmac + - loongson,ls7a-dwmac - amlogic,meson6-dwmac - amlogic,meson8b-dwmac - amlogic,meson8m2-dwmac - amlogic,meson-gxbb-dwmac - amlogic,meson-axg-dwmac + - loongson,ls2k-dwmac + - loongson,ls7a-dwmac - ingenic,jz4775-mac - ingenic,x1000-mac - ingenic,x1600-mac - ingenic,x1830-mac - ingenic,x2000-mac - - loongson,ls2k-dwmac - - loongson,ls7a-dwmac - rockchip,px30-gmac - rockchip,rk3128-gmac - rockchip,rk3228-gmac reverted: --- linux-oem-5.17-5.17.0/Documentation/devicetree/bindings/pci/apple,pcie.yaml +++ linux-oem-5.17-5.17.0.orig/Documentation/devicetree/bindings/pci/apple,pcie.yaml @@ -142,6 +142,7 @@ device_type = "pci"; reg = <0x0 0x0 0x0 0x0 0x0>; reset-gpios = <&pinctrl_ap 152 0>; + max-link-speed = <2>; #address-cells = <3>; #size-cells = <2>; @@ -152,6 +153,7 @@ device_type = "pci"; reg = <0x800 0x0 0x0 0x0 0x0>; reset-gpios = <&pinctrl_ap 153 0>; + max-link-speed = <2>; #address-cells = <3>; #size-cells = <2>; @@ -162,6 +164,7 @@ device_type = "pci"; reg = <0x1000 0x0 0x0 0x0 0x0>; reset-gpios = <&pinctrl_ap 33 0>; + max-link-speed = <1>; #address-cells = <3>; #size-cells = <2>; reverted: --- linux-oem-5.17-5.17.0/Documentation/filesystems/ext4/attributes.rst +++ linux-oem-5.17-5.17.0.orig/Documentation/filesystems/ext4/attributes.rst @@ -76,7 +76,7 @@ - Checksum of the extended attribute block. * - 0x14 - \_\_u32 + - h\_reserved[2] - - h\_reserved[3] - Zero. The checksum is calculated against the FS UUID, the 64-bit block number diff -u linux-oem-5.17-5.17.0/Makefile linux-oem-5.17-5.17.0/Makefile --- linux-oem-5.17-5.17.0/Makefile +++ linux-oem-5.17-5.17.0/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 17 -SUBLEVEL = 7 +SUBLEVEL = 3 EXTRAVERSION = NAME = Superb Owl reverted: --- linux-oem-5.17-5.17.0/arch/arc/kernel/entry.S +++ linux-oem-5.17-5.17.0.orig/arch/arc/kernel/entry.S @@ -196,7 +196,6 @@ st r0, [sp, PT_r0] ; sys call return value in pt_regs ;POST Sys Call Ptrace Hook - mov r0, sp ; pt_regs needed bl @syscall_trace_exit b ret_from_exception ; NOT ret_from_system_call at is saves r0 which ; we'd done before calling post hook above reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/am33xx-l4.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/am33xx-l4.dtsi @@ -263,8 +263,6 @@ compatible = "ti,am3359-tscadc"; reg = <0x0 0x1000>; interrupts = <16>; - clocks = <&adc_tsc_fck>; - clock-names = "fck"; status = "disabled"; dmas = <&edma 53 0>, <&edma 57 0>; dma-names = "fifo0", "fifo1"; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/am3517-evm.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/am3517-evm.dts @@ -161,8 +161,6 @@ /* HS USB Host PHY on PORT 1 */ hsusb1_phy: hsusb1_phy { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb1_rst_pins>; compatible = "usb-nop-xceiv"; reset-gpios = <&gpio2 25 GPIO_ACTIVE_LOW>; /* gpio_57 */ #phy-cells = <0>; @@ -170,9 +168,7 @@ }; &davinci_emac { + status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <ðernet_pins>; - status = "okay"; }; &davinci_mdio { @@ -197,8 +193,6 @@ }; &i2c2 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c2_pins>; clock-frequency = <400000>; /* User DIP swithes [1:8] / User LEDS [1:2] */ tca6416: gpio@21 { @@ -211,8 +205,6 @@ }; &i2c3 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c3_pins>; clock-frequency = <400000>; }; @@ -231,8 +223,6 @@ }; &usbhshost { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb1_pins>; port1-mode = "ehci-phy"; }; @@ -241,35 +231,8 @@ }; &omap3_pmx_core { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb1_rst_pins>; - - ethernet_pins: pinmux_ethernet_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21fe, PIN_INPUT | MUX_MODE0) /* rmii_mdio_data */ - OMAP3_CORE1_IOPAD(0x2200, MUX_MODE0) /* rmii_mdio_clk */ - OMAP3_CORE1_IOPAD(0x2202, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd0 */ - OMAP3_CORE1_IOPAD(0x2204, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd1 */ - OMAP3_CORE1_IOPAD(0x2206, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_crs_dv */ - OMAP3_CORE1_IOPAD(0x2208, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_rxer */ - OMAP3_CORE1_IOPAD(0x220a, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd0 */ - OMAP3_CORE1_IOPAD(0x220c, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd1 */ - OMAP3_CORE1_IOPAD(0x220e, PIN_OUTPUT_PULLDOWN |MUX_MODE0) /* rmii_txen */ - OMAP3_CORE1_IOPAD(0x2210, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_50mhz_clk */ - >; - }; - - i2c2_pins: pinmux_i2c2_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */ - OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */ - >; - }; - - i2c3_pins: pinmux_i2c3_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */ - OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */ - >; - }; leds_pins: pinmux_leds_pins { pinctrl-single,pins = < @@ -337,6 +300,8 @@ }; &omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb1_pins>; hsusb1_pins: pinmux_hsusb1_pins { pinctrl-single,pins = < reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/am3517-som.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/am3517-som.dtsi @@ -69,8 +69,6 @@ }; &i2c1 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c1_pins>; clock-frequency = <400000>; s35390a: s35390a@30 { @@ -181,13 +179,6 @@ &omap3_pmx_core { - i2c1_pins: pinmux_i2c1_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21ba, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */ - OMAP3_CORE1_IOPAD(0x21bc, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */ - >; - }; - wl12xx_buffer_pins: pinmux_wl12xx_buffer_pins { pinctrl-single,pins = < OMAP3_CORE1_IOPAD(0x2156, PIN_OUTPUT | MUX_MODE4) /* mmc1_dat7.gpio_129 */ reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/at91-sama5d3_xplained.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/at91-sama5d3_xplained.dts @@ -57,8 +57,8 @@ }; spi0: spi@f0004000 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_spi0_cs>; - pinctrl-names = "default", "cs"; - pinctrl-1 = <&pinctrl_spi0_cs>; cs-gpios = <&pioD 13 0>, <0>, <0>, <&pioD 16 0>; status = "okay"; }; @@ -171,8 +171,8 @@ }; spi1: spi@f8008000 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_spi1_cs>; - pinctrl-names = "default", "cs"; - pinctrl-1 = <&pinctrl_spi1_cs>; cs-gpios = <&pioC 25 0>; status = "okay"; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/at91-sama5d4_xplained.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/at91-sama5d4_xplained.dts @@ -81,8 +81,8 @@ }; spi1: spi@fc018000 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_spi0_cs>; - pinctrl-names = "default", "cs"; - pinctrl-1 = <&pinctrl_spi1_cs>; cs-gpios = <&pioB 21 0>; status = "okay"; }; @@ -140,7 +140,7 @@ atmel,pins = ; }; + pinctrl_spi0_cs: spi0_cs_default { - pinctrl_spi1_cs: spi1_cs_default { atmel,pins = ; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/at91-sama7g5ek.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/at91-sama7g5ek.dts @@ -465,7 +465,7 @@ pinctrl_flx3_default: flx3_default { pinmux = , ; + bias-disable; - bias-pull-up; }; pinctrl_flx4_default: flx4_default { reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/at91sam9g20ek_common.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/at91sam9g20ek_common.dtsi @@ -219,12 +219,6 @@ wm8731: wm8731@1b { compatible = "wm8731"; reg = <0x1b>; - - /* PCK0 at 12MHz */ - clocks = <&pmc PMC_TYPE_SYSTEM 8>; - clock-names = "mclk"; - assigned-clocks = <&pmc PMC_TYPE_SYSTEM 8>; - assigned-clock-rates = <12000000>; }; }; diff -u linux-oem-5.17-5.17.0/arch/arm/boot/dts/dra7-l4.dtsi linux-oem-5.17-5.17.0/arch/arm/boot/dts/dra7-l4.dtsi --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/dra7-l4.dtsi +++ linux-oem-5.17-5.17.0/arch/arm/boot/dts/dra7-l4.dtsi @@ -4188,11 +4188,11 @@ reg = <0x1d0010 0x4>; reg-names = "sysc"; ti,sysc-midle = , - ; + , + ; ti,sysc-sidle = , , ; - power-domains = <&prm_vpe>; clocks = <&vpe_clkctrl DRA7_VPE_VPE_CLKCTRL 0>; clock-names = "fck"; #address-cells = <1>; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/imx6qdl-apalis.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/imx6qdl-apalis.dtsi @@ -286,8 +286,6 @@ codec: sgtl5000@a { compatible = "fsl,sgtl5000"; reg = <0x0a>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_sgtl5000>; clocks = <&clks IMX6QDL_CLK_CKO>; VDDA-supply = <®_module_3v3_audio>; VDDIO-supply = <®_module_3v3>; @@ -519,6 +517,8 @@ MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0 MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0 MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0 + /* SGTL5000 sys_mclk */ + MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 >; }; @@ -811,12 +811,6 @@ >; }; - pinctrl_sgtl5000: sgtl5000grp { - fsl,pins = < - MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0 - >; - }; - pinctrl_spdif: spdifgrp { fsl,pins = < MX6QDL_PAD_GPIO_16__SPDIF_IN 0x1b0b0 reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/imx6ull-colibri.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/imx6ull-colibri.dtsi @@ -37,7 +37,7 @@ reg_sd1_vmmc: regulator-sd1-vmmc { compatible = "regulator-gpio"; + gpio = <&gpio5 9 GPIO_ACTIVE_HIGH>; - gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_snvs_reg_sd>; regulator-always-on; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts @@ -11,18 +11,3 @@ model = "LogicPD Zoom OMAP35xx SOM-LV Development Kit"; compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3430", "ti,omap3"; }; - -&omap3_pmx_core2 { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb2_2_pins>; - hsusb2_2_pins: pinmux_hsusb2_2_pins { - pinctrl-single,pins = < - OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ - OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ - OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ - OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ - OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ - OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ - >; - }; -}; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts @@ -11,18 +11,3 @@ model = "LogicPD Zoom DM3730 SOM-LV Development Kit"; compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3"; }; - -&omap3_pmx_core2 { - pinctrl-names = "default"; - pinctrl-0 = <&hsusb2_2_pins>; - hsusb2_2_pins: pinmux_hsusb2_2_pins { - pinctrl-single,pins = < - OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ - OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ - OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ - OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ - OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ - OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ - >; - }; -}; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/logicpd-som-lv.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/logicpd-som-lv.dtsi @@ -265,6 +265,21 @@ }; }; +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = <&hsusb2_2_pins>; + hsusb2_2_pins: pinmux_hsusb2_2_pins { + pinctrl-single,pins = < + OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ + OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ + OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ + OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ + OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ + OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ + >; + }; +}; + &uart2 { interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>; pinctrl-names = "default"; reverted: --- linux-oem-5.17-5.17.0/arch/arm/boot/dts/omap3-gta04.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm/boot/dts/omap3-gta04.dtsi @@ -31,8 +31,6 @@ aliases { display0 = &lcd; display1 = &tv0; - /delete-property/ mmc2; - /delete-property/ mmc3; }; ldo_3v3: fixedregulator { reverted: --- linux-oem-5.17-5.17.0/arch/arm/mach-davinci/board-da850-evm.c +++ linux-oem-5.17-5.17.0.orig/arch/arm/mach-davinci/board-da850-evm.c @@ -1101,13 +1101,11 @@ int ret; u32 val; struct davinci_soc_info *soc_info = &davinci_soc_info; + u8 rmii_en = soc_info->emac_pdata->rmii_en; - u8 rmii_en; if (!machine_is_davinci_da850_evm()) return 0; - rmii_en = soc_info->emac_pdata->rmii_en; - cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); val = __raw_readl(cfg_chip3_base); reverted: --- linux-oem-5.17-5.17.0/arch/arm/mach-ep93xx/clock.c +++ linux-oem-5.17-5.17.0.orig/arch/arm/mach-ep93xx/clock.c @@ -148,10 +148,8 @@ psc->lock = &clk_lock; clk = clk_register(NULL, &psc->hw); + if (IS_ERR(clk)) - if (IS_ERR(clk)) { kfree(psc); - return ERR_CAST(clk); - } return &psc->hw; } reverted: --- linux-oem-5.17-5.17.0/arch/arm/mach-exynos/Kconfig +++ linux-oem-5.17-5.17.0.orig/arch/arm/mach-exynos/Kconfig @@ -17,6 +17,7 @@ select EXYNOS_PMU select EXYNOS_SROM select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS + select GPIOLIB select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5 select HAVE_ARM_SCU if SMP select PINCTRL reverted: --- linux-oem-5.17-5.17.0/arch/arm/mach-omap2/omap4-common.c +++ linux-oem-5.17-5.17.0.orig/arch/arm/mach-omap2/omap4-common.c @@ -314,12 +314,10 @@ np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic"); gic_dist_base_addr = of_iomap(np, 0); - of_node_put(np); WARN_ON(!gic_dist_base_addr); np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer"); twd_base = of_iomap(np, 0); - of_node_put(np); WARN_ON(!twd_base); skip_errata_init: reverted: --- linux-oem-5.17-5.17.0/arch/arm/mach-vexpress/spc.c +++ linux-oem-5.17-5.17.0.orig/arch/arm/mach-vexpress/spc.c @@ -580,7 +580,7 @@ } cluster = topology_physical_package_id(cpu_dev->id); + if (init_opp_table[cluster]) - if (cluster < 0 || init_opp_table[cluster]) continue; if (ve_init_opp_table(cpu_dev)) reverted: --- linux-oem-5.17-5.17.0/arch/arm/xen/enlighten.c +++ linux-oem-5.17-5.17.0.orig/arch/arm/xen/enlighten.c @@ -337,15 +337,12 @@ if (!nr_reg) { pr_err("No extended regions are found\n"); - of_node_put(np); return -EINVAL; } regs = kcalloc(nr_reg, sizeof(*regs), GFP_KERNEL); + if (!regs) - if (!regs) { - of_node_put(np); return -ENOMEM; - } /* * Create resource from extended regions provided by the hypervisor to be @@ -406,8 +403,8 @@ *res = &xen_resource; err: - of_node_put(np); kfree(regs); + return rc; } #endif @@ -427,10 +424,8 @@ if (of_address_to_resource(xen_node, GRANT_TABLE_INDEX, &res)) { pr_err("Xen grant table region is not found\n"); - of_node_put(xen_node); return; } - of_node_put(xen_node); xen_grant_frames = res.start; } reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi @@ -11,6 +11,26 @@ compatible = "operating-points-v2"; opp-shared; + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <731000>; + }; + + opp-250000000 { + opp-hz = /bits/ 64 <250000000>; + opp-microvolt = <731000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <731000>; + }; + + opp-667000000 { + opp-hz = /bits/ 64 <667000000>; + opp-microvolt = <731000>; + }; + opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <761000>; @@ -51,6 +71,26 @@ compatible = "operating-points-v2"; opp-shared; + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <731000>; + }; + + opp-250000000 { + opp-hz = /bits/ 64 <250000000>; + opp-microvolt = <731000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <731000>; + }; + + opp-667000000 { + opp-hz = /bits/ 64 <667000000>; + opp-microvolt = <731000>; + }; + opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <731000>; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi @@ -11,6 +11,26 @@ compatible = "operating-points-v2"; opp-shared; + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <731000>; + }; + + opp-250000000 { + opp-hz = /bits/ 64 <250000000>; + opp-microvolt = <731000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <731000>; + }; + + opp-667000000 { + opp-hz = /bits/ 64 <667000000>; + opp-microvolt = <731000>; + }; + opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <731000>; @@ -56,6 +76,26 @@ compatible = "operating-points-v2"; opp-shared; + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <751000>; + }; + + opp-250000000 { + opp-hz = /bits/ 64 <250000000>; + opp-microvolt = <751000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <751000>; + }; + + opp-667000000 { + opp-hz = /bits/ 64 <667000000>; + opp-microvolt = <751000>; + }; + opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <771000>; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts @@ -437,7 +437,6 @@ "", "eMMC_RST#", /* BOOT_12 */ "eMMC_DS", /* BOOT_13 */ - "", "", /* GPIOC */ "SD_D0_B", /* GPIOC_0 */ "SD_D1_B", /* GPIOC_1 */ reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi @@ -95,6 +95,26 @@ compatible = "operating-points-v2"; opp-shared; + opp-100000000 { + opp-hz = /bits/ 64 <100000000>; + opp-microvolt = <730000>; + }; + + opp-250000000 { + opp-hz = /bits/ 64 <250000000>; + opp-microvolt = <730000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <730000>; + }; + + opp-667000000 { + opp-hz = /bits/ 64 <666666666>; + opp-microvolt = <750000>; + }; + opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <770000>; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mm-var-som.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mm-var-som.dtsi @@ -89,12 +89,12 @@ pendown-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <125>; + touchscreen-size-x = /bits/ 16 <4008>; - touchscreen-size-x = <4008>; ti,y-min = /bits/ 16 <282>; + touchscreen-size-y = /bits/ 16 <3864>; - touchscreen-size-y = <3864>; ti,x-plate-ohms = /bits/ 16 <180>; + touchscreen-max-pressure = /bits/ 16 <255>; + touchscreen-average-samples = /bits/ 16 <10>; - touchscreen-max-pressure = <255>; - touchscreen-average-samples = <10>; ti,debounce-tol = /bits/ 16 <3>; ti,debounce-rep = /bits/ 16 <1>; ti,settle-delay-usec = /bits/ 16 <150>; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw71xx.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mm-venice-gw71xx.dtsi @@ -103,14 +103,12 @@ &usbotg1 { dr_mode = "otg"; - over-current-active-low; vbus-supply = <®_usb_otg1_vbus>; status = "okay"; }; &usbotg2 { dr_mode = "host"; - disable-over-current; status = "okay"; }; @@ -168,7 +166,7 @@ fsl,pins = < MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0xd6 + MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 - MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0xd6 MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0xd6 >; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi @@ -139,14 +139,12 @@ &usbotg1 { dr_mode = "otg"; - over-current-active-low; vbus-supply = <®_usb_otg1_vbus>; status = "okay"; }; &usbotg2 { dr_mode = "host"; - disable-over-current; vbus-supply = <®_usb_otg2_vbus>; status = "okay"; }; @@ -233,7 +231,7 @@ fsl,pins = < MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0xd6 + MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 - MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0xd6 MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0xd6 >; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi @@ -166,14 +166,12 @@ &usbotg1 { dr_mode = "otg"; - over-current-active-low; vbus-supply = <®_usb_otg1_vbus>; status = "okay"; }; &usbotg2 { dr_mode = "host"; - disable-over-current; vbus-supply = <®_usb_otg2_vbus>; status = "okay"; }; @@ -282,7 +280,7 @@ fsl,pins = < MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0xd6 + MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6 - MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0xd6 MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0xd6 >; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts @@ -59,10 +59,6 @@ interrupts = <3 IRQ_TYPE_LEVEL_LOW>; rohm,reset-snvs-powered; - #clock-cells = <0>; - clocks = <&osc_32k 0>; - clock-output-names = "clk-32k-out"; - regulators { buck1_reg: BUCK1 { regulator-name = "buck1"; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi @@ -70,12 +70,12 @@ pendown-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <125>; + touchscreen-size-x = /bits/ 16 <4008>; - touchscreen-size-x = <4008>; ti,y-min = /bits/ 16 <282>; + touchscreen-size-y = /bits/ 16 <3864>; - touchscreen-size-y = <3864>; ti,x-plate-ohms = /bits/ 16 <180>; + touchscreen-max-pressure = /bits/ 16 <255>; + touchscreen-average-samples = /bits/ 16 <10>; - touchscreen-max-pressure = <255>; - touchscreen-average-samples = <10>; ti,debounce-tol = /bits/ 16 <3>; ti,debounce-rep = /bits/ 16 <1>; ti,settle-delay-usec = /bits/ 16 <150>; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mn.dtsi @@ -291,7 +291,7 @@ ranges; sai2: sai@30020000 { + compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; - compatible = "fsl,imx8mn-sai", "fsl,imx8mq-sai"; reg = <0x30020000 0x10000>; interrupts = ; clocks = <&clk IMX8MN_CLK_SAI2_IPG>, @@ -305,7 +305,7 @@ }; sai3: sai@30030000 { + compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; - compatible = "fsl,imx8mn-sai", "fsl,imx8mq-sai"; reg = <0x30030000 0x10000>; interrupts = ; clocks = <&clk IMX8MN_CLK_SAI3_IPG>, @@ -319,7 +319,7 @@ }; sai5: sai@30050000 { + compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; - compatible = "fsl,imx8mn-sai", "fsl,imx8mq-sai"; reg = <0x30050000 0x10000>; interrupts = ; clocks = <&clk IMX8MN_CLK_SAI5_IPG>, @@ -335,7 +335,7 @@ }; sai6: sai@30060000 { + compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; - compatible = "fsl,imx8mn-sai", "fsl,imx8mq-sai"; reg = <0x30060000 0x10000>; interrupts = ; clocks = <&clk IMX8MN_CLK_SAI6_IPG>, @@ -392,7 +392,7 @@ }; sai7: sai@300b0000 { + compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; - compatible = "fsl,imx8mn-sai", "fsl,imx8mq-sai"; reg = <0x300b0000 0x10000>; interrupts = ; clocks = <&clk IMX8MN_CLK_SAI7_IPG>, reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi @@ -253,7 +253,7 @@ #address-cells = <1>; #size-cells = <1>; spi-max-frequency = <84000000>; + spi-tx-bus-width = <4>; - spi-tx-bus-width = <1>; spi-rx-bus-width = <4>; }; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/freescale/imx8qm.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/freescale/imx8qm.dtsi @@ -193,7 +193,7 @@ }; clk: clock-controller { + compatible = "fsl,imx8qxp-clk", "fsl,scu-clk"; - compatible = "fsl,imx8qm-clk", "fsl,scu-clk"; #clock-cells = <2>; }; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ linux-oem-5.17-5.17.0.orig/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -1459,8 +1459,6 @@ "imem", "config"; - qcom,qmp = <&aoss_qmp>; - qcom,smem-states = <&ipa_smp2p_out 0>, <&ipa_smp2p_out 1>; qcom,smem-state-names = "ipa-clock-enabled-valid", diff -u linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sc7280.dtsi linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sc7280.dtsi --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -1714,8 +1714,6 @@ interconnect-names = "memory", "config"; - qcom,qmp = <&aoss_qmp>; - qcom,smem-states = <&ipa_smp2p_out 0>, <&ipa_smp2p_out 1>; qcom,smem-state-names = "ipa-clock-enabled-valid", diff -u linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sm8350.dtsi linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sm8350.dtsi --- linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ linux-oem-5.17-5.17.0/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -1443,8 +1443,6 @@ interconnect-names = "memory", "config"; - qcom,qmp = <&aoss_qmp>; - qcom,smem-states = <&ipa_smp2p_out 0>, <&ipa_smp2p_out 1>; qcom,smem-state-names = "ipa-clock-enabled-valid", reverted: --- linux-oem-5.17-5.17.0/arch/arm64/include/asm/kvm_emulate.h +++ linux-oem-5.17-5.17.0.orig/arch/arm64/include/asm/kvm_emulate.h @@ -43,22 +43,10 @@ void kvm_vcpu_wfi(struct kvm_vcpu *vcpu); -#if defined(__KVM_VHE_HYPERVISOR__) || defined(__KVM_NVHE_HYPERVISOR__) static __always_inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) { return !(vcpu->arch.hcr_el2 & HCR_RW); } -#else -static __always_inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) -{ - struct kvm *kvm = vcpu->kvm; - - WARN_ON_ONCE(!test_bit(KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED, - &kvm->arch.flags)); - - return test_bit(KVM_ARCH_FLAG_EL1_32BIT, &kvm->arch.flags); -} -#endif static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) { @@ -84,14 +72,15 @@ vcpu->arch.hcr_el2 |= HCR_TVM; } + if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) - if (vcpu_el1_is_32bit(vcpu)) vcpu->arch.hcr_el2 &= ~HCR_RW; + + /* + * TID3: trap feature register accesses that we virtualise. + * For now this is conditional, since no AArch32 feature regs + * are currently virtualised. + */ + if (!vcpu_el1_is_32bit(vcpu)) - else - /* - * TID3: trap feature register accesses that we virtualise. - * For now this is conditional, since no AArch32 feature regs - * are currently virtualised. - */ vcpu->arch.hcr_el2 |= HCR_TID3; if (cpus_have_const_cap(ARM64_MISMATCHED_CACHE_TYPE) || diff -u linux-oem-5.17-5.17.0/arch/arm64/include/asm/kvm_host.h linux-oem-5.17-5.17.0/arch/arm64/include/asm/kvm_host.h --- linux-oem-5.17-5.17.0/arch/arm64/include/asm/kvm_host.h +++ linux-oem-5.17-5.17.0/arch/arm64/include/asm/kvm_host.h @@ -122,22 +122,7 @@ * should) opt in to this feature if KVM_CAP_ARM_NISV_TO_USER is * supported. */ -#define KVM_ARCH_FLAG_RETURN_NISV_IO_ABORT_TO_USER 0 - /* Memory Tagging Extension enabled for the guest */ -#define KVM_ARCH_FLAG_MTE_ENABLED 1 - /* At least one vCPU has ran in the VM */ -#define KVM_ARCH_FLAG_HAS_RAN_ONCE 2 - /* - * The following two bits are used to indicate the guest's EL1 - * register width configuration. A value of KVM_ARCH_FLAG_EL1_32BIT - * bit is valid only when KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED is set. - * Otherwise, the guest's EL1 register width has not yet been - * determined yet. - */ -#define KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED 3 -#define KVM_ARCH_FLAG_EL1_32BIT 4 - - unsigned long flags; + bool return_nisv_io_abort_to_user; /* * VM-wide PMU filter, implemented as a bitmap and big enough for @@ -148,6 +133,10 @@ u8 pfr0_csv2; u8 pfr0_csv3; + + /* Memory Tagging Extension enabled for the guest */ + bool mte_enabled; + bool ran_once; }; struct kvm_vcpu_fault_info { @@ -803,9 +792,7 @@ #define kvm_arm_vcpu_sve_finalized(vcpu) \ ((vcpu)->arch.flags & KVM_ARM64_VCPU_SVE_FINALIZED) -#define kvm_has_mte(kvm) \ - (system_supports_mte() && \ - test_bit(KVM_ARCH_FLAG_MTE_ENABLED, &(kvm)->arch.flags)) +#define kvm_has_mte(kvm) (system_supports_mte() && (kvm)->arch.mte_enabled) #define kvm_vcpu_has_pmu(vcpu) \ (test_bit(KVM_ARM_VCPU_PMU_V3, (vcpu)->arch.features)) reverted: --- linux-oem-5.17-5.17.0/arch/arm64/include/asm/pgtable.h +++ linux-oem-5.17-5.17.0.orig/arch/arm64/include/asm/pgtable.h @@ -535,7 +535,7 @@ PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_leaf(pmd) pmd_sect(pmd) -#define pmd_leaf(pmd) (pmd_present(pmd) && !pmd_table(pmd)) #define pmd_bad(pmd) (!pmd_table(pmd)) #define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE) @@ -625,7 +625,7 @@ #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!pud_table(pud)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_leaf(pud) pud_sect(pud) -#define pud_leaf(pud) (pud_present(pud) && !pud_table(pud)) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) reverted: --- linux-oem-5.17-5.17.0/arch/arm64/kernel/alternative.c +++ linux-oem-5.17-5.17.0.orig/arch/arm64/kernel/alternative.c @@ -42,7 +42,7 @@ /* * Check if the target PC is within an alternative block. */ +static bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) -static __always_inline bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) { unsigned long replptr = (unsigned long)ALT_REPL_PTR(alt); return !(pc >= replptr && pc <= (replptr + alt->alt_len)); @@ -50,7 +50,7 @@ #define align_down(x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1)) +static u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnptr) -static __always_inline u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnptr) { u32 insn; @@ -95,7 +95,7 @@ return insn; } +static void patch_alternative(struct alt_instr *alt, -static noinstr void patch_alternative(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst) { __le32 *replptr; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/kernel/cpuidle.c +++ linux-oem-5.17-5.17.0.orig/arch/arm64/kernel/cpuidle.c @@ -54,9 +54,6 @@ struct acpi_lpi_state *lpi; struct acpi_processor *pr = per_cpu(processors, cpu); - if (unlikely(!pr || !pr->flags.has_lpi)) - return -EINVAL; - /* * If the PSCI cpu_suspend function hook has not been initialized * idle states must not be enabled, so bail out @@ -64,6 +61,9 @@ if (!psci_ops.cpu_suspend) return -EOPNOTSUPP; + if (unlikely(!pr || !pr->flags.has_lpi)) + return -EINVAL; + count = pr->power.count - 1; if (count <= 0) return -ENODEV; diff -u linux-oem-5.17-5.17.0/arch/arm64/kvm/arm.c linux-oem-5.17-5.17.0/arch/arm64/kvm/arm.c --- linux-oem-5.17-5.17.0/arch/arm64/kvm/arm.c +++ linux-oem-5.17-5.17.0/arch/arm64/kvm/arm.c @@ -89,8 +89,7 @@ switch (cap->cap) { case KVM_CAP_ARM_NISV_TO_USER: r = 0; - set_bit(KVM_ARCH_FLAG_RETURN_NISV_IO_ABORT_TO_USER, - &kvm->arch.flags); + kvm->arch.return_nisv_io_abort_to_user = true; break; case KVM_CAP_ARM_MTE: mutex_lock(&kvm->lock); @@ -98,7 +97,7 @@ r = -EINVAL; } else { r = 0; - set_bit(KVM_ARCH_FLAG_MTE_ENABLED, &kvm->arch.flags); + kvm->arch.mte_enabled = true; } mutex_unlock(&kvm->lock); break; @@ -636,7 +635,7 @@ kvm_call_hyp_nvhe(__pkvm_vcpu_init_traps, vcpu); mutex_lock(&kvm->lock); - set_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags); + kvm->arch.ran_once = true; mutex_unlock(&kvm->lock); return ret; reverted: --- linux-oem-5.17-5.17.0/arch/arm64/kvm/mmio.c +++ linux-oem-5.17-5.17.0.orig/arch/arm64/kvm/mmio.c @@ -135,8 +135,7 @@ * volunteered to do so, and bail out otherwise. */ if (!kvm_vcpu_dabt_isvalid(vcpu)) { + if (vcpu->kvm->arch.return_nisv_io_abort_to_user) { - if (test_bit(KVM_ARCH_FLAG_RETURN_NISV_IO_ABORT_TO_USER, - &vcpu->kvm->arch.flags)) { run->exit_reason = KVM_EXIT_ARM_NISV; run->arm_nisv.esr_iss = kvm_vcpu_dabt_iss_nisv_sanitized(vcpu); run->arm_nisv.fault_ipa = fault_ipa; diff -u linux-oem-5.17-5.17.0/arch/arm64/kvm/pmu-emul.c linux-oem-5.17-5.17.0/arch/arm64/kvm/pmu-emul.c --- linux-oem-5.17-5.17.0/arch/arm64/kvm/pmu-emul.c +++ linux-oem-5.17-5.17.0/arch/arm64/kvm/pmu-emul.c @@ -982,7 +982,7 @@ mutex_lock(&kvm->lock); - if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags)) { + if (kvm->arch.ran_once) { mutex_unlock(&kvm->lock); return -EBUSY; } reverted: --- linux-oem-5.17-5.17.0/arch/arm64/kvm/reset.c +++ linux-oem-5.17-5.17.0.orig/arch/arm64/kvm/reset.c @@ -181,51 +181,27 @@ return 0; } +static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu) -/** - * kvm_set_vm_width() - set the register width for the guest - * @vcpu: Pointer to the vcpu being configured - * - * Set both KVM_ARCH_FLAG_EL1_32BIT and KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED - * in the VM flags based on the vcpu's requested register width, the HW - * capabilities and other options (such as MTE). - * When REG_WIDTH_CONFIGURED is already set, the vcpu settings must be - * consistent with the value of the FLAG_EL1_32BIT bit in the flags. - * - * Return: 0 on success, negative error code on failure. - */ -static int kvm_set_vm_width(struct kvm_vcpu *vcpu) { + struct kvm_vcpu *tmp; - struct kvm *kvm = vcpu->kvm; bool is32bit; + unsigned long i; is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT); - - lockdep_assert_held(&kvm->lock); - - if (test_bit(KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED, &kvm->arch.flags)) { - /* - * The guest's register width is already configured. - * Make sure that the vcpu is consistent with it. - */ - if (is32bit == test_bit(KVM_ARCH_FLAG_EL1_32BIT, &kvm->arch.flags)) - return 0; - - return -EINVAL; - } - if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1) && is32bit) + return false; - return -EINVAL; /* MTE is incompatible with AArch32 */ + if (kvm_has_mte(vcpu->kvm) && is32bit) + return false; - if (kvm_has_mte(kvm) && is32bit) - return -EINVAL; + /* Check that the vcpus are either all 32bit or all 64bit */ + kvm_for_each_vcpu(i, tmp, vcpu->kvm) { + if (vcpu_has_feature(tmp, KVM_ARM_VCPU_EL1_32BIT) != is32bit) + return false; + } - if (is32bit) - set_bit(KVM_ARCH_FLAG_EL1_32BIT, &kvm->arch.flags); + return true; - set_bit(KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED, &kvm->arch.flags); - - return 0; } /** @@ -254,16 +230,10 @@ u32 pstate; mutex_lock(&vcpu->kvm->lock); + reset_state = vcpu->arch.reset_state; + WRITE_ONCE(vcpu->arch.reset_state.reset, false); - ret = kvm_set_vm_width(vcpu); - if (!ret) { - reset_state = vcpu->arch.reset_state; - WRITE_ONCE(vcpu->arch.reset_state.reset, false); - } mutex_unlock(&vcpu->kvm->lock); - if (ret) - return ret; - /* Reset PMU outside of the non-preemptible section */ kvm_pmu_vcpu_reset(vcpu); @@ -290,9 +260,14 @@ } } + if (!vcpu_allowed_register_width(vcpu)) { + ret = -EINVAL; + goto out; + } + switch (vcpu->arch.target) { default: + if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { - if (vcpu_el1_is_32bit(vcpu)) { pstate = VCPU_RESET_PSTATE_SVC; } else { pstate = VCPU_RESET_PSTATE_EL1; reverted: --- linux-oem-5.17-5.17.0/arch/mips/include/asm/timex.h +++ linux-oem-5.17-5.17.0.orig/arch/mips/include/asm/timex.h @@ -40,9 +40,9 @@ typedef unsigned int cycles_t; /* + * On R4000/R4400 before version 5.0 an erratum exists such that if the + * cycle counter is read in the exact moment that it is matching the + * compare register, no interrupt will be generated. - * On R4000/R4400 an erratum exists such that if the cycle counter is - * read in the exact moment that it is matching the compare register, - * no interrupt will be generated. * * There is a suggested workaround and also the erratum can't strike if * the compare interrupt isn't being used as the clock source device. @@ -63,7 +63,7 @@ if (!__builtin_constant_p(cpu_has_counter)) asm volatile("" : "=m" (cpu_data[0].options)); if (likely(cpu_has_counter && + prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0)))) - prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15)))) return 1; else return 0; reverted: --- linux-oem-5.17-5.17.0/arch/mips/kernel/time.c +++ linux-oem-5.17-5.17.0.orig/arch/mips/kernel/time.c @@ -141,10 +141,15 @@ case CPU_R4400MC: /* * The published errata for the R4400 up to 3.0 say the CPU + * has the mfc0 from count bug. - * has the mfc0 from count bug. This seems the last version - * produced. */ + if ((current_cpu_data.processor_id & 0xff) <= 0x30) + return 1; + + /* + * we assume newer revisions are ok + */ + return 0; - return 1; } return 0; reverted: --- linux-oem-5.17-5.17.0/arch/parisc/kernel/processor.c +++ linux-oem-5.17-5.17.0.orig/arch/parisc/kernel/processor.c @@ -418,7 +418,8 @@ } seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); + seq_printf(m, "model\t\t: %s\n" + "model name\t: %s\n", - seq_printf(m, "model\t\t: %s - %s\n", boot_cpu_data.pdc.sys_model_name, cpuinfo->dev ? cpuinfo->dev->name : "Unknown"); reverted: --- linux-oem-5.17-5.17.0/arch/parisc/kernel/setup.c +++ linux-oem-5.17-5.17.0.orig/arch/parisc/kernel/setup.c @@ -161,8 +161,6 @@ #ifdef CONFIG_PA11 dma_ops_init(); #endif - - clear_sched_clock_stable(); } /* reverted: --- linux-oem-5.17-5.17.0/arch/parisc/kernel/time.c +++ linux-oem-5.17-5.17.0.orig/arch/parisc/kernel/time.c @@ -249,9 +249,13 @@ static int __init init_cr16_clocksource(void) { /* + * The cr16 interval timers are not syncronized across CPUs, even if + * they share the same socket. - * The cr16 interval timers are not synchronized across CPUs. */ if (num_online_cpus() > 1 && !running_on_qemu) { + /* mark sched_clock unstable */ + clear_sched_clock_stable(); + clocksource_cr16.name = "cr16_unstable"; clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE; clocksource_cr16.rating = 0; reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/include/asm/static_call.h +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/include/asm/static_call.h @@ -24,6 +24,5 @@ #define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) __PPC_SCT(name, "b " #func) #define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) __PPC_SCT(name, "blr") -#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) __PPC_SCT(name, "b .+20") #endif /* _ASM_POWERPC_STATIC_CALL_H */ reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/kernel/reloc_64.S +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/kernel/reloc_64.S @@ -8,10 +8,8 @@ #include RELA = 7 +RELACOUNT = 0x6ffffff9 -RELASZ = 8 -RELAENT = 9 R_PPC64_RELATIVE = 22 -R_PPC64_UADDR64 = 43 /* * r3 = desired final address of kernel @@ -27,38 +25,29 @@ add r9,r9,r12 /* r9 has runtime addr of .rela.dyn section */ ld r10,(p_st - 0b)(r12) add r10,r10,r12 /* r10 has runtime addr of _stext */ - ld r13,(p_sym - 0b)(r12) - add r13,r13,r12 /* r13 has runtime addr of .dynsym */ /* + * Scan the dynamic section for the RELA and RELACOUNT entries. - * Scan the dynamic section for the RELA, RELASZ and RELAENT entries. */ li r7,0 li r8,0 +1: ld r6,0(r11) /* get tag */ -.Ltags: - ld r6,0(r11) /* get tag */ cmpdi r6,0 + beq 4f /* end of list */ - beq .Lend_of_list /* end of list */ cmpdi r6,RELA bne 2f ld r7,8(r11) /* get RELA pointer in r7 */ + b 3f +2: addis r6,r6,(-RELACOUNT)@ha + cmpdi r6,RELACOUNT@l - b 4f -2: cmpdi r6,RELASZ bne 3f + ld r8,8(r11) /* get RELACOUNT value in r8 */ +3: addi r11,r11,16 + b 1b +4: cmpdi r7,0 /* check we have both RELA and RELACOUNT */ - ld r8,8(r11) /* get RELASZ value in r8 */ - b 4f -3: cmpdi r6,RELAENT - bne 4f - ld r12,8(r11) /* get RELAENT value in r12 */ -4: addi r11,r11,16 - b .Ltags -.Lend_of_list: - cmpdi r7,0 /* check we have RELA, RELASZ, RELAENT */ cmpdi cr1,r8,0 + beq 6f + beq cr1,6f - beq .Lout - beq cr1,.Lout - cmpdi r12,0 - beq .Lout /* * Work out linktime address of _stext and hence the @@ -73,39 +62,23 @@ /* * Run through the list of relocations and process the + * R_PPC64_RELATIVE ones. - * R_PPC64_RELATIVE and R_PPC64_UADDR64 ones. */ - divd r8,r8,r12 /* RELASZ / RELAENT */ mtctr r8 +5: ld r0,8(9) /* ELF64_R_TYPE(reloc->r_info) */ -.Lrels: ld r0,8(r9) /* ELF64_R_TYPE(reloc->r_info) */ cmpdi r0,R_PPC64_RELATIVE + bne 6f - bne .Luaddr64 ld r6,0(r9) /* reloc->r_offset */ ld r0,16(r9) /* reloc->r_addend */ - b .Lstore -.Luaddr64: - srdi r14,r0,32 /* ELF64_R_SYM(reloc->r_info) */ - clrldi r0,r0,32 - cmpdi r0,R_PPC64_UADDR64 - bne .Lnext - ld r6,0(r9) - ld r0,16(r9) - mulli r14,r14,24 /* 24 == sizeof(elf64_sym) */ - add r14,r14,r13 /* elf64_sym[ELF64_R_SYM] */ - ld r14,8(r14) - add r0,r0,r14 -.Lstore: add r0,r0,r3 stdx r0,r7,r6 + addi r9,r9,24 + bdnz 5b + +6: blr -.Lnext: - add r9,r9,r12 - bdnz .Lrels -.Lout: - blr .balign 8 p_dyn: .8byte __dynamic_start - 0b p_rela: .8byte __rela_dyn_start - 0b -p_sym: .8byte __dynamic_symtab - 0b p_st: .8byte _stext - 0b diff -u linux-oem-5.17-5.17.0/arch/powerpc/kernel/time.c linux-oem-5.17-5.17.0/arch/powerpc/kernel/time.c --- linux-oem-5.17-5.17.0/arch/powerpc/kernel/time.c +++ linux-oem-5.17-5.17.0/arch/powerpc/kernel/time.c @@ -610,22 +610,23 @@ return; } - /* - * Ensure a positive value is written to the decrementer, or - * else some CPUs will continue to take decrementer exceptions. - * When the PPC_WATCHDOG (decrementer based) is configured, - * keep this at most 31 bits, which is about 4 seconds on most - * systems, which gives the watchdog a chance of catching timer - * interrupt hard lockups. - */ - if (IS_ENABLED(CONFIG_PPC_WATCHDOG)) - set_dec(0x7fffffff); - else - set_dec(decrementer_max); - /* Conditionally hard-enable interrupts. */ - if (should_hard_irq_enable()) + if (should_hard_irq_enable()) { + /* + * Ensure a positive value is written to the decrementer, or + * else some CPUs will continue to take decrementer exceptions. + * When the PPC_WATCHDOG (decrementer based) is configured, + * keep this at most 31 bits, which is about 4 seconds on most + * systems, which gives the watchdog a chance of catching timer + * interrupt hard lockups. + */ + if (IS_ENABLED(CONFIG_PPC_WATCHDOG)) + set_dec(0x7fffffff); + else + set_dec(decrementer_max); + do_hard_irq_enable(); + } #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) if (atomic_read(&ppc_n_lost_interrupts) != 0) reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/kernel/vmlinux.lds.S +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/kernel/vmlinux.lds.S @@ -281,7 +281,9 @@ . = ALIGN(8); .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { +#ifdef CONFIG_PPC32 __dynamic_symtab = .; +#endif *(.dynsym) } .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) } reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_64_vio.c +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/kvm/book3s_64_vio.c @@ -420,19 +420,13 @@ tbl[idx % TCES_PER_PAGE] = tce; } +static void kvmppc_clear_tce(struct mm_struct *mm, struct iommu_table *tbl, + unsigned long entry) -static void kvmppc_clear_tce(struct mm_struct *mm, struct kvmppc_spapr_tce_table *stt, - struct iommu_table *tbl, unsigned long entry) { + unsigned long hpa = 0; + enum dma_data_direction dir = DMA_NONE; - unsigned long i; - unsigned long subpages = 1ULL << (stt->page_shift - tbl->it_page_shift); - unsigned long io_entry = entry << (stt->page_shift - tbl->it_page_shift); - - for (i = 0; i < subpages; ++i) { - unsigned long hpa = 0; - enum dma_data_direction dir = DMA_NONE; + iommu_tce_xchg_no_kill(mm, tbl, entry, &hpa, &dir); - iommu_tce_xchg_no_kill(mm, tbl, io_entry + i, &hpa, &dir); - } } static long kvmppc_tce_iommu_mapped_dec(struct kvm *kvm, @@ -491,8 +485,6 @@ break; } - iommu_tce_kill(tbl, io_entry, subpages); - return ret; } @@ -552,8 +544,6 @@ break; } - iommu_tce_kill(tbl, io_entry, subpages); - return ret; } @@ -600,9 +590,10 @@ ret = kvmppc_tce_iommu_map(vcpu->kvm, stt, stit->tbl, entry, ua, dir); + iommu_tce_kill(stit->tbl, entry, 1); if (ret != H_SUCCESS) { + kvmppc_clear_tce(vcpu->kvm->mm, stit->tbl, entry); - kvmppc_clear_tce(vcpu->kvm->mm, stt, stit->tbl, entry); goto unlock_exit; } } @@ -678,13 +669,13 @@ */ if (get_user(tce, tces + i)) { ret = H_TOO_HARD; + goto invalidate_exit; - goto unlock_exit; } tce = be64_to_cpu(tce); if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua)) { ret = H_PARAMETER; + goto invalidate_exit; - goto unlock_exit; } list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { @@ -693,15 +684,19 @@ iommu_tce_direction(tce)); if (ret != H_SUCCESS) { + kvmppc_clear_tce(vcpu->kvm->mm, stit->tbl, + entry); + goto invalidate_exit; - kvmppc_clear_tce(vcpu->kvm->mm, stt, stit->tbl, - entry + i); - goto unlock_exit; } } kvmppc_tce_put(stt, entry + i, tce); } +invalidate_exit: + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) + iommu_tce_kill(stit->tbl, entry, npages); + unlock_exit: srcu_read_unlock(&vcpu->kvm->srcu, idx); @@ -740,16 +735,20 @@ continue; if (ret == H_TOO_HARD) + goto invalidate_exit; - return ret; WARN_ON_ONCE(1); + kvmppc_clear_tce(vcpu->kvm->mm, stit->tbl, entry); - kvmppc_clear_tce(vcpu->kvm->mm, stt, stit->tbl, entry + i); } } for (i = 0; i < npages; ++i, ioba += (1ULL << stt->page_shift)) kvmppc_tce_put(stt, ioba >> stt->page_shift, tce_value); +invalidate_exit: + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) + iommu_tce_kill(stit->tbl, ioba >> stt->page_shift, npages); + return ret; } EXPORT_SYMBOL_GPL(kvmppc_h_stuff_tce); reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_64_vio_hv.c +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/kvm/book3s_64_vio_hv.c @@ -247,19 +247,13 @@ tbl->it_ops->tce_kill(tbl, entry, pages, true); } +static void kvmppc_rm_clear_tce(struct kvm *kvm, struct iommu_table *tbl, + unsigned long entry) -static void kvmppc_rm_clear_tce(struct kvm *kvm, struct kvmppc_spapr_tce_table *stt, - struct iommu_table *tbl, unsigned long entry) { + unsigned long hpa = 0; + enum dma_data_direction dir = DMA_NONE; - unsigned long i; - unsigned long subpages = 1ULL << (stt->page_shift - tbl->it_page_shift); - unsigned long io_entry = entry << (stt->page_shift - tbl->it_page_shift); - - for (i = 0; i < subpages; ++i) { - unsigned long hpa = 0; - enum dma_data_direction dir = DMA_NONE; + iommu_tce_xchg_no_kill_rm(kvm->mm, tbl, entry, &hpa, &dir); - iommu_tce_xchg_no_kill_rm(kvm->mm, tbl, io_entry + i, &hpa, &dir); - } } static long kvmppc_rm_tce_iommu_mapped_dec(struct kvm *kvm, @@ -322,8 +316,6 @@ break; } - iommu_tce_kill_rm(tbl, io_entry, subpages); - return ret; } @@ -387,8 +379,6 @@ break; } - iommu_tce_kill_rm(tbl, io_entry, subpages); - return ret; } @@ -430,8 +420,10 @@ ret = kvmppc_rm_tce_iommu_map(vcpu->kvm, stt, stit->tbl, entry, ua, dir); + iommu_tce_kill_rm(stit->tbl, entry, 1); + if (ret != H_SUCCESS) { + kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, entry); - kvmppc_rm_clear_tce(vcpu->kvm, stt, stit->tbl, entry); return ret; } } @@ -569,7 +561,7 @@ ua = 0; if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce, &ua)) { ret = H_PARAMETER; + goto invalidate_exit; - goto unlock_exit; } list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { @@ -578,15 +570,19 @@ iommu_tce_direction(tce)); if (ret != H_SUCCESS) { + kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, + entry); + goto invalidate_exit; - kvmppc_rm_clear_tce(vcpu->kvm, stt, stit->tbl, - entry + i); - goto unlock_exit; } } kvmppc_rm_tce_put(stt, entry + i, tce); } +invalidate_exit: + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) + iommu_tce_kill_rm(stit->tbl, entry, npages); + unlock_exit: if (!prereg) arch_spin_unlock(&kvm->mmu_lock.rlock.raw_lock); @@ -624,16 +620,20 @@ continue; if (ret == H_TOO_HARD) + goto invalidate_exit; - return ret; WARN_ON_ONCE_RM(1); + kvmppc_rm_clear_tce(vcpu->kvm, stit->tbl, entry); - kvmppc_rm_clear_tce(vcpu->kvm, stt, stit->tbl, entry + i); } } for (i = 0; i < npages; ++i, ioba += (1ULL << stt->page_shift)) kvmppc_rm_tce_put(stt, ioba >> stt->page_shift, tce_value); +invalidate_exit: + list_for_each_entry_lockless(stit, &stt->iommu_tables, next) + iommu_tce_kill_rm(stit->tbl, ioba >> stt->page_shift, npages); + return ret; } diff -u linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_hv.c linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_hv.c --- linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_hv.c +++ linux-oem-5.17-5.17.0/arch/powerpc/kvm/book3s_hv.c @@ -225,13 +225,6 @@ int cpu; struct rcuwait *waitp; - /* - * rcuwait_wake_up contains smp_mb() which orders prior stores that - * create pending work vs below loads of cpu fields. The other side - * is the barrier in vcpu run that orders setting the cpu fields vs - * testing for pending work. - */ - waitp = kvm_arch_vcpu_get_wait(vcpu); if (rcuwait_wake_up(waitp)) ++vcpu->stat.generic.halt_wakeup; @@ -1096,7 +1089,7 @@ break; } tvcpu->arch.prodded = 1; - smp_mb(); /* This orders prodded store vs ceded load */ + smp_mb(); if (tvcpu->arch.ceded) kvmppc_fast_vcpu_kick_hv(tvcpu); break; @@ -3778,14 +3771,6 @@ pvc = core_info.vc[sub]; pvc->pcpu = pcpu + thr; for_each_runnable_thread(i, vcpu, pvc) { - /* - * XXX: is kvmppc_start_thread called too late here? - * It updates vcpu->cpu and vcpu->arch.thread_cpu - * which are used by kvmppc_fast_vcpu_kick_hv(), but - * kick is called after new exceptions become available - * and exceptions are checked earlier than here, by - * kvmppc_core_prepare_to_enter. - */ kvmppc_start_thread(vcpu, pvc); kvmppc_create_dtl_entry(vcpu, pvc); trace_kvm_guest_enter(vcpu); @@ -4507,21 +4492,6 @@ if (need_resched() || !kvm->arch.mmu_ready) goto out; - vcpu->cpu = pcpu; - vcpu->arch.thread_cpu = pcpu; - vc->pcpu = pcpu; - local_paca->kvm_hstate.kvm_vcpu = vcpu; - local_paca->kvm_hstate.ptid = 0; - local_paca->kvm_hstate.fake_suspend = 0; - - /* - * Orders set cpu/thread_cpu vs testing for pending interrupts and - * doorbells below. The other side is when these fields are set vs - * kvmppc_fast_vcpu_kick_hv reading the cpu/thread_cpu fields to - * kick a vCPU to notice the pending interrupt. - */ - smp_mb(); - if (!nested) { kvmppc_core_prepare_to_enter(vcpu); if (test_bit(BOOK3S_IRQPRIO_EXTERNAL, @@ -4541,6 +4511,13 @@ tb = mftb(); + vcpu->cpu = pcpu; + vcpu->arch.thread_cpu = pcpu; + vc->pcpu = pcpu; + local_paca->kvm_hstate.kvm_vcpu = vcpu; + local_paca->kvm_hstate.ptid = 0; + local_paca->kvm_hstate.fake_suspend = 0; + __kvmppc_create_dtl_entry(vcpu, pcpu, tb + vc->tb_offset, 0); trace_kvm_guest_enter(vcpu); @@ -4642,8 +4619,6 @@ run->exit_reason = KVM_EXIT_INTR; vcpu->arch.ret = -EINTR; out: - vcpu->cpu = -1; - vcpu->arch.thread_cpu = -1; powerpc_local_irq_pmu_restore(flags); preempt_enable(); goto done; reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/perf/Makefile +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/perf/Makefile @@ -3,11 +3,11 @@ obj-y += callchain.o callchain_$(BITS).o perf_regs.o obj-$(CONFIG_COMPAT) += callchain_32.o +obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o bhrb.o -obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o obj64-$(CONFIG_PPC_PERF_CTRS) += ppc970-pmu.o power5-pmu.o \ power5+-pmu.o power6-pmu.o power7-pmu.o \ isa207-common.o power8-pmu.o power9-pmu.o \ + generic-compat-pmu.o power10-pmu.o - generic-compat-pmu.o power10-pmu.o bhrb.o obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o obj-$(CONFIG_PPC_POWERNV) += imc-pmu.o reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/perf/power10-pmu.c +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/perf/power10-pmu.c @@ -91,8 +91,8 @@ /* Table of alternatives, sorted by column 0 */ static const unsigned int power10_event_alternatives[][MAX_ALT] = { + { PM_CYC_ALT, PM_CYC }, { PM_INST_CMPL_ALT, PM_INST_CMPL }, - { PM_CYC_ALT, PM_CYC }, }; static int power10_get_alternatives(u64 event, unsigned int flags, u64 alt[]) reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/perf/power9-pmu.c +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/perf/power9-pmu.c @@ -133,11 +133,11 @@ /* Table of alternatives, sorted by column 0 */ static const unsigned int power9_event_alternatives[][MAX_ALT] = { + { PM_INST_DISP, PM_INST_DISP_ALT }, + { PM_RUN_CYC_ALT, PM_RUN_CYC }, + { PM_RUN_INST_CMPL_ALT, PM_RUN_INST_CMPL }, + { PM_LD_MISS_L1, PM_LD_MISS_L1_ALT }, { PM_BR_2PATH, PM_BR_2PATH_ALT }, - { PM_INST_DISP, PM_INST_DISP_ALT }, - { PM_RUN_CYC_ALT, PM_RUN_CYC }, - { PM_LD_MISS_L1, PM_LD_MISS_L1_ALT }, - { PM_RUN_INST_CMPL_ALT, PM_RUN_INST_CMPL }, }; static int power9_get_alternatives(u64 event, unsigned int flags, u64 alt[]) reverted: --- linux-oem-5.17-5.17.0/arch/powerpc/tools/relocs_check.sh +++ linux-oem-5.17-5.17.0.orig/arch/powerpc/tools/relocs_check.sh @@ -39,7 +39,6 @@ # R_PPC_NONE grep -F -w -v 'R_PPC64_RELATIVE R_PPC64_NONE -R_PPC64_UADDR64 R_PPC_ADDR16_LO R_PPC_ADDR16_HI R_PPC_ADDR16_HA @@ -55,3 +54,9 @@ num_bad=$(echo "$bad_relocs" | wc -l) echo "WARNING: $num_bad bad relocations" echo "$bad_relocs" + +# If we see this type of relocation it's an idication that +# we /may/ be using an old version of binutils. +if echo "$bad_relocs" | grep -q -F -w R_PPC64_UADDR64; then + echo "WARNING: You need at least binutils >= 2.19 to build a CONFIG_RELOCATABLE kernel" +fi reverted: --- linux-oem-5.17-5.17.0/arch/riscv/kernel/patch.c +++ linux-oem-5.17-5.17.0.orig/arch/riscv/kernel/patch.c @@ -104,7 +104,7 @@ struct patch_insn *patch = data; int ret = 0; + if (atomic_inc_return(&patch->cpu_count) == 1) { - if (atomic_inc_return(&patch->cpu_count) == num_online_cpus()) { ret = patch_text_nosync(patch->addr, &patch->insn, GET_INSN_LENGTH(patch->insn)); reverted: --- linux-oem-5.17-5.17.0/arch/riscv/kvm/vcpu.c +++ linux-oem-5.17-5.17.0.orig/arch/riscv/kvm/vcpu.c @@ -38,16 +38,14 @@ sizeof(kvm_vcpu_stats_desc), }; +#define KVM_RISCV_ISA_ALLOWED (riscv_isa_extension_mask(a) | \ + riscv_isa_extension_mask(c) | \ + riscv_isa_extension_mask(d) | \ + riscv_isa_extension_mask(f) | \ + riscv_isa_extension_mask(i) | \ + riscv_isa_extension_mask(m) | \ + riscv_isa_extension_mask(s) | \ + riscv_isa_extension_mask(u)) -#define KVM_RISCV_ISA_DISABLE_ALLOWED (riscv_isa_extension_mask(d) | \ - riscv_isa_extension_mask(f)) - -#define KVM_RISCV_ISA_DISABLE_NOT_ALLOWED (riscv_isa_extension_mask(a) | \ - riscv_isa_extension_mask(c) | \ - riscv_isa_extension_mask(i) | \ - riscv_isa_extension_mask(m)) - -#define KVM_RISCV_ISA_ALLOWED (KVM_RISCV_ISA_DISABLE_ALLOWED | \ - KVM_RISCV_ISA_DISABLE_NOT_ALLOWED) static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu) { @@ -221,8 +219,7 @@ switch (reg_num) { case KVM_REG_RISCV_CONFIG_REG(isa): if (!vcpu->arch.ran_atleast_once) { + vcpu->arch.isa = reg_val; - /* Ignore the disable request for these extensions */ - vcpu->arch.isa = reg_val | KVM_RISCV_ISA_DISABLE_NOT_ALLOWED; vcpu->arch.isa &= riscv_isa_extension_base(NULL); vcpu->arch.isa &= KVM_RISCV_ISA_ALLOWED; kvm_riscv_vcpu_fp_reset(vcpu); @@ -656,6 +653,8 @@ vcpu->arch.isa); kvm_riscv_vcpu_host_fp_restore(&vcpu->arch.host_context); + csr_write(CSR_HGATP, 0); + csr->vsstatus = csr_read(CSR_VSSTATUS); csr->vsie = csr_read(CSR_VSIE); csr->vstvec = csr_read(CSR_VSTVEC); reverted: --- linux-oem-5.17-5.17.0/arch/riscv/kvm/vcpu_fp.c +++ linux-oem-5.17-5.17.0.orig/arch/riscv/kvm/vcpu_fp.c @@ -11,7 +11,6 @@ #include #include #include -#include #ifdef CONFIG_FPU void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu) reverted: --- linux-oem-5.17-5.17.0/arch/riscv/mm/init.c +++ linux-oem-5.17-5.17.0.orig/arch/riscv/mm/init.c @@ -206,25 +206,8 @@ * early_init_fdt_reserve_self() since __pa() does * not work for DTB pointers that are fixmap addresses */ + if (!IS_ENABLED(CONFIG_BUILTIN_DTB)) + memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); - if (!IS_ENABLED(CONFIG_BUILTIN_DTB)) { - /* - * In case the DTB is not located in a memory region we won't - * be able to locate it later on via the linear mapping and - * get a segfault when accessing it via __va(dtb_early_pa). - * To avoid this situation copy DTB to a memory region. - * Note that memblock_phys_alloc will also reserve DTB region. - */ - if (!memblock_is_memory(dtb_early_pa)) { - size_t fdt_size = fdt_totalsize(dtb_early_va); - phys_addr_t new_dtb_early_pa = memblock_phys_alloc(fdt_size, PAGE_SIZE); - void *new_dtb_early_va = early_memremap(new_dtb_early_pa, fdt_size); - - memcpy(new_dtb_early_va, dtb_early_va, fdt_size); - early_memunmap(new_dtb_early_va, fdt_size); - _dtb_early_pa = new_dtb_early_pa; - } else - memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); - } early_init_fdt_scan_reserved_mem(); dma_contiguous_reserve(dma32_phys_limit); reverted: --- linux-oem-5.17-5.17.0/arch/x86/include/asm/compat.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/include/asm/compat.h @@ -28,13 +28,15 @@ typedef __kernel_fsid_t compat_fsid_t; struct compat_stat { + compat_dev_t st_dev; + u16 __pad1; - u32 st_dev; compat_ino_t st_ino; compat_mode_t st_mode; compat_nlink_t st_nlink; __compat_uid_t st_uid; __compat_gid_t st_gid; + compat_dev_t st_rdev; + u16 __pad2; - u32 st_rdev; u32 st_size; u32 st_blksize; u32 st_blocks; diff -u linux-oem-5.17-5.17.0/arch/x86/include/asm/kvm_host.h linux-oem-5.17-5.17.0/arch/x86/include/asm/kvm_host.h --- linux-oem-5.17-5.17.0/arch/x86/include/asm/kvm_host.h +++ linux-oem-5.17-5.17.0/arch/x86/include/asm/kvm_host.h @@ -969,10 +969,12 @@ HV_TSC_PAGE_UNSET = 0, /* TSC page MSR was written by the guest, update pending */ HV_TSC_PAGE_GUEST_CHANGED, - /* TSC page update was triggered from the host side */ + /* TSC page MSR was written by KVM userspace, update pending */ HV_TSC_PAGE_HOST_CHANGED, /* TSC page was properly set up and is currently active */ HV_TSC_PAGE_SET, + /* TSC page is currently being updated and therefore is inactive */ + HV_TSC_PAGE_UPDATING, /* TSC page was set up with an inaccessible GPA */ HV_TSC_PAGE_BROKEN, }; @@ -1572,9 +1574,8 @@ #define kvm_arch_pmi_in_guest(vcpu) \ ((vcpu) && (vcpu)->arch.handling_intr_from_guest) -void kvm_mmu_x86_module_init(void); -int kvm_mmu_vendor_module_init(void); -void kvm_mmu_vendor_module_exit(void); +int kvm_mmu_module_init(void); +void kvm_mmu_module_exit(void); void kvm_mmu_destroy(struct kvm_vcpu *vcpu); int kvm_mmu_create(struct kvm_vcpu *vcpu); reverted: --- linux-oem-5.17-5.17.0/arch/x86/include/asm/microcode.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/include/asm/microcode.h @@ -131,12 +131,10 @@ extern void load_ucode_ap(void); void reload_early_microcode(void); extern bool initrd_gone; -void microcode_bsp_resume(void); #else static inline void __init load_ucode_bsp(void) { } static inline void load_ucode_ap(void) { } static inline void reload_early_microcode(void) { } -static inline void microcode_bsp_resume(void) { } #endif #endif /* _ASM_X86_MICROCODE_H */ reverted: --- linux-oem-5.17-5.17.0/arch/x86/include/asm/msr-index.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/include/asm/msr-index.h @@ -128,9 +128,9 @@ #define TSX_CTRL_RTM_DISABLE BIT(0) /* Disable RTM feature */ #define TSX_CTRL_CPUID_CLEAR BIT(1) /* Disable TSX enumeration */ +/* SRBDS support */ #define MSR_IA32_MCU_OPT_CTRL 0x00000123 +#define RNGDS_MITG_DIS BIT(0) -#define RNGDS_MITG_DIS BIT(0) /* SRBDS support */ -#define RTM_ALLOW BIT(1) /* TSX development mode */ #define MSR_IA32_SYSENTER_CS 0x00000174 #define MSR_IA32_SYSENTER_ESP 0x00000175 reverted: --- linux-oem-5.17-5.17.0/arch/x86/include/asm/static_call.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/include/asm/static_call.h @@ -38,8 +38,6 @@ #define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) \ __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "ret; int3; nop; nop; nop") -#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) \ - ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0) #define ARCH_ADD_TRAMP_KEY(name) \ asm(".pushsection .static_call_tramp_key, \"a\" \n" \ reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/cpu/common.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/cpu/common.c @@ -1719,8 +1719,6 @@ validate_apic_and_package_id(c); x86_spec_ctrl_setup_ap(); update_srbds_msr(); - - tsx_ap_init(); } static __init int setup_noclflush(char *arg) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/cpu/cpu.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/cpu/cpu.h @@ -55,10 +55,11 @@ extern __ro_after_init enum tsx_ctrl_states tsx_ctrl_state; extern void __init tsx_init(void); +extern void tsx_enable(void); +extern void tsx_disable(void); +extern void tsx_clear_cpuid(void); -void tsx_ap_init(void); #else static inline void tsx_init(void) { } -static inline void tsx_ap_init(void) { } #endif /* CONFIG_CPU_SUP_INTEL */ extern void get_cpu_cap(struct cpuinfo_x86 *c); reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/cpu/intel.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/cpu/intel.c @@ -717,6 +717,13 @@ init_intel_misc_features(c); + if (tsx_ctrl_state == TSX_CTRL_ENABLE) + tsx_enable(); + else if (tsx_ctrl_state == TSX_CTRL_DISABLE) + tsx_disable(); + else if (tsx_ctrl_state == TSX_CTRL_RTM_ALWAYS_ABORT) + tsx_clear_cpuid(); + split_lock_init(); bus_lock_init(); reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/cpu/microcode/core.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/cpu/microcode/core.c @@ -758,9 +758,9 @@ }; /** + * mc_bp_resume - Update boot CPU microcode during resume. - * microcode_bsp_resume - Update boot CPU microcode during resume. */ +static void mc_bp_resume(void) -void microcode_bsp_resume(void) { int cpu = smp_processor_id(); struct ucode_cpu_info *uci = ucode_cpu_info + cpu; @@ -772,7 +772,7 @@ } static struct syscore_ops mc_syscore_ops = { + .resume = mc_bp_resume, - .resume = microcode_bsp_resume, }; static int mc_cpu_starting(unsigned int cpu) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/cpu/tsx.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/cpu/tsx.c @@ -19,7 +19,7 @@ enum tsx_ctrl_states tsx_ctrl_state __ro_after_init = TSX_CTRL_NOT_SUPPORTED; +void tsx_disable(void) -static void tsx_disable(void) { u64 tsx; @@ -39,7 +39,7 @@ wrmsrl(MSR_IA32_TSX_CTRL, tsx); } +void tsx_enable(void) -static void tsx_enable(void) { u64 tsx; @@ -58,7 +58,7 @@ wrmsrl(MSR_IA32_TSX_CTRL, tsx); } +static bool __init tsx_ctrl_is_supported(void) -static bool tsx_ctrl_is_supported(void) { u64 ia32_cap = x86_read_arch_cap_msr(); @@ -84,45 +84,7 @@ return TSX_CTRL_ENABLE; } +void tsx_clear_cpuid(void) -/* - * Disabling TSX is not a trivial business. - * - * First of all, there's a CPUID bit: X86_FEATURE_RTM_ALWAYS_ABORT - * which says that TSX is practically disabled (all transactions are - * aborted by default). When that bit is set, the kernel unconditionally - * disables TSX. - * - * In order to do that, however, it needs to dance a bit: - * - * 1. The first method to disable it is through MSR_TSX_FORCE_ABORT and - * the MSR is present only when *two* CPUID bits are set: - * - * - X86_FEATURE_RTM_ALWAYS_ABORT - * - X86_FEATURE_TSX_FORCE_ABORT - * - * 2. The second method is for CPUs which do not have the above-mentioned - * MSR: those use a different MSR - MSR_IA32_TSX_CTRL and disable TSX - * through that one. Those CPUs can also have the initially mentioned - * CPUID bit X86_FEATURE_RTM_ALWAYS_ABORT set and for those the same strategy - * applies: TSX gets disabled unconditionally. - * - * When either of the two methods are present, the kernel disables TSX and - * clears the respective RTM and HLE feature flags. - * - * An additional twist in the whole thing presents late microcode loading - * which, when done, may cause for the X86_FEATURE_RTM_ALWAYS_ABORT CPUID - * bit to be set after the update. - * - * A subsequent hotplug operation on any logical CPU except the BSP will - * cause for the supported CPUID feature bits to get re-detected and, if - * RTM and HLE get cleared all of a sudden, but, userspace did consult - * them before the update, then funny explosions will happen. Long story - * short: the kernel doesn't modify CPUID feature bits after booting. - * - * That's why, this function's call in init_intel() doesn't clear the - * feature flags. - */ -static void tsx_clear_cpuid(void) { u64 msr; @@ -135,39 +97,6 @@ rdmsrl(MSR_TSX_FORCE_ABORT, msr); msr |= MSR_TFA_TSX_CPUID_CLEAR; wrmsrl(MSR_TSX_FORCE_ABORT, msr); - } else if (tsx_ctrl_is_supported()) { - rdmsrl(MSR_IA32_TSX_CTRL, msr); - msr |= TSX_CTRL_CPUID_CLEAR; - wrmsrl(MSR_IA32_TSX_CTRL, msr); - } -} - -/* - * Disable TSX development mode - * - * When the microcode released in Feb 2022 is applied, TSX will be disabled by - * default on some processors. MSR 0x122 (TSX_CTRL) and MSR 0x123 - * (IA32_MCU_OPT_CTRL) can be used to re-enable TSX for development, doing so is - * not recommended for production deployments. In particular, applying MD_CLEAR - * flows for mitigation of the Intel TSX Asynchronous Abort (TAA) transient - * execution attack may not be effective on these processors when Intel TSX is - * enabled with updated microcode. - */ -static void tsx_dev_mode_disable(void) -{ - u64 mcu_opt_ctrl; - - /* Check if RTM_ALLOW exists */ - if (!boot_cpu_has_bug(X86_BUG_TAA) || !tsx_ctrl_is_supported() || - !cpu_feature_enabled(X86_FEATURE_SRBDS_CTRL)) - return; - - rdmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_opt_ctrl); - - if (mcu_opt_ctrl & RTM_ALLOW) { - mcu_opt_ctrl &= ~RTM_ALLOW; - wrmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_opt_ctrl); - setup_force_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT); } } @@ -176,14 +105,14 @@ char arg[5] = {}; int ret; - tsx_dev_mode_disable(); - /* + * Hardware will always abort a TSX transaction if both CPUID bits + * RTM_ALWAYS_ABORT and TSX_FORCE_ABORT are set. In this case, it is + * better not to enumerate CPUID.RTM and CPUID.HLE bits. Clear them + * here. - * Hardware will always abort a TSX transaction when the CPUID bit - * RTM_ALWAYS_ABORT is set. In this case, it is better not to enumerate - * CPUID.RTM and CPUID.HLE bits. Clear them here. */ + if (boot_cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT) && + boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)) { - if (boot_cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT)) { tsx_ctrl_state = TSX_CTRL_RTM_ALWAYS_ABORT; tsx_clear_cpuid(); setup_clear_cpu_cap(X86_FEATURE_RTM); @@ -246,16 +175,3 @@ setup_force_cpu_cap(X86_FEATURE_HLE); } } - -void tsx_ap_init(void) -{ - tsx_dev_mode_disable(); - - if (tsx_ctrl_state == TSX_CTRL_ENABLE) - tsx_enable(); - else if (tsx_ctrl_state == TSX_CTRL_DISABLE) - tsx_disable(); - else if (tsx_ctrl_state == TSX_CTRL_RTM_ALWAYS_ABORT) - /* See comment over that function for more details. */ - tsx_clear_cpuid(); -} reverted: --- linux-oem-5.17-5.17.0/arch/x86/kernel/fpu/core.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kernel/fpu/core.c @@ -41,7 +41,17 @@ */ struct fpstate init_fpstate __ro_after_init; +/* + * Track whether the kernel is using the FPU state + * currently. + * + * This flag is used: + * + * - by IRQ context code to potentially use the FPU + * if it's unused. + * + * - to debug kernel_fpu_begin()/end() correctness + */ -/* Track in-kernel FPU usage */ static DEFINE_PER_CPU(bool, in_kernel_fpu); /* @@ -49,37 +59,42 @@ */ DEFINE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx); +static bool kernel_fpu_disabled(void) +{ + return this_cpu_read(in_kernel_fpu); +} + +static bool interrupted_kernel_fpu_idle(void) +{ + return !kernel_fpu_disabled(); +} + +/* + * Were we in user mode (or vm86 mode) when we were + * interrupted? + * + * Doing kernel_fpu_begin/end() is ok if we are running + * in an interrupt context from user mode - we'll just + * save the FPU state as required. + */ +static bool interrupted_user_mode(void) +{ + struct pt_regs *regs = get_irq_regs(); + return regs && user_mode(regs); +} + /* * Can we use the FPU in kernel mode with the * whole "kernel_fpu_begin/end()" sequence? + * + * It's always ok in process context (ie "not interrupt") + * but it is sometimes ok even from an irq. */ bool irq_fpu_usable(void) { + return !in_interrupt() || + interrupted_user_mode() || + interrupted_kernel_fpu_idle(); - if (WARN_ON_ONCE(in_nmi())) - return false; - - /* In kernel FPU usage already active? */ - if (this_cpu_read(in_kernel_fpu)) - return false; - - /* - * When not in NMI or hard interrupt context, FPU can be used in: - * - * - Task context except from within fpregs_lock()'ed critical - * regions. - * - * - Soft interrupt processing context which cannot happen - * while in a fpregs_lock()'ed critical region. - */ - if (!in_hardirq()) - return true; - - /* - * In hard interrupt context it's safe when soft interrupts - * are enabled, which means the interrupt did not hit in - * a fpregs_lock()'ed critical region. - */ - return !softirq_count(); } EXPORT_SYMBOL(irq_fpu_usable); diff -u linux-oem-5.17-5.17.0/arch/x86/kernel/kvm.c linux-oem-5.17-5.17.0/arch/x86/kernel/kvm.c --- linux-oem-5.17-5.17.0/arch/x86/kernel/kvm.c +++ linux-oem-5.17-5.17.0/arch/x86/kernel/kvm.c @@ -69,7 +69,6 @@ DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible; static int has_steal_clock = 0; -static int has_guest_poll = 0; /* * No need for any "IO delay" on KVM */ @@ -707,26 +706,14 @@ static int kvm_suspend(void) { - u64 val = 0; - kvm_guest_cpu_offline(false); -#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL - if (kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) - rdmsrl(MSR_KVM_POLL_CONTROL, val); - has_guest_poll = !(val & 1); -#endif return 0; } static void kvm_resume(void) { kvm_cpu_online(raw_smp_processor_id()); - -#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL - if (kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL) && has_guest_poll) - wrmsrl(MSR_KVM_POLL_CONTROL, 0); -#endif } static struct syscore_ops kvm_syscore_ops = { reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/cpuid.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/cpuid.c @@ -865,11 +865,6 @@ union cpuid10_eax eax; union cpuid10_edx edx; - if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { - entry->eax = entry->ebx = entry->ecx = entry->edx = 0; - break; - } - perf_get_x86_pmu_capability(&cap); /* diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/hyperv.c linux-oem-5.17-5.17.0/arch/x86/kvm/hyperv.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/hyperv.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/hyperv.c @@ -1128,13 +1128,11 @@ BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence)); BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0); - mutex_lock(&hv->hv_lock); - if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || - hv->hv_tsc_page_status == HV_TSC_PAGE_SET || hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET) - goto out_unlock; + return; + mutex_lock(&hv->hv_lock); if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)) goto out_unlock; @@ -1196,19 +1194,45 @@ mutex_unlock(&hv->hv_lock); } -void kvm_hv_request_tsc_page_update(struct kvm *kvm) +void kvm_hv_invalidate_tsc_page(struct kvm *kvm) { struct kvm_hv *hv = to_kvm_hv(kvm); + u64 gfn; + int idx; + + if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN || + hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET || + tsc_page_update_unsafe(hv)) + return; mutex_lock(&hv->hv_lock); - if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET && - !tsc_page_update_unsafe(hv)) - hv->hv_tsc_page_status = HV_TSC_PAGE_HOST_CHANGED; + if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)) + goto out_unlock; + /* Preserve HV_TSC_PAGE_GUEST_CHANGED/HV_TSC_PAGE_HOST_CHANGED states */ + if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET) + hv->hv_tsc_page_status = HV_TSC_PAGE_UPDATING; + + gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; + + hv->tsc_ref.tsc_sequence = 0; + + /* + * Take the srcu lock as memslots will be accessed to check the gfn + * cache generation against the memslots generation. + */ + idx = srcu_read_lock(&kvm->srcu); + if (kvm_write_guest(kvm, gfn_to_gpa(gfn), + &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence))) + hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN; + srcu_read_unlock(&kvm->srcu, idx); + +out_unlock: mutex_unlock(&hv->hv_lock); } + static bool hv_check_msr_access(struct kvm_vcpu_hv *hv_vcpu, u32 msr) { if (!hv_vcpu->enforce_cpuid) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/hyperv.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/hyperv.h @@ -133,7 +133,7 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, struct pvclock_vcpu_time_info *hv_clock); +void kvm_hv_invalidate_tsc_page(struct kvm *kvm); -void kvm_hv_request_tsc_page_update(struct kvm *kvm); void kvm_hv_init_vm(struct kvm *kvm); void kvm_hv_destroy_vm(struct kvm *kvm); diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/lapic.c linux-oem-5.17-5.17.0/arch/x86/kvm/lapic.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/lapic.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/lapic.c @@ -113,8 +113,7 @@ static bool kvm_can_post_timer_interrupt(struct kvm_vcpu *vcpu) { - return pi_inject_timer && kvm_vcpu_apicv_active(vcpu) && - (kvm_mwait_in_guest(vcpu->kvm) || kvm_hlt_in_guest(vcpu->kvm)); + return pi_inject_timer && kvm_vcpu_apicv_active(vcpu); } bool kvm_can_use_hv_timer(struct kvm_vcpu *vcpu) @@ -2126,9 +2125,10 @@ break; case APIC_SELF_IPI: - if (apic_x2apic_mode(apic)) - kvm_apic_send_ipi(apic, APIC_DEST_SELF | (val & APIC_VECTOR_MASK), 0); - else + if (apic_x2apic_mode(apic)) { + kvm_lapic_reg_write(apic, APIC_ICR, + APIC_DEST_SELF | (val & APIC_VECTOR_MASK)); + } else ret = 1; break; default: reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/mmu/mmu.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/mmu/mmu.c @@ -3239,8 +3239,6 @@ return; sp = to_shadow_page(*root_hpa & PT64_BASE_ADDR_MASK); - if (WARN_ON(!sp)) - return; if (is_tdp_mmu_page(sp)) kvm_tdp_mmu_put_root(kvm, sp, false); @@ -6146,24 +6144,12 @@ return 0; } +int kvm_mmu_module_init(void) -/* - * nx_huge_pages needs to be resolved to true/false when kvm.ko is loaded, as - * its default value of -1 is technically undefined behavior for a boolean. - */ -void kvm_mmu_x86_module_init(void) { + int ret = -ENOMEM; + if (nx_huge_pages == -1) __set_nx_huge_pages(get_nx_auto_mode()); -} - -/* - * The bulk of the MMU initialization is deferred until the vendor module is - * loaded as many of the masks/values may be modified by VMX or SVM, i.e. need - * to be reset when a potentially different vendor module is loaded. - */ -int kvm_mmu_vendor_module_init(void) -{ - int ret = -ENOMEM; /* * MMU roles use union aliasing which is, generally speaking, an @@ -6211,7 +6197,7 @@ mmu_free_memory_caches(vcpu); } +void kvm_mmu_module_exit(void) -void kvm_mmu_vendor_module_exit(void) { mmu_destroy_caches(); percpu_counter_destroy(&kvm_total_used_mmu_pages); reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/pmu.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/pmu.h @@ -140,15 +140,6 @@ return sample_period; } -static inline void pmc_update_sample_period(struct kvm_pmc *pmc) -{ - if (!pmc->perf_event || pmc->is_paused) - return; - - perf_event_period(pmc->perf_event, - get_sample_period(pmc, pmc->counter)); -} - void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel); void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 ctrl, int fixed_idx); void reprogram_counter(struct kvm_pmu *pmu, int pmc_idx); diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/svm/pmu.c linux-oem-5.17-5.17.0/arch/x86/kvm/svm/pmu.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/svm/pmu.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/svm/pmu.c @@ -45,22 +45,6 @@ [7] = { 0xd1, 0x00, PERF_COUNT_HW_STALLED_CYCLES_BACKEND }, }; -/* duplicated from amd_f17h_perfmon_event_map. */ -static struct kvm_event_hw_type_mapping amd_f17h_event_mapping[] = { - [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, - [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, - [2] = { 0x60, 0xff, PERF_COUNT_HW_CACHE_REFERENCES }, - [3] = { 0x64, 0x09, PERF_COUNT_HW_CACHE_MISSES }, - [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, - [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, - [6] = { 0x87, 0x02, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, - [7] = { 0x87, 0x01, PERF_COUNT_HW_STALLED_CYCLES_BACKEND }, -}; - -/* amd_pmc_perf_hw_id depends on these being the same size */ -static_assert(ARRAY_SIZE(amd_event_mapping) == - ARRAY_SIZE(amd_f17h_event_mapping)); - static unsigned int get_msr_base(struct kvm_pmu *pmu, enum pmu_type type) { struct kvm_vcpu *vcpu = pmu_to_vcpu(pmu); @@ -156,7 +140,6 @@ static unsigned int amd_pmc_perf_hw_id(struct kvm_pmc *pmc) { - struct kvm_event_hw_type_mapping *event_mapping; u8 event_select = pmc->eventsel & ARCH_PERFMON_EVENTSEL_EVENT; u8 unit_mask = (pmc->eventsel & ARCH_PERFMON_EVENTSEL_UMASK) >> 8; int i; @@ -165,20 +148,15 @@ if (WARN_ON(pmc_is_fixed(pmc))) return PERF_COUNT_HW_MAX; - if (guest_cpuid_family(pmc->vcpu) >= 0x17) - event_mapping = amd_f17h_event_mapping; - else - event_mapping = amd_event_mapping; - for (i = 0; i < ARRAY_SIZE(amd_event_mapping); i++) - if (event_mapping[i].eventsel == event_select - && event_mapping[i].unit_mask == unit_mask) + if (amd_event_mapping[i].eventsel == event_select + && amd_event_mapping[i].unit_mask == unit_mask) break; if (i == ARRAY_SIZE(amd_event_mapping)) return PERF_COUNT_HW_MAX; - return event_mapping[i].event_type; + return amd_event_mapping[i].event_type; } /* check if a PMC is enabled by comparing it against global_ctrl bits. Because @@ -279,7 +257,6 @@ pmc = get_gp_pmc_amd(pmu, msr, PMU_TYPE_COUNTER); if (pmc) { pmc->counter += data - pmc_read_counter(pmc); - pmc_update_sample_period(pmc); return 0; } /* MSR_EVNTSELn */ diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/svm/sev.c linux-oem-5.17-5.17.0/arch/x86/kvm/svm/sev.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/svm/sev.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/svm/sev.c @@ -1590,51 +1590,24 @@ atomic_set_release(&src_sev->migration_in_progress, 0); } -/* vCPU mutex subclasses. */ -enum sev_migration_role { - SEV_MIGRATION_SOURCE = 0, - SEV_MIGRATION_TARGET, - SEV_NR_MIGRATION_ROLES, -}; -static int sev_lock_vcpus_for_migration(struct kvm *kvm, - enum sev_migration_role role) +static int sev_lock_vcpus_for_migration(struct kvm *kvm) { struct kvm_vcpu *vcpu; unsigned long i, j; - bool first = true; kvm_for_each_vcpu(i, vcpu, kvm) { - if (mutex_lock_killable_nested(&vcpu->mutex, role)) + if (mutex_lock_killable(&vcpu->mutex)) goto out_unlock; - - if (first) { - /* - * Reset the role to one that avoids colliding with - * the role used for the first vcpu mutex. - */ - role = SEV_NR_MIGRATION_ROLES; - first = false; - } else { - mutex_release(&vcpu->mutex.dep_map, _THIS_IP_); - } } return 0; out_unlock: - - first = true; kvm_for_each_vcpu(j, vcpu, kvm) { if (i == j) break; - if (first) - first = false; - else - mutex_acquire(&vcpu->mutex.dep_map, role, 0, _THIS_IP_); - - mutex_unlock(&vcpu->mutex); } return -EINTR; @@ -1644,15 +1617,8 @@ { struct kvm_vcpu *vcpu; unsigned long i; - bool first = true; kvm_for_each_vcpu(i, vcpu, kvm) { - if (first) - first = false; - else - mutex_acquire(&vcpu->mutex.dep_map, - SEV_NR_MIGRATION_ROLES, 0, _THIS_IP_); - mutex_unlock(&vcpu->mutex); } } @@ -1760,10 +1726,10 @@ charged = true; } - ret = sev_lock_vcpus_for_migration(kvm, SEV_MIGRATION_SOURCE); + ret = sev_lock_vcpus_for_migration(kvm); if (ret) goto out_dst_cgroup; - ret = sev_lock_vcpus_for_migration(source_kvm, SEV_MIGRATION_TARGET); + ret = sev_lock_vcpus_for_migration(source_kvm); if (ret) goto out_dst_vcpu; @@ -2238,39 +2204,51 @@ * Pages used by hardware to hold guest encrypted state must be flushed before * returning them to the system. */ -static void sev_flush_encrypted_page(struct kvm_vcpu *vcpu, void *va) +static void sev_flush_guest_memory(struct vcpu_svm *svm, void *va, + unsigned long len) { - int asid = to_kvm_svm(vcpu->kvm)->sev_info.asid; - /* - * Note! The address must be a kernel address, as regular page walk - * checks are performed by VM_PAGE_FLUSH, i.e. operating on a user - * address is non-deterministic and unsafe. This function deliberately - * takes a pointer to deter passing in a user address. + * If hardware enforced cache coherency for encrypted mappings of the + * same physical page is supported, nothing to do. */ - unsigned long addr = (unsigned long)va; + if (boot_cpu_has(X86_FEATURE_SME_COHERENT)) + return; /* - * If CPU enforced cache coherency for encrypted mappings of the - * same physical page is supported, use CLFLUSHOPT instead. NOTE: cache - * flush is still needed in order to work properly with DMA devices. + * If the VM Page Flush MSR is supported, use it to flush the page + * (using the page virtual address and the guest ASID). */ - if (boot_cpu_has(X86_FEATURE_SME_COHERENT)) { - clflush_cache_range(va, PAGE_SIZE); - return; + if (boot_cpu_has(X86_FEATURE_VM_PAGE_FLUSH)) { + struct kvm_sev_info *sev; + unsigned long va_start; + u64 start, stop; + + /* Align start and stop to page boundaries. */ + va_start = (unsigned long)va; + start = (u64)va_start & PAGE_MASK; + stop = PAGE_ALIGN((u64)va_start + len); + + if (start < stop) { + sev = &to_kvm_svm(svm->vcpu.kvm)->sev_info; + + while (start < stop) { + wrmsrl(MSR_AMD64_VM_PAGE_FLUSH, + start | sev->asid); + + start += PAGE_SIZE; + } + + return; + } + + WARN(1, "Address overflow, using WBINVD\n"); } /* - * VM Page Flush takes a host virtual address and a guest ASID. Fall - * back to WBINVD if this faults so as not to make any problems worse - * by leaving stale encrypted data in the cache. + * Hardware should always have one of the above features, + * but if not, use WBINVD and issue a warning. */ - if (WARN_ON_ONCE(wrmsrl_safe(MSR_AMD64_VM_PAGE_FLUSH, addr | asid))) - goto do_wbinvd; - - return; - -do_wbinvd: + WARN_ONCE(1, "Using WBINVD to flush guest memory\n"); wbinvd_on_all_cpus(); } @@ -2284,8 +2262,7 @@ svm = to_svm(vcpu); if (vcpu->arch.guest_state_protected) - sev_flush_encrypted_page(vcpu, svm->sev_es.vmsa); - + sev_flush_guest_memory(svm, svm->sev_es.vmsa, PAGE_SIZE); __free_page(virt_to_page(svm->sev_es.vmsa)); if (svm->sev_es.ghcb_sa_free) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/nested.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/vmx/nested.c @@ -4618,11 +4618,6 @@ kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu); } - if (vmx->nested.update_vmcs01_apicv_status) { - vmx->nested.update_vmcs01_apicv_status = false; - kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu); - } - if ((vm_exit_reason != -1) && (enable_shadow_vmcs || evmptr_is_valid(vmx->nested.hv_evmcs_vmptr))) vmx->nested.need_vmcs12_to_shadow_sync = true; diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/pmu_intel.c linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/pmu_intel.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/pmu_intel.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/pmu_intel.c @@ -431,11 +431,15 @@ !(msr & MSR_PMC_FULL_WIDTH_BIT)) data = (s64)(s32)data; pmc->counter += data - pmc_read_counter(pmc); - pmc_update_sample_period(pmc); + if (pmc->perf_event && !pmc->is_paused) + perf_event_period(pmc->perf_event, + get_sample_period(pmc, data)); return 0; } else if ((pmc = get_fixed_pmc(pmu, msr))) { pmc->counter += data - pmc_read_counter(pmc); - pmc_update_sample_period(pmc); + if (pmc->perf_event && !pmc->is_paused) + perf_event_period(pmc->perf_event, + get_sample_period(pmc, data)); return 0; } else if ((pmc = get_gp_pmc(pmu, msr, MSR_P6_EVNTSEL0))) { if (data == pmc->eventsel) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/vmx.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/vmx/vmx.c @@ -4182,11 +4182,6 @@ { struct vcpu_vmx *vmx = to_vmx(vcpu); - if (is_guest_mode(vcpu)) { - vmx->nested.update_vmcs01_apicv_status = true; - return; - } - pin_controls_set(vmx, vmx_pin_based_exec_ctrl(vmx)); if (cpu_has_secondary_exec_ctrls()) { if (kvm_vcpu_apicv_active(vcpu)) @@ -5473,7 +5468,7 @@ struct vcpu_vmx *vmx = to_vmx(vcpu); return vmx->emulation_required && !vmx->rmode.vm86_active && + vcpu->arch.exception.pending; - (vcpu->arch.exception.pending || vcpu->arch.exception.injected); } static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) reverted: --- linux-oem-5.17-5.17.0/arch/x86/kvm/vmx/vmx.h +++ linux-oem-5.17-5.17.0.orig/arch/x86/kvm/vmx/vmx.h @@ -183,7 +183,6 @@ bool change_vmcs01_virtual_apic_mode; bool reload_vmcs01_apic_access_page; bool update_vmcs01_cpu_dirty_logging; - bool update_vmcs01_apicv_status; /* * Enlightened VMCS has been enabled. It does not mean that L1 has to diff -u linux-oem-5.17-5.17.0/arch/x86/kvm/x86.c linux-oem-5.17-5.17.0/arch/x86/kvm/x86.c --- linux-oem-5.17-5.17.0/arch/x86/kvm/x86.c +++ linux-oem-5.17-5.17.0/arch/x86/kvm/x86.c @@ -2874,7 +2874,7 @@ static void kvm_update_masterclock(struct kvm *kvm) { - kvm_hv_request_tsc_page_update(kvm); + kvm_hv_invalidate_tsc_page(kvm); kvm_start_pvclock_update(kvm); pvclock_update_vm_gtod_copy(kvm); kvm_end_pvclock_update(kvm); @@ -3086,7 +3086,8 @@ offsetof(struct compat_vcpu_info, time)); if (vcpu->xen.vcpu_time_info_set) kvm_setup_pvclock_page(v, &vcpu->xen.vcpu_time_info_cache, 0); - kvm_hv_setup_tsc_page(v->kvm, &vcpu->hv_clock); + if (!v->vcpu_idx) + kvm_hv_setup_tsc_page(v->kvm, &vcpu->hv_clock); return 0; } @@ -6189,7 +6190,7 @@ if (data.flags & ~KVM_CLOCK_VALID_FLAGS) return -EINVAL; - kvm_hv_request_tsc_page_update(kvm); + kvm_hv_invalidate_tsc_page(kvm); kvm_start_pvclock_update(kvm); pvclock_update_vm_gtod_copy(kvm); @@ -8845,7 +8846,7 @@ } kvm_nr_uret_msrs = 0; - r = kvm_mmu_vendor_module_init(); + r = kvm_mmu_module_init(); if (r) goto out_free_percpu; @@ -8893,7 +8894,7 @@ cancel_work_sync(&pvclock_gtod_work); #endif kvm_x86_ops.hardware_enable = NULL; - kvm_mmu_vendor_module_exit(); + kvm_mmu_module_exit(); free_percpu(user_return_msrs); kmem_cache_destroy(x86_emulator_cache); #ifdef CONFIG_KVM_XEN @@ -10296,7 +10297,12 @@ static inline int complete_emulated_io(struct kvm_vcpu *vcpu) { - return kvm_emulate_instruction(vcpu, EMULTYPE_NO_DECODE); + int r; + + vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); + r = kvm_emulate_instruction(vcpu, EMULTYPE_NO_DECODE); + srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); + return r; } static int complete_emulated_pio(struct kvm_vcpu *vcpu) @@ -11113,21 +11119,8 @@ r = kvm_create_lapic(vcpu, lapic_timer_advance_ns); if (r < 0) goto fail_mmu_destroy; - - /* - * Defer evaluating inhibits until the vCPU is first run, as - * this vCPU will not get notified of any changes until this - * vCPU is visible to other vCPUs (marked online and added to - * the set of vCPUs). Opportunistically mark APICv active as - * VMX in particularly is highly unlikely to have inhibits. - * Ignore the current per-VM APICv state so that vCPU creation - * is guaranteed to run with a deterministic value, the request - * will ensure the vCPU gets the correct state before VM-Entry. - */ - if (enable_apicv) { + if (kvm_apicv_activated(vcpu->kvm)) vcpu->arch.apicv_active = true; - kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu); - } } else static_branch_inc(&kvm_has_noapic_vcpu); @@ -12897,16 +12889,0 @@ - -static int __init kvm_x86_init(void) -{ - kvm_mmu_x86_module_init(); - return 0; -} -module_init(kvm_x86_init); - -static void __exit kvm_x86_exit(void) -{ - /* - * If module_init() is implemented, module_exit() must also be - * implemented to allow module unload. - */ -} -module_exit(kvm_x86_exit); reverted: --- linux-oem-5.17-5.17.0/arch/x86/lib/usercopy_64.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/lib/usercopy_64.c @@ -119,7 +119,7 @@ /* cache copy and flush to align dest */ if (!IS_ALIGNED(dest, 8)) { + unsigned len = min_t(unsigned, size, ALIGN(dest, 8) - dest); - size_t len = min_t(size_t, size, ALIGN(dest, 8) - dest); memcpy((void *) dest, (void *) source, len); clean_cache_range((void *) dest, len); reverted: --- linux-oem-5.17-5.17.0/arch/x86/net/bpf_jit_comp.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/net/bpf_jit_comp.c @@ -398,7 +398,6 @@ EMIT_LFENCE(); EMIT2(0xFF, 0xE0 + reg); } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { - OPTIMIZER_HIDE_VAR(reg); emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip); } else #endif reverted: --- linux-oem-5.17-5.17.0/arch/x86/pci/xen.c +++ linux-oem-5.17-5.17.0.orig/arch/x86/pci/xen.c @@ -467,6 +467,7 @@ else xen_msi_ops.setup_msi_irqs = xen_setup_msi_irqs; xen_msi_ops.teardown_msi_irqs = xen_pv_teardown_msi_irqs; + pci_msi_ignore_mask = 1; } else if (xen_hvm_domain()) { xen_msi_ops.setup_msi_irqs = xen_hvm_setup_msi_irqs; xen_msi_ops.teardown_msi_irqs = xen_teardown_msi_irqs; @@ -480,11 +481,6 @@ * in allocating the native domain and never use it. */ x86_init.irqs.create_pci_msi_domain = xen_create_pci_msi_domain; - /* - * With XEN PIRQ/Eventchannels in use PCI/MSI[-X] masking is solely - * controlled by the hypervisor. - */ - pci_msi_ignore_mask = 1; } #else /* CONFIG_PCI_MSI */ diff -u linux-oem-5.17-5.17.0/arch/x86/power/cpu.c linux-oem-5.17-5.17.0/arch/x86/power/cpu.c --- linux-oem-5.17-5.17.0/arch/x86/power/cpu.c +++ linux-oem-5.17-5.17.0/arch/x86/power/cpu.c @@ -25,7 +25,6 @@ #include #include #include -#include #ifdef CONFIG_X86_32 __visible unsigned long saved_context_ebx; @@ -263,18 +262,11 @@ x86_platform.restore_sched_clock_state(); mtrr_bp_restore(); perf_restore_debug_store(); + msr_restore_context(ctxt); c = &cpu_data(smp_processor_id()); if (cpu_has(c, X86_FEATURE_MSR_IA32_FEAT_CTL)) init_ia32_feat_ctl(c); - - microcode_bsp_resume(); - - /* - * This needs to happen after the microcode has been updated upon resume - * because some of the MSRs are "emulated" in microcode. - */ - msr_restore_context(ctxt); } /* Needed by apm.c */ reverted: --- linux-oem-5.17-5.17.0/arch/xtensa/kernel/coprocessor.S +++ linux-oem-5.17-5.17.0.orig/arch/xtensa/kernel/coprocessor.S @@ -29,7 +29,7 @@ .if XTENSA_HAVE_COPROCESSOR(x); \ .align 4; \ .Lsave_cp_regs_cp##x: \ + xchal_cp##x##_store a2 a4 a5 a6 a7; \ - xchal_cp##x##_store a2 a3 a4 a5 a6; \ jx a0; \ .endif @@ -46,7 +46,7 @@ .if XTENSA_HAVE_COPROCESSOR(x); \ .align 4; \ .Lload_cp_regs_cp##x: \ + xchal_cp##x##_load a2 a4 a5 a6 a7; \ - xchal_cp##x##_load a2 a3 a4 a5 a6; \ jx a0; \ .endif diff -u linux-oem-5.17-5.17.0/arch/xtensa/kernel/jump_label.c linux-oem-5.17-5.17.0/arch/xtensa/kernel/jump_label.c --- linux-oem-5.17-5.17.0/arch/xtensa/kernel/jump_label.c +++ linux-oem-5.17-5.17.0/arch/xtensa/kernel/jump_label.c @@ -40,7 +40,7 @@ { struct patch *patch = data; - if (atomic_inc_return(&patch->cpu_count) == num_online_cpus()) { + if (atomic_inc_return(&patch->cpu_count) == 1) { local_patch_text(patch->addr, patch->data, patch->sz); atomic_inc(&patch->cpu_count); } else { reverted: --- linux-oem-5.17-5.17.0/arch/xtensa/platforms/iss/console.c +++ linux-oem-5.17-5.17.0.orig/arch/xtensa/platforms/iss/console.c @@ -36,19 +36,24 @@ static struct tty_driver *serial_driver; static struct tty_port serial_port; static DEFINE_TIMER(serial_timer, rs_poll); +static DEFINE_SPINLOCK(timer_lock); static int rs_open(struct tty_struct *tty, struct file * filp) { + spin_lock_bh(&timer_lock); if (tty->count == 1) mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); + spin_unlock_bh(&timer_lock); return 0; } static void rs_close(struct tty_struct *tty, struct file * filp) { + spin_lock_bh(&timer_lock); if (tty->count == 1) del_timer_sync(&serial_timer); + spin_unlock_bh(&timer_lock); } @@ -68,6 +73,8 @@ int rd = 1; unsigned char c; + spin_lock(&timer_lock); + while (simc_poll(0)) { rd = simc_read(0, &c, 1); if (rd <= 0) @@ -80,6 +87,7 @@ tty_flip_buffer_push(port); if (rd) mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); + spin_unlock(&timer_lock); } diff -u linux-oem-5.17-5.17.0/block/bfq-iosched.c linux-oem-5.17-5.17.0/block/bfq-iosched.c --- linux-oem-5.17-5.17.0/block/bfq-iosched.c +++ linux-oem-5.17-5.17.0/block/bfq-iosched.c @@ -569,7 +569,7 @@ struct bfq_entity *entity = &bfqq->entity; struct bfq_entity *inline_entities[BFQ_LIMIT_INLINE_DEPTH]; struct bfq_entity **entities = inline_entities; - int depth, level, alloc_depth = BFQ_LIMIT_INLINE_DEPTH; + int depth, level; int class_idx = bfqq->ioprio_class - 1; struct bfq_sched_data *sched_data; unsigned long wsum; @@ -578,21 +578,15 @@ if (!entity->on_st_or_in_serv) return false; -retry: - spin_lock_irq(&bfqd->lock); /* +1 for bfqq entity, root cgroup not included */ depth = bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1; - if (depth > alloc_depth) { - spin_unlock_irq(&bfqd->lock); - if (entities != inline_entities) - kfree(entities); + if (depth > BFQ_LIMIT_INLINE_DEPTH) { entities = kmalloc_array(depth, sizeof(*entities), GFP_NOIO); if (!entities) return false; - alloc_depth = depth; - goto retry; } + spin_lock_irq(&bfqd->lock); sched_data = entity->sched_data; /* Gather our ancestors as we need to traverse them in reverse order */ level = 0; diff -u linux-oem-5.17-5.17.0/block/bio.c linux-oem-5.17-5.17.0/block/bio.c --- linux-oem-5.17-5.17.0/block/bio.c +++ linux-oem-5.17-5.17.0/block/bio.c @@ -1570,7 +1570,7 @@ void bio_trim(struct bio *bio, sector_t offset, sector_t size) { if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS || - offset + size > bio_sectors(bio))) + offset + size > bio->bi_iter.bi_size)) return; size <<= 9; reverted: --- linux-oem-5.17-5.17.0/block/blk-iocost.c +++ linux-oem-5.17-5.17.0.orig/block/blk-iocost.c @@ -2322,17 +2322,7 @@ iocg->hweight_donating = hwa; iocg->hweight_after_donation = new_hwi; list_add(&iocg->surplus_list, &surpluses); + } else { - } else if (!iocg->abs_vdebt) { - /* - * @iocg doesn't have enough to donate. Reset - * its inuse to active. - * - * Don't reset debtors as their inuse's are - * owned by debt handling. This shouldn't affect - * donation calculuation in any meaningful way - * as @iocg doesn't have a meaningful amount of - * share anyway. - */ TRACE_IOCG_PATH(inuse_shortage, iocg, &now, iocg->inuse, iocg->active, iocg->hweight_inuse, new_hwi); diff -u linux-oem-5.17-5.17.0/block/blk-mq.c linux-oem-5.17-5.17.0/block/blk-mq.c --- linux-oem-5.17-5.17.0/block/blk-mq.c +++ linux-oem-5.17-5.17.0/block/blk-mq.c @@ -1122,7 +1122,14 @@ trace_block_rq_issue(rq); if (test_bit(QUEUE_FLAG_STATS, &q->queue_flags)) { - rq->io_start_time_ns = ktime_get_ns(); + u64 start_time; +#ifdef CONFIG_BLK_CGROUP + if (rq->bio) + start_time = bio_issue_time(&rq->bio->bi_issue); + else +#endif + start_time = ktime_get_ns(); + rq->io_start_time_ns = start_time; rq->stats_sectors = blk_rq_sectors(rq); rq->rq_flags |= RQF_STATS; rq_qos_issue(q, rq); reverted: --- linux-oem-5.17-5.17.0/block/ioctl.c +++ linux-oem-5.17-5.17.0.orig/block/ioctl.c @@ -629,7 +629,7 @@ return compat_put_long(argp, (bdev->bd_disk->bdi->ra_pages * PAGE_SIZE) / 512); case BLKGETSIZE: + if (bdev_nr_sectors(bdev) > ~0UL) - if (bdev_nr_sectors(bdev) > ~(compat_ulong_t)0) return -EFBIG; return compat_put_ulong(argp, bdev_nr_sectors(bdev)); diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/abi/version linux-oem-5.17-5.17.0/debian.hwe-5.17/abi/version --- linux-oem-5.17-5.17.0/debian.hwe-5.17/abi/version +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/abi/version @@ -1 +1 @@ -5.17.0-8.8~22.04.2 +5.17.0-8.8~22.04.1 diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/changelog linux-oem-5.17-5.17.0/debian.hwe-5.17/changelog --- linux-oem-5.17-5.17.0/debian.hwe-5.17/changelog +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/changelog @@ -1,791 +1,3 @@ -linux-hwe-5.17 (5.17.0-8.8~22.04.3) jammy; urgency=medium - - * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.3 -proposed tracker (LP: #1971893) - - * Jammy update: v5.17.7 upstream stable release (LP: #1973282) - - pci_irq_vector() can't be used in atomic context any longer. This conflicts - with the usage of this function in nic_mbx_intr_handler(). age of this - function in nic_mbx_intr_handler(). - - ipmi: When handling send message responses, don't process the message - - ipmi:ipmi_ipmb: Fix null-ptr-deref in ipmi_unregister_smi() - - MIPS: Fix CP0 counter erratum detection for R4k CPUs - - Revert "parisc: Mark cr16 CPU clocksource unstable on all SMP machines" - - Revert "parisc: Mark sched_clock unstable only if clocks are not - syncronized" - - parisc: Merge model and model name into one line in /proc/cpuinfo - - ALSA: hda/realtek: Add quirk for Yoga Duet 7 13ITL6 speakers - - ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes - - mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC - - mmc: sunxi-mmc: Fix DMA descriptors allocated above 32 bits - - mmc: core: Set HS clock speed before sending HS CMD13 - - gpiolib: of: fix bounds check for 'gpio-reserved-ranges' - - x86/fpu: Prevent FPU state corruption - - KVM: x86/svm: Account for family 17h event renumberings in - amd_pmc_perf_hw_id - - iommu/vt-d: Calculate mask for non-aligned flushes - - iommu/arm-smmu-v3: Fix size calculation in arm_smmu_mm_invalidate_range() - - drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT - - drm/amdgpu: do not use passthrough mode in Xen dom0 - - RISC-V: relocate DTB if it's outside memory region - - hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk - - Revert "SUNRPC: attempt AF_LOCAL connect on setup" - - timekeeping: Mark NMI safe time accessors as notrace - - firewire: fix potential uaf in outbound_phy_packet_callback() - - firewire: remove check of list iterator against head past the loop body - - firewire: core: extend card->lock in fw_core_handle_bus_reset - - net: stmmac: disable Split Header (SPH) for Intel platforms - - btrfs: sysfs: export the balance paused state of exclusive operation - - btrfs: force v2 space cache usage for subpage mount - - btrfs: do not BUG_ON() on failure to update inode when setting xattr - - btrfs: export a helper for compression hard check - - btrfs: do not allow compression on nodatacow files - - btrfs: skip compression property for anything other than files and dirs - - genirq: Synchronize interrupt thread startup - - ASoC: da7219: Fix change notifications for tone generator frequency - - ASoC: rt9120: Correct the reg 0x09 size to one byte - - ASoC: wm8958: Fix change notifications for DSP controls - - ASoC: meson: Fix event generation for AUI ACODEC mux - - ASoC: meson: Fix event generation for G12A tohdmi mux - - ASoC: meson: Fix event generation for AUI CODEC mux - - s390/dasd: fix data corruption for ESE devices - - s390/dasd: prevent double format of tracks for ESE devices - - s390/dasd: Fix read for ESE with blksize < 4k - - s390/dasd: Fix read inconsistency for ESE DASD devices - - can: grcan: grcan_close(): fix deadlock - - can: isotp: remove re-binding of bound socket - - can: grcan: use ofdev->dev when allocating DMA memory - - can: grcan: grcan_probe(): fix broken system id check for errata workaround - needs - - can: grcan: only use the NAPI poll budget for RX - - nfc: replace improper check device_is_registered() in netlink related - functions - - nfc: nfcmrvl: main: reorder destructive operations in - nfcmrvl_nci_unregister_dev to avoid bugs - - NFC: netlink: fix sleep in atomic bug when firmware download timeout - - gpio: visconti: Fix fwnode of GPIO IRQ - - gpio: pca953x: fix irq_stat not updated when irq is disabled (irq_mask not - set) - - hwmon: (adt7470) Fix warning on module removal - - hwmon: (pmbus) disable PEC if not enabled - - ASoC: dmaengine: Restore NULL prepare_slave_config() callback - - ASoC: meson: axg-tdm-interface: Fix formatters in trigger" - - ASoC: meson: axg-card: Fix nonatomic links - - ASoC: soc-ops: fix error handling - - iommu/vt-d: Drop stop marker messages - - iommu/dart: check return value after calling platform_get_resource() - - net/mlx5e: Fix trust state reset in reload - - net/mlx5: Fix slab-out-of-bounds while reading resource dump menu - - net/mlx5e: Fix wrong source vport matching on tunnel rule - - net/mlx5e: Don't match double-vlan packets if cvlan is not set - - net/mlx5e: CT: Fix queued up restore put() executing after relevant ft - release - - net/mlx5e: Fix the calling of update_buffer_lossy() API - - net/mlx5: Fix matching on inner TTC - - net/mlx5: Avoid double clear or set of sync reset requested - - net/mlx5: Fix deadlock in sync reset flow - - net/mlx5e: Lag, Fix use-after-free in fib event handler - - net/mlx5e: Lag, Fix fib_info pointer assignment - - net/mlx5e: Lag, Don't skip fib events on current dst - - net/mlx5e: TC, fix decap fallback to uplink when int port not supported - - selftests/seccomp: Don't call read() on TTY from background pgrp - - ALSA: hda/realtek: Fix mute led issue on thinkpad with cs35l41 s-codec - - SUNRPC release the transport of a relocated task with an assigned transport - - RDMA/siw: Fix a condition race issue in MPA request processing - - RDMA/irdma: Flush iWARP QP if modified to ERR from RTR state - - RDMA/irdma: Reduce iWARP QP destroy time - - RDMA/irdma: Fix possible crash due to NULL netdev in notifier - - NFSv4: Don't invalidate inode attributes on delegation return - - net: ethernet: mediatek: add missing of_node_put() in mtk_sgmii_init() - - net: dsa: mt7530: add missing of_node_put() in mt7530_setup() - - net: stmmac: dwmac-sun8i: add missing of_node_put() in - sun8i_dwmac_register_mdio_mux() - - net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller - - net: cpsw: add missing of_node_put() in cpsw_probe_dt() - - net: igmp: respect RCU rules in ip_mc_source() and ip_mc_msfilter() - - net: emaclite: Add error handling for of_address_to_resource() - - selftests/net: so_txtime: fix parsing of start time stamp on 32 bit systems - - selftests/net: so_txtime: usage(): fix documentation of default clock - - drm/msm/dp: remove fail safe mode related code - - hinic: fix bug of wq out of bound access - - SUNRPC: Don't leak sockets in xs_local_connect() - - mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter() - - rxrpc: Enable IPv6 checksums on transport socket - - selftests: mirror_gre_bridge_1q: Avoid changing PVID while interface is - operational - - dt-bindings: pci: apple,pcie: Drop max-link-speed from example - - bnxt_en: Fix possible bnxt_open() failure caused by wrong RFS flag - - bnxt_en: Fix unnecessary dropping of RX packets - - selftests: ocelot: tc_flower_chains: specify conform-exceed action for - policer - - smsc911x: allow using IRQ0 - - btrfs: always log symlinks in full mode - - parisc: Mark cr16 clock unstable on all SMP machines - - gpio: mvebu: drop pwm base assignment - - net: rds: acquire refcount on TCP sockets - - kvm: x86/cpuid: Only provide CPUID leaf 0xA if host has architectural PMU - - fbdev: Make fb_release() return -ENODEV if fbdev was unregistered - - iommu/dart: Add missing module owner to ops structure - - KVM: SEV: Mark nested locking of vcpu->lock - - KVM: VMX: Exit to userspace if vCPU has injected exception and invalid state - - kvm: selftests: do not use bitfields larger than 32-bits for PTEs - - KVM: selftests: Silence compiler warning in the kvm_page_table_test - - x86/kvm: Preserve BSP MSR_KVM_POLL_CONTROL across suspend/resume - - KVM: x86: Do not change ICR on write to APIC_SELF_IPI - - KVM: x86/mmu: avoid NULL-pointer dereference on page freeing bugs - - KVM: LAPIC: Enable timer posted-interrupt only when mwait/hlt is advertised - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - mmc: rtsx: add 74 Clocks in power on flow - - PCI: aardvark: Replace custom PCIE_CORE_INT_* macros with PCI_INTERRUPT_* - - PCI: aardvark: Rewrite IRQ code to chained IRQ handler - - PCI: aardvark: Check return value of generic_handle_domain_irq() when - processing INTx IRQ - - PCI: aardvark: Make MSI irq_chip structures static driver structures - - PCI: aardvark: Make msi_domain_info structure a static driver structure - - PCI: aardvark: Use dev_fwnode() instead of of_node_to_fwnode(dev->of_node) - - PCI: aardvark: Refactor unmasking summary MSI interrupt - - PCI: aardvark: Add support for masking MSI interrupts - - PCI: aardvark: Fix setting MSI address - - PCI: aardvark: Enable MSI-X support - - PCI: aardvark: Add support for ERR interrupt on emulated bridge - - PCI: aardvark: Optimize writing PCI_EXP_RTCTL_PMEIE and PCI_EXP_RTSTA_PME on - emulated bridge - - PCI: aardvark: Add support for PME interrupts - - PCI: aardvark: Fix support for PME requester on emulated bridge - - PCI: aardvark: Use separate INTA interrupt for emulated root bridge - - PCI: aardvark: Remove irq_mask_ack() callback for INTx interrupts - - PCI: aardvark: Don't mask irq when mapping - - PCI: aardvark: Drop __maybe_unused from advk_pcie_disable_phy() - - PCI: aardvark: Update comment about link going down after link-up - - Linux 5.17.7 - - * Jammy update: v5.17.6 upstream stable release (LP: #1973281) - - usb: mtu3: fix USB 3.0 dual-role-switch from device to host - - floppy: disable FDRAWCMD by default - - USB: quirks: add a Realtek card reader - - USB: quirks: add STRING quirk for VCOM device - - USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS - - USB: serial: cp210x: add PIDs for Kamstrup USB Meter Reader - - USB: serial: option: add support for Cinterion MV32-WA/MV32-WB - - USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions - - usb: xhci: tegra:Fix PM usage reference leak of - tegra_xusb_unpowergate_partitions - - xhci: Enable runtime PM on second Alderlake controller - - xhci: stop polling roothubs after shutdown - - xhci: increase usb U3 -> U0 link resume timeout from 100ms to 500ms - - iio: dac: ad5592r: Fix the missing return value. - - iio: scd4x: check return of scd4x_write_and_fetch - - iio: dac: ad5446: Fix read_raw not returning set value - - iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() - - iio: imu: inv_icm42600: Fix I2C init possible nack - - usb: misc: fix improper handling of refcount in uss720_probe() - - usb: core: Don't hold the device lock while sleeping in do_proc_control() - - usb: typec: ucsi: Fix reuse of completion structure - - usb: typec: ucsi: Fix role swapping - - usb: gadget: uvc: Fix crash when encoding data for usb request - - usb: gadget: configfs: clear deactivation flag in - configfs_composite_unbind() - - usb: dwc3: Try usb-role-switch first in dwc3_drd_init - - usb: dwc3: core: Fix tx/rx threshold settings - - usb: dwc3: core: Only handle soft-reset in DCTL - - usb: dwc3: gadget: Return proper request status - - usb: dwc3: pci: add support for the Intel Meteor Lake-P - - usb: cdns3: Fix issue for clear halt endpoint - - usb: phy: generic: Get the vbus supply - - kernfs: fix NULL dereferencing in kernfs_remove - - binder: Gracefully handle BINDER_TYPE_FDA objects with num_fds=0 - - binder: Address corner cases in deferred copy and fixup - - serial: imx: fix overrun interrupts in DMA mode - - serial: amba-pl011: do not time out prematurely when draining tx fifo - - serial: 8250: Also set sticky MCR bits in console restoration - - serial: 8250: Correct the clock for EndRun PTP/1588 PCIe device - - eeprom: at25: Use DMA safe buffers - - arch_topology: Do not set llc_sibling if llc_id is invalid - - topology: make core_mask include at least cluster_siblings - - ceph: fix possible NULL pointer dereference for req->r_session - - bus: mhi: host: pci_generic: Add missing poweroff() PM callback - - bus: mhi: host: pci_generic: Flush recovery worker during freeze - - arm64: dts: imx8mm-venice: fix spi2 pin configuration - - pinctrl: samsung: fix missing GPIOLIB on ARM64 Exynos config - - f2fs: should not truncate blocks during roll-forward recovery - - hex2bin: make the function hex_to_bin constant-time - - hex2bin: fix access beyond string end - - bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc() - - riscv: patch_text: Fixup last cpu should be master - - x86/cpu: Load microcode during restore_processor_state() - - x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests - - iocost: don't reset the inuse weight of under-weighted debtors - - virtio_net: fix wrong buf address calculation when using xdp - - cpufreq: qcom-hw: drop affinity hint before freeing the IRQ - - cpufreq: qcom-hw: fix the race between LMH worker and cpuhp - - cpufreq: qcom-hw: fix the opp entries refcounting - - cpufreq: qcom-cpufreq-hw: Fix throttle frequency value on EPSS platforms - - video: fbdev: udlfb: properly check endpoint type - - arm64: dts: meson: remove CPU opps below 1GHz for G12B boards - - arm64: dts: meson: remove CPU opps below 1GHz for SM1 boards - - iio: dac: ad3552r: fix signedness bug in ad3552r_reset() - - iio:imu:bmi160: disable regulator in error path - - iio:filter:admv8818: select REGMAP_SPI for ADMV8818 - - mtd: rawnand: fix ecc parameters for mt7622 - - tee: optee: add missing mutext_destroy in optee_ffa_probe - - xsk: Fix l2fwd for copy mode + busy poll combo - - arm64: dts: imx8qm: Correct SCU clock controller's compatible property - - USB: Fix xhci event ring dequeue pointer ERDP update issue - - soc: imx: imx8m-blk-ctrl: Fix IMX8MN_DISPBLK_PD_ISI hang - - ARM: dts: imx6qdl-apalis: Fix sgtl5000 detection issue - - iio:dac:ad3552r: Fix an IS_ERR() vs NULL check - - arm64: dts: imx8mq-tqma8mq: change the spi-nor tx - - arm64: dts: imx8mn: Fix SAI nodes - - arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO pin labeling for CON1 - - phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe - - phy: samsung: exynos5250-sata: fix missing device put in probe error paths - - ARM: OMAP2+: Fix refcount leak in omap_gic_of_init - - bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific - - ARM: dts: dra7: Fix suspend warning for vpe powerdomain - - phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks - - ARM: dts: at91: Map MCLK for wm8731 on at91sam9g20ek - - ARM: dts: at91: sama5d4_xplained: fix pinctrl phandle name - - ARM: dts: at91: fix pinctrl phandles - - phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe - - phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe - - interconnect: qcom: sc7180: Drop IP0 interconnects - - interconnect: qcom: sdx55: Drop IP0 interconnects - - ARM: dts: Fix mmc order for omap3-gta04 - - ARM: dts: am33xx-l4: Add missing touchscreen clock properties - - ARM: dts: am3517-evm: Fix misc pinmuxing - - ARM: dts: logicpd-som-lv: Fix wrong pinmuxing on OMAP35 - - pinctrl: qcom: sm6350: fix order of UFS & SDC pins - - ipvs: correctly print the memory size of ip_vs_conn_tab - - phy: amlogic: fix error path in phy_g12a_usb3_pcie_probe() - - pinctrl: mediatek: moore: Fix build error - - mtd: rawnand: Fix return value check of wait_for_completion_timeout - - mtd: fix 'part' field data corruption in mtd_info - - pinctrl: stm32: Do not call stm32_gpio_get() for edge triggered IRQs in EOI - - memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode - - net: dsa: Add missing of_node_put() in dsa_port_link_register_of - - netfilter: nft_set_rbtree: overlap detection with element re-addition after - deletion - - bpf, lwt: Fix crash when using bpf_skb_set_tunnel_key() from bpf_xmit lwt - hook - - pinctrl: rockchip: fix RK3308 pinmux bits - - tcp: md5: incorrect tcp_header_len for incoming connections - - pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested - - tcp: ensure to use the most recently sent skb when filling the rate sample - - wireguard: device: check for metadata_dst with skb_valid_dst() - - sctp: check asoc strreset_chunk in sctp_generate_reconf_event - - ARM: dts: imx6ull-colibri: fix vqmmc regulator - - arm64: dts: imx8mn-ddr4-evk: Describe the 32.768 kHz PMIC clock - - pinctrl: pistachio: fix use of irq_of_parse_and_map() - - cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe - - net: hns3: clear inited state and stop client after failed to register - netdev - - net: hns3: fix error log of tx/rx tqps stats - - net: hns3: modify the return code of hclge_get_ring_chain_from_mbx - - net: hns3: add validity check for message data length - - net: hns3: add return value for mailbox handling in PF - - net/smc: sync err code when tcp connection was refused - - net: lan966x: fix a couple off by one bugs - - ip_gre: Make o_seqno start from 0 in native mode - - ip6_gre: Make o_seqno start from 0 in native mode - - ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode - - tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT - - tcp: make sure treq->af_specific is initialized - - bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create() - - clk: sunxi: sun9i-mmc: check return value after calling - platform_get_resource() - - cpufreq: qcom-cpufreq-hw: Clear dcvs interrupts - - mctp: defer the kfree of object mdev->addrs - - net: bcmgenet: hide status block before TX timestamping - - net: phy: marvell10g: fix return value on error - - net: dsa: mv88e6xxx: Fix port_hidden_wait to account for port_base_addr - - drm/sun4i: Remove obsolete references to PHYS_OFFSET - - ice: wait 5 s for EMP reset after firmware flash - - Bluetooth: hci_event: Fix checking for invalid handle on error status - - net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK - - io_uring: check reserved fields for send/sendmsg - - io_uring: check reserved fields for recv/recvmsg - - netfilter: nf_conntrack_tcp: re-init for syn packets only - - netfilter: conntrack: fix udp offload timeout sysctl - - platform/x86: asus-wmi: Potential buffer overflow in - asus_wmi_evaluate_method_buf() - - platform/x86: asus-wmi: Fix driver not binding when fan curve control probe - fails - - drm/amdkfd: Fix GWS queue count - - drm/amd/display: Fix memory leak in dcn21_clock_source_create - - tls: Skip tls_append_frag on zero copy size - - bnx2x: fix napi API usage sequence - - net: fec: add missing of_node_put() in fec_enet_init_stop_mode() - - gfs2: Minor retry logic cleanup - - gfs2: Make sure not to return short direct writes - - gfs2: No short reads or writes upon glock contention - - perf arm-spe: Fix addresses of synthesized SPE events - - ixgbe: ensure IPsec VF<->PF compatibility - - net: enetc: allow tc-etf offload even with NETIF_F_CSUM_MASK - - Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits" - - tcp: fix F-RTO may not work correctly when receiving DSACK - - io_uring: fix uninitialized field in rw io_kiocb - - ASoC: soc-pcm: use GFP_KERNEL when the code is sleepable - - ASoC: cs35l41: Fix a shift-out-of-bounds warning found by UBSAN - - ASoC: rt711/5682: check if bus is active before deferred jack detection - - ASoC: Intel: soc-acpi: correct device endpoints for max98373 - - ASoC: wm8731: Disable the regulator when probing fails - - Input: cypress-sf - register a callback to disable the regulators - - ext4: fix bug_on in start_this_handle during umount filesystem - - arch: xtensa: platforms: Fix deadlock in rs_close() - - ksmbd: increment reference count of parent fp - - ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION - - erofs: fix use-after-free of on-stack io[] - - bonding: do not discard lowest hash bit for non layer3+4 hashing - - x86: __memcpy_flushcache: fix wrong alignment if size > 2^32 - - cifs: destage any unwritten data to the server before calling - copychunk_write - - drivers: net: hippi: Fix deadlock in rr_close() - - powerpc/perf: Fix 32bit compile - - ALSA: hda: intel-dsp-config: Add RaptorLake PCI IDs - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - bfq: Fix warning in bfqq_request_over_limit() - - Revert "ACPI: processor: idle: fix lockup regression on 32-bit ThinkPad T40" - - Revert "block: inherit request start time from bio for BLK_CGROUP" - - zonefs: Fix management of open zones - - zonefs: Clear inode information flags on inode creation - - kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink - occur at same time - - mtd: rawnand: qcom: fix memory corruption that causes panic - - netfilter: Update ip6_route_me_harder to consider L3 domain - - drm/amdgpu: don't runtime suspend if there are displays attached (v3) - - drm/i915: Check EDID for HDR static metadata when choosing blc - - drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses - - net: ethernet: stmmac: fix write to sgmii_adapter_base - - ACPI: processor: idle: Avoid falling back to C3 type C-states - - thermal: int340x: Fix attr.show callback prototype - - btrfs: fix direct I/O read repair for split bios - - btrfs: fix direct I/O writes for split bios on zoned devices - - btrfs: fix leaked plug after failure syncing log on zoned filesystems - - btrfs: zoned: use dedicated lock for data relocation - - btrfs: fix assertion failure during scrub due to block group reallocation - - ARM: dts: at91: sama7g5ek: enable pull-up on flexcom3 console lines - - ARM: dts: imx8mm-venice-gw{71xx,72xx,73xx}: fix OTG controller OC mode - - perf symbol: Pass is_kallsyms to symbols__fixup_end() - - perf symbol: Update symbols__fixup_end() - - perf symbol: Remove arch__symbols__fixup_end() - - tty: n_gsm: fix missing mux reset on config change at responder - - tty: n_gsm: fix restart handling via CLD command - - tty: n_gsm: fix decoupled mux resource - - tty: n_gsm: fix mux cleanup after unregister tty device - - tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2 - - tty: n_gsm: fix frame reception handling - - tty: n_gsm: fix malformed counter for out of frame data - - netfilter: nft_socket: only do sk lookups when indev is available - - tty: n_gsm: fix insufficient txframe size - - tty: n_gsm: fix wrong DLCI release order - - tty: n_gsm: fix missing explicit ldisc flush - - tty: n_gsm: fix wrong command retry handling - - tty: n_gsm: fix wrong command frame length field encoding - - tty: n_gsm: fix wrong signal octets encoding in MSC - - tty: n_gsm: fix missing tty wakeup in convergence layer type 2 - - tty: n_gsm: fix reset fifo race condition - - tty: n_gsm: fix incorrect UA handling - - tty: n_gsm: fix missing update of modem controls after DLCI open - - tty: n_gsm: fix broken virtual tty handling - - tty: n_gsm: fix invalid use of MSC in advanced option - - tty: n_gsm: fix software flow control handling - - tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output() - - objtool: Fix code relocs vs weak symbols - - objtool: Fix type of reloc::addend - - powerpc/64: Add UADDR64 relocation support - - Linux 5.17.6 - - [Config] updateconfigs following v5.17.6 - - * Jammy update: v5.17.5 upstream stable release (LP: #1973280) - - etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead - - perf tools: Fix segfault accessing sample_id xyarray - - drm/amd/display: Only set PSR version when valid - - block/compat_ioctl: fix range check in BLKGETSIZE - - gfs2: assign rgrp glock before compute_bitstructs - - scsi: ufs: core: scsi_get_lba() error fix - - net/sched: cls_u32: fix netns refcount changes in u32_change() - - ALSA: usb-audio: Clear MIDI port active flag after draining - - ALSA: usb-audio: add mapping for MSI MAG X570S Torpedo MAX. - - ALSA: hda/realtek: Add quirk for Clevo NP70PNP - - ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek - - ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create() - - ASoC: rk817: Use devm_clk_get() in rk817_platform_probe - - ASoC: msm8916-wcd-digital: Check failure for devm_snd_soc_register_component - - ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use - - dmaengine: idxd: fix device cleanup on disable - - dmaengine: imx-sdma: Fix error checking in sdma_event_remap - - dmaengine: mediatek:Fix PM usage reference leak of - mtk_uart_apdma_alloc_chan_resources - - dmaengine: dw-edma: Fix unaligned 64bit access - - spi: spi-mtk-nor: initialize spi controller after resume - - firmware: cs_dsp: Fix overrun of unterminated control name string - - esp: limit skb_page_frag_refill use to a single page - - spi: cadence-quadspi: fix incorrect supports_op() return value - - igc: Fix infinite loop in release_swfw_sync - - igc: Fix BUG: scheduling while atomic - - igc: Fix suspending when PTM is active - - ice: allow creating VFs for !CONFIG_NET_SWITCHDEV - - ice: fix crash in switchdev mode - - ice: Fix memory leak in ice_get_orom_civd_data() - - ALSA: hda/hdmi: fix warning about PCM count when used with SOF - - rxrpc: Restore removed timer deletion - - net/smc: Fix sock leak when release after smc_shutdown() - - net/packet: fix packet_sock xmit return value checking - - ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit() - - ip6_gre: Fix skb_under_panic in __gre6_xmit() - - net: restore alpha order to Ethernet devices in config - - net/sched: cls_u32: fix possible leak in u32_init_knode() - - l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using - netdev_master_upper_dev_get_rcu - - ipv6: make ip6_rt_gc_expire an atomic_t - - can: isotp: stop timeout monitoring when no first frame was sent - - net: dsa: hellcreek: Calculate checksums in tagger - - net: mscc: ocelot: fix broken IP multicast flooding - - netlink: reset network and mac headers in netlink_dump() - - drm/i915/display/psr: Unset enable_psr2_sel_fetch if other checks in - intel_psr2_config_valid() fails - - RISC-V: KVM: Remove 's' & 'u' as valid ISA extension - - RISC-V: KVM: Restrict the extensions that can be disabled - - net: stmmac: Use readl_poll_timeout_atomic() in atomic state - - dmaengine: idxd: match type for retries var in idxd_enqcmds() - - dmaengine: idxd: fix retry value to be constant for duration of function - call - - dmaengine: idxd: add RO check for wq max_batch_size write - - dmaengine: idxd: add RO check for wq max_transfer_size write - - dmaengine: idxd: skip clearing device context when device is read-only - - selftests: mlxsw: vxlan_flooding: Prevent flooding of unwanted packets - - selftests: mlxsw: vxlan_flooding_ipv6: Prevent flooding of unwanted packets - - userfaultfd: mark uffd_wp regardless of VM_WRITE flag - - arm64: mm: fix p?d_leaf() - - XArray: Disallow sibling entries of nodes - - drm/msm/gpu: Rename runtime suspend/resume functions - - drm/msm/gpu: Remove mutex from wait_event condition - - ARM: vexpress/spc: Avoid negative array index when !SMP - - reset: renesas: Check return value of reset_control_deassert() - - reset: tegra-bpmp: Restore Handle errors in BPMP response - - platform/x86: samsung-laptop: Fix an unsigned comparison which can never be - negative - - ALSA: usb-audio: Fix undefined behavior due to shift overflowing the - constant - - drm/msm/disp: check the return value of kzalloc() - - selftests: KVM: Free the GIC FD when cleaning up in arch_timer - - ALSA: hda: intel-dsp-config: update AlderLake PCI IDs - - arm64: dts: imx: Fix imx8*-var-som touchscreen property sizes - - vxlan: fix error return code in vxlan_fdb_append - - cifs: Check the IOCB_DIRECT flag, not O_DIRECT - - mt76: Fix undefined behavior due to shift overflowing the constant - - brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant - - dpaa_eth: Fix missing of_node_put in dpaa_get_ts_info() - - drm/msm/mdp5: check the return of kzalloc() - - KVM: x86: hyper-v: Avoid writing to TSC page without an active vCPU - - net: macb: Restart tx only if queue pointer is lagging - - scsi: iscsi: Release endpoint ID when its freed - - scsi: iscsi: Merge suspend fields - - scsi: iscsi: Fix NOP handling during conn recovery - - scsi: qedi: Fix failed disconnect handling - - stat: fix inconsistency between struct stat and struct compat_stat - - VFS: filename_create(): fix incorrect intent. - - nvme: add a quirk to disable namespace identifiers - - nvme-pci: disable namespace identifiers for the MAXIO MAP1002/1202 - - nvme-pci: disable namespace identifiers for Qemu controllers - - irq_work: use kasan_record_aux_stack_noalloc() record callstack - - EDAC/synopsys: Read the error count from the correct register - - mm/memory-failure.c: skip huge_zero_page in memory_failure() - - memcg: sync flush only if periodic flush is delayed - - mm, hugetlb: allow for "high" userspace addresses - - oom_kill.c: futex: delay the OOM reaper to allow time for proper futex - cleanup - - mm/mmu_notifier.c: fix race in mmu_interval_notifier_remove() - - ata: pata_marvell: Check the 'bmdma_addr' beforing reading - - dma: at_xdmac: fix a missing check on list iterator - - dmaengine: imx-sdma: fix init of uart scripts - - net: atlantic: invert deep par in pm functions, preventing null derefs - - drm/radeon: fix logic inversion in radeon_sync_resv - - io_uring: free iovec if file assignment fails - - Input: omap4-keypad - fix pm_runtime_get_sync() error checking - - scsi: sr: Do not leak information in ioctl - - sched/pelt: Fix attach_entity_load_avg() corner case - - perf/core: Fix perf_mmap fail when CONFIG_PERF_USE_VMALLOC enabled - - drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised - - drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare - - powerpc/time: Always set decrementer in timer_interrupt() - - KVM: PPC: Fix TCE handling for VFIO - - drm/vc4: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage - - powerpc/perf: Fix power9 event alternatives - - powerpc/perf: Fix power10 event alternatives - - arm/xen: Fix some refcount leaks - - perf script: Always allow field 'data_src' for auxtrace - - perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event - - fs: fix acl translation - - cifs: fix NULL ptr dereference in refresh_mounts() - - cifs: use correct lock type in cifs_reconnect() - - xtensa: patch_text: Fixup last cpu should be master - - xtensa: fix a7 clobbering in coprocessor context load/store - - openvswitch: fix OOB access in reserve_sfa_size() - - gpio: Request interrupts after IRQ is initialized - - ASoC: rt5682: fix an incorrect NULL check on list iterator - - ASoC: soc-dapm: fix two incorrect uses of list iterator - - e1000e: Fix possible overflow in LTR decoding - - codecs: rt5682s: fix an incorrect NULL check on list iterator - - ARC: entry: fix syscall_trace_exit argument - - drm/vmwgfx: Fix gem refcounting and memory evictions - - arm_pmu: Validate single/group leader events - - KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog - - KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io() - - KVM: x86: Pend KVM_REQ_APICV_UPDATE during vCPU creation to fix a race - - KVM: nVMX: Defer APICv updates while L2 is active until L1 is active - - KVM: SVM: Simplify and harden helper to flush SEV guest page(s) - - KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs - - ext4: fix fallocate to use file_modified to update permissions consistently - - ext4: fix symlink file size not match to file content - - ext4: fix use-after-free in ext4_search_dir - - ext4: limit length to bitmap_maxbytes - blocksize in punch_hole - - ext4, doc: fix incorrect h_reserved size - - ext4: fix overhead calculation to account for the reserved gdt blocks - - ext4: force overhead calculation if the s_overhead_cluster makes no sense - - ext4: update the cached overhead value in the superblock - - jbd2: fix a potential race while discarding reserved buffers after an abort - - spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and - controller - - ASoC: SOF: topology: cleanup dailinks on widget unload - - io_uring: fix leaks on IOPOLL and CQE_SKIP - - arm64: dts: qcom: add IPA qcom,qmp property - - Linux 5.17.5 - - * Aquantia GbE LAN driver causes UBSAN error during kernel boot - (LP: #1958770) // Jammy update: v5.17.5 upstream stable release - (LP: #1973280) - - net: atlantic: Avoid out-of-bounds indexing - - * Jammy update: v5.17.4 upstream stable release (LP: #1973279) - - drm/amd/display: Add pstate verification and recovery for DCN31 - - drm/amd/display: Fix p-state allow debug index on dcn31 - - cpuidle: PSCI: Move the `has_lpi` check to the beginning of the function - - ACPI: processor idle: Check for architectural support for LPI - - net: dsa: realtek: allow subdrivers to externally lock regmap - - net: dsa: realtek: rtl8365mb: serialize indirect PHY register access - - net: dsa: realtek: make interface drivers depend on OF - - btrfs: remove no longer used counter when reading data page - - btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups() - - RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put() - - media: si2157: unknown chip version Si2147-A30 ROM 0x50 - - uapi/linux/stddef.h: Add include guards - - drm/amdgpu: Ensure HDA function is suspended before ASIC reset - - btrfs: release correct delalloc amount in direct IO write path - - btrfs: fix btrfs_submit_compressed_write cgroup attribution - - btrfs: return allocated block group from do_chunk_alloc() - - ALSA: core: Add snd_card_free_on_error() helper - - ALSA: sis7019: Fix the missing error handling - - ALSA: ali5451: Fix the missing snd_card_free() call at probe error - - ALSA: als300: Fix the missing snd_card_free() call at probe error - - ALSA: als4000: Fix the missing snd_card_free() call at probe error - - ALSA: atiixp: Fix the missing snd_card_free() call at probe error - - ALSA: au88x0: Fix the missing snd_card_free() call at probe error - - ALSA: aw2: Fix the missing snd_card_free() call at probe error - - ALSA: azt3328: Fix the missing snd_card_free() call at probe error - - ALSA: bt87x: Fix the missing snd_card_free() call at probe error - - ALSA: ca0106: Fix the missing snd_card_free() call at probe error - - ALSA: cmipci: Fix the missing snd_card_free() call at probe error - - ALSA: cs4281: Fix the missing snd_card_free() call at probe error - - ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error - - ALSA: echoaudio: Fix the missing snd_card_free() call at probe error - - ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error - - ALSA: ens137x: Fix the missing snd_card_free() call at probe error - - ALSA: es1938: Fix the missing snd_card_free() call at probe error - - ALSA: es1968: Fix the missing snd_card_free() call at probe error - - ALSA: fm801: Fix the missing snd_card_free() call at probe error - - ALSA: galaxy: Fix the missing snd_card_free() call at probe error - - ALSA: hdsp: Fix the missing snd_card_free() call at probe error - - ALSA: hdspm: Fix the missing snd_card_free() call at probe error - - ALSA: ice1724: Fix the missing snd_card_free() call at probe error - - ALSA: intel8x0: Fix the missing snd_card_free() call at probe error - - ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error - - ALSA: korg1212: Fix the missing snd_card_free() call at probe error - - ALSA: lola: Fix the missing snd_card_free() call at probe error - - ALSA: lx6464es: Fix the missing snd_card_free() call at probe error - - ALSA: maestro3: Fix the missing snd_card_free() call at probe error - - ALSA: oxygen: Fix the missing snd_card_free() call at probe error - - ALSA: riptide: Fix the missing snd_card_free() call at probe error - - ALSA: rme32: Fix the missing snd_card_free() call at probe error - - ALSA: rme9652: Fix the missing snd_card_free() call at probe error - - ALSA: rme96: Fix the missing snd_card_free() call at probe error - - ALSA: sc6000: Fix the missing snd_card_free() call at probe error - - ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error - - ALSA: via82xx: Fix the missing snd_card_free() call at probe error - - ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb - - ALSA: memalloc: Add fallback SG-buffer allocations for x86 - - ALSA: nm256: Don't call card private_free at probe error path - - drm/msm: Add missing put_task_struct() in debugfs path - - nfsd: Fix a write performance regression - - firmware: arm_scmi: Remove clear channel call on the TX channel - - memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe - - Revert "ath11k: mesh: add support for 256 bitmap in blockack frames in 11ax" - - firmware: arm_scmi: Fix sorting of retrieved clock rates - - media: rockchip/rga: do proper error checking in probe - - KVM: arm64: Generalise VM features into a set of flags - - KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs - - SUNRPC: Fix the svc_deferred_event trace class - - net/sched: flower: fix parsing of ethertype following VLAN header - - veth: Ensure eth header is in skb's linear part - - gpiolib: acpi: use correct format characters - - cifs: release cached dentries only if mount is complete - - ice: arfs: fix use-after-free when freeing @rx_cpu_rmap - - Revert "iavf: Fix deadlock occurrence during resetting VF interface" - - net: mdio: don't defer probe forever if PHY IRQ provider is missing - - mlxsw: i2c: Fix initialization error flow - - sctp: use the correct skb for security_sctp_assoc_request - - net/sched: fix initialization order when updating chain 0 head - - cachefiles: unmark inode in use in error path - - cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr - - net: dsa: felix: suppress -EPROBE_DEFER errors - - KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table - - KVM: selftests: riscv: Fix alignment of the guest_hang() function - - RISC-V: KVM: include missing hwcap.h into vcpu_fp - - io_uring: flag the fact that linked file assignment is sane - - net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link - - net/sched: taprio: Check if socket flags are valid - - cfg80211: hold bss_lock while updating nontrans_list - - mac80211: fix ht_capa printout in debugfs - - netfilter: nft_socket: make cgroup match work in input too - - drm/msm: Fix range size vs end confusion - - drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init() - - drm/msm/dp: add fail safe mode outside of event_mutex context - - io_uring: stop using io_wq_work as an fd placeholder - - net/smc: use memcpy instead of snprintf to avoid out of bounds read - - net/smc: Fix NULL pointer dereference in smc_pnet_find_ib() - - scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63 - - scsi: pm80xx: Enable upper inbound, outbound queues - - scsi: iscsi: Move iscsi_ep_disconnect() - - scsi: iscsi: Fix offload conn cleanup when iscsid restarts - - scsi: iscsi: Fix endpoint reuse regression - - scsi: iscsi: Fix conn cleanup and stop race during iscsid restart - - scsi: iscsi: Fix unbound endpoint error handling - - sctp: Initialize daddr on peeled off socket - - net: lan966x: Fix when a port's upper is changed. - - net: lan966x: Stop processing the MAC entry is port is wrong. - - netfilter: nf_tables: nft_parse_register can return a negative value - - io_uring: fix assign file locking issue - - ALSA: ad1889: Fix the missing snd_card_free() call at probe error - - ALSA: mtpav: Don't call card private_free at probe error path - - io_uring: move io_uring_rsrc_update2 validation - - io_uring: verify that resv2 is 0 in io_uring_rsrc_update2 - - io_uring: verify pad field is 0 in io_get_ext_arg - - testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set - - ALSA: usb-audio: Increase max buffer size - - ALSA: usb-audio: Limit max buffer and period sizes per time - - perf tools: Fix misleading add event PMU debug message - - macvlan: Fix leaking skb in source mode with nodst option - - net: ftgmac100: access hardware register after clock ready - - nfc: nci: add flush_workqueue to prevent uaf - - cifs: potential buffer overflow in handling symlinks - - dm mpath: only use ktime_get_ns() in historical selector - - vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used - - tun: annotate access to queue->trans_start - - net: dsa: felix: fix tagging protocol changes with multiple CPU ports - - net: bcmgenet: Revert "Use stronger register read/writes to assure ordering" - - block: fix offset/size check in bio_trim() - - block: null_blk: end timed out poll request - - io_uring: abort file assignment prior to assigning creds - - KVM: PPC: Book3S HV P9: Fix "lost kick" race - - drm/amd: Add USBC connector ID - - btrfs: fix fallocate to use file_modified to update permissions consistently - - btrfs: do not warn for free space inode in cow_file_range - - drm/amdgpu: conduct a proper cleanup of PDB bo - - drm/amdgpu/gmc: use PCI BARs for APUs in passthrough - - drm/amd/display: fix audio format not updated after edid updated - - drm/amd/display: FEC check in timing validation - - drm/amd/display: Update VTEM Infopacket definition - - drm/amdkfd: Fix Incorrect VMIDs passed to HWS - - drm/amdgpu/vcn: improve vcn dpg stop procedure - - drm/amdkfd: Check for potential null return of kmalloc_array() - - Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in - isolated guests - - Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device - - PCI: hv: Propagate coherence from VMbus device to PCI device - - Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer - - scsi: target: tcmu: Fix possible page UAF - - scsi: lpfc: Improve PCI EEH Error and Recovery Handling - - scsi: lpfc: Fix unload hang after back to back PCI EEH faults - - scsi: lpfc: Fix queue failures when recovering from PCI parity error - - scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024 - - net: micrel: fix KS8851_MLL Kconfig - - ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs - - gpu: ipu-v3: Fix dev_dbg frequency output - - regulator: wm8994: Add an off-on delay for WM8994 variant - - static_call: Properly initialise DEFINE_STATIC_CALL_RET0() - - arm64: alternatives: mark patch_alternative() as `noinstr` - - tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry - - net: axienet: setup mdio unconditionally - - Drivers: hv: balloon: Disable balloon and hot-add accordingly - - net: usb: aqc111: Fix out-of-bounds accesses in RX fixup - - myri10ge: fix an incorrect free for skb in myri10ge_sw_tso - - spi: cadence-quadspi: fix protocol setup for non-1-1-X operations - - drm/amd/display: Correct Slice reset calculation - - drm/amd/display: Enable power gating before init_pipes - - drm/amd/display: Revert FEC check in validation - - drm/amd/display: Fix allocate_mst_payload assert on resume - - drbd: set QUEUE_FLAG_STABLE_WRITES - - scsi: mpt3sas: Fail reset operation if config request timed out - - scsi: mvsas: Add PCI ID of RocketRaid 2640 - - scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan - - drivers: net: slip: fix NPD bug in sl_tx_timeout() - - x86,bpf: Avoid IBT objtool warning - - io_uring: zero tag on rsrc removal - - io_uring: use nospec annotation for more indexes - - perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant - - mm/secretmem: fix panic when growing a memfd_secret - - mm, page_alloc: fix build_zonerefs_node() - - mm: fix unexpected zeroed page mapping with zram swap - - mm: kmemleak: take a full lowmem check in kmemleak_*_phys() - - hugetlb: do not demote poisoned hugetlb pages - - revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders" - - revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE" - - KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded - - SUNRPC: Fix NFSD's request deferral on RDMA transports - - memory: renesas-rpc-if: fix platform-device leak in error path - - gcc-plugins: latent_entropy: use /dev/urandom - - cifs: verify that tcon is valid before dereference in cifs_kill_sb - - gpio: sim: fix setting and getting multiple lines - - ath9k: Properly clear TX status area before reporting to mac80211 - - ath9k: Fix usage of driver-private space in tx_info - - btrfs: zoned: activate block group only for extent allocation - - btrfs: fix root ref counts in error handling in btrfs_get_root_ref - - btrfs: mark resumed async balance as writing - - ALSA: hda/realtek: Add quirk for Clevo PD50PNT - - ALSA: hda/realtek: add quirk for Lenovo Thinkpad X12 speakers - - ALSA: pcm: Test for "silence" field in struct "pcm_format_data" - - nl80211: correctly check NL80211_ATTR_REG_ALPHA2 size - - ipv6: fix panic when forwarding a pkt with no in6 dev - - drm/amd/display: don't ignore alpha property on pre-multiplied mode - - drm/amdgpu: Enable gfxoff quirk on MacBook Pro - - x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits - - x86/tsx: Disable TSX development mode at boot - - genirq/affinity: Consider that CPUs on nodes can be unbalanced - - tick/nohz: Use WARN_ON_ONCE() to prevent console saturation - - ARM: davinci: da850-evm: Avoid NULL pointer dereference - - ep93xx: clock: Fix UAF in ep93xx_clk_register_gate() - - dm integrity: fix memory corruption when tag_size is less than digest size - - i2c: dev: check return value when calling dev_set_name() - - Revert "net: dsa: setup master before ports" - - smp: Fix offline cpu check in flush_smp_call_function_queue() - - dt-bindings: memory: snps,ddrc-3.80a compatible also need interrupts - - i2c: pasemi: Wait for write xfers to finish - - dt-bindings: net: snps: remove duplicate name - - timers: Fix warning condition in __run_timers() - - dma-direct: avoid redundant memory sync for swiotlb - - mm, kfence: support kmem_dump_obj() for KFENCE objects - - drm/i915: Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL - - cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state - - ax25: Fix UAF bugs in ax25 timers - - io_uring: use right issue_flags for splice/tee - - io_uring: fix poll file assign deadlock - - io_uring: fix poll error reporting - - Linux 5.17.4 - - [Config] updateconfigs following v5.17.4 - - -- Paolo Pisati Fri, 13 May 2022 10:48:58 +0200 - linux-hwe-5.17 (5.17.0-8.8~22.04.2) jammy; urgency=medium * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.2 -proposed tracker (LP: #1969219) diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/config/amd64/config.common.amd64 linux-oem-5.17-5.17.0/debian.hwe-5.17/config/amd64/config.common.amd64 --- linux-oem-5.17-5.17.0/debian.hwe-5.17/config/amd64/config.common.amd64 +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/config/amd64/config.common.amd64 @@ -57,7 +57,7 @@ CONFIG_CAIF=m CONFIG_CAN=m CONFIG_CB710_CORE=m -CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0" +CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 11.2.0-18ubuntu1) 11.2.0" CONFIG_CDROM_PKTCDVD=m # CONFIG_CMA is not set CONFIG_CMDLINE_PARTITION=y diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/config/annotations linux-oem-5.17-5.17.0/debian.hwe-5.17/config/annotations --- linux-oem-5.17-5.17.0/debian.hwe-5.17/config/annotations +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/config/annotations @@ -5851,7 +5851,7 @@ CONFIG_NET_DSA_XRS700X_I2C policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_XRS700X_MDIO policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_QCA8K policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> -CONFIG_NET_DSA_REALTEK_SMI policy<{'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> +CONFIG_NET_DSA_REALTEK_SMI policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_SMSC_LAN9303_I2C policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_SMSC_LAN9303_MDIO policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_VITESSE_VSC73XX_SPI policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/config/config.common.ubuntu linux-oem-5.17-5.17.0/debian.hwe-5.17/config/config.common.ubuntu --- linux-oem-5.17-5.17.0/debian.hwe-5.17/config/config.common.ubuntu +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/config/config.common.ubuntu @@ -1222,7 +1222,6 @@ CONFIG_BLK_DEV_DM_BUILTIN=y CONFIG_BLK_DEV_DRBD=m CONFIG_BLK_DEV_FD=m -# CONFIG_BLK_DEV_FD_RAWCMD is not set CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INTEGRITY=y CONFIG_BLK_DEV_INTEGRITY_T10=y diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/reconstruct linux-oem-5.17-5.17.0/debian.hwe-5.17/reconstruct --- linux-oem-5.17-5.17.0/debian.hwe-5.17/reconstruct +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/reconstruct @@ -6,7 +6,6 @@ rm -f 'drivers/net/dsa/rtl8365mb.c' rm -f 'drivers/net/dsa/rtl8366.c' rm -f 'drivers/net/dsa/rtl8366rb.c' -rm -f 'tools/perf/arch/powerpc/util/machine.c' chmod +x 'debian.hwe-5.17/scripts/helpers/copy-files' chmod +x 'debian.hwe-5.17/scripts/helpers/local-mangle' chmod +x 'debian/cloud-tools/hv_get_dhcp_info' diff -u linux-oem-5.17-5.17.0/debian.hwe-5.17/tracking-bug linux-oem-5.17-5.17.0/debian.hwe-5.17/tracking-bug --- linux-oem-5.17-5.17.0/debian.hwe-5.17/tracking-bug +++ linux-oem-5.17-5.17.0/debian.hwe-5.17/tracking-bug @@ -1 +1 @@ -1971893 2022.05.09-1 +1969219 d2022.04.13-1 diff -u linux-oem-5.17-5.17.0/debian.oem/abi/amd64/oem.modules linux-oem-5.17-5.17.0/debian.oem/abi/amd64/oem.modules --- linux-oem-5.17-5.17.0/debian.oem/abi/amd64/oem.modules +++ linux-oem-5.17-5.17.0/debian.oem/abi/amd64/oem.modules @@ -4067,6 +4067,7 @@ rds_rdma rds_tcp realtek +realtek-smi redboot redrat3 reed_solomon diff -u linux-oem-5.17-5.17.0/debian.oem/changelog linux-oem-5.17-5.17.0/debian.oem/changelog --- linux-oem-5.17-5.17.0/debian.oem/changelog +++ linux-oem-5.17-5.17.0/debian.oem/changelog @@ -1,823 +1,14 @@ -linux-oem-5.17 (5.17.0-1005.5) jammy; urgency=medium +linux-oem-5.17 (5.17.0-1006.6) jammy; urgency=medium - * jammy/linux-oem-5.17: 5.17.0-1005.5 -proposed tracker (LP: #1971892) + * jammy/linux-oem-5.17: 5.17.0-1006.6 -proposed tracker (LP: #1973926) - * build backport-iwlwifi-dkms as linux-modules-iwlwifi-ABI (LP: #1969434) - - [Packaging] support standalone dkms module builds - - [Packaging] drop do_ arch specific configs - - * Packaging resync (LP: #1786013) - - debian/dkms-versions -- update from kernel-versions (main/master) - - * e1000e report hardware hang (LP: #1973104) - - SAUCE: e1000e: Enable GPT clock before sending message to CSME - - * Headset mic with Cirrus logic codec doesn't work (LP: #1972815) - - SAUCE: ASoC: cs42l42: Move CS42L42 register descriptions to general include - - SAUCE: ALSA: hda/cs8409: Use general cs42l42 include in cs8409 hda driver - - SAUCE: ALSA: hda/cs8409: Support manual mode detection for CS42L42 - - * Support Cirrus audio codec configurations for Odin platform (LP: #1968861) - - SAUCE: ALSA: hda/cs8409: Support new Odin Variants - - SAUCE: ALSA: hda/cs8409: Add Speaker Playback Switch for Cyborg - - * Support different Cirrus audio codec configurations on Dell laptops - (LP: #1967988) - - ALSA: hda/cs8409: Fix Warlock to use mono mic configuration - - ALSA: hda/cs8409: Re-order quirk table into ascending order - - ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants - - ALSA: hda/cs8409: Support new Warlock MLK Variants - - ALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg - - ALSA: hda/cs8409: Add new Dolphin HW variants - - * Update OS policy capability handshake (LP: #1966089) - - thermal: int340x: Update OS policy capability handshake - - * Miscellaneous Ubuntu changes - - [Config] update configs and annotations after stable updates - - [ Ubuntu: 5.17.0-8.8~22.04.3 ] + * ext4: limit length to bitmap_maxbytes (LP: #1972281) + - ext4: limit length to bitmap_maxbytes - blocksize in punch_hole - * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.3 -proposed tracker (LP: #1971893) - * Jammy update: v5.17.7 upstream stable release (LP: #1973282) - - pci_irq_vector() can't be used in atomic context any longer. This conflicts - with the usage of this function in nic_mbx_intr_handler(). age of this - function in nic_mbx_intr_handler(). - - ipmi: When handling send message responses, don't process the message - - ipmi:ipmi_ipmb: Fix null-ptr-deref in ipmi_unregister_smi() - - MIPS: Fix CP0 counter erratum detection for R4k CPUs - - Revert "parisc: Mark cr16 CPU clocksource unstable on all SMP machines" - - Revert "parisc: Mark sched_clock unstable only if clocks are not - syncronized" - - parisc: Merge model and model name into one line in /proc/cpuinfo - - ALSA: hda/realtek: Add quirk for Yoga Duet 7 13ITL6 speakers - - ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes - - mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC - - mmc: sunxi-mmc: Fix DMA descriptors allocated above 32 bits - - mmc: core: Set HS clock speed before sending HS CMD13 - - gpiolib: of: fix bounds check for 'gpio-reserved-ranges' - - x86/fpu: Prevent FPU state corruption - - KVM: x86/svm: Account for family 17h event renumberings in - amd_pmc_perf_hw_id - - iommu/vt-d: Calculate mask for non-aligned flushes - - iommu/arm-smmu-v3: Fix size calculation in arm_smmu_mm_invalidate_range() - - drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT - - drm/amdgpu: do not use passthrough mode in Xen dom0 - - RISC-V: relocate DTB if it's outside memory region - - hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk - - Revert "SUNRPC: attempt AF_LOCAL connect on setup" - - timekeeping: Mark NMI safe time accessors as notrace - - firewire: fix potential uaf in outbound_phy_packet_callback() - - firewire: remove check of list iterator against head past the loop body - - firewire: core: extend card->lock in fw_core_handle_bus_reset - - net: stmmac: disable Split Header (SPH) for Intel platforms - - btrfs: sysfs: export the balance paused state of exclusive operation - - btrfs: force v2 space cache usage for subpage mount - - btrfs: do not BUG_ON() on failure to update inode when setting xattr - - btrfs: export a helper for compression hard check - - btrfs: do not allow compression on nodatacow files - - btrfs: skip compression property for anything other than files and dirs - - genirq: Synchronize interrupt thread startup - - ASoC: da7219: Fix change notifications for tone generator frequency - - ASoC: rt9120: Correct the reg 0x09 size to one byte - - ASoC: wm8958: Fix change notifications for DSP controls - - ASoC: meson: Fix event generation for AUI ACODEC mux - - ASoC: meson: Fix event generation for G12A tohdmi mux - - ASoC: meson: Fix event generation for AUI CODEC mux - - s390/dasd: fix data corruption for ESE devices - - s390/dasd: prevent double format of tracks for ESE devices - - s390/dasd: Fix read for ESE with blksize < 4k - - s390/dasd: Fix read inconsistency for ESE DASD devices - - can: grcan: grcan_close(): fix deadlock - - can: isotp: remove re-binding of bound socket - - can: grcan: use ofdev->dev when allocating DMA memory - - can: grcan: grcan_probe(): fix broken system id check for errata workaround - needs - - can: grcan: only use the NAPI poll budget for RX - - nfc: replace improper check device_is_registered() in netlink related - functions - - nfc: nfcmrvl: main: reorder destructive operations in - nfcmrvl_nci_unregister_dev to avoid bugs - - NFC: netlink: fix sleep in atomic bug when firmware download timeout - - gpio: visconti: Fix fwnode of GPIO IRQ - - gpio: pca953x: fix irq_stat not updated when irq is disabled (irq_mask not - set) - - hwmon: (adt7470) Fix warning on module removal - - hwmon: (pmbus) disable PEC if not enabled - - ASoC: dmaengine: Restore NULL prepare_slave_config() callback - - ASoC: meson: axg-tdm-interface: Fix formatters in trigger" - - ASoC: meson: axg-card: Fix nonatomic links - - ASoC: soc-ops: fix error handling - - iommu/vt-d: Drop stop marker messages - - iommu/dart: check return value after calling platform_get_resource() - - net/mlx5e: Fix trust state reset in reload - - net/mlx5: Fix slab-out-of-bounds while reading resource dump menu - - net/mlx5e: Fix wrong source vport matching on tunnel rule - - net/mlx5e: Don't match double-vlan packets if cvlan is not set - - net/mlx5e: CT: Fix queued up restore put() executing after relevant ft - release - - net/mlx5e: Fix the calling of update_buffer_lossy() API - - net/mlx5: Fix matching on inner TTC - - net/mlx5: Avoid double clear or set of sync reset requested - - net/mlx5: Fix deadlock in sync reset flow - - net/mlx5e: Lag, Fix use-after-free in fib event handler - - net/mlx5e: Lag, Fix fib_info pointer assignment - - net/mlx5e: Lag, Don't skip fib events on current dst - - net/mlx5e: TC, fix decap fallback to uplink when int port not supported - - selftests/seccomp: Don't call read() on TTY from background pgrp - - ALSA: hda/realtek: Fix mute led issue on thinkpad with cs35l41 s-codec - - SUNRPC release the transport of a relocated task with an assigned transport - - RDMA/siw: Fix a condition race issue in MPA request processing - - RDMA/irdma: Flush iWARP QP if modified to ERR from RTR state - - RDMA/irdma: Reduce iWARP QP destroy time - - RDMA/irdma: Fix possible crash due to NULL netdev in notifier - - NFSv4: Don't invalidate inode attributes on delegation return - - net: ethernet: mediatek: add missing of_node_put() in mtk_sgmii_init() - - net: dsa: mt7530: add missing of_node_put() in mt7530_setup() - - net: stmmac: dwmac-sun8i: add missing of_node_put() in - sun8i_dwmac_register_mdio_mux() - - net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller - - net: cpsw: add missing of_node_put() in cpsw_probe_dt() - - net: igmp: respect RCU rules in ip_mc_source() and ip_mc_msfilter() - - net: emaclite: Add error handling for of_address_to_resource() - - selftests/net: so_txtime: fix parsing of start time stamp on 32 bit systems - - selftests/net: so_txtime: usage(): fix documentation of default clock - - drm/msm/dp: remove fail safe mode related code - - hinic: fix bug of wq out of bound access - - SUNRPC: Don't leak sockets in xs_local_connect() - - mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter() - - rxrpc: Enable IPv6 checksums on transport socket - - selftests: mirror_gre_bridge_1q: Avoid changing PVID while interface is - operational - - dt-bindings: pci: apple,pcie: Drop max-link-speed from example - - bnxt_en: Fix possible bnxt_open() failure caused by wrong RFS flag - - bnxt_en: Fix unnecessary dropping of RX packets - - selftests: ocelot: tc_flower_chains: specify conform-exceed action for - policer - - smsc911x: allow using IRQ0 - - btrfs: always log symlinks in full mode - - parisc: Mark cr16 clock unstable on all SMP machines - - gpio: mvebu: drop pwm base assignment - - net: rds: acquire refcount on TCP sockets - - kvm: x86/cpuid: Only provide CPUID leaf 0xA if host has architectural PMU - - fbdev: Make fb_release() return -ENODEV if fbdev was unregistered - - iommu/dart: Add missing module owner to ops structure - - KVM: SEV: Mark nested locking of vcpu->lock - - KVM: VMX: Exit to userspace if vCPU has injected exception and invalid state - - kvm: selftests: do not use bitfields larger than 32-bits for PTEs - - KVM: selftests: Silence compiler warning in the kvm_page_table_test - - x86/kvm: Preserve BSP MSR_KVM_POLL_CONTROL across suspend/resume - - KVM: x86: Do not change ICR on write to APIC_SELF_IPI - - KVM: x86/mmu: avoid NULL-pointer dereference on page freeing bugs - - KVM: LAPIC: Enable timer posted-interrupt only when mwait/hlt is advertised - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - mmc: rtsx: add 74 Clocks in power on flow - - PCI: aardvark: Replace custom PCIE_CORE_INT_* macros with PCI_INTERRUPT_* - - PCI: aardvark: Rewrite IRQ code to chained IRQ handler - - PCI: aardvark: Check return value of generic_handle_domain_irq() when - processing INTx IRQ - - PCI: aardvark: Make MSI irq_chip structures static driver structures - - PCI: aardvark: Make msi_domain_info structure a static driver structure - - PCI: aardvark: Use dev_fwnode() instead of of_node_to_fwnode(dev->of_node) - - PCI: aardvark: Refactor unmasking summary MSI interrupt - - PCI: aardvark: Add support for masking MSI interrupts - - PCI: aardvark: Fix setting MSI address - - PCI: aardvark: Enable MSI-X support - - PCI: aardvark: Add support for ERR interrupt on emulated bridge - - PCI: aardvark: Optimize writing PCI_EXP_RTCTL_PMEIE and PCI_EXP_RTSTA_PME on - emulated bridge - - PCI: aardvark: Add support for PME interrupts - - PCI: aardvark: Fix support for PME requester on emulated bridge - - PCI: aardvark: Use separate INTA interrupt for emulated root bridge - - PCI: aardvark: Remove irq_mask_ack() callback for INTx interrupts - - PCI: aardvark: Don't mask irq when mapping - - PCI: aardvark: Drop __maybe_unused from advk_pcie_disable_phy() - - PCI: aardvark: Update comment about link going down after link-up - - Linux 5.17.7 - * Jammy update: v5.17.6 upstream stable release (LP: #1973281) - - usb: mtu3: fix USB 3.0 dual-role-switch from device to host - - floppy: disable FDRAWCMD by default - - USB: quirks: add a Realtek card reader - - USB: quirks: add STRING quirk for VCOM device - - USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS - - USB: serial: cp210x: add PIDs for Kamstrup USB Meter Reader - - USB: serial: option: add support for Cinterion MV32-WA/MV32-WB - - USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions - - usb: xhci: tegra:Fix PM usage reference leak of - tegra_xusb_unpowergate_partitions - - xhci: Enable runtime PM on second Alderlake controller - - xhci: stop polling roothubs after shutdown - - xhci: increase usb U3 -> U0 link resume timeout from 100ms to 500ms - - iio: dac: ad5592r: Fix the missing return value. - - iio: scd4x: check return of scd4x_write_and_fetch - - iio: dac: ad5446: Fix read_raw not returning set value - - iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() - - iio: imu: inv_icm42600: Fix I2C init possible nack - - usb: misc: fix improper handling of refcount in uss720_probe() - - usb: core: Don't hold the device lock while sleeping in do_proc_control() - - usb: typec: ucsi: Fix reuse of completion structure - - usb: typec: ucsi: Fix role swapping - - usb: gadget: uvc: Fix crash when encoding data for usb request - - usb: gadget: configfs: clear deactivation flag in - configfs_composite_unbind() - - usb: dwc3: Try usb-role-switch first in dwc3_drd_init - - usb: dwc3: core: Fix tx/rx threshold settings - - usb: dwc3: core: Only handle soft-reset in DCTL - - usb: dwc3: gadget: Return proper request status - - usb: dwc3: pci: add support for the Intel Meteor Lake-P - - usb: cdns3: Fix issue for clear halt endpoint - - usb: phy: generic: Get the vbus supply - - kernfs: fix NULL dereferencing in kernfs_remove - - binder: Gracefully handle BINDER_TYPE_FDA objects with num_fds=0 - - binder: Address corner cases in deferred copy and fixup - - serial: imx: fix overrun interrupts in DMA mode - - serial: amba-pl011: do not time out prematurely when draining tx fifo - - serial: 8250: Also set sticky MCR bits in console restoration - - serial: 8250: Correct the clock for EndRun PTP/1588 PCIe device - - eeprom: at25: Use DMA safe buffers - - arch_topology: Do not set llc_sibling if llc_id is invalid - - topology: make core_mask include at least cluster_siblings - - ceph: fix possible NULL pointer dereference for req->r_session - - bus: mhi: host: pci_generic: Add missing poweroff() PM callback - - bus: mhi: host: pci_generic: Flush recovery worker during freeze - - arm64: dts: imx8mm-venice: fix spi2 pin configuration - - pinctrl: samsung: fix missing GPIOLIB on ARM64 Exynos config - - f2fs: should not truncate blocks during roll-forward recovery - - hex2bin: make the function hex_to_bin constant-time - - hex2bin: fix access beyond string end - - bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc() - - riscv: patch_text: Fixup last cpu should be master - - x86/cpu: Load microcode during restore_processor_state() - - x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests - - iocost: don't reset the inuse weight of under-weighted debtors - - virtio_net: fix wrong buf address calculation when using xdp - - cpufreq: qcom-hw: drop affinity hint before freeing the IRQ - - cpufreq: qcom-hw: fix the race between LMH worker and cpuhp - - cpufreq: qcom-hw: fix the opp entries refcounting - - cpufreq: qcom-cpufreq-hw: Fix throttle frequency value on EPSS platforms - - video: fbdev: udlfb: properly check endpoint type - - arm64: dts: meson: remove CPU opps below 1GHz for G12B boards - - arm64: dts: meson: remove CPU opps below 1GHz for SM1 boards - - iio: dac: ad3552r: fix signedness bug in ad3552r_reset() - - iio:imu:bmi160: disable regulator in error path - - iio:filter:admv8818: select REGMAP_SPI for ADMV8818 - - mtd: rawnand: fix ecc parameters for mt7622 - - tee: optee: add missing mutext_destroy in optee_ffa_probe - - xsk: Fix l2fwd for copy mode + busy poll combo - - arm64: dts: imx8qm: Correct SCU clock controller's compatible property - - USB: Fix xhci event ring dequeue pointer ERDP update issue - - soc: imx: imx8m-blk-ctrl: Fix IMX8MN_DISPBLK_PD_ISI hang - - ARM: dts: imx6qdl-apalis: Fix sgtl5000 detection issue - - iio:dac:ad3552r: Fix an IS_ERR() vs NULL check - - arm64: dts: imx8mq-tqma8mq: change the spi-nor tx - - arm64: dts: imx8mn: Fix SAI nodes - - arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO pin labeling for CON1 - - phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe - - phy: samsung: exynos5250-sata: fix missing device put in probe error paths - - ARM: OMAP2+: Fix refcount leak in omap_gic_of_init - - bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific - - ARM: dts: dra7: Fix suspend warning for vpe powerdomain - - phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks - - ARM: dts: at91: Map MCLK for wm8731 on at91sam9g20ek - - ARM: dts: at91: sama5d4_xplained: fix pinctrl phandle name - - ARM: dts: at91: fix pinctrl phandles - - phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe - - phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe - - interconnect: qcom: sc7180: Drop IP0 interconnects - - interconnect: qcom: sdx55: Drop IP0 interconnects - - ARM: dts: Fix mmc order for omap3-gta04 - - ARM: dts: am33xx-l4: Add missing touchscreen clock properties - - ARM: dts: am3517-evm: Fix misc pinmuxing - - ARM: dts: logicpd-som-lv: Fix wrong pinmuxing on OMAP35 - - pinctrl: qcom: sm6350: fix order of UFS & SDC pins - - ipvs: correctly print the memory size of ip_vs_conn_tab - - phy: amlogic: fix error path in phy_g12a_usb3_pcie_probe() - - pinctrl: mediatek: moore: Fix build error - - mtd: rawnand: Fix return value check of wait_for_completion_timeout - - mtd: fix 'part' field data corruption in mtd_info - - pinctrl: stm32: Do not call stm32_gpio_get() for edge triggered IRQs in EOI - - memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode - - net: dsa: Add missing of_node_put() in dsa_port_link_register_of - - netfilter: nft_set_rbtree: overlap detection with element re-addition after - deletion - - bpf, lwt: Fix crash when using bpf_skb_set_tunnel_key() from bpf_xmit lwt - hook - - pinctrl: rockchip: fix RK3308 pinmux bits - - tcp: md5: incorrect tcp_header_len for incoming connections - - pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested - - tcp: ensure to use the most recently sent skb when filling the rate sample - - wireguard: device: check for metadata_dst with skb_valid_dst() - - sctp: check asoc strreset_chunk in sctp_generate_reconf_event - - ARM: dts: imx6ull-colibri: fix vqmmc regulator - - arm64: dts: imx8mn-ddr4-evk: Describe the 32.768 kHz PMIC clock - - pinctrl: pistachio: fix use of irq_of_parse_and_map() - - cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe - - net: hns3: clear inited state and stop client after failed to register - netdev - - net: hns3: fix error log of tx/rx tqps stats - - net: hns3: modify the return code of hclge_get_ring_chain_from_mbx - - net: hns3: add validity check for message data length - - net: hns3: add return value for mailbox handling in PF - - net/smc: sync err code when tcp connection was refused - - net: lan966x: fix a couple off by one bugs - - ip_gre: Make o_seqno start from 0 in native mode - - ip6_gre: Make o_seqno start from 0 in native mode - - ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode - - tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT - - tcp: make sure treq->af_specific is initialized - - bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create() - - clk: sunxi: sun9i-mmc: check return value after calling - platform_get_resource() - - cpufreq: qcom-cpufreq-hw: Clear dcvs interrupts - - mctp: defer the kfree of object mdev->addrs - - net: bcmgenet: hide status block before TX timestamping - - net: phy: marvell10g: fix return value on error - - net: dsa: mv88e6xxx: Fix port_hidden_wait to account for port_base_addr - - drm/sun4i: Remove obsolete references to PHYS_OFFSET - - ice: wait 5 s for EMP reset after firmware flash - - Bluetooth: hci_event: Fix checking for invalid handle on error status - - net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK - - io_uring: check reserved fields for send/sendmsg - - io_uring: check reserved fields for recv/recvmsg - - netfilter: nf_conntrack_tcp: re-init for syn packets only - - netfilter: conntrack: fix udp offload timeout sysctl - - platform/x86: asus-wmi: Potential buffer overflow in - asus_wmi_evaluate_method_buf() - - platform/x86: asus-wmi: Fix driver not binding when fan curve control probe - fails - - drm/amdkfd: Fix GWS queue count - - drm/amd/display: Fix memory leak in dcn21_clock_source_create - - tls: Skip tls_append_frag on zero copy size - - bnx2x: fix napi API usage sequence - - net: fec: add missing of_node_put() in fec_enet_init_stop_mode() - - gfs2: Minor retry logic cleanup - - gfs2: Make sure not to return short direct writes - - gfs2: No short reads or writes upon glock contention - - perf arm-spe: Fix addresses of synthesized SPE events - - ixgbe: ensure IPsec VF<->PF compatibility - - net: enetc: allow tc-etf offload even with NETIF_F_CSUM_MASK - - Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits" - - tcp: fix F-RTO may not work correctly when receiving DSACK - - io_uring: fix uninitialized field in rw io_kiocb - - ASoC: soc-pcm: use GFP_KERNEL when the code is sleepable - - ASoC: cs35l41: Fix a shift-out-of-bounds warning found by UBSAN - - ASoC: rt711/5682: check if bus is active before deferred jack detection - - ASoC: Intel: soc-acpi: correct device endpoints for max98373 - - ASoC: wm8731: Disable the regulator when probing fails - - Input: cypress-sf - register a callback to disable the regulators - - ext4: fix bug_on in start_this_handle during umount filesystem - - arch: xtensa: platforms: Fix deadlock in rs_close() - - ksmbd: increment reference count of parent fp - - ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION - - erofs: fix use-after-free of on-stack io[] - - bonding: do not discard lowest hash bit for non layer3+4 hashing - - x86: __memcpy_flushcache: fix wrong alignment if size > 2^32 - - cifs: destage any unwritten data to the server before calling - copychunk_write - - drivers: net: hippi: Fix deadlock in rr_close() - - powerpc/perf: Fix 32bit compile - - ALSA: hda: intel-dsp-config: Add RaptorLake PCI IDs - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - bfq: Fix warning in bfqq_request_over_limit() - - Revert "ACPI: processor: idle: fix lockup regression on 32-bit ThinkPad T40" - - Revert "block: inherit request start time from bio for BLK_CGROUP" - - zonefs: Fix management of open zones - - zonefs: Clear inode information flags on inode creation - - kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink - occur at same time - - mtd: rawnand: qcom: fix memory corruption that causes panic - - netfilter: Update ip6_route_me_harder to consider L3 domain - - drm/amdgpu: don't runtime suspend if there are displays attached (v3) - - drm/i915: Check EDID for HDR static metadata when choosing blc - - drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses - - net: ethernet: stmmac: fix write to sgmii_adapter_base - - ACPI: processor: idle: Avoid falling back to C3 type C-states - - thermal: int340x: Fix attr.show callback prototype - - btrfs: fix direct I/O read repair for split bios - - btrfs: fix direct I/O writes for split bios on zoned devices - - btrfs: fix leaked plug after failure syncing log on zoned filesystems - - btrfs: zoned: use dedicated lock for data relocation - - btrfs: fix assertion failure during scrub due to block group reallocation - - ARM: dts: at91: sama7g5ek: enable pull-up on flexcom3 console lines - - ARM: dts: imx8mm-venice-gw{71xx,72xx,73xx}: fix OTG controller OC mode - - perf symbol: Pass is_kallsyms to symbols__fixup_end() - - perf symbol: Update symbols__fixup_end() - - perf symbol: Remove arch__symbols__fixup_end() - - tty: n_gsm: fix missing mux reset on config change at responder - - tty: n_gsm: fix restart handling via CLD command - - tty: n_gsm: fix decoupled mux resource - - tty: n_gsm: fix mux cleanup after unregister tty device - - tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2 - - tty: n_gsm: fix frame reception handling - - tty: n_gsm: fix malformed counter for out of frame data - - netfilter: nft_socket: only do sk lookups when indev is available - - tty: n_gsm: fix insufficient txframe size - - tty: n_gsm: fix wrong DLCI release order - - tty: n_gsm: fix missing explicit ldisc flush - - tty: n_gsm: fix wrong command retry handling - - tty: n_gsm: fix wrong command frame length field encoding - - tty: n_gsm: fix wrong signal octets encoding in MSC - - tty: n_gsm: fix missing tty wakeup in convergence layer type 2 - - tty: n_gsm: fix reset fifo race condition - - tty: n_gsm: fix incorrect UA handling - - tty: n_gsm: fix missing update of modem controls after DLCI open - - tty: n_gsm: fix broken virtual tty handling - - tty: n_gsm: fix invalid use of MSC in advanced option - - tty: n_gsm: fix software flow control handling - - tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output() - - objtool: Fix code relocs vs weak symbols - - objtool: Fix type of reloc::addend - - powerpc/64: Add UADDR64 relocation support - - Linux 5.17.6 - - [Config] updateconfigs following v5.17.6 - * Jammy update: v5.17.5 upstream stable release (LP: #1973280) - - etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead - - perf tools: Fix segfault accessing sample_id xyarray - - drm/amd/display: Only set PSR version when valid - - block/compat_ioctl: fix range check in BLKGETSIZE - - gfs2: assign rgrp glock before compute_bitstructs - - scsi: ufs: core: scsi_get_lba() error fix + * CVE-2022-29581 - net/sched: cls_u32: fix netns refcount changes in u32_change() - - ALSA: usb-audio: Clear MIDI port active flag after draining - - ALSA: usb-audio: add mapping for MSI MAG X570S Torpedo MAX. - - ALSA: hda/realtek: Add quirk for Clevo NP70PNP - - ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek - - ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create() - - ASoC: rk817: Use devm_clk_get() in rk817_platform_probe - - ASoC: msm8916-wcd-digital: Check failure for devm_snd_soc_register_component - - ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use - - dmaengine: idxd: fix device cleanup on disable - - dmaengine: imx-sdma: Fix error checking in sdma_event_remap - - dmaengine: mediatek:Fix PM usage reference leak of - mtk_uart_apdma_alloc_chan_resources - - dmaengine: dw-edma: Fix unaligned 64bit access - - spi: spi-mtk-nor: initialize spi controller after resume - - firmware: cs_dsp: Fix overrun of unterminated control name string - - esp: limit skb_page_frag_refill use to a single page - - spi: cadence-quadspi: fix incorrect supports_op() return value - - igc: Fix infinite loop in release_swfw_sync - - igc: Fix BUG: scheduling while atomic - - igc: Fix suspending when PTM is active - - ice: allow creating VFs for !CONFIG_NET_SWITCHDEV - - ice: fix crash in switchdev mode - - ice: Fix memory leak in ice_get_orom_civd_data() - - ALSA: hda/hdmi: fix warning about PCM count when used with SOF - - rxrpc: Restore removed timer deletion - - net/smc: Fix sock leak when release after smc_shutdown() - - net/packet: fix packet_sock xmit return value checking - - ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit() - - ip6_gre: Fix skb_under_panic in __gre6_xmit() - - net: restore alpha order to Ethernet devices in config - - net/sched: cls_u32: fix possible leak in u32_init_knode() - - l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using - netdev_master_upper_dev_get_rcu - - ipv6: make ip6_rt_gc_expire an atomic_t - - can: isotp: stop timeout monitoring when no first frame was sent - - net: dsa: hellcreek: Calculate checksums in tagger - - net: mscc: ocelot: fix broken IP multicast flooding - - netlink: reset network and mac headers in netlink_dump() - - drm/i915/display/psr: Unset enable_psr2_sel_fetch if other checks in - intel_psr2_config_valid() fails - - RISC-V: KVM: Remove 's' & 'u' as valid ISA extension - - RISC-V: KVM: Restrict the extensions that can be disabled - - net: stmmac: Use readl_poll_timeout_atomic() in atomic state - - dmaengine: idxd: match type for retries var in idxd_enqcmds() - - dmaengine: idxd: fix retry value to be constant for duration of function - call - - dmaengine: idxd: add RO check for wq max_batch_size write - - dmaengine: idxd: add RO check for wq max_transfer_size write - - dmaengine: idxd: skip clearing device context when device is read-only - - selftests: mlxsw: vxlan_flooding: Prevent flooding of unwanted packets - - selftests: mlxsw: vxlan_flooding_ipv6: Prevent flooding of unwanted packets - - userfaultfd: mark uffd_wp regardless of VM_WRITE flag - - arm64: mm: fix p?d_leaf() - - XArray: Disallow sibling entries of nodes - - drm/msm/gpu: Rename runtime suspend/resume functions - - drm/msm/gpu: Remove mutex from wait_event condition - - ARM: vexpress/spc: Avoid negative array index when !SMP - - reset: renesas: Check return value of reset_control_deassert() - - reset: tegra-bpmp: Restore Handle errors in BPMP response - - platform/x86: samsung-laptop: Fix an unsigned comparison which can never be - negative - - ALSA: usb-audio: Fix undefined behavior due to shift overflowing the - constant - - drm/msm/disp: check the return value of kzalloc() - - selftests: KVM: Free the GIC FD when cleaning up in arch_timer - - ALSA: hda: intel-dsp-config: update AlderLake PCI IDs - - arm64: dts: imx: Fix imx8*-var-som touchscreen property sizes - - vxlan: fix error return code in vxlan_fdb_append - - cifs: Check the IOCB_DIRECT flag, not O_DIRECT - - mt76: Fix undefined behavior due to shift overflowing the constant - - brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant - - dpaa_eth: Fix missing of_node_put in dpaa_get_ts_info() - - drm/msm/mdp5: check the return of kzalloc() - - KVM: x86: hyper-v: Avoid writing to TSC page without an active vCPU - - net: macb: Restart tx only if queue pointer is lagging - - scsi: iscsi: Release endpoint ID when its freed - - scsi: iscsi: Merge suspend fields - - scsi: iscsi: Fix NOP handling during conn recovery - - scsi: qedi: Fix failed disconnect handling - - stat: fix inconsistency between struct stat and struct compat_stat - - VFS: filename_create(): fix incorrect intent. - - nvme: add a quirk to disable namespace identifiers - - nvme-pci: disable namespace identifiers for the MAXIO MAP1002/1202 - - nvme-pci: disable namespace identifiers for Qemu controllers - - irq_work: use kasan_record_aux_stack_noalloc() record callstack - - EDAC/synopsys: Read the error count from the correct register - - mm/memory-failure.c: skip huge_zero_page in memory_failure() - - memcg: sync flush only if periodic flush is delayed - - mm, hugetlb: allow for "high" userspace addresses - - oom_kill.c: futex: delay the OOM reaper to allow time for proper futex - cleanup - - mm/mmu_notifier.c: fix race in mmu_interval_notifier_remove() - - ata: pata_marvell: Check the 'bmdma_addr' beforing reading - - dma: at_xdmac: fix a missing check on list iterator - - dmaengine: imx-sdma: fix init of uart scripts - - net: atlantic: invert deep par in pm functions, preventing null derefs - - drm/radeon: fix logic inversion in radeon_sync_resv - - io_uring: free iovec if file assignment fails - - Input: omap4-keypad - fix pm_runtime_get_sync() error checking - - scsi: sr: Do not leak information in ioctl - - sched/pelt: Fix attach_entity_load_avg() corner case - - perf/core: Fix perf_mmap fail when CONFIG_PERF_USE_VMALLOC enabled - - drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised - - drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare - - powerpc/time: Always set decrementer in timer_interrupt() - - KVM: PPC: Fix TCE handling for VFIO - - drm/vc4: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage - - powerpc/perf: Fix power9 event alternatives - - powerpc/perf: Fix power10 event alternatives - - arm/xen: Fix some refcount leaks - - perf script: Always allow field 'data_src' for auxtrace - - perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event - - fs: fix acl translation - - cifs: fix NULL ptr dereference in refresh_mounts() - - cifs: use correct lock type in cifs_reconnect() - - xtensa: patch_text: Fixup last cpu should be master - - xtensa: fix a7 clobbering in coprocessor context load/store - - openvswitch: fix OOB access in reserve_sfa_size() - - gpio: Request interrupts after IRQ is initialized - - ASoC: rt5682: fix an incorrect NULL check on list iterator - - ASoC: soc-dapm: fix two incorrect uses of list iterator - - e1000e: Fix possible overflow in LTR decoding - - codecs: rt5682s: fix an incorrect NULL check on list iterator - - ARC: entry: fix syscall_trace_exit argument - - drm/vmwgfx: Fix gem refcounting and memory evictions - - arm_pmu: Validate single/group leader events - - KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog - - KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io() - - KVM: x86: Pend KVM_REQ_APICV_UPDATE during vCPU creation to fix a race - - KVM: nVMX: Defer APICv updates while L2 is active until L1 is active - - KVM: SVM: Simplify and harden helper to flush SEV guest page(s) - - KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs - - ext4: fix fallocate to use file_modified to update permissions consistently - - ext4: fix symlink file size not match to file content - - ext4: fix use-after-free in ext4_search_dir - - ext4: limit length to bitmap_maxbytes - blocksize in punch_hole - - ext4, doc: fix incorrect h_reserved size - - ext4: fix overhead calculation to account for the reserved gdt blocks - - ext4: force overhead calculation if the s_overhead_cluster makes no sense - - ext4: update the cached overhead value in the superblock - - jbd2: fix a potential race while discarding reserved buffers after an abort - - spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and - controller - - ASoC: SOF: topology: cleanup dailinks on widget unload - - io_uring: fix leaks on IOPOLL and CQE_SKIP - - arm64: dts: qcom: add IPA qcom,qmp property - - Linux 5.17.5 - * Aquantia GbE LAN driver causes UBSAN error during kernel boot - (LP: #1958770) // Jammy update: v5.17.5 upstream stable release - (LP: #1973280) - - net: atlantic: Avoid out-of-bounds indexing - * Jammy update: v5.17.4 upstream stable release (LP: #1973279) - - drm/amd/display: Add pstate verification and recovery for DCN31 - - drm/amd/display: Fix p-state allow debug index on dcn31 - - cpuidle: PSCI: Move the `has_lpi` check to the beginning of the function - - ACPI: processor idle: Check for architectural support for LPI - - net: dsa: realtek: allow subdrivers to externally lock regmap - - net: dsa: realtek: rtl8365mb: serialize indirect PHY register access - - net: dsa: realtek: make interface drivers depend on OF - - btrfs: remove no longer used counter when reading data page - - btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups() - - RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put() - - media: si2157: unknown chip version Si2147-A30 ROM 0x50 - - uapi/linux/stddef.h: Add include guards - - drm/amdgpu: Ensure HDA function is suspended before ASIC reset - - btrfs: release correct delalloc amount in direct IO write path - - btrfs: fix btrfs_submit_compressed_write cgroup attribution - - btrfs: return allocated block group from do_chunk_alloc() - - ALSA: core: Add snd_card_free_on_error() helper - - ALSA: sis7019: Fix the missing error handling - - ALSA: ali5451: Fix the missing snd_card_free() call at probe error - - ALSA: als300: Fix the missing snd_card_free() call at probe error - - ALSA: als4000: Fix the missing snd_card_free() call at probe error - - ALSA: atiixp: Fix the missing snd_card_free() call at probe error - - ALSA: au88x0: Fix the missing snd_card_free() call at probe error - - ALSA: aw2: Fix the missing snd_card_free() call at probe error - - ALSA: azt3328: Fix the missing snd_card_free() call at probe error - - ALSA: bt87x: Fix the missing snd_card_free() call at probe error - - ALSA: ca0106: Fix the missing snd_card_free() call at probe error - - ALSA: cmipci: Fix the missing snd_card_free() call at probe error - - ALSA: cs4281: Fix the missing snd_card_free() call at probe error - - ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error - - ALSA: echoaudio: Fix the missing snd_card_free() call at probe error - - ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error - - ALSA: ens137x: Fix the missing snd_card_free() call at probe error - - ALSA: es1938: Fix the missing snd_card_free() call at probe error - - ALSA: es1968: Fix the missing snd_card_free() call at probe error - - ALSA: fm801: Fix the missing snd_card_free() call at probe error - - ALSA: galaxy: Fix the missing snd_card_free() call at probe error - - ALSA: hdsp: Fix the missing snd_card_free() call at probe error - - ALSA: hdspm: Fix the missing snd_card_free() call at probe error - - ALSA: ice1724: Fix the missing snd_card_free() call at probe error - - ALSA: intel8x0: Fix the missing snd_card_free() call at probe error - - ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error - - ALSA: korg1212: Fix the missing snd_card_free() call at probe error - - ALSA: lola: Fix the missing snd_card_free() call at probe error - - ALSA: lx6464es: Fix the missing snd_card_free() call at probe error - - ALSA: maestro3: Fix the missing snd_card_free() call at probe error - - ALSA: oxygen: Fix the missing snd_card_free() call at probe error - - ALSA: riptide: Fix the missing snd_card_free() call at probe error - - ALSA: rme32: Fix the missing snd_card_free() call at probe error - - ALSA: rme9652: Fix the missing snd_card_free() call at probe error - - ALSA: rme96: Fix the missing snd_card_free() call at probe error - - ALSA: sc6000: Fix the missing snd_card_free() call at probe error - - ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error - - ALSA: via82xx: Fix the missing snd_card_free() call at probe error - - ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb - - ALSA: memalloc: Add fallback SG-buffer allocations for x86 - - ALSA: nm256: Don't call card private_free at probe error path - - drm/msm: Add missing put_task_struct() in debugfs path - - nfsd: Fix a write performance regression - - firmware: arm_scmi: Remove clear channel call on the TX channel - - memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe - - Revert "ath11k: mesh: add support for 256 bitmap in blockack frames in 11ax" - - firmware: arm_scmi: Fix sorting of retrieved clock rates - - media: rockchip/rga: do proper error checking in probe - - KVM: arm64: Generalise VM features into a set of flags - - KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs - - SUNRPC: Fix the svc_deferred_event trace class - - net/sched: flower: fix parsing of ethertype following VLAN header - - veth: Ensure eth header is in skb's linear part - - gpiolib: acpi: use correct format characters - - cifs: release cached dentries only if mount is complete - - ice: arfs: fix use-after-free when freeing @rx_cpu_rmap - - Revert "iavf: Fix deadlock occurrence during resetting VF interface" - - net: mdio: don't defer probe forever if PHY IRQ provider is missing - - mlxsw: i2c: Fix initialization error flow - - sctp: use the correct skb for security_sctp_assoc_request - - net/sched: fix initialization order when updating chain 0 head - - cachefiles: unmark inode in use in error path - - cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr - - net: dsa: felix: suppress -EPROBE_DEFER errors - - KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table - - KVM: selftests: riscv: Fix alignment of the guest_hang() function - - RISC-V: KVM: include missing hwcap.h into vcpu_fp - - io_uring: flag the fact that linked file assignment is sane - - net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link - - net/sched: taprio: Check if socket flags are valid - - cfg80211: hold bss_lock while updating nontrans_list - - mac80211: fix ht_capa printout in debugfs - - netfilter: nft_socket: make cgroup match work in input too - - drm/msm: Fix range size vs end confusion - - drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init() - - drm/msm/dp: add fail safe mode outside of event_mutex context - - io_uring: stop using io_wq_work as an fd placeholder - - net/smc: use memcpy instead of snprintf to avoid out of bounds read - - net/smc: Fix NULL pointer dereference in smc_pnet_find_ib() - - scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63 - - scsi: pm80xx: Enable upper inbound, outbound queues - - scsi: iscsi: Move iscsi_ep_disconnect() - - scsi: iscsi: Fix offload conn cleanup when iscsid restarts - - scsi: iscsi: Fix endpoint reuse regression - - scsi: iscsi: Fix conn cleanup and stop race during iscsid restart - - scsi: iscsi: Fix unbound endpoint error handling - - sctp: Initialize daddr on peeled off socket - - net: lan966x: Fix when a port's upper is changed. - - net: lan966x: Stop processing the MAC entry is port is wrong. - - netfilter: nf_tables: nft_parse_register can return a negative value - - io_uring: fix assign file locking issue - - ALSA: ad1889: Fix the missing snd_card_free() call at probe error - - ALSA: mtpav: Don't call card private_free at probe error path - - io_uring: move io_uring_rsrc_update2 validation - - io_uring: verify that resv2 is 0 in io_uring_rsrc_update2 - - io_uring: verify pad field is 0 in io_get_ext_arg - - testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set - - ALSA: usb-audio: Increase max buffer size - - ALSA: usb-audio: Limit max buffer and period sizes per time - - perf tools: Fix misleading add event PMU debug message - - macvlan: Fix leaking skb in source mode with nodst option - - net: ftgmac100: access hardware register after clock ready - - nfc: nci: add flush_workqueue to prevent uaf - - cifs: potential buffer overflow in handling symlinks - - dm mpath: only use ktime_get_ns() in historical selector - - vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used - - tun: annotate access to queue->trans_start - - net: dsa: felix: fix tagging protocol changes with multiple CPU ports - - net: bcmgenet: Revert "Use stronger register read/writes to assure ordering" - - block: fix offset/size check in bio_trim() - - block: null_blk: end timed out poll request - - io_uring: abort file assignment prior to assigning creds - - KVM: PPC: Book3S HV P9: Fix "lost kick" race - - drm/amd: Add USBC connector ID - - btrfs: fix fallocate to use file_modified to update permissions consistently - - btrfs: do not warn for free space inode in cow_file_range - - drm/amdgpu: conduct a proper cleanup of PDB bo - - drm/amdgpu/gmc: use PCI BARs for APUs in passthrough - - drm/amd/display: fix audio format not updated after edid updated - - drm/amd/display: FEC check in timing validation - - drm/amd/display: Update VTEM Infopacket definition - - drm/amdkfd: Fix Incorrect VMIDs passed to HWS - - drm/amdgpu/vcn: improve vcn dpg stop procedure - - drm/amdkfd: Check for potential null return of kmalloc_array() - - Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in - isolated guests - - Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device - - PCI: hv: Propagate coherence from VMbus device to PCI device - - Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer - - scsi: target: tcmu: Fix possible page UAF - - scsi: lpfc: Improve PCI EEH Error and Recovery Handling - - scsi: lpfc: Fix unload hang after back to back PCI EEH faults - - scsi: lpfc: Fix queue failures when recovering from PCI parity error - - scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024 - - net: micrel: fix KS8851_MLL Kconfig - - ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs - - gpu: ipu-v3: Fix dev_dbg frequency output - - regulator: wm8994: Add an off-on delay for WM8994 variant - - static_call: Properly initialise DEFINE_STATIC_CALL_RET0() - - arm64: alternatives: mark patch_alternative() as `noinstr` - - tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry - - net: axienet: setup mdio unconditionally - - Drivers: hv: balloon: Disable balloon and hot-add accordingly - - net: usb: aqc111: Fix out-of-bounds accesses in RX fixup - - myri10ge: fix an incorrect free for skb in myri10ge_sw_tso - - spi: cadence-quadspi: fix protocol setup for non-1-1-X operations - - drm/amd/display: Correct Slice reset calculation - - drm/amd/display: Enable power gating before init_pipes - - drm/amd/display: Revert FEC check in validation - - drm/amd/display: Fix allocate_mst_payload assert on resume - - drbd: set QUEUE_FLAG_STABLE_WRITES - - scsi: mpt3sas: Fail reset operation if config request timed out - - scsi: mvsas: Add PCI ID of RocketRaid 2640 - - scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan - - drivers: net: slip: fix NPD bug in sl_tx_timeout() - - x86,bpf: Avoid IBT objtool warning - - io_uring: zero tag on rsrc removal - - io_uring: use nospec annotation for more indexes - - perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant - - mm/secretmem: fix panic when growing a memfd_secret - - mm, page_alloc: fix build_zonerefs_node() - - mm: fix unexpected zeroed page mapping with zram swap - - mm: kmemleak: take a full lowmem check in kmemleak_*_phys() - - hugetlb: do not demote poisoned hugetlb pages - - revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders" - - revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE" - - KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded - - SUNRPC: Fix NFSD's request deferral on RDMA transports - - memory: renesas-rpc-if: fix platform-device leak in error path - - gcc-plugins: latent_entropy: use /dev/urandom - - cifs: verify that tcon is valid before dereference in cifs_kill_sb - - gpio: sim: fix setting and getting multiple lines - - ath9k: Properly clear TX status area before reporting to mac80211 - - ath9k: Fix usage of driver-private space in tx_info - - btrfs: zoned: activate block group only for extent allocation - - btrfs: fix root ref counts in error handling in btrfs_get_root_ref - - btrfs: mark resumed async balance as writing - - ALSA: hda/realtek: Add quirk for Clevo PD50PNT - - ALSA: hda/realtek: add quirk for Lenovo Thinkpad X12 speakers - - ALSA: pcm: Test for "silence" field in struct "pcm_format_data" - - nl80211: correctly check NL80211_ATTR_REG_ALPHA2 size - - ipv6: fix panic when forwarding a pkt with no in6 dev - - drm/amd/display: don't ignore alpha property on pre-multiplied mode - - drm/amdgpu: Enable gfxoff quirk on MacBook Pro - - x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits - - x86/tsx: Disable TSX development mode at boot - - genirq/affinity: Consider that CPUs on nodes can be unbalanced - - tick/nohz: Use WARN_ON_ONCE() to prevent console saturation - - ARM: davinci: da850-evm: Avoid NULL pointer dereference - - ep93xx: clock: Fix UAF in ep93xx_clk_register_gate() - - dm integrity: fix memory corruption when tag_size is less than digest size - - i2c: dev: check return value when calling dev_set_name() - - Revert "net: dsa: setup master before ports" - - smp: Fix offline cpu check in flush_smp_call_function_queue() - - dt-bindings: memory: snps,ddrc-3.80a compatible also need interrupts - - i2c: pasemi: Wait for write xfers to finish - - dt-bindings: net: snps: remove duplicate name - - timers: Fix warning condition in __run_timers() - - dma-direct: avoid redundant memory sync for swiotlb - - mm, kfence: support kmem_dump_obj() for KFENCE objects - - drm/i915: Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL - - cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state - - ax25: Fix UAF bugs in ax25 timers - - io_uring: use right issue_flags for splice/tee - - io_uring: fix poll file assign deadlock - - io_uring: fix poll error reporting - - Linux 5.17.4 - - [Config] updateconfigs following v5.17.4 - -- Timo Aaltonen Tue, 17 May 2022 16:04:59 +0300 + -- Timo Aaltonen Thu, 19 May 2022 14:31:40 +0300 linux-oem-5.17 (5.17.0-1004.4) jammy; urgency=medium diff -u linux-oem-5.17-5.17.0/debian.oem/config/annotations linux-oem-5.17-5.17.0/debian.oem/config/annotations --- linux-oem-5.17-5.17.0/debian.oem/config/annotations +++ linux-oem-5.17-5.17.0/debian.oem/config/annotations @@ -5857,7 +5857,7 @@ CONFIG_NET_DSA_XRS700X_I2C policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_XRS700X_MDIO policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_QCA8K policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> -CONFIG_NET_DSA_REALTEK_SMI policy<{'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> +CONFIG_NET_DSA_REALTEK_SMI policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_SMSC_LAN9303_I2C policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_SMSC_LAN9303_MDIO policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> CONFIG_NET_DSA_VITESSE_VSC73XX_SPI policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm'}> diff -u linux-oem-5.17-5.17.0/debian.oem/config/config.common.ubuntu linux-oem-5.17-5.17.0/debian.oem/config/config.common.ubuntu --- linux-oem-5.17-5.17.0/debian.oem/config/config.common.ubuntu +++ linux-oem-5.17-5.17.0/debian.oem/config/config.common.ubuntu @@ -734,7 +734,6 @@ CONFIG_BLK_DEV_DM_BUILTIN=y CONFIG_BLK_DEV_DRBD=m CONFIG_BLK_DEV_FD=m -# CONFIG_BLK_DEV_FD_RAWCMD is not set CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INTEGRITY=y CONFIG_BLK_DEV_INTEGRITY_T10=y @@ -5153,6 +5152,7 @@ CONFIG_NET_DSA_MV88E6XXX_PTP=y CONFIG_NET_DSA_QCA8K=m CONFIG_NET_DSA_REALTEK=m +CONFIG_NET_DSA_REALTEK_SMI=m CONFIG_NET_DSA_SJA1105=m CONFIG_NET_DSA_SJA1105_PTP=y CONFIG_NET_DSA_SJA1105_TAS=y diff -u linux-oem-5.17-5.17.0/debian.oem/reconstruct linux-oem-5.17-5.17.0/debian.oem/reconstruct --- linux-oem-5.17-5.17.0/debian.oem/reconstruct +++ linux-oem-5.17-5.17.0/debian.oem/reconstruct @@ -7,7 +7,6 @@ rm -f 'drivers/net/dsa/rtl8366.c' rm -f 'drivers/net/dsa/rtl8366rb.c' rm -f 'drivers/platform/x86/i2c-multi-instantiate.c' -rm -f 'tools/perf/arch/powerpc/util/machine.c' chmod +x 'debian.hwe-5.17/scripts/helpers/copy-files' chmod +x 'debian.hwe-5.17/scripts/helpers/local-mangle' chmod +x 'debian/cloud-tools/hv_get_dhcp_info' diff -u linux-oem-5.17-5.17.0/debian.oem/rules.d/amd64.mk linux-oem-5.17-5.17.0/debian.oem/rules.d/amd64.mk --- linux-oem-5.17-5.17.0/debian.oem/rules.d/amd64.mk +++ linux-oem-5.17-5.17.0/debian.oem/rules.d/amd64.mk @@ -20,6 +20,8 @@ do_extras_package = true do_tools_common = true do_tools_acpidbg = true +do_zfs = true +do_v4l2loopback = true do_odm_drivers = true # OEM diff -u linux-oem-5.17-5.17.0/debian.oem/tracking-bug linux-oem-5.17-5.17.0/debian.oem/tracking-bug --- linux-oem-5.17-5.17.0/debian.oem/tracking-bug +++ linux-oem-5.17-5.17.0/debian.oem/tracking-bug @@ -1 +1 @@ -1971892 2022.05.09-1 +1973926 2022.04.18-9 diff -u linux-oem-5.17-5.17.0/debian/changelog linux-oem-5.17-5.17.0/debian/changelog --- linux-oem-5.17-5.17.0/debian/changelog +++ linux-oem-5.17-5.17.0/debian/changelog @@ -1,823 +1,14 @@ -linux-oem-5.17 (5.17.0-1005.5) jammy; urgency=medium +linux-oem-5.17 (5.17.0-1006.6) jammy; urgency=medium - * jammy/linux-oem-5.17: 5.17.0-1005.5 -proposed tracker (LP: #1971892) + * jammy/linux-oem-5.17: 5.17.0-1006.6 -proposed tracker (LP: #1973926) - * build backport-iwlwifi-dkms as linux-modules-iwlwifi-ABI (LP: #1969434) - - [Packaging] support standalone dkms module builds - - [Packaging] drop do_ arch specific configs - - * Packaging resync (LP: #1786013) - - debian/dkms-versions -- update from kernel-versions (main/master) - - * e1000e report hardware hang (LP: #1973104) - - SAUCE: e1000e: Enable GPT clock before sending message to CSME - - * Headset mic with Cirrus logic codec doesn't work (LP: #1972815) - - SAUCE: ASoC: cs42l42: Move CS42L42 register descriptions to general include - - SAUCE: ALSA: hda/cs8409: Use general cs42l42 include in cs8409 hda driver - - SAUCE: ALSA: hda/cs8409: Support manual mode detection for CS42L42 - - * Support Cirrus audio codec configurations for Odin platform (LP: #1968861) - - SAUCE: ALSA: hda/cs8409: Support new Odin Variants - - SAUCE: ALSA: hda/cs8409: Add Speaker Playback Switch for Cyborg - - * Support different Cirrus audio codec configurations on Dell laptops - (LP: #1967988) - - ALSA: hda/cs8409: Fix Warlock to use mono mic configuration - - ALSA: hda/cs8409: Re-order quirk table into ascending order - - ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants - - ALSA: hda/cs8409: Support new Warlock MLK Variants - - ALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg - - ALSA: hda/cs8409: Add new Dolphin HW variants - - * Update OS policy capability handshake (LP: #1966089) - - thermal: int340x: Update OS policy capability handshake - - * Miscellaneous Ubuntu changes - - [Config] update configs and annotations after stable updates - - [ Ubuntu: 5.17.0-8.8~22.04.3 ] + * ext4: limit length to bitmap_maxbytes (LP: #1972281) + - ext4: limit length to bitmap_maxbytes - blocksize in punch_hole - * jammy/linux-hwe-5.17: 5.17.0-8.8~22.04.3 -proposed tracker (LP: #1971893) - * Jammy update: v5.17.7 upstream stable release (LP: #1973282) - - pci_irq_vector() can't be used in atomic context any longer. This conflicts - with the usage of this function in nic_mbx_intr_handler(). age of this - function in nic_mbx_intr_handler(). - - ipmi: When handling send message responses, don't process the message - - ipmi:ipmi_ipmb: Fix null-ptr-deref in ipmi_unregister_smi() - - MIPS: Fix CP0 counter erratum detection for R4k CPUs - - Revert "parisc: Mark cr16 CPU clocksource unstable on all SMP machines" - - Revert "parisc: Mark sched_clock unstable only if clocks are not - syncronized" - - parisc: Merge model and model name into one line in /proc/cpuinfo - - ALSA: hda/realtek: Add quirk for Yoga Duet 7 13ITL6 speakers - - ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes - - mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC - - mmc: sunxi-mmc: Fix DMA descriptors allocated above 32 bits - - mmc: core: Set HS clock speed before sending HS CMD13 - - gpiolib: of: fix bounds check for 'gpio-reserved-ranges' - - x86/fpu: Prevent FPU state corruption - - KVM: x86/svm: Account for family 17h event renumberings in - amd_pmc_perf_hw_id - - iommu/vt-d: Calculate mask for non-aligned flushes - - iommu/arm-smmu-v3: Fix size calculation in arm_smmu_mm_invalidate_range() - - drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT - - drm/amdgpu: do not use passthrough mode in Xen dom0 - - RISC-V: relocate DTB if it's outside memory region - - hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk - - Revert "SUNRPC: attempt AF_LOCAL connect on setup" - - timekeeping: Mark NMI safe time accessors as notrace - - firewire: fix potential uaf in outbound_phy_packet_callback() - - firewire: remove check of list iterator against head past the loop body - - firewire: core: extend card->lock in fw_core_handle_bus_reset - - net: stmmac: disable Split Header (SPH) for Intel platforms - - btrfs: sysfs: export the balance paused state of exclusive operation - - btrfs: force v2 space cache usage for subpage mount - - btrfs: do not BUG_ON() on failure to update inode when setting xattr - - btrfs: export a helper for compression hard check - - btrfs: do not allow compression on nodatacow files - - btrfs: skip compression property for anything other than files and dirs - - genirq: Synchronize interrupt thread startup - - ASoC: da7219: Fix change notifications for tone generator frequency - - ASoC: rt9120: Correct the reg 0x09 size to one byte - - ASoC: wm8958: Fix change notifications for DSP controls - - ASoC: meson: Fix event generation for AUI ACODEC mux - - ASoC: meson: Fix event generation for G12A tohdmi mux - - ASoC: meson: Fix event generation for AUI CODEC mux - - s390/dasd: fix data corruption for ESE devices - - s390/dasd: prevent double format of tracks for ESE devices - - s390/dasd: Fix read for ESE with blksize < 4k - - s390/dasd: Fix read inconsistency for ESE DASD devices - - can: grcan: grcan_close(): fix deadlock - - can: isotp: remove re-binding of bound socket - - can: grcan: use ofdev->dev when allocating DMA memory - - can: grcan: grcan_probe(): fix broken system id check for errata workaround - needs - - can: grcan: only use the NAPI poll budget for RX - - nfc: replace improper check device_is_registered() in netlink related - functions - - nfc: nfcmrvl: main: reorder destructive operations in - nfcmrvl_nci_unregister_dev to avoid bugs - - NFC: netlink: fix sleep in atomic bug when firmware download timeout - - gpio: visconti: Fix fwnode of GPIO IRQ - - gpio: pca953x: fix irq_stat not updated when irq is disabled (irq_mask not - set) - - hwmon: (adt7470) Fix warning on module removal - - hwmon: (pmbus) disable PEC if not enabled - - ASoC: dmaengine: Restore NULL prepare_slave_config() callback - - ASoC: meson: axg-tdm-interface: Fix formatters in trigger" - - ASoC: meson: axg-card: Fix nonatomic links - - ASoC: soc-ops: fix error handling - - iommu/vt-d: Drop stop marker messages - - iommu/dart: check return value after calling platform_get_resource() - - net/mlx5e: Fix trust state reset in reload - - net/mlx5: Fix slab-out-of-bounds while reading resource dump menu - - net/mlx5e: Fix wrong source vport matching on tunnel rule - - net/mlx5e: Don't match double-vlan packets if cvlan is not set - - net/mlx5e: CT: Fix queued up restore put() executing after relevant ft - release - - net/mlx5e: Fix the calling of update_buffer_lossy() API - - net/mlx5: Fix matching on inner TTC - - net/mlx5: Avoid double clear or set of sync reset requested - - net/mlx5: Fix deadlock in sync reset flow - - net/mlx5e: Lag, Fix use-after-free in fib event handler - - net/mlx5e: Lag, Fix fib_info pointer assignment - - net/mlx5e: Lag, Don't skip fib events on current dst - - net/mlx5e: TC, fix decap fallback to uplink when int port not supported - - selftests/seccomp: Don't call read() on TTY from background pgrp - - ALSA: hda/realtek: Fix mute led issue on thinkpad with cs35l41 s-codec - - SUNRPC release the transport of a relocated task with an assigned transport - - RDMA/siw: Fix a condition race issue in MPA request processing - - RDMA/irdma: Flush iWARP QP if modified to ERR from RTR state - - RDMA/irdma: Reduce iWARP QP destroy time - - RDMA/irdma: Fix possible crash due to NULL netdev in notifier - - NFSv4: Don't invalidate inode attributes on delegation return - - net: ethernet: mediatek: add missing of_node_put() in mtk_sgmii_init() - - net: dsa: mt7530: add missing of_node_put() in mt7530_setup() - - net: stmmac: dwmac-sun8i: add missing of_node_put() in - sun8i_dwmac_register_mdio_mux() - - net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller - - net: cpsw: add missing of_node_put() in cpsw_probe_dt() - - net: igmp: respect RCU rules in ip_mc_source() and ip_mc_msfilter() - - net: emaclite: Add error handling for of_address_to_resource() - - selftests/net: so_txtime: fix parsing of start time stamp on 32 bit systems - - selftests/net: so_txtime: usage(): fix documentation of default clock - - drm/msm/dp: remove fail safe mode related code - - hinic: fix bug of wq out of bound access - - SUNRPC: Don't leak sockets in xs_local_connect() - - mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter() - - rxrpc: Enable IPv6 checksums on transport socket - - selftests: mirror_gre_bridge_1q: Avoid changing PVID while interface is - operational - - dt-bindings: pci: apple,pcie: Drop max-link-speed from example - - bnxt_en: Fix possible bnxt_open() failure caused by wrong RFS flag - - bnxt_en: Fix unnecessary dropping of RX packets - - selftests: ocelot: tc_flower_chains: specify conform-exceed action for - policer - - smsc911x: allow using IRQ0 - - btrfs: always log symlinks in full mode - - parisc: Mark cr16 clock unstable on all SMP machines - - gpio: mvebu: drop pwm base assignment - - net: rds: acquire refcount on TCP sockets - - kvm: x86/cpuid: Only provide CPUID leaf 0xA if host has architectural PMU - - fbdev: Make fb_release() return -ENODEV if fbdev was unregistered - - iommu/dart: Add missing module owner to ops structure - - KVM: SEV: Mark nested locking of vcpu->lock - - KVM: VMX: Exit to userspace if vCPU has injected exception and invalid state - - kvm: selftests: do not use bitfields larger than 32-bits for PTEs - - KVM: selftests: Silence compiler warning in the kvm_page_table_test - - x86/kvm: Preserve BSP MSR_KVM_POLL_CONTROL across suspend/resume - - KVM: x86: Do not change ICR on write to APIC_SELF_IPI - - KVM: x86/mmu: avoid NULL-pointer dereference on page freeing bugs - - KVM: LAPIC: Enable timer posted-interrupt only when mwait/hlt is advertised - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - mmc: rtsx: add 74 Clocks in power on flow - - PCI: aardvark: Replace custom PCIE_CORE_INT_* macros with PCI_INTERRUPT_* - - PCI: aardvark: Rewrite IRQ code to chained IRQ handler - - PCI: aardvark: Check return value of generic_handle_domain_irq() when - processing INTx IRQ - - PCI: aardvark: Make MSI irq_chip structures static driver structures - - PCI: aardvark: Make msi_domain_info structure a static driver structure - - PCI: aardvark: Use dev_fwnode() instead of of_node_to_fwnode(dev->of_node) - - PCI: aardvark: Refactor unmasking summary MSI interrupt - - PCI: aardvark: Add support for masking MSI interrupts - - PCI: aardvark: Fix setting MSI address - - PCI: aardvark: Enable MSI-X support - - PCI: aardvark: Add support for ERR interrupt on emulated bridge - - PCI: aardvark: Optimize writing PCI_EXP_RTCTL_PMEIE and PCI_EXP_RTSTA_PME on - emulated bridge - - PCI: aardvark: Add support for PME interrupts - - PCI: aardvark: Fix support for PME requester on emulated bridge - - PCI: aardvark: Use separate INTA interrupt for emulated root bridge - - PCI: aardvark: Remove irq_mask_ack() callback for INTx interrupts - - PCI: aardvark: Don't mask irq when mapping - - PCI: aardvark: Drop __maybe_unused from advk_pcie_disable_phy() - - PCI: aardvark: Update comment about link going down after link-up - - Linux 5.17.7 - * Jammy update: v5.17.6 upstream stable release (LP: #1973281) - - usb: mtu3: fix USB 3.0 dual-role-switch from device to host - - floppy: disable FDRAWCMD by default - - USB: quirks: add a Realtek card reader - - USB: quirks: add STRING quirk for VCOM device - - USB: serial: whiteheat: fix heap overflow in WHITEHEAT_GET_DTR_RTS - - USB: serial: cp210x: add PIDs for Kamstrup USB Meter Reader - - USB: serial: option: add support for Cinterion MV32-WA/MV32-WB - - USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions - - usb: xhci: tegra:Fix PM usage reference leak of - tegra_xusb_unpowergate_partitions - - xhci: Enable runtime PM on second Alderlake controller - - xhci: stop polling roothubs after shutdown - - xhci: increase usb U3 -> U0 link resume timeout from 100ms to 500ms - - iio: dac: ad5592r: Fix the missing return value. - - iio: scd4x: check return of scd4x_write_and_fetch - - iio: dac: ad5446: Fix read_raw not returning set value - - iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() - - iio: imu: inv_icm42600: Fix I2C init possible nack - - usb: misc: fix improper handling of refcount in uss720_probe() - - usb: core: Don't hold the device lock while sleeping in do_proc_control() - - usb: typec: ucsi: Fix reuse of completion structure - - usb: typec: ucsi: Fix role swapping - - usb: gadget: uvc: Fix crash when encoding data for usb request - - usb: gadget: configfs: clear deactivation flag in - configfs_composite_unbind() - - usb: dwc3: Try usb-role-switch first in dwc3_drd_init - - usb: dwc3: core: Fix tx/rx threshold settings - - usb: dwc3: core: Only handle soft-reset in DCTL - - usb: dwc3: gadget: Return proper request status - - usb: dwc3: pci: add support for the Intel Meteor Lake-P - - usb: cdns3: Fix issue for clear halt endpoint - - usb: phy: generic: Get the vbus supply - - kernfs: fix NULL dereferencing in kernfs_remove - - binder: Gracefully handle BINDER_TYPE_FDA objects with num_fds=0 - - binder: Address corner cases in deferred copy and fixup - - serial: imx: fix overrun interrupts in DMA mode - - serial: amba-pl011: do not time out prematurely when draining tx fifo - - serial: 8250: Also set sticky MCR bits in console restoration - - serial: 8250: Correct the clock for EndRun PTP/1588 PCIe device - - eeprom: at25: Use DMA safe buffers - - arch_topology: Do not set llc_sibling if llc_id is invalid - - topology: make core_mask include at least cluster_siblings - - ceph: fix possible NULL pointer dereference for req->r_session - - bus: mhi: host: pci_generic: Add missing poweroff() PM callback - - bus: mhi: host: pci_generic: Flush recovery worker during freeze - - arm64: dts: imx8mm-venice: fix spi2 pin configuration - - pinctrl: samsung: fix missing GPIOLIB on ARM64 Exynos config - - f2fs: should not truncate blocks during roll-forward recovery - - hex2bin: make the function hex_to_bin constant-time - - hex2bin: fix access beyond string end - - bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc() - - riscv: patch_text: Fixup last cpu should be master - - x86/cpu: Load microcode during restore_processor_state() - - x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests - - iocost: don't reset the inuse weight of under-weighted debtors - - virtio_net: fix wrong buf address calculation when using xdp - - cpufreq: qcom-hw: drop affinity hint before freeing the IRQ - - cpufreq: qcom-hw: fix the race between LMH worker and cpuhp - - cpufreq: qcom-hw: fix the opp entries refcounting - - cpufreq: qcom-cpufreq-hw: Fix throttle frequency value on EPSS platforms - - video: fbdev: udlfb: properly check endpoint type - - arm64: dts: meson: remove CPU opps below 1GHz for G12B boards - - arm64: dts: meson: remove CPU opps below 1GHz for SM1 boards - - iio: dac: ad3552r: fix signedness bug in ad3552r_reset() - - iio:imu:bmi160: disable regulator in error path - - iio:filter:admv8818: select REGMAP_SPI for ADMV8818 - - mtd: rawnand: fix ecc parameters for mt7622 - - tee: optee: add missing mutext_destroy in optee_ffa_probe - - xsk: Fix l2fwd for copy mode + busy poll combo - - arm64: dts: imx8qm: Correct SCU clock controller's compatible property - - USB: Fix xhci event ring dequeue pointer ERDP update issue - - soc: imx: imx8m-blk-ctrl: Fix IMX8MN_DISPBLK_PD_ISI hang - - ARM: dts: imx6qdl-apalis: Fix sgtl5000 detection issue - - iio:dac:ad3552r: Fix an IS_ERR() vs NULL check - - arm64: dts: imx8mq-tqma8mq: change the spi-nor tx - - arm64: dts: imx8mn: Fix SAI nodes - - arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO pin labeling for CON1 - - phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe - - phy: samsung: exynos5250-sata: fix missing device put in probe error paths - - ARM: OMAP2+: Fix refcount leak in omap_gic_of_init - - bus: ti-sysc: Make omap3 gpt12 quirk handling SoC specific - - ARM: dts: dra7: Fix suspend warning for vpe powerdomain - - phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks - - ARM: dts: at91: Map MCLK for wm8731 on at91sam9g20ek - - ARM: dts: at91: sama5d4_xplained: fix pinctrl phandle name - - ARM: dts: at91: fix pinctrl phandles - - phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe - - phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe - - interconnect: qcom: sc7180: Drop IP0 interconnects - - interconnect: qcom: sdx55: Drop IP0 interconnects - - ARM: dts: Fix mmc order for omap3-gta04 - - ARM: dts: am33xx-l4: Add missing touchscreen clock properties - - ARM: dts: am3517-evm: Fix misc pinmuxing - - ARM: dts: logicpd-som-lv: Fix wrong pinmuxing on OMAP35 - - pinctrl: qcom: sm6350: fix order of UFS & SDC pins - - ipvs: correctly print the memory size of ip_vs_conn_tab - - phy: amlogic: fix error path in phy_g12a_usb3_pcie_probe() - - pinctrl: mediatek: moore: Fix build error - - mtd: rawnand: Fix return value check of wait_for_completion_timeout - - mtd: fix 'part' field data corruption in mtd_info - - pinctrl: stm32: Do not call stm32_gpio_get() for edge triggered IRQs in EOI - - memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode - - net: dsa: Add missing of_node_put() in dsa_port_link_register_of - - netfilter: nft_set_rbtree: overlap detection with element re-addition after - deletion - - bpf, lwt: Fix crash when using bpf_skb_set_tunnel_key() from bpf_xmit lwt - hook - - pinctrl: rockchip: fix RK3308 pinmux bits - - tcp: md5: incorrect tcp_header_len for incoming connections - - pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested - - tcp: ensure to use the most recently sent skb when filling the rate sample - - wireguard: device: check for metadata_dst with skb_valid_dst() - - sctp: check asoc strreset_chunk in sctp_generate_reconf_event - - ARM: dts: imx6ull-colibri: fix vqmmc regulator - - arm64: dts: imx8mn-ddr4-evk: Describe the 32.768 kHz PMIC clock - - pinctrl: pistachio: fix use of irq_of_parse_and_map() - - cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe - - net: hns3: clear inited state and stop client after failed to register - netdev - - net: hns3: fix error log of tx/rx tqps stats - - net: hns3: modify the return code of hclge_get_ring_chain_from_mbx - - net: hns3: add validity check for message data length - - net: hns3: add return value for mailbox handling in PF - - net/smc: sync err code when tcp connection was refused - - net: lan966x: fix a couple off by one bugs - - ip_gre: Make o_seqno start from 0 in native mode - - ip6_gre: Make o_seqno start from 0 in native mode - - ip_gre, ip6_gre: Fix race condition on o_seqno in collect_md mode - - tcp: fix potential xmit stalls caused by TCP_NOTSENT_LOWAT - - tcp: make sure treq->af_specific is initialized - - bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create() - - clk: sunxi: sun9i-mmc: check return value after calling - platform_get_resource() - - cpufreq: qcom-cpufreq-hw: Clear dcvs interrupts - - mctp: defer the kfree of object mdev->addrs - - net: bcmgenet: hide status block before TX timestamping - - net: phy: marvell10g: fix return value on error - - net: dsa: mv88e6xxx: Fix port_hidden_wait to account for port_base_addr - - drm/sun4i: Remove obsolete references to PHYS_OFFSET - - ice: wait 5 s for EMP reset after firmware flash - - Bluetooth: hci_event: Fix checking for invalid handle on error status - - net: dsa: lantiq_gswip: Don't set GSWIP_MII_CFG_RMII_CLK - - io_uring: check reserved fields for send/sendmsg - - io_uring: check reserved fields for recv/recvmsg - - netfilter: nf_conntrack_tcp: re-init for syn packets only - - netfilter: conntrack: fix udp offload timeout sysctl - - platform/x86: asus-wmi: Potential buffer overflow in - asus_wmi_evaluate_method_buf() - - platform/x86: asus-wmi: Fix driver not binding when fan curve control probe - fails - - drm/amdkfd: Fix GWS queue count - - drm/amd/display: Fix memory leak in dcn21_clock_source_create - - tls: Skip tls_append_frag on zero copy size - - bnx2x: fix napi API usage sequence - - net: fec: add missing of_node_put() in fec_enet_init_stop_mode() - - gfs2: Minor retry logic cleanup - - gfs2: Make sure not to return short direct writes - - gfs2: No short reads or writes upon glock contention - - perf arm-spe: Fix addresses of synthesized SPE events - - ixgbe: ensure IPsec VF<->PF compatibility - - net: enetc: allow tc-etf offload even with NETIF_F_CSUM_MASK - - Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits" - - tcp: fix F-RTO may not work correctly when receiving DSACK - - io_uring: fix uninitialized field in rw io_kiocb - - ASoC: soc-pcm: use GFP_KERNEL when the code is sleepable - - ASoC: cs35l41: Fix a shift-out-of-bounds warning found by UBSAN - - ASoC: rt711/5682: check if bus is active before deferred jack detection - - ASoC: Intel: soc-acpi: correct device endpoints for max98373 - - ASoC: wm8731: Disable the regulator when probing fails - - Input: cypress-sf - register a callback to disable the regulators - - ext4: fix bug_on in start_this_handle during umount filesystem - - arch: xtensa: platforms: Fix deadlock in rs_close() - - ksmbd: increment reference count of parent fp - - ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION - - erofs: fix use-after-free of on-stack io[] - - bonding: do not discard lowest hash bit for non layer3+4 hashing - - x86: __memcpy_flushcache: fix wrong alignment if size > 2^32 - - cifs: destage any unwritten data to the server before calling - copychunk_write - - drivers: net: hippi: Fix deadlock in rr_close() - - powerpc/perf: Fix 32bit compile - - ALSA: hda: intel-dsp-config: Add RaptorLake PCI IDs - - selftest/vm: verify mmap addr in mremap_test - - selftest/vm: verify remap destination address in mremap_test - - bfq: Fix warning in bfqq_request_over_limit() - - Revert "ACPI: processor: idle: fix lockup regression on 32-bit ThinkPad T40" - - Revert "block: inherit request start time from bio for BLK_CGROUP" - - zonefs: Fix management of open zones - - zonefs: Clear inode information flags on inode creation - - kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink - occur at same time - - mtd: rawnand: qcom: fix memory corruption that causes panic - - netfilter: Update ip6_route_me_harder to consider L3 domain - - drm/amdgpu: don't runtime suspend if there are displays attached (v3) - - drm/i915: Check EDID for HDR static metadata when choosing blc - - drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses - - net: ethernet: stmmac: fix write to sgmii_adapter_base - - ACPI: processor: idle: Avoid falling back to C3 type C-states - - thermal: int340x: Fix attr.show callback prototype - - btrfs: fix direct I/O read repair for split bios - - btrfs: fix direct I/O writes for split bios on zoned devices - - btrfs: fix leaked plug after failure syncing log on zoned filesystems - - btrfs: zoned: use dedicated lock for data relocation - - btrfs: fix assertion failure during scrub due to block group reallocation - - ARM: dts: at91: sama7g5ek: enable pull-up on flexcom3 console lines - - ARM: dts: imx8mm-venice-gw{71xx,72xx,73xx}: fix OTG controller OC mode - - perf symbol: Pass is_kallsyms to symbols__fixup_end() - - perf symbol: Update symbols__fixup_end() - - perf symbol: Remove arch__symbols__fixup_end() - - tty: n_gsm: fix missing mux reset on config change at responder - - tty: n_gsm: fix restart handling via CLD command - - tty: n_gsm: fix decoupled mux resource - - tty: n_gsm: fix mux cleanup after unregister tty device - - tty: n_gsm: fix wrong signal octet encoding in convergence layer type 2 - - tty: n_gsm: fix frame reception handling - - tty: n_gsm: fix malformed counter for out of frame data - - netfilter: nft_socket: only do sk lookups when indev is available - - tty: n_gsm: fix insufficient txframe size - - tty: n_gsm: fix wrong DLCI release order - - tty: n_gsm: fix missing explicit ldisc flush - - tty: n_gsm: fix wrong command retry handling - - tty: n_gsm: fix wrong command frame length field encoding - - tty: n_gsm: fix wrong signal octets encoding in MSC - - tty: n_gsm: fix missing tty wakeup in convergence layer type 2 - - tty: n_gsm: fix reset fifo race condition - - tty: n_gsm: fix incorrect UA handling - - tty: n_gsm: fix missing update of modem controls after DLCI open - - tty: n_gsm: fix broken virtual tty handling - - tty: n_gsm: fix invalid use of MSC in advanced option - - tty: n_gsm: fix software flow control handling - - tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output() - - objtool: Fix code relocs vs weak symbols - - objtool: Fix type of reloc::addend - - powerpc/64: Add UADDR64 relocation support - - Linux 5.17.6 - - [Config] updateconfigs following v5.17.6 - * Jammy update: v5.17.5 upstream stable release (LP: #1973280) - - etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead - - perf tools: Fix segfault accessing sample_id xyarray - - drm/amd/display: Only set PSR version when valid - - block/compat_ioctl: fix range check in BLKGETSIZE - - gfs2: assign rgrp glock before compute_bitstructs - - scsi: ufs: core: scsi_get_lba() error fix + * CVE-2022-29581 - net/sched: cls_u32: fix netns refcount changes in u32_change() - - ALSA: usb-audio: Clear MIDI port active flag after draining - - ALSA: usb-audio: add mapping for MSI MAG X570S Torpedo MAX. - - ALSA: hda/realtek: Add quirk for Clevo NP70PNP - - ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek - - ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create() - - ASoC: rk817: Use devm_clk_get() in rk817_platform_probe - - ASoC: msm8916-wcd-digital: Check failure for devm_snd_soc_register_component - - ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use - - dmaengine: idxd: fix device cleanup on disable - - dmaengine: imx-sdma: Fix error checking in sdma_event_remap - - dmaengine: mediatek:Fix PM usage reference leak of - mtk_uart_apdma_alloc_chan_resources - - dmaengine: dw-edma: Fix unaligned 64bit access - - spi: spi-mtk-nor: initialize spi controller after resume - - firmware: cs_dsp: Fix overrun of unterminated control name string - - esp: limit skb_page_frag_refill use to a single page - - spi: cadence-quadspi: fix incorrect supports_op() return value - - igc: Fix infinite loop in release_swfw_sync - - igc: Fix BUG: scheduling while atomic - - igc: Fix suspending when PTM is active - - ice: allow creating VFs for !CONFIG_NET_SWITCHDEV - - ice: fix crash in switchdev mode - - ice: Fix memory leak in ice_get_orom_civd_data() - - ALSA: hda/hdmi: fix warning about PCM count when used with SOF - - rxrpc: Restore removed timer deletion - - net/smc: Fix sock leak when release after smc_shutdown() - - net/packet: fix packet_sock xmit return value checking - - ip6_gre: Avoid updating tunnel->tun_hlen in __gre6_xmit() - - ip6_gre: Fix skb_under_panic in __gre6_xmit() - - net: restore alpha order to Ethernet devices in config - - net/sched: cls_u32: fix possible leak in u32_init_knode() - - l3mdev: l3mdev_master_upper_ifindex_by_index_rcu should be using - netdev_master_upper_dev_get_rcu - - ipv6: make ip6_rt_gc_expire an atomic_t - - can: isotp: stop timeout monitoring when no first frame was sent - - net: dsa: hellcreek: Calculate checksums in tagger - - net: mscc: ocelot: fix broken IP multicast flooding - - netlink: reset network and mac headers in netlink_dump() - - drm/i915/display/psr: Unset enable_psr2_sel_fetch if other checks in - intel_psr2_config_valid() fails - - RISC-V: KVM: Remove 's' & 'u' as valid ISA extension - - RISC-V: KVM: Restrict the extensions that can be disabled - - net: stmmac: Use readl_poll_timeout_atomic() in atomic state - - dmaengine: idxd: match type for retries var in idxd_enqcmds() - - dmaengine: idxd: fix retry value to be constant for duration of function - call - - dmaengine: idxd: add RO check for wq max_batch_size write - - dmaengine: idxd: add RO check for wq max_transfer_size write - - dmaengine: idxd: skip clearing device context when device is read-only - - selftests: mlxsw: vxlan_flooding: Prevent flooding of unwanted packets - - selftests: mlxsw: vxlan_flooding_ipv6: Prevent flooding of unwanted packets - - userfaultfd: mark uffd_wp regardless of VM_WRITE flag - - arm64: mm: fix p?d_leaf() - - XArray: Disallow sibling entries of nodes - - drm/msm/gpu: Rename runtime suspend/resume functions - - drm/msm/gpu: Remove mutex from wait_event condition - - ARM: vexpress/spc: Avoid negative array index when !SMP - - reset: renesas: Check return value of reset_control_deassert() - - reset: tegra-bpmp: Restore Handle errors in BPMP response - - platform/x86: samsung-laptop: Fix an unsigned comparison which can never be - negative - - ALSA: usb-audio: Fix undefined behavior due to shift overflowing the - constant - - drm/msm/disp: check the return value of kzalloc() - - selftests: KVM: Free the GIC FD when cleaning up in arch_timer - - ALSA: hda: intel-dsp-config: update AlderLake PCI IDs - - arm64: dts: imx: Fix imx8*-var-som touchscreen property sizes - - vxlan: fix error return code in vxlan_fdb_append - - cifs: Check the IOCB_DIRECT flag, not O_DIRECT - - mt76: Fix undefined behavior due to shift overflowing the constant - - brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant - - dpaa_eth: Fix missing of_node_put in dpaa_get_ts_info() - - drm/msm/mdp5: check the return of kzalloc() - - KVM: x86: hyper-v: Avoid writing to TSC page without an active vCPU - - net: macb: Restart tx only if queue pointer is lagging - - scsi: iscsi: Release endpoint ID when its freed - - scsi: iscsi: Merge suspend fields - - scsi: iscsi: Fix NOP handling during conn recovery - - scsi: qedi: Fix failed disconnect handling - - stat: fix inconsistency between struct stat and struct compat_stat - - VFS: filename_create(): fix incorrect intent. - - nvme: add a quirk to disable namespace identifiers - - nvme-pci: disable namespace identifiers for the MAXIO MAP1002/1202 - - nvme-pci: disable namespace identifiers for Qemu controllers - - irq_work: use kasan_record_aux_stack_noalloc() record callstack - - EDAC/synopsys: Read the error count from the correct register - - mm/memory-failure.c: skip huge_zero_page in memory_failure() - - memcg: sync flush only if periodic flush is delayed - - mm, hugetlb: allow for "high" userspace addresses - - oom_kill.c: futex: delay the OOM reaper to allow time for proper futex - cleanup - - mm/mmu_notifier.c: fix race in mmu_interval_notifier_remove() - - ata: pata_marvell: Check the 'bmdma_addr' beforing reading - - dma: at_xdmac: fix a missing check on list iterator - - dmaengine: imx-sdma: fix init of uart scripts - - net: atlantic: invert deep par in pm functions, preventing null derefs - - drm/radeon: fix logic inversion in radeon_sync_resv - - io_uring: free iovec if file assignment fails - - Input: omap4-keypad - fix pm_runtime_get_sync() error checking - - scsi: sr: Do not leak information in ioctl - - sched/pelt: Fix attach_entity_load_avg() corner case - - perf/core: Fix perf_mmap fail when CONFIG_PERF_USE_VMALLOC enabled - - drm/panel/raspberrypi-touchscreen: Avoid NULL deref if not initialised - - drm/panel/raspberrypi-touchscreen: Initialise the bridge in prepare - - powerpc/time: Always set decrementer in timer_interrupt() - - KVM: PPC: Fix TCE handling for VFIO - - drm/vc4: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage - - powerpc/perf: Fix power9 event alternatives - - powerpc/perf: Fix power10 event alternatives - - arm/xen: Fix some refcount leaks - - perf script: Always allow field 'data_src' for auxtrace - - perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event - - fs: fix acl translation - - cifs: fix NULL ptr dereference in refresh_mounts() - - cifs: use correct lock type in cifs_reconnect() - - xtensa: patch_text: Fixup last cpu should be master - - xtensa: fix a7 clobbering in coprocessor context load/store - - openvswitch: fix OOB access in reserve_sfa_size() - - gpio: Request interrupts after IRQ is initialized - - ASoC: rt5682: fix an incorrect NULL check on list iterator - - ASoC: soc-dapm: fix two incorrect uses of list iterator - - e1000e: Fix possible overflow in LTR decoding - - codecs: rt5682s: fix an incorrect NULL check on list iterator - - ARC: entry: fix syscall_trace_exit argument - - drm/vmwgfx: Fix gem refcounting and memory evictions - - arm_pmu: Validate single/group leader events - - KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog - - KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io() - - KVM: x86: Pend KVM_REQ_APICV_UPDATE during vCPU creation to fix a race - - KVM: nVMX: Defer APICv updates while L2 is active until L1 is active - - KVM: SVM: Simplify and harden helper to flush SEV guest page(s) - - KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs - - ext4: fix fallocate to use file_modified to update permissions consistently - - ext4: fix symlink file size not match to file content - - ext4: fix use-after-free in ext4_search_dir - - ext4: limit length to bitmap_maxbytes - blocksize in punch_hole - - ext4, doc: fix incorrect h_reserved size - - ext4: fix overhead calculation to account for the reserved gdt blocks - - ext4: force overhead calculation if the s_overhead_cluster makes no sense - - ext4: update the cached overhead value in the superblock - - jbd2: fix a potential race while discarding reserved buffers after an abort - - spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and - controller - - ASoC: SOF: topology: cleanup dailinks on widget unload - - io_uring: fix leaks on IOPOLL and CQE_SKIP - - arm64: dts: qcom: add IPA qcom,qmp property - - Linux 5.17.5 - * Aquantia GbE LAN driver causes UBSAN error during kernel boot - (LP: #1958770) // Jammy update: v5.17.5 upstream stable release - (LP: #1973280) - - net: atlantic: Avoid out-of-bounds indexing - * Jammy update: v5.17.4 upstream stable release (LP: #1973279) - - drm/amd/display: Add pstate verification and recovery for DCN31 - - drm/amd/display: Fix p-state allow debug index on dcn31 - - cpuidle: PSCI: Move the `has_lpi` check to the beginning of the function - - ACPI: processor idle: Check for architectural support for LPI - - net: dsa: realtek: allow subdrivers to externally lock regmap - - net: dsa: realtek: rtl8365mb: serialize indirect PHY register access - - net: dsa: realtek: make interface drivers depend on OF - - btrfs: remove no longer used counter when reading data page - - btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups() - - RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put() - - media: si2157: unknown chip version Si2147-A30 ROM 0x50 - - uapi/linux/stddef.h: Add include guards - - drm/amdgpu: Ensure HDA function is suspended before ASIC reset - - btrfs: release correct delalloc amount in direct IO write path - - btrfs: fix btrfs_submit_compressed_write cgroup attribution - - btrfs: return allocated block group from do_chunk_alloc() - - ALSA: core: Add snd_card_free_on_error() helper - - ALSA: sis7019: Fix the missing error handling - - ALSA: ali5451: Fix the missing snd_card_free() call at probe error - - ALSA: als300: Fix the missing snd_card_free() call at probe error - - ALSA: als4000: Fix the missing snd_card_free() call at probe error - - ALSA: atiixp: Fix the missing snd_card_free() call at probe error - - ALSA: au88x0: Fix the missing snd_card_free() call at probe error - - ALSA: aw2: Fix the missing snd_card_free() call at probe error - - ALSA: azt3328: Fix the missing snd_card_free() call at probe error - - ALSA: bt87x: Fix the missing snd_card_free() call at probe error - - ALSA: ca0106: Fix the missing snd_card_free() call at probe error - - ALSA: cmipci: Fix the missing snd_card_free() call at probe error - - ALSA: cs4281: Fix the missing snd_card_free() call at probe error - - ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error - - ALSA: echoaudio: Fix the missing snd_card_free() call at probe error - - ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error - - ALSA: ens137x: Fix the missing snd_card_free() call at probe error - - ALSA: es1938: Fix the missing snd_card_free() call at probe error - - ALSA: es1968: Fix the missing snd_card_free() call at probe error - - ALSA: fm801: Fix the missing snd_card_free() call at probe error - - ALSA: galaxy: Fix the missing snd_card_free() call at probe error - - ALSA: hdsp: Fix the missing snd_card_free() call at probe error - - ALSA: hdspm: Fix the missing snd_card_free() call at probe error - - ALSA: ice1724: Fix the missing snd_card_free() call at probe error - - ALSA: intel8x0: Fix the missing snd_card_free() call at probe error - - ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error - - ALSA: korg1212: Fix the missing snd_card_free() call at probe error - - ALSA: lola: Fix the missing snd_card_free() call at probe error - - ALSA: lx6464es: Fix the missing snd_card_free() call at probe error - - ALSA: maestro3: Fix the missing snd_card_free() call at probe error - - ALSA: oxygen: Fix the missing snd_card_free() call at probe error - - ALSA: riptide: Fix the missing snd_card_free() call at probe error - - ALSA: rme32: Fix the missing snd_card_free() call at probe error - - ALSA: rme9652: Fix the missing snd_card_free() call at probe error - - ALSA: rme96: Fix the missing snd_card_free() call at probe error - - ALSA: sc6000: Fix the missing snd_card_free() call at probe error - - ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error - - ALSA: via82xx: Fix the missing snd_card_free() call at probe error - - ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb - - ALSA: memalloc: Add fallback SG-buffer allocations for x86 - - ALSA: nm256: Don't call card private_free at probe error path - - drm/msm: Add missing put_task_struct() in debugfs path - - nfsd: Fix a write performance regression - - firmware: arm_scmi: Remove clear channel call on the TX channel - - memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe - - Revert "ath11k: mesh: add support for 256 bitmap in blockack frames in 11ax" - - firmware: arm_scmi: Fix sorting of retrieved clock rates - - media: rockchip/rga: do proper error checking in probe - - KVM: arm64: Generalise VM features into a set of flags - - KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs - - SUNRPC: Fix the svc_deferred_event trace class - - net/sched: flower: fix parsing of ethertype following VLAN header - - veth: Ensure eth header is in skb's linear part - - gpiolib: acpi: use correct format characters - - cifs: release cached dentries only if mount is complete - - ice: arfs: fix use-after-free when freeing @rx_cpu_rmap - - Revert "iavf: Fix deadlock occurrence during resetting VF interface" - - net: mdio: don't defer probe forever if PHY IRQ provider is missing - - mlxsw: i2c: Fix initialization error flow - - sctp: use the correct skb for security_sctp_assoc_request - - net/sched: fix initialization order when updating chain 0 head - - cachefiles: unmark inode in use in error path - - cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr - - net: dsa: felix: suppress -EPROBE_DEFER errors - - KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table - - KVM: selftests: riscv: Fix alignment of the guest_hang() function - - RISC-V: KVM: include missing hwcap.h into vcpu_fp - - io_uring: flag the fact that linked file assignment is sane - - net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link - - net/sched: taprio: Check if socket flags are valid - - cfg80211: hold bss_lock while updating nontrans_list - - mac80211: fix ht_capa printout in debugfs - - netfilter: nft_socket: make cgroup match work in input too - - drm/msm: Fix range size vs end confusion - - drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init() - - drm/msm/dp: add fail safe mode outside of event_mutex context - - io_uring: stop using io_wq_work as an fd placeholder - - net/smc: use memcpy instead of snprintf to avoid out of bounds read - - net/smc: Fix NULL pointer dereference in smc_pnet_find_ib() - - scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63 - - scsi: pm80xx: Enable upper inbound, outbound queues - - scsi: iscsi: Move iscsi_ep_disconnect() - - scsi: iscsi: Fix offload conn cleanup when iscsid restarts - - scsi: iscsi: Fix endpoint reuse regression - - scsi: iscsi: Fix conn cleanup and stop race during iscsid restart - - scsi: iscsi: Fix unbound endpoint error handling - - sctp: Initialize daddr on peeled off socket - - net: lan966x: Fix when a port's upper is changed. - - net: lan966x: Stop processing the MAC entry is port is wrong. - - netfilter: nf_tables: nft_parse_register can return a negative value - - io_uring: fix assign file locking issue - - ALSA: ad1889: Fix the missing snd_card_free() call at probe error - - ALSA: mtpav: Don't call card private_free at probe error path - - io_uring: move io_uring_rsrc_update2 validation - - io_uring: verify that resv2 is 0 in io_uring_rsrc_update2 - - io_uring: verify pad field is 0 in io_get_ext_arg - - testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set - - ALSA: usb-audio: Increase max buffer size - - ALSA: usb-audio: Limit max buffer and period sizes per time - - perf tools: Fix misleading add event PMU debug message - - macvlan: Fix leaking skb in source mode with nodst option - - net: ftgmac100: access hardware register after clock ready - - nfc: nci: add flush_workqueue to prevent uaf - - cifs: potential buffer overflow in handling symlinks - - dm mpath: only use ktime_get_ns() in historical selector - - vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used - - tun: annotate access to queue->trans_start - - net: dsa: felix: fix tagging protocol changes with multiple CPU ports - - net: bcmgenet: Revert "Use stronger register read/writes to assure ordering" - - block: fix offset/size check in bio_trim() - - block: null_blk: end timed out poll request - - io_uring: abort file assignment prior to assigning creds - - KVM: PPC: Book3S HV P9: Fix "lost kick" race - - drm/amd: Add USBC connector ID - - btrfs: fix fallocate to use file_modified to update permissions consistently - - btrfs: do not warn for free space inode in cow_file_range - - drm/amdgpu: conduct a proper cleanup of PDB bo - - drm/amdgpu/gmc: use PCI BARs for APUs in passthrough - - drm/amd/display: fix audio format not updated after edid updated - - drm/amd/display: FEC check in timing validation - - drm/amd/display: Update VTEM Infopacket definition - - drm/amdkfd: Fix Incorrect VMIDs passed to HWS - - drm/amdgpu/vcn: improve vcn dpg stop procedure - - drm/amdkfd: Check for potential null return of kmalloc_array() - - Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in - isolated guests - - Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device - - PCI: hv: Propagate coherence from VMbus device to PCI device - - Drivers: hv: vmbus: Prevent load re-ordering when reading ring buffer - - scsi: target: tcmu: Fix possible page UAF - - scsi: lpfc: Improve PCI EEH Error and Recovery Handling - - scsi: lpfc: Fix unload hang after back to back PCI EEH faults - - scsi: lpfc: Fix queue failures when recovering from PCI parity error - - scsi: ibmvscsis: Increase INITIAL_SRP_LIMIT to 1024 - - net: micrel: fix KS8851_MLL Kconfig - - ata: libata-core: Disable READ LOG DMA EXT for Samsung 840 EVOs - - gpu: ipu-v3: Fix dev_dbg frequency output - - regulator: wm8994: Add an off-on delay for WM8994 variant - - static_call: Properly initialise DEFINE_STATIC_CALL_RET0() - - arm64: alternatives: mark patch_alternative() as `noinstr` - - tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry - - net: axienet: setup mdio unconditionally - - Drivers: hv: balloon: Disable balloon and hot-add accordingly - - net: usb: aqc111: Fix out-of-bounds accesses in RX fixup - - myri10ge: fix an incorrect free for skb in myri10ge_sw_tso - - spi: cadence-quadspi: fix protocol setup for non-1-1-X operations - - drm/amd/display: Correct Slice reset calculation - - drm/amd/display: Enable power gating before init_pipes - - drm/amd/display: Revert FEC check in validation - - drm/amd/display: Fix allocate_mst_payload assert on resume - - drbd: set QUEUE_FLAG_STABLE_WRITES - - scsi: mpt3sas: Fail reset operation if config request timed out - - scsi: mvsas: Add PCI ID of RocketRaid 2640 - - scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan - - drivers: net: slip: fix NPD bug in sl_tx_timeout() - - x86,bpf: Avoid IBT objtool warning - - io_uring: zero tag on rsrc removal - - io_uring: use nospec annotation for more indexes - - perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant - - mm/secretmem: fix panic when growing a memfd_secret - - mm, page_alloc: fix build_zonerefs_node() - - mm: fix unexpected zeroed page mapping with zram swap - - mm: kmemleak: take a full lowmem check in kmemleak_*_phys() - - hugetlb: do not demote poisoned hugetlb pages - - revert "fs/binfmt_elf: fix PT_LOAD p_align values for loaders" - - revert "fs/binfmt_elf: use PT_LOAD p_align values for static PIE" - - KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded - - SUNRPC: Fix NFSD's request deferral on RDMA transports - - memory: renesas-rpc-if: fix platform-device leak in error path - - gcc-plugins: latent_entropy: use /dev/urandom - - cifs: verify that tcon is valid before dereference in cifs_kill_sb - - gpio: sim: fix setting and getting multiple lines - - ath9k: Properly clear TX status area before reporting to mac80211 - - ath9k: Fix usage of driver-private space in tx_info - - btrfs: zoned: activate block group only for extent allocation - - btrfs: fix root ref counts in error handling in btrfs_get_root_ref - - btrfs: mark resumed async balance as writing - - ALSA: hda/realtek: Add quirk for Clevo PD50PNT - - ALSA: hda/realtek: add quirk for Lenovo Thinkpad X12 speakers - - ALSA: pcm: Test for "silence" field in struct "pcm_format_data" - - nl80211: correctly check NL80211_ATTR_REG_ALPHA2 size - - ipv6: fix panic when forwarding a pkt with no in6 dev - - drm/amd/display: don't ignore alpha property on pre-multiplied mode - - drm/amdgpu: Enable gfxoff quirk on MacBook Pro - - x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits - - x86/tsx: Disable TSX development mode at boot - - genirq/affinity: Consider that CPUs on nodes can be unbalanced - - tick/nohz: Use WARN_ON_ONCE() to prevent console saturation - - ARM: davinci: da850-evm: Avoid NULL pointer dereference - - ep93xx: clock: Fix UAF in ep93xx_clk_register_gate() - - dm integrity: fix memory corruption when tag_size is less than digest size - - i2c: dev: check return value when calling dev_set_name() - - Revert "net: dsa: setup master before ports" - - smp: Fix offline cpu check in flush_smp_call_function_queue() - - dt-bindings: memory: snps,ddrc-3.80a compatible also need interrupts - - i2c: pasemi: Wait for write xfers to finish - - dt-bindings: net: snps: remove duplicate name - - timers: Fix warning condition in __run_timers() - - dma-direct: avoid redundant memory sync for swiotlb - - mm, kfence: support kmem_dump_obj() for KFENCE objects - - drm/i915: Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL - - cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state - - ax25: Fix UAF bugs in ax25 timers - - io_uring: use right issue_flags for splice/tee - - io_uring: fix poll file assign deadlock - - io_uring: fix poll error reporting - - Linux 5.17.4 - - [Config] updateconfigs following v5.17.4 - -- Timo Aaltonen Tue, 17 May 2022 16:04:59 +0300 + -- Timo Aaltonen Thu, 19 May 2022 14:31:40 +0300 linux-oem-5.17 (5.17.0-1004.4) jammy; urgency=medium diff -u linux-oem-5.17-5.17.0/debian/control linux-oem-5.17-5.17.0/debian/control --- linux-oem-5.17-5.17.0/debian/control +++ linux-oem-5.17-5.17.0/debian/control @@ -59,7 +59,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-oem-5.17-headers-5.17.0-1005 +Package: linux-oem-5.17-headers-5.17.0-1006 Build-Profiles: Architecture: all Multi-Arch: foreign @@ -69,20 +69,20 @@ Description: Header files related to Linux kernel version 5.17.0 This package provides kernel header files for version 5.17.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-oem-5.17-headers-5.17.0-1005/debian.README.gz for details + /usr/share/doc/linux-oem-5.17-headers-5.17.0-1006/debian.README.gz for details -Package: linux-oem-5.17-tools-5.17.0-1005 +Package: linux-oem-5.17-tools-5.17.0-1006 Build-Profiles: Architecture: amd64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-tools-common -Description: Linux kernel version specific tools for version 5.17.0-1005 +Description: Linux kernel version specific tools for version 5.17.0-1006 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.17.0-1005 on + version 5.17.0-1006 on 64 bit x86. - You probably want to install linux-tools-5.17.0-1005-. + You probably want to install linux-tools-5.17.0-1006-. Package: linux-oem-5.17-tools-host Build-Profiles: @@ -96,17 +96,17 @@ -Package: linux-image-unsigned-5.17.0-1005-oem +Package: linux-image-unsigned-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: kernel Priority: optional Provides: linux-image, fuse-module, kvm-api-4, redhat-cluster-modules, ivtv-modules, virtualbox-guest-modules [amd64], ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.17.0-1005-oem +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.17.0-1006-oem Recommends: grub-pc [amd64] | grub-efi-amd64 [amd64] | grub-efi-ia32 [amd64] | grub [amd64] | lilo [amd64] | flash-kernel [armhf arm64] | grub-efi-arm64 [arm64] | grub-efi-arm [armhf] | grub-ieee1275 [ppc64el], initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.17.0-1005-oem -Suggests: fdutils, linux-oem-5.17-tools, linux-headers-5.17.0-1005-oem +Conflicts: linux-image-5.17.0-1006-oem +Suggests: fdutils, linux-oem-5.17-tools, linux-headers-5.17.0-1006-oem Description: Linux kernel image for version 5.17.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.17.0 on 64 bit x86 SMP. @@ -119,12 +119,12 @@ the linux-oem meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.17.0-1005-oem +Package: linux-modules-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.17.0-1005-oem | linux-image-unsigned-5.17.0-1005-oem +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.17.0-1006-oem | linux-image-unsigned-5.17.0-1006-oem Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.17.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -139,12 +139,12 @@ the linux-oem meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.17.0-1005-oem +Package: linux-modules-extra-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.17.0-1005-oem | linux-image-unsigned-5.17.0-1005-oem, wireless-regdb +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.17.0-1006-oem | linux-image-unsigned-5.17.0-1006-oem, wireless-regdb Description: Linux kernel extra modules for version 5.17.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.17.0 on 64 bit x86 SMP. @@ -161,21 +161,21 @@ the linux-oem meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.17.0-1005-oem +Package: linux-headers-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-oem-5.17-headers-5.17.0-1005, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-oem-5.17-headers-5.17.0-1006, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.17.0 on 64 bit x86 SMP This package provides kernel header files for version 5.17.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.17.0-1005/debian.README.gz for details. + /usr/share/doc/linux-headers-5.17.0-1006/debian.README.gz for details. -Package: linux-image-unsigned-5.17.0-1005-oem-dbgsym +Package: linux-image-unsigned-5.17.0-1006-oem-dbgsym Build-Profiles: Architecture: amd64 Section: devel @@ -192,31 +192,31 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.17.0-1005-oem +Package: linux-tools-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-oem-5.17-tools-5.17.0-1005 -Description: Linux kernel version specific tools for version 5.17.0-1005 +Depends: ${misc:Depends}, linux-oem-5.17-tools-5.17.0-1006 +Description: Linux kernel version specific tools for version 5.17.0-1006 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.17.0-1005 on + version 5.17.0-1006 on 64 bit x86. -Package: linux-cloud-tools-5.17.0-1005-oem +Package: linux-cloud-tools-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-oem-5.17-cloud-tools-5.17.0-1005 -Description: Linux kernel version specific cloud tools for version 5.17.0-1005 +Depends: ${misc:Depends}, linux-oem-5.17-cloud-tools-5.17.0-1006 +Description: Linux kernel version specific cloud tools for version 5.17.0-1006 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.17.0-1005 on + version locked tools for cloud for version 5.17.0-1006 on 64 bit x86. -Package: linux-buildinfo-5.17.0-1005-oem +Package: linux-buildinfo-5.17.0-1006-oem Build-Profiles: Architecture: amd64 Section: kernel @@ -232,19 +231,0 @@ - -Package: linux-modules-iwlwifi-5.17.0-1005-oem -Build-Profiles: -Architecture: amd64 -Section: kernel -Priority: optional -Depends: - ${misc:Depends}, - linux-image-5.17.0-1005-oem | linux-image-unsigned-5.17.0-1005-oem, -Built-Using: ${linux:BuiltUsing} -Description: Linux kernel iwlwifi modules for version 5.17.0-1005 - This package provides the Linux kernel iwlwifi modules for version - 5.17.0-1005. - . - You likely do not want to install this package directly. Instead, install the - one of the linux-modules-iwlwifi-oem* meta-packages, - which will ensure that upgrades work correctly, and that supporting packages are - also installed. - reverted: --- linux-oem-5.17-5.17.0/debian/control.d/flavour-module.stub +++ linux-oem-5.17-5.17.0.orig/debian/control.d/flavour-module.stub @@ -1,19 +0,0 @@ - -Package: linux-modules-MODULE-PKGVER-ABINUM-FLAVOUR -Build-Profiles: -Architecture: ARCH -Section: kernel -Priority: optional -Depends: - ${misc:Depends}, - linux-image-PKGVER-ABINUM-FLAVOUR | linux-image-unsigned-PKGVER-ABINUM-FLAVOUR, -Built-Using: ${linux:BuiltUsing} -Description: Linux kernel MODULE modules for version PKGVER-ABINUM - This package provides the Linux kernel MODULE modules for version - PKGVER-ABINUM. - . - You likely do not want to install this package directly. Instead, install the - one of the linux-modules-MODULE-FLAVOUR* meta-packages, - which will ensure that upgrades work correctly, and that supporting packages are - also installed. - diff -u linux-oem-5.17-5.17.0/debian/dkms-versions linux-oem-5.17-5.17.0/debian/dkms-versions --- linux-oem-5.17-5.17.0/debian/dkms-versions +++ linux-oem-5.17-5.17.0/debian/dkms-versions @@ -1,3 +1,2 @@ -backport-iwlwifi-dkms 9858-0ubuntu3 modulename=iwlwifi debpath=pool/universe/b/%package%/backport-iwlwifi-dkms_%version%_all.deb arch=amd64 rprovides=iwlwifi-modules rprovides=backport-iwlwifi-dkms type=standalone -v4l2loopback 0.12.5-1ubuntu5 modulename=v4l2loopback debpath=pool/universe/v/%package%/v4l2loopback-dkms_%version%_all.deb arch=amd64 rprovides=v4l2loopback-modules rprovides=v4l2loopback-dkms -zfs-linux 2.1.2-1ubuntu3 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.5-1ubuntu5 +zfs-linux 2.1.2-1ubuntu3 diff -u linux-oem-5.17-5.17.0/debian/rules linux-oem-5.17-5.17.0/debian/rules --- linux-oem-5.17-5.17.0/debian/rules +++ linux-oem-5.17-5.17.0/debian/rules @@ -40,11 +40,6 @@ do_tools_perf_jvmti?=false do_enforce_all?=false -# Default settings for DKMS modules. -$(foreach _m,$(all_dkms_modules), \ - $(eval do_$(_m) ?= $(if $(filter $(_m),$(filter-out $(dkms_exclude),$(dkms_include) $(subst any,$(_m),$(subst $(arch),$(_m),$(dkms_$(_m)_archs))))),true,false)) \ -) - # Don't build tools in a cross compile environment. ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) do_tools=false @@ -79,7 +74,8 @@ # - disable dkms builds as the versions used may have been deleted ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),) flavours := $(firstword $(flavours)) - $(foreach _m,$(all_dkms_modules),$(eval do_$(_m) = false)) + do_zfs=false + do_v4l2loopback=false endif # Being used to build a mainline build -- turn off things which do not work. @@ -101,11 +97,13 @@ do_tools_host= endif -$(foreach _m,$(all_built-in_dkms_modules), \ - $(if $(filter true,$(do_$(_m))),, \ - $(eval do_$(_m)_disable := $$(shell for m in $$$$(cat $(DROOT)/$(_m)-modules.ignore); do grep -qxF $$$$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$$$m >> $(prev_abidir)/../modules.ignore; done)) \ - ) \ -) +ifeq ($(do_zfs),false) + do_zfs_disable:=$(shell for m in $$(cat $(DROOT)/zfs-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done) +endif + +ifeq ($(do_v4l2loopback),false) + do_v4l2loopback_disable:=$(shell for m in $$(cat $(DROOT)/v4l2loopback-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done) +endif ifeq ($(do_dkms_wireguard),false) do_wireguard_disable:=$(shell for m in $$(cat $(DROOT)/wireguard-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done) @@ -114,6 +112,10 @@ # Either tools package needs the common source preparation do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools))) +# Versions of dkms packages. +dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions) +dkms_v4l2loopback_version=$(shell gawk '/^v4l2loopback / { print $$2; }' debian/dkms-versions) + # NVIDIA DKMS package gross series split into desktop and server. nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions) nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions) @@ -180,7 +182,6 @@ $(DEBIAN)/control.stub: \ $(DROOT)/scripts/control-create \ $(control_files) \ - $(DROOT)/control.d/flavour-module.stub \ $(DEBIAN)/changelog \ $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars) for i in $(control_files); do \ diff -u linux-oem-5.17-5.17.0/debian/rules.d/0-common-vars.mk linux-oem-5.17-5.17.0/debian/rules.d/0-common-vars.mk --- linux-oem-5.17-5.17.0/debian/rules.d/0-common-vars.mk +++ linux-oem-5.17-5.17.0/debian/rules.d/0-common-vars.mk @@ -288,47 +287,0 @@ - -# DKMS -all_dkms_modules = - -subst_paired = $(subst $(firstword $(subst =, ,$(1))),$(lastword $(subst =, ,$(1))),$(2)) -recursive_call = $(if $(2),$(call recursive_call,$(1),$(wordlist 2,$(words $(2)),$(2)),$(call $(1),$(firstword $(2)),$(3))),$(3)) - -$(foreach _line,$(shell gawk '{ OFS = "!"; $$1 = $$1; print }' $(DROOT)/dkms-versions), \ - $(eval _params = $(subst !, ,$(_line))) \ - $(eval _deb_pkgname = $(firstword $(_params))) \ - $(eval _deb_version = $(word 2,$(_params))) \ - $(if $(filter modulename=%,$(_params)), \ - $(eval _m = $(word 2,$(subst =, ,$(filter modulename=%,$(_params))))) \ - , \ - $(info modulename for $(_deb_pkgname) not specified in dkms-versions. Assume $(_deb_pkgname).) \ - $(eval _m = $(_deb_pkgname)) \ - ) \ - $(eval all_dkms_modules += $(_m)) \ - $(eval dkms_$(_m)_version = $(_deb_version)) \ - $(foreach _p,$(patsubst debpath=%,%,$(filter debpath=%,$(_params))), \ - $(eval dkms_$(_m)_debpath += $(strip \ - $(call recursive_call,subst_paired, \ - %module%=$(_m) \ - %package%=$(_deb_pkgname) \ - %version%=$(lastword $(subst :, ,$(_deb_version))) \ - , \ - $(_p) \ - ) \ - )) \ - ) \ - $(if $(dkms_$(_m)_debpath),,$(error debpath for $(_deb_pkgname) not specified.)) \ - $(if $(filter arch=%,$(_params)), \ - $(eval dkms_$(_m)_archs = $(patsubst arch=%,%,$(filter arch=%,$(_params)))) \ - , \ - $(eval dkms_$(_m)_archs = any) \ - ) \ - $(eval dkms_$(_m)_rprovides = $(patsubst rprovides=%,%,$(filter rprovides=%,$(_params)))) \ - $(eval dkms_$(_m)_type = $(word 1,$(patsubst type=%,%,$(filter type=%,$(_params))) built-in)) \ - $(eval all_$(dkms_$(_m)_type)_dkms_modules += $(_m)) \ - $(if $(filter standalone,$(dkms_$(_m)_type)), \ - $(eval dkms_$(_m)_pkg_name = linux-modules-$(_m)-$(abi_release)) \ - $(eval dkms_$(_m)_subdir = ubuntu) \ - , \ - $(eval dkms_$(_m)_pkg_name = $(mods_pkg_name)) \ - $(eval dkms_$(_m)_subdir = kernel) \ - ) \ -) diff -u linux-oem-5.17-5.17.0/debian/rules.d/2-binary-arch.mk linux-oem-5.17-5.17.0/debian/rules.d/2-binary-arch.mk --- linux-oem-5.17-5.17.0/debian/rules.d/2-binary-arch.mk +++ linux-oem-5.17-5.17.0/debian/rules.d/2-binary-arch.mk @@ -117,10 +117,8 @@ $(stampdir)/stamp-install-%: MODPUBKEY=$(builddir)/build-$*/certs/signing_key.x509 $(stampdir)/stamp-install-%: build_dir=$(builddir)/build-$* $(stampdir)/stamp-install-%: dkms_dir=$(call dkms_dir_prefix,$(builddir)/build-$*) -$(foreach _m,$(all_dkms_modules), \ - $(eval $$(stampdir)/stamp-install-%: enable_$(_m) = $$(filter true,$$(call custom_override,do_$(_m),$$*))) \ - $(eval $$(stampdir)/stamp-install-%: dkms_$(_m)_pkgdir = $$(CURDIR)/debian/$(dkms_$(_m)_pkg_name)-$$*) \ -) +$(stampdir)/stamp-install-%: enable_zfs = $(call custom_override,do_zfs,$*) +$(stampdir)/stamp-install-%: enable_v4l2loopback = $(call custom_override,do_v4l2loopback,$*) $(stampdir)/stamp-install-%: dbgpkgdir_dkms = $(if $(filter true,$(skipdbg)),"",$(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/kernel) $(stampdir)/stamp-install-%: $(stampdir)/stamp-build-% $(stampdir)/stamp-install-headers @echo Debug: $@ kernel_file $(kernel_file) kernfile $(kernfile) install_file $(install_file) instfile $(instfile) @@ -128,9 +126,6 @@ dh_prep -p$(bin_pkg_name)-$* dh_prep -p$(mods_pkg_name)-$* dh_prep -p$(hdrs_pkg_name)-$* - $(foreach _m,$(all_standalone_dkms_modules), \ - $(if $(enable_$(_m)),dh_prep -p$(dkms_$(_m)_pkg_name)-$*;)\ - ) ifneq ($(skipdbg),true) dh_prep -p$(bin_pkg_name)-$*-dbgsym endif @@ -268,12 +263,6 @@ $(call install_control,$(mods_extra_pkg_name)-$*,extra,postinst postrm); \ fi endif - $(foreach _m,$(all_standalone_dkms_modules), \ - $(if $(enable_$(_m)), \ - install -d $(dkms_$(_m)_pkgdir)/usr/lib/linux/triggers; \ - $(call install_control,$(dkms_$(_m)_pkg_name)-$*,extra,postinst postrm); \ - ) \ - ) # Install the full changelog. ifeq ($(do_doc_package),true) @@ -423,11 +412,8 @@ install -d $(dkms_dir) $(dkms_dir)/headers $(dkms_dir)/build $(dkms_dir)/source cp -rp "$(hdrdir)" "$(indep_hdrdir)" "$(dkms_dir)/headers" - $(foreach _m,$(all_dkms_modules), \ - $(if $(enable_$(_m)), \ - $(call build_dkms,$(dkms_$(_m)_pkg_name)-$*,$(dkms_$(_m)_pkgdir)/lib/modules/$(abi_release)-$*/$(dkms_$(_m)_subdir),$(dbgpkgdir_dkms),$(_m),$(dkms_$(_m)_debpath)); \ - ) \ - ) + $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_dkms), zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb)) + $(if $(filter true,$(enable_v4l2loopback)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_dkms), v4l2loopback, pool/universe/v/v4l2loopback/v4l2loopback-dkms_$(dkms_v4l2loopback_version)_all.deb)) ifneq ($(skipdbg),true) @@ -577,7 +563,7 @@ dh_shlibdeps -p$(1) $(shlibdeps_opts) dh_installdeb -p$(1) dh_installdebconf -p$(1) - $(lockme) dh_gencontrol -p$(1) -- -Vlinux:rprovides='$(rprovides)' $(2) + $(lockme) dh_gencontrol -p$(1) -- -Vlinux:rprovides='$(rprovides)' dh_md5sums -p$(1) dh_builddeb -p$(1) endef @@ -586,7 +572,7 @@ endef define dh_all_inline - $(subst ${newline},; \${newline},$(call dh_all,$(1),$(2))) + $(subst ${newline},; \${newline},$(call dh_all,$(1))) endef binary-arch-headers: install-arch-headers @@ -611,10 +597,8 @@ binary-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym binary-%: pkgtools = $(tools_flavour_pkg_name)-$* binary-%: pkgcloud = $(cloud_flavour_pkg_name)-$* -$(foreach _m,$(all_dkms_modules), \ - $(eval binary-%: enable_$(_m) = $$(filter true,$$(call custom_override,do_$(_m),$$*))) \ -) -binary-%: rprovides = $(foreach _m,$(all_built-in_dkms_modules),$(if $(enable_$(_m)),$(foreach _r,$(dkms_$(_m)_rprovides),$(_r)$(comma) ))) +binary-%: rprovides = $(if $(filter true,$(call custom_override,do_zfs,$*)),spl-modules$(comma) spl-dkms$(comma) zfs-modules$(comma) zfs-dkms$(comma)) \ + $(if $(filter true,$(call custom_override,do_v4l2loopback,$*)),v4l2loopback-modules$(comma) v4l2loopback-dkms$(comma)) binary-%: target_flavour = $* binary-%: checks-% @echo Debug: $@ @@ -639,10 +623,6 @@ endif endif - $(foreach _m,$(all_standalone_dkms_modules), \ - $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*);)\ - ) - $(call dh_all,$(pkgbldinfo)) $(call dh_all,$(pkghdr)) diff -u linux-oem-5.17-5.17.0/debian/scripts/control-create linux-oem-5.17-5.17.0/debian/scripts/control-create --- linux-oem-5.17-5.17.0/debian/scripts/control-create +++ linux-oem-5.17-5.17.0/debian/scripts/control-create @@ -41,27 +40,0 @@ - -while read package version extras -do - module="$package" - module_type= - - # Module arch parameters are skipped here, so a package section will - # be generated for each flavour, and its Architecture will be set to - # all architectures with that flavour. Even that is being generated, - # it doesn't follow all of them will be built. That's to work-around - # dkms_exclude/dkms_include that manipulates supported architectures - # in $(DEBIAN)/rules.d/$(arch).mk. - for param in $extras; do - case "$param" in - modulename=*) module="${param#modulename=}" ;; - type=*) module_type="${param#type=}" ;; - *) continue ;; - esac - done - - [ "$module_type" = "standalone" ] || continue - - cat debian/control.d/flavour-module.stub | grep -v '^#' | sed \ - -e "s#ARCH#$arch#g" \ - -e "s#MODULE#$module#g" \ - -e "s#FLAVOUR#$flavour#g" -done <"debian/dkms-versions" diff -u linux-oem-5.17-5.17.0/drivers/acpi/processor_idle.c linux-oem-5.17-5.17.0/drivers/acpi/processor_idle.c --- linux-oem-5.17-5.17.0/drivers/acpi/processor_idle.c +++ linux-oem-5.17-5.17.0/drivers/acpi/processor_idle.c @@ -96,6 +96,11 @@ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")}, (void *)1}, + /* T40 can not handle C3 idle state */ + { set_max_cstate, "IBM ThinkPad T40", { + DMI_MATCH(DMI_SYS_VENDOR, "IBM"), + DMI_MATCH(DMI_PRODUCT_NAME, "23737CU")}, + (void *)2}, {}, }; @@ -790,8 +795,7 @@ if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) { state->enter_dead = acpi_idle_play_dead; - if (cx->type != ACPI_STATE_C3) - drv->safe_state_index = count; + drv->safe_state_index = count; } /* * Halt-induced C1 is not good for ->enter_s2idle, because it @@ -1075,11 +1079,6 @@ return 0; } -int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) -{ - return -EOPNOTSUPP; -} - static int acpi_processor_get_lpi_info(struct acpi_processor *pr) { int ret, i; @@ -1088,11 +1087,6 @@ struct acpi_device *d = NULL; struct acpi_lpi_states_array info[2], *tmp, *prev, *curr; - /* make sure our architecture has support */ - ret = acpi_processor_ffh_lpi_probe(pr->id); - if (ret == -EOPNOTSUPP) - return ret; - if (!osc_pc_lpi_support_confirmed) return -EOPNOTSUPP; @@ -1144,6 +1138,11 @@ return 0; } +int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) +{ + return -ENODEV; +} + int __weak acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi) { return -ENODEV; diff -u linux-oem-5.17-5.17.0/drivers/android/binder.c linux-oem-5.17-5.17.0/drivers/android/binder.c --- linux-oem-5.17-5.17.0/drivers/android/binder.c +++ linux-oem-5.17-5.17.0/drivers/android/binder.c @@ -2295,7 +2295,6 @@ { int ret = 0; struct binder_sg_copy *sgc, *tmpsgc; - struct binder_ptr_fixup *tmppf; struct binder_ptr_fixup *pf = list_first_entry_or_null(pf_head, struct binder_ptr_fixup, node); @@ -2350,11 +2349,7 @@ list_del(&sgc->node); kfree(sgc); } - list_for_each_entry_safe(pf, tmppf, pf_head, node) { - BUG_ON(pf->skip_size == 0); - list_del(&pf->node); - kfree(pf); - } + BUG_ON(!list_empty(pf_head)); BUG_ON(!list_empty(sgc_head)); return ret > 0 ? -EINVAL : ret; @@ -2491,9 +2486,6 @@ struct binder_proc *proc = thread->proc; int ret; - if (fda->num_fds == 0) - return 0; - fd_buf_size = sizeof(u32) * fda->num_fds; if (fda->num_fds >= SIZE_MAX / sizeof(u32)) { binder_user_error("%d:%d got transaction with invalid number of fds (%lld)\n", reverted: --- linux-oem-5.17-5.17.0/drivers/ata/libata-core.c +++ linux-oem-5.17-5.17.0.orig/drivers/ata/libata-core.c @@ -4014,9 +4014,6 @@ ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, - { "Samsung SSD 840 EVO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | - ATA_HORKAGE_NO_DMA_LOG | - ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | reverted: --- linux-oem-5.17-5.17.0/drivers/ata/pata_marvell.c +++ linux-oem-5.17-5.17.0.orig/drivers/ata/pata_marvell.c @@ -77,8 +77,6 @@ switch(ap->port_no) { case 0: - if (!ap->ioaddr.bmdma_addr) - return ATA_CBL_PATA_UNK; if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1) return ATA_CBL_PATA40; return ATA_CBL_PATA80; reverted: --- linux-oem-5.17-5.17.0/drivers/base/arch_topology.c +++ linux-oem-5.17-5.17.0.orig/drivers/base/arch_topology.c @@ -628,15 +628,6 @@ core_mask = &cpu_topology[cpu].llc_sibling; } - /* - * For systems with no shared cpu-side LLC but with clusters defined, - * extend core_mask to cluster_siblings. The sched domain builder will - * then remove MC as redundant with CLS if SCHED_CLUSTER is enabled. - */ - if (IS_ENABLED(CONFIG_SCHED_CLUSTER) && - cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling)) - core_mask = &cpu_topology[cpu].cluster_sibling; - return core_mask; } @@ -654,7 +645,7 @@ for_each_online_cpu(cpu) { cpu_topo = &cpu_topology[cpu]; + if (cpuid_topo->llc_id == cpu_topo->llc_id) { - if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) { cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling); cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling); } diff -u linux-oem-5.17-5.17.0/drivers/base/dd.c linux-oem-5.17-5.17.0/drivers/base/dd.c --- linux-oem-5.17-5.17.0/drivers/base/dd.c +++ linux-oem-5.17-5.17.0/drivers/base/dd.c @@ -296,7 +296,6 @@ return -EPROBE_DEFER; } -EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state); static void deferred_probe_timeout_work_func(struct work_struct *work) { reverted: --- linux-oem-5.17-5.17.0/drivers/block/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/block/Kconfig @@ -33,22 +33,6 @@ To compile this driver as a module, choose M here: the module will be called floppy. -config BLK_DEV_FD_RAWCMD - bool "Support for raw floppy disk commands (DEPRECATED)" - depends on BLK_DEV_FD - help - If you want to use actual physical floppies and expect to do - special low-level hardware accesses to them (access and use - non-standard formats, for example), then enable this. - - Note that the code enabled by this option is rarely used and - might be unstable or insecure, and distros should not enable it. - - Note: FDRAWCMD is deprecated and will be removed from the kernel - in the near future. - - If unsure, say N. - config AMIGA_FLOPPY tristate "Amiga floppy support" depends on AMIGA diff -u linux-oem-5.17-5.17.0/drivers/block/drbd/drbd_main.c linux-oem-5.17-5.17.0/drivers/block/drbd/drbd_main.c --- linux-oem-5.17-5.17.0/drivers/block/drbd/drbd_main.c +++ linux-oem-5.17-5.17.0/drivers/block/drbd/drbd_main.c @@ -2739,7 +2739,6 @@ sprintf(disk->disk_name, "drbd%d", minor); disk->private_data = device; - blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue); blk_queue_write_cache(disk->queue, true, true); /* Setting the max_hw_sectors to an odd value of 8kibyte here This triggers a max_bio_size message upon first attach or connect */ reverted: --- linux-oem-5.17-5.17.0/drivers/block/floppy.c +++ linux-oem-5.17-5.17.0.orig/drivers/block/floppy.c @@ -2984,8 +2984,6 @@ return "(null)"; } -#ifdef CONFIG_BLK_DEV_FD_RAWCMD - /* raw commands */ static void raw_cmd_done(int flag) { @@ -3185,35 +3183,6 @@ return ret; } -static int floppy_raw_cmd_ioctl(int type, int drive, int cmd, - void __user *param) -{ - int ret; - - pr_warn_once("Note: FDRAWCMD is deprecated and will be removed from the kernel in the near future.\n"); - - if (type) - return -EINVAL; - if (lock_fdc(drive)) - return -EINTR; - set_floppy(drive); - ret = raw_cmd_ioctl(cmd, param); - if (ret == -EINTR) - return -EINTR; - process_fd_request(); - return ret; -} - -#else /* CONFIG_BLK_DEV_FD_RAWCMD */ - -static int floppy_raw_cmd_ioctl(int type, int drive, int cmd, - void __user *param) -{ - return -EOPNOTSUPP; -} - -#endif - static int invalidate_drive(struct block_device *bdev) { /* invalidate the buffer track to force a reread */ @@ -3402,6 +3371,7 @@ { int drive = (long)bdev->bd_disk->private_data; int type = ITYPE(drive_state[drive].fd_device); + int i; int ret; int size; union inparam { @@ -3552,7 +3522,16 @@ outparam = &write_errors[drive]; break; case FDRAWCMD: + if (type) + return -EINVAL; + if (lock_fdc(drive)) + return -EINTR; + set_floppy(drive); + i = raw_cmd_ioctl(cmd, (void __user *)param); + if (i == -EINTR) + return -EINTR; + process_fd_request(); + return i; - return floppy_raw_cmd_ioctl(type, drive, cmd, (void __user *)param); case FDTWADDLE: if (lock_fdc(drive)) return -EINTR; reverted: --- linux-oem-5.17-5.17.0/drivers/block/null_blk/main.c +++ linux-oem-5.17-5.17.0.orig/drivers/block/null_blk/main.c @@ -1606,7 +1606,7 @@ * Only fake timeouts need to execute blk_mq_complete_request() here. */ cmd->error = BLK_STS_TIMEOUT; + if (cmd->fake_timeout) - if (cmd->fake_timeout || hctx->type == HCTX_TYPE_POLL) blk_mq_complete_request(rq); return BLK_EH_DONE; } reverted: --- linux-oem-5.17-5.17.0/drivers/bus/fsl-mc/fsl-mc-msi.c +++ linux-oem-5.17-5.17.0.orig/drivers/bus/fsl-mc/fsl-mc-msi.c @@ -224,12 +224,8 @@ if (error) return error; - msi_lock_descs(dev); if (msi_first_desc(dev, MSI_DESC_ALL)) + return -EINVAL; - error = -EINVAL; - msi_unlock_descs(dev); - if (error) - return error; /* * NOTE: Calling this function will trigger the invocation of the diff -u linux-oem-5.17-5.17.0/drivers/bus/mhi/pci_generic.c linux-oem-5.17-5.17.0/drivers/bus/mhi/pci_generic.c --- linux-oem-5.17-5.17.0/drivers/bus/mhi/pci_generic.c +++ linux-oem-5.17-5.17.0/drivers/bus/mhi/pci_generic.c @@ -1060,7 +1060,6 @@ * the intermediate restore kernel reinitializes MHI device with new * context. */ - flush_work(&mhi_pdev->recovery_work); if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { mhi_power_down(mhi_cntrl, true); mhi_unprepare_after_power_down(mhi_cntrl); @@ -1086,7 +1085,6 @@ .resume = mhi_pci_resume, .freeze = mhi_pci_freeze, .thaw = mhi_pci_restore, - .poweroff = mhi_pci_freeze, .restore = mhi_pci_restore, #endif }; reverted: --- linux-oem-5.17-5.17.0/drivers/bus/sunxi-rsb.c +++ linux-oem-5.17-5.17.0.orig/drivers/bus/sunxi-rsb.c @@ -227,8 +227,6 @@ dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev)); - return rdev; - err_device_add: put_device(&rdev->dev); reverted: --- linux-oem-5.17-5.17.0/drivers/bus/ti-sysc.c +++ linux-oem-5.17-5.17.0.orig/drivers/bus/ti-sysc.c @@ -3232,27 +3232,13 @@ */ static int sysc_check_active_timer(struct sysc *ddata) { - int error; - if (ddata->cap->type != TI_SYSC_OMAP2_TIMER && ddata->cap->type != TI_SYSC_OMAP4_TIMER) return 0; - /* - * Quirk for omap3 beagleboard revision A to B4 to use gpt12. - * Revision C and later are fixed with commit 23885389dbbb ("ARM: - * dts: Fix timer regression for beagleboard revision c"). This all - * can be dropped if we stop supporting old beagleboard revisions - * A to B4 at some point. - */ - if (sysc_soc->soc == SOC_3430) - error = -ENXIO; - else - error = -EBUSY; - if ((ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) && (ddata->cfg.quirks & SYSC_QUIRK_NO_IDLE)) + return -ENXIO; - return error; return 0; } reverted: --- linux-oem-5.17-5.17.0/drivers/char/ipmi/ipmi_msghandler.c +++ linux-oem-5.17-5.17.0.orig/drivers/char/ipmi/ipmi_msghandler.c @@ -3677,11 +3677,8 @@ void ipmi_unregister_smi(struct ipmi_smi *intf) { struct ipmi_smi_watcher *w; + int intf_num = intf->intf_num, index; - int intf_num, index; - if (!intf) - return; - intf_num = intf->intf_num; mutex_lock(&ipmi_interfaces_mutex); intf->intf_num = -1; intf->in_shutdown = true; @@ -4521,8 +4518,6 @@ } else /* The message was sent, start the timer. */ intf_start_seq_timer(intf, msg->msgid); - requeue = 0; - goto out; } else if (((msg->rsp[0] >> 2) != ((msg->data[0] >> 2) | 1)) || (msg->rsp[1] != msg->data[1])) { /* reverted: --- linux-oem-5.17-5.17.0/drivers/char/ipmi/ipmi_si_intf.c +++ linux-oem-5.17-5.17.0.orig/drivers/char/ipmi/ipmi_si_intf.c @@ -2220,7 +2220,10 @@ return; list_del(&smi_info->link); + + if (smi_info->intf) + ipmi_unregister_smi(smi_info->intf); + - ipmi_unregister_smi(smi_info->intf); kfree(smi_info); } reverted: --- linux-oem-5.17-5.17.0/drivers/clk/sunxi/clk-sun9i-mmc.c +++ linux-oem-5.17-5.17.0.orig/drivers/clk/sunxi/clk-sun9i-mmc.c @@ -109,8 +109,6 @@ spin_lock_init(&data->lock); r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) - return -EINVAL; /* one clock/reset pair per word */ count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH); data->membase = devm_ioremap_resource(&pdev->dev, r); reverted: --- linux-oem-5.17-5.17.0/drivers/cpufreq/qcom-cpufreq-hw.c +++ linux-oem-5.17-5.17.0.orig/drivers/cpufreq/qcom-cpufreq-hw.c @@ -24,16 +24,12 @@ #define CLK_HW_DIV 2 #define LUT_TURBO_IND 1 -#define GT_IRQ_STATUS BIT(2) - #define HZ_PER_KHZ 1000 struct qcom_cpufreq_soc_data { u32 reg_enable; - u32 reg_domain_state; u32 reg_freq_lut; u32 reg_volt_lut; - u32 reg_intr_clr; u32 reg_current_vote; u32 reg_perf_state; u8 lut_row_size; @@ -271,46 +267,37 @@ } } +static unsigned int qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data) -static unsigned long qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data) { + unsigned int val = readl_relaxed(data->base + data->soc_data->reg_current_vote); - unsigned int lval; - - if (data->soc_data->reg_current_vote) - lval = readl_relaxed(data->base + data->soc_data->reg_current_vote) & 0x3ff; - else - lval = readl_relaxed(data->base + data->soc_data->reg_domain_state) & 0xff; + return (val & 0x3FF) * 19200; - return lval * xo_rate; } static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) { struct cpufreq_policy *policy = data->policy; + int cpu = cpumask_first(policy->cpus); - int cpu = cpumask_first(policy->related_cpus); struct device *dev = get_cpu_device(cpu); unsigned long freq_hz, throttled_freq; struct dev_pm_opp *opp; + unsigned int freq; /* * Get the h/w throttled frequency, normalize it using the * registered opp table and use it to calculate thermal pressure. */ + freq = qcom_lmh_get_throttle_freq(data); + freq_hz = freq * HZ_PER_KHZ; - freq_hz = qcom_lmh_get_throttle_freq(data); opp = dev_pm_opp_find_freq_floor(dev, &freq_hz); if (IS_ERR(opp) && PTR_ERR(opp) == -ERANGE) + dev_pm_opp_find_freq_ceil(dev, &freq_hz); - opp = dev_pm_opp_find_freq_ceil(dev, &freq_hz); + throttled_freq = freq_hz / HZ_PER_KHZ; - 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); - /* Update thermal pressure (the boost frequencies are accepted) */ - arch_update_thermal_pressure(policy->related_cpus, throttled_freq); - - dev_pm_opp_put(opp); - } /* * In the unlikely case policy is unregistered do not enable @@ -350,10 +337,6 @@ disable_irq_nosync(c_data->throttle_irq); schedule_delayed_work(&c_data->throttle_work, 0); - if (c_data->soc_data->reg_intr_clr) - writel_relaxed(GT_IRQ_STATUS, - c_data->base + c_data->soc_data->reg_intr_clr); - return IRQ_HANDLED; } @@ -368,10 +351,8 @@ static const struct qcom_cpufreq_soc_data epss_soc_data = { .reg_enable = 0x0, - .reg_domain_state = 0x20, .reg_freq_lut = 0x100, .reg_volt_lut = 0x200, - .reg_intr_clr = 0x308, .reg_perf_state = 0x320, .lut_row_size = 4, }; @@ -431,7 +412,6 @@ mutex_unlock(&data->throttle_lock); cancel_delayed_work_sync(&data->throttle_work); - irq_set_affinity_hint(data->throttle_irq, NULL); free_irq(data->throttle_irq, data); } reverted: --- linux-oem-5.17-5.17.0/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ linux-oem-5.17-5.17.0.orig/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -98,10 +98,8 @@ return -ENOMEM; ret = sun50i_cpufreq_get_efuse(&speed); + if (ret) - if (ret) { - kfree(opp_tables); return ret; - } snprintf(name, MAX_NAME_LEN, "speed%d", speed); reverted: --- linux-oem-5.17-5.17.0/drivers/dma/at_xdmac.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/at_xdmac.c @@ -1453,7 +1453,7 @@ { struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan); struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); + struct at_xdmac_desc *desc, *_desc; - struct at_xdmac_desc *desc, *_desc, *iter; struct list_head *descs_list; enum dma_status ret; int residue, retry; @@ -1568,13 +1568,11 @@ * microblock. */ descs_list = &desc->descs_list; + list_for_each_entry_safe(desc, _desc, descs_list, desc_node) { + dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg); + residue -= (desc->lld.mbr_ubc & 0xffffff) << dwidth; + if ((desc->lld.mbr_nda & 0xfffffffc) == cur_nda) - list_for_each_entry_safe(iter, _desc, descs_list, desc_node) { - dwidth = at_xdmac_get_dwidth(iter->lld.mbr_cfg); - residue -= (iter->lld.mbr_ubc & 0xffffff) << dwidth; - if ((iter->lld.mbr_nda & 0xfffffffc) == cur_nda) { - desc = iter; break; - } } residue += cur_ubc << dwidth; reverted: --- linux-oem-5.17-5.17.0/drivers/dma/dw-edma/dw-edma-v0-core.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -415,11 +415,8 @@ (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE)); /* Linked list */ #ifdef CONFIG_64BIT + SET_CH_64(dw, chan->dir, chan->id, llp.reg, + chunk->ll_region.paddr); - /* llp is not aligned on 64bit -> keep 32bit accesses */ - SET_CH_32(dw, chan->dir, chan->id, llp.lsb, - lower_32_bits(chunk->ll_region.paddr)); - SET_CH_32(dw, chan->dir, chan->id, llp.msb, - upper_32_bits(chunk->ll_region.paddr)); #else /* CONFIG_64BIT */ SET_CH_32(dw, chan->dir, chan->id, llp.lsb, lower_32_bits(chunk->ll_region.paddr)); diff -u linux-oem-5.17-5.17.0/drivers/dma/idxd/device.c linux-oem-5.17-5.17.0/drivers/dma/idxd/device.c --- linux-oem-5.17-5.17.0/drivers/dma/idxd/device.c +++ linux-oem-5.17-5.17.0/drivers/dma/idxd/device.c @@ -373,6 +373,7 @@ { lockdep_assert_held(&wq->wq_lock); + idxd_wq_disable_cleanup(wq); wq->size = 0; wq->group = NULL; } @@ -700,17 +701,14 @@ if (wq->state == IDXD_WQ_ENABLED) { idxd_wq_disable_cleanup(wq); + idxd_wq_device_reset_cleanup(wq); wq->state = IDXD_WQ_DISABLED; } - idxd_wq_device_reset_cleanup(wq); } } void idxd_device_clear_state(struct idxd_device *idxd) { - if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) - return; - idxd_groups_clear_state(idxd); idxd_engines_clear_state(idxd); idxd_device_wqs_clear_state(idxd); reverted: --- linux-oem-5.17-5.17.0/drivers/dma/idxd/submit.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/idxd/submit.c @@ -150,15 +150,14 @@ */ int idxd_enqcmds(struct idxd_wq *wq, void __iomem *portal, const void *desc) { + int rc, retries = 0; - unsigned int retries = wq->enqcmds_retries; - int rc; do { rc = enqcmds(portal, desc); if (rc == 0) break; cpu_relax(); + } while (retries++ < wq->enqcmds_retries); - } while (retries--); return rc; } reverted: --- linux-oem-5.17-5.17.0/drivers/dma/idxd/sysfs.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/idxd/sysfs.c @@ -905,9 +905,6 @@ u64 xfer_size; int rc; - if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) - return -EPERM; - if (wq->state != IDXD_WQ_DISABLED) return -EPERM; @@ -942,9 +939,6 @@ u64 batch_size; int rc; - if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) - return -EPERM; - if (wq->state != IDXD_WQ_DISABLED) return -EPERM; reverted: --- linux-oem-5.17-5.17.0/drivers/dma/imx-sdma.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/imx-sdma.c @@ -198,12 +198,12 @@ s32 per_2_firi_addr; s32 mcu_2_firi_addr; s32 uart_2_per_addr; + s32 uart_2_mcu_ram_addr; - s32 uart_2_mcu_addr; s32 per_2_app_addr; s32 mcu_2_app_addr; s32 per_2_per_addr; s32 uartsh_2_per_addr; + s32 uartsh_2_mcu_ram_addr; - s32 uartsh_2_mcu_addr; s32 per_2_shp_addr; s32 mcu_2_shp_addr; s32 ata_2_mcu_addr; @@ -232,8 +232,8 @@ s32 mcu_2_ecspi_addr; s32 mcu_2_sai_addr; s32 sai_2_mcu_addr; + s32 uart_2_mcu_addr; + s32 uartsh_2_mcu_addr; - s32 uart_2_mcu_rom_addr; - s32 uartsh_2_mcu_rom_addr; /* End of v3 array */ s32 mcu_2_zqspi_addr; /* End of v4 array */ @@ -1780,17 +1780,17 @@ saddr_arr[i] = addr_arr[i]; /* + * get uart_2_mcu_addr/uartsh_2_mcu_addr rom script specially because + * they are now replaced by uart_2_mcu_ram_addr/uartsh_2_mcu_ram_addr + * to be compatible with legacy freescale/nxp sdma firmware, and they + * are located in the bottom part of sdma_script_start_addrs which are + * beyond the SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1. - * For compatibility with NXP internal legacy kernel before 4.19 which - * is based on uart ram script and mainline kernel based on uart rom - * script, both uart ram/rom scripts are present in newer sdma - * firmware. Use the rom versions if they are present (V3 or newer). */ + if (addr->uart_2_mcu_addr) + sdma->script_addrs->uart_2_mcu_addr = addr->uart_2_mcu_addr; + if (addr->uartsh_2_mcu_addr) + sdma->script_addrs->uartsh_2_mcu_addr = addr->uartsh_2_mcu_addr; + - if (sdma->script_number >= SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3) { - if (addr->uart_2_mcu_rom_addr) - sdma->script_addrs->uart_2_mcu_addr = addr->uart_2_mcu_rom_addr; - if (addr->uartsh_2_mcu_rom_addr) - sdma->script_addrs->uartsh_2_mcu_addr = addr->uartsh_2_mcu_rom_addr; - } } static void sdma_load_firmware(const struct firmware *fw, void *context) @@ -1869,7 +1869,7 @@ u32 reg, val, shift, num_map, i; int ret = 0; + if (IS_ERR(np) || IS_ERR(gpr_np)) - if (IS_ERR(np) || !gpr_np) goto out; event_remap = of_find_property(np, propname, NULL); @@ -1917,7 +1917,7 @@ } out: + if (!IS_ERR(gpr_np)) - if (gpr_np) of_node_put(gpr_np); return ret; reverted: --- linux-oem-5.17-5.17.0/drivers/dma/mediatek/mtk-uart-apdma.c +++ linux-oem-5.17-5.17.0.orig/drivers/dma/mediatek/mtk-uart-apdma.c @@ -274,7 +274,7 @@ unsigned int status; int ret; + ret = pm_runtime_get_sync(mtkd->ddev.dev); - ret = pm_runtime_resume_and_get(mtkd->ddev.dev); if (ret < 0) { pm_runtime_put_noidle(chan->device->dev); return ret; @@ -288,21 +288,18 @@ ret = readx_poll_timeout(readl, c->base + VFF_EN, status, !status, 10, 100); if (ret) + return ret; - goto err_pm; ret = request_irq(c->irq, mtk_uart_apdma_irq_handler, IRQF_TRIGGER_NONE, KBUILD_MODNAME, chan); if (ret < 0) { dev_err(chan->device->dev, "Can't request dma IRQ\n"); + return -EINVAL; - ret = -EINVAL; - goto err_pm; } if (mtkd->support_33bits) mtk_uart_apdma_write(c, VFF_4G_SUPPORT, VFF_4G_SUPPORT_CLR_B); -err_pm: - pm_runtime_put_noidle(mtkd->ddev.dev); return ret; } reverted: --- linux-oem-5.17-5.17.0/drivers/edac/synopsys_edac.c +++ linux-oem-5.17-5.17.0.orig/drivers/edac/synopsys_edac.c @@ -164,11 +164,6 @@ #define ECC_STAT_CECNT_SHIFT 8 #define ECC_STAT_BITNUM_MASK 0x7F -/* ECC error count register definitions */ -#define ECC_ERRCNT_UECNT_MASK 0xFFFF0000 -#define ECC_ERRCNT_UECNT_SHIFT 16 -#define ECC_ERRCNT_CECNT_MASK 0xFFFF - /* DDR QOS Interrupt register definitions */ #define DDR_QOS_IRQ_STAT_OFST 0x20200 #define DDR_QOSUE_MASK 0x4 @@ -428,16 +423,15 @@ base = priv->baseaddr; p = &priv->stat; - regval = readl(base + ECC_ERRCNT_OFST); - p->ce_cnt = regval & ECC_ERRCNT_CECNT_MASK; - p->ue_cnt = (regval & ECC_ERRCNT_UECNT_MASK) >> ECC_ERRCNT_UECNT_SHIFT; - if (!p->ce_cnt) - goto ue_err; - regval = readl(base + ECC_STAT_OFST); if (!regval) return 1; + p->ce_cnt = (regval & ECC_STAT_CECNT_MASK) >> ECC_STAT_CECNT_SHIFT; + p->ue_cnt = (regval & ECC_STAT_UECNT_MASK) >> ECC_STAT_UECNT_SHIFT; + if (!p->ce_cnt) + goto ue_err; + p->ceinfo.bitpos = (regval & ECC_STAT_BITNUM_MASK); regval = readl(base + ECC_CEADDR0_OFST); reverted: --- linux-oem-5.17-5.17.0/drivers/firewire/core-card.c +++ linux-oem-5.17-5.17.0.orig/drivers/firewire/core-card.c @@ -668,7 +668,6 @@ void fw_core_remove_card(struct fw_card *card) { struct fw_card_driver dummy_driver = dummy_driver_template; - unsigned long flags; card->driver->update_phy_reg(card, 4, PHY_LINK_ACTIVE | PHY_CONTENDER, 0); @@ -683,9 +682,7 @@ dummy_driver.stop_iso = card->driver->stop_iso; card->driver = &dummy_driver; - spin_lock_irqsave(&card->lock, flags); fw_destroy_nodes(card); - spin_unlock_irqrestore(&card->lock, flags); /* Wait for all users, especially device workqueue jobs, to finish. */ fw_card_put(card); reverted: --- linux-oem-5.17-5.17.0/drivers/firewire/core-cdev.c +++ linux-oem-5.17-5.17.0.orig/drivers/firewire/core-cdev.c @@ -1500,7 +1500,6 @@ { struct outbound_phy_packet_event *e = container_of(packet, struct outbound_phy_packet_event, p); - struct client *e_client; switch (status) { /* expected: */ @@ -1517,10 +1516,9 @@ } e->phy_packet.data[0] = packet->timestamp; - e_client = e->client; queue_event(e->client, &e->event, &e->phy_packet, sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); + client_put(e->client); - client_put(e_client); } static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) reverted: --- linux-oem-5.17-5.17.0/drivers/firewire/core-topology.c +++ linux-oem-5.17-5.17.0.orig/drivers/firewire/core-topology.c @@ -375,13 +375,16 @@ card->bm_retries = 0; } -/* Must be called with card->lock held */ void fw_destroy_nodes(struct fw_card *card) { + unsigned long flags; + + spin_lock_irqsave(&card->lock, flags); card->color++; if (card->local_node != NULL) for_each_fw_node(card, card->local_node, report_lost_node); card->local_node = NULL; + spin_unlock_irqrestore(&card->lock, flags); } static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) @@ -507,8 +510,6 @@ struct fw_node *local_node; unsigned long flags; - spin_lock_irqsave(&card->lock, flags); - /* * If the selfID buffer is not the immediate successor of the * previously processed one, we cannot reliably compare the @@ -520,6 +521,8 @@ card->bm_retries = 0; } + spin_lock_irqsave(&card->lock, flags); + card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated; card->node_id = node_id; /* reverted: --- linux-oem-5.17-5.17.0/drivers/firewire/core-transaction.c +++ linux-oem-5.17-5.17.0.orig/drivers/firewire/core-transaction.c @@ -73,25 +73,24 @@ static int close_transaction(struct fw_transaction *transaction, struct fw_card *card, int rcode) { + struct fw_transaction *t; - struct fw_transaction *t = NULL, *iter; unsigned long flags; spin_lock_irqsave(&card->lock, flags); + list_for_each_entry(t, &card->transaction_list, link) { + if (t == transaction) { + if (!try_cancel_split_timeout(t)) { - list_for_each_entry(iter, &card->transaction_list, link) { - if (iter == transaction) { - if (!try_cancel_split_timeout(iter)) { spin_unlock_irqrestore(&card->lock, flags); goto timed_out; } + list_del_init(&t->link); + card->tlabel_mask &= ~(1ULL << t->tlabel); - list_del_init(&iter->link); - card->tlabel_mask &= ~(1ULL << iter->tlabel); - t = iter; break; } } spin_unlock_irqrestore(&card->lock, flags); + if (&t->link != &card->transaction_list) { - if (t) { t->callback(card, rcode, NULL, 0, t->callback_data); return 0; } @@ -936,7 +935,7 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) { + struct fw_transaction *t; - struct fw_transaction *t = NULL, *iter; unsigned long flags; u32 *data; size_t data_length; @@ -948,21 +947,20 @@ rcode = HEADER_GET_RCODE(p->header[1]); spin_lock_irqsave(&card->lock, flags); + list_for_each_entry(t, &card->transaction_list, link) { + if (t->node_id == source && t->tlabel == tlabel) { + if (!try_cancel_split_timeout(t)) { - list_for_each_entry(iter, &card->transaction_list, link) { - if (iter->node_id == source && iter->tlabel == tlabel) { - if (!try_cancel_split_timeout(iter)) { spin_unlock_irqrestore(&card->lock, flags); goto timed_out; } + list_del_init(&t->link); + card->tlabel_mask &= ~(1ULL << t->tlabel); - list_del_init(&iter->link); - card->tlabel_mask &= ~(1ULL << iter->tlabel); - t = iter; break; } } spin_unlock_irqrestore(&card->lock, flags); + if (&t->link == &card->transaction_list) { - if (!t) { timed_out: fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", source, tlabel); reverted: --- linux-oem-5.17-5.17.0/drivers/firewire/sbp2.c +++ linux-oem-5.17-5.17.0.orig/drivers/firewire/sbp2.c @@ -408,7 +408,7 @@ void *payload, size_t length, void *callback_data) { struct sbp2_logical_unit *lu = callback_data; + struct sbp2_orb *orb; - struct sbp2_orb *orb = NULL, *iter; struct sbp2_status status; unsigned long flags; @@ -433,18 +433,17 @@ /* Lookup the orb corresponding to this status write. */ spin_lock_irqsave(&lu->tgt->lock, flags); + list_for_each_entry(orb, &lu->orb_list, link) { - list_for_each_entry(iter, &lu->orb_list, link) { if (STATUS_GET_ORB_HIGH(status) == 0 && + STATUS_GET_ORB_LOW(status) == orb->request_bus) { + orb->rcode = RCODE_COMPLETE; + list_del(&orb->link); - STATUS_GET_ORB_LOW(status) == iter->request_bus) { - iter->rcode = RCODE_COMPLETE; - list_del(&iter->link); - orb = iter; break; } } spin_unlock_irqrestore(&lu->tgt->lock, flags); + if (&orb->link != &lu->orb_list) { - if (orb) { orb->callback(orb, &status); kref_put(&orb->kref, free_orb); /* orb callback reference */ } else { reverted: --- linux-oem-5.17-5.17.0/drivers/firmware/arm_scmi/clock.c +++ linux-oem-5.17-5.17.0.orig/drivers/firmware/arm_scmi/clock.c @@ -204,8 +204,7 @@ if (rate_discrete && rate) { clk->list.num_rates = tot_rate_cnt; + sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL); - sort(clk->list.rates, tot_rate_cnt, sizeof(*rate), - rate_cmp_func, NULL); } clk->rate_discrete = rate_discrete; reverted: --- linux-oem-5.17-5.17.0/drivers/firmware/arm_scmi/driver.c +++ linux-oem-5.17-5.17.0.orig/drivers/firmware/arm_scmi/driver.c @@ -652,8 +652,7 @@ xfer = scmi_xfer_command_acquire(cinfo, msg_hdr); if (IS_ERR(xfer)) { + scmi_clear_channel(info, cinfo); - if (MSG_XTRACT_TYPE(msg_hdr) == MSG_TYPE_DELAYED_RESP) - scmi_clear_channel(info, cinfo); return; } reverted: --- linux-oem-5.17-5.17.0/drivers/firmware/cirrus/cs_dsp.c +++ linux-oem-5.17-5.17.0.orig/drivers/firmware/cirrus/cs_dsp.c @@ -955,7 +955,8 @@ ctl->alg_region = *alg_region; if (subname && dsp->fw_ver >= 2) { ctl->subname_len = subname_len; + ctl->subname = kmemdup(subname, + strlen(subname) + 1, GFP_KERNEL); - ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname); if (!ctl->subname) { ret = -ENOMEM; goto err_ctl; reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpio-mvebu.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpio-mvebu.c @@ -871,6 +871,13 @@ mvpwm->chip.dev = dev; mvpwm->chip.ops = &mvebu_pwm_ops; mvpwm->chip.npwm = mvchip->chip.ngpio; + /* + * There may already be some PWM allocated, so we can't force + * mvpwm->chip.base to a fixed point like mvchip->chip.base. + * So, we let pwmchip_add() do the numbering and take the next free + * region. + */ + mvpwm->chip.base = -1; spin_lock_init(&mvpwm->lock); reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpio-pca953x.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpio-pca953x.c @@ -762,11 +762,11 @@ bitmap_xor(cur_stat, new_stat, old_stat, gc->ngpio); bitmap_and(trigger, cur_stat, chip->irq_mask, gc->ngpio); - bitmap_copy(chip->irq_stat, new_stat, gc->ngpio); - if (bitmap_empty(trigger, gc->ngpio)) return false; + bitmap_copy(chip->irq_stat, new_stat, gc->ngpio); + bitmap_and(cur_stat, chip->irq_trig_fall, old_stat, gc->ngpio); bitmap_and(old_stat, chip->irq_trig_raise, new_stat, gc->ngpio); bitmap_or(new_stat, old_stat, cur_stat, gc->ngpio); reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpio-sim.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpio-sim.c @@ -134,7 +134,7 @@ struct gpio_sim_chip *chip = gpiochip_get_data(gc); mutex_lock(&chip->lock); + bitmap_copy(bits, chip->value_map, gc->ngpio); - bitmap_replace(bits, bits, chip->value_map, mask, gc->ngpio); mutex_unlock(&chip->lock); return 0; @@ -146,7 +146,7 @@ struct gpio_sim_chip *chip = gpiochip_get_data(gc); mutex_lock(&chip->lock); + bitmap_copy(chip->value_map, bits, gc->ngpio); - bitmap_replace(chip->value_map, chip->value_map, bits, mask, gc->ngpio); mutex_unlock(&chip->lock); } reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpio-visconti.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpio-visconti.c @@ -130,6 +130,7 @@ struct gpio_irq_chip *girq; struct irq_domain *parent; struct device_node *irq_parent; + struct fwnode_handle *fwnode; int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -149,12 +150,14 @@ } parent = irq_find_host(irq_parent); - of_node_put(irq_parent); if (!parent) { dev_err(dev, "No IRQ parent domain\n"); return -ENODEV; } + fwnode = of_node_to_fwnode(irq_parent); + of_node_put(irq_parent); + ret = bgpio_init(&priv->gpio_chip, dev, 4, priv->base + GPIO_IDATA, priv->base + GPIO_OSET, @@ -177,7 +180,7 @@ girq = &priv->gpio_chip.irq; girq->chip = irq_chip; + girq->fwnode = fwnode; - girq->fwnode = of_node_to_fwnode(dev->of_node); girq->parent_domain = parent; girq->child_to_parent_hwirq = visconti_gpio_child_to_parent_hwirq; girq->populate_parent_alloc_arg = visconti_gpio_populate_parent_fwspec; reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpiolib-acpi.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpiolib-acpi.c @@ -387,8 +387,8 @@ pin = agpio->pin_table[0]; if (pin <= 255) { + char ev_name[5]; + sprintf(ev_name, "_%c%02hhX", - char ev_name[8]; - sprintf(ev_name, "_%c%02X", agpio->triggering == ACPI_EDGE_SENSITIVE ? 'E' : 'L', pin); if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) reverted: --- linux-oem-5.17-5.17.0/drivers/gpio/gpiolib-of.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpio/gpiolib-of.c @@ -912,7 +912,7 @@ i, &start); of_property_read_u32_index(np, "gpio-reserved-ranges", i + 1, &count); + if (start >= chip->ngpio || start + count >= chip->ngpio) - if (start >= chip->ngpio || start + count > chip->ngpio) continue; bitmap_clear(chip->valid_mask, start, count); diff -u linux-oem-5.17-5.17.0/drivers/gpio/gpiolib.c linux-oem-5.17-5.17.0/drivers/gpio/gpiolib.c --- linux-oem-5.17-5.17.0/drivers/gpio/gpiolib.c +++ linux-oem-5.17-5.17.0/drivers/gpio/gpiolib.c @@ -1601,6 +1601,8 @@ gpiochip_set_irq_hooks(gc); + acpi_gpiochip_request_interrupts(gc); + /* * Using barrier() here to prevent compiler from reordering * gc->irq.initialized before initialization of above @@ -1610,8 +1612,6 @@ gc->irq.initialized = true; - acpi_gpiochip_request_interrupts(gc); - return 0; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/ObjectID.h +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/ObjectID.h @@ -119,7 +119,6 @@ #define CONNECTOR_OBJECT_ID_eDP 0x14 #define CONNECTOR_OBJECT_ID_MXM 0x15 #define CONNECTOR_OBJECT_ID_LVDS_eDP 0x16 -#define CONNECTOR_OBJECT_ID_USBC 0x17 /* deleted */ diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -5678,7 +5678,7 @@ struct amdgpu_ring *ring) { #ifdef CONFIG_X86_64 - if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) + if (adev->flags & AMD_IS_APU) return; #endif if (adev->gmc.xgmi.connected_to_cpu) @@ -5694,7 +5694,7 @@ struct amdgpu_ring *ring) { #ifdef CONFIG_X86_64 - if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) + if (adev->flags & AMD_IS_APU) return; #endif if (adev->gmc.xgmi.connected_to_cpu) reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -686,7 +686,7 @@ * Maximum number of processes that HWS can schedule concurrently. The maximum is the * number of VMIDs assigned to the HWS, which is also the default. */ +int hws_max_conc_proc = 8; -int hws_max_conc_proc = -1; module_param(hws_max_conc_proc, int, 0444); MODULE_PARM_DESC(hws_max_conc_proc, "Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))"); @@ -2276,23 +2276,18 @@ { struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev); + int r; if (amdgpu_acpi_is_s0ix_active(adev)) adev->in_s0ix = true; else adev->in_s3 = true; + r = amdgpu_device_suspend(drm_dev, true); + if (r) + return r; - return amdgpu_device_suspend(drm_dev, true); -} - -static int amdgpu_pmops_suspend_noirq(struct device *dev) -{ - struct drm_device *drm_dev = dev_get_drvdata(dev); - struct amdgpu_device *adev = drm_to_adev(drm_dev); - if (!adev->in_s0ix) + r = amdgpu_asic_reset(adev); + return r; - return amdgpu_asic_reset(adev); - - return 0; } static int amdgpu_pmops_resume(struct device *dev) @@ -2348,71 +2343,6 @@ return amdgpu_device_resume(drm_dev, true); } -static int amdgpu_runtime_idle_check_display(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); - struct amdgpu_device *adev = drm_to_adev(drm_dev); - - if (adev->mode_info.num_crtc) { - struct drm_connector *list_connector; - struct drm_connector_list_iter iter; - int ret = 0; - - /* XXX: Return busy if any displays are connected to avoid - * possible display wakeups after runtime resume due to - * hotplug events in case any displays were connected while - * the GPU was in suspend. Remove this once that is fixed. - */ - mutex_lock(&drm_dev->mode_config.mutex); - drm_connector_list_iter_begin(drm_dev, &iter); - drm_for_each_connector_iter(list_connector, &iter) { - if (list_connector->status == connector_status_connected) { - ret = -EBUSY; - break; - } - } - drm_connector_list_iter_end(&iter); - mutex_unlock(&drm_dev->mode_config.mutex); - - if (ret) - return ret; - - if (amdgpu_device_has_dc_support(adev)) { - struct drm_crtc *crtc; - - drm_for_each_crtc(crtc, drm_dev) { - drm_modeset_lock(&crtc->mutex, NULL); - if (crtc->state->active) - ret = -EBUSY; - drm_modeset_unlock(&crtc->mutex); - if (ret < 0) - break; - } - } else { - mutex_lock(&drm_dev->mode_config.mutex); - drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL); - - drm_connector_list_iter_begin(drm_dev, &iter); - drm_for_each_connector_iter(list_connector, &iter) { - if (list_connector->dpms == DRM_MODE_DPMS_ON) { - ret = -EBUSY; - break; - } - } - - drm_connector_list_iter_end(&iter); - - drm_modeset_unlock(&drm_dev->mode_config.connection_mutex); - mutex_unlock(&drm_dev->mode_config.mutex); - } - if (ret) - return ret; - } - - return 0; -} - static int amdgpu_pmops_runtime_suspend(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); @@ -2425,10 +2355,6 @@ return -EBUSY; } - ret = amdgpu_runtime_idle_check_display(dev); - if (ret) - return ret; - /* wait for all rings to drain before suspending */ for (i = 0; i < AMDGPU_MAX_RINGS; i++) { struct amdgpu_ring *ring = adev->rings[i]; @@ -2538,7 +2464,41 @@ return -EBUSY; } + if (amdgpu_device_has_dc_support(adev)) { + struct drm_crtc *crtc; + + drm_for_each_crtc(crtc, drm_dev) { + drm_modeset_lock(&crtc->mutex, NULL); + if (crtc->state->active) + ret = -EBUSY; + drm_modeset_unlock(&crtc->mutex); + if (ret < 0) + break; + } + + } else { + struct drm_connector *list_connector; + struct drm_connector_list_iter iter; + + mutex_lock(&drm_dev->mode_config.mutex); + drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL); + + drm_connector_list_iter_begin(drm_dev, &iter); + drm_for_each_connector_iter(list_connector, &iter) { + if (list_connector->dpms == DRM_MODE_DPMS_ON) { + ret = -EBUSY; + break; + } + } + + drm_connector_list_iter_end(&iter); + + drm_modeset_unlock(&drm_dev->mode_config.connection_mutex); + mutex_unlock(&drm_dev->mode_config.mutex); + } + + if (ret == -EBUSY) + DRM_DEBUG_DRIVER("failing to power off - crtc active\n"); - ret = amdgpu_runtime_idle_check_display(dev); pm_runtime_mark_last_busy(dev); pm_runtime_autosuspend(dev); @@ -2568,7 +2528,6 @@ .prepare = amdgpu_pmops_prepare, .complete = amdgpu_pmops_complete, .suspend = amdgpu_pmops_suspend, - .suspend_noirq = amdgpu_pmops_suspend_noirq, .resume = amdgpu_pmops_resume, .freeze = amdgpu_pmops_freeze, .thaw = amdgpu_pmops_thaw, reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -24,7 +24,6 @@ #include #include -#include #include "amdgpu.h" #include "amdgpu_ras.h" @@ -709,8 +708,7 @@ adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV; if (!reg) { + if (is_virtual_machine()) /* passthrough mode exclus sriov mod */ - /* passthrough mode exclus sriov mod */ - if (is_virtual_machine() && !xen_initial_domain()) adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -1334,8 +1334,6 @@ { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 }, /* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */ { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 }, - /* Apple MacBook Pro (15-inch, 2019) Radeon Pro Vega 20 4 GB */ - { 0x1002, 0x69af, 0x106b, 0x019a, 0xc0 }, { 0, 0, 0, 0, 0 }, }; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c @@ -788,7 +788,7 @@ adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); #ifdef CONFIG_X86_64 + if (adev->flags & AMD_IS_APU) { - if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) { adev->gmc.aper_base = adev->gfxhub.funcs->get_mc_fb_offset(adev); adev->gmc.aper_size = adev->gmc.real_vram_size; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c @@ -381,9 +381,8 @@ adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); #ifdef CONFIG_X86_64 + if (adev->flags & AMD_IS_APU && + adev->gmc.real_vram_size > adev->gmc.aper_size) { - if ((adev->flags & AMD_IS_APU) && - adev->gmc.real_vram_size > adev->gmc.aper_size && - !amdgpu_passthrough(adev)) { adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22; adev->gmc.aper_size = adev->gmc.real_vram_size; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -581,7 +581,7 @@ adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); #ifdef CONFIG_X86_64 + if (adev->flags & AMD_IS_APU) { - if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) { adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22; adev->gmc.aper_size = adev->gmc.real_vram_size; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1420,7 +1420,7 @@ */ /* check whether both host-gpu and gpu-gpu xgmi links exist */ + if ((adev->flags & AMD_IS_APU) || - if (((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) || (adev->gmc.xgmi.supported && adev->gmc.xgmi.connected_to_cpu)) { adev->gmc.aper_base = @@ -1684,7 +1684,7 @@ amdgpu_gem_force_release(adev); amdgpu_vm_manager_fini(adev); amdgpu_gart_table_vram_free(adev); + amdgpu_bo_unref(&adev->gmc.pdb0_bo); - amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0); amdgpu_bo_fini(adev); return 0; diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c @@ -1474,11 +1474,8 @@ static int vcn_v3_0_stop_dpg_mode(struct amdgpu_device *adev, int inst_idx) { - struct dpg_pause_state state = {.fw_based = VCN_DPG_STATE__UNPAUSE}; uint32_t tmp; - vcn_v3_0_pause_dpg_mode(adev, 0, &state); - /* Wait for power status to be 1 */ SOC15_WAIT_ON_RREG(VCN, inst_idx, mmUVD_POWER_STATUS, 1, UVD_POWER_STATUS__UVD_POWER_STATUS_MASK); reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -480,10 +480,15 @@ } /* Verify module parameters regarding mapped process number*/ + if ((hws_max_conc_proc < 0) + || (hws_max_conc_proc > kfd->vm_info.vmid_num_kfd)) { + dev_err(kfd_device, + "hws_max_conc_proc %d must be between 0 and %d, use %d instead\n", + hws_max_conc_proc, kfd->vm_info.vmid_num_kfd, + kfd->vm_info.vmid_num_kfd); - if (hws_max_conc_proc >= 0) - kfd->max_proc_per_quantum = min((u32)hws_max_conc_proc, kfd->vm_info.vmid_num_kfd); - else kfd->max_proc_per_quantum = kfd->vm_info.vmid_num_kfd; + } else + kfd->max_proc_per_quantum = hws_max_conc_proc; /* calculate max size of mqds needed for queues */ size = max_num_of_queues_per_device * reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -129,33 +129,19 @@ } static void increment_queue_count(struct device_queue_manager *dqm, + enum kfd_queue_type type) - struct qcm_process_device *qpd, - struct queue *q) { dqm->active_queue_count++; + if (type == KFD_QUEUE_TYPE_COMPUTE || type == KFD_QUEUE_TYPE_DIQ) - if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE || - q->properties.type == KFD_QUEUE_TYPE_DIQ) dqm->active_cp_queue_count++; - - if (q->properties.is_gws) { - dqm->gws_queue_count++; - qpd->mapped_gws_queue = true; - } } static void decrement_queue_count(struct device_queue_manager *dqm, + enum kfd_queue_type type) - struct qcm_process_device *qpd, - struct queue *q) { dqm->active_queue_count--; + if (type == KFD_QUEUE_TYPE_COMPUTE || type == KFD_QUEUE_TYPE_DIQ) - if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE || - q->properties.type == KFD_QUEUE_TYPE_DIQ) dqm->active_cp_queue_count--; - - if (q->properties.is_gws) { - dqm->gws_queue_count--; - qpd->mapped_gws_queue = false; - } } static int allocate_doorbell(struct qcm_process_device *qpd, struct queue *q) @@ -394,7 +380,7 @@ list_add(&q->list, &qpd->queues_list); qpd->queue_count++; if (q->properties.is_active) + increment_queue_count(dqm, q->properties.type); - increment_queue_count(dqm, qpd, q); /* * Unconditionally increment this counter, regardless of the queue's @@ -519,8 +505,13 @@ deallocate_vmid(dqm, qpd, q); } qpd->queue_count--; + if (q->properties.is_active) { + decrement_queue_count(dqm, q->properties.type); + if (q->properties.is_gws) { + dqm->gws_queue_count--; + qpd->mapped_gws_queue = false; + } + } - if (q->properties.is_active) - decrement_queue_count(dqm, qpd, q); return retval; } @@ -613,11 +604,12 @@ * dqm->active_queue_count to determine whether a new runlist must be * uploaded. */ + if (q->properties.is_active && !prev_active) + increment_queue_count(dqm, q->properties.type); + else if (!q->properties.is_active && prev_active) + decrement_queue_count(dqm, q->properties.type); + + if (q->gws && !q->properties.is_gws) { - if (q->properties.is_active && !prev_active) { - increment_queue_count(dqm, &pdd->qpd, q); - } else if (!q->properties.is_active && prev_active) { - decrement_queue_count(dqm, &pdd->qpd, q); - } else if (q->gws && !q->properties.is_gws) { if (q->properties.is_active) { dqm->gws_queue_count++; pdd->qpd.mapped_gws_queue = true; @@ -679,7 +671,11 @@ mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( q->properties.type)]; q->properties.is_active = false; + decrement_queue_count(dqm, q->properties.type); + if (q->properties.is_gws) { + dqm->gws_queue_count--; + qpd->mapped_gws_queue = false; + } - decrement_queue_count(dqm, qpd, q); if (WARN_ONCE(!dqm->sched_running, "Evict when stopped\n")) continue; @@ -725,7 +721,7 @@ continue; q->properties.is_active = false; + decrement_queue_count(dqm, q->properties.type); - decrement_queue_count(dqm, qpd, q); } pdd->last_evict_timestamp = get_jiffies_64(); retval = execute_queues_cpsch(dqm, @@ -796,7 +792,11 @@ mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( q->properties.type)]; q->properties.is_active = true; + increment_queue_count(dqm, q->properties.type); + if (q->properties.is_gws) { + dqm->gws_queue_count++; + qpd->mapped_gws_queue = true; + } - increment_queue_count(dqm, qpd, q); if (WARN_ONCE(!dqm->sched_running, "Restore when stopped\n")) continue; @@ -854,7 +854,7 @@ continue; q->properties.is_active = true; + increment_queue_count(dqm, q->properties.type); - increment_queue_count(dqm, &pdd->qpd, q); } retval = execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); @@ -1260,7 +1260,7 @@ dqm->total_queue_count); list_add(&kq->list, &qpd->priv_queue_list); + increment_queue_count(dqm, kq->queue->properties.type); - increment_queue_count(dqm, qpd, kq->queue); qpd->is_debug = true; execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); dqm_unlock(dqm); @@ -1274,7 +1274,7 @@ { dqm_lock(dqm); list_del(&kq->list); + decrement_queue_count(dqm, kq->queue->properties.type); - decrement_queue_count(dqm, qpd, kq->queue); qpd->is_debug = false; execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0); /* @@ -1341,7 +1341,7 @@ qpd->queue_count++; if (q->properties.is_active) { + increment_queue_count(dqm, q->properties.type); - increment_queue_count(dqm, qpd, q); execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); @@ -1558,11 +1558,15 @@ list_del(&q->list); qpd->queue_count--; if (q->properties.is_active) { + decrement_queue_count(dqm, q->properties.type); - decrement_queue_count(dqm, qpd, q); retval = execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); if (retval == -ETIME) qpd->reset_wavefronts = true; + if (q->properties.is_gws) { + dqm->gws_queue_count--; + qpd->mapped_gws_queue = false; + } } /* @@ -1753,7 +1757,7 @@ /* Clean all kernel queues */ list_for_each_entry_safe(kq, kq_next, &qpd->priv_queue_list, list) { list_del(&kq->list); + decrement_queue_count(dqm, kq->queue->properties.type); - decrement_queue_count(dqm, qpd, kq->queue); qpd->is_debug = false; dqm->total_queue_count--; filter = KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES; @@ -1766,8 +1770,13 @@ else if (q->properties.type == KFD_QUEUE_TYPE_SDMA_XGMI) deallocate_sdma_queue(dqm, q); + if (q->properties.is_active) { + decrement_queue_count(dqm, q->properties.type); + if (q->properties.is_gws) { + dqm->gws_queue_count--; + qpd->mapped_gws_queue = false; + } + } - if (q->properties.is_active) - decrement_queue_count(dqm, qpd, q); dqm->total_queue_count--; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/amdkfd/kfd_events.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/amdkfd/kfd_events.c @@ -531,8 +531,6 @@ event_waiters = kmalloc_array(num_events, sizeof(struct kfd_event_waiter), GFP_KERNEL); - if (!event_waiters) - return NULL; for (i = 0; (event_waiters) && (i < num_events) ; i++) { init_wait(&event_waiters[i].wait); diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2693,8 +2693,7 @@ * this is the case when traversing through already created * MST connectors, should be skipped */ - if (aconnector->dc_link && - aconnector->dc_link->type == dc_connection_mst_branch) + if (aconnector->mst_port) continue; mutex_lock(&aconnector->hpd_lock); diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -4634,7 +4634,7 @@ &dpcd_pattern_type.value, sizeof(dpcd_pattern_type)); - channel_count = min(dpcd_test_mode.bits.channel_count + 1, AUDIO_CHANNELS_COUNT); + channel_count = dpcd_test_mode.bits.channel_count + 1; // read pattern periods for requested channels when sawTooth pattern is requested if (dpcd_pattern_type.value == AUDIO_TEST_PATTERN_SAWTOOTH || diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_resource.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_resource.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1667,8 +1667,8 @@ if (old_stream->ignore_msa_timing_param != stream->ignore_msa_timing_param) return false; - /*compare audio info*/ - if (memcmp(&old_stream->audio_info, &stream->audio_info, sizeof(stream->audio_info)) != 0) + // Only Have Audio left to check whether it is same or not. This is a corner case for Tiled sinks + if (old_stream->audio_info.mode_count != stream->audio_info.mode_count) return false; return true; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c @@ -940,7 +940,6 @@ .program_watermarks = hubbub1_program_watermarks, .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, .allow_self_refresh_control = hubbub1_allow_self_refresh_control, - .verify_allow_pstate_change_high = hubbub1_verify_allow_pstate_change_high, }; void hubbub1_construct(struct hubbub *hubbub, diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -1112,13 +1112,9 @@ void dcn10_verify_allow_pstate_change_high(struct dc *dc) { - struct hubbub *hubbub = dc->res_pool->hubbub; static bool should_log_hw_state; /* prevent hw state log by default */ - if (!hubbub->funcs->verify_allow_pstate_change_high) - return; - - if (!hubbub->funcs->verify_allow_pstate_change_high(hubbub)) { + if (!hubbub1_verify_allow_pstate_change_high(dc->res_pool->hubbub)) { int i = 0; if (should_log_hw_state) @@ -1127,8 +1123,8 @@ TRACE_DC_PIPE_STATE(pipe_ctx, i, MAX_PIPES); BREAK_TO_DEBUGGER(); if (dcn10_hw_wa_force_recovery(dc)) { - /*check again*/ - if (!hubbub->funcs->verify_allow_pstate_change_high(hubbub)) + /*check again*/ + if (!hubbub1_verify_allow_pstate_change_high(dc->res_pool->hubbub)) BREAK_TO_DEBUGGER(); } } @@ -1501,9 +1497,6 @@ if (dc->config.power_down_display_on_boot) dc_link_blank_all_dp_displays(dc); - if (hws->funcs.enable_power_gating_plane) - hws->funcs.enable_power_gating_plane(dc->hwseq, true); - /* If taking control over from VBIOS, we may want to optimize our first * mode set, so we need to skip powering down pipes until we know which * pipes we want to use. @@ -1556,6 +1549,8 @@ REG_UPDATE(DCFCLK_CNTL, DCFCLK_GATE_DIS, 0); } + if (hws->funcs.enable_power_gating_plane) + hws->funcs.enable_power_gating_plane(dc->hwseq, true); if (dc->clk_mgr->funcs->notify_wm_ranges) dc->clk_mgr->funcs->notify_wm_ranges(dc->clk_mgr); @@ -2520,17 +2515,13 @@ struct mpc *mpc = dc->res_pool->mpc; struct mpc_tree *mpc_tree_params = &(pipe_ctx->stream_res.opp->mpc_tree_params); - blnd_cfg.overlap_only = false; - blnd_cfg.global_gain = 0xff; - - if (per_pixel_alpha && pipe_ctx->plane_state->global_alpha) { - blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN; - blnd_cfg.global_gain = pipe_ctx->plane_state->global_alpha_value; - } else if (per_pixel_alpha) { + if (per_pixel_alpha) blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA; - } else { + else blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA; - } + + blnd_cfg.overlap_only = false; + blnd_cfg.global_gain = 0xff; if (pipe_ctx->plane_state->global_alpha) blnd_cfg.global_alpha = pipe_ctx->plane_state->global_alpha_value; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c @@ -2313,18 +2313,14 @@ struct mpc *mpc = dc->res_pool->mpc; struct mpc_tree *mpc_tree_params = &(pipe_ctx->stream_res.opp->mpc_tree_params); + if (per_pixel_alpha) + blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA; + else + blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA; + blnd_cfg.overlap_only = false; blnd_cfg.global_gain = 0xff; - if (per_pixel_alpha && pipe_ctx->plane_state->global_alpha) { - blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN; - blnd_cfg.global_gain = pipe_ctx->plane_state->global_alpha_value; - } else if (per_pixel_alpha) { - blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA; - } else { - blnd_cfg.alpha_mode = MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA; - } - if (pipe_ctx->plane_state->global_alpha) blnd_cfg.global_alpha = pipe_ctx->plane_state->global_alpha_value; else diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c @@ -1427,7 +1427,6 @@ return &clk_src->base; } - kfree(clk_src); BREAK_TO_DEBUGGER(); return NULL; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.c @@ -448,7 +448,6 @@ .program_watermarks = hubbub3_program_watermarks, .allow_self_refresh_control = hubbub1_allow_self_refresh_control, .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, - .verify_allow_pstate_change_high = hubbub1_verify_allow_pstate_change_high, .force_wm_propagate_to_pipes = hubbub3_force_wm_propagate_to_pipes, .force_pstate_change_control = hubbub3_force_pstate_change_control, .init_watermarks = hubbub3_init_watermarks, reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c @@ -548,9 +548,6 @@ if (dc->config.power_down_display_on_boot) dc_link_blank_all_dp_displays(dc); - if (hws->funcs.enable_power_gating_plane) - hws->funcs.enable_power_gating_plane(dc->hwseq, true); - /* If taking control over from VBIOS, we may want to optimize our first * mode set, so we need to skip powering down pipes until we know which * pipes we want to use. @@ -628,6 +625,8 @@ REG_UPDATE(DCFCLK_CNTL, DCFCLK_GATE_DIS, 0); } + if (hws->funcs.enable_power_gating_plane) + hws->funcs.enable_power_gating_plane(dc->hwseq, true); if (!dcb->funcs->is_accelerated_mode(dcb) && dc->res_pool->hubbub->funcs->init_watermarks) dc->res_pool->hubbub->funcs->init_watermarks(dc->res_pool->hubbub); reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_hubbub.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_hubbub.c @@ -60,7 +60,6 @@ .program_watermarks = hubbub3_program_watermarks, .allow_self_refresh_control = hubbub1_allow_self_refresh_control, .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, - .verify_allow_pstate_change_high = hubbub1_verify_allow_pstate_change_high, .force_wm_propagate_to_pipes = hubbub3_force_wm_propagate_to_pipes, .force_pstate_change_control = hubbub3_force_pstate_change_control, .hubbub_read_state = hubbub2_read_state, reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c @@ -949,65 +949,6 @@ } } -static bool hubbub31_verify_allow_pstate_change_high(struct hubbub *hubbub) -{ - struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub); - - /* - * Pstate latency is ~20us so if we wait over 40us and pstate allow - * still not asserted, we are probably stuck and going to hang - */ - const unsigned int pstate_wait_timeout_us = 100; - const unsigned int pstate_wait_expected_timeout_us = 40; - - static unsigned int max_sampled_pstate_wait_us; /* data collection */ - static bool forced_pstate_allow; /* help with revert wa */ - - unsigned int debug_data = 0; - unsigned int i; - - if (forced_pstate_allow) { - /* we hacked to force pstate allow to prevent hang last time - * we verify_allow_pstate_change_high. so disable force - * here so we can check status - */ - REG_UPDATE_2(DCHUBBUB_ARB_DRAM_STATE_CNTL, - DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_VALUE, 0, - DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_ENABLE, 0); - forced_pstate_allow = false; - } - - REG_WRITE(DCHUBBUB_TEST_DEBUG_INDEX, hubbub2->debug_test_index_pstate); - - for (i = 0; i < pstate_wait_timeout_us; i++) { - debug_data = REG_READ(DCHUBBUB_TEST_DEBUG_DATA); - - /* Debug bit is specific to ASIC. */ - if (debug_data & (1 << 26)) { - if (i > pstate_wait_expected_timeout_us) - DC_LOG_WARNING("pstate took longer than expected ~%dus\n", i); - return true; - } - if (max_sampled_pstate_wait_us < i) - max_sampled_pstate_wait_us = i; - - udelay(1); - } - - /* force pstate allow to prevent system hang - * and break to debugger to investigate - */ - REG_UPDATE_2(DCHUBBUB_ARB_DRAM_STATE_CNTL, - DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_VALUE, 1, - DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_ENABLE, 1); - forced_pstate_allow = true; - - DC_LOG_WARNING("pstate TEST_DEBUG_DATA: 0x%X\n", - debug_data); - - return false; -} - static const struct hubbub_funcs hubbub31_funcs = { .update_dchub = hubbub2_update_dchub, .init_dchub_sys_ctx = hubbub31_init_dchub_sys_ctx, @@ -1020,7 +961,6 @@ .program_watermarks = hubbub31_program_watermarks, .allow_self_refresh_control = hubbub1_allow_self_refresh_control, .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, - .verify_allow_pstate_change_high = hubbub31_verify_allow_pstate_change_high, .program_det_size = dcn31_program_det_size, .program_compbuf_size = dcn31_program_compbuf_size, .init_crb = dcn31_init_crb, @@ -1042,7 +982,5 @@ hubbub31->detile_buf_size = det_size_kb * 1024; hubbub31->pixel_chunk_size = pixel_chunk_size_kb * 1024; hubbub31->crb_size_segs = config_return_buffer_size_kb / DCN31_CRB_SEGMENT_SIZE_KB; - - hubbub31->debug_test_index_pstate = 0x6; } diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c @@ -200,9 +200,6 @@ if (dc->config.power_down_display_on_boot) dc_link_blank_all_dp_displays(dc); - if (hws->funcs.enable_power_gating_plane) - hws->funcs.enable_power_gating_plane(dc->hwseq, true); - /* If taking control over from VBIOS, we may want to optimize our first * mode set, so we need to skip powering down pipes until we know which * pipes we want to use. @@ -252,6 +249,8 @@ REG_UPDATE(DCFCLK_CNTL, DCFCLK_GATE_DIS, 0); } + if (hws->funcs.enable_power_gating_plane) + hws->funcs.enable_power_gating_plane(dc->hwseq, true); if (!dcb->funcs->is_accelerated_mode(dcb) && dc->res_pool->hubbub->funcs->init_watermarks) dc->res_pool->hubbub->funcs->init_watermarks(dc->res_pool->hubbub); diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -1011,7 +1011,7 @@ .max_downscale_src_width = 4096,/*upto true 4K*/ .disable_pplib_wm_range = false, .scl_reset_length10 = true, - .sanity_checks = true, + .sanity_checks = false, .underflow_assert_delay_us = 0xFFFFFFFF, .dwb_fi_phase = -1, // -1 = disable, .dmub_command_table = true, reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c @@ -864,11 +864,11 @@ min_slices_h = inc_num_slices(dsc_common_caps.slice_caps, min_slices_h); } - is_dsc_possible = (min_slices_h <= max_slices_h); - if (pic_width % min_slices_h != 0) min_slices_h = 0; // DSC TODO: Maybe try increasing the number of slices first? + is_dsc_possible = (min_slices_h <= max_slices_h); + if (min_slices_h == 0 && max_slices_h == 0) is_dsc_possible = false; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h @@ -154,8 +154,6 @@ bool (*is_allow_self_refresh_enabled)(struct hubbub *hubbub); void (*allow_self_refresh_control)(struct hubbub *hubbub, bool allow); - bool (*verify_allow_pstate_change_high)(struct hubbub *hubbub); - void (*apply_DEDCN21_147_wa)(struct hubbub *hubbub); void (*force_wm_propagate_to_pipes)(struct hubbub *hubbub); reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c @@ -100,8 +100,7 @@ //PB7 = MD0 #define MASK_VTEM_MD0__VRR_EN 0x01 #define MASK_VTEM_MD0__M_CONST 0x02 +#define MASK_VTEM_MD0__RESERVED2 0x0C -#define MASK_VTEM_MD0__QMS_EN 0x04 -#define MASK_VTEM_MD0__RESERVED2 0x08 #define MASK_VTEM_MD0__FVA_FACTOR_M1 0xF0 //MD1 @@ -110,7 +109,7 @@ //MD2 #define MASK_VTEM_MD2__BASE_REFRESH_RATE_98 0x03 #define MASK_VTEM_MD2__RB 0x04 +#define MASK_VTEM_MD2__RESERVED3 0xF8 -#define MASK_VTEM_MD2__NEXT_TFR 0xF8 //MD3 #define MASK_VTEM_MD3__BASE_REFRESH_RATE_07 0xFF reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -97,14 +97,6 @@ #define INTEL_EDP_BRIGHTNESS_OPTIMIZATION_1 0x359 -enum intel_dp_aux_backlight_modparam { - INTEL_DP_AUX_BACKLIGHT_AUTO = -1, - INTEL_DP_AUX_BACKLIGHT_OFF = 0, - INTEL_DP_AUX_BACKLIGHT_ON = 1, - INTEL_DP_AUX_BACKLIGHT_FORCE_VESA = 2, - INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL = 3, -}; - /* Intel EDP backlight callbacks */ static bool intel_dp_aux_supports_hdr_backlight(struct intel_connector *connector) @@ -134,24 +126,6 @@ return false; } - /* - * If we don't have HDR static metadata there is no way to - * runtime detect used range for nits based control. For now - * do not use Intel proprietary eDP backlight control if we - * don't have this data in panel EDID. In case we find panel - * which supports only nits based control, but doesn't provide - * HDR static metadata we need to start maintaining table of - * ranges for such panels. - */ - if (i915->params.enable_dpcd_backlight != INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL && - !(connector->base.hdr_sink_metadata.hdmi_type1.metadata_type & - BIT(HDMI_STATIC_METADATA_TYPE1))) { - drm_info(&i915->drm, - "Panel is missing HDR static metadata. Possible support for Intel HDR backlight interface is not used. If your backlight controls don't work try booting with i915.enable_dpcd_backlight=%d. needs this, please file a _new_ bug report on drm/i915, see " FDO_BUG_URL " for details.\n", - INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL); - return false; - } - panel->backlight.edp.intel.sdr_uses_aux = tcon_cap[2] & INTEL_EDP_SDR_TCON_BRIGHTNESS_AUX_CAP; @@ -439,6 +413,14 @@ .get = intel_dp_aux_vesa_get_backlight, }; +enum intel_dp_aux_backlight_modparam { + INTEL_DP_AUX_BACKLIGHT_AUTO = -1, + INTEL_DP_AUX_BACKLIGHT_OFF = 0, + INTEL_DP_AUX_BACKLIGHT_ON = 1, + INTEL_DP_AUX_BACKLIGHT_FORCE_VESA = 2, + INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL = 3, +}; + int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) { struct drm_device *dev = connector->base.dev; diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/display/intel_psr.c linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/display/intel_psr.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/display/intel_psr.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/display/intel_psr.c @@ -887,20 +887,6 @@ return false; } - /* Wa_16011303918:adl-p */ - if (crtc_state->vrr.enable && - IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) { - drm_dbg_kms(&dev_priv->drm, - "PSR2 not enabled, not compatible with HW stepping + VRR\n"); - return false; - } - - if (!_compute_psr2_sdp_prior_scanline_indication(intel_dp, crtc_state)) { - drm_dbg_kms(&dev_priv->drm, - "PSR2 not enabled, PSR2 SDP indication do not fit in hblank\n"); - return false; - } - if (HAS_PSR2_SEL_FETCH(dev_priv)) { if (!intel_psr2_sel_fetch_config_valid(intel_dp, crtc_state) && !HAS_PSR_HW_TRACKING(dev_priv)) { @@ -914,12 +900,12 @@ if (!crtc_state->enable_psr2_sel_fetch && IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_C0)) { drm_dbg_kms(&dev_priv->drm, "PSR2 HW tracking is not supported this Display stepping\n"); - goto unsupported; + return false; } if (!psr2_granularity_check(intel_dp, crtc_state)) { drm_dbg_kms(&dev_priv->drm, "PSR2 not enabled, SU granularity not compatible\n"); - goto unsupported; + return false; } if (!crtc_state->enable_psr2_sel_fetch && @@ -928,15 +914,25 @@ "PSR2 not enabled, resolution %dx%d > max supported %dx%d\n", crtc_hdisplay, crtc_vdisplay, psr_max_h, psr_max_v); - goto unsupported; + return false; + } + + if (!_compute_psr2_sdp_prior_scanline_indication(intel_dp, crtc_state)) { + drm_dbg_kms(&dev_priv->drm, + "PSR2 not enabled, PSR2 SDP indication do not fit in hblank\n"); + return false; + } + + /* Wa_16011303918:adl-p */ + if (crtc_state->vrr.enable && + IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0)) { + drm_dbg_kms(&dev_priv->drm, + "PSR2 not enabled, not compatible with HW stepping + VRR\n"); + return false; } tgl_dc3co_exitline_compute_config(intel_dp, crtc_state); return true; - -unsupported: - crtc_state->enable_psr2_sel_fetch = false; - return false; } void intel_psr_compute_config(struct intel_dp *intel_dp, diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/gem/i915_gem_mman.c @@ -67,7 +67,7 @@ * mmap ioctl is disallowed for all discrete platforms, * and for all platforms with GRAPHICS_VER > 12. */ - if (IS_DGFX(i915) || GRAPHICS_VER_FULL(i915) > IP_VER(12, 0)) + if (IS_DGFX(i915) || GRAPHICS_VER(i915) > 12) return -EOPNOTSUPP; if (args->flags & ~(I915_MMAP_WC)) reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/i915/i915_reg.h +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/i915/i915_reg.h @@ -7578,7 +7578,7 @@ #define _SEL_FETCH_PLANE_BASE_6_A 0x70940 #define _SEL_FETCH_PLANE_BASE_7_A 0x70960 #define _SEL_FETCH_PLANE_BASE_CUR_A 0x70880 +#define _SEL_FETCH_PLANE_BASE_1_B 0x70990 -#define _SEL_FETCH_PLANE_BASE_1_B 0x71890 #define _SEL_FETCH_PLANE_BASE_A(plane) _PICK(plane, \ _SEL_FETCH_PLANE_BASE_1_A, \ diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1714,7 +1714,7 @@ return ERR_CAST(mmu); return msm_gem_address_space_create(mmu, - "gpu", 0x100000000ULL, SZ_4G); + "gpu", 0x100000000ULL, 0x1ffffffffULL); } static uint32_t a6xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring) reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/adreno/adreno_device.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -601,20 +601,29 @@ }; #ifdef CONFIG_PM +static int adreno_resume(struct device *dev) -static int adreno_runtime_resume(struct device *dev) { struct msm_gpu *gpu = dev_to_gpu(dev); return gpu->funcs->pm_resume(gpu); } +static int active_submits(struct msm_gpu *gpu) +{ + int active_submits; + mutex_lock(&gpu->active_lock); + active_submits = gpu->active_submits; + mutex_unlock(&gpu->active_lock); + return active_submits; +} + +static int adreno_suspend(struct device *dev) -static int adreno_runtime_suspend(struct device *dev) { struct msm_gpu *gpu = dev_to_gpu(dev); int remaining; remaining = wait_event_timeout(gpu->retire_event, + active_submits(gpu) == 0, - gpu->active_submits == 0, msecs_to_jiffies(1000)); if (remaining == 0) { dev_err(dev, "Timeout waiting for GPU to suspend\n"); @@ -627,7 +636,7 @@ static const struct dev_pm_ops adreno_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(adreno_suspend, adreno_resume, NULL) - SET_RUNTIME_PM_OPS(adreno_runtime_suspend, adreno_runtime_resume, NULL) }; static struct platform_driver adreno_driver = { reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -90,10 +90,7 @@ __drm_atomic_helper_plane_destroy_state(plane->state); kfree(to_mdp5_plane_state(plane->state)); - plane->state = NULL; mdp5_state = kzalloc(sizeof(*mdp5_state), GFP_KERNEL); - if (!mdp5_state) - return; if (plane->type == DRM_PLANE_TYPE_PRIMARY) mdp5_state->base.zpos = STAGE_BASE; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -176,8 +176,6 @@ va_list va; new_blk = kzalloc(sizeof(struct msm_disp_state_block), GFP_KERNEL); - if (!new_blk) - return; va_start(va, fmt); diff -u linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/dp/dp_panel.c linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/dp/dp_panel.c --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/dp/dp_panel.c +++ linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/dp/dp_panel.c @@ -206,6 +206,17 @@ rc = -ETIMEDOUT; goto end; } + + /* fail safe edid */ + mutex_lock(&connector->dev->mode_config.mutex); + if (drm_add_modes_noedid(connector, 640, 480)) + drm_set_preferred_mode(connector, 640, 480); + mutex_unlock(&connector->dev->mode_config.mutex); + } else { + /* always add fail-safe mode as backup mode */ + mutex_lock(&connector->dev->mode_config.mutex); + drm_add_modes_noedid(connector, 640, 480); + mutex_unlock(&connector->dev->mode_config.mutex); } if (panel->aux_cfg_update_done) { reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -641,7 +641,7 @@ return connector; fail: + connector->funcs->destroy(msm_dsi->connector); - connector->funcs->destroy(connector); return ERR_PTR(ret); } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/msm/msm_gem.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/msm/msm_gem.c @@ -926,7 +926,6 @@ get_pid_task(aspace->pid, PIDTYPE_PID); if (task) { comm = kstrdup(task->comm, GFP_KERNEL); - put_task_struct(task); } else { comm = NULL; } reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c @@ -229,7 +229,7 @@ ret = i2c_smbus_write_byte_data(ts->i2c, reg, val); if (ret) + dev_err(&ts->dsi->dev, "I2C write failed: %d\n", ret); - dev_err(&ts->i2c->dev, "I2C write failed: %d\n", ret); } static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val) @@ -265,7 +265,7 @@ return 0; } +static int rpi_touchscreen_enable(struct drm_panel *panel) -static int rpi_touchscreen_prepare(struct drm_panel *panel) { struct rpi_touchscreen *ts = panel_to_ts(panel); int i; @@ -295,13 +295,6 @@ rpi_touchscreen_write(ts, DSI_STARTDSI, 0x01); msleep(100); - return 0; -} - -static int rpi_touchscreen_enable(struct drm_panel *panel) -{ - struct rpi_touchscreen *ts = panel_to_ts(panel); - /* Turn on the backlight. */ rpi_touchscreen_i2c_write(ts, REG_PWM, 255); @@ -356,7 +349,7 @@ static const struct drm_panel_funcs rpi_touchscreen_funcs = { .disable = rpi_touchscreen_disable, .unprepare = rpi_touchscreen_noop, + .prepare = rpi_touchscreen_noop, - .prepare = rpi_touchscreen_prepare, .enable = rpi_touchscreen_enable, .get_modes = rpi_touchscreen_get_modes, }; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/radeon/radeon_sync.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/radeon/radeon_sync.c @@ -96,7 +96,7 @@ struct dma_fence *f; int r = 0; + dma_resv_for_each_fence(&cursor, resv, shared, f) { - dma_resv_for_each_fence(&cursor, resv, !shared, f) { fence = to_radeon_fence(f); if (fence && fence->rdev == rdev) radeon_sync_fence(sync, fence); reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -222,11 +222,13 @@ /* Set the physical address of the buffer in memory */ paddr = drm_fb_cma_get_gem_addr(fb, state, 0); + paddr -= PHYS_OFFSET; DRM_DEBUG_DRIVER("Setting buffer #0 address to %pad\n", &paddr); regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR0_REG, paddr); if (fb->format->num_planes > 1) { paddr = drm_fb_cma_get_gem_addr(fb, state, swap ? 2 : 1); + paddr -= PHYS_OFFSET; DRM_DEBUG_DRIVER("Setting buffer #1 address to %pad\n", &paddr); regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR1_REG, paddr); @@ -234,6 +236,7 @@ if (fb->format->num_planes > 2) { paddr = drm_fb_cma_get_gem_addr(fb, state, swap ? 1 : 2); + paddr -= PHYS_OFFSET; DRM_DEBUG_DRIVER("Setting buffer #2 address to %pad\n", &paddr); regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR2_REG, paddr); reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/vc4/vc4_dsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/vc4/vc4_dsi.c @@ -846,7 +846,7 @@ unsigned long phy_clock; int ret; + ret = pm_runtime_get_sync(dev); - ret = pm_runtime_resume_and_get(dev); if (ret) { DRM_ERROR("Failed to runtime PM enable on DSI%d\n", dsi->variant->port); return; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -46,21 +46,6 @@ return container_of(bo, struct vmw_buffer_object, base); } -/** - * bo_is_vmw - check if the buffer object is a &vmw_buffer_object - * @bo: ttm buffer object to be checked - * - * Uses destroy function associated with the object to determine if this is - * a &vmw_buffer_object. - * - * Returns: - * true if the object is of &vmw_buffer_object type, false if not. - */ -static bool bo_is_vmw(struct ttm_buffer_object *bo) -{ - return bo->destroy == &vmw_bo_bo_free || - bo->destroy == &vmw_gem_destroy; -} /** * vmw_bo_pin_in_placement - Validate a buffer to placement. @@ -630,9 +615,8 @@ ret = vmw_user_bo_synccpu_grab(vbo, arg->flags); vmw_bo_unreference(&vbo); + if (unlikely(ret != 0 && ret != -ERESTARTSYS && + ret != -EBUSY)) { - if (unlikely(ret != 0)) { - if (ret == -ERESTARTSYS || ret == -EBUSY) - return -EBUSY; DRM_ERROR("Failed synccpu grab on handle 0x%08x.\n", (unsigned int) arg->handle); return ret; @@ -814,7 +798,7 @@ void vmw_bo_swap_notify(struct ttm_buffer_object *bo) { /* Is @bo embedded in a struct vmw_buffer_object? */ + if (vmw_bo_is_vmw_bo(bo)) - if (!bo_is_vmw(bo)) return; /* Kill any cached kernel maps before swapout */ @@ -838,7 +822,7 @@ struct vmw_buffer_object *vbo; /* Make sure @bo is embedded in a struct vmw_buffer_object? */ + if (vmw_bo_is_vmw_bo(bo)) - if (!bo_is_vmw(bo)) return; vbo = container_of(bo, struct vmw_buffer_object, base); @@ -859,3 +843,22 @@ if (mem->mem_type != VMW_PL_MOB && bo->resource->mem_type == VMW_PL_MOB) vmw_resource_unbind_list(vbo); } + +/** + * vmw_bo_is_vmw_bo - check if the buffer object is a &vmw_buffer_object + * @bo: buffer object to be checked + * + * Uses destroy function associated with the object to determine if this is + * a &vmw_buffer_object. + * + * Returns: + * true if the object is of &vmw_buffer_object type, false if not. + */ +bool vmw_bo_is_vmw_bo(struct ttm_buffer_object *bo) +{ + if (bo->destroy == &vmw_bo_bo_free || + bo->destroy == &vmw_gem_destroy) + return true; + + return false; +} reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -997,10 +997,13 @@ goto out_no_fman; } + drm_vma_offset_manager_init(&dev_priv->vma_manager, + DRM_FILE_PAGE_OFFSET_START, + DRM_FILE_PAGE_OFFSET_SIZE); ret = ttm_device_init(&dev_priv->bdev, &vmw_bo_driver, dev_priv->drm.dev, dev_priv->drm.anon_inode->i_mapping, + &dev_priv->vma_manager, - dev_priv->drm.vma_offset_manager, dev_priv->map_mode == vmw_dma_alloc_coherent, false); if (unlikely(ret != 0)) { @@ -1170,6 +1173,7 @@ vmw_devcaps_destroy(dev_priv); vmw_vram_manager_fini(dev_priv); ttm_device_fini(&dev_priv->bdev); + drm_vma_offset_manager_destroy(&dev_priv->vma_manager); vmw_release_device_late(dev_priv); vmw_fence_manager_takedown(dev_priv->fman); if (dev_priv->capabilities & SVGA_CAP_IRQMASK) @@ -1393,7 +1397,7 @@ struct vmw_private *dev_priv = vmw_priv(file_priv->minor->dev); return drm_get_unmapped_area(file, uaddr, len, pgoff, flags, + &dev_priv->vma_manager); - dev_priv->drm.vma_offset_manager); } static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -683,9 +683,6 @@ container_of(base, struct vmw_user_surface, prime.base); struct vmw_resource *res = &user_srf->srf.res; - if (base->shareable && res && res->backup) - drm_gem_object_put(&res->backup->base.base); - *p_base = NULL; vmw_resource_unreference(&res); } @@ -860,7 +857,6 @@ goto out_unlock; } vmw_bo_reference(res->backup); - drm_gem_object_get(&res->backup->base.base); } tmp = vmw_resource_reference(&srf->res); @@ -1517,6 +1513,7 @@ &res->backup); if (ret == 0) vmw_bo_reference(res->backup); + } if (unlikely(ret != 0)) { @@ -1564,8 +1561,6 @@ drm_vma_node_offset_addr(&res->backup->base.base.vma_node); rep->buffer_size = res->backup->base.base.size; rep->buffer_handle = backup_handle; - if (user_srf->prime.base.shareable) - drm_gem_object_get(&res->backup->base.base); } else { rep->buffer_map_handle = 0; rep->buffer_size = 0; reverted: --- linux-oem-5.17-5.17.0/drivers/gpu/ipu-v3/ipu-di.c +++ linux-oem-5.17-5.17.0.orig/drivers/gpu/ipu-v3/ipu-di.c @@ -447,9 +447,8 @@ error = rate / (sig->mode.pixelclock / 1000); + dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", + rate, div, (signed)(error - 1000) / 10, error % 10); - dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n", - rate, div, error < 1000 ? '-' : '+', - abs(error - 1000) / 10, abs(error - 1000) % 10); /* Allow a 1% error */ if (error < 1010 && error >= 990) { diff -u linux-oem-5.17-5.17.0/drivers/hv/hv_balloon.c linux-oem-5.17-5.17.0/drivers/hv/hv_balloon.c --- linux-oem-5.17-5.17.0/drivers/hv/hv_balloon.c +++ linux-oem-5.17-5.17.0/drivers/hv/hv_balloon.c @@ -1653,38 +1653,6 @@ } } -static int ballooning_enabled(void) -{ - /* - * Disable ballooning if the page size is not 4k (HV_HYP_PAGE_SIZE), - * since currently it's unclear to us whether an unballoon request can - * make sure all page ranges are guest page size aligned. - */ - if (PAGE_SIZE != HV_HYP_PAGE_SIZE) { - pr_info("Ballooning disabled because page size is not 4096 bytes\n"); - return 0; - } - - return 1; -} - -static int hot_add_enabled(void) -{ - /* - * Disable hot add on ARM64, because we currently rely on - * memory_add_physaddr_to_nid() to get a node id of a hot add range, - * however ARM64's memory_add_physaddr_to_nid() always return 0 and - * DM_MEM_HOT_ADD_REQUEST doesn't have the NUMA node information for - * add_memory(). - */ - if (IS_ENABLED(CONFIG_ARM64)) { - pr_info("Memory hot add disabled on ARM64\n"); - return 0; - } - - return 1; -} - static int balloon_connect_vsp(struct hv_device *dev) { struct dm_version_request version_req; @@ -1756,8 +1724,8 @@ * currently still requires the bits to be set, so we have to add code * to fail the host's hot-add and balloon up/down requests, if any. */ - cap_msg.caps.cap_bits.balloon = ballooning_enabled(); - cap_msg.caps.cap_bits.hot_add = hot_add_enabled(); + cap_msg.caps.cap_bits.balloon = 1; + cap_msg.caps.cap_bits.hot_add = 1; /* * Specify our alignment requirements as it relates reverted: --- linux-oem-5.17-5.17.0/drivers/hv/hv_common.c +++ linux-oem-5.17-5.17.0.orig/drivers/hv/hv_common.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -217,16 +216,6 @@ } EXPORT_SYMBOL_GPL(hv_query_ext_cap); -void hv_setup_dma_ops(struct device *dev, bool coherent) -{ - /* - * Hyper-V does not offer a vIOMMU in the guest - * VM, so pass 0/NULL for the IOMMU settings - */ - arch_setup_dma_ops(dev, 0, 0, NULL, coherent); -} -EXPORT_SYMBOL_GPL(hv_setup_dma_ops); - bool hv_is_hibernation_supported(void) { return !hv_root_partition && acpi_sleep_state_supported(ACPI_STATE_S4); reverted: --- linux-oem-5.17-5.17.0/drivers/hv/ring_buffer.c +++ linux-oem-5.17-5.17.0.orig/drivers/hv/ring_buffer.c @@ -439,16 +439,7 @@ static u32 hv_pkt_iter_avail(const struct hv_ring_buffer_info *rbi) { u32 priv_read_loc = rbi->priv_read_index; + u32 write_loc = READ_ONCE(rbi->ring_buffer->write_index); - u32 write_loc; - - /* - * The Hyper-V host writes the packet data, then uses - * store_release() to update the write_index. Use load_acquire() - * here to prevent loads of the packet data from being re-ordered - * before the read of the write_index and potentially getting - * stale data. - */ - write_loc = virt_load_acquire(&rbi->ring_buffer->write_index); if (write_loc >= priv_read_loc) return write_loc - priv_read_loc; diff -u linux-oem-5.17-5.17.0/drivers/hv/vmbus_drv.c linux-oem-5.17-5.17.0/drivers/hv/vmbus_drv.c --- linux-oem-5.17-5.17.0/drivers/hv/vmbus_drv.c +++ linux-oem-5.17-5.17.0/drivers/hv/vmbus_drv.c @@ -77,8 +77,8 @@ /* * Hyper-V should be notified only once about a panic. If we will be - * doing hv_kmsg_dump() with kmsg data later, don't do the notification - * here. + * doing hyperv_report_panic_msg() later with kmsg data, don't do + * the notification here. */ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE && hyperv_report_reg()) { @@ -100,8 +100,8 @@ /* * Hyper-V should be notified only once about a panic. If we will be - * doing hv_kmsg_dump() with kmsg data later, don't do the notification - * here. + * doing hyperv_report_panic_msg() later with kmsg data, don't do + * the notification here. */ if (hyperv_report_reg()) hyperv_report_panic(regs, val, true); @@ -921,21 +921,6 @@ } /* - * vmbus_dma_configure -- Configure DMA coherence for VMbus device - */ -static int vmbus_dma_configure(struct device *child_device) -{ - /* - * On ARM64, propagate the DMA coherence setting from the top level - * VMbus ACPI device to the child VMbus device being added here. - * On x86/x64 coherence is assumed and these calls have no effect. - */ - hv_setup_dma_ops(child_device, - device_get_dma_attr(&hv_acpi_dev->dev) == DEV_DMA_COHERENT); - return 0; -} - -/* * vmbus_remove - Remove a vmbus device */ static void vmbus_remove(struct device *child_device) @@ -1055,7 +1040,6 @@ .remove = vmbus_remove, .probe = vmbus_probe, .uevent = vmbus_uevent, - .dma_configure = vmbus_dma_configure, .dev_groups = vmbus_dev_groups, .drv_groups = vmbus_drv_groups, .bus_groups = vmbus_bus_groups, @@ -1562,20 +1546,14 @@ if (ret) goto err_connect; - if (hv_is_isolation_supported()) - sysctl_record_panic_msg = 0; - /* * Only register if the crash MSRs are available */ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) { u64 hyperv_crash_ctl; /* - * Panic message recording (sysctl_record_panic_msg) - * is enabled by default in non-isolated guests and - * disabled by default in isolated guests; the panic - * message recording won't be available in isolated - * guests should the following registration fail. + * Sysctl registration is not fatal, since by default + * reporting is enabled. */ hv_ctl_table_hdr = register_sysctl_table(hv_root_table); if (!hv_ctl_table_hdr) @@ -2451,21 +2429,6 @@ hv_acpi_dev = device; - /* - * Older versions of Hyper-V for ARM64 fail to include the _CCA - * method on the top level VMbus device in the DSDT. But devices - * are hardware coherent in all current Hyper-V use cases, so fix - * up the ACPI device to behave as if _CCA is present and indicates - * hardware coherence. - */ - ACPI_COMPANION_SET(&device->dev, device); - if (IS_ENABLED(CONFIG_ACPI_CCA_REQUIRED) && - device_get_dma_attr(&device->dev) == DEV_DMA_NOT_SUPPORTED) { - pr_info("No ACPI _CCA found; assuming coherent device I/O\n"); - device->flags.cca_seen = true; - device->flags.coherent_dma = true; - } - result = acpi_walk_resources(device->handle, METHOD_NAME__CRS, vmbus_walk_resources, NULL); reverted: --- linux-oem-5.17-5.17.0/drivers/hwmon/adt7470.c +++ linux-oem-5.17-5.17.0.orig/drivers/hwmon/adt7470.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -295,10 +294,11 @@ adt7470_read_temperatures(data); mutex_unlock(&data->lock); + set_current_state(TASK_INTERRUPTIBLE); if (kthread_should_stop()) break; + schedule_timeout(msecs_to_jiffies(data->auto_update_interval)); - schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval)); } return 0; reverted: --- linux-oem-5.17-5.17.0/drivers/hwmon/pmbus/delta-ahe50dc-fan.c +++ linux-oem-5.17-5.17.0.orig/drivers/hwmon/pmbus/delta-ahe50dc-fan.c @@ -14,21 +14,6 @@ #define AHE50DC_PMBUS_READ_TEMP4 0xd0 -static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value) -{ - /* - * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps - * 5% of the time or so) trigger a problematic phenomenon in which the - * fan speeds surge momentarily and at least some (perhaps all?) of the - * system's power outputs experience a glitch. - * - * However, according to Delta it should be OK to simply not send any - * CLEAR_FAULTS commands (the device doesn't seem to be capable of - * reporting any faults anyway), so just blackhole them unconditionally. - */ - return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA; -} - static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg) { /* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */ @@ -83,7 +68,6 @@ PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL, .func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL, - .write_byte = ahe50dc_fan_write_byte, .read_word_data = ahe50dc_fan_read_word_data, }; diff -u linux-oem-5.17-5.17.0/drivers/hwmon/pmbus/pmbus_core.c linux-oem-5.17-5.17.0/drivers/hwmon/pmbus/pmbus_core.c --- linux-oem-5.17-5.17.0/drivers/hwmon/pmbus/pmbus_core.c +++ linux-oem-5.17-5.17.0/drivers/hwmon/pmbus/pmbus_core.c @@ -2326,9 +2326,6 @@ data->has_status_word = true; } - /* Make sure PEC is disabled, will be enabled later if needed */ - client->flags &= ~I2C_CLIENT_PEC; - /* Enable PEC if the controller and bus supports it */ if (!(data->flags & PMBUS_NO_CAPABILITY)) { ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); diff -u linux-oem-5.17-5.17.0/drivers/i2c/busses/i2c-pasemi-core.c linux-oem-5.17-5.17.0/drivers/i2c/busses/i2c-pasemi-core.c --- linux-oem-5.17-5.17.0/drivers/i2c/busses/i2c-pasemi-core.c +++ linux-oem-5.17-5.17.0/drivers/i2c/busses/i2c-pasemi-core.c @@ -137,12 +137,6 @@ TXFIFO_WR(smbus, msg->buf[msg->len-1] | (stop ? MTXFIFO_STOP : 0)); - - if (stop) { - err = pasemi_smb_waitready(smbus); - if (err) - goto reset_out; - } } return 0; reverted: --- linux-oem-5.17-5.17.0/drivers/i2c/i2c-dev.c +++ linux-oem-5.17-5.17.0.orig/drivers/i2c/i2c-dev.c @@ -668,21 +668,16 @@ i2c_dev->dev.class = i2c_dev_class; i2c_dev->dev.parent = &adap->dev; i2c_dev->dev.release = i2cdev_dev_release; + dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr); - - res = dev_set_name(&i2c_dev->dev, "i2c-%d", adap->nr); - if (res) - goto err_put_i2c_dev; res = cdev_device_add(&i2c_dev->cdev, &i2c_dev->dev); + if (res) { + put_i2c_dev(i2c_dev, false); + return res; + } - if (res) - goto err_put_i2c_dev; pr_debug("adapter [%s] registered as minor %d\n", adap->name, adap->nr); return 0; - -err_put_i2c_dev: - put_i2c_dev(i2c_dev, false); - return res; } static int i2cdev_detach_adapter(struct device *dev, void *dummy) reverted: --- linux-oem-5.17-5.17.0/drivers/iio/chemical/scd4x.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/chemical/scd4x.c @@ -471,15 +471,12 @@ ret = scd4x_write_and_fetch(state, CMD_FRC, arg, &val, sizeof(val)); mutex_unlock(&state->lock); - if (ret) - return ret; - if (val == 0xff) { dev_err(dev, "forced calibration has failed"); return -EINVAL; } + return ret ?: len; - return len; } static IIO_DEVICE_ATTR_RW(calibration_auto_enable, 0); reverted: --- linux-oem-5.17-5.17.0/drivers/iio/dac/ad3552r.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/dac/ad3552r.c @@ -656,7 +656,7 @@ { struct reg_addr_pool addr; int ret; + u16 val; - int val; dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset", GPIOD_OUT_LOW); @@ -809,10 +809,10 @@ gain_child = fwnode_get_named_child_node(child, "custom-output-range-config"); + if (IS_ERR(gain_child)) { - if (!gain_child) { dev_err(dev, "mandatory custom-output-range-config property missing\n"); + return PTR_ERR(gain_child); - return -EINVAL; } dac->ch_data[ch].range_override = 1; reverted: --- linux-oem-5.17-5.17.0/drivers/iio/dac/ad5446.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/dac/ad5446.c @@ -178,7 +178,7 @@ switch (m) { case IIO_CHAN_INFO_RAW: + *val = st->cached_val; - *val = st->cached_val >> chan->scan_type.shift; return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: *val = st->vref_mv; reverted: --- linux-oem-5.17-5.17.0/drivers/iio/dac/ad5592r-base.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/dac/ad5592r-base.c @@ -523,7 +523,7 @@ if (!ret) st->channel_modes[reg] = tmp; + fwnode_property_read_u32(child, "adi,off-state", &tmp); - ret = fwnode_property_read_u32(child, "adi,off-state", &tmp); if (!ret) st->channel_offstate[reg] = tmp; } reverted: --- linux-oem-5.17-5.17.0/drivers/iio/filter/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/iio/filter/Kconfig @@ -8,7 +8,6 @@ config ADMV8818 tristate "Analog Devices ADMV8818 High-Pass and Low-Pass Filter" depends on SPI && COMMON_CLK && 64BIT - select REGMAP_SPI help Say yes here to build support for Analog Devices ADMV8818 2 GHz to 18 GHz, Digitally Tunable, High-Pass and Low-Pass Filter. reverted: --- linux-oem-5.17-5.17.0/drivers/iio/imu/bmi160/bmi160_core.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/imu/bmi160/bmi160_core.c @@ -730,7 +730,7 @@ ret = regmap_write(data->regmap, BMI160_REG_CMD, BMI160_CMD_SOFTRESET); if (ret) + return ret; - goto disable_regulator; usleep_range(BMI160_SOFTRESET_USLEEP, BMI160_SOFTRESET_USLEEP + 1); @@ -741,37 +741,29 @@ if (use_spi) { ret = regmap_read(data->regmap, BMI160_REG_DUMMY, &val); if (ret) + return ret; - goto disable_regulator; } ret = regmap_read(data->regmap, BMI160_REG_CHIP_ID, &val); if (ret) { dev_err(dev, "Error reading chip id\n"); + return ret; - goto disable_regulator; } if (val != BMI160_CHIP_ID_VAL) { dev_err(dev, "Wrong chip id, got %x expected %x\n", val, BMI160_CHIP_ID_VAL); + return -ENODEV; - ret = -ENODEV; - goto disable_regulator; } ret = bmi160_set_mode(data, BMI160_ACCEL, true); if (ret) + return ret; - goto disable_regulator; ret = bmi160_set_mode(data, BMI160_GYRO, true); if (ret) + return ret; - goto disable_accel; return 0; - -disable_accel: - bmi160_set_mode(data, BMI160_ACCEL, false); - -disable_regulator: - regulator_bulk_disable(ARRAY_SIZE(data->supplies), data->supplies); - return ret; } static int bmi160_data_rdy_trigger_set_state(struct iio_trigger *trig, reverted: --- linux-oem-5.17-5.17.0/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c @@ -18,15 +18,12 @@ unsigned int mask, val; int ret; + /* setup interface registers */ + ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6, + INV_ICM42600_INTF_CONFIG6_MASK, + INV_ICM42600_INTF_CONFIG6_I3C_EN); + if (ret) + return ret; - /* - * setup interface registers - * This register write to REG_INTF_CONFIG6 enables a spike filter that - * is impacting the line and can prevent the I2C ACK to be seen by the - * controller. So we don't test the return value. - */ - regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6, - INV_ICM42600_INTF_CONFIG6_MASK, - INV_ICM42600_INTF_CONFIG6_I3C_EN); ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4, INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY, 0); reverted: --- linux-oem-5.17-5.17.0/drivers/iio/magnetometer/ak8975.c +++ linux-oem-5.17-5.17.0.orig/drivers/iio/magnetometer/ak8975.c @@ -416,7 +416,6 @@ if (ret) { dev_warn(&data->client->dev, "Failed to enable specified Vid supply\n"); - regulator_disable(data->vdd); return ret; } reverted: --- linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/cm.c +++ linux-oem-5.17-5.17.0.orig/drivers/infiniband/hw/irdma/cm.c @@ -2305,8 +2305,10 @@ return NULL; } +static void irdma_cm_node_free_cb(struct rcu_head *rcu_head) -static void irdma_destroy_connection(struct irdma_cm_node *cm_node) { + struct irdma_cm_node *cm_node = + container_of(rcu_head, struct irdma_cm_node, rcu_head); struct irdma_cm_core *cm_core = cm_node->cm_core; struct irdma_qp *iwqp; struct irdma_cm_info nfo; @@ -2354,6 +2356,7 @@ } cm_core->cm_free_ah(cm_node); + kfree(cm_node); } /** @@ -2381,9 +2384,8 @@ spin_unlock_irqrestore(&cm_core->ht_lock, flags); + /* wait for all list walkers to exit their grace period */ + call_rcu(&cm_node->rcu_head, irdma_cm_node_free_cb); - irdma_destroy_connection(cm_node); - - kfree_rcu(cm_node, rcu_head); } /** @@ -3463,6 +3465,12 @@ } cm_id = iwqp->cm_id; + /* make sure we havent already closed this connection */ + if (!cm_id) { + spin_unlock_irqrestore(&iwqp->lock, flags); + return; + } + original_hw_tcp_state = iwqp->hw_tcp_state; original_ibqp_state = iwqp->ibqp_state; last_ae = iwqp->last_aeq; @@ -3484,11 +3492,11 @@ disconn_status = -ECONNRESET; } + if ((original_hw_tcp_state == IRDMA_TCP_STATE_CLOSED || + original_hw_tcp_state == IRDMA_TCP_STATE_TIME_WAIT || + last_ae == IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE || + last_ae == IRDMA_AE_BAD_CLOSE || + last_ae == IRDMA_AE_LLP_CONNECTION_RESET || iwdev->rf->reset)) { - if (original_hw_tcp_state == IRDMA_TCP_STATE_CLOSED || - original_hw_tcp_state == IRDMA_TCP_STATE_TIME_WAIT || - last_ae == IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE || - last_ae == IRDMA_AE_BAD_CLOSE || - last_ae == IRDMA_AE_LLP_CONNECTION_RESET || iwdev->rf->reset || !cm_id) { issue_close = 1; iwqp->cm_id = NULL; qp->term_flags = 0; diff -u linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/utils.c linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/utils.c --- linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/utils.c +++ linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/utils.c @@ -258,16 +258,18 @@ u32 local_ipaddr[4] = {}; bool ipv4 = true; + real_dev = rdma_vlan_dev_real_dev(netdev); + if (!real_dev) + real_dev = netdev; + + ibdev = ib_device_get_by_netdev(real_dev, RDMA_DRIVER_IRDMA); + if (!ibdev) + return NOTIFY_DONE; + + iwdev = to_iwdev(ibdev); + switch (event) { case NETEVENT_NEIGH_UPDATE: - real_dev = rdma_vlan_dev_real_dev(netdev); - if (!real_dev) - real_dev = netdev; - ibdev = ib_device_get_by_netdev(real_dev, RDMA_DRIVER_IRDMA); - if (!ibdev) - return NOTIFY_DONE; - - iwdev = to_iwdev(ibdev); p = (__be32 *)neigh->primary_key; if (neigh->tbl->family == AF_INET6) { ipv4 = false; @@ -288,12 +290,13 @@ irdma_manage_arp_cache(iwdev->rf, neigh->ha, local_ipaddr, ipv4, IRDMA_ARP_DELETE); - ib_device_put(ibdev); break; default: break; } + ib_device_put(ibdev); + return NOTIFY_DONE; } diff -u linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/verbs.c linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/verbs.c --- linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/verbs.c +++ linux-oem-5.17-5.17.0/drivers/infiniband/hw/irdma/verbs.c @@ -1620,13 +1620,13 @@ if (issue_modify_qp && iwqp->ibqp_state > IB_QPS_RTS) { if (dont_wait) { - if (iwqp->hw_tcp_state) { + if (iwqp->cm_id && iwqp->hw_tcp_state) { spin_lock_irqsave(&iwqp->lock, flags); iwqp->hw_tcp_state = IRDMA_TCP_STATE_CLOSED; iwqp->last_aeq = IRDMA_AE_RESET_SENT; spin_unlock_irqrestore(&iwqp->lock, flags); + irdma_cm_disconn(iwqp); } - irdma_cm_disconn(iwqp); } else { int close_timer_started; reverted: --- linux-oem-5.17-5.17.0/drivers/infiniband/sw/siw/siw_cm.c +++ linux-oem-5.17-5.17.0.orig/drivers/infiniband/sw/siw/siw_cm.c @@ -968,15 +968,14 @@ siw_cep_set_inuse(new_cep); rv = siw_proc_mpareq(new_cep); + siw_cep_set_free(new_cep); + if (rv != -EAGAIN) { siw_cep_put(cep); new_cep->listen_cep = NULL; + if (rv) - if (rv) { - siw_cep_set_free(new_cep); goto error; - } } - siw_cep_set_free(new_cep); } return; reverted: --- linux-oem-5.17-5.17.0/drivers/input/keyboard/cypress-sf.c +++ linux-oem-5.17-5.17.0.orig/drivers/input/keyboard/cypress-sf.c @@ -61,14 +61,6 @@ return IRQ_HANDLED; } -static void cypress_sf_disable_regulators(void *arg) -{ - struct cypress_sf_data *touchkey = arg; - - regulator_bulk_disable(ARRAY_SIZE(touchkey->regulators), - touchkey->regulators); -} - static int cypress_sf_probe(struct i2c_client *client) { struct cypress_sf_data *touchkey; @@ -129,12 +121,6 @@ return error; } - error = devm_add_action_or_reset(&client->dev, - cypress_sf_disable_regulators, - touchkey); - if (error) - return error; - touchkey->input_dev = devm_input_allocate_device(&client->dev); if (!touchkey->input_dev) { dev_err(&client->dev, "Failed to allocate input device\n"); reverted: --- linux-oem-5.17-5.17.0/drivers/input/keyboard/omap4-keypad.c +++ linux-oem-5.17-5.17.0.orig/drivers/input/keyboard/omap4-keypad.c @@ -393,7 +393,7 @@ * revision register. */ error = pm_runtime_get_sync(dev); + if (error) { - if (error < 0) { dev_err(dev, "pm_runtime_get_sync() failed\n"); pm_runtime_put_noidle(dev); return error; reverted: --- linux-oem-5.17-5.17.0/drivers/interconnect/qcom/sc7180.c +++ linux-oem-5.17-5.17.0.orig/drivers/interconnect/qcom/sc7180.c @@ -47,6 +47,7 @@ DEFINE_QNODE(qnm_snoc_gc, SC7180_MASTER_SNOC_GC_MEM_NOC, 1, 8, SC7180_SLAVE_LLCC); DEFINE_QNODE(qnm_snoc_sf, SC7180_MASTER_SNOC_SF_MEM_NOC, 1, 16, SC7180_SLAVE_LLCC); DEFINE_QNODE(qxm_gpu, SC7180_MASTER_GFX3D, 2, 32, SC7180_SLAVE_GEM_NOC_SNOC, SC7180_SLAVE_LLCC); +DEFINE_QNODE(ipa_core_master, SC7180_MASTER_IPA_CORE, 1, 8, SC7180_SLAVE_IPA_CORE); DEFINE_QNODE(llcc_mc, SC7180_MASTER_LLCC, 2, 4, SC7180_SLAVE_EBI1); DEFINE_QNODE(qhm_mnoc_cfg, SC7180_MASTER_CNOC_MNOC_CFG, 1, 4, SC7180_SLAVE_SERVICE_MNOC); DEFINE_QNODE(qxm_camnoc_hf0, SC7180_MASTER_CAMNOC_HF0, 2, 32, SC7180_SLAVE_MNOC_HF_MEM_NOC); @@ -128,6 +129,7 @@ DEFINE_QNODE(qns_gem_noc_snoc, SC7180_SLAVE_GEM_NOC_SNOC, 1, 8, SC7180_MASTER_GEM_NOC_SNOC); DEFINE_QNODE(qns_llcc, SC7180_SLAVE_LLCC, 1, 16, SC7180_MASTER_LLCC); DEFINE_QNODE(srvc_gemnoc, SC7180_SLAVE_SERVICE_GEM_NOC, 1, 4); +DEFINE_QNODE(ipa_core_slave, SC7180_SLAVE_IPA_CORE, 1, 8); DEFINE_QNODE(ebi, SC7180_SLAVE_EBI1, 2, 4); DEFINE_QNODE(qns_mem_noc_hf, SC7180_SLAVE_MNOC_HF_MEM_NOC, 1, 32, SC7180_MASTER_MNOC_HF_MEM_NOC); DEFINE_QNODE(qns_mem_noc_sf, SC7180_SLAVE_MNOC_SF_MEM_NOC, 1, 32, SC7180_MASTER_MNOC_SF_MEM_NOC); @@ -158,6 +160,7 @@ DEFINE_QBCM(bcm_sh0, "SH0", true, &qns_llcc); DEFINE_QBCM(bcm_mm0, "MM0", false, &qns_mem_noc_hf); DEFINE_QBCM(bcm_ce0, "CE0", false, &qxm_crypto); +DEFINE_QBCM(bcm_ip0, "IP0", false, &ipa_core_slave); DEFINE_QBCM(bcm_cn0, "CN0", true, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy0, &qhs_aop, &qhs_aoss, &qhs_boot_rom, &qhs_camera_cfg, &qhs_camera_nrt_throttle_cfg, &qhs_camera_rt_throttle_cfg, &qhs_clk_ctl, &qhs_cpr_cx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_display_rt_throttle_cfg, &qhs_display_throttle_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_mss_cfg, &qhs_npu_cfg, &qhs_npu_dma_throttle_cfg, &qhs_npu_dsp_throttle_cfg, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qm_cfg, &qhs_qm_mpu_cfg, &qhs_qup0, &qhs_qup1, &qhs_security, &qhs_snoc_cfg, &qhs_tcsr, &qhs_tlmm_1, &qhs_tlmm_2, &qhs_tlmm_3, &qhs_ufs_mem_cfg, &qhs_usb3, &qhs_venus_cfg, &qhs_venus_throttle_cfg, &qhs_vsense_ctrl_cfg, &srvc_cnoc); DEFINE_QBCM(bcm_mm1, "MM1", false, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qhm_mnoc_cfg, &qxm_mdp0, &qxm_rot, &qxm_venus0, &qxm_venus_arm9); DEFINE_QBCM(bcm_sh2, "SH2", false, &acm_sys_tcu); @@ -369,6 +372,22 @@ .num_bcms = ARRAY_SIZE(gem_noc_bcms), }; +static struct qcom_icc_bcm *ipa_virt_bcms[] = { + &bcm_ip0, +}; + +static struct qcom_icc_node *ipa_virt_nodes[] = { + [MASTER_IPA_CORE] = &ipa_core_master, + [SLAVE_IPA_CORE] = &ipa_core_slave, +}; + +static struct qcom_icc_desc sc7180_ipa_virt = { + .nodes = ipa_virt_nodes, + .num_nodes = ARRAY_SIZE(ipa_virt_nodes), + .bcms = ipa_virt_bcms, + .num_bcms = ARRAY_SIZE(ipa_virt_bcms), +}; + static struct qcom_icc_bcm *mc_virt_bcms[] = { &bcm_acv, &bcm_mc0, @@ -500,6 +519,8 @@ .data = &sc7180_dc_noc}, { .compatible = "qcom,sc7180-gem-noc", .data = &sc7180_gem_noc}, + { .compatible = "qcom,sc7180-ipa-virt", + .data = &sc7180_ipa_virt}, { .compatible = "qcom,sc7180-mc-virt", .data = &sc7180_mc_virt}, { .compatible = "qcom,sc7180-mmss-noc", reverted: --- linux-oem-5.17-5.17.0/drivers/interconnect/qcom/sdx55.c +++ linux-oem-5.17-5.17.0.orig/drivers/interconnect/qcom/sdx55.c @@ -18,6 +18,7 @@ #include "icc-rpmh.h" #include "sdx55.h" +DEFINE_QNODE(ipa_core_master, SDX55_MASTER_IPA_CORE, 1, 8, SDX55_SLAVE_IPA_CORE); DEFINE_QNODE(llcc_mc, SDX55_MASTER_LLCC, 4, 4, SDX55_SLAVE_EBI_CH0); DEFINE_QNODE(acm_tcu, SDX55_MASTER_TCU_0, 1, 8, SDX55_SLAVE_LLCC, SDX55_SLAVE_MEM_NOC_SNOC, SDX55_SLAVE_MEM_NOC_PCIE_SNOC); DEFINE_QNODE(qnm_snoc_gc, SDX55_MASTER_SNOC_GC_MEM_NOC, 1, 8, SDX55_SLAVE_LLCC); @@ -39,6 +40,7 @@ DEFINE_QNODE(xm_qdss_etr, SDX55_MASTER_QDSS_ETR, 1, 8, SDX55_SLAVE_SNOC_CFG, SDX55_SLAVE_EMAC_CFG, SDX55_SLAVE_USB3, SDX55_SLAVE_AOSS, SDX55_SLAVE_SPMI_FETCHER, SDX55_SLAVE_QDSS_CFG, SDX55_SLAVE_PDM, SDX55_SLAVE_SNOC_MEM_NOC_GC, SDX55_SLAVE_TCSR, SDX55_SLAVE_CNOC_DDRSS, SDX55_SLAVE_SPMI_VGI_COEX, SDX55_SLAVE_QPIC, SDX55_SLAVE_OCIMEM, SDX55_SLAVE_IPA_CFG, SDX55_SLAVE_USB3_PHY_CFG, SDX55_SLAVE_AOP, SDX55_SLAVE_BLSP_1, SDX55_SLAVE_SDCC_1, SDX55_SLAVE_CNOC_MSS, SDX55_SLAVE_PCIE_PARF, SDX55_SLAVE_ECC_CFG, SDX55_SLAVE_AUDIO, SDX55_SLAVE_AOSS, SDX55_SLAVE_PRNG, SDX55_SLAVE_CRYPTO_0_CFG, SDX55_SLAVE_TCU, SDX55_SLAVE_CLK_CTL, SDX55_SLAVE_IMEM_CFG); DEFINE_QNODE(xm_sdc1, SDX55_MASTER_SDCC_1, 1, 8, SDX55_SLAVE_AOSS, SDX55_SLAVE_IPA_CFG, SDX55_SLAVE_ANOC_SNOC, SDX55_SLAVE_AOP, SDX55_SLAVE_AUDIO); DEFINE_QNODE(xm_usb3, SDX55_MASTER_USB3, 1, 8, SDX55_SLAVE_ANOC_SNOC); +DEFINE_QNODE(ipa_core_slave, SDX55_SLAVE_IPA_CORE, 1, 8); DEFINE_QNODE(ebi, SDX55_SLAVE_EBI_CH0, 1, 4); DEFINE_QNODE(qns_llcc, SDX55_SLAVE_LLCC, 1, 16, SDX55_SLAVE_EBI_CH0); DEFINE_QNODE(qns_memnoc_snoc, SDX55_SLAVE_MEM_NOC_SNOC, 1, 8, SDX55_MASTER_MEM_NOC_SNOC); @@ -80,6 +82,7 @@ DEFINE_QBCM(bcm_mc0, "MC0", true, &ebi); DEFINE_QBCM(bcm_sh0, "SH0", true, &qns_llcc); DEFINE_QBCM(bcm_ce0, "CE0", false, &qxm_crypto); +DEFINE_QBCM(bcm_ip0, "IP0", false, &ipa_core_slave); DEFINE_QBCM(bcm_pn0, "PN0", false, &qhm_snoc_cfg); DEFINE_QBCM(bcm_sh3, "SH3", false, &xm_apps_rdwr); DEFINE_QBCM(bcm_sh4, "SH4", false, &qns_memnoc_snoc, &qns_sys_pcie); @@ -216,6 +219,22 @@ .num_bcms = ARRAY_SIZE(system_noc_bcms), }; +static struct qcom_icc_bcm *ipa_virt_bcms[] = { + &bcm_ip0, +}; + +static struct qcom_icc_node *ipa_virt_nodes[] = { + [MASTER_IPA_CORE] = &ipa_core_master, + [SLAVE_IPA_CORE] = &ipa_core_slave, +}; + +static const struct qcom_icc_desc sdx55_ipa_virt = { + .nodes = ipa_virt_nodes, + .num_nodes = ARRAY_SIZE(ipa_virt_nodes), + .bcms = ipa_virt_bcms, + .num_bcms = ARRAY_SIZE(ipa_virt_bcms), +}; + static const struct of_device_id qnoc_of_match[] = { { .compatible = "qcom,sdx55-mc-virt", .data = &sdx55_mc_virt}, @@ -223,6 +242,8 @@ .data = &sdx55_mem_noc}, { .compatible = "qcom,sdx55-system-noc", .data = &sdx55_system_noc}, + { .compatible = "qcom,sdx55-ipa-virt", + .data = &sdx55_ipa_virt}, { } }; MODULE_DEVICE_TABLE(of, qnoc_of_match); reverted: --- linux-oem-5.17-5.17.0/drivers/iommu/apple-dart.c +++ linux-oem-5.17-5.17.0.orig/drivers/iommu/apple-dart.c @@ -782,7 +782,6 @@ .get_resv_regions = apple_dart_get_resv_regions, .put_resv_regions = generic_iommu_put_resv_regions, .pgsize_bitmap = -1UL, /* Restricted during dart probe */ - .owner = THIS_MODULE, }; static irqreturn_t apple_dart_irq(int irq, void *dev) @@ -858,15 +857,16 @@ dart->dev = dev; spin_lock_init(&dart->lock); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dart->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(dart->regs)) - return PTR_ERR(dart->regs); - if (resource_size(res) < 0x4000) { dev_err(dev, "MMIO region too small (%pr)\n", res); return -EINVAL; } + dart->regs = devm_ioremap_resource(dev, res); + if (IS_ERR(dart->regs)) + return PTR_ERR(dart->regs); + dart->irq = platform_get_irq(pdev, 0); if (dart->irq < 0) return -ENODEV; reverted: --- linux-oem-5.17-5.17.0/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +++ linux-oem-5.17-5.17.0.orig/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c @@ -183,14 +183,7 @@ { struct arm_smmu_mmu_notifier *smmu_mn = mn_to_smmu(mn); struct arm_smmu_domain *smmu_domain = smmu_mn->domain; + size_t size = end - start + 1; - size_t size; - - /* - * The mm_types defines vm_end as the first byte after the end address, - * different from IOMMU subsystem using the last address of an address - * range. So do a simple translation here by calculating size correctly. - */ - size = end - start; if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) arm_smmu_tlb_inv_range_asid(start, size, smmu_mn->cd->asid, diff -u linux-oem-5.17-5.17.0/drivers/iommu/intel/iommu.c linux-oem-5.17-5.17.0/drivers/iommu/intel/iommu.c --- linux-oem-5.17-5.17.0/drivers/iommu/intel/iommu.c +++ linux-oem-5.17-5.17.0/drivers/iommu/intel/iommu.c @@ -1725,8 +1725,7 @@ unsigned long pfn, unsigned int pages, int ih, int map) { - unsigned int aligned_pages = __roundup_pow_of_two(pages); - unsigned int mask = ilog2(aligned_pages); + unsigned int mask = ilog2(__roundup_pow_of_two(pages)); uint64_t addr = (uint64_t)pfn << VTD_PAGE_SHIFT; u16 did = domain->iommu_did[iommu->seq_id]; @@ -1738,30 +1737,10 @@ if (domain_use_first_level(domain)) { domain_flush_piotlb(iommu, domain, addr, pages, ih); } else { - unsigned long bitmask = aligned_pages - 1; - - /* - * PSI masks the low order bits of the base address. If the - * address isn't aligned to the mask, then compute a mask value - * needed to ensure the target range is flushed. - */ - if (unlikely(bitmask & pfn)) { - unsigned long end_pfn = pfn + pages - 1, shared_bits; - - /* - * Since end_pfn <= pfn + bitmask, the only way bits - * higher than bitmask can differ in pfn and end_pfn is - * by carrying. This means after masking out bitmask, - * high bits starting with the first set bit in - * shared_bits are all equal in both pfn and end_pfn. - */ - shared_bits = ~(pfn ^ end_pfn) & ~bitmask; - mask = shared_bits ? __ffs(shared_bits) : BITS_PER_LONG; - } - /* * Fallback to domain selective flush if no PSI support or - * the size is too big. + * the size is too big. PSI requires page size to be 2 ^ x, + * and the base address is naturally aligned to the size. */ if (!cap_pgsel_inv(iommu->cap) || mask > cap_max_amask_val(iommu->cap)) reverted: --- linux-oem-5.17-5.17.0/drivers/iommu/intel/svm.c +++ linux-oem-5.17-5.17.0.orig/drivers/iommu/intel/svm.c @@ -956,10 +956,6 @@ goto bad_req; } - /* Drop Stop Marker message. No need for a response. */ - if (unlikely(req->lpig && !req->rd_req && !req->wr_req)) - goto prq_advance; - if (!svm || svm->pasid != req->pasid) { /* * It can't go away, because the driver is not permitted diff -u linux-oem-5.17-5.17.0/drivers/md/dm-integrity.c linux-oem-5.17-5.17.0/drivers/md/dm-integrity.c --- linux-oem-5.17-5.17.0/drivers/md/dm-integrity.c +++ linux-oem-5.17-5.17.0/drivers/md/dm-integrity.c @@ -4400,7 +4400,6 @@ } if (ic->internal_hash) { - size_t recalc_tags_size; ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", WQ_MEM_RECLAIM, 1); if (!ic->recalc_wq ) { ti->error = "Cannot allocate workqueue"; @@ -4414,10 +4413,8 @@ r = -ENOMEM; goto bad; } - recalc_tags_size = (RECALC_SECTORS >> ic->sb->log2_sectors_per_block) * ic->tag_size; - if (crypto_shash_digestsize(ic->internal_hash) > ic->tag_size) - recalc_tags_size += crypto_shash_digestsize(ic->internal_hash) - ic->tag_size; - ic->recalc_tags = kvmalloc(recalc_tags_size, GFP_KERNEL); + ic->recalc_tags = kvmalloc_array(RECALC_SECTORS >> ic->sb->log2_sectors_per_block, + ic->tag_size, GFP_KERNEL); if (!ic->recalc_tags) { ti->error = "Cannot allocate tags for recalculating"; r = -ENOMEM; reverted: --- linux-oem-5.17-5.17.0/drivers/md/dm-ps-historical-service-time.c +++ linux-oem-5.17-5.17.0.orig/drivers/md/dm-ps-historical-service-time.c @@ -27,6 +27,7 @@ #include #include #include +#include #define DM_MSG_PREFIX "multipath historical-service-time" @@ -432,7 +433,7 @@ { struct selector *s = ps->context; struct path_info *pi = NULL, *best = NULL; + u64 time_now = sched_clock(); - u64 time_now = ktime_get_ns(); struct dm_path *ret = NULL; unsigned long flags; @@ -473,7 +474,7 @@ static u64 path_service_time(struct path_info *pi, u64 start_time) { + u64 sched_now = ktime_get_ns(); - u64 now = ktime_get_ns(); /* if a previous disk request has finished after this IO was * sent to the hardware, pretend the submission happened @@ -482,11 +483,11 @@ if (time_after64(pi->last_finish, start_time)) start_time = pi->last_finish; + pi->last_finish = sched_now; + if (time_before64(sched_now, start_time)) - pi->last_finish = now; - if (time_before64(now, start_time)) return 0; + return sched_now - start_time; - return now - start_time; } static int hst_end_io(struct path_selector *ps, struct dm_path *path, reverted: --- linux-oem-5.17-5.17.0/drivers/media/platform/rockchip/rga/rga.c +++ linux-oem-5.17-5.17.0.orig/drivers/media/platform/rockchip/rga/rga.c @@ -892,7 +892,7 @@ } rga->dst_mmu_pages = (unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3); + if (rga->dst_mmu_pages) { - if (!rga->dst_mmu_pages) { ret = -ENOMEM; goto free_src_pages; } reverted: --- linux-oem-5.17-5.17.0/drivers/media/tuners/si2157.c +++ linux-oem-5.17-5.17.0.orig/drivers/media/tuners/si2157.c @@ -77,16 +77,16 @@ } static const struct si2157_tuner_info si2157_tuners[] = { + { SI2141, false, 0x60, SI2141_60_FIRMWARE, SI2141_A10_FIRMWARE }, + { SI2141, false, 0x61, SI2141_61_FIRMWARE, SI2141_A10_FIRMWARE }, + { SI2146, false, 0x11, SI2146_11_FIRMWARE, NULL }, + { SI2147, false, 0x50, SI2147_50_FIRMWARE, NULL }, + { SI2148, true, 0x32, SI2148_32_FIRMWARE, SI2158_A20_FIRMWARE }, + { SI2148, true, 0x33, SI2148_33_FIRMWARE, SI2158_A20_FIRMWARE }, + { SI2157, false, 0x50, SI2157_50_FIRMWARE, SI2157_A30_FIRMWARE }, + { SI2158, false, 0x50, SI2158_50_FIRMWARE, SI2158_A20_FIRMWARE }, + { SI2158, false, 0x51, SI2158_51_FIRMWARE, SI2158_A20_FIRMWARE }, + { SI2177, false, 0x50, SI2177_50_FIRMWARE, SI2157_A30_FIRMWARE }, - { SI2141, 0x60, false, SI2141_60_FIRMWARE, SI2141_A10_FIRMWARE }, - { SI2141, 0x61, false, SI2141_61_FIRMWARE, SI2141_A10_FIRMWARE }, - { SI2146, 0x11, false, SI2146_11_FIRMWARE, NULL }, - { SI2147, 0x50, false, SI2147_50_FIRMWARE, NULL }, - { SI2148, 0x32, true, SI2148_32_FIRMWARE, SI2158_A20_FIRMWARE }, - { SI2148, 0x33, true, SI2148_33_FIRMWARE, SI2158_A20_FIRMWARE }, - { SI2157, 0x50, false, SI2157_50_FIRMWARE, SI2157_A30_FIRMWARE }, - { SI2158, 0x50, false, SI2158_50_FIRMWARE, SI2158_A20_FIRMWARE }, - { SI2158, 0x51, false, SI2158_51_FIRMWARE, SI2158_A20_FIRMWARE }, - { SI2177, 0x50, false, SI2177_50_FIRMWARE, SI2157_A30_FIRMWARE }, }; static int si2157_load_firmware(struct dvb_frontend *fe, @@ -178,7 +178,7 @@ } } + if (!fw_name && !fw_alt_name) { - if (required && !fw_name && !fw_alt_name) { dev_err(&client->dev, "unknown chip version Si21%d-%c%c%c ROM 0x%02x\n", part_id, cmd.args[1], cmd.args[3], cmd.args[4], rom_id); reverted: --- linux-oem-5.17-5.17.0/drivers/memory/atmel-ebi.c +++ linux-oem-5.17-5.17.0.orig/drivers/memory/atmel-ebi.c @@ -544,27 +544,20 @@ smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0); ebi->smc.regmap = syscon_node_to_regmap(smc_np); + if (IS_ERR(ebi->smc.regmap)) + return PTR_ERR(ebi->smc.regmap); - if (IS_ERR(ebi->smc.regmap)) { - ret = PTR_ERR(ebi->smc.regmap); - goto put_node; - } ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np); + if (IS_ERR(ebi->smc.layout)) + return PTR_ERR(ebi->smc.layout); - if (IS_ERR(ebi->smc.layout)) { - ret = PTR_ERR(ebi->smc.layout); - goto put_node; - } ebi->smc.clk = of_clk_get(smc_np, 0); if (IS_ERR(ebi->smc.clk)) { + if (PTR_ERR(ebi->smc.clk) != -ENOENT) + return PTR_ERR(ebi->smc.clk); - if (PTR_ERR(ebi->smc.clk) != -ENOENT) { - ret = PTR_ERR(ebi->smc.clk); - goto put_node; - } ebi->smc.clk = NULL; } - of_node_put(smc_np); ret = clk_prepare_enable(ebi->smc.clk); if (ret) return ret; @@ -615,10 +608,6 @@ } return of_platform_populate(np, NULL, NULL, dev); - -put_node: - of_node_put(smc_np); - return ret; } static __maybe_unused int atmel_ebi_resume(struct device *dev) reverted: --- linux-oem-5.17-5.17.0/drivers/memory/renesas-rpc-if.c +++ linux-oem-5.17-5.17.0.orig/drivers/memory/renesas-rpc-if.c @@ -164,39 +164,25 @@ /* + * Custom accessor functions to ensure SMRDR0 and SMWDR0 are always accessed + * with proper width. Requires SMENR_SPIDE to be correctly set before! - * Custom accessor functions to ensure SM[RW]DR[01] are always accessed with - * proper width. Requires rpcif.xfer_size to be correctly set before! */ static int rpcif_reg_read(void *context, unsigned int reg, unsigned int *val) { struct rpcif *rpc = context; + if (reg == RPCIF_SMRDR0 || reg == RPCIF_SMWDR0) { + u32 spide = readl(rpc->base + RPCIF_SMENR) & RPCIF_SMENR_SPIDE(0xF); + + if (spide == 0x8) { - switch (reg) { - case RPCIF_SMRDR0: - case RPCIF_SMWDR0: - switch (rpc->xfer_size) { - case 1: *val = readb(rpc->base + reg); return 0; + } else if (spide == 0xC) { - - case 2: *val = readw(rpc->base + reg); return 0; + } else if (spide != 0xF) { - - case 4: - case 8: - *val = readl(rpc->base + reg); - return 0; - - default: return -EILSEQ; } - - case RPCIF_SMRDR1: - case RPCIF_SMWDR1: - if (rpc->xfer_size != 8) - return -EILSEQ; - break; } *val = readl(rpc->base + reg); @@ -207,34 +193,18 @@ { struct rpcif *rpc = context; + if (reg == RPCIF_SMRDR0 || reg == RPCIF_SMWDR0) { + u32 spide = readl(rpc->base + RPCIF_SMENR) & RPCIF_SMENR_SPIDE(0xF); + + if (spide == 0x8) { - switch (reg) { - case RPCIF_SMWDR0: - switch (rpc->xfer_size) { - case 1: writeb(val, rpc->base + reg); return 0; + } else if (spide == 0xC) { - - case 2: writew(val, rpc->base + reg); return 0; + } else if (spide != 0xF) { - - case 4: - case 8: - writel(val, rpc->base + reg); - return 0; - - default: return -EILSEQ; } - - case RPCIF_SMWDR1: - if (rpc->xfer_size != 8) - return -EILSEQ; - break; - - case RPCIF_SMRDR0: - case RPCIF_SMRDR1: - return -EPERM; } writel(val, rpc->base + reg); @@ -499,7 +469,6 @@ smenr |= RPCIF_SMENR_SPIDE(rpcif_bits_set(rpc, nbytes)); regmap_write(rpc->regmap, RPCIF_SMENR, smenr); - rpc->xfer_size = nbytes; memcpy(data, rpc->buffer + pos, nbytes); if (nbytes == 8) { @@ -564,7 +533,6 @@ regmap_write(rpc->regmap, RPCIF_SMENR, smenr); regmap_write(rpc->regmap, RPCIF_SMCR, rpc->smcr | RPCIF_SMCR_SPIE); - rpc->xfer_size = nbytes; ret = wait_msg_xfer_end(rpc); if (ret) goto err_out; @@ -683,7 +651,6 @@ struct platform_device *vdev; struct device_node *flash; const char *name; - int ret; flash = of_get_next_child(pdev->dev.of_node, NULL); if (!flash) { @@ -707,14 +674,7 @@ return -ENOMEM; vdev->dev.parent = &pdev->dev; platform_set_drvdata(pdev, vdev); + return platform_device_add(vdev); - - ret = platform_device_add(vdev); - if (ret) { - platform_device_put(vdev); - return ret; - } - - return 0; } static int rpcif_remove(struct platform_device *pdev) reverted: --- linux-oem-5.17-5.17.0/drivers/misc/eeprom/at25.c +++ linux-oem-5.17-5.17.0.orig/drivers/misc/eeprom/at25.c @@ -31,8 +31,6 @@ */ #define FM25_SN_LEN 8 /* serial number length */ -#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */ - struct at25_data { struct spi_eeprom chip; struct spi_device *spi; @@ -41,7 +39,6 @@ struct nvmem_config nvmem_config; struct nvmem_device *nvmem; u8 sernum[FM25_SN_LEN]; - u8 command[EE_MAXADDRLEN + 1]; }; #define AT25_WREN 0x06 /* latch the write enable */ @@ -64,6 +61,8 @@ #define FM25_ID_LEN 9 /* ID length */ +#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */ + /* * Specs often allow 5ms for a page write, sometimes 20ms; * it's important to recover from write timeouts. @@ -79,6 +78,7 @@ { struct at25_data *at25 = priv; char *buf = val; + u8 command[EE_MAXADDRLEN + 1]; u8 *cp; ssize_t status; struct spi_transfer t[2]; @@ -92,15 +92,12 @@ if (unlikely(!count)) return -EINVAL; + cp = command; - cp = at25->command; instr = AT25_READ; if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR) if (offset >= BIT(at25->addrlen * 8)) instr |= AT25_INSTR_BIT3; - - mutex_lock(&at25->lock); - *cp++ = instr; /* 8/16/24-bit address is written MSB first */ @@ -119,7 +116,7 @@ spi_message_init(&m); memset(t, 0, sizeof(t)); + t[0].tx_buf = command; - t[0].tx_buf = at25->command; t[0].len = at25->addrlen + 1; spi_message_add_tail(&t[0], &m); @@ -127,6 +124,8 @@ t[1].len = count; spi_message_add_tail(&t[1], &m); + mutex_lock(&at25->lock); + /* * Read it all at once. * @@ -153,7 +152,7 @@ spi_message_init(&m); memset(t, 0, sizeof(t)); + t[0].tx_buf = &command; - t[0].tx_buf = at25->command; t[0].len = 1; spi_message_add_tail(&t[0], &m); @@ -163,8 +162,6 @@ mutex_lock(&at25->lock); - at25->command[0] = command; - status = spi_sync(at25->spi, &m); dev_dbg(&at25->spi->dev, "read %d aux bytes --> %d\n", len, status); diff -u linux-oem-5.17-5.17.0/drivers/mmc/core/mmc.c linux-oem-5.17-5.17.0/drivers/mmc/core/mmc.c --- linux-oem-5.17-5.17.0/drivers/mmc/core/mmc.c +++ linux-oem-5.17-5.17.0/drivers/mmc/core/mmc.c @@ -1389,17 +1389,13 @@ goto out_err; } - /* - * Bump to HS timing and frequency. Some cards don't handle - * SEND_STATUS reliably at the initial frequency. - */ mmc_set_timing(host, MMC_TIMING_MMC_HS); - mmc_set_bus_speed(card); - err = mmc_switch_status(card, true); if (err) goto out_err; + mmc_set_clock(host, card->ext_csd.hs_max_dtr); + /* Switch card to DDR with strobe bit */ val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, @@ -1457,7 +1453,7 @@ static int mmc_select_hs200(struct mmc_card *card) { struct mmc_host *host = card->host; - unsigned int old_timing, old_signal_voltage, old_clock; + unsigned int old_timing, old_signal_voltage; int err = -EINVAL; u8 val; @@ -1488,17 +1484,8 @@ false, true, MMC_CMD_RETRIES); if (err) goto err; - - /* - * Bump to HS timing and frequency. Some cards don't handle - * SEND_STATUS reliably at the initial frequency. - * NB: We can't move to full (HS200) speeds until after we've - * successfully switched over. - */ old_timing = host->ios.timing; - old_clock = host->ios.clock; mmc_set_timing(host, MMC_TIMING_MMC_HS200); - mmc_set_clock(card->host, card->ext_csd.hs_max_dtr); /* * For HS200, CRC errors are not a reliable way to know the @@ -1511,10 +1498,8 @@ * mmc_select_timing() assumes timing has not changed if * it is a switch error. */ - if (err == -EBADMSG) { - mmc_set_clock(host, old_clock); + if (err == -EBADMSG) mmc_set_timing(host, old_timing); - } } err: if (err) { diff -u linux-oem-5.17-5.17.0/drivers/mmc/host/rtsx_pci_sdmmc.c linux-oem-5.17-5.17.0/drivers/mmc/host/rtsx_pci_sdmmc.c --- linux-oem-5.17-5.17.0/drivers/mmc/host/rtsx_pci_sdmmc.c +++ linux-oem-5.17-5.17.0/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -38,7 +38,10 @@ bool double_clk; bool eject; bool initial_mode; - int prev_power_state; + int power_state; +#define SDMMC_POWER_ON 1 +#define SDMMC_POWER_OFF 0 + int sg_count; s32 cookie; int cookie_sg_count; @@ -902,7 +905,7 @@ return err; } -static int sd_power_on(struct realtek_pci_sdmmc *host, unsigned char power_mode) +static int sd_power_on(struct realtek_pci_sdmmc *host) { struct rtsx_pcr *pcr = host->pcr; struct mmc_host *mmc = host->mmc; @@ -910,14 +913,9 @@ u32 val; u8 test_mode; - if (host->prev_power_state == MMC_POWER_ON) + if (host->power_state == SDMMC_POWER_ON) return 0; - if (host->prev_power_state == MMC_POWER_UP) { - rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0); - goto finish; - } - msleep(100); rtsx_pci_init_cmd(pcr); @@ -938,15 +936,10 @@ if (err < 0) return err; - mdelay(1); - err = rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN); if (err < 0) return err; - /* send at least 74 clocks */ - rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN); - if (PCI_PID(pcr) == PID_5261) { /* * If test mode is set switch to SD Express mandatorily, @@ -971,8 +964,7 @@ } } -finish: - host->prev_power_state = power_mode; + host->power_state = SDMMC_POWER_ON; return 0; } @@ -981,7 +973,7 @@ struct rtsx_pcr *pcr = host->pcr; int err; - host->prev_power_state = MMC_POWER_OFF; + host->power_state = SDMMC_POWER_OFF; rtsx_pci_init_cmd(pcr); @@ -1007,7 +999,7 @@ if (power_mode == MMC_POWER_OFF) err = sd_power_off(host); else - err = sd_power_on(host, power_mode); + err = sd_power_on(host); return err; } @@ -1490,11 +1482,10 @@ host = mmc_priv(mmc); host->pcr = pcr; - mmc->ios.power_delay_ms = 5; host->mmc = mmc; host->pdev = pdev; host->cookie = -1; - host->prev_power_state = MMC_POWER_OFF; + host->power_state = SDMMC_POWER_OFF; INIT_WORK(&host->work, sd_request); platform_set_drvdata(pdev, host); pcr->slots[RTSX_SD_CARD].p_dev = pdev; reverted: --- linux-oem-5.17-5.17.0/drivers/mmc/host/sdhci-msm.c +++ linux-oem-5.17-5.17.0.orig/drivers/mmc/host/sdhci-msm.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "sdhci-pltfm.h" #include "cqhci.h" @@ -2483,43 +2482,6 @@ of_property_read_u32(node, "qcom,dll-config", &msm_host->dll_config); } -static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host) -{ - struct reset_control *reset; - int ret = 0; - - reset = reset_control_get_optional_exclusive(dev, NULL); - if (IS_ERR(reset)) - return dev_err_probe(dev, PTR_ERR(reset), - "unable to acquire core_reset\n"); - - if (!reset) - return ret; - - ret = reset_control_assert(reset); - if (ret) { - reset_control_put(reset); - return dev_err_probe(dev, ret, "core_reset assert failed\n"); - } - - /* - * The hardware requirement for delay between assert/deassert - * is at least 3-4 sleep clock (32.7KHz) cycles, which comes to - * ~125us (4/32768). To be on the safe side add 200us delay. - */ - usleep_range(200, 210); - - ret = reset_control_deassert(reset); - if (ret) { - reset_control_put(reset); - return dev_err_probe(dev, ret, "core_reset deassert failed\n"); - } - - usleep_range(200, 210); - reset_control_put(reset); - - return ret; -} static int sdhci_msm_probe(struct platform_device *pdev) { @@ -2567,10 +2529,6 @@ msm_host->saved_tuning_phase = INVALID_TUNING_PHASE; - ret = sdhci_msm_gcc_reset(&pdev->dev, host); - if (ret) - goto pltfm_free; - /* Setup SDCC bus voter clock. */ msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus"); if (!IS_ERR(msm_host->bus_clk)) { reverted: --- linux-oem-5.17-5.17.0/drivers/mmc/host/sunxi-mmc.c +++ linux-oem-5.17-5.17.0.orig/drivers/mmc/host/sunxi-mmc.c @@ -377,9 +377,8 @@ pdes[i].buf_addr_ptr1 = cpu_to_le32(sg_dma_address(&data->sg[i]) >> host->cfg->idma_des_shift); + pdes[i].buf_addr_ptr2 = cpu_to_le32((u32)next_desc >> + host->cfg->idma_des_shift); - pdes[i].buf_addr_ptr2 = - cpu_to_le32(next_desc >> - host->cfg->idma_des_shift); } pdes[0].config |= cpu_to_le32(SDXC_IDMAC_DES0_FD); reverted: --- linux-oem-5.17-5.17.0/drivers/mtd/nand/raw/mtk_ecc.c +++ linux-oem-5.17-5.17.0.orig/drivers/mtd/nand/raw/mtk_ecc.c @@ -43,7 +43,6 @@ struct mtk_ecc_caps { u32 err_mask; - u32 err_shift; const u8 *ecc_strength; const u32 *ecc_regs; u8 num_ecc_strength; @@ -77,7 +76,7 @@ }; static const u8 ecc_strength_mt7622[] = { + 4, 6, 8, 10, 12, 14, 16 - 4, 6, 8, 10, 12 }; enum mtk_ecc_regs { @@ -222,7 +221,7 @@ for (i = 0; i < sectors; i++) { offset = (i >> 2) << 2; err = readl(ecc->regs + ECC_DECENUM0 + offset); + err = err >> ((i % 4) * 8); - err = err >> ((i % 4) * ecc->caps->err_shift); err &= ecc->caps->err_mask; if (err == ecc->caps->err_mask) { /* uncorrectable errors */ @@ -450,7 +449,6 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = { .err_mask = 0x3f, - .err_shift = 8, .ecc_strength = ecc_strength_mt2701, .ecc_regs = mt2701_ecc_regs, .num_ecc_strength = 20, @@ -461,7 +459,6 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = { .err_mask = 0x7f, - .err_shift = 8, .ecc_strength = ecc_strength_mt2712, .ecc_regs = mt2712_ecc_regs, .num_ecc_strength = 23, @@ -471,11 +468,10 @@ }; static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { + .err_mask = 0x3f, - .err_mask = 0x1f, - .err_shift = 5, .ecc_strength = ecc_strength_mt7622, .ecc_regs = mt7622_ecc_regs, + .num_ecc_strength = 7, - .num_ecc_strength = 5, .ecc_mode_shift = 4, .parity_bits = 13, .pg_irq_sel = 0, reverted: --- linux-oem-5.17-5.17.0/drivers/mtd/nand/raw/qcom_nandc.c +++ linux-oem-5.17-5.17.0.orig/drivers/mtd/nand/raw/qcom_nandc.c @@ -2651,23 +2651,10 @@ ecc->engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; mtd_set_ooblayout(mtd, &qcom_nand_ooblayout_ops); - /* Free the initially allocated BAM transaction for reading the ONFI params */ - if (nandc->props->is_bam) - free_bam_transaction(nandc); nandc->max_cwperpage = max_t(unsigned int, nandc->max_cwperpage, cwperpage); - /* Now allocate the BAM transaction based on updated max_cwperpage */ - if (nandc->props->is_bam) { - nandc->bam_txn = alloc_bam_transaction(nandc); - if (!nandc->bam_txn) { - dev_err(nandc->dev, - "failed to allocate bam transaction\n"); - return -ENOMEM; - } - } - /* * DATA_UD_BYTES varies based on whether the read/write command protects * spare data with ECC too. We protect spare data by default, so we set @@ -2968,6 +2955,17 @@ if (ret) return ret; + if (nandc->props->is_bam) { + free_bam_transaction(nandc); + nandc->bam_txn = alloc_bam_transaction(nandc); + if (!nandc->bam_txn) { + dev_err(nandc->dev, + "failed to allocate bam transaction\n"); + nand_cleanup(chip); + return -ENOMEM; + } + } + ret = mtd_device_parse_register(mtd, probes, NULL, NULL, 0); if (ret) nand_cleanup(chip); reverted: --- linux-oem-5.17-5.17.0/drivers/mtd/nand/raw/sh_flctl.c +++ linux-oem-5.17-5.17.0.orig/drivers/mtd/nand/raw/sh_flctl.c @@ -384,8 +384,7 @@ dma_addr_t dma_addr; dma_cookie_t cookie; uint32_t reg; + int ret; - int ret = 0; - unsigned long time_left; if (dir == DMA_FROM_DEVICE) { chan = flctl->chan_fifo0_rx; @@ -426,14 +425,13 @@ goto out; } + ret = - time_left = wait_for_completion_timeout(&flctl->dma_complete, msecs_to_jiffies(3000)); + if (ret <= 0) { - if (time_left == 0) { dmaengine_terminate_all(chan); dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n"); - ret = -ETIMEDOUT; } out: @@ -443,7 +441,7 @@ dma_unmap_single(chan->device->dev, dma_addr, len, dir); + /* ret > 0 is success */ - /* ret == 0 is success */ return ret; } @@ -467,7 +465,7 @@ /* initiate DMA transfer */ if (flctl->chan_fifo0_rx && rlen >= 32 && + flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0) - !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE)) goto convert; /* DMA success */ /* do polling transfer */ @@ -526,7 +524,7 @@ /* initiate DMA transfer */ if (flctl->chan_fifo0_tx && rlen >= 32 && + flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0) - !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE)) return; /* DMA success */ /* do polling transfer */ reverted: --- linux-oem-5.17-5.17.0/drivers/net/bonding/bond_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/bonding/bond_main.c @@ -3819,19 +3819,14 @@ return true; } +static u32 bond_ip_hash(u32 hash, struct flow_keys *flow) -static u32 bond_ip_hash(u32 hash, struct flow_keys *flow, int xmit_policy) { hash ^= (__force u32)flow_get_u32_dst(flow) ^ (__force u32)flow_get_u32_src(flow); hash ^= (hash >> 16); hash ^= (hash >> 8); - /* discard lowest hash bit to deal with the common even ports pattern */ + return hash >> 1; - if (xmit_policy == BOND_XMIT_POLICY_LAYER34 || - xmit_policy == BOND_XMIT_POLICY_ENCAP34) - return hash >> 1; - - return hash; } /* Generate hash based on xmit policy. If @skb is given it is used to linearize @@ -3861,7 +3856,7 @@ memcpy(&hash, &flow.ports.ports, sizeof(hash)); } + return bond_ip_hash(hash, &flow); - return bond_ip_hash(hash, &flow, bond->params.xmit_policy); } /** @@ -5056,7 +5051,7 @@ /* L4 */ memcpy(&hash, &flow.ports.ports, sizeof(hash)); /* L3 */ + return bond_ip_hash(hash, &flow); - return bond_ip_hash(hash, &flow, BOND_XMIT_POLICY_LAYER34); } static struct net_device *__bond_sk_get_lower_dev(struct bonding *bond, reverted: --- linux-oem-5.17-5.17.0/drivers/net/can/grcan.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/can/grcan.c @@ -241,14 +241,13 @@ .rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \ } +#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100 -#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 4100 #define GRLIB_VERSION_MASK 0xffff /* GRCAN private data structure */ struct grcan_priv { struct can_priv can; /* must be the first member */ struct net_device *dev; - struct device *ofdev_dev; struct napi_struct napi; struct grcan_registers __iomem *regs; /* ioremap'ed registers */ @@ -922,7 +921,7 @@ struct grcan_priv *priv = netdev_priv(dev); struct grcan_dma *dma = &priv->dma; + dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf, - dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf, dma->base_handle); memset(dma, 0, sizeof(*dma)); } @@ -947,7 +946,7 @@ /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */ dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT; + dma->base_buf = dma_alloc_coherent(&dev->dev, - dma->base_buf = dma_alloc_coherent(priv->ofdev_dev, dma->base_size, &dma->base_handle, GFP_KERNEL); @@ -1103,10 +1102,8 @@ priv->closing = true; if (priv->need_txbug_workaround) { - spin_unlock_irqrestore(&priv->lock, flags); del_timer_sync(&priv->hang_timer); del_timer_sync(&priv->rr_timer); - spin_lock_irqsave(&priv->lock, flags); } netif_stop_queue(dev); grcan_stop_hardware(dev); @@ -1125,7 +1122,7 @@ return 0; } +static int grcan_transmit_catch_up(struct net_device *dev, int budget) -static void grcan_transmit_catch_up(struct net_device *dev) { struct grcan_priv *priv = netdev_priv(dev); unsigned long flags; @@ -1133,7 +1130,7 @@ spin_lock_irqsave(&priv->lock, flags); + work_done = catch_up_echo_skb(dev, budget, true); - work_done = catch_up_echo_skb(dev, -1, true); if (work_done) { if (!priv->resetting && !priv->closing && !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) @@ -1147,6 +1144,8 @@ } spin_unlock_irqrestore(&priv->lock, flags); + + return work_done; } static int grcan_receive(struct net_device *dev, int budget) @@ -1228,13 +1227,19 @@ struct net_device *dev = priv->dev; struct grcan_registers __iomem *regs = priv->regs; unsigned long flags; + int tx_work_done, rx_work_done; + int rx_budget = budget / 2; + int tx_budget = budget - rx_budget; - int work_done; + /* Half of the budget for receiving messages */ + rx_work_done = grcan_receive(dev, rx_budget); - work_done = grcan_receive(dev, budget); + /* Half of the budget for transmitting messages as that can trigger echo + * frames being received + */ + tx_work_done = grcan_transmit_catch_up(dev, tx_budget); - grcan_transmit_catch_up(dev); + if (rx_work_done < rx_budget && tx_work_done < tx_budget) { - if (work_done < budget) { napi_complete(napi); /* Guarantee no interference with a running reset that otherwise @@ -1251,7 +1256,7 @@ spin_unlock_irqrestore(&priv->lock, flags); } + return rx_work_done + tx_work_done; - return work_done; } /* Work tx bug by waiting while for the risky situation to clear. If that fails, @@ -1582,7 +1587,6 @@ memcpy(&priv->config, &grcan_module_config, sizeof(struct grcan_device_config)); priv->dev = dev; - priv->ofdev_dev = &ofdev->dev; priv->regs = base; priv->can.bittiming_const = &grcan_bittiming_const; priv->can.do_set_bittiming = grcan_set_bittiming; @@ -1635,7 +1639,6 @@ static int grcan_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; - struct device_node *sysid_parent; u32 sysid, ambafreq; int irq, err; void __iomem *base; @@ -1644,15 +1647,10 @@ /* Compare GRLIB version number with the first that does not * have the tx bug (see start_xmit) */ + err = of_property_read_u32(np, "systemid", &sysid); + if (!err && ((sysid & GRLIB_VERSION_MASK) + >= GRCAN_TXBUG_SAFE_GRLIB_VERSION)) + txbug = false; - sysid_parent = of_find_node_by_path("/ambapp0"); - if (sysid_parent) { - of_node_get(sysid_parent); - err = of_property_read_u32(sysid_parent, "systemid", &sysid); - if (!err && ((sysid & GRLIB_VERSION_MASK) >= - GRCAN_TXBUG_SAFE_GRLIB_VERSION)) - txbug = false; - of_node_put(sysid_parent); - } err = of_property_read_u32(np, "freq", &ambafreq); if (err) { reverted: --- linux-oem-5.17-5.17.0/drivers/net/dsa/lantiq_gswip.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/dsa/lantiq_gswip.c @@ -1637,6 +1637,9 @@ break; case PHY_INTERFACE_MODE_RMII: miicfg |= GSWIP_MII_CFG_MODE_RMIIM; + + /* Configure the RMII clock as output: */ + miicfg |= GSWIP_MII_CFG_RMII_CLK; break; case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII_ID: reverted: --- linux-oem-5.17-5.17.0/drivers/net/dsa/mt7530.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/dsa/mt7530.c @@ -2224,7 +2224,6 @@ ret = of_get_phy_mode(mac_np, &interface); if (ret && ret != -ENODEV) { of_node_put(mac_np); - of_node_put(phy_node); return ret; } id = of_mdio_parse_addr(ds->dev, phy_node); reverted: --- linux-oem-5.17-5.17.0/drivers/net/dsa/mv88e6xxx/port_hidden.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/dsa/mv88e6xxx/port_hidden.c @@ -40,9 +40,8 @@ { int bit = __bf_shf(MV88E6XXX_PORT_RESERVED_1A_BUSY); + return mv88e6xxx_wait_bit(chip, MV88E6XXX_PORT_RESERVED_1A_CTRL_PORT, + MV88E6XXX_PORT_RESERVED_1A, bit, 0); - return mv88e6xxx_port_wait_bit(chip, - MV88E6XXX_PORT_RESERVED_1A_CTRL_PORT, - MV88E6XXX_PORT_RESERVED_1A, bit, 0); } int mv88e6xxx_port_hidden_read(struct mv88e6xxx_chip *chip, int block, int port, reverted: --- linux-oem-5.17-5.17.0/drivers/net/dsa/ocelot/felix.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/dsa/ocelot/felix.c @@ -599,8 +599,6 @@ struct ocelot *ocelot = ds->priv; struct felix *felix = ocelot_to_felix(ocelot); enum dsa_tag_protocol old_proto = felix->tag_proto; - bool cpu_port_active = false; - struct dsa_port *dp; int err; if (proto != DSA_TAG_PROTO_SEVILLE && @@ -608,27 +606,6 @@ proto != DSA_TAG_PROTO_OCELOT_8021Q) return -EPROTONOSUPPORT; - /* We don't support multiple CPU ports, yet the DT blob may have - * multiple CPU ports defined. The first CPU port is the active one, - * the others are inactive. In this case, DSA will call - * ->change_tag_protocol() multiple times, once per CPU port. - * Since we implement the tagging protocol change towards "ocelot" or - * "seville" as effectively initializing the NPI port, what we are - * doing is effectively changing who the NPI port is to the last @cpu - * argument passed, which is an unused DSA CPU port and not the one - * that should actively pass traffic. - * Suppress DSA's calls on CPU ports that are inactive. - */ - dsa_switch_for_each_user_port(dp, ds) { - if (dp->cpu_dp->index == cpu) { - cpu_port_active = true; - break; - } - } - - if (!cpu_port_active) - return 0; - felix_del_tag_protocol(ds, cpu, old_proto); err = felix_set_tag_protocol(ds, cpu, proto); diff -u linux-oem-5.17-5.17.0/drivers/net/dsa/ocelot/felix_vsc9959.c linux-oem-5.17-5.17.0/drivers/net/dsa/ocelot/felix_vsc9959.c --- linux-oem-5.17-5.17.0/drivers/net/dsa/ocelot/felix_vsc9959.c +++ linux-oem-5.17-5.17.0/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2328,7 +2328,7 @@ err = dsa_register_switch(ds); if (err) { - dev_err_probe(&pdev->dev, err, "Failed to register DSA switch\n"); + dev_err(&pdev->dev, "Failed to register DSA switch: %d\n", err); goto err_register_ds; } diff -u linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/Kconfig linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/Kconfig --- linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/Kconfig +++ linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/Kconfig @@ -14,7 +14,6 @@ config NET_DSA_REALTEK_SMI tristate "Realtek SMI connected switch driver" depends on NET_DSA_REALTEK - depends on OF default y help Select to enable support for registering switches connected diff -u linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.c linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.c --- linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.c +++ linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.c @@ -315,21 +315,7 @@ return realtek_smi_read_reg(smi, reg, val); } -static void realtek_smi_lock(void *ctx) -{ - struct realtek_smi *smi = ctx; - - mutex_lock(&smi->map_lock); -} - -static void realtek_smi_unlock(void *ctx) -{ - struct realtek_smi *smi = ctx; - - mutex_unlock(&smi->map_lock); -} - -static const struct regmap_config realtek_smi_regmap_config = { +static const struct regmap_config realtek_smi_mdio_regmap_config = { .reg_bits = 10, /* A4..A0 R4..R0 */ .val_bits = 16, .reg_stride = 1, @@ -339,21 +325,6 @@ .reg_read = realtek_smi_read, .reg_write = realtek_smi_write, .cache_type = REGCACHE_NONE, - .lock = realtek_smi_lock, - .unlock = realtek_smi_unlock, -}; - -static const struct regmap_config realtek_smi_nolock_regmap_config = { - .reg_bits = 10, /* A4..A0 R4..R0 */ - .val_bits = 16, - .reg_stride = 1, - /* PHY regs are at 0x8000 */ - .max_register = 0xffff, - .reg_format_endian = REGMAP_ENDIAN_BIG, - .reg_read = realtek_smi_read, - .reg_write = realtek_smi_write, - .cache_type = REGCACHE_NONE, - .disable_locking = true, }; static int realtek_smi_mdio_read(struct mii_bus *bus, int addr, int regnum) @@ -417,7 +388,6 @@ const struct realtek_smi_variant *var; struct device *dev = &pdev->dev; struct realtek_smi *smi; - struct regmap_config rc; struct device_node *np; int ret; @@ -428,25 +398,13 @@ if (!smi) return -ENOMEM; smi->chip_data = (void *)smi + sizeof(*smi); - - mutex_init(&smi->map_lock); - - rc = realtek_smi_regmap_config; - rc.lock_arg = smi; - smi->map = devm_regmap_init(dev, NULL, smi, &rc); + smi->map = devm_regmap_init(dev, NULL, smi, + &realtek_smi_mdio_regmap_config); if (IS_ERR(smi->map)) { ret = PTR_ERR(smi->map); dev_err(dev, "regmap init failed: %d\n", ret); return ret; } - - rc = realtek_smi_nolock_regmap_config; - smi->map_nolock = devm_regmap_init(dev, NULL, smi, &rc); - if (IS_ERR(smi->map_nolock)) { - ret = PTR_ERR(smi->map_nolock); - dev_err(dev, "regmap init failed: %d\n", ret); - return ret; - } /* Link forward and backward */ smi->dev = dev; diff -u linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.h linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.h --- linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.h +++ linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/realtek-smi-core.h @@ -49,8 +49,6 @@ struct gpio_desc *mdc; struct gpio_desc *mdio; struct regmap *map; - struct regmap *map_nolock; - struct mutex map_lock; struct mii_bus *slave_mii_bus; unsigned int clk_delay; diff -u linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/rtl8365mb.c linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/rtl8365mb.c --- linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/rtl8365mb.c +++ linux-oem-5.17-5.17.0/drivers/net/dsa/realtek/rtl8365mb.c @@ -565,7 +565,7 @@ { u32 val; - return regmap_read_poll_timeout(smi->map_nolock, + return regmap_read_poll_timeout(smi->map, RTL8365MB_INDIRECT_ACCESS_STATUS_REG, val, !val, 10, 100); } @@ -579,7 +579,7 @@ /* Set OCP prefix */ val = FIELD_GET(RTL8365MB_PHY_OCP_ADDR_PREFIX_MASK, ocp_addr); ret = regmap_update_bits( - smi->map_nolock, RTL8365MB_GPHY_OCP_MSB_0_REG, + smi->map, RTL8365MB_GPHY_OCP_MSB_0_REG, RTL8365MB_GPHY_OCP_MSB_0_CFG_CPU_OCPADR_MASK, FIELD_PREP(RTL8365MB_GPHY_OCP_MSB_0_CFG_CPU_OCPADR_MASK, val)); if (ret) @@ -592,8 +592,8 @@ ocp_addr >> 1); val |= FIELD_PREP(RTL8365MB_INDIRECT_ACCESS_ADDRESS_OCPADR_9_6_MASK, ocp_addr >> 6); - ret = regmap_write(smi->map_nolock, - RTL8365MB_INDIRECT_ACCESS_ADDRESS_REG, val); + ret = regmap_write(smi->map, RTL8365MB_INDIRECT_ACCESS_ADDRESS_REG, + val); if (ret) return ret; @@ -606,42 +606,36 @@ u32 val; int ret; - mutex_lock(&smi->map_lock); - ret = rtl8365mb_phy_poll_busy(smi); if (ret) - goto out; + return ret; ret = rtl8365mb_phy_ocp_prepare(smi, phy, ocp_addr); if (ret) - goto out; + return ret; /* Execute read operation */ val = FIELD_PREP(RTL8365MB_INDIRECT_ACCESS_CTRL_CMD_MASK, RTL8365MB_INDIRECT_ACCESS_CTRL_CMD_VALUE) | FIELD_PREP(RTL8365MB_INDIRECT_ACCESS_CTRL_RW_MASK, RTL8365MB_INDIRECT_ACCESS_CTRL_RW_READ); - ret = regmap_write(smi->map_nolock, RTL8365MB_INDIRECT_ACCESS_CTRL_REG, - val); + ret = regmap_write(smi->map, RTL8365MB_INDIRECT_ACCESS_CTRL_REG, val); if (ret) - goto out; + return ret; ret = rtl8365mb_phy_poll_busy(smi); if (ret) - goto out; + return ret; /* Get PHY register data */ - ret = regmap_read(smi->map_nolock, - RTL8365MB_INDIRECT_ACCESS_READ_DATA_REG, &val); + ret = regmap_read(smi->map, RTL8365MB_INDIRECT_ACCESS_READ_DATA_REG, + &val); if (ret) - goto out; + return ret; *data = val & 0xFFFF; -out: - mutex_unlock(&smi->map_lock); - - return ret; + return 0; } static int rtl8365mb_phy_ocp_write(struct realtek_smi *smi, int phy, @@ -650,38 +644,32 @@ u32 val; int ret; - mutex_lock(&smi->map_lock); - ret = rtl8365mb_phy_poll_busy(smi); if (ret) - goto out; + return ret; ret = rtl8365mb_phy_ocp_prepare(smi, phy, ocp_addr); if (ret) - goto out; + return ret; /* Set PHY register data */ - ret = regmap_write(smi->map_nolock, - RTL8365MB_INDIRECT_ACCESS_WRITE_DATA_REG, data); + ret = regmap_write(smi->map, RTL8365MB_INDIRECT_ACCESS_WRITE_DATA_REG, + data); if (ret) - goto out; + return ret; /* Execute write operation */ val = FIELD_PREP(RTL8365MB_INDIRECT_ACCESS_CTRL_CMD_MASK, RTL8365MB_INDIRECT_ACCESS_CTRL_CMD_VALUE) | FIELD_PREP(RTL8365MB_INDIRECT_ACCESS_CTRL_RW_MASK, RTL8365MB_INDIRECT_ACCESS_CTRL_RW_WRITE); - ret = regmap_write(smi->map_nolock, RTL8365MB_INDIRECT_ACCESS_CTRL_REG, - val); + ret = regmap_write(smi->map, RTL8365MB_INDIRECT_ACCESS_CTRL_REG, val); if (ret) - goto out; + return ret; ret = rtl8365mb_phy_poll_busy(smi); if (ret) - goto out; - -out: - mutex_unlock(&smi->map_lock); + return ret; return 0; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/Kconfig @@ -35,6 +35,15 @@ source "drivers/net/ethernet/arc/Kconfig" source "drivers/net/ethernet/asix/Kconfig" source "drivers/net/ethernet/atheros/Kconfig" +source "drivers/net/ethernet/broadcom/Kconfig" +source "drivers/net/ethernet/brocade/Kconfig" +source "drivers/net/ethernet/cadence/Kconfig" +source "drivers/net/ethernet/calxeda/Kconfig" +source "drivers/net/ethernet/cavium/Kconfig" +source "drivers/net/ethernet/chelsio/Kconfig" +source "drivers/net/ethernet/cirrus/Kconfig" +source "drivers/net/ethernet/cisco/Kconfig" +source "drivers/net/ethernet/cortina/Kconfig" config CX_ECAT tristate "Beckhoff CX5020 EtherCAT master support" @@ -48,14 +57,6 @@ To compile this driver as a module, choose M here. The module will be called ec_bhf. -source "drivers/net/ethernet/broadcom/Kconfig" -source "drivers/net/ethernet/cadence/Kconfig" -source "drivers/net/ethernet/calxeda/Kconfig" -source "drivers/net/ethernet/cavium/Kconfig" -source "drivers/net/ethernet/chelsio/Kconfig" -source "drivers/net/ethernet/cirrus/Kconfig" -source "drivers/net/ethernet/cisco/Kconfig" -source "drivers/net/ethernet/cortina/Kconfig" source "drivers/net/ethernet/davicom/Kconfig" config DNET @@ -83,6 +84,7 @@ source "drivers/net/ethernet/i825xx/Kconfig" source "drivers/net/ethernet/ibm/Kconfig" source "drivers/net/ethernet/intel/Kconfig" +source "drivers/net/ethernet/microsoft/Kconfig" source "drivers/net/ethernet/xscale/Kconfig" config JME @@ -125,9 +127,8 @@ source "drivers/net/ethernet/mellanox/Kconfig" source "drivers/net/ethernet/micrel/Kconfig" source "drivers/net/ethernet/microchip/Kconfig" +source "drivers/net/ethernet/moxa/Kconfig" source "drivers/net/ethernet/mscc/Kconfig" -source "drivers/net/ethernet/microsoft/Kconfig" -source "drivers/net/ethernet/moxa/Kconfig" source "drivers/net/ethernet/myricom/Kconfig" config FEALNX @@ -139,10 +140,10 @@ Say Y here to support the Myson MTD-800 family of PCI-based Ethernet cards. -source "drivers/net/ethernet/ni/Kconfig" source "drivers/net/ethernet/natsemi/Kconfig" source "drivers/net/ethernet/neterion/Kconfig" source "drivers/net/ethernet/netronome/Kconfig" +source "drivers/net/ethernet/ni/Kconfig" source "drivers/net/ethernet/8390/Kconfig" source "drivers/net/ethernet/nvidia/Kconfig" source "drivers/net/ethernet/nxp/Kconfig" @@ -162,7 +163,6 @@ source "drivers/net/ethernet/pasemi/Kconfig" source "drivers/net/ethernet/pensando/Kconfig" source "drivers/net/ethernet/qlogic/Kconfig" -source "drivers/net/ethernet/brocade/Kconfig" source "drivers/net/ethernet/qualcomm/Kconfig" source "drivers/net/ethernet/rdc/Kconfig" source "drivers/net/ethernet/realtek/Kconfig" @@ -170,10 +170,10 @@ source "drivers/net/ethernet/rocker/Kconfig" source "drivers/net/ethernet/samsung/Kconfig" source "drivers/net/ethernet/seeq/Kconfig" +source "drivers/net/ethernet/sfc/Kconfig" source "drivers/net/ethernet/sgi/Kconfig" source "drivers/net/ethernet/silan/Kconfig" source "drivers/net/ethernet/sis/Kconfig" -source "drivers/net/ethernet/sfc/Kconfig" source "drivers/net/ethernet/smsc/Kconfig" source "drivers/net/ethernet/socionext/Kconfig" source "drivers/net/ethernet/stmicro/Kconfig" reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -486,8 +486,8 @@ if (err < 0) goto err_exit; + for (i = 0U, aq_vec = self->aq_vec[0]; + self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) { - for (i = 0U; self->aq_vecs > i; ++i) { - aq_vec = self->aq_vec[i]; err = aq_vec_start(aq_vec); if (err < 0) goto err_exit; @@ -517,8 +517,8 @@ mod_timer(&self->polling_timer, jiffies + AQ_CFG_POLLING_TIMER_INTERVAL); } else { + for (i = 0U, aq_vec = self->aq_vec[0]; + self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) { - for (i = 0U; self->aq_vecs > i; ++i) { - aq_vec = self->aq_vec[i]; err = aq_pci_func_alloc_irq(self, i, self->ndev->name, aq_vec_isr, aq_vec, aq_vec_get_affinity_mask(aq_vec)); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -444,22 +444,22 @@ static int aq_pm_freeze(struct device *dev) { + return aq_suspend_common(dev, false); - return aq_suspend_common(dev, true); } static int aq_pm_suspend_poweroff(struct device *dev) { + return aq_suspend_common(dev, true); - return aq_suspend_common(dev, false); } static int aq_pm_thaw(struct device *dev) { + return atl_resume_common(dev, false); - return atl_resume_common(dev, true); } static int aq_pm_resume_restore(struct device *dev) { + return atl_resume_common(dev, true); - return atl_resume_common(dev, false); } static const struct dev_pm_ops aq_pm_ops = { reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/aquantia/atlantic/aq_vec.c @@ -43,8 +43,8 @@ if (!self) { err = -EINVAL; } else { + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; u64_stats_update_begin(&ring[AQ_VEC_RX_ID].stats.rx.syncp); ring[AQ_VEC_RX_ID].stats.rx.polls++; u64_stats_update_end(&ring[AQ_VEC_RX_ID].stats.rx.syncp); @@ -182,8 +182,8 @@ self->aq_hw_ops = aq_hw_ops; self->aq_hw = aq_hw; + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; err = aq_ring_init(&ring[AQ_VEC_TX_ID], ATL_RING_TX); if (err < 0) goto err_exit; @@ -224,8 +224,8 @@ unsigned int i = 0U; int err = 0; + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; err = self->aq_hw_ops->hw_ring_tx_start(self->aq_hw, &ring[AQ_VEC_TX_ID]); if (err < 0) @@ -248,8 +248,8 @@ struct aq_ring_s *ring = NULL; unsigned int i = 0U; + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; self->aq_hw_ops->hw_ring_tx_stop(self->aq_hw, &ring[AQ_VEC_TX_ID]); @@ -268,8 +268,8 @@ if (!self) goto err_exit; + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]); aq_ring_rx_deinit(&ring[AQ_VEC_RX_ID]); } @@ -297,8 +297,8 @@ if (!self) goto err_exit; + for (i = 0U, ring = self->ring[0]; + self->tx_rings > i; ++i, ring = self->ring[i]) { - for (i = 0U; self->tx_rings > i; ++i) { - ring = self->ring[i]; aq_ring_free(&ring[AQ_VEC_TX_ID]); if (i < self->rx_rings) aq_ring_free(&ring[AQ_VEC_RX_ID]); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -14153,6 +14153,10 @@ /* Stop Tx */ bnx2x_tx_disable(bp); + /* Delete all NAPI objects */ + bnx2x_del_all_napi(bp); + if (CNIC_LOADED(bp)) + bnx2x_del_all_napi_cnic(bp); netdev_reset_tc(bp->dev); del_timer_sync(&bp->timer); @@ -14257,11 +14261,6 @@ bnx2x_drain_tx_queues(bp); bnx2x_send_unload_req(bp, UNLOAD_RECOVERY); bnx2x_netif_stop(bp, 1); - bnx2x_del_all_napi(bp); - - if (CNIC_LOADED(bp)) - bnx2x_del_all_napi_cnic(bp); - bnx2x_free_irq(bp); /* Report UNLOAD_DONE to MCP */ diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2678,10 +2678,6 @@ u32 idx = le32_to_cpu(nqcmp->cq_handle_low); struct bnxt_cp_ring_info *cpr2; - /* No more budget for RX work */ - if (budget && work_done >= budget && idx == BNXT_RX_HDL) - break; - cpr2 = cpr->cp_ring_arr[idx]; work_done += __bnxt_poll_work(bp, cpr2, budget - work_done); @@ -10942,7 +10938,7 @@ if (bp->flags & BNXT_FLAG_CHIP_P5) return bnxt_rfs_supported(bp); - if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp) || !bp->rx_nr_rings) + if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp)) return false; vnics = 1 + bp->rx_nr_rings; @@ -13198,9 +13194,10 @@ goto init_dflt_ring_err; bp->tx_nr_rings_per_tc = bp->tx_nr_rings; - - bnxt_set_dflt_rfs(bp); - + if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { + bp->flags |= BNXT_FLAG_RFS; + bp->dev->features |= NETIF_F_NTUPLE; + } init_dflt_ring_err: bnxt_ulp_irq_restart(bp, rc); return rc; diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -76,7 +76,7 @@ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) __raw_writel(value, offset); else - writel_relaxed(value, offset); + writel(value, offset); } static inline u32 bcmgenet_readl(void __iomem *offset) @@ -84,7 +84,7 @@ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) return __raw_readl(offset); else - return readl_relaxed(offset); + return readl(offset); } static inline void dmadesc_set_length_status(struct bcmgenet_priv *priv, @@ -2035,11 +2035,6 @@ return skb; } -static void bcmgenet_hide_tsb(struct sk_buff *skb) -{ - __skb_pull(skb, sizeof(struct status_64)); -} - static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) { struct bcmgenet_priv *priv = netdev_priv(dev); @@ -2146,8 +2141,6 @@ } GENET_CB(skb)->last_cb = tx_cb_ptr; - - bcmgenet_hide_tsb(skb); skb_tx_timestamp(skb); /* Decrement total BD count and advance our write pointer */ reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/cadence/macb_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/cadence/macb_main.c @@ -1656,7 +1656,6 @@ unsigned int head = queue->tx_head; unsigned int tail = queue->tx_tail; struct macb *bp = queue->bp; - unsigned int head_idx, tbqp; if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) queue_writel(queue, ISR, MACB_BIT(TXUBR)); @@ -1664,13 +1663,6 @@ if (head == tail) return; - tbqp = queue_readl(queue, TBQP) / macb_dma_desc_get_size(bp); - tbqp = macb_adj_dma_desc_idx(bp, macb_tx_ring_wrap(bp, tbqp)); - head_idx = macb_adj_dma_desc_idx(bp, macb_tx_ring_wrap(bp, head)); - - if (tbqp == head_idx) - return; - macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/cavium/thunder/nic_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -59,7 +59,7 @@ /* MSI-X */ u8 num_vec; + bool irq_allocated[NIC_PF_MSIX_VECTORS]; - unsigned int irq_allocated[NIC_PF_MSIX_VECTORS]; char irq_name[NIC_PF_MSIX_VECTORS][20]; }; @@ -1150,7 +1150,7 @@ u64 intr; u8 vf; + if (irq == pci_irq_vector(nic->pdev, NIC_PF_INTR_ID_MBOX0)) - if (irq == nic->irq_allocated[NIC_PF_INTR_ID_MBOX0]) mbx = 0; else mbx = 1; @@ -1176,14 +1176,14 @@ for (irq = 0; irq < nic->num_vec; irq++) { if (nic->irq_allocated[irq]) + free_irq(pci_irq_vector(nic->pdev, irq), nic); + nic->irq_allocated[irq] = false; - free_irq(nic->irq_allocated[irq], nic); - nic->irq_allocated[irq] = 0; } } static int nic_register_interrupts(struct nicpf *nic) { + int i, ret; - int i, ret, irq; nic->num_vec = pci_msix_vec_count(nic->pdev); /* Enable MSI-X */ @@ -1201,13 +1201,13 @@ sprintf(nic->irq_name[i], "NICPF Mbox%d", (i - NIC_PF_INTR_ID_MBOX0)); + ret = request_irq(pci_irq_vector(nic->pdev, i), + nic_mbx_intr_handler, 0, - irq = pci_irq_vector(nic->pdev, i); - ret = request_irq(irq, nic_mbx_intr_handler, 0, nic->irq_name[i], nic); if (ret) goto fail; + nic->irq_allocated[i] = true; - nic->irq_allocated[i] = irq; } /* Enable mailbox interrupt */ reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/faraday/ftgmac100.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/faraday/ftgmac100.c @@ -1835,6 +1835,11 @@ priv->rxdes0_edorr_mask = BIT(30); priv->txdes0_edotr_mask = BIT(30); priv->is_aspeed = true; + /* Disable ast2600 problematic HW arbitration */ + if (of_device_is_compatible(np, "aspeed,ast2600-mac")) { + iowrite32(FTGMAC100_TM_DEFAULT, + priv->base + FTGMAC100_OFFSET_TM); + } } else { priv->rxdes0_edorr_mask = BIT(15); priv->txdes0_edotr_mask = BIT(15); @@ -1906,11 +1911,6 @@ err = ftgmac100_setup_clk(priv); if (err) goto err_phy_connect; - - /* Disable ast2600 problematic HW arbitration */ - if (of_device_is_compatible(np, "aspeed,ast2600-mac")) - iowrite32(FTGMAC100_TM_DEFAULT, - priv->base + FTGMAC100_OFFSET_TM); } /* Default ring sizes */ reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -489,15 +489,11 @@ info->phc_index = -1; fman_node = of_get_parent(mac_node); + if (fman_node) - if (fman_node) { ptp_node = of_parse_phandle(fman_node, "ptimer-handle", 0); - of_node_put(fman_node); - } + if (ptp_node) - if (ptp_node) { ptp_dev = of_find_device_by_node(ptp_node); - of_node_put(ptp_node); - } if (ptp_dev) ptp = platform_get_drvdata(ptp_dev); diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -308,6 +308,10 @@ if (tc < 0 || tc >= priv->num_tx_rings) return -EINVAL; + /* Do not support TXSTART and TX CSUM offload simutaniously */ + if (ndev->features & NETIF_F_CSUM_MASK) + return -EBUSY; + /* TSD and Qbv are mutually exclusive in hardware */ if (enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) return -EBUSY; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/freescale/fec_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/freescale/fec_main.c @@ -3731,7 +3731,7 @@ ARRAY_SIZE(out_val)); if (ret) { dev_dbg(&fep->pdev->dev, "no stop mode property\n"); + return ret; - goto out; } fep->stop_gpr.gpr = syscon_node_to_regmap(gpr_np); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c @@ -75,7 +75,7 @@ ret = hclge_comm_cmd_send(hw, &desc, 1); if (ret) { dev_err(&hw->cmq.csq.pdev->dev, + "failed to get tqp stat, ret = %d, tx = %u.\n", - "failed to get tqp stat, ret = %d, rx = %u.\n", ret, i); return ret; } @@ -89,7 +89,7 @@ ret = hclge_comm_cmd_send(hw, &desc, 1); if (ret) { dev_err(&hw->cmq.csq.pdev->dev, + "failed to get tqp stat, ret = %d, rx = %u.\n", - "failed to get tqp stat, ret = %d, tx = %u.\n", ret, i); return ret; } diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5132,13 +5132,6 @@ set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state); } -static void hns3_state_uninit(struct hnae3_handle *handle) -{ - struct hns3_nic_priv *priv = handle->priv; - - clear_bit(HNS3_NIC_STATE_INITED, &priv->state); -} - static int hns3_client_init(struct hnae3_handle *handle) { struct pci_dev *pdev = handle->pdev; @@ -5256,9 +5249,7 @@ return ret; out_reg_netdev_fail: - hns3_state_uninit(handle); hns3_dbg_uninit(handle); - hns3_client_stop(handle); out_client_start: hns3_free_rx_cpu_rmap(netdev); hns3_nic_uninit_irq(priv); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -94,13 +94,6 @@ enum hclge_comm_cmd_status status; struct hclge_desc desc; - if (msg_len > HCLGE_MBX_MAX_MSG_SIZE) { - dev_err(&hdev->pdev->dev, - "msg data length(=%u) exceeds maximum(=%u)\n", - msg_len, HCLGE_MBX_MAX_MSG_SIZE); - return -EMSGSIZE; - } - resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data; hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false); @@ -183,7 +176,7 @@ ring_num = req->msg.ring_num; if (ring_num > HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM) + return -ENOMEM; - return -EINVAL; for (i = 0; i < ring_num; i++) { if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) { @@ -594,9 +587,9 @@ return hclge_set_vport_mtu(vport, mtu); } +static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, + struct hclge_mbx_vf_to_pf_cmd *mbx_req, + struct hclge_respond_to_vf_msg *resp_msg) -static int hclge_get_queue_id_in_pf(struct hclge_vport *vport, - struct hclge_mbx_vf_to_pf_cmd *mbx_req, - struct hclge_respond_to_vf_msg *resp_msg) { struct hnae3_handle *handle = &vport->nic; struct hclge_dev *hdev = vport->back; @@ -606,18 +599,17 @@ if (queue_id >= handle->kinfo.num_tqps) { dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", queue_id, mbx_req->mbx_src_vfid); + return; - return -EINVAL; } qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); resp_msg->len = sizeof(qid_in_pf); - return 0; } +static void hclge_get_rss_key(struct hclge_vport *vport, + struct hclge_mbx_vf_to_pf_cmd *mbx_req, + struct hclge_respond_to_vf_msg *resp_msg) -static int hclge_get_rss_key(struct hclge_vport *vport, - struct hclge_mbx_vf_to_pf_cmd *mbx_req, - struct hclge_respond_to_vf_msg *resp_msg) { #define HCLGE_RSS_MBX_RESP_LEN 8 struct hclge_dev *hdev = vport->back; @@ -635,14 +627,13 @@ dev_warn(&hdev->pdev->dev, "failed to get the rss hash key, the index(%u) invalid !\n", index); + return; - return -EINVAL; } memcpy(resp_msg->data, &rss_cfg->rss_hash_key[index * HCLGE_RSS_MBX_RESP_LEN], HCLGE_RSS_MBX_RESP_LEN); resp_msg->len = HCLGE_RSS_MBX_RESP_LEN; - return 0; } static void hclge_link_fail_parse(struct hclge_dev *hdev, u8 link_fail_code) @@ -818,10 +809,10 @@ "VF fail(%d) to set mtu\n", ret); break; case HCLGE_MBX_GET_QID_IN_PF: + hclge_get_queue_id_in_pf(vport, req, &resp_msg); - ret = hclge_get_queue_id_in_pf(vport, req, &resp_msg); break; case HCLGE_MBX_GET_RSS_KEY: + hclge_get_rss_key(vport, req, &resp_msg); - ret = hclge_get_rss_key(vport, req, &resp_msg); break; case HCLGE_MBX_GET_LINK_MODE: hclge_get_link_mode(vport, req); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c @@ -771,7 +771,7 @@ /* If we only have one page, still need to get shadown wqe when * wqe rolling-over page */ + if (curr_pg != end_pg || MASKED_WQE_IDX(wq, end_prod_idx) < *prod_idx) { - if (curr_pg != end_pg || end_prod_idx < *prod_idx) { void *shadow_addr = &wq->shadow_wqe[curr_pg * wq->max_wqe_size]; copy_wqe_to_shadow(wq, shadow_addr, num_wqebbs, *prod_idx); @@ -841,10 +841,7 @@ *cons_idx = curr_cons_idx; + if (curr_pg != end_pg) { - /* If we only have one page, still need to get shadown wqe when - * wqe rolling-over page - */ - if (curr_pg != end_pg || end_cons_idx < curr_cons_idx) { void *shadow_addr = &wq->shadow_wqe[curr_pg * wq->max_wqe_size]; copy_wqe_to_shadow(wq, shadow_addr, num_wqebbs, *cons_idx); diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.c linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.c @@ -3209,8 +3209,13 @@ { struct ibmvnic_adapter *adapter = netdev_priv(netdev); - ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; - ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; + if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { + ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; + ring->tx_max_pending = adapter->max_tx_entries_per_subcrq; + } else { + ring->rx_max_pending = IBMVNIC_MAX_QUEUE_SZ; + ring->tx_max_pending = IBMVNIC_MAX_QUEUE_SZ; + } ring->rx_mini_max_pending = 0; ring->rx_jumbo_max_pending = 0; ring->rx_pending = adapter->req_rx_add_entries_per_subcrq; @@ -3225,21 +3230,23 @@ struct netlink_ext_ack *extack) { struct ibmvnic_adapter *adapter = netdev_priv(netdev); + int ret; - if (ring->rx_pending > adapter->max_rx_add_entries_per_subcrq || - ring->tx_pending > adapter->max_tx_entries_per_subcrq) { - netdev_err(netdev, "Invalid request.\n"); - netdev_err(netdev, "Max tx buffers = %llu\n", - adapter->max_rx_add_entries_per_subcrq); - netdev_err(netdev, "Max rx buffers = %llu\n", - adapter->max_tx_entries_per_subcrq); - return -EINVAL; - } - + ret = 0; adapter->desired.rx_entries = ring->rx_pending; adapter->desired.tx_entries = ring->tx_pending; - return wait_for_reset(adapter); + ret = wait_for_reset(adapter); + + if (!ret && + (adapter->req_rx_add_entries_per_subcrq != ring->rx_pending || + adapter->req_tx_entries_per_subcrq != ring->tx_pending)) + netdev_info(netdev, + "Could not match full ringsize request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n", + ring->rx_pending, ring->tx_pending, + adapter->req_rx_add_entries_per_subcrq, + adapter->req_tx_entries_per_subcrq); + return ret; } static void ibmvnic_get_channels(struct net_device *netdev, @@ -3247,8 +3254,14 @@ { struct ibmvnic_adapter *adapter = netdev_priv(netdev); - channels->max_rx = adapter->max_rx_queues; - channels->max_tx = adapter->max_tx_queues; + if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { + channels->max_rx = adapter->max_rx_queues; + channels->max_tx = adapter->max_tx_queues; + } else { + channels->max_rx = IBMVNIC_MAX_QUEUES; + channels->max_tx = IBMVNIC_MAX_QUEUES; + } + channels->max_other = 0; channels->max_combined = 0; channels->rx_count = adapter->req_rx_queues; @@ -3261,11 +3274,22 @@ struct ethtool_channels *channels) { struct ibmvnic_adapter *adapter = netdev_priv(netdev); + int ret; + ret = 0; adapter->desired.rx_queues = channels->rx_count; adapter->desired.tx_queues = channels->tx_count; - return wait_for_reset(adapter); + ret = wait_for_reset(adapter); + + if (!ret && + (adapter->req_rx_queues != channels->rx_count || + adapter->req_tx_queues != channels->tx_count)) + netdev_info(netdev, + "Could not match full channels request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n", + channels->rx_count, channels->tx_count, + adapter->req_rx_queues, adapter->req_tx_queues); + return ret; } static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data) @@ -3273,32 +3297,43 @@ struct ibmvnic_adapter *adapter = netdev_priv(dev); int i; - if (stringset != ETH_SS_STATS) + switch (stringset) { + case ETH_SS_STATS: + for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); + i++, data += ETH_GSTRING_LEN) + memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN); + + for (i = 0; i < adapter->req_tx_queues; i++) { + snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i); + data += ETH_GSTRING_LEN; + + snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i); + data += ETH_GSTRING_LEN; + + snprintf(data, ETH_GSTRING_LEN, + "tx%d_dropped_packets", i); + data += ETH_GSTRING_LEN; + } + + for (i = 0; i < adapter->req_rx_queues; i++) { + snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i); + data += ETH_GSTRING_LEN; + + snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i); + data += ETH_GSTRING_LEN; + + snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i); + data += ETH_GSTRING_LEN; + } + break; + + case ETH_SS_PRIV_FLAGS: + for (i = 0; i < ARRAY_SIZE(ibmvnic_priv_flags); i++) + strcpy(data + i * ETH_GSTRING_LEN, + ibmvnic_priv_flags[i]); + break; + default: return; - - for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN) - memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN); - - for (i = 0; i < adapter->req_tx_queues; i++) { - snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i); - data += ETH_GSTRING_LEN; - - snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i); - data += ETH_GSTRING_LEN; - - snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i); - data += ETH_GSTRING_LEN; - } - - for (i = 0; i < adapter->req_rx_queues; i++) { - snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i); - data += ETH_GSTRING_LEN; - - snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i); - data += ETH_GSTRING_LEN; - - snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i); - data += ETH_GSTRING_LEN; } } @@ -3311,6 +3346,8 @@ return ARRAY_SIZE(ibmvnic_stats) + adapter->req_tx_queues * NUM_TX_STATS + adapter->req_rx_queues * NUM_RX_STATS; + case ETH_SS_PRIV_FLAGS: + return ARRAY_SIZE(ibmvnic_priv_flags); default: return -EOPNOTSUPP; } @@ -3363,6 +3400,26 @@ } } +static u32 ibmvnic_get_priv_flags(struct net_device *netdev) +{ + struct ibmvnic_adapter *adapter = netdev_priv(netdev); + + return adapter->priv_flags; +} + +static int ibmvnic_set_priv_flags(struct net_device *netdev, u32 flags) +{ + struct ibmvnic_adapter *adapter = netdev_priv(netdev); + bool which_maxes = !!(flags & IBMVNIC_USE_SERVER_MAXES); + + if (which_maxes) + adapter->priv_flags |= IBMVNIC_USE_SERVER_MAXES; + else + adapter->priv_flags &= ~IBMVNIC_USE_SERVER_MAXES; + + return 0; +} + static const struct ethtool_ops ibmvnic_ethtool_ops = { .get_drvinfo = ibmvnic_get_drvinfo, .get_msglevel = ibmvnic_get_msglevel, @@ -3376,6 +3433,8 @@ .get_sset_count = ibmvnic_get_sset_count, .get_ethtool_stats = ibmvnic_get_ethtool_stats, .get_link_ksettings = ibmvnic_get_link_ksettings, + .get_priv_flags = ibmvnic_get_priv_flags, + .set_priv_flags = ibmvnic_set_priv_flags, }; /* Routines for managing CRQs/sCRQs */ diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.h linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.h --- linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.h +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/ibm/ibmvnic.h @@ -41,6 +41,11 @@ #define IBMVNIC_RESET_DELAY 100 +static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = { +#define IBMVNIC_USE_SERVER_MAXES 0x1 + "use-server-maxes" +}; + struct ibmvnic_login_buffer { __be32 len; __be32 version; @@ -878,6 +883,7 @@ struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl; dma_addr_t ip_offload_ctrl_tok; u32 msg_enable; + u32 priv_flags; /* Vital Product Data (VPD) */ struct ibmvnic_vpd *vpd; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1009,8 +1009,8 @@ { u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) | link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND; + u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ + u16 lat_enc_d = 0; /* latency decoded */ - u32 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ - u32 lat_enc_d = 0; /* latency decoded */ u16 lat_enc = 0; /* latency encoded */ if (link) { diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/e1000e/netdev.c linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/e1000e/netdev.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/e1000e/netdev.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6492,10 +6492,6 @@ if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID && hw->mac.type >= e1000_pch_adp) { - /* Keep the GPT clock enabled for CSME */ - mac_data = er32(FEXTNVM); - mac_data |= BIT(3); - ew32(FEXTNVM, mac_data); /* Request ME unconfigure the device from S0ix */ mac_data = er32(H2ME); mac_data &= ~E1000_H2ME_START_DPG; diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/iavf/iavf_main.c linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/iavf/iavf_main.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/iavf/iavf_main.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2817,6 +2817,7 @@ running = adapter->state == __IAVF_RUNNING; if (running) { + netdev->flags &= ~IFF_UP; netif_carrier_off(netdev); netif_tx_stop_all_queues(netdev); adapter->link_up = false; @@ -2933,7 +2934,7 @@ * to __IAVF_RUNNING */ iavf_up_complete(adapter); - + netdev->flags |= IFF_UP; iavf_irq_enable(adapter, true); } else { iavf_change_state(adapter, __IAVF_DOWN); @@ -2949,8 +2950,10 @@ reset_err: mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->crit_lock); - if (running) + if (running) { iavf_change_state(adapter, __IAVF_RUNNING); + netdev->flags |= IFF_UP; + } dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); iavf_close(netdev); } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_arfs.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/ice/ice_arfs.c @@ -577,7 +577,7 @@ { struct net_device *netdev; + if (!vsi || vsi->type != ICE_VSI_PF || !vsi->arfs_fltr_list) - if (!vsi || vsi->type != ICE_VSI_PF) return; netdev = vsi->netdev; @@ -599,7 +599,7 @@ int base_idx, i; if (!vsi || vsi->type != ICE_VSI_PF) + return -EINVAL; - return 0; pf = vsi->back; netdev = vsi->netdev; @@ -636,6 +636,7 @@ if (!pf_vsi) return; + ice_free_cpu_rx_rmap(pf_vsi); ice_clear_arfs(pf_vsi); } @@ -652,5 +653,9 @@ return; ice_remove_arfs(pf); + if (ice_set_cpu_rx_rmap(pf_vsi)) { + dev_err(ice_pf_to_dev(pf), "Failed to rebuild aRFS\n"); + return; + } ice_init_arfs(pf_vsi); } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_eswitch.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/ice/ice_eswitch.c @@ -342,8 +342,7 @@ np = netdev_priv(netdev); vsi = np->vsi; + if (ice_is_reset_in_progress(vsi->back->state)) - if (ice_is_reset_in_progress(vsi->back->state) || - test_bit(ICE_VF_DIS, vsi->back->state)) return NETDEV_TX_BUSY; repr = ice_netdev_to_repr(netdev); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_eswitch.h +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/ice/ice_eswitch.h @@ -52,7 +52,7 @@ static inline int ice_eswitch_configure(struct ice_pf *pf) { + return -EOPNOTSUPP; - return 0; } static inline int ice_eswitch_rebuild(struct ice_pf *pf) diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_lib.c linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_lib.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_lib.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2869,8 +2869,6 @@ return; vsi->irqs_ready = false; - ice_free_cpu_rx_rmap(vsi); - ice_for_each_q_vector(vsi, i) { u16 vector = i + base; int irq_num; @@ -2884,8 +2882,7 @@ continue; /* clear the affinity notifier in the IRQ descriptor */ - if (!IS_ENABLED(CONFIG_RFS_ACCEL)) - irq_set_affinity_notifier(irq_num, NULL); + irq_set_affinity_notifier(irq_num, NULL); /* clear the affinity_mask in the IRQ descriptor */ irq_set_affinity_hint(irq_num, NULL); diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_main.c linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_main.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_main.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_main.c @@ -2494,13 +2494,6 @@ irq_set_affinity_hint(irq_num, &q_vector->affinity_mask); } - err = ice_set_cpu_rx_rmap(vsi); - if (err) { - netdev_err(vsi->netdev, "Failed to setup CPU RMAP on VSI %u: %pe\n", - vsi->vsi_num, ERR_PTR(err)); - goto free_q_irqs; - } - vsi->irqs_ready = true; return 0; @@ -3612,12 +3605,20 @@ */ ice_napi_add(vsi); + status = ice_set_cpu_rx_rmap(vsi); + if (status) { + dev_err(dev, "Failed to set CPU Rx map VSI %d error %d\n", + vsi->vsi_num, status); + goto unroll_napi_add; + } status = ice_init_mac_fltr(pf); if (status) - goto unroll_napi_add; + goto free_cpu_rx_map; return 0; +free_cpu_rx_map: + ice_free_cpu_rx_rmap(vsi); unroll_napi_add: ice_tc_indir_block_unregister(vsi); unroll_cfg_netdev: @@ -5075,6 +5076,7 @@ continue; ice_vsi_free_q_vectors(pf->vsi[v]); } + ice_free_cpu_rx_rmap(ice_get_main_vsi(pf)); ice_clear_interrupt_scheme(pf); pci_save_state(pdev); @@ -6662,15 +6664,12 @@ dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type); -#define ICE_EMP_RESET_SLEEP_MS 5000 if (reset_type == ICE_RESET_EMPR) { /* If an EMP reset has occurred, any previously pending flash * update will have completed. We no longer know whether or * not the NVM update EMP reset is restricted. */ pf->fw_emp_reset_disabled = false; - - msleep(ICE_EMP_RESET_SLEEP_MS); } err = ice_init_all_ctrlq(hw); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ice/ice_nvm.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/ice/ice_nvm.c @@ -641,7 +641,6 @@ status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0, orom_data, hw->flash.banks.orom_size); if (status) { - vfree(orom_data); ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n"); return status; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/igc/igc_i225.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/igc/igc_i225.c @@ -156,15 +156,8 @@ { u32 swfw_sync; + while (igc_get_hw_semaphore_i225(hw)) + ; /* Empty */ - /* Releasing the resource requires first getting the HW semaphore. - * If we fail to get the semaphore, there is nothing we can do, - * except log an error and quit. We are not allowed to hang here - * indefinitely, as it may cause denial of service or system crash. - */ - if (igc_get_hw_semaphore_i225(hw)) { - hw_dbg("Failed to release SW_FW_SYNC.\n"); - return; - } swfw_sync = rd32(IGC_SW_FW_SYNC); swfw_sync &= ~mask; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/igc/igc_phy.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/igc/igc_phy.c @@ -581,7 +581,7 @@ * the lower time out */ for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) { + usleep_range(500, 1000); - udelay(50); mdic = rd32(IGC_MDIC); if (mdic & IGC_MDIC_READY) break; @@ -638,7 +638,7 @@ * the lower time out */ for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) { + usleep_range(500, 1000); - udelay(50); mdic = rd32(IGC_MDIC); if (mdic & IGC_MDIC_READY) break; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/igc/igc_ptp.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -992,17 +992,6 @@ igc_ptp_write_i225(adapter, &ts); } -static void igc_ptm_stop(struct igc_adapter *adapter) -{ - struct igc_hw *hw = &adapter->hw; - u32 ctrl; - - ctrl = rd32(IGC_PTM_CTRL); - ctrl &= ~IGC_PTM_CTRL_EN; - - wr32(IGC_PTM_CTRL, ctrl); -} - /** * igc_ptp_suspend - Disable PTP work items and prepare for suspend * @adapter: Board private structure @@ -1020,10 +1009,8 @@ adapter->ptp_tx_skb = NULL; clear_bit_unlock(__IGC_PTP_TX_IN_PROGRESS, &adapter->state); + if (pci_device_is_present(adapter->pdev)) - if (pci_device_is_present(adapter->pdev)) { igc_ptp_time_save(adapter); - igc_ptm_stop(adapter); - } } /** reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c @@ -903,8 +903,7 @@ /* Tx IPsec offload doesn't seem to work on this * device, so block these requests for now. */ + if (!(sam->flags & XFRM_OFFLOAD_INBOUND)) { - sam->flags = sam->flags & ~XFRM_OFFLOAD_IPV6; - if (sam->flags != XFRM_OFFLOAD_INBOUND) { err = -EOPNOTSUPP; goto err_out; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -26,7 +26,6 @@ break; ss->regmap[i] = syscon_node_to_regmap(np); - of_node_put(np); if (IS_ERR(ss->regmap[i])) return PTR_ERR(ss->regmap[i]); } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c @@ -31,7 +31,6 @@ struct mlx5_rsc_dump { u32 pdn; u32 mkey; - u32 number_of_menu_items; u16 fw_segment_type[MLX5_SGMT_TYPE_NUM]; }; @@ -51,37 +50,21 @@ return -EINVAL; } +static void mlx5_rsc_dump_read_menu_sgmt(struct mlx5_rsc_dump *rsc_dump, struct page *page) -#define MLX5_RSC_DUMP_MENU_HEADER_SIZE (MLX5_ST_SZ_BYTES(resource_dump_info_segment) + \ - MLX5_ST_SZ_BYTES(resource_dump_command_segment) + \ - MLX5_ST_SZ_BYTES(resource_dump_menu_segment)) - -static int mlx5_rsc_dump_read_menu_sgmt(struct mlx5_rsc_dump *rsc_dump, struct page *page, - int read_size, int start_idx) { void *data = page_address(page); enum mlx5_sgmt_type sgmt_idx; int num_of_items; char *sgmt_name; void *member; - int size = 0; void *menu; int i; + menu = MLX5_ADDR_OF(menu_resource_dump_response, data, menu); + num_of_items = MLX5_GET(resource_dump_menu_segment, menu, num_of_records); - if (!start_idx) { - menu = MLX5_ADDR_OF(menu_resource_dump_response, data, menu); - rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu, - num_of_records); - size = MLX5_RSC_DUMP_MENU_HEADER_SIZE; - data += size; - } - num_of_items = rsc_dump->number_of_menu_items; - - for (i = 0; start_idx + i < num_of_items; i++) { - size += MLX5_ST_SZ_BYTES(resource_dump_menu_record); - if (size >= read_size) - return start_idx + i; + for (i = 0; i < num_of_items; i++) { + member = MLX5_ADDR_OF(resource_dump_menu_segment, menu, record[i]); - member = data + MLX5_ST_SZ_BYTES(resource_dump_menu_record) * i; sgmt_name = MLX5_ADDR_OF(resource_dump_menu_record, member, segment_name); sgmt_idx = mlx5_rsc_dump_sgmt_get_by_name(sgmt_name); if (sgmt_idx == -EINVAL) @@ -89,7 +72,6 @@ rsc_dump->fw_segment_type[sgmt_idx] = MLX5_GET(resource_dump_menu_record, member, segment_type); } - return 0; } static int mlx5_rsc_dump_trigger(struct mlx5_core_dev *dev, struct mlx5_rsc_dump_cmd *cmd, @@ -186,7 +168,6 @@ struct mlx5_rsc_dump_cmd *cmd = NULL; struct mlx5_rsc_key key = {}; struct page *page; - int start_idx = 0; int size; int err; @@ -208,7 +189,7 @@ if (err < 0) goto destroy_cmd; + mlx5_rsc_dump_read_menu_sgmt(dev->rsc_dump, page); - start_idx = mlx5_rsc_dump_read_menu_sgmt(dev->rsc_dump, page, size, start_idx); } while (err > 0); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c @@ -309,8 +309,8 @@ if (err) return err; + err = update_buffer_lossy(max_mtu, curr_pfc_en, prio2buffer, port_buff_cell_sz, + xoff, &port_buffer, &update_buffer); - err = update_buffer_lossy(max_mtu, curr_pfc_en, prio2buffer, xoff, - port_buff_cell_sz, &port_buffer, &update_buffer); if (err) return err; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -1739,8 +1739,6 @@ static void mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) { - struct mlx5e_priv *priv; - if (!refcount_dec_and_test(&ft->refcount)) return; @@ -1750,8 +1748,6 @@ rhashtable_free_and_destroy(&ft->ct_entries_ht, mlx5_tc_ct_flush_ft_entry, ct_priv); - priv = netdev_priv(ct_priv->netdev); - flush_workqueue(priv->wq); mlx5_tc_ct_free_pre_ct_tables(ft); mapping_remove(ct_priv->zone_mapping, ft->zone_restore_id); kfree(ft); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -713,7 +713,6 @@ struct net_device *filter_dev) { struct mlx5_esw_flow_attr *esw_attr = flow_attr->esw_attr; - struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5e_tc_int_port *int_port; TC_TUN_ROUTE_ATTR_INIT(attr); u16 vport_num; @@ -748,7 +747,7 @@ esw_attr->rx_tun_attr->vni = MLX5_GET(fte_match_param, spec->match_value, misc_parameters.vxlan_vni); esw_attr->rx_tun_attr->decap_vport = vport_num; + } else if (netif_is_ovs_master(attr.route_dev)) { - } else if (netif_is_ovs_master(attr.route_dev) && mlx5e_tc_int_port_supported(esw)) { int_port = mlx5e_tc_int_port_get(mlx5e_get_int_port_priv(priv), attr.route_dev->ifindex, MLX5E_TC_INT_PORT_INGRESS); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c @@ -1198,16 +1198,6 @@ if (err) return err; - if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_PCP && priv->dcbx.dscp_app_cnt) { - /* - * Align the driver state with the register state. - * Temporary state change is required to enable the app list reset. - */ - priv->dcbx_dp.trust_state = MLX5_QPTS_TRUST_DSCP; - mlx5e_dcbnl_delete_app(priv); - priv->dcbx_dp.trust_state = MLX5_QPTS_TRUST_PCP; - } - mlx5e_params_calc_trust_tx_min_inline_mode(priv->mdev, &priv->channels.params, priv->dcbx_dp.trust_state); diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -2355,17 +2355,6 @@ match.key->vlan_priority); *match_level = MLX5_MATCH_L2; - - if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CVLAN) && - match.mask->vlan_eth_type && - MLX5_CAP_FLOWTABLE_TYPE(priv->mdev, - ft_field_support.outer_second_vid, - fs_type)) { - MLX5_SET(fte_match_set_misc, misc_c, - outer_second_cvlan_tag, 1); - spec->match_criteria_enable |= - MLX5_MATCH_MISC_PARAMETERS; - } } } else if (*match_level != MLX5_MATCH_NONE) { /* cvlan_tag enabled in match criteria and diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -139,7 +139,7 @@ if (mlx5_esw_indir_table_decap_vport(attr)) vport = mlx5_esw_indir_table_decap_vport(attr); - if (attr && !attr->chain && esw_attr->int_port) + if (esw_attr->int_port) metadata = mlx5e_tc_int_port_get_metadata_for_match(esw_attr->int_port); else reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -112,28 +112,6 @@ } } -static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) -{ - struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; - - del_timer_sync(&fw_reset->timer); -} - -static int mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health) -{ - struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; - - if (!test_and_clear_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags)) { - mlx5_core_warn(dev, "Reset request was already cleared\n"); - return -EALREADY; - } - - mlx5_stop_sync_reset_poll(dev); - if (poll_health) - mlx5_start_health_poll(dev); - return 0; -} - static void mlx5_sync_reset_reload_work(struct work_struct *work) { struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset, @@ -141,7 +119,6 @@ struct mlx5_core_dev *dev = fw_reset->dev; int err; - mlx5_sync_reset_clear_reset_requested(dev, false); mlx5_enter_error_state(dev, true); mlx5_unload_one(dev); err = mlx5_health_wait_pci_up(dev); @@ -151,6 +128,23 @@ mlx5_fw_reset_complete_reload(dev); } +static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) +{ + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + + del_timer_sync(&fw_reset->timer); +} + +static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health) +{ + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + + mlx5_stop_sync_reset_poll(dev); + clear_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags); + if (poll_health) + mlx5_start_health_poll(dev); +} + #define MLX5_RESET_POLL_INTERVAL (HZ / 10) static void poll_sync_reset(struct timer_list *t) { @@ -165,6 +159,7 @@ if (fatal_error) { mlx5_core_warn(dev, "Got Device Reset\n"); + mlx5_sync_reset_clear_reset_requested(dev, false); queue_work(fw_reset->wq, &fw_reset->reset_reload_work); return; } @@ -191,17 +186,13 @@ return mlx5_reg_mfrl_set(dev, MLX5_MFRL_REG_RESET_LEVEL3, 0, 2, false); } +static void mlx5_sync_reset_set_reset_requested(struct mlx5_core_dev *dev) -static int mlx5_sync_reset_set_reset_requested(struct mlx5_core_dev *dev) { struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; - if (test_and_set_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags)) { - mlx5_core_warn(dev, "Reset request was already set\n"); - return -EALREADY; - } mlx5_stop_health_poll(dev, true); + set_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags); mlx5_start_sync_reset_poll(dev); - return 0; } static void mlx5_fw_live_patch_event(struct work_struct *work) @@ -230,9 +221,7 @@ err ? "Failed" : "Sent"); return; } + mlx5_sync_reset_set_reset_requested(dev); - if (mlx5_sync_reset_set_reset_requested(dev)) - return; - err = mlx5_fw_reset_set_reset_sync_ack(dev); if (err) mlx5_core_warn(dev, "PCI Sync FW Update Reset Ack Failed. Error code: %d\n", err); @@ -330,8 +319,7 @@ struct mlx5_core_dev *dev = fw_reset->dev; int err; + mlx5_sync_reset_clear_reset_requested(dev, false); - if (mlx5_sync_reset_clear_reset_requested(dev, false)) - return; mlx5_core_warn(dev, "Sync Reset now. Device is going to reset.\n"); @@ -360,8 +348,10 @@ reset_abort_work); struct mlx5_core_dev *dev = fw_reset->dev; + if (!test_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags)) - if (mlx5_sync_reset_clear_reset_requested(dev, true)) return; + + mlx5_sync_reset_clear_reset_requested(dev, true); mlx5_core_warn(dev, "PCI Sync FW Update Reset Aborted.\n"); } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c @@ -100,14 +100,6 @@ flush_workqueue(mp->wq); } -static void mlx5_lag_fib_set(struct lag_mp *mp, struct fib_info *fi, u32 dst, int dst_len) -{ - mp->fib.mfi = fi; - mp->fib.priority = fi->fib_priority; - mp->fib.dst = dst; - mp->fib.dst_len = dst_len; -} - struct mlx5_fib_event_work { struct work_struct work; struct mlx5_lag *ldev; @@ -118,10 +110,10 @@ }; }; +static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev, + unsigned long event, + struct fib_info *fi) -static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev, unsigned long event, - struct fib_entry_notifier_info *fen_info) { - struct fib_info *fi = fen_info->fi; struct lag_mp *mp = &ldev->lag_mp; struct fib_nh *fib_nh0, *fib_nh1; unsigned int nhs; @@ -129,15 +121,13 @@ /* Handle delete event */ if (event == FIB_EVENT_ENTRY_DEL) { /* stop track */ + if (mp->mfi == fi) + mp->mfi = NULL; - if (mp->fib.mfi == fi) - mp->fib.mfi = NULL; return; } /* Handle multipath entry with lower priority value */ + if (mp->mfi && mp->mfi != fi && fi->fib_priority >= mp->mfi->fib_priority) - if (mp->fib.mfi && mp->fib.mfi != fi && - (mp->fib.dst != fen_info->dst || mp->fib.dst_len != fen_info->dst_len) && - fi->fib_priority >= mp->fib.priority) return; /* Handle add/replace event */ @@ -153,9 +143,9 @@ i++; mlx5_lag_set_port_affinity(ldev, i); - mlx5_lag_fib_set(mp, fi, fen_info->dst, fen_info->dst_len); } + mp->mfi = fi; return; } @@ -175,7 +165,7 @@ } /* First time we see multipath route */ + if (!mp->mfi && !__mlx5_lag_is_active(ldev)) { - if (!mp->fib.mfi && !__mlx5_lag_is_active(ldev)) { struct lag_tracker tracker; tracker = ldev->tracker; @@ -183,7 +173,7 @@ } mlx5_lag_set_port_affinity(ldev, MLX5_LAG_NORMAL_AFFINITY); + mp->mfi = fi; - mlx5_lag_fib_set(mp, fi, fen_info->dst, fen_info->dst_len); } static void mlx5_lag_fib_nexthop_event(struct mlx5_lag *ldev, @@ -194,7 +184,7 @@ struct lag_mp *mp = &ldev->lag_mp; /* Check the nh event is related to the route */ + if (!mp->mfi || mp->mfi != fi) - if (!mp->fib.mfi || mp->fib.mfi != fi) return; /* nh added/removed */ @@ -224,7 +214,7 @@ case FIB_EVENT_ENTRY_REPLACE: case FIB_EVENT_ENTRY_DEL: mlx5_lag_fib_route_event(ldev, fib_work->event, + fib_work->fen_info.fi); - &fib_work->fen_info); fib_info_put(fib_work->fen_info.fi); break; case FIB_EVENT_NH_ADD: @@ -323,7 +313,7 @@ /* Clear mfi, as it might become stale when a route delete event * has been missed, see mlx5_lag_fib_route_event(). */ + ldev->lag_mp.mfi = NULL; - ldev->lag_mp.fib.mfi = NULL; } int mlx5_lag_mp_init(struct mlx5_lag *ldev) @@ -334,7 +324,7 @@ /* always clear mfi, as it might become stale when a route delete event * has been missed */ + mp->mfi = NULL; - mp->fib.mfi = NULL; if (mp->fib_nb.notifier_call) return 0; @@ -364,5 +354,5 @@ unregister_fib_notifier(&init_net, &mp->fib_nb); destroy_workqueue(mp->wq); mp->fib_nb.notifier_call = NULL; + mp->mfi = NULL; - mp->fib.mfi = NULL; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.h +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.h @@ -15,12 +15,7 @@ struct lag_mp { struct notifier_block fib_nb; + struct fib_info *mfi; /* used in tracking fib events */ - struct { - const void *mfi; /* used in tracking fib events */ - u32 priority; - u32 dst; - int dst_len; - } fib; struct workqueue_struct *wq; }; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c @@ -505,7 +505,7 @@ struct ttc_params ttc_params = {}; mlx5_lag_set_inner_ttc_params(ldev, &ttc_params); + port_sel->inner.ttc = mlx5_create_ttc_table(dev, &ttc_params); - port_sel->inner.ttc = mlx5_create_inner_ttc_table(dev, &ttc_params); if (IS_ERR(port_sel->inner.ttc)) return PTR_ERR(port_sel->inner.ttc); reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c @@ -408,8 +408,6 @@ for (tt = 0; tt < MLX5_NUM_TT; tt++) { struct mlx5_ttc_rule *rule = &rules[tt]; - if (test_bit(tt, params->ignore_dests)) - continue; rule->rule = mlx5_generate_inner_ttc_rule(dev, ft, ¶ms->dests[tt], ttc_rules[tt].etype, reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mellanox/mlxsw/i2c.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mellanox/mlxsw/i2c.c @@ -650,7 +650,6 @@ return 0; errout: - mutex_destroy(&mlxsw_i2c->cmd.lock); i2c_set_clientdata(client, NULL); return err; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/micrel/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/micrel/Kconfig @@ -39,7 +39,6 @@ config KS8851_MLL tristate "Micrel KS8851 MLL" depends on HAS_IOMEM - depends on PTP_1588_CLOCK_OPTIONAL select MII select CRC32 select EEPROM_93CX6 reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c @@ -346,8 +346,7 @@ lan966x_mac_process_raw_entry(&raw_entries[column], mac, &vid, &dest_idx); + WARN_ON(dest_idx > lan966x->num_phys_ports); - if (WARN_ON(dest_idx >= lan966x->num_phys_ports)) - continue; /* If the entry in SW is found, then there is nothing * to do @@ -393,8 +392,7 @@ lan966x_mac_process_raw_entry(&raw_entries[column], mac, &vid, &dest_idx); + WARN_ON(dest_idx > lan966x->num_phys_ports); - if (WARN_ON(dest_idx >= lan966x->num_phys_ports)) - continue; mac_entry = lan966x_mac_alloc_entry(mac, vid, dest_idx); if (!mac_entry) reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c @@ -261,7 +261,8 @@ if (netif_is_bridge_master(info->upper_dev) && !info->linking) switchdev_bridge_port_unoffload(port->dev, port, + &lan966x_switchdev_nb, + &lan966x_switchdev_blocking_nb); - NULL, NULL); return NOTIFY_DONE; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/mscc/ocelot.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/mscc/ocelot.c @@ -2508,8 +2508,6 @@ val = BIT(port); ocelot_rmw_rix(ocelot, val, BIT(port), ANA_PGID_PGID, PGID_MC); - ocelot_rmw_rix(ocelot, val, BIT(port), ANA_PGID_PGID, PGID_MCIPV4); - ocelot_rmw_rix(ocelot, val, BIT(port), ANA_PGID_PGID, PGID_MCIPV6); } static void ocelot_port_set_bcast_flood(struct ocelot *ocelot, int port, reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2903,9 +2903,11 @@ status = myri10ge_xmit(curr, dev); if (status != 0) { dev_kfree_skb_any(curr); + if (segs != NULL) { + curr = segs; + segs = next; - skb_list_walk_safe(next, curr, next) { curr->next = NULL; + dev_kfree_skb_any(segs); - dev_kfree_skb_any(curr); } goto drop; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/smsc/smsc911x.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/smsc/smsc911x.c @@ -2431,7 +2431,7 @@ if (irq == -EPROBE_DEFER) { retval = -EPROBE_DEFER; goto out_0; + } else if (irq <= 0) { - } else if (irq < 0) { pr_warn("Could not allocate irq resource\n"); retval = -ENODEV; goto out_0; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c @@ -57,6 +57,10 @@ #define TSE_PCS_USE_SGMII_ENA BIT(0) #define TSE_PCS_IF_USE_SGMII 0x03 +#define SGMII_ADAPTER_CTRL_REG 0x00 +#define SGMII_ADAPTER_DISABLE 0x0001 +#define SGMII_ADAPTER_ENABLE 0x0000 + #define AUTONEGO_LINK_TIMER 20 static int tse_pcs_reset(void __iomem *base, struct tse_pcs *pcs) @@ -198,8 +202,12 @@ unsigned int speed) { void __iomem *tse_pcs_base = pcs->tse_pcs_base; + void __iomem *sgmii_adapter_base = pcs->sgmii_adapter_base; u32 val; + writew(SGMII_ADAPTER_ENABLE, + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + pcs->autoneg = phy_dev->autoneg; if (phy_dev->autoneg == AUTONEG_ENABLE) { reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h @@ -10,10 +10,6 @@ #include #include -#define SGMII_ADAPTER_CTRL_REG 0x00 -#define SGMII_ADAPTER_ENABLE 0x0000 -#define SGMII_ADAPTER_DISABLE 0x0001 - struct tse_pcs { struct device *dev; void __iomem *tse_pcs_base; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -454,7 +454,6 @@ plat->has_gmac4 = 1; plat->force_sf_dma_mode = 0; plat->tso_en = 1; - plat->sph_disable = 1; /* Multiplying factor to the clk_eee_i clock time * period to make it closer to 100 ns. This value reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -18,6 +18,9 @@ #include "altr_tse_pcs.h" +#define SGMII_ADAPTER_CTRL_REG 0x00 +#define SGMII_ADAPTER_DISABLE 0x0001 + #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII 0x2 @@ -59,13 +62,14 @@ { struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv; void __iomem *splitter_base = dwmac->splitter_base; + void __iomem *tse_pcs_base = dwmac->pcs.tse_pcs_base; void __iomem *sgmii_adapter_base = dwmac->pcs.sgmii_adapter_base; struct device *dev = dwmac->dev; struct net_device *ndev = dev_get_drvdata(dev); struct phy_device *phy_dev = ndev->phydev; u32 val; + if ((tse_pcs_base) && (sgmii_adapter_base)) - if (sgmii_adapter_base) writew(SGMII_ADAPTER_DISABLE, sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); @@ -89,11 +93,8 @@ writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); } + if (tse_pcs_base && sgmii_adapter_base) - if (phy_dev && sgmii_adapter_base) { - writew(SGMII_ADAPTER_ENABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); - } } static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev) reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -916,7 +916,6 @@ ret = mdio_mux_init(priv->device, mdio_mux, mdio_mux_syscon_switch_fn, &gmac->mux_handle, priv, priv->mii); - of_node_put(mdio_mux); return ret; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -71,9 +71,9 @@ writel(value, ioaddr + PTP_TCR); /* wait for present system time initialize to complete */ + return readl_poll_timeout(ioaddr + PTP_TCR, value, - return readl_poll_timeout_atomic(ioaddr + PTP_TCR, value, !(value & PTP_TCR_TSINIT), + 10000, 100000); - 10, 100000); } static int config_addend(void __iomem *ioaddr, u32 addend) reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7077,7 +7077,7 @@ dev_info(priv->device, "TSO feature enabled\n"); } + if (priv->dma_cap.sphen) { - if (priv->dma_cap.sphen && !priv->plat->sph_disable) { ndev->hw_features |= NETIF_F_GRO; priv->sph_cap = true; priv->sph = priv->sph_cap; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/ti/cpsw_new.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/ti/cpsw_new.c @@ -1246,10 +1246,8 @@ data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM, sizeof(struct cpsw_slave_data), GFP_KERNEL); + if (!data->slave_data) - if (!data->slave_data) { - of_node_put(tmp_node); return -ENOMEM; - } /* Populate all the child nodes here... */ @@ -1343,7 +1341,6 @@ err_node_put: of_node_put(port_np); - of_node_put(tmp_node); return ret; } diff -u linux-oem-5.17-5.17.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c linux-oem-5.17-5.17.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c --- linux-oem-5.17-5.17.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ linux-oem-5.17-5.17.0/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2082,14 +2082,15 @@ if (ret) goto cleanup_clk; - ret = axienet_mdio_setup(lp); - if (ret) - dev_warn(&pdev->dev, - "error registering MDIO bus: %d\n", ret); - + lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); + if (lp->phy_node) { + ret = axienet_mdio_setup(lp); + if (ret) + dev_warn(&pdev->dev, + "error registering MDIO bus: %d\n", ret); + } if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII || lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) { - lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (!lp->phy_node) { dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); ret = -EINVAL; reverted: --- linux-oem-5.17-5.17.0/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/ethernet/xilinx/xilinx_emaclite.c @@ -823,10 +823,10 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) { struct mii_bus *bus; + int rc; struct resource res; struct device_node *np = of_get_parent(lp->phy_node); struct device_node *npp; - int rc, ret; /* Don't register the MDIO bus if the phy_node or its parent node * can't be found. @@ -836,14 +836,8 @@ return -ENODEV; } npp = of_get_parent(np); + + of_address_to_resource(npp, 0, &res); - ret = of_address_to_resource(npp, 0, &res); - of_node_put(npp); - if (ret) { - dev_err(dev, "%s resource error!\n", - dev->of_node->full_name); - of_node_put(np); - return ret; - } if (lp->ndev->mem_start != res.start) { struct phy_device *phydev; phydev = of_phy_find_device(lp->phy_node); @@ -852,7 +846,6 @@ "MDIO of the phy is not registered yet\n"); else put_device(&phydev->mdio.dev); - of_node_put(np); return 0; } @@ -865,7 +858,6 @@ bus = mdiobus_alloc(); if (!bus) { dev_err(dev, "Failed to allocate mdiobus\n"); - of_node_put(np); return -ENOMEM; } @@ -878,7 +870,6 @@ bus->parent = dev; rc = of_mdiobus_register(bus, np); - of_node_put(np); if (rc) { dev_err(dev, "Failed to register mdio bus.\n"); goto err_register; reverted: --- linux-oem-5.17-5.17.0/drivers/net/hippi/rrunner.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/hippi/rrunner.c @@ -1355,9 +1355,7 @@ rrpriv->fw_running = 0; - spin_unlock_irqrestore(&rrpriv->lock, flags); del_timer_sync(&rrpriv->timer); - spin_lock_irqsave(&rrpriv->lock, flags); writel(0, ®s->TxPi); writel(0, ®s->IpRxPi); reverted: --- linux-oem-5.17-5.17.0/drivers/net/macvlan.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/macvlan.c @@ -460,10 +460,8 @@ return RX_HANDLER_CONSUMED; *pskb = skb; eth = eth_hdr(skb); + if (macvlan_forward_source(skb, port, eth->h_source)) - if (macvlan_forward_source(skb, port, eth->h_source)) { - kfree_skb(skb); return RX_HANDLER_CONSUMED; - } src = macvlan_hash_lookup(port, eth->h_source); if (src && src->mode != MACVLAN_MODE_VEPA && src->mode != MACVLAN_MODE_BRIDGE) { @@ -482,10 +480,8 @@ return RX_HANDLER_PASS; } + if (macvlan_forward_source(skb, port, eth->h_source)) - if (macvlan_forward_source(skb, port, eth->h_source)) { - kfree_skb(skb); return RX_HANDLER_CONSUMED; - } if (macvlan_passthru(port)) vlan = list_first_or_null_rcu(&port->vlans, struct macvlan_dev, list); reverted: --- linux-oem-5.17-5.17.0/drivers/net/mdio/fwnode_mdio.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/mdio/fwnode_mdio.c @@ -43,11 +43,6 @@ int rc; rc = fwnode_irq_get(child, 0); - /* Don't wait forever if the IRQ provider doesn't become available, - * just fall back to poll mode - */ - if (rc == -EPROBE_DEFER) - rc = driver_deferred_probe_check_state(&phy->mdio.dev); if (rc == -EPROBE_DEFER) return rc; reverted: --- linux-oem-5.17-5.17.0/drivers/net/mdio/mdio-mux-bcm6368.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/mdio/mdio-mux-bcm6368.c @@ -115,7 +115,7 @@ md->mii_bus = devm_mdiobus_alloc(&pdev->dev); if (!md->mii_bus) { dev_err(&pdev->dev, "mdiomux bus alloc failed\n"); + return ENOMEM; - return -ENOMEM; } bus = md->mii_bus; reverted: --- linux-oem-5.17-5.17.0/drivers/net/phy/marvell10g.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/phy/marvell10g.c @@ -880,7 +880,7 @@ cssr1 = phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_CSSR1); if (cssr1 < 0) + return val; - return cssr1; /* If the link settings are not resolved, mark the link down */ if (!(cssr1 & MV_PCS_CSSR1_RESOLVED)) { reverted: --- linux-oem-5.17-5.17.0/drivers/net/slip/slip.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/slip/slip.c @@ -469,7 +469,7 @@ spin_lock(&sl->lock); if (netif_queue_stopped(dev)) { + if (!netif_running(dev)) - if (!netif_running(dev) || !sl->tty) goto out; /* May be we must check transmitter timeout here ? diff -u linux-oem-5.17-5.17.0/drivers/net/tun.c linux-oem-5.17-5.17.0/drivers/net/tun.c --- linux-oem-5.17-5.17.0/drivers/net/tun.c +++ linux-oem-5.17-5.17.0/drivers/net/tun.c @@ -1106,7 +1106,7 @@ /* NETIF_F_LLTX requires to do our own update of trans_start */ queue = netdev_get_tx_queue(dev, txq); - txq_trans_cond_update(queue); + queue->trans_start = jiffies; /* Notify and wake up reader process */ if (tfile->flags & TUN_FASYNC) reverted: --- linux-oem-5.17-5.17.0/drivers/net/usb/aqc111.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/usb/aqc111.c @@ -1102,15 +1102,10 @@ if (start_of_descs != desc_offset) goto err; + /* self check desc_offset from header*/ + if (desc_offset >= skb_len) - /* self check desc_offset from header and make sure that the - * bounds of the metadata array are inside the SKB - */ - if (pkt_count * 2 + desc_offset >= skb_len) goto err; - /* Packets must not overlap the metadata array */ - skb_trim(skb, desc_offset); - if (pkt_count == 0) goto err; reverted: --- linux-oem-5.17-5.17.0/drivers/net/veth.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/veth.c @@ -320,7 +320,7 @@ rcu_read_lock(); rcv = rcu_dereference(priv->peer); + if (unlikely(!rcv)) { - if (unlikely(!rcv) || !pskb_may_pull(skb, ETH_HLEN)) { kfree_skb(skb); goto drop; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/virtio_net.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/virtio_net.c @@ -978,24 +978,6 @@ * xdp.data_meta were adjusted */ len = xdp.data_end - xdp.data + vi->hdr_len + metasize; - - /* recalculate headroom if xdp.data or xdp_data_meta - * were adjusted, note that offset should always point - * to the start of the reserved bytes for virtio_net - * header which are followed by xdp.data, that means - * that offset is equal to the headroom (when buf is - * starting at the beginning of the page, otherwise - * there is a base offset inside the page) but it's used - * with a different starting point (buf start) than - * xdp.data (buf start + vnet hdr size). If xdp.data or - * data_meta were adjusted by the xdp prog then the - * headroom size has changed and so has the offset, we - * can use data_hard_start, which points at buf start + - * vnet hdr size, to calculate the new headroom and use - * it later to compute buf start in page_to_skb() - */ - headroom = xdp.data - xdp.data_hard_start - metasize; - /* We can only create skb based on xdp_page. */ if (unlikely(xdp_page != page)) { rcu_read_unlock(); @@ -1003,7 +985,7 @@ head_skb = page_to_skb(vi, rq, xdp_page, offset, len, PAGE_SIZE, false, metasize, + VIRTIO_XDP_HEADROOM); - headroom); return head_skb; } break; diff -u linux-oem-5.17-5.17.0/drivers/net/vxlan.c linux-oem-5.17-5.17.0/drivers/net/vxlan.c --- linux-oem-5.17-5.17.0/drivers/net/vxlan.c +++ linux-oem-5.17-5.17.0/drivers/net/vxlan.c @@ -874,11 +874,11 @@ rd = kmalloc(sizeof(*rd), GFP_ATOMIC); if (rd == NULL) - return -ENOMEM; + return -ENOBUFS; if (dst_cache_init(&rd->dst_cache, GFP_ATOMIC)) { kfree(rd); - return -ENOMEM; + return -ENOBUFS; } rd->remote_ip = *ip; reverted: --- linux-oem-5.17-5.17.0/drivers/net/wireguard/device.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/wireguard/device.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -153,7 +152,7 @@ goto err_peer; } + mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; - mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; __skb_queue_head_init(&packets); if (!skb_is_gso(skb)) { diff -u linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath11k/mac.c linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath11k/mac.c --- linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath11k/mac.c +++ linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath11k/mac.c @@ -3131,20 +3131,6 @@ arvif->do_not_send_tmpl = true; else arvif->do_not_send_tmpl = false; - - if (vif->bss_conf.he_support) { - ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, - WMI_VDEV_PARAM_BA_MODE, - WMI_BA_MODE_BUFFER_SIZE_256); - if (ret) - ath11k_warn(ar->ab, - "failed to set BA BUFFER SIZE 256 for vdev: %d\n", - arvif->vdev_id); - else - ath11k_dbg(ar->ab, ATH11K_DBG_MAC, - "Set BA BUFFER SIZE 256 for VDEV: %d\n", - arvif->vdev_id); - } } if (changed & (BSS_CHANGED_BEACON_INFO | BSS_CHANGED_BEACON)) { @@ -3180,6 +3166,14 @@ if (arvif->is_up && vif->bss_conf.he_support && vif->bss_conf.he_oper.params) { + ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, + WMI_VDEV_PARAM_BA_MODE, + WMI_BA_MODE_BUFFER_SIZE_256); + if (ret) + ath11k_warn(ar->ab, + "failed to set BA BUFFER SIZE 256 for vdev: %d\n", + arvif->vdev_id); + param_id = WMI_VDEV_PARAM_HEOPS_0_31; param_value = vif->bss_conf.he_oper.params; ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, reverted: --- linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath9k/main.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/wireless/ath/ath9k/main.c @@ -839,7 +839,7 @@ continue; txinfo = IEEE80211_SKB_CB(bf->bf_mpdu); + fi = (struct ath_frame_info *)&txinfo->rate_driver_data[0]; - fi = (struct ath_frame_info *)&txinfo->status.status_driver_data[0]; if (fi->keyix == keyix) return true; } reverted: --- linux-oem-5.17-5.17.0/drivers/net/wireless/ath/ath9k/xmit.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/wireless/ath/ath9k/xmit.c @@ -141,8 +141,8 @@ { struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); BUILD_BUG_ON(sizeof(struct ath_frame_info) > + sizeof(tx_info->rate_driver_data)); + return (struct ath_frame_info *) &tx_info->rate_driver_data[0]; - sizeof(tx_info->status.status_driver_data)); - return (struct ath_frame_info *) &tx_info->status.status_driver_data[0]; } static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno) @@ -2542,16 +2542,6 @@ spin_unlock_irqrestore(&sc->tx.txbuflock, flags); } -static void ath_clear_tx_status(struct ieee80211_tx_info *tx_info) -{ - void *ptr = &tx_info->status; - - memset(ptr + sizeof(tx_info->status.rates), 0, - sizeof(tx_info->status) - - sizeof(tx_info->status.rates) - - sizeof(tx_info->status.status_driver_data)); -} - static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, struct ath_tx_status *ts, int nframes, int nbad, int txok) @@ -2563,8 +2553,6 @@ struct ath_hw *ah = sc->sc_ah; u8 i, tx_rateindex; - ath_clear_tx_status(tx_info); - if (txok) tx_info->status.ack_signal = ts->ts_rssi; @@ -2579,13 +2567,6 @@ tx_info->status.ampdu_len = nframes; tx_info->status.ampdu_ack_len = nframes - nbad; - tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; - - for (i = tx_rateindex + 1; i < hw->max_rates; i++) { - tx_info->status.rates[i].count = 0; - tx_info->status.rates[i].idx = -1; - } - if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) { /* @@ -2607,6 +2588,16 @@ tx_info->status.rates[tx_rateindex].count = hw->max_rate_tries; } + + for (i = tx_rateindex + 1; i < hw->max_rates; i++) { + tx_info->status.rates[i].count = 0; + tx_info->status.rates[i].idx = -1; + } + + tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; + + /* we report airtime in ath_tx_count_airtime(), don't report twice */ + tx_info->status.tx_time = 0; } static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) diff -u linux-oem-5.17-5.17.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c linux-oem-5.17-5.17.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c --- linux-oem-5.17-5.17.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ linux-oem-5.17-5.17.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -557,7 +557,7 @@ BRCMF_SDIO_FT_SUB, }; -#define SDIOD_DRVSTR_KEY(chip, pmu) (((unsigned int)(chip) << 16) | (pmu)) +#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) /* SDIO Pad drive strength to select value mappings */ struct sdiod_drive_str { reverted: --- linux-oem-5.17-5.17.0/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +++ linux-oem-5.17-5.17.0.orig/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c @@ -80,7 +80,7 @@ mt76_rmw_field(dev, 0x15a10, 0x1f << 16, 0x9); /* RG_SSUSB_G1_CDR_BIC_LTR = 0xf */ + mt76_rmw_field(dev, 0x15a0c, 0xf << 28, 0xf); - mt76_rmw_field(dev, 0x15a0c, 0xfU << 28, 0xf); /* RG_SSUSB_CDR_BR_PE1D = 0x3 */ mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3); reverted: --- linux-oem-5.17-5.17.0/drivers/nfc/nfcmrvl/main.c +++ linux-oem-5.17-5.17.0.orig/drivers/nfc/nfcmrvl/main.c @@ -183,7 +183,6 @@ { struct nci_dev *ndev = priv->ndev; - nci_unregister_device(ndev); if (priv->ndev->nfc_dev->fw_download_in_progress) nfcmrvl_fw_dnld_abort(priv); @@ -192,6 +191,7 @@ if (gpio_is_valid(priv->config.reset_n_io)) gpio_free(priv->config.reset_n_io); + nci_unregister_device(ndev); nci_free_device(ndev); kfree(priv); } diff -u linux-oem-5.17-5.17.0/drivers/nvme/host/core.c linux-oem-5.17-5.17.0/drivers/nvme/host/core.c --- linux-oem-5.17-5.17.0/drivers/nvme/host/core.c +++ linux-oem-5.17-5.17.0/drivers/nvme/host/core.c @@ -1363,8 +1363,6 @@ warn_str, cur->nidl); return -1; } - if (ctrl->quirks & NVME_QUIRK_BOGUS_NID) - return NVME_NIDT_EUI64_LEN; memcpy(ids->eui64, data + sizeof(*cur), NVME_NIDT_EUI64_LEN); return NVME_NIDT_EUI64_LEN; case NVME_NIDT_NGUID: @@ -1373,8 +1371,6 @@ warn_str, cur->nidl); return -1; } - if (ctrl->quirks & NVME_QUIRK_BOGUS_NID) - return NVME_NIDT_NGUID_LEN; memcpy(ids->nguid, data + sizeof(*cur), NVME_NIDT_NGUID_LEN); return NVME_NIDT_NGUID_LEN; case NVME_NIDT_UUID: @@ -1383,8 +1379,6 @@ warn_str, cur->nidl); return -1; } - if (ctrl->quirks & NVME_QUIRK_BOGUS_NID) - return NVME_NIDT_UUID_LEN; uuid_copy(&ids->uuid, data + sizeof(*cur)); return NVME_NIDT_UUID_LEN; case NVME_NIDT_CSI: @@ -1481,18 +1475,12 @@ if ((*id)->ncap == 0) /* namespace not allocated or attached */ goto out_free_id; - - if (ctrl->quirks & NVME_QUIRK_BOGUS_NID) { - dev_info(ctrl->device, - "Ignoring bogus Namespace Identifiers\n"); - } else { - if (ctrl->vs >= NVME_VS(1, 1, 0) && - !memchr_inv(ids->eui64, 0, sizeof(ids->eui64))) - memcpy(ids->eui64, (*id)->eui64, sizeof(ids->eui64)); - if (ctrl->vs >= NVME_VS(1, 2, 0) && - !memchr_inv(ids->nguid, 0, sizeof(ids->nguid))) - memcpy(ids->nguid, (*id)->nguid, sizeof(ids->nguid)); - } + if (ctrl->vs >= NVME_VS(1, 1, 0) && + !memchr_inv(ids->eui64, 0, sizeof(ids->eui64))) + memcpy(ids->eui64, (*id)->eui64, sizeof(ids->eui64)); + if (ctrl->vs >= NVME_VS(1, 2, 0) && + !memchr_inv(ids->nguid, 0, sizeof(ids->nguid))) + memcpy(ids->nguid, (*id)->nguid, sizeof(ids->nguid)); return 0; diff -u linux-oem-5.17-5.17.0/drivers/nvme/host/nvme.h linux-oem-5.17-5.17.0/drivers/nvme/host/nvme.h --- linux-oem-5.17-5.17.0/drivers/nvme/host/nvme.h +++ linux-oem-5.17-5.17.0/drivers/nvme/host/nvme.h @@ -144,11 +144,6 @@ * encoding the generation sequence number. */ NVME_QUIRK_SKIP_CID_GEN = (1 << 17), - - /* - * Reports garbage in the namespace identifiers (eui64, nguid, uuid). - */ - NVME_QUIRK_BOGUS_NID = (1 << 18), }; /* reverted: --- linux-oem-5.17-5.17.0/drivers/nvme/host/pci.c +++ linux-oem-5.17-5.17.0.orig/drivers/nvme/host/pci.c @@ -3405,10 +3405,7 @@ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ .driver_data = NVME_QUIRK_IDENTIFY_CNS | + NVME_QUIRK_DISABLE_WRITE_ZEROES, }, - NVME_QUIRK_DISABLE_WRITE_ZEROES | - NVME_QUIRK_BOGUS_NID, }, - { PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */ - .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */ .driver_data = NVME_QUIRK_NO_NS_DESC_LIST, }, { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */ @@ -3446,10 +3443,6 @@ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, - { PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */ - .driver_data = NVME_QUIRK_BOGUS_NID, }, - { PCI_DEVICE(0x1e4B, 0x1202), /* MAXIO MAP1202 */ - .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 -u linux-oem-5.17-5.17.0/drivers/pci/controller/pci-aardvark.c linux-oem-5.17-5.17.0/drivers/pci/controller/pci-aardvark.c --- linux-oem-5.17-5.17.0/drivers/pci/controller/pci-aardvark.c +++ linux-oem-5.17-5.17.0/drivers/pci/controller/pci-aardvark.c @@ -38,6 +38,10 @@ #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX_EN BIT(6) #define PCIE_CORE_ERR_CAPCTL_ECRC_CHCK BIT(7) #define PCIE_CORE_ERR_CAPCTL_ECRC_CHCK_RCV BIT(8) +#define PCIE_CORE_INT_A_ASSERT_ENABLE 1 +#define PCIE_CORE_INT_B_ASSERT_ENABLE 2 +#define PCIE_CORE_INT_C_ASSERT_ENABLE 3 +#define PCIE_CORE_INT_D_ASSERT_ENABLE 4 /* PIO registers base address and register offsets */ #define PIO_BASE_ADDR 0x4000 #define PIO_CTRL (PIO_BASE_ADDR + 0x0) @@ -98,10 +102,6 @@ #define PCIE_MSG_PM_PME_MASK BIT(7) #define PCIE_ISR0_MASK_REG (CONTROL_BASE_ADDR + 0x44) #define PCIE_ISR0_MSI_INT_PENDING BIT(24) -#define PCIE_ISR0_CORR_ERR BIT(11) -#define PCIE_ISR0_NFAT_ERR BIT(12) -#define PCIE_ISR0_FAT_ERR BIT(13) -#define PCIE_ISR0_ERR_MASK GENMASK(13, 11) #define PCIE_ISR0_INTX_ASSERT(val) BIT(16 + (val)) #define PCIE_ISR0_INTX_DEASSERT(val) BIT(20 + (val)) #define PCIE_ISR0_ALL_MASK GENMASK(31, 0) @@ -272,16 +272,17 @@ u32 actions; } wins[OB_WIN_COUNT]; u8 wins_count; - int irq; - struct irq_domain *rp_irq_domain; struct irq_domain *irq_domain; struct irq_chip irq_chip; raw_spinlock_t irq_lock; struct irq_domain *msi_domain; struct irq_domain *msi_inner_domain; - raw_spinlock_t msi_irq_lock; + struct irq_chip msi_bottom_irq_chip; + struct irq_chip msi_irq_chip; + struct msi_domain_info msi_domain_info; DECLARE_BITMAP(msi_used, MSI_IRQ_NUM); struct mutex msi_used_lock; + u16 msi_msg; int link_gen; struct pci_bridge_emul bridge; struct gpio_desc *reset_gpio; @@ -476,7 +477,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) { - phys_addr_t msi_addr; u32 reg; int i; @@ -565,11 +565,6 @@ reg |= LANE_COUNT_1; advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); - /* Set MSI address */ - msi_addr = virt_to_phys(pcie); - advk_writel(pcie, lower_32_bits(msi_addr), PCIE_MSI_ADDR_LOW_REG); - advk_writel(pcie, upper_32_bits(msi_addr), PCIE_MSI_ADDR_HIGH_REG); - /* Enable MSI */ reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); reg |= PCIE_CORE_CTRL2_MSI_ENABLE; @@ -581,20 +576,15 @@ advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG); advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG); - /* Disable All ISR0/1 and MSI Sources */ - advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_MASK_REG); - advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG); - advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG); - - /* Unmask summary MSI interrupt */ - reg = advk_readl(pcie, PCIE_ISR0_MASK_REG); + /* Disable All ISR0/1 Sources */ + reg = PCIE_ISR0_ALL_MASK; reg &= ~PCIE_ISR0_MSI_INT_PENDING; advk_writel(pcie, reg, PCIE_ISR0_MASK_REG); - /* Unmask PME interrupt for processing of PME requester */ - reg = advk_readl(pcie, PCIE_ISR0_MASK_REG); - reg &= ~PCIE_MSG_PM_PME_MASK; - advk_writel(pcie, reg, PCIE_ISR0_MASK_REG); + advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG); + + /* Unmask all MSIs */ + advk_writel(pcie, ~(u32)PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG); /* Enable summary interrupt for GIC SPI source */ reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); @@ -788,15 +778,11 @@ case PCI_INTERRUPT_LINE: { /* * From the whole 32bit register we support reading from HW only - * two bits: PCI_BRIDGE_CTL_BUS_RESET and PCI_BRIDGE_CTL_SERR. + * one bit: PCI_BRIDGE_CTL_BUS_RESET. * Other bits are retrieved only from emulated config buffer. */ __le32 *cfgspace = (__le32 *)&bridge->conf; u32 val = le32_to_cpu(cfgspace[PCI_INTERRUPT_LINE / 4]); - if (advk_readl(pcie, PCIE_ISR0_MASK_REG) & PCIE_ISR0_ERR_MASK) - val &= ~(PCI_BRIDGE_CTL_SERR << 16); - else - val |= PCI_BRIDGE_CTL_SERR << 16; if (advk_readl(pcie, PCIE_CORE_CTRL1_REG) & HOT_RESET_GEN) val |= PCI_BRIDGE_CTL_BUS_RESET << 16; else @@ -822,19 +808,6 @@ break; case PCI_INTERRUPT_LINE: - /* - * According to Figure 6-3: Pseudo Logic Diagram for Error - * Message Controls in PCIe base specification, SERR# Enable bit - * in Bridge Control register enable receiving of ERR_* messages - */ - if (mask & (PCI_BRIDGE_CTL_SERR << 16)) { - u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); - if (new & (PCI_BRIDGE_CTL_SERR << 16)) - val &= ~PCIE_ISR0_ERR_MASK; - else - val |= PCIE_ISR0_ERR_MASK; - advk_writel(pcie, val, PCIE_ISR0_MASK_REG); - } if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) { u32 val = advk_readl(pcie, PCIE_CORE_CTRL1_REG); if (new & (PCI_BRIDGE_CTL_BUS_RESET << 16)) @@ -862,11 +835,22 @@ *value = PCI_EXP_SLTSTA_PDS << 16; return PCI_BRIDGE_EMUL_HANDLED; - /* - * PCI_EXP_RTCTL and PCI_EXP_RTSTA are also supported, but do not need - * to be handled here, because their values are stored in emulated - * config space buffer, and we read them from there when needed. - */ + case PCI_EXP_RTCTL: { + u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); + *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; + *value |= le16_to_cpu(bridge->pcie_conf.rootctl) & PCI_EXP_RTCTL_CRSSVE; + *value |= PCI_EXP_RTCAP_CRSVIS << 16; + return PCI_BRIDGE_EMUL_HANDLED; + } + + case PCI_EXP_RTSTA: { + u32 isr0 = advk_readl(pcie, PCIE_ISR0_REG); + u32 msglog = advk_readl(pcie, PCIE_MSG_LOG_REG); + *value = msglog >> 16; + if (isr0 & PCIE_MSG_PM_PME_MASK) + *value |= PCI_EXP_RTSTA_PME; + return PCI_BRIDGE_EMUL_HANDLED; + } case PCI_EXP_LNKCAP: { u32 val = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); @@ -921,18 +905,19 @@ break; case PCI_EXP_RTCTL: { - u16 rootctl = le16_to_cpu(bridge->pcie_conf.rootctl); - /* Only emulation of PMEIE and CRSSVE bits is provided */ - rootctl &= PCI_EXP_RTCTL_PMEIE | PCI_EXP_RTCTL_CRSSVE; - bridge->pcie_conf.rootctl = cpu_to_le16(rootctl); + /* Only mask/unmask PME interrupt */ + u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG) & + ~PCIE_MSG_PM_PME_MASK; + if ((new & PCI_EXP_RTCTL_PMEIE) == 0) + val |= PCIE_MSG_PM_PME_MASK; + advk_writel(pcie, val, PCIE_ISR0_MASK_REG); break; } - /* - * PCI_EXP_RTSTA is also supported, but does not need to be handled - * here, because its value is stored in emulated config space buffer, - * and we write it there when needed. - */ + case PCI_EXP_RTSTA: + new = (new & PCI_EXP_RTSTA_PME) >> 9; + advk_writel(pcie, new, PCIE_ISR0_REG); + break; case PCI_EXP_DEVCTL: case PCI_EXP_DEVCTL2: @@ -976,7 +961,7 @@ bridge->conf.pref_mem_limit = cpu_to_le16(PCI_PREF_RANGE_TYPE_64); /* Support interrupt A for MSI feature */ - bridge->conf.intpin = PCI_INTERRUPT_INTA; + bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE; /* Aardvark HW provides PCIe Capability structure in version 2 */ bridge->pcie_conf.cap = cpu_to_le16(2); @@ -998,12 +983,8 @@ return false; /* - * If the link goes down after we check for link-up, we have a problem: - * if a PIO request is executed while link-down, the whole controller - * gets stuck in a non-functional state, and even after link comes up - * again, PIO requests won't work anymore, and a reset of the whole PCIe - * controller is needed. Therefore we need to prevent sending PIO - * requests while the link is down. + * If the link goes down after we check for link-up, nothing bad + * happens but the config access times out. */ if (!pci_is_root_bus(bus) && !advk_pcie_link_up(pcie)) return false; @@ -1201,10 +1182,10 @@ struct msi_msg *msg) { struct advk_pcie *pcie = irq_data_get_irq_chip_data(data); - phys_addr_t msi_addr = virt_to_phys(pcie); + phys_addr_t msi_msg = virt_to_phys(&pcie->msi_msg); - msg->address_lo = lower_32_bits(msi_addr); - msg->address_hi = upper_32_bits(msi_addr); + msg->address_lo = lower_32_bits(msi_msg); + msg->address_hi = upper_32_bits(msi_msg); msg->data = data->hwirq; } @@ -1214,54 +1195,6 @@ return -EINVAL; } -static void advk_msi_irq_mask(struct irq_data *d) -{ - struct advk_pcie *pcie = d->domain->host_data; - irq_hw_number_t hwirq = irqd_to_hwirq(d); - unsigned long flags; - u32 mask; - - raw_spin_lock_irqsave(&pcie->msi_irq_lock, flags); - mask = advk_readl(pcie, PCIE_MSI_MASK_REG); - mask |= BIT(hwirq); - advk_writel(pcie, mask, PCIE_MSI_MASK_REG); - raw_spin_unlock_irqrestore(&pcie->msi_irq_lock, flags); -} - -static void advk_msi_irq_unmask(struct irq_data *d) -{ - struct advk_pcie *pcie = d->domain->host_data; - irq_hw_number_t hwirq = irqd_to_hwirq(d); - unsigned long flags; - u32 mask; - - raw_spin_lock_irqsave(&pcie->msi_irq_lock, flags); - mask = advk_readl(pcie, PCIE_MSI_MASK_REG); - mask &= ~BIT(hwirq); - advk_writel(pcie, mask, PCIE_MSI_MASK_REG); - raw_spin_unlock_irqrestore(&pcie->msi_irq_lock, flags); -} - -static void advk_msi_top_irq_mask(struct irq_data *d) -{ - pci_msi_mask_irq(d); - irq_chip_mask_parent(d); -} - -static void advk_msi_top_irq_unmask(struct irq_data *d) -{ - pci_msi_unmask_irq(d); - irq_chip_unmask_parent(d); -} - -static struct irq_chip advk_msi_bottom_irq_chip = { - .name = "MSI", - .irq_compose_msi_msg = advk_msi_irq_compose_msi_msg, - .irq_set_affinity = advk_msi_set_affinity, - .irq_mask = advk_msi_irq_mask, - .irq_unmask = advk_msi_irq_unmask, -}; - static int advk_msi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *args) @@ -1278,7 +1211,7 @@ for (i = 0; i < nr_irqs; i++) irq_domain_set_info(domain, virq + i, hwirq + i, - &advk_msi_bottom_irq_chip, + &pcie->msi_bottom_irq_chip, domain->host_data, handle_simple_irq, NULL, NULL); @@ -1334,6 +1267,7 @@ { struct advk_pcie *pcie = h->host_data; + advk_pcie_irq_mask(irq_get_irq_data(virq)); irq_set_status_flags(virq, IRQ_LEVEL); irq_set_chip_and_handler(virq, &pcie->irq_chip, handle_level_irq); @@ -1347,25 +1281,37 @@ .xlate = irq_domain_xlate_onecell, }; -static struct irq_chip advk_msi_irq_chip = { - .name = "advk-MSI", - .irq_mask = advk_msi_top_irq_mask, - .irq_unmask = advk_msi_top_irq_unmask, -}; - -static struct msi_domain_info advk_msi_domain_info = { - .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX, - .chip = &advk_msi_irq_chip, -}; - static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie) { struct device *dev = &pcie->pdev->dev; + struct device_node *node = dev->of_node; + struct irq_chip *bottom_ic, *msi_ic; + struct msi_domain_info *msi_di; + phys_addr_t msi_msg_phys; - raw_spin_lock_init(&pcie->msi_irq_lock); mutex_init(&pcie->msi_used_lock); + bottom_ic = &pcie->msi_bottom_irq_chip; + + bottom_ic->name = "MSI"; + bottom_ic->irq_compose_msi_msg = advk_msi_irq_compose_msi_msg; + bottom_ic->irq_set_affinity = advk_msi_set_affinity; + + msi_ic = &pcie->msi_irq_chip; + msi_ic->name = "advk-MSI"; + + msi_di = &pcie->msi_domain_info; + msi_di->flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_MULTI_PCI_MSI; + msi_di->chip = msi_ic; + + msi_msg_phys = virt_to_phys(&pcie->msi_msg); + + advk_writel(pcie, lower_32_bits(msi_msg_phys), + PCIE_MSI_ADDR_LOW_REG); + advk_writel(pcie, upper_32_bits(msi_msg_phys), + PCIE_MSI_ADDR_HIGH_REG); + pcie->msi_inner_domain = irq_domain_add_linear(NULL, MSI_IRQ_NUM, &advk_msi_domain_ops, pcie); @@ -1373,9 +1319,8 @@ return -ENOMEM; pcie->msi_domain = - pci_msi_create_irq_domain(dev_fwnode(dev), - &advk_msi_domain_info, - pcie->msi_inner_domain); + pci_msi_create_irq_domain(of_node_to_fwnode(node), + msi_di, pcie->msi_inner_domain); if (!pcie->msi_domain) { irq_domain_remove(pcie->msi_inner_domain); return -ENOMEM; @@ -1416,6 +1361,7 @@ } irq_chip->irq_mask = advk_pcie_irq_mask; + irq_chip->irq_mask_ack = advk_pcie_irq_mask; irq_chip->irq_unmask = advk_pcie_irq_unmask; pcie->irq_domain = @@ -1437,70 +1383,6 @@ irq_domain_remove(pcie->irq_domain); } -static struct irq_chip advk_rp_irq_chip = { - .name = "advk-RP", -}; - -static int advk_pcie_rp_irq_map(struct irq_domain *h, - unsigned int virq, irq_hw_number_t hwirq) -{ - struct advk_pcie *pcie = h->host_data; - - irq_set_chip_and_handler(virq, &advk_rp_irq_chip, handle_simple_irq); - irq_set_chip_data(virq, pcie); - - return 0; -} - -static const struct irq_domain_ops advk_pcie_rp_irq_domain_ops = { - .map = advk_pcie_rp_irq_map, - .xlate = irq_domain_xlate_onecell, -}; - -static int advk_pcie_init_rp_irq_domain(struct advk_pcie *pcie) -{ - pcie->rp_irq_domain = irq_domain_add_linear(NULL, 1, - &advk_pcie_rp_irq_domain_ops, - pcie); - if (!pcie->rp_irq_domain) { - dev_err(&pcie->pdev->dev, "Failed to add Root Port IRQ domain\n"); - return -ENOMEM; - } - - return 0; -} - -static void advk_pcie_remove_rp_irq_domain(struct advk_pcie *pcie) -{ - irq_domain_remove(pcie->rp_irq_domain); -} - -static void advk_pcie_handle_pme(struct advk_pcie *pcie) -{ - u32 requester = advk_readl(pcie, PCIE_MSG_LOG_REG) >> 16; - - advk_writel(pcie, PCIE_MSG_PM_PME_MASK, PCIE_ISR0_REG); - - /* - * PCIE_MSG_LOG_REG contains the last inbound message, so store - * the requester ID only when PME was not asserted yet. - * Also do not trigger PME interrupt when PME is still asserted. - */ - if (!(le32_to_cpu(pcie->bridge.pcie_conf.rootsta) & PCI_EXP_RTSTA_PME)) { - pcie->bridge.pcie_conf.rootsta = cpu_to_le32(requester | PCI_EXP_RTSTA_PME); - - /* - * Trigger PME interrupt only if PMEIE bit in Root Control is set. - * Aardvark HW returns zero for PCI_EXP_FLAGS_IRQ, so use PCIe interrupt 0. - */ - if (!(le16_to_cpu(pcie->bridge.pcie_conf.rootctl) & PCI_EXP_RTCTL_PMEIE)) - return; - - if (generic_handle_domain_irq(pcie->rp_irq_domain, 0) == -EINVAL) - dev_err_ratelimited(&pcie->pdev->dev, "unhandled PME IRQ\n"); - } -} - static void advk_pcie_handle_msi(struct advk_pcie *pcie) { u32 msi_val, msi_mask, msi_status, msi_idx; @@ -1536,22 +1418,6 @@ isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); - /* Process PME interrupt as the first one to do not miss PME requester id */ - if (isr0_status & PCIE_MSG_PM_PME_MASK) - advk_pcie_handle_pme(pcie); - - /* Process ERR interrupt */ - if (isr0_status & PCIE_ISR0_ERR_MASK) { - advk_writel(pcie, PCIE_ISR0_ERR_MASK, PCIE_ISR0_REG); - - /* - * Aardvark HW returns zero for PCI_ERR_ROOT_AER_IRQ, so use - * PCIe interrupt 0 - */ - if (generic_handle_domain_irq(pcie->rp_irq_domain, 0) == -EINVAL) - dev_err_ratelimited(&pcie->pdev->dev, "unhandled ERR IRQ\n"); - } - /* Process MSI interrupts */ if (isr0_status & PCIE_ISR0_MSI_INT_PENDING) advk_pcie_handle_msi(pcie); @@ -1564,50 +1430,28 @@ advk_writel(pcie, PCIE_ISR1_INTX_ASSERT(i), PCIE_ISR1_REG); - if (generic_handle_domain_irq(pcie->irq_domain, i) == -EINVAL) - dev_err_ratelimited(&pcie->pdev->dev, "unexpected INT%c IRQ\n", - (char)i + 'A'); + generic_handle_domain_irq(pcie->irq_domain, i); } } -static void advk_pcie_irq_handler(struct irq_desc *desc) +static irqreturn_t advk_pcie_irq_handler(int irq, void *arg) { - struct advk_pcie *pcie = irq_desc_get_handler_data(desc); - struct irq_chip *chip = irq_desc_get_chip(desc); - u32 val, mask, status; - - chained_irq_enter(chip, desc); + struct advk_pcie *pcie = arg; + u32 status; - val = advk_readl(pcie, HOST_CTRL_INT_STATUS_REG); - mask = advk_readl(pcie, HOST_CTRL_INT_MASK_REG); - status = val & ((~mask) & PCIE_IRQ_ALL_MASK); + status = advk_readl(pcie, HOST_CTRL_INT_STATUS_REG); + if (!(status & PCIE_IRQ_CORE_INT)) + return IRQ_NONE; - if (status & PCIE_IRQ_CORE_INT) { - advk_pcie_handle_int(pcie); + advk_pcie_handle_int(pcie); - /* Clear interrupt */ - advk_writel(pcie, PCIE_IRQ_CORE_INT, HOST_CTRL_INT_STATUS_REG); - } - - chained_irq_exit(chip, desc); -} + /* Clear interrupt */ + advk_writel(pcie, PCIE_IRQ_CORE_INT, HOST_CTRL_INT_STATUS_REG); -static int advk_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - struct advk_pcie *pcie = dev->bus->sysdata; - - /* - * Emulated root bridge has its own emulated irq chip and irq domain. - * Argument pin is the INTx pin (1=INTA, 2=INTB, 3=INTC, 4=INTD) and - * hwirq for irq_create_mapping() is indexed from zero. - */ - if (pci_is_root_bus(dev->bus)) - return irq_create_mapping(pcie->rp_irq_domain, pin - 1); - else - return of_irq_parse_and_map_pci(dev, slot, pin); + return IRQ_HANDLED; } -static void advk_pcie_disable_phy(struct advk_pcie *pcie) +static void __maybe_unused advk_pcie_disable_phy(struct advk_pcie *pcie) { phy_power_off(pcie->phy); phy_exit(pcie->phy); @@ -1671,7 +1515,7 @@ struct advk_pcie *pcie; struct pci_host_bridge *bridge; struct resource_entry *entry; - int ret; + int ret, irq; bridge = devm_pci_alloc_host_bridge(dev, sizeof(struct advk_pcie)); if (!bridge) @@ -1757,9 +1601,17 @@ if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); - pcie->irq = platform_get_irq(pdev, 0); - if (pcie->irq < 0) - return pcie->irq; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + ret = devm_request_irq(dev, irq, advk_pcie_irq_handler, + IRQF_SHARED | IRQF_NO_THREAD, "advk-pcie", + pcie); + if (ret) { + dev_err(dev, "Failed to register interrupt\n"); + return ret; + } pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, "reset-gpios", 0, @@ -1808,24 +1660,11 @@ return ret; } - ret = advk_pcie_init_rp_irq_domain(pcie); - if (ret) { - dev_err(dev, "Failed to initialize irq\n"); - advk_pcie_remove_msi_irq_domain(pcie); - advk_pcie_remove_irq_domain(pcie); - return ret; - } - - irq_set_chained_handler_and_data(pcie->irq, advk_pcie_irq_handler, pcie); - bridge->sysdata = pcie; bridge->ops = &advk_pcie_ops; - bridge->map_irq = advk_pcie_map_irq; ret = pci_host_probe(bridge); if (ret < 0) { - irq_set_chained_handler_and_data(pcie->irq, NULL, NULL); - advk_pcie_remove_rp_irq_domain(pcie); advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); return ret; @@ -1873,11 +1712,7 @@ advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG); advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG); - /* Remove IRQ handler */ - irq_set_chained_handler_and_data(pcie->irq, NULL, NULL); - /* Remove IRQ domains */ - advk_pcie_remove_rp_irq_domain(pcie); advk_pcie_remove_msi_irq_domain(pcie); advk_pcie_remove_irq_domain(pcie); reverted: --- linux-oem-5.17-5.17.0/drivers/pci/controller/pci-hyperv.c +++ linux-oem-5.17-5.17.0.orig/drivers/pci/controller/pci-hyperv.c @@ -3404,15 +3404,6 @@ hbus->bridge->domain_nr = dom; #ifdef CONFIG_X86 hbus->sysdata.domain = dom; -#elif defined(CONFIG_ARM64) - /* - * Set the PCI bus parent to be the corresponding VMbus - * device. Then the VMbus device will be assigned as the - * ACPI companion in pcibios_root_bridge_prepare() and - * pci_dma_configure() will propagate device coherence - * information to devices created on the bus. - */ - hbus->sysdata.parent = hdev->device.parent; #endif hbus->hdev = hdev; reverted: --- linux-oem-5.17-5.17.0/drivers/perf/arm_pmu.c +++ linux-oem-5.17-5.17.0.orig/drivers/perf/arm_pmu.c @@ -398,9 +398,6 @@ if (!validate_event(event->pmu, &fake_pmu, leader)) return -EINVAL; - if (event == leader) - return 0; - for_each_sibling_event(sibling, leader) { if (!validate_event(event->pmu, &fake_pmu, sibling)) return -EINVAL; @@ -490,7 +487,12 @@ local64_set(&hwc->period_left, hwc->sample_period); } + if (event->group_leader != event) { + if (validate_group(event) != 0) + return -EINVAL; + } + + return 0; - return validate_group(event); } static int armpmu_event_init(struct perf_event *event) reverted: --- linux-oem-5.17-5.17.0/drivers/perf/fsl_imx8_ddr_perf.c +++ linux-oem-5.17-5.17.0.orig/drivers/perf/fsl_imx8_ddr_perf.c @@ -29,7 +29,7 @@ #define CNTL_OVER_MASK 0xFFFFFFFE #define CNTL_CSV_SHIFT 24 +#define CNTL_CSV_MASK (0xFF << CNTL_CSV_SHIFT) -#define CNTL_CSV_MASK (0xFFU << CNTL_CSV_SHIFT) #define EVENT_CYCLES_ID 0 #define EVENT_CYCLES_COUNTER 0 reverted: --- linux-oem-5.17-5.17.0/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c +++ linux-oem-5.17-5.17.0.orig/drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c @@ -414,19 +414,19 @@ ret = clk_prepare_enable(priv->clk_ref); if (ret) + goto err_disable_clk_ref; - return ret; priv->reset = devm_reset_control_array_get_exclusive(dev); + if (IS_ERR(priv->reset)) + return PTR_ERR(priv->reset); - if (IS_ERR(priv->reset)) { - ret = PTR_ERR(priv->reset); - goto err_disable_clk_ref; - } priv->phy = devm_phy_create(dev, np, &phy_g12a_usb3_pcie_ops); if (IS_ERR(priv->phy)) { ret = PTR_ERR(priv->phy); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to create PHY\n"); + + return ret; - dev_err_probe(dev, ret, "failed to create PHY\n"); - goto err_disable_clk_ref; } phy_set_drvdata(priv->phy, priv); @@ -434,12 +434,8 @@ phy_provider = devm_of_phy_provider_register(dev, phy_g12a_usb3_pcie_xlate); - if (IS_ERR(phy_provider)) { - ret = PTR_ERR(phy_provider); - goto err_disable_clk_ref; - } + return PTR_ERR_OR_ZERO(phy_provider); - return 0; err_disable_clk_ref: clk_disable_unprepare(priv->clk_ref); reverted: --- linux-oem-5.17-5.17.0/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ linux-oem-5.17-5.17.0.orig/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -629,8 +629,7 @@ cleanup: if (error < 0) phy_mdm6600_device_power_off(ddata); + - pm_runtime_disable(ddata->dev); - pm_runtime_dont_use_autosuspend(ddata->dev); return error; } reverted: --- linux-oem-5.17-5.17.0/drivers/phy/samsung/phy-exynos5250-sata.c +++ linux-oem-5.17-5.17.0.orig/drivers/phy/samsung/phy-exynos5250-sata.c @@ -187,7 +187,6 @@ return -EINVAL; sata_phy->client = of_find_i2c_device_by_node(node); - of_node_put(node); if (!sata_phy->client) return -EPROBE_DEFER; @@ -196,21 +195,20 @@ sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl"); if (IS_ERR(sata_phy->phyclk)) { dev_err(dev, "failed to get clk for PHY\n"); + return PTR_ERR(sata_phy->phyclk); - ret = PTR_ERR(sata_phy->phyclk); - goto put_dev; } ret = clk_prepare_enable(sata_phy->phyclk); if (ret < 0) { dev_err(dev, "failed to enable source clk\n"); + return ret; - goto put_dev; } sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops); if (IS_ERR(sata_phy->phy)) { + clk_disable_unprepare(sata_phy->phyclk); dev_err(dev, "failed to create PHY\n"); + return PTR_ERR(sata_phy->phy); - ret = PTR_ERR(sata_phy->phy); - goto clk_disable; } phy_set_drvdata(sata_phy->phy, sata_phy); @@ -218,18 +216,11 @@ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (IS_ERR(phy_provider)) { + clk_disable_unprepare(sata_phy->phyclk); + return PTR_ERR(phy_provider); - ret = PTR_ERR(phy_provider); - goto clk_disable; } return 0; - -clk_disable: - clk_disable_unprepare(sata_phy->phyclk); -put_dev: - put_device(&sata_phy->client->dev); - - return ret; } static const struct of_device_id exynos_sata_phy_of_match[] = { reverted: --- linux-oem-5.17-5.17.0/drivers/phy/ti/phy-am654-serdes.c +++ linux-oem-5.17-5.17.0.orig/drivers/phy/ti/phy-am654-serdes.c @@ -838,7 +838,7 @@ clk_err: of_clk_del_provider(node); + - pm_runtime_disable(dev); return ret; } reverted: --- linux-oem-5.17-5.17.0/drivers/phy/ti/phy-omap-usb2.c +++ linux-oem-5.17-5.17.0.orig/drivers/phy/ti/phy-omap-usb2.c @@ -215,7 +215,7 @@ return 0; err1: + clk_disable(phy->wkupclk); - clk_disable_unprepare(phy->wkupclk); err0: return ret; reverted: --- linux-oem-5.17-5.17.0/drivers/pinctrl/mediatek/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/pinctrl/mediatek/Kconfig @@ -30,7 +30,6 @@ select GENERIC_PINMUX_FUNCTIONS select GPIOLIB select OF_GPIO - select EINT_MTK select PINCTRL_MTK_V2 config PINCTRL_MTK_PARIS reverted: --- linux-oem-5.17-5.17.0/drivers/pinctrl/pinctrl-pistachio.c +++ linux-oem-5.17-5.17.0.orig/drivers/pinctrl/pinctrl-pistachio.c @@ -1374,10 +1374,10 @@ } irq = irq_of_parse_and_map(child, 0); + if (irq < 0) { + dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); - if (!irq) { - dev_err(pctl->dev, "No IRQ for bank %u\n", i); of_node_put(child); + ret = irq; - ret = -EINVAL; goto err; } diff -u linux-oem-5.17-5.17.0/drivers/pinctrl/pinctrl-rockchip.c linux-oem-5.17-5.17.0/drivers/pinctrl/pinctrl-rockchip.c --- linux-oem-5.17-5.17.0/drivers/pinctrl/pinctrl-rockchip.c +++ linux-oem-5.17-5.17.0/drivers/pinctrl/pinctrl-rockchip.c @@ -457,110 +457,95 @@ static struct rockchip_mux_recalced_data rk3308_mux_recalced_data[] = { { - /* gpio1b6_sel */ .num = 1, .pin = 14, .reg = 0x28, .bit = 12, .mask = 0xf }, { - /* gpio1b7_sel */ .num = 1, .pin = 15, .reg = 0x2c, .bit = 0, .mask = 0x3 }, { - /* gpio1c2_sel */ .num = 1, .pin = 18, .reg = 0x30, .bit = 4, .mask = 0xf }, { - /* gpio1c3_sel */ .num = 1, .pin = 19, .reg = 0x30, .bit = 8, .mask = 0xf }, { - /* gpio1c4_sel */ .num = 1, .pin = 20, .reg = 0x30, .bit = 12, .mask = 0xf }, { - /* gpio1c5_sel */ .num = 1, .pin = 21, .reg = 0x34, .bit = 0, .mask = 0xf }, { - /* gpio1c6_sel */ .num = 1, .pin = 22, .reg = 0x34, .bit = 4, .mask = 0xf }, { - /* gpio1c7_sel */ .num = 1, .pin = 23, .reg = 0x34, .bit = 8, .mask = 0xf }, { - /* gpio3b4_sel */ .num = 3, .pin = 12, .reg = 0x68, .bit = 8, .mask = 0xf }, { - /* gpio3b5_sel */ .num = 3, .pin = 13, .reg = 0x68, .bit = 12, .mask = 0xf }, { - /* gpio2a2_sel */ .num = 2, .pin = 2, - .reg = 0x40, - .bit = 4, - .mask = 0x3 + .reg = 0x608, + .bit = 0, + .mask = 0x7 }, { - /* gpio2a3_sel */ .num = 2, .pin = 3, - .reg = 0x40, - .bit = 6, - .mask = 0x3 + .reg = 0x608, + .bit = 4, + .mask = 0x7 }, { - /* gpio2c0_sel */ .num = 2, .pin = 16, - .reg = 0x50, - .bit = 0, - .mask = 0x3 + .reg = 0x610, + .bit = 8, + .mask = 0x7 }, { - /* gpio3b2_sel */ .num = 3, .pin = 10, - .reg = 0x68, - .bit = 4, - .mask = 0x3 + .reg = 0x610, + .bit = 0, + .mask = 0x7 }, { - /* gpio3b3_sel */ .num = 3, .pin = 11, - .reg = 0x68, - .bit = 6, - .mask = 0x3 + .reg = 0x610, + .bit = 4, + .mask = 0x7 }, }; reverted: --- linux-oem-5.17-5.17.0/drivers/pinctrl/qcom/pinctrl-sm6350.c +++ linux-oem-5.17-5.17.0.orig/drivers/pinctrl/qcom/pinctrl-sm6350.c @@ -264,14 +264,14 @@ PINCTRL_PIN(153, "GPIO_153"), PINCTRL_PIN(154, "GPIO_154"), PINCTRL_PIN(155, "GPIO_155"), + PINCTRL_PIN(156, "SDC1_RCLK"), + PINCTRL_PIN(157, "SDC1_CLK"), + PINCTRL_PIN(158, "SDC1_CMD"), + PINCTRL_PIN(159, "SDC1_DATA"), + PINCTRL_PIN(160, "SDC2_CLK"), + PINCTRL_PIN(161, "SDC2_CMD"), + PINCTRL_PIN(162, "SDC2_DATA"), + PINCTRL_PIN(163, "UFS_RESET"), - PINCTRL_PIN(156, "UFS_RESET"), - PINCTRL_PIN(157, "SDC1_RCLK"), - PINCTRL_PIN(158, "SDC1_CLK"), - PINCTRL_PIN(159, "SDC1_CMD"), - PINCTRL_PIN(160, "SDC1_DATA"), - PINCTRL_PIN(161, "SDC2_CLK"), - PINCTRL_PIN(162, "SDC2_CMD"), - PINCTRL_PIN(163, "SDC2_DATA"), }; #define DECLARE_MSM_GPIO_PINS(pin) \ reverted: --- linux-oem-5.17-5.17.0/drivers/pinctrl/samsung/Kconfig +++ linux-oem-5.17-5.17.0.orig/drivers/pinctrl/samsung/Kconfig @@ -4,13 +4,14 @@ # config PINCTRL_SAMSUNG bool + depends on OF_GPIO - select GPIOLIB select PINMUX select PINCONF config PINCTRL_EXYNOS bool "Pinctrl common driver part for Samsung Exynos SoCs" + depends on OF_GPIO + depends on ARCH_EXYNOS || ARCH_S5PV210 || COMPILE_TEST - depends on ARCH_EXYNOS || ARCH_S5PV210 || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG select PINCTRL_EXYNOS_ARM if ARM && (ARCH_EXYNOS || ARCH_S5PV210) select PINCTRL_EXYNOS_ARM64 if ARM64 && ARCH_EXYNOS @@ -25,10 +26,12 @@ config PINCTRL_S3C24XX bool "Samsung S3C24XX SoC pinctrl driver" + depends on OF_GPIO + depends on ARCH_S3C24XX || COMPILE_TEST - depends on ARCH_S3C24XX || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG config PINCTRL_S3C64XX bool "Samsung S3C64XX SoC pinctrl driver" + depends on OF_GPIO + depends on ARCH_S3C64XX || COMPILE_TEST - depends on ARCH_S3C64XX || (COMPILE_TEST && OF) select PINCTRL_SAMSUNG reverted: --- linux-oem-5.17-5.17.0/drivers/pinctrl/stm32/pinctrl-stm32.c +++ linux-oem-5.17-5.17.0.orig/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -225,13 +225,6 @@ pinctrl_gpio_free(chip->base + offset); } -static int stm32_gpio_get_noclk(struct gpio_chip *chip, unsigned int offset) -{ - struct stm32_gpio_bank *bank = gpiochip_get_data(chip); - - return !!(readl_relaxed(bank->base + STM32_GPIO_IDR) & BIT(offset)); -} - static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset) { struct stm32_gpio_bank *bank = gpiochip_get_data(chip); @@ -239,7 +232,7 @@ clk_enable(bank->clk); + ret = !!(readl_relaxed(bank->base + STM32_GPIO_IDR) & BIT(offset)); - ret = stm32_gpio_get_noclk(chip, offset); clk_disable(bank->clk); @@ -318,12 +311,8 @@ struct stm32_gpio_bank *bank = d->domain->host_data; int level; - /* Do not access the GPIO if this is not LEVEL triggered IRQ. */ - if (!(bank->irq_type[d->hwirq] & IRQ_TYPE_LEVEL_MASK)) - return; - /* If level interrupt type then retrig */ + level = stm32_gpio_get(&bank->gpio_chip, d->hwirq); - level = stm32_gpio_get_noclk(&bank->gpio_chip, d->hwirq); if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) || (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH)) irq_chip_retrigger_hierarchy(d); @@ -365,7 +354,6 @@ { struct stm32_gpio_bank *bank = irq_data->domain->host_data; struct stm32_pinctrl *pctl = dev_get_drvdata(bank->gpio_chip.parent); - unsigned long flags; int ret; ret = stm32_gpio_direction_input(&bank->gpio_chip, irq_data->hwirq); @@ -379,10 +367,6 @@ return ret; } - flags = irqd_get_trigger_type(irq_data); - if (flags & IRQ_TYPE_LEVEL_MASK) - clk_enable(bank->clk); - return 0; } @@ -390,9 +374,6 @@ { struct stm32_gpio_bank *bank = irq_data->domain->host_data; - if (bank->irq_type[irq_data->hwirq] & IRQ_TYPE_LEVEL_MASK) - clk_disable(bank->clk); - gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq); } diff -u linux-oem-5.17-5.17.0/drivers/platform/x86/asus-wmi.c linux-oem-5.17-5.17.0/drivers/platform/x86/asus-wmi.c --- linux-oem-5.17-5.17.0/drivers/platform/x86/asus-wmi.c +++ linux-oem-5.17-5.17.0/drivers/platform/x86/asus-wmi.c @@ -371,14 +371,10 @@ switch (obj->type) { case ACPI_TYPE_BUFFER: - if (obj->buffer.length > size) { + if (obj->buffer.length > size) err = -ENOSPC; - break; - } - if (obj->buffer.length == 0) { + if (obj->buffer.length == 0) err = -ENODATA; - break; - } memcpy(ret_buffer, obj->buffer.pointer, obj->buffer.length); break; @@ -2227,10 +2223,9 @@ 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; + if (err == -ENODEV || err == -ENODATA) + return 0; + return err; } *available = true; reverted: --- linux-oem-5.17-5.17.0/drivers/platform/x86/samsung-laptop.c +++ linux-oem-5.17-5.17.0.orig/drivers/platform/x86/samsung-laptop.c @@ -1121,6 +1121,8 @@ if (value > samsung->kbd_led.max_brightness) value = samsung->kbd_led.max_brightness; + else if (value < 0) + value = 0; samsung->kbd_led_wk = value; queue_work(samsung->led_workqueue, &samsung->kbd_led_work); reverted: --- linux-oem-5.17-5.17.0/drivers/regulator/wm8994-regulator.c +++ linux-oem-5.17-5.17.0.orig/drivers/regulator/wm8994-regulator.c @@ -82,35 +82,6 @@ .min_uV = 2400000, .uV_step = 100000, .enable_time = 3000, - .off_on_delay = 36000, - .owner = THIS_MODULE, - }, - { - .name = "LDO2", - .id = 2, - .type = REGULATOR_VOLTAGE, - .n_voltages = WM8994_LDO2_MAX_SELECTOR + 1, - .vsel_reg = WM8994_LDO_2, - .vsel_mask = WM8994_LDO2_VSEL_MASK, - .ops = &wm8994_ldo2_ops, - .enable_time = 3000, - .off_on_delay = 36000, - .owner = THIS_MODULE, - }, -}; - -static const struct regulator_desc wm8958_ldo_desc[] = { - { - .name = "LDO1", - .id = 1, - .type = REGULATOR_VOLTAGE, - .n_voltages = WM8994_LDO1_MAX_SELECTOR + 1, - .vsel_reg = WM8994_LDO_1, - .vsel_mask = WM8994_LDO1_VSEL_MASK, - .ops = &wm8994_ldo1_ops, - .min_uV = 2400000, - .uV_step = 100000, - .enable_time = 3000, .owner = THIS_MODULE, }, { @@ -201,16 +172,9 @@ * regulator core and we need not worry about it on the * error path. */ + ldo->regulator = devm_regulator_register(&pdev->dev, + &wm8994_ldo_desc[id], + &config); - if (ldo->wm8994->type == WM8994) { - ldo->regulator = devm_regulator_register(&pdev->dev, - &wm8994_ldo_desc[id], - &config); - } else { - ldo->regulator = devm_regulator_register(&pdev->dev, - &wm8958_ldo_desc[id], - &config); - } - if (IS_ERR(ldo->regulator)) { ret = PTR_ERR(ldo->regulator); dev_err(wm8994->dev, "Failed to register LDO%d: %d\n", reverted: --- linux-oem-5.17-5.17.0/drivers/reset/reset-rzg2l-usbphy-ctrl.c +++ linux-oem-5.17-5.17.0.orig/drivers/reset/reset-rzg2l-usbphy-ctrl.c @@ -121,9 +121,7 @@ return dev_err_probe(dev, PTR_ERR(priv->rstc), "failed to get reset\n"); + reset_control_deassert(priv->rstc); - error = reset_control_deassert(priv->rstc); - if (error) - return error; priv->rcdev.ops = &rzg2l_usbphy_ctrl_reset_ops; priv->rcdev.of_reset_n_cells = 1; reverted: --- linux-oem-5.17-5.17.0/drivers/reset/tegra/reset-bpmp.c +++ linux-oem-5.17-5.17.0.orig/drivers/reset/tegra/reset-bpmp.c @@ -20,7 +20,6 @@ struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc); struct mrq_reset_request request; struct tegra_bpmp_message msg; - int err; memset(&request, 0, sizeof(request)); request.cmd = command; @@ -31,13 +30,7 @@ msg.tx.data = &request; msg.tx.size = sizeof(request); + return tegra_bpmp_transfer(bpmp, &msg); - err = tegra_bpmp_transfer(bpmp, &msg); - if (err) - return err; - if (msg.rx.ret) - return -EINVAL; - - return 0; } static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc, reverted: --- linux-oem-5.17-5.17.0/drivers/s390/block/dasd.c +++ linux-oem-5.17-5.17.0.orig/drivers/s390/block/dasd.c @@ -1422,13 +1422,6 @@ if (!cqr->lpm) cqr->lpm = dasd_path_get_opm(device); } - /* - * remember the amount of formatted tracks to prevent double format on - * ESE devices - */ - if (cqr->block) - cqr->trkcount = atomic_read(&cqr->block->trkcount); - if (cqr->cpmode == 1) { rc = ccw_device_tm_start(device->cdev, cqr->cpaddr, (long) cqr, cqr->lpm); @@ -1646,7 +1639,6 @@ unsigned long now; int nrf_suppressed = 0; int fp_suppressed = 0; - struct request *req; u8 *sense = NULL; int expires; @@ -1747,12 +1739,7 @@ } if (dasd_ese_needs_format(cqr->block, irb)) { + if (rq_data_dir((struct request *)cqr->callback_data) == READ) { - req = dasd_get_callback_data(cqr); - if (!req) { - cqr->status = DASD_CQR_ERROR; - return; - } - if (rq_data_dir(req) == READ) { device->discipline->ese_read(cqr, irb); cqr->status = DASD_CQR_SUCCESS; cqr->stopclk = now; @@ -2778,7 +2765,8 @@ * complete a request partially. */ if (proc_bytes) { + blk_update_request(req, BLK_STS_OK, + blk_rq_bytes(req) - proc_bytes); - blk_update_request(req, BLK_STS_OK, proc_bytes); blk_mq_requeue_request(req, true); } else if (likely(!blk_should_fake_timeout(req->q))) { blk_mq_complete_request(req); reverted: --- linux-oem-5.17-5.17.0/drivers/s390/block/dasd_eckd.c +++ linux-oem-5.17-5.17.0.orig/drivers/s390/block/dasd_eckd.c @@ -3083,24 +3083,13 @@ } static bool test_and_set_format_track(struct dasd_format_entry *to_format, + struct dasd_block *block) - struct dasd_ccw_req *cqr) { - struct dasd_block *block = cqr->block; struct dasd_format_entry *format; unsigned long flags; bool rc = false; spin_lock_irqsave(&block->format_lock, flags); - if (cqr->trkcount != atomic_read(&block->trkcount)) { - /* - * The number of formatted tracks has changed after request - * start and we can not tell if the current track was involved. - * To avoid data corruption treat it as if the current track is - * involved - */ - rc = true; - goto out; - } list_for_each_entry(format, &block->format_list, list) { if (format->track == to_format->track) { rc = true; @@ -3120,7 +3109,6 @@ unsigned long flags; spin_lock_irqsave(&block->format_lock, flags); - atomic_inc(&block->trkcount); list_del_init(&format->list); spin_unlock_irqrestore(&block->format_lock, flags); } @@ -3157,7 +3145,7 @@ sector_t curr_trk; int rc; + req = cqr->callback_data; - req = dasd_get_callback_data(cqr); block = cqr->block; base = block->base; private = base->private; @@ -3182,11 +3170,8 @@ } format->track = curr_trk; /* test if track is already in formatting by another thread */ + if (test_and_set_format_track(format, block)) - if (test_and_set_format_track(format, cqr)) { - /* this is no real error so do not count down retries */ - cqr->retries++; return ERR_PTR(-EEXIST); - } fdata.start_unit = curr_trk; fdata.stop_unit = curr_trk; @@ -3285,11 +3270,12 @@ cqr->proc_bytes = blk_count * blksize; return 0; } + if (dst && !skip_block) { + dst += off; - if (dst && !skip_block) memset(dst, 0, blksize); + } else { - else skip_block--; + } - dst += blksize; blk_count++; } } reverted: --- linux-oem-5.17-5.17.0/drivers/s390/block/dasd_int.h +++ linux-oem-5.17-5.17.0.orig/drivers/s390/block/dasd_int.h @@ -188,7 +188,6 @@ void (*callback)(struct dasd_ccw_req *, void *data); void *callback_data; unsigned int proc_bytes; /* bytes for partial completion */ - unsigned int trkcount; /* count formatted tracks */ }; /* @@ -612,7 +611,6 @@ struct list_head format_list; spinlock_t format_lock; - atomic_t trkcount; }; struct dasd_attention_data { @@ -759,18 +757,6 @@ return 0; } -/* - * return the callback data of the original request in case there are - * ERP requests build on top of it - */ -static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr) -{ - while (cqr->refers) - cqr = cqr->refers; - - return cqr->callback_data; -} - /* externals in dasd.c */ #define DASD_PROFILE_OFF 0 #define DASD_PROFILE_ON 1 reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/bnx2i/bnx2i_hwi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -1977,7 +1977,7 @@ if (nopin->cq_req_sn != qp->cqe_exp_seq_sn) break; + if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) { - if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { if (nopin->op_code == ISCSI_OP_NOOP_IN && nopin->itt == (u16) RESERVED_ITT) { printk(KERN_ALERT "bnx2i: Unsolicited " reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1721,7 +1721,7 @@ struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; /* Must suspend all rx queue activity for this ep */ + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); - set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); } /* CONN_DISCONNECT timeout may or may not be an issue depending * on what transcribed in TCP layer, different targets behave reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/cxgbi/libcxgbi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/cxgbi/libcxgbi.c @@ -1634,11 +1634,11 @@ log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, conn 0x%p.\n", csk, conn); + if (unlikely(!conn || conn->suspend_rx)) { - if (unlikely(!conn || test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { log_debug(1 << CXGBI_DBG_PDU_RX, + "csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n", - "csk 0x%p, conn 0x%p, id %d, conn flags 0x%lx!\n", csk, conn, conn ? conn->id : 0xFF, + conn ? conn->suspend_rx : 0xFF); - conn ? conn->flags : 0xFF); return; } reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -36,7 +36,7 @@ #define IBMVSCSIS_VERSION "v0.2" +#define INITIAL_SRP_LIMIT 800 -#define INITIAL_SRP_LIMIT 1024 #define DEFAULT_MAX_SECTORS 256 #define MAX_TXU 1024 * 1024 reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/libiscsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/libiscsi.c @@ -678,8 +678,7 @@ struct iscsi_task *task; itt_t itt; + if (session->state == ISCSI_STATE_TERMINATE) - if (session->state == ISCSI_STATE_TERMINATE || - !test_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags)) return NULL; if (opcode == ISCSI_OP_LOGIN || opcode == ISCSI_OP_TEXT) { @@ -1393,8 +1392,8 @@ if (conn->stop_stage == 0) session->state = ISCSI_STATE_FAILED; + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); - set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); return true; } @@ -1455,7 +1454,7 @@ * Do this after dropping the extra ref because if this was a requeue * it's removed from that list and cleanup_queued_task would miss it. */ + if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { - if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { /* * Save the task and ref in case we weren't cleaning up this * task and get woken up again. @@ -1533,7 +1532,7 @@ int rc = 0; spin_lock_bh(&conn->session->frwd_lock); + if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { - if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { ISCSI_DBG_SESSION(conn->session, "Tx suspended!\n"); spin_unlock_bh(&conn->session->frwd_lock); return -ENODATA; @@ -1747,7 +1746,7 @@ goto fault; } + if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { - if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { reason = FAILURE_SESSION_IN_RECOVERY; sc->result = DID_REQUEUE << 16; goto fault; @@ -1936,7 +1935,7 @@ void iscsi_suspend_queue(struct iscsi_conn *conn) { spin_lock_bh(&conn->session->frwd_lock); + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_suspend_queue); @@ -1954,7 +1953,7 @@ struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) flush_workqueue(ihost->workq); } @@ -1962,7 +1961,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn) { + clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); iscsi_conn_queue_work(conn); } @@ -2215,8 +2214,6 @@ iscsi_suspend_tx(conn); spin_lock_bh(&session->frwd_lock); - clear_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags); - if (!is_active) { /* * if logout timed out before userspace could even send a PDU @@ -3314,8 +3311,6 @@ spin_lock_bh(&session->frwd_lock); if (is_leading) session->leadconn = conn; - - set_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags); spin_unlock_bh(&session->frwd_lock); /* @@ -3328,8 +3323,8 @@ /* * Unblock xmitworker(), Login Phase will pass through. */ + clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); + clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - clear_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); - clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); return 0; } EXPORT_SYMBOL_GPL(iscsi_conn_bind); reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/libiscsi_tcp.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/libiscsi_tcp.c @@ -927,7 +927,7 @@ */ conn->last_recv = jiffies; + if (unlikely(conn->suspend_rx)) { - if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { ISCSI_DBG_TCP(conn, "Rx suspended!\n"); *status = ISCSI_TCP_SUSPENDED; return 0; reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc.h +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc.h @@ -897,11 +897,6 @@ NHT_MODE, }; -enum lpfc_hba_bit_flags { - FABRIC_COMANDS_BLOCKED, - HBA_PCI_ERR, -}; - struct lpfc_hba { /* SCSI interface function jump table entries */ struct lpfc_io_buf * (*lpfc_get_scsi_buf) @@ -1030,6 +1025,7 @@ * Firmware supports Forced Link Speed * capability */ +#define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */ #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ @@ -1339,6 +1335,7 @@ atomic_t fabric_iocb_count; struct timer_list fabric_block_timer; unsigned long bit_flags; +#define FABRIC_COMANDS_BLOCKED 0 atomic_t num_rsrc_err; atomic_t num_cmd_success; unsigned long last_rsrc_error_time; reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc_crtn.h +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc_crtn.h @@ -652,6 +652,3 @@ uint32_t hash, uint8_t *buf); void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); int lpfc_issue_els_qfpa(struct lpfc_vport *vport); - -void lpfc_sli_rpi_release(struct lpfc_vport *vport, - struct lpfc_nodelist *ndlp); reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc_hbadisc.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -109,8 +109,8 @@ ndlp = rdata->pnode; if (!rdata->pnode) { + pr_err("**** %s: NULL ndlp on rport x%px SID x%x\n", + __func__, rport, rport->scsi_target_id); - pr_info("**** %s: NULL ndlp on rport x%px SID x%x\n", - __func__, rport, rport->scsi_target_id); return -EINVAL; } @@ -169,10 +169,9 @@ lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, "3181 dev_loss_callbk x%06x, rport x%px flg x%x " + "load_flag x%x refcnt %d\n", - "load_flag x%x refcnt %d state %d xpt x%x\n", ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, + vport->load_flag, kref_read(&ndlp->kref)); - vport->load_flag, kref_read(&ndlp->kref), - ndlp->nlp_state, ndlp->fc4_xpt_flags); /* Don't schedule a worker thread event if the vport is going down. * The teardown process cleans up the node via lpfc_drop_node. @@ -182,11 +181,6 @@ ndlp->rport = NULL; ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; - /* clear the NLP_XPT_REGD if the node is not registered - * with nvme-fc - */ - if (ndlp->fc4_xpt_flags == NLP_XPT_REGD) - ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD; /* Remove the node reference from remote_port_add now. * The driver will not call remote_port_delete. @@ -231,36 +225,18 @@ ndlp->rport = NULL; spin_unlock_irqrestore(&ndlp->lock, iflags); + /* We need to hold the node by incrementing the reference + * count until this queued work is done + */ + evtp->evt_arg1 = lpfc_nlp_get(ndlp); - if (phba->worker_thread) { - /* We need to hold the node by incrementing the reference - * count until this queued work is done - */ - evtp->evt_arg1 = lpfc_nlp_get(ndlp); - - spin_lock_irqsave(&phba->hbalock, iflags); - if (evtp->evt_arg1) { - evtp->evt = LPFC_EVT_DEV_LOSS; - list_add_tail(&evtp->evt_listp, &phba->work_list); - lpfc_worker_wake_up(phba); - } - spin_unlock_irqrestore(&phba->hbalock, iflags); - } else { - lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, - "3188 worker thread is stopped %s x%06x, " - " rport x%px flg x%x load_flag x%x refcnt " - "%d\n", __func__, ndlp->nlp_DID, - ndlp->rport, ndlp->nlp_flag, - vport->load_flag, kref_read(&ndlp->kref)); - if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) { - spin_lock_irqsave(&ndlp->lock, iflags); - /* Node is in dev loss. No further transaction. */ - ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; - spin_unlock_irqrestore(&ndlp->lock, iflags); - lpfc_disc_state_machine(vport, ndlp, NULL, - NLP_EVT_DEVICE_RM); - } + spin_lock_irqsave(&phba->hbalock, iflags); + if (evtp->evt_arg1) { + evtp->evt = LPFC_EVT_DEV_LOSS; + list_add_tail(&evtp->evt_listp, &phba->work_list); + lpfc_worker_wake_up(phba); } + spin_unlock_irqrestore(&phba->hbalock, iflags); return; } @@ -527,12 +503,11 @@ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0203 Devloss timeout on " "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " + "NPort x%06x Data: x%x x%x x%x\n", - "NPort x%06x Data: x%x x%x x%x refcnt %d\n", *name, *(name+1), *(name+2), *(name+3), *(name+4), *(name+5), *(name+6), *(name+7), ndlp->nlp_DID, ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi); - ndlp->nlp_state, ndlp->nlp_rpi, - kref_read(&ndlp->kref)); } else { lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT, "0204 Devloss timeout on " @@ -780,22 +755,18 @@ int free_evt; int fcf_inuse; uint32_t nlp_did; - bool hba_pci_err; spin_lock_irq(&phba->hbalock); while (!list_empty(&phba->work_list)) { list_remove_head((&phba->work_list), evtp, typeof(*evtp), evt_listp); spin_unlock_irq(&phba->hbalock); - hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); free_evt = 1; switch (evtp->evt) { case LPFC_EVT_ELS_RETRY: ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); + lpfc_els_retry_delay_handler(ndlp); + free_evt = 0; /* evt is part of ndlp */ - if (!hba_pci_err) { - lpfc_els_retry_delay_handler(ndlp); - free_evt = 0; /* evt is part of ndlp */ - } /* decrement the node reference count held * for this queued work */ @@ -817,10 +788,8 @@ break; case LPFC_EVT_RECOVER_PORT: ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); + lpfc_sli_abts_recover_port(ndlp->vport, ndlp); + free_evt = 0; - if (!hba_pci_err) { - lpfc_sli_abts_recover_port(ndlp->vport, ndlp); - free_evt = 0; - } /* decrement the node reference count held for * this queued work */ @@ -890,18 +859,14 @@ struct lpfc_vport **vports; struct lpfc_vport *vport; int i; - bool hba_pci_err; - hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); spin_lock_irq(&phba->hbalock); ha_copy = phba->work_ha; phba->work_ha = 0; spin_unlock_irq(&phba->hbalock); - if (hba_pci_err) - ha_copy = 0; /* First, try to post the next mailbox command to SLI4 device */ + if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) - if (phba->pci_dev_grp == LPFC_PCI_DEV_OC && !hba_pci_err) lpfc_sli4_post_async_mbox(phba); if (ha_copy & HA_ERATT) { @@ -921,7 +886,7 @@ lpfc_handle_latt(phba); /* Handle VMID Events */ + if (lpfc_is_vmid_enabled(phba)) { - if (lpfc_is_vmid_enabled(phba) && !hba_pci_err) { if (phba->pport->work_port_events & WORKER_CHECK_VMID_ISSUE_QFPA) { lpfc_check_vmid_qfpa_issue(phba); @@ -971,8 +936,6 @@ work_port_events = vport->work_port_events; vport->work_port_events &= ~work_port_events; spin_unlock_irq(&vport->work_port_lock); - if (hba_pci_err) - continue; if (work_port_events & WORKER_DISC_TMO) lpfc_disc_timeout_handler(vport); if (work_port_events & WORKER_ELS_TMO) @@ -1210,14 +1173,12 @@ struct lpfc_vport **vports; LPFC_MBOXQ_t *mb; int i; - int offline; if (phba->link_state == LPFC_LINK_DOWN) return 0; /* Block all SCSI stack I/Os */ lpfc_scsi_dev_block(phba); - offline = pci_channel_offline(phba->pcidev); phba->defer_flogi_acc_flag = false; @@ -1258,7 +1219,7 @@ lpfc_destroy_vport_work_array(phba, vports); /* Clean up any SLI3 firmware default rpi's */ + if (phba->sli_rev > LPFC_SLI_REV3) - if (phba->sli_rev > LPFC_SLI_REV3 || offline) goto skip_unreg_did; mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); @@ -4751,11 +4712,6 @@ spin_lock_irqsave(&ndlp->lock, iflags); if (!(ndlp->fc4_xpt_flags & NLP_XPT_REGD)) { spin_unlock_irqrestore(&ndlp->lock, iflags); - lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, - "0999 %s Not regd: ndlp x%px rport x%px DID " - "x%x FLG x%x XPT x%x\n", - __func__, ndlp, ndlp->rport, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->fc4_xpt_flags); return; } @@ -4766,13 +4722,6 @@ ndlp->fc4_xpt_flags & SCSI_XPT_REGD) { vport->phba->nport_event_cnt++; lpfc_unregister_remote_port(ndlp); - } else if (!ndlp->rport) { - lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, - "1999 %s NDLP in devloss x%px DID x%x FLG x%x" - " XPT x%x refcnt %d\n", - __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag, - ndlp->fc4_xpt_flags, - kref_read(&ndlp->kref)); } if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) { @@ -5416,7 +5365,6 @@ ndlp->nlp_flag &= ~NLP_UNREG_INP; mempool_free(mbox, phba->mbox_mem_pool); acc_plogi = 1; - lpfc_nlp_put(ndlp); } } else { lpfc_printf_vlog(vport, KERN_INFO, @@ -6141,34 +6089,12 @@ } } -/* - * lpfc_notify_xport_npr - notifies xport of node disappearance - * @vport: Pointer to Virtual Port object. - * - * Transitions all ndlps to NPR state. When lpfc_nlp_set_state - * calls lpfc_nlp_state_cleanup, the ndlp->rport is unregistered - * and transport notified that the node is gone. - * Return Code: - * none - */ -static void -lpfc_notify_xport_npr(struct lpfc_vport *vport) -{ - struct lpfc_nodelist *ndlp, *next_ndlp; - - list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, - nlp_listp) { - lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); - } -} void lpfc_cleanup_discovery_resources(struct lpfc_vport *vport) { lpfc_els_flush_rscn(vport); lpfc_els_flush_cmd(vport); lpfc_disc_flush_list(vport); - if (pci_channel_offline(vport->phba->pcidev)) - lpfc_notify_xport_npr(vport); } /*****************************************************************************/ reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc_init.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc_init.c @@ -95,7 +95,6 @@ static uint16_t lpfc_find_cpu_handle(struct lpfc_hba *, uint16_t, int); static void lpfc_setup_bg(struct lpfc_hba *, struct Scsi_Host *); static int lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *); -static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba); static struct scsi_transport_template *lpfc_transport_template = NULL; static struct scsi_transport_template *lpfc_vport_transport_template = NULL; @@ -1653,7 +1652,7 @@ { spin_lock_irq(&phba->hbalock); if (phba->link_state == LPFC_HBA_ERROR && + phba->hba_flag & HBA_PCI_ERR) { - test_bit(HBA_PCI_ERR, &phba->bit_flags)) { spin_unlock_irq(&phba->hbalock); return; } @@ -1996,7 +1995,6 @@ if (pci_channel_offline(phba->pcidev)) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "3166 pci channel is offline\n"); - lpfc_sli_flush_io_rings(phba); return; } @@ -2985,22 +2983,6 @@ NLP_EVT_DEVICE_RM); } - /* This is a special case flush to return all - * IOs before entering this loop. There are - * two points in the code where a flush is - * avoided if the FC_UNLOADING flag is set. - * one is in the multipool destroy, - * (this prevents a crash) and the other is - * in the nvme abort handler, ( also prevents - * a crash). Both of these exceptions are - * cases where the slot is still accessible. - * The flush here is only when the pci slot - * is offline. - */ - if (vport->load_flag & FC_UNLOADING && - pci_channel_offline(phba->pcidev)) - lpfc_sli_flush_io_rings(vport->phba); - /* At this point, ALL ndlp's should be gone * because of the previous NLP_EVT_DEVICE_RM. * Lets wait for this to happen, if needed. @@ -3013,7 +2995,7 @@ list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { lpfc_printf_vlog(ndlp->vport, KERN_ERR, + LOG_TRACE_EVENT, - LOG_DISCOVERY, "0282 did:x%x ndlp:x%px " "refcnt:%d xflags x%x nflag x%x\n", ndlp->nlp_DID, (void *)ndlp, @@ -3710,8 +3692,7 @@ struct lpfc_vport **vports; struct Scsi_Host *shost; int i; + int offline = 0; - int offline; - bool hba_pci_err; if (vport->fc_flag & FC_OFFLINE_MODE) return; @@ -3721,7 +3702,6 @@ lpfc_linkdown(phba); offline = pci_channel_offline(phba->pcidev); - hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); /* Issue an unreg_login to all nodes on all vports */ vports = lpfc_create_vport_work_array(phba); @@ -3745,14 +3725,11 @@ ndlp->nlp_flag &= ~NLP_NPR_ADISC; spin_unlock_irq(&ndlp->lock); + if (offline) { - if (offline || hba_pci_err) { spin_lock_irq(&ndlp->lock); ndlp->nlp_flag &= ~(NLP_UNREG_INP | NLP_RPI_REGISTERED); spin_unlock_irq(&ndlp->lock); - if (phba->sli_rev == LPFC_SLI_REV4) - lpfc_sli_rpi_release(vports[i], - ndlp); } else { lpfc_unreg_rpi(vports[i], ndlp); } @@ -13389,9 +13366,8 @@ /* Abort all iocbs associated with the hba */ lpfc_sli_hba_iocb_abort(phba); + /* Wait for completion of device XRI exchange busy */ + lpfc_sli4_xri_exchange_busy_wait(phba); - if (!pci_channel_offline(phba->pcidev)) - /* Wait for completion of device XRI exchange busy */ - lpfc_sli4_xri_exchange_busy_wait(phba); /* per-phba callback de-registration for hotplug event */ if (phba->pport) @@ -13410,12 +13386,15 @@ /* Disable FW logging to host memory */ lpfc_ras_stop_fwlog(phba); + /* Unset the queues shared with the hardware then release all + * allocated resources. + */ + lpfc_sli4_queue_unset(phba); + lpfc_sli4_queue_destroy(phba); + /* Reset SLI4 HBA FCoE function */ lpfc_pci_function_reset(phba); - /* release all queue allocated resources. */ - lpfc_sli4_queue_destroy(phba); - /* Free RAS DMA memory */ if (phba->ras_fwlog.ras_enabled) lpfc_sli4_ras_dma_free(phba); @@ -14295,7 +14274,6 @@ "2711 PCI channel permanent disable for failure\n"); /* Block all SCSI devices' I/Os on the host */ lpfc_scsi_dev_block(phba); - lpfc_sli4_prep_dev_for_reset(phba); /* stop all timers */ lpfc_stop_hba_timers(phba); @@ -15091,28 +15069,24 @@ static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "2826 PCI channel disable preparing for reset\n"); - int offline = pci_channel_offline(phba->pcidev); - - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "2826 PCI channel disable preparing for reset offline" - " %d\n", offline); /* Block any management I/Os to the device */ lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); + /* Block all SCSI devices' I/Os on the host */ + lpfc_scsi_dev_block(phba); - /* HBA_PCI_ERR was set in io_error_detect */ - lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); /* Flush all driver's outstanding I/Os as we are to reset */ lpfc_sli_flush_io_rings(phba); - lpfc_offline(phba); /* stop all timers */ lpfc_stop_hba_timers(phba); - lpfc_sli4_queue_destroy(phba); /* Disable interrupt and pci device */ lpfc_sli4_disable_intr(phba); + lpfc_sli4_queue_destroy(phba); pci_disable_device(phba->pcidev); } @@ -15161,7 +15135,6 @@ { struct Scsi_Host *shost = pci_get_drvdata(pdev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; - bool hba_pci_err; switch (state) { case pci_channel_io_normal: @@ -15169,24 +15142,17 @@ lpfc_sli4_prep_dev_for_recover(phba); return PCI_ERS_RESULT_CAN_RECOVER; case pci_channel_io_frozen: + phba->hba_flag |= HBA_PCI_ERR; - hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); /* Fatal error, prepare for slot reset */ + lpfc_sli4_prep_dev_for_reset(phba); - if (!hba_pci_err) - lpfc_sli4_prep_dev_for_reset(phba); - else - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "2832 Already handling PCI error " - "state: x%x\n", state); return PCI_ERS_RESULT_NEED_RESET; case pci_channel_io_perm_failure: + phba->hba_flag |= HBA_PCI_ERR; - set_bit(HBA_PCI_ERR, &phba->bit_flags); /* Permanent failure, prepare for device down */ lpfc_sli4_prep_dev_for_perm_failure(phba); return PCI_ERS_RESULT_DISCONNECT; default: + phba->hba_flag |= HBA_PCI_ERR; - hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); - if (!hba_pci_err) - lpfc_sli4_prep_dev_for_reset(phba); /* Unknown state, prepare and request slot reset */ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "2825 Unknown PCI error state: x%x\n", state); @@ -15220,21 +15186,17 @@ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; struct lpfc_sli *psli = &phba->sli; uint32_t intr_mode; - bool hba_pci_err; dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n"); if (pci_enable_device_mem(pdev)) { printk(KERN_ERR "lpfc: Cannot re-enable " + "PCI device after reset.\n"); - "PCI device after reset.\n"); return PCI_ERS_RESULT_DISCONNECT; } pci_restore_state(pdev); + phba->hba_flag &= ~HBA_PCI_ERR; - hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); - if (!hba_pci_err) - dev_info(&pdev->dev, - "hba_pci_err was not set, recovering slot reset.\n"); /* * As the new kernel behavior of pci_restore_state() API call clears * device saved_state flag, need to save the restored state again. @@ -15248,8 +15210,6 @@ psli->sli_flag &= ~LPFC_SLI_ACTIVE; spin_unlock_irq(&phba->hbalock); - /* Init cpu_map array */ - lpfc_cpu_map_array_init(phba); /* Configure and enable interrupt */ intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); if (intr_mode == LPFC_INTR_ERROR) { @@ -15291,6 +15251,8 @@ */ if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { /* Perform device reset */ + lpfc_offline_prep(phba, LPFC_MBX_WAIT); + lpfc_offline(phba); lpfc_sli_brdrestart(phba); /* Bring the device back online */ lpfc_online(phba); reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc_nvme.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc_nvme.c @@ -93,11 +93,6 @@ lport = (struct lpfc_nvme_lport *)pnvme_lport->private; vport = lport->vport; - - if (!vport || vport->load_flag & FC_UNLOADING || - vport->phba->hba_flag & HBA_IOQ_FLUSH) - return -ENODEV; - qhandle = kzalloc(sizeof(struct lpfc_nvme_qhandle), GFP_KERNEL); if (qhandle == NULL) return -ENOMEM; @@ -272,8 +267,7 @@ return -EINVAL; remoteport = lpfc_rport->remoteport; + if (!vport->localport) - if (!vport->localport || - vport->phba->hba_flag & HBA_IOQ_FLUSH) return -EINVAL; lport = vport->localport->private; @@ -565,8 +559,6 @@ ndlp->nlp_DID, ntype, nstate); return -ENODEV; } - if (vport->phba->hba_flag & HBA_IOQ_FLUSH) - return -ENODEV; if (!vport->phba->sli4_hba.nvmels_wq) return -ENOMEM; @@ -670,8 +662,7 @@ return -EINVAL; vport = lport->vport; + if (vport->load_flag & FC_UNLOADING) - if (vport->load_flag & FC_UNLOADING || - vport->phba->hba_flag & HBA_IOQ_FLUSH) return -ENODEV; atomic_inc(&lport->fc4NvmeLsRequests); @@ -1524,8 +1515,7 @@ phba = vport->phba; + if (unlikely(vport->load_flag & FC_UNLOADING)) { - if ((unlikely(vport->load_flag & FC_UNLOADING)) || - phba->hba_flag & HBA_IOQ_FLUSH) { lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, "6124 Fail IO, Driver unload\n"); atomic_inc(&lport->xmt_fcp_err); @@ -2179,7 +2169,8 @@ abts_nvme = 0; for (i = 0; i < phba->cfg_hdw_queue; i++) { qp = &phba->sli4_hba.hdwq[i]; + if (!vport || !vport->localport || + !qp || !qp->io_wq) - if (!vport->localport || !qp || !qp->io_wq) return; pring = qp->io_wq->pring; @@ -2189,9 +2180,8 @@ abts_scsi += qp->abts_scsi_io_bufs; abts_nvme += qp->abts_nvme_io_bufs; } + if (!vport || !vport->localport || + vport->phba->hba_flag & HBA_PCI_ERR) - if (!vport->localport || - test_bit(HBA_PCI_ERR, &vport->phba->bit_flags) || - vport->load_flag & FC_UNLOADING) return; lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, @@ -2551,7 +2541,8 @@ * return values is ignored. The upcall is a courtesy to the * transport. */ + if (vport->load_flag & FC_UNLOADING || + unlikely(vport->phba->hba_flag & HBA_PCI_ERR)) - if (vport->load_flag & FC_UNLOADING) (void)nvme_fc_set_remoteport_devloss(remoteport, 0); ret = nvme_fc_unregister_remoteport(remoteport); reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/lpfc/lpfc_sli.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/lpfc/lpfc_sli.c @@ -2833,12 +2833,6 @@ ndlp->nlp_flag &= ~NLP_UNREG_INP; } -void -lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) -{ - __lpfc_sli_rpi_release(vport, ndlp); -} - /** * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler * @phba: Pointer to HBA context object. @@ -4472,62 +4466,42 @@ void lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) { + LIST_HEAD(completions); - LIST_HEAD(tx_completions); - LIST_HEAD(txcmplq_completions); struct lpfc_iocbq *iocb, *next_iocb; - int offline; if (pring->ringno == LPFC_ELS_RING) { lpfc_fabric_abort_hba(phba); } - offline = pci_channel_offline(phba->pcidev); /* Error everything on txq and txcmplq * First do the txq. */ if (phba->sli_rev >= LPFC_SLI_REV4) { spin_lock_irq(&pring->ring_lock); + list_splice_init(&pring->txq, &completions); - list_splice_init(&pring->txq, &tx_completions); pring->txq_cnt = 0; + spin_unlock_irq(&pring->ring_lock); + spin_lock_irq(&phba->hbalock); + /* Next issue ABTS for everything on the txcmplq */ + list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) + lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL); + spin_unlock_irq(&phba->hbalock); - if (offline) { - list_splice_init(&pring->txcmplq, - &txcmplq_completions); - } else { - /* Next issue ABTS for everything on the txcmplq */ - list_for_each_entry_safe(iocb, next_iocb, - &pring->txcmplq, list) - lpfc_sli_issue_abort_iotag(phba, pring, - iocb, NULL); - } - spin_unlock_irq(&pring->ring_lock); } else { spin_lock_irq(&phba->hbalock); + list_splice_init(&pring->txq, &completions); - list_splice_init(&pring->txq, &tx_completions); pring->txq_cnt = 0; + /* Next issue ABTS for everything on the txcmplq */ + list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) + lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL); - if (offline) { - list_splice_init(&pring->txcmplq, &txcmplq_completions); - } else { - /* Next issue ABTS for everything on the txcmplq */ - list_for_each_entry_safe(iocb, next_iocb, - &pring->txcmplq, list) - lpfc_sli_issue_abort_iotag(phba, pring, - iocb, NULL); - } spin_unlock_irq(&phba->hbalock); } + /* Make sure HBA is alive */ + lpfc_issue_hb_tmo(phba); - if (offline) { - /* Cancel all the IOCBs from the completions list */ - lpfc_sli_cancel_iocbs(phba, &txcmplq_completions, - IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED); - } else { - /* Make sure HBA is alive */ - lpfc_issue_hb_tmo(phba); - } /* Cancel all the IOCBs from the completions list */ + lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, - lpfc_sli_cancel_iocbs(phba, &tx_completions, IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED); } @@ -4580,6 +4554,11 @@ struct lpfc_iocbq *piocb, *next_iocb; spin_lock_irq(&phba->hbalock); + if (phba->hba_flag & HBA_IOQ_FLUSH || + !phba->sli4_hba.hdwq) { + spin_unlock_irq(&phba->hbalock); + return; + } /* Indicate the I/O queues are flushed */ phba->hba_flag |= HBA_IOQ_FLUSH; spin_unlock_irq(&phba->hbalock); @@ -11256,10 +11235,6 @@ unsigned long iflags; int rc; - /* If the PCI channel is in offline state, do not post iocbs. */ - if (unlikely(pci_channel_offline(phba->pcidev))) - return IOCB_ERROR; - if (phba->sli_rev == LPFC_SLI_REV4) { eq = phba->sli4_hba.hdwq[piocb->hba_wqidx].hba_eq; reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/megaraid/megaraid_sas.h +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/megaraid/megaraid_sas.h @@ -2558,9 +2558,6 @@ #define MEGASAS_IS_LOGICAL(sdev) \ ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) -#define MEGASAS_IS_LUN_VALID(sdev) \ - (((sdev)->lun == 0) ? 1 : 0) - #define MEGASAS_DEV_INDEX(scp) \ (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ scp->device->id) reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/megaraid/megaraid_sas_base.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2126,9 +2126,6 @@ goto scan_target; } return -ENXIO; - } else if (!MEGASAS_IS_LUN_VALID(sdev)) { - sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__); - return -ENXIO; } scan_target: @@ -2159,10 +2156,6 @@ instance = megasas_lookup_instance(sdev->host->host_no); if (MEGASAS_IS_LOGICAL(sdev)) { - if (!MEGASAS_IS_LUN_VALID(sdev)) { - sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__); - return; - } ld_tgt_id = MEGASAS_TARGET_ID(sdev); instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_DELETED; if (megasas_dbg_lvl & LD_PD_DEBUG) reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/mpt3sas/mpt3sas_config.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/mpt3sas/mpt3sas_config.c @@ -394,13 +394,10 @@ retry_count++; if (ioc->config_cmds.smid == smid) mpt3sas_base_free_smid(ioc, smid); + if ((ioc->shost_recovery) || (ioc->config_cmds.status & + MPT3_CMD_RESET) || ioc->pci_error_recovery) - if (ioc->config_cmds.status & MPT3_CMD_RESET) goto retry_config; + issue_host_reset = 1; - if (ioc->shost_recovery || ioc->pci_error_recovery) { - issue_host_reset = 0; - r = -EFAULT; - } else - issue_host_reset = 1; goto free_mem; } diff -u linux-oem-5.17-5.17.0/drivers/scsi/mvsas/mv_init.c linux-oem-5.17-5.17.0/drivers/scsi/mvsas/mv_init.c --- linux-oem-5.17-5.17.0/drivers/scsi/mvsas/mv_init.c +++ linux-oem-5.17-5.17.0/drivers/scsi/mvsas/mv_init.c @@ -646,7 +646,6 @@ { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 }, - { PCI_VDEVICE(TTI, 0x2640), chip_6440 }, { PCI_VDEVICE(TTI, 0x2710), chip_9480 }, { PCI_VDEVICE(TTI, 0x2720), chip_9480 }, { PCI_VDEVICE(TTI, 0x2721), chip_9480 }, diff -u linux-oem-5.17-5.17.0/drivers/scsi/pm8001/pm80xx_hwi.c linux-oem-5.17-5.17.0/drivers/scsi/pm8001/pm80xx_hwi.c --- linux-oem-5.17-5.17.0/drivers/scsi/pm8001/pm80xx_hwi.c +++ linux-oem-5.17-5.17.0/drivers/scsi/pm8001/pm80xx_hwi.c @@ -766,10 +766,6 @@ pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity = 0x01; pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt = 0x01; - /* Enable higher IQs and OQs, 32 to 63, bit 16 */ - if (pm8001_ha->max_q_num > 32) - pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= - 1 << 16; /* Disable end to end CRC checking */ pm8001_ha->main_cfg_tbl.pm80xx_tbl.crc_core_dump = (0x1 << 16); @@ -1031,13 +1027,6 @@ if (0x0000 != gst_len_mpistate) return -EBUSY; - /* - * As per controller datasheet, after successful MPI - * initialization minimum 500ms delay is required before - * issuing commands. - */ - msleep(500); - return 0; } @@ -1745,11 +1734,10 @@ pm80xx_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec) { #ifdef PM8001_USE_MSIX - if (vec < 32) - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, 1U << vec); - else - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR_U, - 1U << (vec - 32)); + u32 mask; + mask = (u32)(1 << vec); + + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, (u32)(mask & 0xFFFFFFFF)); return; #endif pm80xx_chip_intx_interrupt_enable(pm8001_ha); @@ -1765,15 +1753,12 @@ pm80xx_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec) { #ifdef PM8001_USE_MSIX - if (vec == 0xFF) { - /* disable all vectors 0-31, 32-63 */ - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 0xFFFFFFFF); - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, 0xFFFFFFFF); - } else if (vec < 32) - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 1U << vec); + u32 mask; + if (vec == 0xFF) + mask = 0xFFFFFFFF; else - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, - 1U << (vec - 32)); + mask = (u32)(1 << vec); + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, (u32)(mask & 0xFFFFFFFF)); return; #endif pm80xx_chip_intx_interrupt_disable(pm8001_ha); reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/qedi/qedi_iscsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/qedi/qedi_iscsi.c @@ -859,37 +859,6 @@ return qedi_iscsi_send_ioreq(task); } -static void qedi_offload_work(struct work_struct *work) -{ - struct qedi_endpoint *qedi_ep = - container_of(work, struct qedi_endpoint, offload_work); - struct qedi_ctx *qedi; - int wait_delay = 5 * HZ; - int ret; - - qedi = qedi_ep->qedi; - - ret = qedi_iscsi_offload_conn(qedi_ep); - if (ret) { - QEDI_ERR(&qedi->dbg_ctx, - "offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n", - qedi_ep->iscsi_cid, qedi_ep, ret); - qedi_ep->state = EP_STATE_OFLDCONN_FAILED; - return; - } - - ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait, - (qedi_ep->state == - EP_STATE_OFLDCONN_COMPL), - wait_delay); - if (ret <= 0 || qedi_ep->state != EP_STATE_OFLDCONN_COMPL) { - qedi_ep->state = EP_STATE_OFLDCONN_FAILED; - QEDI_ERR(&qedi->dbg_ctx, - "Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n", - qedi_ep->iscsi_cid, qedi_ep); - } -} - static struct iscsi_endpoint * qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, int non_blocking) @@ -938,7 +907,6 @@ } qedi_ep = ep->dd_data; memset(qedi_ep, 0, sizeof(struct qedi_endpoint)); - INIT_WORK(&qedi_ep->offload_work, qedi_offload_work); qedi_ep->state = EP_STATE_IDLE; qedi_ep->iscsi_cid = (u32)-1; qedi_ep->qedi = qedi; @@ -1087,11 +1055,12 @@ qedi_ep = ep->dd_data; qedi = qedi_ep->qedi; - flush_work(&qedi_ep->offload_work); - if (qedi_ep->state == EP_STATE_OFLDCONN_START) goto ep_exit_recover; + if (qedi_ep->state != EP_STATE_OFLDCONN_NONE) + flush_work(&qedi_ep->offload_work); + if (qedi_ep->conn) { qedi_conn = qedi_ep->conn; abrt_conn = qedi_conn->abrt_conn; @@ -1265,6 +1234,37 @@ return rc; } +static void qedi_offload_work(struct work_struct *work) +{ + struct qedi_endpoint *qedi_ep = + container_of(work, struct qedi_endpoint, offload_work); + struct qedi_ctx *qedi; + int wait_delay = 5 * HZ; + int ret; + + qedi = qedi_ep->qedi; + + ret = qedi_iscsi_offload_conn(qedi_ep); + if (ret) { + QEDI_ERR(&qedi->dbg_ctx, + "offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n", + qedi_ep->iscsi_cid, qedi_ep, ret); + qedi_ep->state = EP_STATE_OFLDCONN_FAILED; + return; + } + + ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait, + (qedi_ep->state == + EP_STATE_OFLDCONN_COMPL), + wait_delay); + if ((ret <= 0) || (qedi_ep->state != EP_STATE_OFLDCONN_COMPL)) { + qedi_ep->state = EP_STATE_OFLDCONN_FAILED; + QEDI_ERR(&qedi->dbg_ctx, + "Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n", + qedi_ep->iscsi_cid, qedi_ep); + } +} + static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data) { struct qedi_ctx *qedi; @@ -1380,6 +1380,7 @@ qedi_ep->dst_addr, qedi_ep->dst_port); } + INIT_WORK(&qedi_ep->offload_work, qedi_offload_work); queue_work(qedi->offload_thread, &qedi_ep->offload_work); ret = 0; reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/scsi_transport_iscsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/scsi_transport_iscsi.c @@ -86,9 +86,6 @@ struct transport_container session_cont; }; -static DEFINE_IDR(iscsi_ep_idr); -static DEFINE_MUTEX(iscsi_ep_idr_mutex); - static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ static struct workqueue_struct *iscsi_eh_timer_workq; @@ -172,11 +169,6 @@ static void iscsi_endpoint_release(struct device *dev) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); - - mutex_lock(&iscsi_ep_idr_mutex); - idr_remove(&iscsi_ep_idr, ep->id); - mutex_unlock(&iscsi_ep_idr_mutex); - kfree(ep); } @@ -189,7 +181,7 @@ show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); + return sysfs_emit(buf, "%llu\n", (unsigned long long) ep->id); - return sysfs_emit(buf, "%d\n", ep->id); } static ISCSI_ATTR(ep, handle, S_IRUGO, show_ep_handle, NULL); @@ -202,32 +194,48 @@ .attrs = iscsi_endpoint_attrs, }; +#define ISCSI_MAX_EPID -1 + +static int iscsi_match_epid(struct device *dev, const void *data) +{ + struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); + const uint64_t *epid = data; + + return *epid == ep->id; +} + struct iscsi_endpoint * iscsi_create_endpoint(int dd_size) { + struct device *dev; struct iscsi_endpoint *ep; + uint64_t id; + int err; + + for (id = 1; id < ISCSI_MAX_EPID; id++) { + dev = class_find_device(&iscsi_endpoint_class, NULL, &id, + iscsi_match_epid); + if (!dev) + break; + else + put_device(dev); + } + if (id == ISCSI_MAX_EPID) { + printk(KERN_ERR "Too many connections. Max supported %u\n", + ISCSI_MAX_EPID - 1); + return NULL; + } - int err, id; ep = kzalloc(sizeof(*ep) + dd_size, GFP_KERNEL); if (!ep) return NULL; - mutex_lock(&iscsi_ep_idr_mutex); - id = idr_alloc(&iscsi_ep_idr, ep, 0, -1, GFP_NOIO); - if (id < 0) { - mutex_unlock(&iscsi_ep_idr_mutex); - printk(KERN_ERR "Could not allocate endpoint ID. Error %d.\n", - id); - goto free_ep; - } - mutex_unlock(&iscsi_ep_idr_mutex); - ep->id = id; ep->dev.class = &iscsi_endpoint_class; + dev_set_name(&ep->dev, "ep-%llu", (unsigned long long) id); - dev_set_name(&ep->dev, "ep-%d", id); err = device_register(&ep->dev); if (err) + goto free_ep; - goto free_id; err = sysfs_create_group(&ep->dev.kobj, &iscsi_endpoint_group); if (err) @@ -241,10 +249,6 @@ device_unregister(&ep->dev); return NULL; -free_id: - mutex_lock(&iscsi_ep_idr_mutex); - idr_remove(&iscsi_ep_idr, id); - mutex_unlock(&iscsi_ep_idr_mutex); free_ep: kfree(ep); return NULL; @@ -272,17 +276,14 @@ */ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) { + struct device *dev; - struct iscsi_endpoint *ep; + dev = class_find_device(&iscsi_endpoint_class, NULL, &handle, + iscsi_match_epid); + if (!dev) + return NULL; - mutex_lock(&iscsi_ep_idr_mutex); - ep = idr_find(&iscsi_ep_idr, handle); - if (!ep) - goto unlock; + return iscsi_dev_to_endpoint(dev); - get_device(&ep->dev); -unlock: - mutex_unlock(&iscsi_ep_idr_mutex); - return ep; } EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint); @@ -2220,10 +2221,10 @@ switch (flag) { case STOP_CONN_RECOVER: + conn->state = ISCSI_CONN_FAILED; - WRITE_ONCE(conn->state, ISCSI_CONN_FAILED); break; case STOP_CONN_TERM: + conn->state = ISCSI_CONN_DOWN; - WRITE_ONCE(conn->state, ISCSI_CONN_DOWN); break; default: iscsi_cls_conn_printk(KERN_ERR, conn, "invalid stop flag %d\n", @@ -2235,49 +2236,6 @@ ISCSI_DBG_TRANS_CONN(conn, "Stopping conn done.\n"); } -static void iscsi_ep_disconnect(struct iscsi_cls_conn *conn, bool is_active) -{ - struct iscsi_cls_session *session = iscsi_conn_to_session(conn); - struct iscsi_endpoint *ep; - - ISCSI_DBG_TRANS_CONN(conn, "disconnect ep.\n"); - WRITE_ONCE(conn->state, ISCSI_CONN_FAILED); - - if (!conn->ep || !session->transport->ep_disconnect) - return; - - ep = conn->ep; - conn->ep = NULL; - - session->transport->unbind_conn(conn, is_active); - session->transport->ep_disconnect(ep); - ISCSI_DBG_TRANS_CONN(conn, "disconnect ep done.\n"); -} - -static void iscsi_if_disconnect_bound_ep(struct iscsi_cls_conn *conn, - struct iscsi_endpoint *ep, - bool is_active) -{ - /* Check if this was a conn error and the kernel took ownership */ - spin_lock_irq(&conn->lock); - if (!test_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { - spin_unlock_irq(&conn->lock); - iscsi_ep_disconnect(conn, is_active); - } else { - spin_unlock_irq(&conn->lock); - ISCSI_DBG_TRANS_CONN(conn, "flush kernel conn cleanup.\n"); - mutex_unlock(&conn->ep_mutex); - - flush_work(&conn->cleanup_work); - /* - * Userspace is now done with the EP so we can release the ref - * iscsi_cleanup_conn_work_fn took. - */ - iscsi_put_endpoint(ep); - mutex_lock(&conn->ep_mutex); - } -} - static int iscsi_if_stop_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) { @@ -2299,24 +2257,11 @@ iscsi_stop_conn(conn, flag); } else { /* - * For offload, when iscsid is restarted it won't know about - * existing endpoints so it can't do a ep_disconnect. We clean - * it up here for userspace. - */ - mutex_lock(&conn->ep_mutex); - if (conn->ep) - iscsi_if_disconnect_bound_ep(conn, conn->ep, true); - mutex_unlock(&conn->ep_mutex); - - /* * Figure out if it was the kernel or userspace initiating this. */ - spin_lock_irq(&conn->lock); if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { - spin_unlock_irq(&conn->lock); iscsi_stop_conn(conn, flag); } else { - spin_unlock_irq(&conn->lock); ISCSI_DBG_TRANS_CONN(conn, "flush kernel conn cleanup.\n"); flush_work(&conn->cleanup_work); @@ -2325,14 +2270,31 @@ * Only clear for recovery to avoid extra cleanup runs during * termination. */ - spin_lock_irq(&conn->lock); clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags); - spin_unlock_irq(&conn->lock); } ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop done.\n"); return 0; } +static void iscsi_ep_disconnect(struct iscsi_cls_conn *conn, bool is_active) +{ + struct iscsi_cls_session *session = iscsi_conn_to_session(conn); + struct iscsi_endpoint *ep; + + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep.\n"); + conn->state = ISCSI_CONN_FAILED; + + if (!conn->ep || !session->transport->ep_disconnect) + return; + + ep = conn->ep; + conn->ep = NULL; + + session->transport->unbind_conn(conn, is_active); + session->transport->ep_disconnect(ep); + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep done.\n"); +} + static void iscsi_cleanup_conn_work_fn(struct work_struct *work) { struct iscsi_cls_conn *conn = container_of(work, struct iscsi_cls_conn, @@ -2341,11 +2303,18 @@ mutex_lock(&conn->ep_mutex); /* + * If we are not at least bound there is nothing for us to do. Userspace + * will do a ep_disconnect call if offload is used, but will not be + * doing a stop since there is nothing to clean up, so we have to clear + * the cleanup bit here. - * Get a ref to the ep, so we don't release its ID until after - * userspace is done referencing it in iscsi_if_disconnect_bound_ep. */ + if (conn->state != ISCSI_CONN_BOUND && conn->state != ISCSI_CONN_UP) { + ISCSI_DBG_TRANS_CONN(conn, "Got error while conn is already failed. Ignoring.\n"); + clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags); + mutex_unlock(&conn->ep_mutex); + return; + } + - if (conn->ep) - get_device(&conn->ep->dev); iscsi_ep_disconnect(conn, false); if (system_state != SYSTEM_RUNNING) { @@ -2401,12 +2370,11 @@ conn->dd_data = &conn[1]; mutex_init(&conn->ep_mutex); - spin_lock_init(&conn->lock); INIT_LIST_HEAD(&conn->conn_list); INIT_WORK(&conn->cleanup_work, iscsi_cleanup_conn_work_fn); conn->transport = transport; conn->cid = cid; + conn->state = ISCSI_CONN_DOWN; - WRITE_ONCE(conn->state, ISCSI_CONN_DOWN); /* this is released in the dev's release function */ if (!get_device(&session->dev)) @@ -2593,32 +2561,9 @@ struct iscsi_uevent *ev; struct iscsi_internal *priv; int len = nlmsg_total_size(sizeof(*ev)); - unsigned long flags; - int state; + if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) + queue_work(iscsi_conn_cleanup_workq, &conn->cleanup_work); - spin_lock_irqsave(&conn->lock, flags); - /* - * Userspace will only do a stop call if we are at least bound. And, we - * only need to do the in kernel cleanup if in the UP state so cmds can - * be released to upper layers. If in other states just wait for - * userspace to avoid races that can leave the cleanup_work queued. - */ - state = READ_ONCE(conn->state); - switch (state) { - case ISCSI_CONN_BOUND: - case ISCSI_CONN_UP: - if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, - &conn->flags)) { - queue_work(iscsi_conn_cleanup_workq, - &conn->cleanup_work); - } - break; - default: - ISCSI_DBG_TRANS_CONN(conn, "Got conn error in state %d\n", - state); - break; - } - spin_unlock_irqrestore(&conn->lock, flags); priv = iscsi_if_transport_lookup(conn->transport); if (!priv) @@ -2968,7 +2913,7 @@ char *data = (char*)ev + sizeof(*ev); struct iscsi_cls_conn *conn; struct iscsi_cls_session *session; + int err = 0, value = 0; - int err = 0, value = 0, state; if (ev->u.set_param.len > PAGE_SIZE) return -EINVAL; @@ -2985,8 +2930,8 @@ session->recovery_tmo = value; break; default: + if ((conn->state == ISCSI_CONN_BOUND) || + (conn->state == ISCSI_CONN_UP)) { - state = READ_ONCE(conn->state); - if (state == ISCSI_CONN_BOUND || state == ISCSI_CONN_UP) { err = transport->set_param(conn, ev->u.set_param.param, data, ev->u.set_param.len); } else { @@ -3058,7 +3003,16 @@ } mutex_lock(&conn->ep_mutex); + /* Check if this was a conn error and the kernel took ownership */ + if (test_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { + ISCSI_DBG_TRANS_CONN(conn, "flush kernel conn cleanup.\n"); + mutex_unlock(&conn->ep_mutex); + + flush_work(&conn->cleanup_work); + goto put_ep; + } + + iscsi_ep_disconnect(conn, false); - iscsi_if_disconnect_bound_ep(conn, ep, false); mutex_unlock(&conn->ep_mutex); put_ep: iscsi_put_endpoint(ep); @@ -3761,17 +3715,24 @@ return -EINVAL; mutex_lock(&conn->ep_mutex); - spin_lock_irq(&conn->lock); if (test_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { - spin_unlock_irq(&conn->lock); mutex_unlock(&conn->ep_mutex); ev->r.retcode = -ENOTCONN; return 0; } - spin_unlock_irq(&conn->lock); switch (nlh->nlmsg_type) { case ISCSI_UEVENT_BIND_CONN: + if (conn->ep) { + /* + * For offload boot support where iscsid is restarted + * during the pivot root stage, the ep will be intact + * here when the new iscsid instance starts up and + * reconnects. + */ + iscsi_ep_disconnect(conn, true); + } + session = iscsi_session_lookup(ev->u.b_conn.sid); if (!session) { err = -EINVAL; @@ -3782,7 +3743,7 @@ ev->u.b_conn.transport_eph, ev->u.b_conn.is_leading); if (!ev->r.retcode) + conn->state = ISCSI_CONN_BOUND; - WRITE_ONCE(conn->state, ISCSI_CONN_BOUND); if (ev->r.retcode || !transport->ep_connect) break; @@ -3801,8 +3762,7 @@ case ISCSI_UEVENT_START_CONN: ev->r.retcode = transport->start_conn(conn); if (!ev->r.retcode) + conn->state = ISCSI_CONN_UP; - WRITE_ONCE(conn->state, ISCSI_CONN_UP); - break; case ISCSI_UEVENT_SEND_PDU: pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev); @@ -4110,11 +4070,10 @@ { struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev->parent); const char *state = "unknown"; - int conn_state = READ_ONCE(conn->state); + if (conn->state >= 0 && + conn->state < ARRAY_SIZE(connection_state_names)) + state = connection_state_names[conn->state]; - if (conn_state >= 0 && - conn_state < ARRAY_SIZE(connection_state_names)) - state = connection_state_names[conn_state]; return sysfs_emit(buf, "%s\n", state); } reverted: --- linux-oem-5.17-5.17.0/drivers/scsi/sr_ioctl.c +++ linux-oem-5.17-5.17.0.orig/drivers/scsi/sr_ioctl.c @@ -41,7 +41,7 @@ int result; unsigned char *buffer; + buffer = kmalloc(32, GFP_KERNEL); - buffer = kzalloc(32, GFP_KERNEL); if (!buffer) return -ENOMEM; @@ -55,13 +55,10 @@ cgc.data_direction = DMA_FROM_DEVICE; result = sr_do_ioctl(cd, &cgc); - if (result) - goto err; tochdr->cdth_trk0 = buffer[2]; tochdr->cdth_trk1 = buffer[3]; -err: kfree(buffer); return result; } @@ -74,7 +71,7 @@ int result; unsigned char *buffer; + buffer = kmalloc(32, GFP_KERNEL); - buffer = kzalloc(32, GFP_KERNEL); if (!buffer) return -ENOMEM; @@ -89,8 +86,6 @@ cgc.data_direction = DMA_FROM_DEVICE; result = sr_do_ioctl(cd, &cgc); - if (result) - goto err; tocentry->cdte_ctrl = buffer[5] & 0xf; tocentry->cdte_adr = buffer[5] >> 4; @@ -103,7 +98,6 @@ tocentry->cdte_addr.lba = (((((buffer[8] << 8) + buffer[9]) << 8) + buffer[10]) << 8) + buffer[11]; -err: kfree(buffer); return result; } @@ -390,7 +384,7 @@ { Scsi_CD *cd = cdi->handle; struct packet_command cgc; + char *buffer = kmalloc(32, GFP_KERNEL); - char *buffer = kzalloc(32, GFP_KERNEL); int result; if (!buffer) @@ -406,13 +400,10 @@ cgc.data_direction = DMA_FROM_DEVICE; cgc.timeout = IOCTL_TIMEOUT; result = sr_do_ioctl(cd, &cgc); - if (result) - goto err; memcpy(mcn->medium_catalog_number, buffer + 9, 13); mcn->medium_catalog_number[13] = 0; -err: kfree(buffer); return result; } diff -u linux-oem-5.17-5.17.0/drivers/scsi/ufs/ufshcd.c linux-oem-5.17-5.17.0/drivers/scsi/ufs/ufshcd.c --- linux-oem-5.17-5.17.0/drivers/scsi/ufs/ufshcd.c +++ linux-oem-5.17-5.17.0/drivers/scsi/ufs/ufshcd.c @@ -367,7 +367,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag, enum ufs_trace_str_t str_t) { - u64 lba = 0; + u64 lba; u8 opcode = 0, group_id = 0; u32 intr, doorbell; struct ufshcd_lrb *lrbp = &hba->lrb[tag]; @@ -384,6 +384,7 @@ return; opcode = cmd->cmnd[0]; + lba = scsi_get_lba(cmd); if (opcode == READ_10 || opcode == WRITE_10) { /* @@ -391,7 +392,6 @@ */ transfer_len = be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len); - lba = scsi_get_lba(cmd); if (opcode == WRITE_10) group_id = lrbp->cmd->cmnd[6]; } else if (opcode == UNMAP) { @@ -399,7 +399,6 @@ * The number of Bytes to be unmapped beginning with the lba. */ transfer_len = blk_rq_bytes(rq); - lba = scsi_get_lba(cmd); } intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS); reverted: --- linux-oem-5.17-5.17.0/drivers/soc/imx/imx8m-blk-ctrl.c +++ linux-oem-5.17-5.17.0.orig/drivers/soc/imx/imx8m-blk-ctrl.c @@ -49,7 +49,7 @@ u32 mipi_phy_rst_mask; }; +#define DOMAIN_MAX_CLKS 3 -#define DOMAIN_MAX_CLKS 4 struct imx8m_blk_ctrl_domain { struct generic_pm_domain genpd; reverted: --- linux-oem-5.17-5.17.0/drivers/spi/atmel-quadspi.c +++ linux-oem-5.17-5.17.0.orig/drivers/spi/atmel-quadspi.c @@ -277,9 +277,6 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { - if (!spi_mem_default_supports_op(mem, op)) - return false; - if (atmel_qspi_find_mode(op) < 0) return false; reverted: --- linux-oem-5.17-5.17.0/drivers/spi/spi-cadence-quadspi.c +++ linux-oem-5.17-5.17.0.orig/drivers/spi/spi-cadence-quadspi.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -103,6 +102,12 @@ #define CQSPI_TIMEOUT_MS 500 #define CQSPI_READ_TIMEOUT_MS 10 +/* Instruction type */ +#define CQSPI_INST_TYPE_SINGLE 0 +#define CQSPI_INST_TYPE_DUAL 1 +#define CQSPI_INST_TYPE_QUAD 2 +#define CQSPI_INST_TYPE_OCTAL 3 + #define CQSPI_DUMMY_CLKS_PER_BYTE 8 #define CQSPI_DUMMY_BYTES_MAX 4 #define CQSPI_DUMMY_CLKS_MAX 31 @@ -371,6 +376,10 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, const struct spi_mem_op *op) { + f_pdata->inst_width = CQSPI_INST_TYPE_SINGLE; + f_pdata->addr_width = CQSPI_INST_TYPE_SINGLE; + f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; + /* * For an op to be DTR, cmd phase along with every other non-empty * phase should have dtr field set to 1. If an op phase has zero @@ -380,23 +389,32 @@ (!op->addr.nbytes || op->addr.dtr) && (!op->data.nbytes || op->data.dtr); + switch (op->data.buswidth) { + case 0: + break; + case 1: + f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; + break; + case 2: + f_pdata->data_width = CQSPI_INST_TYPE_DUAL; + break; + case 4: + f_pdata->data_width = CQSPI_INST_TYPE_QUAD; + break; + case 8: + f_pdata->data_width = CQSPI_INST_TYPE_OCTAL; + break; + default: + return -EINVAL; + } - f_pdata->inst_width = 0; - if (op->cmd.buswidth) - f_pdata->inst_width = ilog2(op->cmd.buswidth); - - f_pdata->addr_width = 0; - if (op->addr.buswidth) - f_pdata->addr_width = ilog2(op->addr.buswidth); - - f_pdata->data_width = 0; - if (op->data.buswidth) - f_pdata->data_width = ilog2(op->data.buswidth); /* Right now we only support 8-8-8 DTR mode. */ if (f_pdata->dtr) { switch (op->cmd.buswidth) { case 0: + break; case 8: + f_pdata->inst_width = CQSPI_INST_TYPE_OCTAL; break; default: return -EINVAL; @@ -404,7 +422,9 @@ switch (op->addr.buswidth) { case 0: + break; case 8: + f_pdata->addr_width = CQSPI_INST_TYPE_OCTAL; break; default: return -EINVAL; @@ -412,7 +432,9 @@ switch (op->data.buswidth) { case 0: + break; case 8: + f_pdata->data_width = CQSPI_INST_TYPE_OCTAL; break; default: return -EINVAL; @@ -1415,24 +1437,9 @@ all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr && !op->data.dtr; + /* Mixed DTR modes not supported. */ + if (!(all_true || all_false)) - if (all_true) { - /* Right now we only support 8-8-8 DTR mode. */ - if (op->cmd.nbytes && op->cmd.buswidth != 8) - return false; - if (op->addr.nbytes && op->addr.buswidth != 8) - return false; - if (op->data.nbytes && op->data.buswidth != 8) - return false; - } else if (all_false) { - /* Only 1-1-X ops are supported without DTR */ - if (op->cmd.nbytes && op->cmd.buswidth > 1) - return false; - if (op->addr.nbytes && op->addr.buswidth > 1) - return false; - } else { - /* Mixed DTR modes are not supported. */ return false; - } if (all_true) return spi_mem_dtr_supports_op(mem, op); reverted: --- linux-oem-5.17-5.17.0/drivers/spi/spi-mtk-nor.c +++ linux-oem-5.17-5.17.0.orig/drivers/spi/spi-mtk-nor.c @@ -909,17 +909,7 @@ static int __maybe_unused mtk_nor_resume(struct device *dev) { + return pm_runtime_force_resume(dev); - struct spi_controller *ctlr = dev_get_drvdata(dev); - struct mtk_nor *sp = spi_controller_get_devdata(ctlr); - int ret; - - ret = pm_runtime_force_resume(dev); - if (ret) - return ret; - - mtk_nor_init(sp); - - return 0; } static const struct dev_pm_ops mtk_nor_pm_ops = { reverted: --- linux-oem-5.17-5.17.0/drivers/target/target_core_user.c +++ linux-oem-5.17-5.17.0.orig/drivers/target/target_core_user.c @@ -1820,7 +1820,6 @@ mutex_lock(&udev->cmdr_lock); page = xa_load(&udev->data_pages, dpi); if (likely(page)) { - get_page(page); mutex_unlock(&udev->cmdr_lock); return page; } @@ -1877,7 +1876,6 @@ /* For the vmalloc()ed cmd area pages */ addr = (void *)(unsigned long)info->mem[mi].addr + offset; page = vmalloc_to_page(addr); - get_page(page); } else { uint32_t dpi; @@ -1888,6 +1886,7 @@ return VM_FAULT_SIGBUS; } + get_page(page); vmf->page = page; return 0; } reverted: --- linux-oem-5.17-5.17.0/drivers/tee/optee/ffa_abi.c +++ linux-oem-5.17-5.17.0.orig/drivers/tee/optee/ffa_abi.c @@ -894,7 +894,6 @@ rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL); optee_supp_uninit(&optee->supp); mutex_destroy(&optee->call_queue.mutex); - mutex_destroy(&optee->ffa.mutex); err_unreg_supp_teedev: tee_device_unregister(optee->supp_teedev); err_unreg_teedev: diff -u linux-oem-5.17-5.17.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c linux-oem-5.17-5.17.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c --- linux-oem-5.17-5.17.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ linux-oem-5.17-5.17.0/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -17,8 +17,8 @@ #define INT3400_KEEP_ALIVE 0xA0 enum int3400_thermal_uuid { - INT3400_THERMAL_ACTIVE = 0, INT3400_THERMAL_PASSIVE_1, + INT3400_THERMAL_ACTIVE, INT3400_THERMAL_CRITICAL, INT3400_THERMAL_ADAPTIVE_PERFORMANCE, INT3400_THERMAL_EMERGENCY_CALL_MODE, @@ -31,8 +31,8 @@ }; static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = { - "3A95C389-E4B8-4629-A526-C52C88626BAE", "42A441D6-AE6A-462b-A84B-4A8CE79027D3", + "3A95C389-E4B8-4629-A526-C52C88626BAE", "97C68AE7-15FA-499c-B8C9-5DA81D606E0A", "63BE270F-1C11-48FD-A6F7-3AF253FF3E2D", "5349962F-71E6-431D-9AE8-0A635B710AEE", @@ -59,7 +59,6 @@ char *data_vault; int odvp_count; int *odvp; - u32 os_uuid_mask; struct odvp_attr *odvp_attrs; }; @@ -68,7 +67,7 @@ struct odvp_attr { int odvp; struct int3400_thermal_priv *priv; - struct device_attribute attr; + struct kobj_attribute attr; }; static ssize_t data_vault_read(struct file *file, struct kobject *kobj, @@ -143,55 +142,12 @@ struct device_attribute *devattr, char *buf) { struct int3400_thermal_priv *priv = dev_get_drvdata(dev); - int i, length = 0; - if (priv->current_uuid_index > 0) - return sprintf(buf, "%s\n", - int3400_thermal_uuids[priv->current_uuid_index]); - - for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) { - if (priv->os_uuid_mask & BIT(i)) - length += scnprintf(&buf[length], - PAGE_SIZE - length, - "%s\n", - int3400_thermal_uuids[i]); - } + if (priv->current_uuid_index == -1) + return sprintf(buf, "INVALID\n"); - if (length) - return length; - - return sprintf(buf, "INVALID\n"); -} - -static int int3400_thermal_run_osc(acpi_handle handle, char *uuid_str, int *enable) -{ - u32 ret, buf[2]; - acpi_status status; - int result = 0; - struct acpi_osc_context context = { - .uuid_str = NULL, - .rev = 1, - .cap.length = 8, - }; - - context.uuid_str = uuid_str; - - buf[OSC_QUERY_DWORD] = 0; - buf[OSC_SUPPORT_DWORD] = *enable; - - context.cap.pointer = buf; - - status = acpi_run_osc(handle, &context); - if (ACPI_SUCCESS(status)) { - ret = *((u32 *)(context.ret.pointer + 4)); - if (ret != *enable) - result = -EPERM; - } else - result = -EPERM; - - kfree(context.ret.pointer); - - return result; + return sprintf(buf, "%s\n", + int3400_thermal_uuids[priv->current_uuid_index]); } static ssize_t current_uuid_store(struct device *dev, @@ -208,47 +164,16 @@ * If we have a list of supported UUIDs, make sure * this one is supported. */ - if (priv->uuid_bitmap & BIT(i)) { - priv->current_uuid_index = i; - return count; - } - - /* - * There is support of only 3 policies via the new - * _OSC to inform OS capability: - * INT3400_THERMAL_ACTIVE - * INT3400_THERMAL_PASSIVE_1 - * INT3400_THERMAL_CRITICAL - */ - - if (i > INT3400_THERMAL_CRITICAL) + if (priv->uuid_bitmap && + !(priv->uuid_bitmap & (1 << i))) return -EINVAL; - priv->os_uuid_mask |= BIT(i); - - break; + priv->current_uuid_index = i; + return count; } } - if (priv->os_uuid_mask) { - int cap, ret; - - /* - * Capability bits: - * Bit 0: set to 1 to indicate DPTF is active - * Bi1 1: set to 1 to active cooling is supported by user space daemon - * Bit 2: set to 1 to passive cooling is supported by user space daemon - * Bit 3: set to 1 to critical trip is handled by user space daemon - */ - cap = ((priv->os_uuid_mask << 1) | 0x01); - ret = int3400_thermal_run_osc(priv->adev->handle, - "b23ba85d-c8b7-3542-88de-8de2ffcfd698", - &cap); - if (ret) - return ret; - } - - return count; + return -EINVAL; } static DEVICE_ATTR_RW(current_uuid); @@ -311,7 +236,42 @@ return result; } -static ssize_t odvp_show(struct device *dev, struct device_attribute *attr, +static int int3400_thermal_run_osc(acpi_handle handle, + enum int3400_thermal_uuid uuid, bool enable) +{ + u32 ret, buf[2]; + acpi_status status; + int result = 0; + struct acpi_osc_context context = { + .uuid_str = NULL, + .rev = 1, + .cap.length = 8, + }; + + if (uuid < 0 || uuid >= INT3400_THERMAL_MAXIMUM_UUID) + return -EINVAL; + + context.uuid_str = int3400_thermal_uuids[uuid]; + + buf[OSC_QUERY_DWORD] = 0; + buf[OSC_SUPPORT_DWORD] = enable; + + context.cap.pointer = buf; + + status = acpi_run_osc(handle, &context); + if (ACPI_SUCCESS(status)) { + ret = *((u32 *)(context.ret.pointer + 4)); + if (ret != enable) + result = -EPERM; + } else + result = -EPERM; + + kfree(context.ret.pointer); + + return result; +} + +static ssize_t odvp_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct odvp_attr *odvp_attr; @@ -466,18 +426,10 @@ if (!priv) return -EINVAL; - if (mode != thermal->mode) { - int enabled; - - if (priv->current_uuid_index < 0 || - priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID) - return -EINVAL; - - enabled = (mode == THERMAL_DEVICE_ENABLED); + if (mode != thermal->mode) result = int3400_thermal_run_osc(priv->adev->handle, - int3400_thermal_uuids[priv->current_uuid_index], - &enabled); - } + priv->current_uuid_index, + mode == THERMAL_DEVICE_ENABLED); evaluate_odvp(priv); reverted: --- linux-oem-5.17-5.17.0/drivers/tty/n_gsm.c +++ linux-oem-5.17-5.17.0.orig/drivers/tty/n_gsm.c @@ -73,8 +73,6 @@ */ #define MAX_MRU 1500 #define MAX_MTU 1500 -/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */ -#define PROT_OVERHEAD 7 #define GSM_NET_TX_TIMEOUT (HZ*10) /* @@ -221,6 +219,7 @@ int encoding; u8 control; u8 fcs; + u8 received_fcs; u8 *txframe; /* TX framing buffer */ /* Method for the receiver side */ @@ -232,7 +231,6 @@ int initiator; /* Did we initiate connection */ bool dead; /* Has the mux been shut down */ struct gsm_dlci *dlci[NUM_DLCI]; - int old_c_iflag; /* termios c_iflag value before attach */ bool constipated; /* Asked by remote to shut up */ spinlock_t tx_lock; @@ -273,6 +271,10 @@ static struct tty_driver *gsm_tty_driver; +/* Save dlci open address */ +static int addr_open[256] = { 0 }; +/* Save dlci open count */ +static int addr_cnt; /* * This section of the driver logic implements the GSM encodings * both the basic and the 'advanced'. Reliable transport is not @@ -367,7 +369,6 @@ #define GOOD_FCS 0xCF static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len); -static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk); /** * gsm_fcs_add - update FCS @@ -831,7 +832,7 @@ break; case 2: /* Unstructed with modem bits. Always one byte as we never send inline break data */ + *dp++ = gsm_encode_modem(dlci); - *dp++ = (gsm_encode_modem(dlci) << 1) | EA; break; } WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) != len); @@ -916,66 +917,6 @@ } /** - * gsm_dlci_modem_output - try and push modem status out of a DLCI - * @gsm: mux - * @dlci: the DLCI to pull modem status from - * @brk: break signal - * - * 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. - */ - -static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci, - u8 brk) -{ - u8 *dp = NULL; - struct gsm_msg *msg; - int size = 0; - - /* for modem bits without break data */ - switch (dlci->adaption) { - case 1: /* Unstructured */ - break; - case 2: /* Unstructured with modem bits. */ - size++; - if (brk > 0) - size++; - break; - default: - pr_err("%s: unsupported adaption %d\n", __func__, - dlci->adaption); - return -EINVAL; - } - - msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - if (!msg) { - pr_err("%s: gsm_data_alloc error", __func__); - return -ENOMEM; - } - dp = msg->data; - switch (dlci->adaption) { - case 1: /* Unstructured */ - break; - case 2: /* Unstructured with modem bits. */ - if (brk == 0) { - *dp++ = (gsm_encode_modem(dlci) << 1) | EA; - } else { - *dp++ = gsm_encode_modem(dlci) << 1; - *dp++ = (brk << 4) | 2 | EA; /* Length, Break, EA */ - } - break; - default: - /* Handled above */ - break; - } - - __gsm_data_queue(dlci, msg); - return size; -} - -/** * gsm_dlci_data_sweep - look for data to send * @gsm: the GSM mux * @@ -1152,6 +1093,7 @@ { unsigned int addr = 0; unsigned int modem = 0; + unsigned int brk = 0; struct gsm_dlci *dlci; int len = clen; int slen; @@ -1181,8 +1123,17 @@ return; } len--; + if (len > 0) { + while (gsm_read_ea(&brk, *dp++) == 0) { + len--; + if (len == 0) + return; + } + modem <<= 7; + modem |= (brk & 0x7f); + } tty = tty_port_tty_get(&dlci->port); + gsm_process_modem(tty, dlci, modem, slen); - gsm_process_modem(tty, dlci, modem, slen - len); if (tty) { tty_wakeup(tty); tty_kref_put(tty); @@ -1242,6 +1193,7 @@ } static void gsm_dlci_begin_close(struct gsm_dlci *dlci); +static void gsm_dlci_close(struct gsm_dlci *dlci); /** * gsm_control_message - DLCI 0 control processing @@ -1260,15 +1212,28 @@ { u8 buf[1]; unsigned long flags; + struct gsm_dlci *dlci; + int i; + int address; switch (command) { case CMD_CLD: { + if (addr_cnt > 0) { + for (i = 0; i < addr_cnt; i++) { + address = addr_open[i]; + dlci = gsm->dlci[address]; + gsm_dlci_close(dlci); + addr_open[i] = 0; + } + } - struct gsm_dlci *dlci = gsm->dlci[0]; /* Modem wishes to close down */ + dlci = gsm->dlci[0]; if (dlci) { dlci->dead = true; gsm->dead = true; + gsm_dlci_close(dlci); + addr_cnt = 0; + gsm_response(gsm, 0, UA|PF); - gsm_dlci_begin_close(dlci); } } break; @@ -1361,12 +1326,11 @@ static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl) { + struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype); - struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype); if (msg == NULL) return; + msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */ + memcpy(msg->data + 1, ctrl->data, ctrl->len); - msg->data[0] = (ctrl->cmd << 1) | CR | EA; /* command */ - msg->data[1] = (ctrl->len << 1) | EA; - memcpy(msg->data + 2, ctrl->data, ctrl->len); gsm_data_queue(gsm->dlci[0], msg); } @@ -1389,6 +1353,7 @@ spin_lock_irqsave(&gsm->control_lock, flags); ctrl = gsm->pending_cmd; if (ctrl) { + gsm->cretries--; if (gsm->cretries == 0) { gsm->pending_cmd = NULL; ctrl->error = -ETIMEDOUT; @@ -1397,7 +1362,6 @@ wake_up(&gsm->event); return; } - gsm->cretries--; gsm_control_transmit(gsm, ctrl); mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100); } @@ -1438,7 +1402,7 @@ /* If DLCI0 is in ADM mode skip retries, it won't respond */ if (gsm->dlci[0]->mode == DLCI_MODE_ADM) + gsm->cretries = 1; - gsm->cretries = 0; else gsm->cretries = gsm->n2; @@ -1486,22 +1450,20 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) { - unsigned long flags; - del_timer(&dlci->t1); if (debug & 8) pr_debug("DLCI %d goes closed.\n", dlci->addr); dlci->state = DLCI_CLOSED; if (dlci->addr != 0) { tty_port_tty_hangup(&dlci->port, false); - spin_lock_irqsave(&dlci->lock, flags); kfifo_reset(&dlci->fifo); - spin_unlock_irqrestore(&dlci->lock, flags); /* Ensure that gsmtty_open() can return. */ tty_port_set_initialized(&dlci->port, 0); wake_up_interruptible(&dlci->port.open_wait); } else dlci->gsm->dead = true; + /* Unregister gsmtty driver,report gsmtty dev remove uevent for user */ + tty_unregister_device(gsm_tty_driver, dlci->addr); wake_up(&dlci->gsm->event); /* A DLCI 0 close is a MUX termination so we need to kick that back to userspace somehow */ @@ -1523,9 +1485,8 @@ dlci->state = DLCI_OPEN; if (debug & 8) pr_debug("DLCI %d goes open.\n", dlci->addr); + /* Register gsmtty driver,report gsmtty dev add uevent for user */ + tty_register_device(gsm_tty_driver, dlci->addr, NULL); - /* Send current modem state */ - if (dlci->addr) - gsm_modem_update(dlci, 0); wake_up(&dlci->gsm->event); } @@ -1662,7 +1623,6 @@ tty = tty_port_tty_get(port); if (tty) { gsm_process_modem(tty, dlci, modem, slen); - tty_wakeup(tty); tty_kref_put(tty); } fallthrough; @@ -1833,7 +1793,19 @@ struct gsm_dlci *dlci; u8 cr; int address; + int i, j, k, address_tmp; + /* We have to sneak a look at the packet body to do the FCS. + A somewhat layering violation in the spec */ + if ((gsm->control & ~PF) == UI) + gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len); + if (gsm->encoding == 0) { + /* WARNING: gsm->received_fcs is used for + gsm->encoding = 0 only. + In this case it contain the last piece of data + required to generate final CRC */ + gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs); + } if (gsm->fcs != GOOD_FCS) { gsm->bad_fcs++; if (debug & 4) @@ -1864,6 +1836,11 @@ else { gsm_response(gsm, address, UA|PF); gsm_dlci_open(dlci); + /* Save dlci open address */ + if (address) { + addr_open[addr_cnt] = address; + addr_cnt++; + } } break; case DISC|PF: @@ -1874,9 +1851,35 @@ return; } /* Real close complete */ + if (!address) { + if (addr_cnt > 0) { + for (i = 0; i < addr_cnt; i++) { + address = addr_open[i]; + dlci = gsm->dlci[address]; + gsm_dlci_close(dlci); + addr_open[i] = 0; + } + } + dlci = gsm->dlci[0]; + gsm_dlci_close(dlci); + addr_cnt = 0; + gsm_response(gsm, 0, UA|PF); + } else { + gsm_response(gsm, address, UA|PF); + gsm_dlci_close(dlci); + /* clear dlci address */ + for (j = 0; j < addr_cnt; j++) { + address_tmp = addr_open[j]; + if (address_tmp == address) { + for (k = j; k < addr_cnt; k++) + addr_open[k] = addr_open[k+1]; + addr_cnt--; + break; + } + } + } - gsm_response(gsm, address, UA|PF); - gsm_dlci_close(dlci); break; + case UA: case UA|PF: if (cr == 0 || dlci == NULL) break; @@ -1990,25 +1993,19 @@ break; case GSM_DATA: /* Data */ gsm->buf[gsm->count++] = c; + if (gsm->count == gsm->len) - if (gsm->count == gsm->len) { - /* Calculate final FCS for UI frames over all data */ - if ((gsm->control & ~PF) != UIH) { - gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, - gsm->count); - } gsm->state = GSM_FCS; - } break; case GSM_FCS: /* FCS follows the packet */ + gsm->received_fcs = c; + gsm_queue(gsm); - gsm->fcs = gsm_fcs_add(gsm->fcs, c); gsm->state = GSM_SSOF; break; case GSM_SSOF: + if (c == GSM0_SOF) { + gsm->state = GSM_SEARCH; + break; + } - gsm->state = GSM_SEARCH; - if (c == GSM0_SOF) - gsm_queue(gsm); - else - gsm->bad_size++; break; default: pr_debug("%s: unhandled state: %d\n", __func__, gsm->state); @@ -2026,35 +2023,12 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) { - /* handle XON/XOFF */ - if ((c & ISO_IEC_646_MASK) == XON) { - gsm->constipated = true; - return; - } else if ((c & ISO_IEC_646_MASK) == XOFF) { - gsm->constipated = false; - /* Kick the link in case it is idling */ - gsm_data_kick(gsm, NULL); - return; - } if (c == GSM1_SOF) { + /* EOF is only valid in frame if we have got to the data state + and received at least one byte (the FCS) */ + if (gsm->state == GSM_DATA && gsm->count) { + /* Extract the FCS */ - /* EOF is only valid in frame if we have got to the data state */ - if (gsm->state == GSM_DATA) { - if (gsm->count < 1) { - /* Missing FSC */ - gsm->malformed++; - gsm->state = GSM_START; - return; - } - /* Remove the FCS from data */ gsm->count--; - if ((gsm->control & ~PF) != UIH) { - /* Calculate final FCS for UI frames over all - * data but FCS - */ - gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, - gsm->count); - } - /* Add the FCS itself to test against GOOD_FCS */ gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->buf[gsm->count]); gsm->len = gsm->count; gsm_queue(gsm); @@ -2063,8 +2037,7 @@ } /* Any partial frame was a runt so go back to start */ if (gsm->state != GSM_START) { + gsm->malformed++; - if (gsm->state != GSM_SEARCH) - gsm->malformed++; gsm->state = GSM_START; } /* A SOF in GSM_START means we are still reading idling or @@ -2133,43 +2106,74 @@ gsm->io_error++; } +static int gsm_disconnect(struct gsm_mux *gsm) +{ + struct gsm_dlci *dlci = gsm->dlci[0]; + struct gsm_control *gc; + + if (!dlci) + return 0; + + /* In theory disconnecting DLCI 0 is sufficient but for some + modems this is apparently not the case. */ + gc = gsm_control_send(gsm, CMD_CLD, NULL, 0); + if (gc) + gsm_control_wait(gsm, gc); + + del_timer_sync(&gsm->t2_timer); + /* Now we are sure T2 has stopped */ + + gsm_dlci_begin_close(dlci); + wait_event_interruptible(gsm->event, + dlci->state == DLCI_CLOSED); + + if (signal_pending(current)) + return -EINTR; + + return 0; +} + /** * gsm_cleanup_mux - generic GSM protocol cleanup * @gsm: our mux - * @disc: disconnect link? * * Clean up the bits of the mux which are the same for all framing * protocols. Remove the mux from the mux table, stop all the timers * and then shut down each device hanging up the channels as we go. */ +static void gsm_cleanup_mux(struct gsm_mux *gsm) -static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc) { int i; struct gsm_dlci *dlci = gsm->dlci[0]; struct gsm_msg *txq, *ntxq; gsm->dead = true; - mutex_lock(&gsm->mutex); + spin_lock(&gsm_mux_lock); + for (i = 0; i < MAX_MUX; i++) { + if (gsm_mux[i] == gsm) { + gsm_mux[i] = NULL; + break; - if (dlci) { - if (disc && dlci->state != DLCI_CLOSED) { - gsm_dlci_begin_close(dlci); - wait_event(gsm->event, dlci->state == DLCI_CLOSED); } - dlci->dead = true; } + spin_unlock(&gsm_mux_lock); + /* open failed before registering => nothing to do */ + if (i == MAX_MUX) + return; - /* Finish outstanding timers, making sure they are done */ del_timer_sync(&gsm->t2_timer); + /* Now we are sure T2 has stopped */ + if (dlci) + dlci->dead = true; + /* Free up any link layer users */ + mutex_lock(&gsm->mutex); + for (i = 0; i < NUM_DLCI; i++) - /* Free up any link layer users and finally the control channel */ - for (i = NUM_DLCI - 1; i >= 0; i--) if (gsm->dlci[i]) gsm_dlci_release(gsm->dlci[i]); mutex_unlock(&gsm->mutex); /* Now wipe the queues */ - tty_ldisc_flush(gsm->tty); list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list) kfree(txq); INIT_LIST_HEAD(&gsm->tx_list); @@ -2187,6 +2191,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) { struct gsm_dlci *dlci; + int i = 0; timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); @@ -2198,6 +2203,18 @@ else gsm->receive = gsm1_receive; + spin_lock(&gsm_mux_lock); + for (i = 0; i < MAX_MUX; i++) { + if (gsm_mux[i] == NULL) { + gsm->num = i; + gsm_mux[i] = gsm; + break; + } + } + spin_unlock(&gsm_mux_lock); + if (i == MAX_MUX) + return -EBUSY; + dlci = gsm_dlci_alloc(gsm, 0); if (dlci == NULL) return -ENOMEM; @@ -2213,15 +2230,6 @@ */ static void gsm_free_mux(struct gsm_mux *gsm) { - int i; - - for (i = 0; i < MAX_MUX; i++) { - if (gsm == gsm_mux[i]) { - gsm_mux[i] = NULL; - break; - } - } - mutex_destroy(&gsm->mutex); kfree(gsm->txframe); kfree(gsm->buf); kfree(gsm); @@ -2241,20 +2249,12 @@ static inline void mux_get(struct gsm_mux *gsm) { - unsigned long flags; - - spin_lock_irqsave(&gsm_mux_lock, flags); kref_get(&gsm->ref); - spin_unlock_irqrestore(&gsm_mux_lock, flags); } static inline void mux_put(struct gsm_mux *gsm) { - unsigned long flags; - - spin_lock_irqsave(&gsm_mux_lock, flags); kref_put(&gsm->ref, gsm_free_muxr); - spin_unlock_irqrestore(&gsm_mux_lock, flags); } static inline unsigned int mux_num_to_base(struct gsm_mux *gsm) @@ -2275,7 +2275,6 @@ static struct gsm_mux *gsm_alloc_mux(void) { - int i; struct gsm_mux *gsm = kzalloc(sizeof(struct gsm_mux), GFP_KERNEL); if (gsm == NULL) return NULL; @@ -2284,7 +2283,7 @@ kfree(gsm); return NULL; } + gsm->txframe = kmalloc(2 * MAX_MRU + 2, GFP_KERNEL); - gsm->txframe = kmalloc(2 * (MAX_MTU + PROT_OVERHEAD - 1), GFP_KERNEL); if (gsm->txframe == NULL) { kfree(gsm->buf); kfree(gsm); @@ -2305,26 +2304,6 @@ gsm->mtu = 64; gsm->dead = true; /* Avoid early tty opens */ - /* Store the instance to the mux array or abort if no space is - * available. - */ - spin_lock(&gsm_mux_lock); - for (i = 0; i < MAX_MUX; i++) { - if (!gsm_mux[i]) { - gsm_mux[i] = gsm; - gsm->num = i; - break; - } - } - spin_unlock(&gsm_mux_lock); - if (i == MAX_MUX) { - mutex_destroy(&gsm->mutex); - kfree(gsm->txframe); - kfree(gsm->buf); - kfree(gsm); - return NULL; - } - return gsm; } @@ -2360,7 +2339,7 @@ /* Check the MRU/MTU range looks sane */ if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8) return -EINVAL; + if (c->n2 < 3) - if (c->n2 > 255) return -EINVAL; if (c->encapsulation > 1) /* Basic, advanced, no I */ return -EINVAL; @@ -2391,11 +2370,19 @@ /* * Close down what is needed, restart and initiate the new + * configuration - * configuration. On the first time there is no DLCI[0] - * and closing or cleaning up is not necessary. */ + + if (gsm->initiator && (need_close || need_restart)) { + int ret; + + ret = gsm_disconnect(gsm); + + if (ret) + return ret; + } + if (need_restart) + gsm_cleanup_mux(gsm); - if (need_close || need_restart) - gsm_cleanup_mux(gsm, true); gsm->initiator = c->initiator; gsm->mru = c->mru; @@ -2463,26 +2450,25 @@ int ret, i; gsm->tty = tty_kref_get(tty); - /* Turn off tty XON/XOFF handling to handle it explicitly. */ - gsm->old_c_iflag = tty->termios.c_iflag; - tty->termios.c_iflag &= (IXON | IXOFF); ret = gsm_activate_mux(gsm); if (ret != 0) tty_kref_put(gsm->tty); else { /* Don't register device 0 - this is the control channel and not a usable tty interface */ + if (gsm->initiator) { + base = mux_num_to_base(gsm); /* Base for this MUX */ + for (i = 1; i < NUM_DLCI; i++) { + struct device *dev; - base = mux_num_to_base(gsm); /* Base for this MUX */ - for (i = 1; i < NUM_DLCI; i++) { - struct device *dev; + dev = tty_register_device(gsm_tty_driver, - dev = tty_register_device(gsm_tty_driver, base + i, NULL); + if (IS_ERR(dev)) { + for (i--; i >= 1; i--) + tty_unregister_device(gsm_tty_driver, + base + i); + return PTR_ERR(dev); + } - if (IS_ERR(dev)) { - for (i--; i >= 1; i--) - tty_unregister_device(gsm_tty_driver, - base + i); - return PTR_ERR(dev); } } } @@ -2504,10 +2490,11 @@ int i; WARN_ON(tty != gsm->tty); + if (gsm->initiator) { + for (i = 1; i < NUM_DLCI; i++) + tty_unregister_device(gsm_tty_driver, base + i); + } + gsm_cleanup_mux(gsm); - for (i = 1; i < NUM_DLCI; i++) - tty_unregister_device(gsm_tty_driver, base + i); - /* Restore tty XON/XOFF handling. */ - gsm->tty->termios.c_iflag = gsm->old_c_iflag; tty_kref_put(gsm->tty); gsm->tty = NULL; } @@ -2572,12 +2559,6 @@ { struct gsm_mux *gsm = tty->disc_data; - /* The ldisc locks and closes the port before calling our close. This - * means we have no way to do a proper disconnect. We will not bother - * to do one. - */ - gsm_cleanup_mux(gsm, false); - gsmld_detach_gsm(tty, gsm); gsmld_flush_buffer(tty); @@ -2616,7 +2597,7 @@ ret = gsmld_attach_gsm(tty, gsm); if (ret != 0) { + gsm_cleanup_mux(gsm); - gsm_cleanup_mux(gsm, false); mux_put(gsm); } return ret; @@ -2973,78 +2954,26 @@ #define TX_SIZE 512 +static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk) -/** - * gsm_modem_upd_via_data - send modem bits via convergence layer - * @dlci: channel - * @brk: break signal - * - * Send an empty frame to signal mobile state changes and to transmit the - * break signal for adaption 2. - */ - -static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk) { + u8 modembits[5]; - 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); - gsm_dlci_modem_output(gsm, dlci, brk); - spin_unlock_irqrestore(&gsm->tx_lock, flags); -} - -/** - * gsm_modem_upd_via_msc - send modem bits via control frame - * @dlci: channel - * @brk: break signal - */ - -static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk) -{ - u8 modembits[3]; struct gsm_control *ctrl; int len = 2; + if (brk) + len++; - if (dlci->gsm->encoding != 0) - return 0; + modembits[0] = len << 1 | EA; /* Data bytes */ + modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */ + modembits[2] = gsm_encode_modem(dlci) << 1 | EA; + if (brk) + modembits[3] = brk << 4 | 2 | EA; /* Valid, EA */ + ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1); - modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */ - if (!brk) { - modembits[1] = (gsm_encode_modem(dlci) << 1) | EA; - } else { - modembits[1] = gsm_encode_modem(dlci) << 1; - modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */ - len++; - } - ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len); if (ctrl == NULL) return -ENOMEM; return gsm_control_wait(dlci->gsm, ctrl); } -/** - * gsm_modem_update - send modem status line state - * @dlci: channel - * @brk: break signal - */ - -static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk) -{ - if (dlci->adaption == 2) { - /* Send convergence layer type 2 empty data frame. */ - gsm_modem_upd_via_data(dlci, brk); - return 0; - } else if (dlci->gsm->encoding == 0) { - /* Send as MSC control message. */ - return gsm_modem_upd_via_msc(dlci, brk); - } - - /* Modem status lines are not supported. */ - return -EPROTONOSUPPORT; -} - static int gsm_carrier_raised(struct tty_port *port) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port); @@ -3077,7 +3006,7 @@ modem_tx &= ~(TIOCM_DTR | TIOCM_RTS); if (modem_tx != dlci->modem_tx) { dlci->modem_tx = modem_tx; + gsmtty_modem_update(dlci, 0); - gsm_modem_update(dlci, 0); } } @@ -3226,17 +3155,13 @@ static void gsmtty_flush_buffer(struct tty_struct *tty) { struct gsm_dlci *dlci = tty->driver_data; - unsigned long flags; - if (dlci->state == DLCI_CLOSED) return; /* Caution needed: If we implement reliable transport classes then the data being transmitted can't simply be junked once it has first hit the stack. Until then we can just blow it away */ - spin_lock_irqsave(&dlci->lock, flags); kfifo_reset(&dlci->fifo); - spin_unlock_irqrestore(&dlci->lock, flags); /* Need to unhook this DLCI from the transmit queue logic */ } @@ -3268,7 +3193,7 @@ if (modem_tx != dlci->modem_tx) { dlci->modem_tx = modem_tx; + return gsmtty_modem_update(dlci, 0); - return gsm_modem_update(dlci, 0); } return 0; } @@ -3329,7 +3254,7 @@ dlci->modem_tx &= ~TIOCM_RTS; dlci->throttled = true; /* Send an MSC with RTS cleared */ + gsmtty_modem_update(dlci, 0); - gsm_modem_update(dlci, 0); } static void gsmtty_unthrottle(struct tty_struct *tty) @@ -3341,7 +3266,7 @@ dlci->modem_tx |= TIOCM_RTS; dlci->throttled = false; /* Send an MSC with RTS set */ + gsmtty_modem_update(dlci, 0); - gsm_modem_update(dlci, 0); } static int gsmtty_break_ctl(struct tty_struct *tty, int state) @@ -3359,7 +3284,7 @@ if (encode > 0x0F) encode = 0x0F; /* Best effort */ } + return gsmtty_modem_update(dlci, encode); - return gsm_modem_update(dlci, encode); } static void gsmtty_cleanup(struct tty_struct *tty) reverted: --- linux-oem-5.17-5.17.0/drivers/tty/serial/8250/8250_pci.c +++ linux-oem-5.17-5.17.0.orig/drivers/tty/serial/8250/8250_pci.c @@ -2667,7 +2667,7 @@ pbn_panacom2, pbn_panacom4, pbn_plx_romulus, + pbn_endrun_2_4000000, - pbn_endrun_2_3906250, pbn_oxsemi, pbn_oxsemi_1_3906250, pbn_oxsemi_2_3906250, @@ -3195,10 +3195,10 @@ * signal now many ports are available * 2 port 952 Uart support */ + [pbn_endrun_2_4000000] = { - [pbn_endrun_2_3906250] = { .flags = FL_BASE0, .num_ports = 2, + .base_baud = 4000000, - .base_baud = 3906250, .uart_offset = 0x200, .first_offset = 0x1000, }, @@ -4115,7 +4115,7 @@ */ { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_endrun_2_4000000 }, - pbn_endrun_2_3906250 }, /* * Quatech cards. These actually have configurable clocks but for * now we just use the default. diff -u linux-oem-5.17-5.17.0/drivers/tty/serial/8250/8250_port.c linux-oem-5.17-5.17.0/drivers/tty/serial/8250/8250_port.c --- linux-oem-5.17-5.17.0/drivers/tty/serial/8250/8250_port.c +++ linux-oem-5.17-5.17.0/drivers/tty/serial/8250/8250_port.c @@ -3340,7 +3340,7 @@ serial8250_set_divisor(port, baud, quot, frac); serial_port_out(port, UART_LCR, up->lcr); - serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); + serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS); } /* reverted: --- linux-oem-5.17-5.17.0/drivers/tty/serial/amba-pl011.c +++ linux-oem-5.17-5.17.0.orig/drivers/tty/serial/amba-pl011.c @@ -1255,18 +1255,13 @@ static void pl011_rs485_tx_stop(struct uart_amba_port *uap) { - /* - * To be on the safe side only time out after twice as many iterations - * as fifo size. - */ - const int MAX_TX_DRAIN_ITERS = uap->port.fifosize * 2; struct uart_port *port = &uap->port; int i = 0; u32 cr; /* Wait until hardware tx queue is empty */ while (!pl011_tx_empty(port)) { + if (i == port->fifosize) { - if (i > MAX_TX_DRAIN_ITERS) { dev_warn(port->dev, "timeout while draining hardware tx queue\n"); break; @@ -2057,7 +2052,7 @@ * with the given baud rate. We use this as the poll interval when we * wait for the tx queue to empty. */ + uap->rs485_tx_drain_interval = (bits * 1000 * 1000) / baud; - uap->rs485_tx_drain_interval = DIV_ROUND_UP(bits * 1000 * 1000, baud); pl011_setup_status_masks(port, termios); reverted: --- linux-oem-5.17-5.17.0/drivers/tty/serial/imx.c +++ linux-oem-5.17-5.17.0.orig/drivers/tty/serial/imx.c @@ -1438,7 +1438,7 @@ imx_uart_writel(sport, ucr1, UCR1); ucr4 = imx_uart_readl(sport, UCR4) & ~(UCR4_OREN | UCR4_INVR); + if (!sport->dma_is_enabled) - if (!dma_is_inited) ucr4 |= UCR4_OREN; if (sport->inverted_rx) ucr4 |= UCR4_INVR; reverted: --- linux-oem-5.17-5.17.0/drivers/usb/cdns3/cdns3-gadget.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/cdns3/cdns3-gadget.c @@ -2684,7 +2684,6 @@ struct usb_request *request; struct cdns3_request *priv_req; struct cdns3_trb *trb = NULL; - struct cdns3_trb trb_tmp; int ret; int val; @@ -2694,10 +2693,8 @@ if (request) { priv_req = to_cdns3_request(request); trb = priv_req->trb; + if (trb) - if (trb) { - trb_tmp = *trb; trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE); - } } writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd); @@ -2712,7 +2709,7 @@ if (request) { if (trb) + trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE); - *trb = trb_tmp; cdns3_rearm_transfer(priv_ep, 1); } reverted: --- linux-oem-5.17-5.17.0/drivers/usb/core/devio.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/core/devio.c @@ -1197,16 +1197,12 @@ usb_unlock_device(dev); i = usbfs_start_wait_urb(urb, tmo, &actlen); - - /* Linger a bit, prior to the next control message. */ - if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) - msleep(200); usb_lock_device(dev); snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, tbuf, actlen); if (!i && actlen) { if (copy_to_user(ctrl->data, tbuf, actlen)) { ret = -EFAULT; + goto recv_fault; - goto done; } } } else { @@ -1223,10 +1219,6 @@ usb_unlock_device(dev); i = usbfs_start_wait_urb(urb, tmo, &actlen); - - /* Linger a bit, prior to the next control message. */ - if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) - msleep(200); usb_lock_device(dev); snoop_urb(dev, NULL, pipe, actlen, i, COMPLETE, NULL, 0); } @@ -1238,6 +1230,10 @@ } ret = (i < 0 ? i : actlen); + recv_fault: + /* Linger a bit, prior to the next control message. */ + if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) + msleep(200); done: kfree(dr); usb_free_urb(urb); reverted: --- linux-oem-5.17-5.17.0/drivers/usb/core/quirks.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/core/quirks.c @@ -404,9 +404,6 @@ { USB_DEVICE(0x0b05, 0x17e0), .driver_info = USB_QUIRK_IGNORE_REMOTE_WAKEUP }, - /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/ - { USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, - /* Realtek hub in Dell WD19 (Type-C) */ { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, @@ -510,9 +507,6 @@ /* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, - /* VCOM device */ - { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, - /* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, reverted: --- linux-oem-5.17-5.17.0/drivers/usb/dwc3/core.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/dwc3/core.c @@ -276,8 +276,7 @@ reg = dwc3_readl(dwc->regs, DWC3_DCTL); reg |= DWC3_DCTL_CSFTRST; + dwc3_writel(dwc->regs, DWC3_DCTL, reg); - reg &= ~DWC3_DCTL_RUN_STOP; - dwc3_gadget_dctl_write_safe(dwc, reg); /* * For DWC_usb31 controller 1.90a and later, the DCTL.CSFRST bit @@ -1296,10 +1295,10 @@ u8 lpm_nyet_threshold; u8 tx_de_emphasis; u8 hird_threshold; + u8 rx_thr_num_pkt_prd; + u8 rx_max_burst_prd; + u8 tx_thr_num_pkt_prd; + u8 tx_max_burst_prd; - u8 rx_thr_num_pkt_prd = 0; - u8 rx_max_burst_prd = 0; - u8 tx_thr_num_pkt_prd = 0; - u8 tx_max_burst_prd = 0; u8 tx_fifo_resize_max_num; const char *usb_psy_name; int ret; reverted: --- linux-oem-5.17-5.17.0/drivers/usb/dwc3/drd.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/dwc3/drd.c @@ -571,15 +571,16 @@ { int ret, irq; - if (ROLE_SWITCH && - 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 (ROLE_SWITCH && + device_property_read_bool(dwc->dev, "usb-role-switch")) { + ret = dwc3_setup_role_switch(dwc); + if (ret < 0) + return ret; + } else if (dwc->edev) { - if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb); diff -u linux-oem-5.17-5.17.0/drivers/usb/dwc3/dwc3-pci.c linux-oem-5.17-5.17.0/drivers/usb/dwc3/dwc3-pci.c --- linux-oem-5.17-5.17.0/drivers/usb/dwc3/dwc3-pci.c +++ linux-oem-5.17-5.17.0/drivers/usb/dwc3/dwc3-pci.c @@ -44,8 +44,6 @@ #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 #define PCI_DEVICE_ID_INTEL_RPLS 0x7a61 -#define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1 -#define PCI_DEVICE_ID_INTEL_MTL 0x7e7e #define PCI_DEVICE_ID_INTEL_TGL 0x9a15 #define PCI_DEVICE_ID_AMD_MR 0x163a @@ -423,12 +421,6 @@ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS), (kernel_ulong_t) &dwc3_pci_intel_swnode, }, - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLP), - (kernel_ulong_t) &dwc3_pci_intel_swnode, }, - - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL), - (kernel_ulong_t) &dwc3_pci_intel_swnode, }, - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL), (kernel_ulong_t) &dwc3_pci_intel_swnode, }, reverted: --- linux-oem-5.17-5.17.0/drivers/usb/dwc3/gadget.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/dwc3/gadget.c @@ -3229,7 +3229,6 @@ const struct dwc3_event_depevt *event, struct dwc3_request *req, int status) { - int request_status; int ret; if (req->request.num_mapped_sgs) @@ -3250,35 +3249,7 @@ req->needs_extra_trb = false; } + dwc3_gadget_giveback(dep, req, status); - /* - * The event status only reflects the status of the TRB with IOC set. - * For the requests that don't set interrupt on completion, the driver - * needs to check and return the status of the completed TRBs associated - * with the request. Use the status of the last TRB of the request. - */ - if (req->request.no_interrupt) { - struct dwc3_trb *trb; - - trb = dwc3_ep_prev_trb(dep, dep->trb_dequeue); - switch (DWC3_TRB_SIZE_TRBSTS(trb->size)) { - case DWC3_TRBSTS_MISSED_ISOC: - /* Isoc endpoint only */ - request_status = -EXDEV; - break; - case DWC3_TRB_STS_XFER_IN_PROG: - /* Applicable when End Transfer with ForceRM=0 */ - case DWC3_TRBSTS_SETUP_PENDING: - /* Control endpoint only */ - case DWC3_TRBSTS_OK: - default: - request_status = 0; - break; - } - } else { - request_status = status; - } - - dwc3_gadget_giveback(dep, req, request_status); out: return ret; reverted: --- linux-oem-5.17-5.17.0/drivers/usb/gadget/configfs.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/gadget/configfs.c @@ -1434,8 +1434,6 @@ usb_ep_autoconfig_reset(cdev->gadget); spin_lock_irqsave(&gi->spinlock, flags); cdev->gadget = NULL; - cdev->deactivations = 0; - gadget->deactivated = false; set_gadget_data(gadget, NULL); spin_unlock_irqrestore(&gi->spinlock, flags); } reverted: --- linux-oem-5.17-5.17.0/drivers/usb/gadget/function/uvc_queue.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/gadget/function/uvc_queue.c @@ -264,8 +264,6 @@ buf->state = UVC_BUF_STATE_ERROR; vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); } - queue->buf_used = 0; - /* This must be protected by the irqlock spinlock to avoid race * conditions between uvc_queue_buffer and the disconnection event that * could result in an interruptible wait in uvc_dequeue_buffer. Do not diff -u linux-oem-5.17-5.17.0/drivers/usb/host/xhci-hub.c linux-oem-5.17-5.17.0/drivers/usb/host/xhci-hub.c --- linux-oem-5.17-5.17.0/drivers/usb/host/xhci-hub.c +++ linux-oem-5.17-5.17.0/drivers/usb/host/xhci-hub.c @@ -1434,7 +1434,7 @@ } spin_unlock_irqrestore(&xhci->lock, flags); if (!wait_for_completion_timeout(&bus_state->u3exit_done[wIndex], - msecs_to_jiffies(500))) + msecs_to_jiffies(100))) xhci_dbg(xhci, "missing U0 port change event for port %d-%d\n", hcd->self.busnum, wIndex + 1); spin_lock_irqsave(&xhci->lock, flags); diff -u linux-oem-5.17-5.17.0/drivers/usb/host/xhci-pci.c linux-oem-5.17-5.17.0/drivers/usb/host/xhci-pci.c --- linux-oem-5.17-5.17.0/drivers/usb/host/xhci-pci.c +++ linux-oem-5.17-5.17.0/drivers/usb/host/xhci-pci.c @@ -59,7 +59,6 @@ #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e -#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 @@ -267,8 +266,7 @@ pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)) + pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI)) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; if (pdev->vendor == PCI_VENDOR_ID_ETRON && reverted: --- linux-oem-5.17-5.17.0/drivers/usb/host/xhci-ring.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/host/xhci-ring.c @@ -3141,7 +3141,6 @@ if (event_loop++ < TRBS_PER_SEGMENT / 2) continue; xhci_update_erst_dequeue(xhci, event_ring_deq); - event_ring_deq = xhci->event_ring->dequeue; /* ring is half-full, force isoc trbs to interrupt more often */ if (xhci->isoc_bei_interval > AVOID_BEI_INTERVAL_MIN) reverted: --- linux-oem-5.17-5.17.0/drivers/usb/host/xhci-tegra.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/host/xhci-tegra.c @@ -1034,13 +1034,13 @@ int rc; if (tegra->use_genpd) { + rc = pm_runtime_get_sync(tegra->genpd_dev_ss); - rc = pm_runtime_resume_and_get(tegra->genpd_dev_ss); if (rc < 0) { dev_err(dev, "failed to enable XUSB SS partition\n"); return rc; } + rc = pm_runtime_get_sync(tegra->genpd_dev_host); - rc = pm_runtime_resume_and_get(tegra->genpd_dev_host); if (rc < 0) { dev_err(dev, "failed to enable XUSB Host partition\n"); pm_runtime_put_sync(tegra->genpd_dev_ss); diff -u linux-oem-5.17-5.17.0/drivers/usb/host/xhci.c linux-oem-5.17-5.17.0/drivers/usb/host/xhci.c --- linux-oem-5.17-5.17.0/drivers/usb/host/xhci.c +++ linux-oem-5.17-5.17.0/drivers/usb/host/xhci.c @@ -778,17 +778,6 @@ if (xhci->quirks & XHCI_SPURIOUS_REBOOT) usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); - /* Don't poll the roothubs after shutdown. */ - xhci_dbg(xhci, "%s: stopping usb%d port polling.\n", - __func__, hcd->self.busnum); - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); - del_timer_sync(&hcd->rh_timer); - - if (xhci->shared_hcd) { - clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); - del_timer_sync(&xhci->shared_hcd->rh_timer); - } - spin_lock_irq(&xhci->lock); xhci_halt(xhci); /* Workaround for spurious wakeups at shutdown with HSW */ reverted: --- linux-oem-5.17-5.17.0/drivers/usb/misc/uss720.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/misc/uss720.c @@ -71,7 +71,6 @@ dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n"); usb_put_dev(priv->usbdev); - priv->usbdev = NULL; kfree(priv); } @@ -737,6 +736,7 @@ parport_announce_port(pp); usb_set_intfdata(intf, pp); + usb_put_dev(usbdev); return 0; probe_abort: @@ -754,6 +754,7 @@ usb_set_intfdata(intf, NULL); if (pp) { priv = pp->private_data; + priv->usbdev = NULL; priv->pp = NULL; dev_dbg(&intf->dev, "parport_remove_port\n"); parport_remove_port(pp); reverted: --- linux-oem-5.17-5.17.0/drivers/usb/mtu3/mtu3_dr.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/mtu3/mtu3_dr.c @@ -21,8 +21,10 @@ static void toggle_opstate(struct ssusb_mtk *ssusb) { + if (!ssusb->otg_switch.is_u3_drd) { + mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION); + mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN); + } - mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION); - mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN); } /* only port0 supports dual-role mode */ reverted: --- linux-oem-5.17-5.17.0/drivers/usb/phy/phy-generic.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/phy/phy-generic.c @@ -268,13 +268,6 @@ return -EPROBE_DEFER; } - nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); - if (PTR_ERR(nop->vbus_draw) == -ENODEV) - nop->vbus_draw = NULL; - if (IS_ERR(nop->vbus_draw)) - return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), - "could not get vbus regulator\n"); - nop->dev = dev; nop->phy.dev = nop->dev; nop->phy.label = "nop-xceiv"; reverted: --- linux-oem-5.17-5.17.0/drivers/usb/serial/cp210x.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/serial/cp210x.c @@ -194,8 +194,6 @@ { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */ { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */ - { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */ - { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */ { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ reverted: --- linux-oem-5.17-5.17.0/drivers/usb/serial/option.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/serial/option.c @@ -432,8 +432,6 @@ #define CINTERION_PRODUCT_CLS8 0x00b0 #define CINTERION_PRODUCT_MV31_MBIM 0x00b3 #define CINTERION_PRODUCT_MV31_RMNET 0x00b7 -#define CINTERION_PRODUCT_MV32_WA 0x00f1 -#define CINTERION_PRODUCT_MV32_WB 0x00f2 /* Olivetti products */ #define OLIVETTI_VENDOR_ID 0x0b3c @@ -1219,10 +1217,6 @@ .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff), /* Telit FN980 */ - .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff), /* Telit FN980 (PCIe) */ - .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ @@ -1239,8 +1233,6 @@ .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ - .driver_info = RSVD(0) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), @@ -1977,10 +1969,6 @@ .driver_info = RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff), .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_WB, 0xff), - .driver_info = RSVD(3)}, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), .driver_info = RSVD(4) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), reverted: --- linux-oem-5.17-5.17.0/drivers/usb/serial/whiteheat.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/serial/whiteheat.c @@ -584,8 +584,9 @@ switch (command) { case WHITEHEAT_GET_DTR_RTS: info = usb_get_serial_port_data(port); + memcpy(&info->mcr, command_info->result_buffer, + sizeof(struct whiteheat_dr_info)); + break; - info->mcr = command_info->result_buffer[0]; - break; } } exit: reverted: --- linux-oem-5.17-5.17.0/drivers/usb/typec/ucsi/ucsi.c +++ linux-oem-5.17-5.17.0.orig/drivers/usb/typec/ucsi/ucsi.c @@ -949,8 +949,6 @@ role == TYPEC_HOST)) goto out_unlock; - reinit_completion(&con->complete); - command = UCSI_SET_UOR | UCSI_CONNECTOR_NUMBER(con->num); command |= UCSI_SET_UOR_ROLE(role); command |= UCSI_SET_UOR_ACCEPT_ROLE_SWAPS; @@ -958,18 +956,14 @@ if (ret < 0) goto out_unlock; - mutex_unlock(&con->lock); - if (!wait_for_completion_timeout(&con->complete, + msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS))) + ret = -ETIMEDOUT; - msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS))) - return -ETIMEDOUT; - - return 0; out_unlock: mutex_unlock(&con->lock); + return ret < 0 ? ret : 0; - return ret; } static int ucsi_pr_swap(struct typec_port *port, enum typec_role role) @@ -991,8 +985,6 @@ if (cur_role == role) goto out_unlock; - reinit_completion(&con->complete); - command = UCSI_SET_PDR | UCSI_CONNECTOR_NUMBER(con->num); command |= UCSI_SET_PDR_ROLE(role); command |= UCSI_SET_PDR_ACCEPT_ROLE_SWAPS; @@ -1000,13 +992,11 @@ if (ret < 0) goto out_unlock; - mutex_unlock(&con->lock); - if (!wait_for_completion_timeout(&con->complete, + msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS))) { + ret = -ETIMEDOUT; + goto out_unlock; + } - msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS))) - return -ETIMEDOUT; - - mutex_lock(&con->lock); /* Something has gone wrong while swapping the role */ if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) != diff -u linux-oem-5.17-5.17.0/drivers/vfio/pci/vfio_pci_core.c linux-oem-5.17-5.17.0/drivers/vfio/pci/vfio_pci_core.c --- linux-oem-5.17-5.17.0/drivers/vfio/pci/vfio_pci_core.c +++ linux-oem-5.17-5.17.0/drivers/vfio/pci/vfio_pci_core.c @@ -36,10 +36,6 @@ static bool disable_vga; static bool disable_idle_d3; -/* List of PF's that vfio_pci_core_sriov_configure() has been called on */ -static DEFINE_MUTEX(vfio_pci_sriov_pfs_mutex); -static LIST_HEAD(vfio_pci_sriov_pfs); - static inline bool vfio_vga_disabled(void) { #ifdef CONFIG_VFIO_PCI_VGA @@ -438,17 +434,47 @@ } EXPORT_SYMBOL_GPL(vfio_pci_core_disable); +static struct vfio_pci_core_device *get_pf_vdev(struct vfio_pci_core_device *vdev) +{ + struct pci_dev *physfn = pci_physfn(vdev->pdev); + struct vfio_device *pf_dev; + + if (!vdev->pdev->is_virtfn) + return NULL; + + pf_dev = vfio_device_get_from_dev(&physfn->dev); + if (!pf_dev) + return NULL; + + if (pci_dev_driver(physfn) != pci_dev_driver(vdev->pdev)) { + vfio_device_put(pf_dev); + return NULL; + } + + return container_of(pf_dev, struct vfio_pci_core_device, vdev); +} + +static void vfio_pci_vf_token_user_add(struct vfio_pci_core_device *vdev, int val) +{ + struct vfio_pci_core_device *pf_vdev = get_pf_vdev(vdev); + + if (!pf_vdev) + return; + + mutex_lock(&pf_vdev->vf_token->lock); + pf_vdev->vf_token->users += val; + WARN_ON(pf_vdev->vf_token->users < 0); + mutex_unlock(&pf_vdev->vf_token->lock); + + vfio_device_put(&pf_vdev->vdev); +} + void vfio_pci_core_close_device(struct vfio_device *core_vdev) { struct vfio_pci_core_device *vdev = container_of(core_vdev, struct vfio_pci_core_device, vdev); - if (vdev->sriov_pf_core_dev) { - mutex_lock(&vdev->sriov_pf_core_dev->vf_token->lock); - WARN_ON(!vdev->sriov_pf_core_dev->vf_token->users); - vdev->sriov_pf_core_dev->vf_token->users--; - mutex_unlock(&vdev->sriov_pf_core_dev->vf_token->lock); - } + vfio_pci_vf_token_user_add(vdev, -1); vfio_spapr_pci_eeh_release(vdev->pdev); vfio_pci_core_disable(vdev); @@ -469,12 +495,7 @@ { vfio_pci_probe_mmaps(vdev); vfio_spapr_pci_eeh_open(vdev->pdev); - - if (vdev->sriov_pf_core_dev) { - mutex_lock(&vdev->sriov_pf_core_dev->vf_token->lock); - vdev->sriov_pf_core_dev->vf_token->users++; - mutex_unlock(&vdev->sriov_pf_core_dev->vf_token->lock); - } + vfio_pci_vf_token_user_add(vdev, 1); } EXPORT_SYMBOL_GPL(vfio_pci_core_finish_enable); @@ -1582,8 +1603,11 @@ * * If the VF token is provided but unused, an error is generated. */ + if (!vdev->pdev->is_virtfn && !vdev->vf_token && !vf_token) + return 0; /* No VF token provided or required */ + if (vdev->pdev->is_virtfn) { - struct vfio_pci_core_device *pf_vdev = vdev->sriov_pf_core_dev; + struct vfio_pci_core_device *pf_vdev = get_pf_vdev(vdev); bool match; if (!pf_vdev) { @@ -1596,6 +1620,7 @@ } if (!vf_token) { + vfio_device_put(&pf_vdev->vdev); pci_info_ratelimited(vdev->pdev, "VF token required to access device\n"); return -EACCES; @@ -1605,6 +1630,8 @@ match = uuid_equal(uuid, &pf_vdev->vf_token->uuid); mutex_unlock(&pf_vdev->vf_token->lock); + vfio_device_put(&pf_vdev->vdev); + if (!match) { pci_info_ratelimited(vdev->pdev, "Incorrect VF token provided for device\n"); @@ -1725,30 +1752,8 @@ static int vfio_pci_vf_init(struct vfio_pci_core_device *vdev) { struct pci_dev *pdev = vdev->pdev; - struct vfio_pci_core_device *cur; - struct pci_dev *physfn; int ret; - if (pdev->is_virtfn) { - /* - * If this VF was created by our vfio_pci_core_sriov_configure() - * then we can find the PF vfio_pci_core_device now, and due to - * the locking in pci_disable_sriov() it cannot change until - * this VF device driver is removed. - */ - physfn = pci_physfn(vdev->pdev); - mutex_lock(&vfio_pci_sriov_pfs_mutex); - list_for_each_entry(cur, &vfio_pci_sriov_pfs, sriov_pfs_item) { - if (cur->pdev == physfn) { - vdev->sriov_pf_core_dev = cur; - break; - } - } - mutex_unlock(&vfio_pci_sriov_pfs_mutex); - return 0; - } - - /* Not a SRIOV PF */ if (!pdev->is_physfn) return 0; @@ -1820,7 +1825,6 @@ INIT_LIST_HEAD(&vdev->ioeventfds_list); mutex_init(&vdev->vma_lock); INIT_LIST_HEAD(&vdev->vma_list); - INIT_LIST_HEAD(&vdev->sriov_pfs_item); init_rwsem(&vdev->memory_lock); } EXPORT_SYMBOL_GPL(vfio_pci_core_init_device); @@ -1912,7 +1916,7 @@ { struct pci_dev *pdev = vdev->pdev; - vfio_pci_core_sriov_configure(pdev, 0); + pci_disable_sriov(pdev); vfio_unregister_group_dev(&vdev->vdev); @@ -1950,49 +1954,21 @@ int vfio_pci_core_sriov_configure(struct pci_dev *pdev, int nr_virtfn) { - struct vfio_pci_core_device *vdev; struct vfio_device *device; int ret = 0; - device_lock_assert(&pdev->dev); - device = vfio_device_get_from_dev(&pdev->dev); if (!device) return -ENODEV; - vdev = container_of(device, struct vfio_pci_core_device, vdev); - - if (nr_virtfn) { - mutex_lock(&vfio_pci_sriov_pfs_mutex); - /* - * The thread that adds the vdev to the list is the only thread - * that gets to call pci_enable_sriov() and we will only allow - * it to be called once without going through - * pci_disable_sriov() - */ - if (!list_empty(&vdev->sriov_pfs_item)) { - ret = -EINVAL; - goto out_unlock; - } - list_add_tail(&vdev->sriov_pfs_item, &vfio_pci_sriov_pfs); - mutex_unlock(&vfio_pci_sriov_pfs_mutex); + if (nr_virtfn == 0) + pci_disable_sriov(pdev); + else ret = pci_enable_sriov(pdev, nr_virtfn); - if (ret) - goto out_del; - ret = nr_virtfn; - goto out_put; - } - - pci_disable_sriov(pdev); -out_del: - mutex_lock(&vfio_pci_sriov_pfs_mutex); - list_del_init(&vdev->sriov_pfs_item); -out_unlock: - mutex_unlock(&vfio_pci_sriov_pfs_mutex); -out_put: vfio_device_put(device); - return ret; + + return ret < 0 ? ret : nr_virtfn; } EXPORT_SYMBOL_GPL(vfio_pci_core_sriov_configure); diff -u linux-oem-5.17-5.17.0/drivers/video/fbdev/core/fbmem.c linux-oem-5.17-5.17.0/drivers/video/fbdev/core/fbmem.c --- linux-oem-5.17-5.17.0/drivers/video/fbdev/core/fbmem.c +++ linux-oem-5.17-5.17.0/drivers/video/fbdev/core/fbmem.c @@ -1438,10 +1438,7 @@ __acquires(&info->lock) __releases(&info->lock) { - struct fb_info * const info = file_fb_info(file); - - if (!info) - return -ENODEV; + struct fb_info * const info = file->private_data; lock_fb_info(info); if (info->fbops->fb_release) diff -u linux-oem-5.17-5.17.0/drivers/video/fbdev/udlfb.c linux-oem-5.17-5.17.0/drivers/video/fbdev/udlfb.c --- linux-oem-5.17-5.17.0/drivers/video/fbdev/udlfb.c +++ linux-oem-5.17-5.17.0/drivers/video/fbdev/udlfb.c @@ -1649,9 +1649,8 @@ const struct device_attribute *attr; struct dlfb_data *dlfb; struct fb_info *info; - int retval; + int retval = -ENOMEM; struct usb_device *usbdev = interface_to_usbdev(intf); - struct usb_endpoint_descriptor *out; /* usb initialization */ dlfb = kzalloc(sizeof(*dlfb), GFP_KERNEL); @@ -1665,12 +1664,6 @@ dlfb->udev = usb_get_dev(usbdev); usb_set_intfdata(intf, dlfb); - retval = usb_find_common_endpoints(intf->cur_altsetting, NULL, &out, NULL, NULL); - if (retval) { - dev_err(&intf->dev, "Device should have at lease 1 bulk endpoint!\n"); - goto error; - } - dev_dbg(&intf->dev, "console enable=%d\n", console); dev_dbg(&intf->dev, "fb_defio enable=%d\n", fb_defio); dev_dbg(&intf->dev, "shadow enable=%d\n", shadow); @@ -1680,7 +1673,6 @@ if (!dlfb_parse_vendor_descriptor(dlfb, intf)) { dev_err(&intf->dev, "firmware not recognized, incompatible device?\n"); - retval = -ENODEV; goto error; } @@ -1694,10 +1686,8 @@ /* allocates framebuffer driver structure, not framebuffer memory */ info = framebuffer_alloc(0, &dlfb->udev->dev); - if (!info) { - retval = -ENOMEM; + if (!info) goto error; - } dlfb->info = info; info->par = dlfb; diff -u linux-oem-5.17-5.17.0/fs/binfmt_elf.c linux-oem-5.17-5.17.0/fs/binfmt_elf.c --- linux-oem-5.17-5.17.0/fs/binfmt_elf.c +++ linux-oem-5.17-5.17.0/fs/binfmt_elf.c @@ -1116,11 +1116,11 @@ * independently randomized mmap region (0 load_bias * without MAP_FIXED nor MAP_FIXED_NOREPLACE). */ - if (interpreter) { + alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum); + if (interpreter || alignment > ELF_MIN_ALIGN) { load_bias = ELF_ET_DYN_BASE; if (current->flags & PF_RANDOMIZE) load_bias += arch_mmap_rnd(); - alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum); if (alignment) load_bias &= ~(alignment - 1); elf_flags |= MAP_FIXED_NOREPLACE; diff -u linux-oem-5.17-5.17.0/fs/btrfs/block-group.c linux-oem-5.17-5.17.0/fs/btrfs/block-group.c --- linux-oem-5.17-5.17.0/fs/btrfs/block-group.c +++ linux-oem-5.17-5.17.0/fs/btrfs/block-group.c @@ -2479,6 +2479,12 @@ return ERR_PTR(ret); } + /* + * New block group is likely to be used soon. Try to activate it now. + * Failure is OK for now. + */ + btrfs_zone_activate(cache); + ret = exclude_super_stripes(cache); if (ret) { /* We may have excluded something, so call this just in case */ @@ -2916,6 +2922,7 @@ struct btrfs_path *path = NULL; LIST_HEAD(dirty); struct list_head *io = &cur_trans->io_bgs; + int num_started = 0; int loops = 0; spin_lock(&cur_trans->dirty_bgs_lock); @@ -2981,6 +2988,7 @@ cache->io_ctl.inode = NULL; ret = btrfs_write_out_cache(trans, cache, path); if (ret == 0 && cache->io_ctl.inode) { + num_started++; should_put = 0; /* @@ -3081,6 +3089,7 @@ int should_put; struct btrfs_path *path; struct list_head *io = &cur_trans->io_bgs; + int num_started = 0; path = btrfs_alloc_path(); if (!path) @@ -3138,6 +3147,7 @@ cache->io_ctl.inode = NULL; ret = btrfs_write_out_cache(trans, cache, path); if (ret == 0 && cache->io_ctl.inode) { + num_started++; should_put = 0; list_add_tail(&cache->io_list, io); } else { @@ -3421,7 +3431,7 @@ return btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE); } -static struct btrfs_block_group *do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags) +static int do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags) { struct btrfs_block_group *bg; int ret; @@ -3508,11 +3518,7 @@ out: btrfs_trans_release_chunk_metadata(trans); - if (ret) - return ERR_PTR(ret); - - btrfs_get_block_group(bg); - return bg; + return ret; } /* @@ -3627,17 +3633,10 @@ { struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_space_info *space_info; - struct btrfs_block_group *ret_bg; bool wait_for_alloc = false; bool should_alloc = false; - bool from_extent_allocation = false; int ret = 0; - if (force == CHUNK_ALLOC_FORCE_FOR_EXTENT) { - from_extent_allocation = true; - force = CHUNK_ALLOC_FORCE; - } - /* Don't re-enter if we're already allocating a chunk */ if (trans->allocating_chunk) return -ENOSPC; @@ -3727,22 +3726,9 @@ force_metadata_allocation(fs_info); } - ret_bg = do_chunk_alloc(trans, flags); + ret = do_chunk_alloc(trans, flags); trans->allocating_chunk = false; - if (IS_ERR(ret_bg)) { - ret = PTR_ERR(ret_bg); - } else if (from_extent_allocation) { - /* - * New block group is likely to be used soon. Try to activate - * it now. Failure is OK for now. - */ - btrfs_zone_activate(ret_bg); - } - - if (!ret) - btrfs_put_block_group(ret_bg); - spin_lock(&space_info->lock); if (ret < 0) { if (ret == -ENOSPC) reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/block-group.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/block-group.h @@ -35,15 +35,11 @@ * the FS with empty chunks * * CHUNK_ALLOC_FORCE means it must try to allocate one - * - * CHUNK_ALLOC_FORCE_FOR_EXTENT like CHUNK_ALLOC_FORCE but called from - * find_free_extent() that also activaes the zone */ enum btrfs_chunk_alloc_enum { CHUNK_ALLOC_NO_FORCE, CHUNK_ALLOC_LIMITED, CHUNK_ALLOC_FORCE, - CHUNK_ALLOC_FORCE_FOR_EXTENT, }; struct btrfs_caching_control { reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/btrfs_inode.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/btrfs_inode.h @@ -346,17 +346,6 @@ return ret; } -/* - * Check if the inode has flags compatible with compression - */ -static inline bool btrfs_inode_can_compress(const struct btrfs_inode *inode) -{ - if (inode->flags & BTRFS_INODE_NODATACOW || - inode->flags & BTRFS_INODE_NODATASUM) - return false; - return true; -} - struct btrfs_dio_private { struct inode *inode; diff -u linux-oem-5.17-5.17.0/fs/btrfs/compression.c linux-oem-5.17-5.17.0/fs/btrfs/compression.c --- linux-oem-5.17-5.17.0/fs/btrfs/compression.c +++ linux-oem-5.17-5.17.0/fs/btrfs/compression.c @@ -534,9 +534,6 @@ cb->orig_bio = NULL; cb->nr_pages = nr_pages; - if (blkcg_css) - kthread_associate_blkcg(blkcg_css); - while (cur_disk_bytenr < disk_start + compressed_len) { u64 offset = cur_disk_bytenr - disk_start; unsigned int index = offset >> PAGE_SHIFT; @@ -555,8 +552,6 @@ bio = NULL; goto finish_cb; } - if (blkcg_css) - bio->bi_opf |= REQ_CGROUP_PUNT; } /* * We should never reach next_stripe_start start as we will @@ -614,9 +609,6 @@ return 0; finish_cb: - if (blkcg_css) - kthread_associate_blkcg(NULL); - if (bio) { bio->bi_status = ret; bio_endio(bio); reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/ctree.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/ctree.h @@ -1029,7 +1029,6 @@ */ spinlock_t relocation_bg_lock; u64 data_reloc_bg; - struct mutex zoned_data_reloc_io_lock; spinlock_t zone_active_bgs_lock; struct list_head zone_active_bgs; reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/dev-replace.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/dev-replace.c @@ -730,12 +730,7 @@ btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); + /* Commit dev_replace state and reserve 1 item for it. */ - /* - * Commit dev_replace state and reserve 1 item for it. - * This is crucial to ensure we won't miss copying extents for new block - * groups that are allocated after we started the device replace, and - * must be done after setting up the device replace state. - */ trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) { ret = PTR_ERR(trans); diff -u linux-oem-5.17-5.17.0/fs/btrfs/disk-io.c linux-oem-5.17-5.17.0/fs/btrfs/disk-io.c --- linux-oem-5.17-5.17.0/fs/btrfs/disk-io.c +++ linux-oem-5.17-5.17.0/fs/btrfs/disk-io.c @@ -1826,10 +1826,9 @@ ret = btrfs_insert_fs_root(fs_info, root); if (ret) { - if (ret == -EEXIST) { - btrfs_put_root(root); + btrfs_put_root(root); + if (ret == -EEXIST) goto again; - } goto fail; } return root; @@ -3068,7 +3067,6 @@ mutex_init(&fs_info->reloc_mutex); mutex_init(&fs_info->delalloc_root_mutex); mutex_init(&fs_info->zoned_meta_io_lock); - mutex_init(&fs_info->zoned_data_reloc_io_lock); seqlock_init(&fs_info->profiles_lock); INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots); @@ -3569,17 +3567,6 @@ if (sectorsize < PAGE_SIZE) { struct btrfs_subpage_info *subpage_info; - /* - * V1 space cache has some hardcoded PAGE_SIZE usage, and is - * going to be deprecated. - * - * Force to use v2 cache for subpage case. - */ - btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE); - btrfs_set_and_info(fs_info, FREE_SPACE_TREE, - "forcing free space tree for sector size %u with page size %lu", - sectorsize, PAGE_SIZE); - btrfs_warn(fs_info, "read-write for sector size %u with page size %lu is experimental", sectorsize, PAGE_SIZE); reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/extent-tree.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/extent-tree.c @@ -4087,7 +4087,7 @@ } ret = btrfs_chunk_alloc(trans, ffe_ctl->flags, + CHUNK_ALLOC_FORCE); - CHUNK_ALLOC_FORCE_FOR_EXTENT); /* Do not bail out on ENOSPC since we can do more. */ if (ret == -ENOSPC) diff -u linux-oem-5.17-5.17.0/fs/btrfs/extent_io.c linux-oem-5.17-5.17.0/fs/btrfs/extent_io.c --- linux-oem-5.17-5.17.0/fs/btrfs/extent_io.c +++ linux-oem-5.17-5.17.0/fs/btrfs/extent_io.c @@ -2657,7 +2657,6 @@ repair_bio = btrfs_bio_alloc(1); repair_bbio = btrfs_bio(repair_bio); - repair_bbio->file_offset = start; repair_bio->bi_opf = REQ_OP_READ; repair_bio->bi_end_io = failed_bio->bi_end_io; repair_bio->bi_iter.bi_sector = failrec->logical >> 9; @@ -3563,6 +3562,7 @@ u64 cur_end; struct extent_map *em; int ret = 0; + int nr = 0; size_t pg_offset = 0; size_t iosize; size_t blocksize = inode->i_sb->s_blocksize; @@ -3720,7 +3720,9 @@ end_bio_extent_readpage, 0, this_bio_flag, force_bio_submit); - if (ret) { + if (!ret) { + nr++; + } else { unlock_extent(tree, cur, cur + iosize - 1); end_page_read(page, false, cur, iosize); goto out; reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/file.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/file.c @@ -2918,9 +2918,8 @@ return ret; } +static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) -static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len) { - struct inode *inode = file_inode(file); struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_root *root = BTRFS_I(inode)->root; struct extent_state *cached_state = NULL; @@ -2952,10 +2951,6 @@ goto out_only_mutex; } - ret = file_modified(file); - if (ret) - goto out_only_mutex; - lockstart = round_up(offset, btrfs_inode_sectorsize(BTRFS_I(inode))); lockend = round_down(offset + len, btrfs_inode_sectorsize(BTRFS_I(inode))) - 1; @@ -3396,7 +3391,7 @@ return -EOPNOTSUPP; if (mode & FALLOC_FL_PUNCH_HOLE) + return btrfs_punch_hole(inode, offset, len); - return btrfs_punch_hole(file, offset, len); /* * Only trigger disk allocation, don't trigger qgroup reserve @@ -3418,10 +3413,6 @@ goto out; } - ret = file_modified(file); - if (ret) - goto out; - /* * TODO: Move these two operations after we have checked * accurate reserved space, or fallocate can still fail but diff -u linux-oem-5.17-5.17.0/fs/btrfs/inode.c linux-oem-5.17-5.17.0/fs/btrfs/inode.c --- linux-oem-5.17-5.17.0/fs/btrfs/inode.c +++ linux-oem-5.17-5.17.0/fs/btrfs/inode.c @@ -486,6 +486,17 @@ } /* + * Check if the inode has flags compatible with compression + */ +static inline bool inode_can_compress(struct btrfs_inode *inode) +{ + if (inode->flags & BTRFS_INODE_NODATACOW || + inode->flags & BTRFS_INODE_NODATASUM) + return false; + return true; +} + +/* * Check if the inode needs to be submitted to compression, based on mount * options, defragmentation, properties or heuristics. */ @@ -494,7 +505,7 @@ { struct btrfs_fs_info *fs_info = inode->root->fs_info; - if (!btrfs_inode_can_compress(inode)) { + if (!inode_can_compress(inode)) { WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG), KERN_ERR "BTRFS: unexpected compression for ino %llu\n", btrfs_ino(inode)); @@ -1119,6 +1130,7 @@ int ret = 0; if (btrfs_is_free_space_inode(inode)) { + WARN_ON_ONCE(1); ret = -EINVAL; goto out_unlock; } @@ -2004,7 +2016,7 @@ (zoned && btrfs_is_data_reloc_root(inode->root))); ret = run_delalloc_nocow(inode, locked_page, start, end, page_started, nr_written); - } else if (!btrfs_inode_can_compress(inode) || + } else if (!inode_can_compress(inode) || !inode_need_compress(inode, start, end)) { if (zoned) ret = run_delalloc_zoned(inode, locked_page, start, end, @@ -7411,7 +7423,6 @@ u64 block_start, orig_start, orig_block_len, ram_bytes; bool can_nocow = false; bool space_reserved = false; - u64 prev_len; int ret = 0; /* @@ -7439,7 +7450,6 @@ can_nocow = true; } - prev_len = len; if (can_nocow) { struct extent_map *em2; @@ -7469,6 +7479,8 @@ goto out; } } else { + const u64 prev_len = len; + /* Our caller expects us to free the input extent map. */ free_extent_map(em); *map = NULL; @@ -7499,7 +7511,7 @@ * We have created our ordered extent, so we can now release our reservation * for an outstanding extent. */ - btrfs_delalloc_release_extents(BTRFS_I(inode), prev_len); + btrfs_delalloc_release_extents(BTRFS_I(inode), len); /* * Need to update the i_size under the extent lock so buffered @@ -7778,6 +7790,8 @@ const bool csum = !(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM); struct bio_vec bvec; struct bvec_iter iter; + const u64 orig_file_offset = dip->file_offset; + u64 start = orig_file_offset; u32 bio_offset = 0; blk_status_t err = BLK_STS_OK; @@ -7787,8 +7801,6 @@ nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info, bvec.bv_len); pgoff = bvec.bv_offset; for (i = 0; i < nr_sectors; i++) { - u64 start = bbio->file_offset + bio_offset; - ASSERT(pgoff < PAGE_SIZE); if (uptodate && (!csum || !check_data_csum(inode, bbio, @@ -7801,13 +7813,17 @@ } else { int ret; - ret = btrfs_repair_one_sector(inode, &bbio->bio, - bio_offset, bvec.bv_page, pgoff, + ASSERT((start - orig_file_offset) < UINT_MAX); + ret = btrfs_repair_one_sector(inode, + &bbio->bio, + start - orig_file_offset, + bvec.bv_page, pgoff, start, bbio->mirror_num, submit_dio_repair_bio); if (ret) err = errno_to_blk_status(ret); } + start += sectorsize; ASSERT(bio_offset + sectorsize > bio_offset); bio_offset += sectorsize; pgoff += sectorsize; @@ -7834,7 +7850,6 @@ static void btrfs_end_dio_bio(struct bio *bio) { struct btrfs_dio_private *dip = bio->bi_private; - struct btrfs_bio *bbio = btrfs_bio(bio); blk_status_t err = bio->bi_status; if (err) @@ -7845,12 +7860,12 @@ bio->bi_iter.bi_size, err); if (bio_op(bio) == REQ_OP_READ) - err = btrfs_check_read_dio_bio(dip, bbio, !err); + err = btrfs_check_read_dio_bio(dip, btrfs_bio(bio), !err); if (err) dip->dio_bio->bi_status = err; - btrfs_record_physical_zoned(dip->inode, bbio->file_offset, bio); + btrfs_record_physical_zoned(dip->inode, dip->file_offset, bio); bio_put(bio); btrfs_dio_private_put(dip); @@ -8011,7 +8026,6 @@ bio = btrfs_bio_clone_partial(dio_bio, clone_offset, clone_len); bio->bi_private = dip; bio->bi_end_io = btrfs_end_dio_bio; - btrfs_bio(bio)->file_offset = file_offset; if (bio_op(bio) == REQ_OP_ZONE_APPEND) { status = extract_ordered_extent(BTRFS_I(inode), bio, reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/props.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/props.c @@ -17,11 +17,9 @@ struct prop_handler { struct hlist_node node; const char *xattr_name; + int (*validate)(const char *value, size_t len); - int (*validate)(const struct btrfs_inode *inode, const char *value, - size_t len); int (*apply)(struct inode *inode, const char *value, size_t len); const char *(*extract)(struct inode *inode); - bool (*ignore)(const struct btrfs_inode *inode); int inheritable; }; @@ -57,8 +55,7 @@ return NULL; } +int btrfs_validate_prop(const char *name, const char *value, size_t value_len) -int btrfs_validate_prop(const struct btrfs_inode *inode, const char *name, - const char *value, size_t value_len) { const struct prop_handler *handler; @@ -72,29 +69,7 @@ if (value_len == 0) return 0; + return handler->validate(value, value_len); - return handler->validate(inode, value, value_len); -} - -/* - * Check if a property should be ignored (not set) for an inode. - * - * @inode: The target inode. - * @name: The property's name. - * - * The caller must be sure the given property name is valid, for example by - * having previously called btrfs_validate_prop(). - * - * Returns: true if the property should be ignored for the given inode - * false if the property must not be ignored for the given inode - */ -bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name) -{ - const struct prop_handler *handler; - - handler = find_prop_handler(name, NULL); - ASSERT(handler != NULL); - - return handler->ignore(inode); } int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, @@ -277,12 +252,8 @@ return ret; } +static int prop_compression_validate(const char *value, size_t len) -static int prop_compression_validate(const struct btrfs_inode *inode, - const char *value, size_t len) { - if (!btrfs_inode_can_compress(inode)) - return -EINVAL; - if (!value) return 0; @@ -339,22 +310,6 @@ return 0; } -static bool prop_compression_ignore(const struct btrfs_inode *inode) -{ - /* - * Compression only has effect for regular files, and for directories - * we set it just to propagate it to new files created inside them. - * Everything else (symlinks, devices, sockets, fifos) is pointless as - * it will do nothing, so don't waste metadata space on a compression - * xattr for anything that is neither a file nor a directory. - */ - if (!S_ISREG(inode->vfs_inode.i_mode) && - !S_ISDIR(inode->vfs_inode.i_mode)) - return true; - - return false; -} - static const char *prop_compression_extract(struct inode *inode) { switch (BTRFS_I(inode)->prop_compress) { @@ -375,7 +330,6 @@ .validate = prop_compression_validate, .apply = prop_compression_apply, .extract = prop_compression_extract, - .ignore = prop_compression_ignore, .inheritable = 1 }, }; @@ -402,9 +356,6 @@ if (!h->inheritable) continue; - if (h->ignore(BTRFS_I(inode))) - continue; - value = h->extract(parent); if (!value) continue; @@ -413,7 +364,7 @@ * This is not strictly necessary as the property should be * valid, but in case it isn't, don't propagate it further. */ + ret = h->validate(value, strlen(value)); - ret = h->validate(BTRFS_I(inode), value, strlen(value)); if (ret) continue; reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/props.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/props.h @@ -13,9 +13,7 @@ int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, const char *name, const char *value, size_t value_len, int flags); +int btrfs_validate_prop(const char *name, const char *value, size_t value_len); -int btrfs_validate_prop(const struct btrfs_inode *inode, const char *name, - const char *value, size_t value_len); -bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name); int btrfs_load_inode_props(struct inode *inode, struct btrfs_path *path); reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/scrub.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/scrub.c @@ -3699,31 +3699,6 @@ if (!cache) goto skip; - ASSERT(cache->start <= chunk_offset); - /* - * We are using the commit root to search for device extents, so - * that means we could have found a device extent item from a - * block group that was deleted in the current transaction. The - * logical start offset of the deleted block group, stored at - * @chunk_offset, might be part of the logical address range of - * a new block group (which uses different physical extents). - * In this case btrfs_lookup_block_group() has returned the new - * block group, and its start address is less than @chunk_offset. - * - * We skip such new block groups, because it's pointless to - * process them, as we won't find their extents because we search - * for them using the commit root of the extent tree. For a device - * replace it's also fine to skip it, we won't miss copying them - * to the target device because we have the write duplication - * setup through the regular write path (by btrfs_map_block()), - * and we have committed a transaction when we started the device - * replace, right after setting up the device replace state. - */ - if (cache->start < chunk_offset) { - btrfs_put_block_group(cache); - goto skip; - } - if (sctx->is_dev_replace && btrfs_is_zoned(fs_info)) { spin_lock(&cache->lock); if (!cache->to_copy) { @@ -3847,6 +3822,7 @@ dev_replace->item_needs_writeback = 1; up_write(&dev_replace->rwsem); + ASSERT(cache->start == chunk_offset); ret = scrub_chunk(sctx, cache, scrub_dev, found_key.offset, dev_extent_len); reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/sysfs.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/sysfs.c @@ -919,9 +919,6 @@ case BTRFS_EXCLOP_BALANCE: str = "balance\n"; break; - case BTRFS_EXCLOP_BALANCE_PAUSED: - str = "balance paused\n"; - break; case BTRFS_EXCLOP_DEV_ADD: str = "device add\n"; break; reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/tree-log.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/tree-log.c @@ -3225,7 +3225,6 @@ ret = btrfs_alloc_log_tree_node(trans, log_root_tree); if (ret) { mutex_unlock(&fs_info->tree_root->log_mutex); - blk_finish_plug(&plug); goto out; } } @@ -5656,18 +5655,6 @@ } /* - * For symlinks, we must always log their content, which is stored in an - * inline extent, otherwise we could end up with an empty symlink after - * log replay, which is invalid on linux (symlink(2) returns -ENOENT if - * one attempts to create an empty symlink). - * We don't need to worry about flushing delalloc, because when we create - * the inline extent when the symlink is created (we never have delalloc - * for symlinks). - */ - if (S_ISLNK(inode->vfs_inode.i_mode)) - inode_only = LOG_INODE_ALL; - - /* * This is for cases where logging a directory could result in losing a * a file after replaying the log. For example, if we move a file from a * directory A to a directory B, then fsync directory A, we have no way @@ -6027,7 +6014,7 @@ } ctx->log_new_dentries = false; + if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK) - if (type == BTRFS_FT_DIR) log_mode = LOG_INODE_ALL; ret = btrfs_log_inode(trans, BTRFS_I(di_inode), log_mode, ctx); diff -u linux-oem-5.17-5.17.0/fs/btrfs/volumes.c linux-oem-5.17-5.17.0/fs/btrfs/volumes.c --- linux-oem-5.17-5.17.0/fs/btrfs/volumes.c +++ linux-oem-5.17-5.17.0/fs/btrfs/volumes.c @@ -4467,12 +4467,10 @@ struct btrfs_fs_info *fs_info = data; int ret = 0; - sb_start_write(fs_info->sb); mutex_lock(&fs_info->balance_mutex); if (fs_info->balance_ctl) ret = btrfs_balance(fs_info, fs_info->balance_ctl, NULL); mutex_unlock(&fs_info->balance_mutex); - sb_end_write(fs_info->sb); return ret; } reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/volumes.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/volumes.h @@ -323,9 +323,6 @@ struct btrfs_bio { unsigned int mirror_num; - /* for direct I/O */ - u64 file_offset; - /* @device is for stripe IO submission. */ struct btrfs_device *device; u8 *csum; reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/xattr.c +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/xattr.c @@ -262,8 +262,7 @@ inode_inc_iversion(inode); inode->i_ctime = current_time(inode); ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); + BUG_ON(ret); - if (ret) - btrfs_abort_transaction(trans, ret); out: if (start_trans) btrfs_end_transaction(trans); @@ -404,13 +403,10 @@ struct btrfs_root *root = BTRFS_I(inode)->root; name = xattr_full_name(handler, name); + ret = btrfs_validate_prop(name, value, size); - ret = btrfs_validate_prop(BTRFS_I(inode), name, value, size); if (ret) return ret; - if (btrfs_ignore_prop(BTRFS_I(inode), name)) - return 0; - trans = btrfs_start_transaction(root, 2); if (IS_ERR(trans)) return PTR_ERR(trans); @@ -420,8 +416,7 @@ inode_inc_iversion(inode); inode->i_ctime = current_time(inode); ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); + BUG_ON(ret); - if (ret) - btrfs_abort_transaction(trans, ret); } btrfs_end_transaction(trans); reverted: --- linux-oem-5.17-5.17.0/fs/btrfs/zoned.h +++ linux-oem-5.17-5.17.0.orig/fs/btrfs/zoned.h @@ -359,7 +359,7 @@ struct btrfs_root *root = inode->root; if (btrfs_is_data_reloc_root(root) && btrfs_is_zoned(root->fs_info)) + btrfs_inode_lock(&inode->vfs_inode, 0); - mutex_lock(&root->fs_info->zoned_data_reloc_io_lock); } static inline void btrfs_zoned_data_reloc_unlock(struct btrfs_inode *inode) @@ -367,7 +367,7 @@ struct btrfs_root *root = inode->root; if (btrfs_is_data_reloc_root(root) && btrfs_is_zoned(root->fs_info)) + btrfs_inode_unlock(&inode->vfs_inode, 0); - mutex_unlock(&root->fs_info->zoned_data_reloc_io_lock); } #endif reverted: --- linux-oem-5.17-5.17.0/fs/cachefiles/namei.c +++ linux-oem-5.17-5.17.0.orig/fs/cachefiles/namei.c @@ -57,16 +57,6 @@ trace_cachefiles_mark_inactive(object, inode); } -static void cachefiles_do_unmark_inode_in_use(struct cachefiles_object *object, - struct dentry *dentry) -{ - struct inode *inode = d_backing_inode(dentry); - - inode_lock(inode); - __cachefiles_unmark_inode_in_use(object, dentry); - inode_unlock(inode); -} - /* * Unmark a backing inode and tell cachefilesd that there's something that can * be culled. @@ -78,7 +68,9 @@ struct inode *inode = file_inode(file); if (inode) { + inode_lock(inode); + __cachefiles_unmark_inode_in_use(object, file->f_path.dentry); + inode_unlock(inode); - cachefiles_do_unmark_inode_in_use(object, file->f_path.dentry); if (!test_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags)) { atomic_long_add(inode->i_blocks, &cache->b_released); @@ -492,7 +484,7 @@ object, d_backing_inode(path.dentry), ret, cachefiles_trace_trunc_error); file = ERR_PTR(ret); + goto out_dput; - goto out_unuse; } } @@ -502,20 +494,15 @@ trace_cachefiles_vfs_error(object, d_backing_inode(path.dentry), PTR_ERR(file), cachefiles_trace_open_error); + goto out_dput; - goto out_unuse; } if (unlikely(!file->f_op->read_iter) || unlikely(!file->f_op->write_iter)) { fput(file); pr_notice("Cache does not support read_iter and write_iter\n"); file = ERR_PTR(-EINVAL); - goto out_unuse; } - goto out_dput; - -out_unuse: - cachefiles_do_unmark_inode_in_use(object, path.dentry); out_dput: dput(path.dentry); out: @@ -603,16 +590,14 @@ check_failed: fscache_cookie_lookup_negative(object->cookie); cachefiles_unmark_inode_in_use(object, file); + if (ret == -ESTALE) { + fput(file); + dput(dentry); - fput(file); - dput(dentry); - if (ret == -ESTALE) return cachefiles_create_file(object); + } - return false; - error_fput: fput(file); error: - cachefiles_do_unmark_inode_in_use(object, dentry); dput(dentry); return false; } reverted: --- linux-oem-5.17-5.17.0/fs/cachefiles/xattr.c +++ linux-oem-5.17-5.17.0.orig/fs/cachefiles/xattr.c @@ -203,7 +203,7 @@ if (!buf) return false; buf->reserved = cpu_to_be32(0); + memcpy(buf->data, p, len); - memcpy(buf->data, p, volume->vcookie->coherency_len); ret = cachefiles_inject_write_error(); if (ret == 0) reverted: --- linux-oem-5.17-5.17.0/fs/ceph/caps.c +++ linux-oem-5.17-5.17.0.orig/fs/ceph/caps.c @@ -2267,8 +2267,6 @@ list_for_each_entry(req, &ci->i_unsafe_dirops, r_unsafe_dir_item) { s = req->r_session; - if (!s) - continue; if (unlikely(s->s_mds >= max_sessions)) { spin_unlock(&ci->i_unsafe_lock); for (i = 0; i < max_sessions; i++) { @@ -2289,8 +2287,6 @@ list_for_each_entry(req, &ci->i_unsafe_iops, r_unsafe_target_item) { s = req->r_session; - if (!s) - continue; if (unlikely(s->s_mds >= max_sessions)) { spin_unlock(&ci->i_unsafe_lock); for (i = 0; i < max_sessions; i++) { diff -u linux-oem-5.17-5.17.0/fs/cifs/cifsfs.c linux-oem-5.17-5.17.0/fs/cifs/cifsfs.c --- linux-oem-5.17-5.17.0/fs/cifs/cifsfs.c +++ linux-oem-5.17-5.17.0/fs/cifs/cifsfs.c @@ -266,24 +266,22 @@ * before we kill the sb. */ if (cifs_sb->root) { - for (node = rb_first(root); node; node = rb_next(node)) { - tlink = rb_entry(node, struct tcon_link, tl_rbnode); - tcon = tlink_tcon(tlink); - if (IS_ERR(tcon)) - continue; - cfid = &tcon->crfid; - mutex_lock(&cfid->fid_mutex); - if (cfid->dentry) { - dput(cfid->dentry); - cfid->dentry = NULL; - } - mutex_unlock(&cfid->fid_mutex); - } - - /* finally release root dentry */ dput(cifs_sb->root); cifs_sb->root = NULL; } + node = rb_first(root); + while (node != NULL) { + tlink = rb_entry(node, struct tcon_link, tl_rbnode); + tcon = tlink_tcon(tlink); + cfid = &tcon->crfid; + mutex_lock(&cfid->fid_mutex); + if (cfid->dentry) { + dput(cfid->dentry); + cfid->dentry = NULL; + } + mutex_unlock(&cfid->fid_mutex); + node = rb_next(node); + } kill_anon_super(sb); cifs_umount(cifs_sb); @@ -946,7 +944,7 @@ ssize_t rc; struct inode *inode = file_inode(iocb->ki_filp); - if (iocb->ki_flags & IOCB_DIRECT) + if (iocb->ki_filp->f_flags & O_DIRECT) return cifs_user_readv(iocb, iter); rc = cifs_revalidate_mapping(inode); diff -u linux-oem-5.17-5.17.0/fs/cifs/connect.c linux-oem-5.17-5.17.0/fs/cifs/connect.c --- linux-oem-5.17-5.17.0/fs/cifs/connect.c +++ linux-oem-5.17-5.17.0/fs/cifs/connect.c @@ -534,19 +534,12 @@ { /* If tcp session is not an dfs connection, then reconnect to last target server */ spin_lock(&cifs_tcp_ses_lock); - if (!server->is_dfs_conn) { + if (!server->is_dfs_conn || !server->origin_fullpath || !server->leaf_fullpath) { spin_unlock(&cifs_tcp_ses_lock); return __cifs_reconnect(server, mark_smb_session); } spin_unlock(&cifs_tcp_ses_lock); - mutex_lock(&server->refpath_lock); - if (!server->origin_fullpath || !server->leaf_fullpath) { - mutex_unlock(&server->refpath_lock); - return __cifs_reconnect(server, mark_smb_session); - } - mutex_unlock(&server->refpath_lock); - return reconnect_dfs_server(server); } #else @@ -3682,11 +3675,9 @@ { struct TCP_Server_Info *server = mnt_ctx->server; - mutex_lock(&server->refpath_lock); server->origin_fullpath = mnt_ctx->origin_fullpath; server->leaf_fullpath = mnt_ctx->leaf_fullpath; server->current_fullpath = mnt_ctx->leaf_fullpath; - mutex_unlock(&server->refpath_lock); mnt_ctx->origin_fullpath = mnt_ctx->leaf_fullpath = NULL; } diff -u linux-oem-5.17-5.17.0/fs/cifs/dfs_cache.c linux-oem-5.17-5.17.0/fs/cifs/dfs_cache.c --- linux-oem-5.17-5.17.0/fs/cifs/dfs_cache.c +++ linux-oem-5.17-5.17.0/fs/cifs/dfs_cache.c @@ -1422,14 +1422,12 @@ struct TCP_Server_Info *server = tcon->ses->server; mutex_lock(&server->refpath_lock); - if (server->origin_fullpath) { - if (server->leaf_fullpath && strcasecmp(server->leaf_fullpath, - server->origin_fullpath)) - __refresh_tcon(server->leaf_fullpath + 1, sessions, tcon, force_refresh); - __refresh_tcon(server->origin_fullpath + 1, sessions, tcon, force_refresh); - } + if (strcasecmp(server->leaf_fullpath, server->origin_fullpath)) + __refresh_tcon(server->leaf_fullpath + 1, sessions, tcon, force_refresh); mutex_unlock(&server->refpath_lock); + __refresh_tcon(server->origin_fullpath + 1, sessions, tcon, force_refresh); + return 0; } @@ -1532,14 +1530,11 @@ list_del_init(&tcon->ulist); mutex_lock(&server->refpath_lock); - if (server->origin_fullpath) { - if (server->leaf_fullpath && strcasecmp(server->leaf_fullpath, - server->origin_fullpath)) - __refresh_tcon(server->leaf_fullpath + 1, sessions, tcon, false); - __refresh_tcon(server->origin_fullpath + 1, sessions, tcon, false); - } + if (strcasecmp(server->leaf_fullpath, server->origin_fullpath)) + __refresh_tcon(server->leaf_fullpath + 1, sessions, tcon, false); mutex_unlock(&server->refpath_lock); + __refresh_tcon(server->origin_fullpath + 1, sessions, tcon, false); cifs_put_tcon(tcon); } } reverted: --- linux-oem-5.17-5.17.0/fs/cifs/link.c +++ linux-oem-5.17-5.17.0.orig/fs/cifs/link.c @@ -85,9 +85,6 @@ if (rc != 1) return -EINVAL; - if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN) - return -EINVAL; - rc = symlink_hash(link_len, link_str, md5_hash); if (rc) { cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc); diff -u linux-oem-5.17-5.17.0/fs/cifs/smb2ops.c linux-oem-5.17-5.17.0/fs/cifs/smb2ops.c --- linux-oem-5.17-5.17.0/fs/cifs/smb2ops.c +++ linux-oem-5.17-5.17.0/fs/cifs/smb2ops.c @@ -1861,17 +1861,9 @@ 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; reverted: --- linux-oem-5.17-5.17.0/fs/erofs/zdata.c +++ linux-oem-5.17-5.17.0.orig/fs/erofs/zdata.c @@ -1073,9 +1073,12 @@ /* wake up the caller thread for sync decompression */ if (sync) { + unsigned long flags; + + spin_lock_irqsave(&io->u.wait.lock, flags); if (!atomic_add_return(bios, &io->pending_bios)) + wake_up_locked(&io->u.wait); + spin_unlock_irqrestore(&io->u.wait.lock, flags); - complete(&io->u.done); - return; } @@ -1221,7 +1224,7 @@ } else { fg_out: q = fgq; + init_waitqueue_head(&fgq->u.wait); - init_completion(&fgq->u.done); atomic_set(&fgq->pending_bios, 0); } q->sb = sb; @@ -1425,7 +1428,8 @@ return; /* wait until all bios are completed */ + io_wait_event(io[JQ_SUBMIT].u.wait, + !atomic_read(&io[JQ_SUBMIT].pending_bios)); - wait_for_completion_io(&io[JQ_SUBMIT].u.done); /* handle synchronous decompress queue in the caller context */ z_erofs_decompress_queue(&io[JQ_SUBMIT], pagepool); reverted: --- linux-oem-5.17-5.17.0/fs/erofs/zdata.h +++ linux-oem-5.17-5.17.0.orig/fs/erofs/zdata.h @@ -97,7 +97,7 @@ z_erofs_next_pcluster_t head; union { + wait_queue_head_t wait; - struct completion done; struct work_struct work; } u; }; reverted: --- linux-oem-5.17-5.17.0/fs/ext4/ext4.h +++ linux-oem-5.17-5.17.0.orig/fs/ext4/ext4.h @@ -2271,10 +2271,6 @@ * Structure of a directory entry */ #define EXT4_NAME_LEN 255 -/* - * Base length of the ext4 directory entry excluding the name length - */ -#define EXT4_BASE_DIR_LEN (sizeof(struct ext4_dir_entry_2) - EXT4_NAME_LEN) struct ext4_dir_entry { __le32 inode; /* Inode number */ @@ -3034,7 +3030,7 @@ extern int ext4_can_truncate(struct inode *inode); extern int ext4_truncate(struct inode *); extern int ext4_break_layouts(struct inode *); +extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length); -extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length); extern void ext4_set_inode_flags(struct inode *, bool init); extern int ext4_alloc_da_blocks(struct inode *inode); extern void ext4_set_aops(struct inode *inode); @@ -3066,7 +3062,6 @@ struct dentry *dentry, struct fileattr *fa); int ext4_fileattr_get(struct dentry *dentry, struct fileattr *fa); extern void ext4_reset_inode_seed(struct inode *inode); -int ext4_update_overhead(struct super_block *sb); /* migrate.c */ extern int ext4_ext_migrate(struct inode *); reverted: --- linux-oem-5.17-5.17.0/fs/ext4/extents.c +++ linux-oem-5.17-5.17.0.orig/fs/ext4/extents.c @@ -4501,9 +4501,9 @@ return ret > 0 ? ret2 : ret; } +static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len); -static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len); +static int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len); -static int ext4_insert_range(struct file *file, loff_t offset, loff_t len); static long ext4_zero_range(struct file *file, loff_t offset, loff_t len, int mode) @@ -4575,10 +4575,6 @@ /* Wait all existing dio workers, newcomers will block on i_rwsem */ inode_dio_wait(inode); - ret = file_modified(file); - if (ret) - goto out_mutex; - /* Preallocate the range including the unaligned edges */ if (partial_begin || partial_end) { ret = ext4_alloc_file_blocks(file, @@ -4695,7 +4691,7 @@ return -EOPNOTSUPP; if (mode & FALLOC_FL_PUNCH_HOLE) { + ret = ext4_punch_hole(inode, offset, len); - ret = ext4_punch_hole(file, offset, len); goto exit; } @@ -4704,12 +4700,12 @@ goto exit; if (mode & FALLOC_FL_COLLAPSE_RANGE) { + ret = ext4_collapse_range(inode, offset, len); - ret = ext4_collapse_range(file, offset, len); goto exit; } if (mode & FALLOC_FL_INSERT_RANGE) { + ret = ext4_insert_range(inode, offset, len); - ret = ext4_insert_range(file, offset, len); goto exit; } @@ -4745,10 +4741,6 @@ /* Wait all existing dio workers, newcomers will block on i_rwsem */ inode_dio_wait(inode); - ret = file_modified(file); - if (ret) - goto out; - ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, flags); if (ret) goto out; @@ -5250,9 +5242,8 @@ * This implements the fallocate's collapse range functionality for ext4 * Returns: 0 and non-zero on error. */ +static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) -static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len) { - struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; struct address_space *mapping = inode->i_mapping; ext4_lblk_t punch_start, punch_stop; @@ -5304,10 +5295,6 @@ /* Wait for existing dio to complete */ inode_dio_wait(inode); - ret = file_modified(file); - if (ret) - goto out_mutex; - /* * Prevent page faults from reinstantiating pages we have released from * page cache. @@ -5401,9 +5388,8 @@ * by len bytes. * Returns 0 on success, error otherwise. */ +static int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) -static int ext4_insert_range(struct file *file, loff_t offset, loff_t len) { - struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; struct address_space *mapping = inode->i_mapping; handle_t *handle; @@ -5460,10 +5446,6 @@ /* Wait for existing dio to complete */ inode_dio_wait(inode); - ret = file_modified(file); - if (ret) - goto out_mutex; - /* * Prevent page faults from reinstantiating pages we have released from * page cache. diff -u linux-oem-5.17-5.17.0/fs/ext4/inode.c linux-oem-5.17-5.17.0/fs/ext4/inode.c --- linux-oem-5.17-5.17.0/fs/ext4/inode.c +++ linux-oem-5.17-5.17.0/fs/ext4/inode.c @@ -3944,9 +3944,8 @@ * Returns: 0 on success or negative on failure */ -int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) +int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) { - struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; ext4_lblk_t first_block, stop_block; struct address_space *mapping = inode->i_mapping; @@ -4017,10 +4016,6 @@ /* Wait all existing dio workers, newcomers will block on i_rwsem */ inode_dio_wait(inode); - ret = file_modified(file); - if (ret) - goto out_mutex; - /* * Prevent page faults from reinstantiating pages we have released from * page cache. reverted: --- linux-oem-5.17-5.17.0/fs/ext4/ioctl.c +++ linux-oem-5.17-5.17.0.orig/fs/ext4/ioctl.c @@ -1652,19 +1652,3 @@ return ext4_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); } #endif - -static void set_overhead(struct ext4_super_block *es, const void *arg) -{ - es->s_overhead_clusters = cpu_to_le32(*((unsigned long *) arg)); -} - -int ext4_update_overhead(struct super_block *sb) -{ - struct ext4_sb_info *sbi = EXT4_SB(sb); - - if (sb_rdonly(sb) || sbi->s_overhead == 0 || - sbi->s_overhead == le32_to_cpu(sbi->s_es->s_overhead_clusters)) - return 0; - - return ext4_update_superblocks_fn(sb, set_overhead, &sbi->s_overhead); -} diff -u linux-oem-5.17-5.17.0/fs/ext4/namei.c linux-oem-5.17-5.17.0/fs/ext4/namei.c --- linux-oem-5.17-5.17.0/fs/ext4/namei.c +++ linux-oem-5.17-5.17.0/fs/ext4/namei.c @@ -1466,10 +1466,10 @@ de = (struct ext4_dir_entry_2 *)search_buf; dlimit = search_buf + buf_size; - while ((char *) de < dlimit - EXT4_BASE_DIR_LEN) { + while ((char *) de < dlimit) { /* this code is executed quadratically often */ /* do minimal checking `by hand' */ - if (de->name + de->name_len <= dlimit && + if ((char *) de + de->name_len <= dlimit && ext4_match(dir, fname, de)) { /* found a match - just to be sure, do * a full check */ reverted: --- linux-oem-5.17-5.17.0/fs/ext4/page-io.c +++ linux-oem-5.17-5.17.0.orig/fs/ext4/page-io.c @@ -134,10 +134,8 @@ continue; } clear_buffer_async_write(bh); + if (bio->bi_status) - if (bio->bi_status) { - set_buffer_write_io_error(bh); buffer_io_error(bh); - } } while ((bh = bh->b_this_page) != head); spin_unlock_irqrestore(&head->b_uptodate_lock, flags); if (!under_io) { diff -u linux-oem-5.17-5.17.0/fs/ext4/super.c linux-oem-5.17-5.17.0/fs/ext4/super.c --- linux-oem-5.17-5.17.0/fs/ext4/super.c +++ linux-oem-5.17-5.17.0/fs/ext4/super.c @@ -1199,18 +1199,6 @@ int aborted = 0; int i, err; - /* - * Unregister sysfs before destroying jbd2 journal. - * Since we could still access attr_journal_task attribute via sysfs - * path which could have sbi->s_journal->j_task as NULL - * Unregister sysfs before flush sbi->s_error_work. - * Since user may read /proc/fs/ext4/xx/mb_groups during umount, If - * read metadata verify failed then will queue error work. - * flush_stashed_error_work will call start_this_handle may trigger - * BUG_ON. - */ - ext4_unregister_sysfs(sb); - ext4_unregister_li_request(sb); ext4_quota_off_umount(sb); @@ -1218,6 +1206,13 @@ destroy_workqueue(sbi->rsv_conversion_wq); ext4_release_orphan_info(sb); + /* + * Unregister sysfs before destroying jbd2 journal. + * Since we could still access attr_journal_task attribute via sysfs + * path which could have sbi->s_journal->j_task as NULL + */ + ext4_unregister_sysfs(sb); + if (sbi->s_journal) { aborted = is_journal_aborted(sbi->s_journal); err = jbd2_journal_destroy(sbi->s_journal); @@ -4161,11 +4156,9 @@ ext4_fsblk_t first_block, last_block, b; ext4_group_t i, ngroups = ext4_get_groups_count(sb); int s, j, count = 0; - int has_super = ext4_bg_has_super(sb, grp); if (!ext4_has_feature_bigalloc(sb)) - return (has_super + ext4_bg_num_gdb(sb, grp) + - (has_super ? le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0) + + return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + sbi->s_itb_per_group + 2); first_block = le32_to_cpu(sbi->s_es->s_first_data_block) + @@ -5273,18 +5266,9 @@ * Get the # of file system overhead blocks from the * superblock if present. */ - sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters); - /* ignore the precalculated value if it is ridiculous */ - if (sbi->s_overhead > ext4_blocks_count(es)) - sbi->s_overhead = 0; - /* - * If the bigalloc feature is not enabled recalculating the - * overhead doesn't take long, so we might as well just redo - * it to make sure we are using the correct value. - */ - if (!ext4_has_feature_bigalloc(sb)) - sbi->s_overhead = 0; - if (sbi->s_overhead == 0) { + if (es->s_overhead_clusters) + sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters); + else { err = ext4_calculate_overhead(sb); if (err) goto failed_mount_wq; @@ -5602,8 +5586,6 @@ ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " "Quota mode: %s.", descr, ext4_quota_mode(sb)); - /* Update the s_overhead_clusters if necessary */ - ext4_update_overhead(sb); return 0; free_sbi: diff -u linux-oem-5.17-5.17.0/fs/f2fs/inode.c linux-oem-5.17-5.17.0/fs/f2fs/inode.c --- linux-oem-5.17-5.17.0/fs/f2fs/inode.c +++ linux-oem-5.17-5.17.0/fs/f2fs/inode.c @@ -550,8 +550,7 @@ } f2fs_set_inode_flags(inode); - if (file_should_truncate(inode) && - !is_sbi_flag_set(sbi, SBI_POR_DOING)) { + if (file_should_truncate(inode)) { ret = f2fs_truncate(inode); if (ret) goto bad_inode; diff -u linux-oem-5.17-5.17.0/fs/gfs2/file.c linux-oem-5.17-5.17.0/fs/gfs2/file.c --- linux-oem-5.17-5.17.0/fs/gfs2/file.c +++ linux-oem-5.17-5.17.0/fs/gfs2/file.c @@ -851,9 +851,9 @@ leftover = fault_in_iov_iter_writeable(to, window_size); gfs2_holder_disallow_demote(gh); if (leftover != window_size) { - if (gfs2_holder_queued(gh)) - goto retry_under_glock; - goto retry; + if (!gfs2_holder_queued(gh)) + goto retry; + goto retry_under_glock; } } if (gfs2_holder_queued(gh)) @@ -920,9 +920,9 @@ leftover = fault_in_iov_iter_readable(from, window_size); gfs2_holder_disallow_demote(gh); if (leftover != window_size) { - if (gfs2_holder_queued(gh)) - goto retry_under_glock; - goto retry; + if (!gfs2_holder_queued(gh)) + goto retry; + goto retry_under_glock; } } out: @@ -989,9 +989,12 @@ leftover = fault_in_iov_iter_writeable(to, window_size); gfs2_holder_disallow_demote(&gh); if (leftover != window_size) { - if (gfs2_holder_queued(&gh)) - goto retry_under_glock; - goto retry; + if (!gfs2_holder_queued(&gh)) { + if (written) + goto out_uninit; + goto retry; + } + goto retry_under_glock; } } if (gfs2_holder_queued(&gh)) @@ -1065,9 +1068,12 @@ gfs2_holder_disallow_demote(gh); if (leftover != window_size) { from->count = min(from->count, window_size - leftover); - if (gfs2_holder_queued(gh)) - goto retry_under_glock; - goto retry; + if (!gfs2_holder_queued(gh)) { + if (read) + goto out_uninit; + goto retry; + } + goto retry_under_glock; } } out_unlock: diff -u linux-oem-5.17-5.17.0/fs/gfs2/rgrp.c linux-oem-5.17-5.17.0/fs/gfs2/rgrp.c --- linux-oem-5.17-5.17.0/fs/gfs2/rgrp.c +++ linux-oem-5.17-5.17.0/fs/gfs2/rgrp.c @@ -923,14 +923,14 @@ spin_lock_init(&rgd->rd_rsspin); mutex_init(&rgd->rd_mutex); - error = gfs2_glock_get(sdp, rgd->rd_addr, - &gfs2_rgrp_glops, CREATE, &rgd->rd_gl); + error = compute_bitstructs(rgd); if (error) goto fail; - error = compute_bitstructs(rgd); + error = gfs2_glock_get(sdp, rgd->rd_addr, + &gfs2_rgrp_glops, CREATE, &rgd->rd_gl); if (error) - goto fail_glock; + goto fail; rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr; rgd->rd_flags &= ~GFS2_RDF_PREFERRED; @@ -945,7 +945,6 @@ } error = 0; /* someone else read in the rgrp; free it and ignore it */ -fail_glock: gfs2_glock_put(rgd->rd_gl); fail: reverted: --- linux-oem-5.17-5.17.0/fs/hugetlbfs/inode.c +++ linux-oem-5.17-5.17.0.orig/fs/hugetlbfs/inode.c @@ -206,7 +206,7 @@ info.flags = 0; info.length = len; info.low_limit = current->mm->mmap_base; + info.high_limit = TASK_SIZE; - info.high_limit = arch_get_mmap_end(addr); info.align_mask = PAGE_MASK & ~huge_page_mask(h); info.align_offset = 0; return vm_unmapped_area(&info); @@ -222,7 +222,7 @@ info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; info.low_limit = max(PAGE_SIZE, mmap_min_addr); + info.high_limit = current->mm->mmap_base; - info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base); info.align_mask = PAGE_MASK & ~huge_page_mask(h); info.align_offset = 0; addr = vm_unmapped_area(&info); @@ -237,7 +237,7 @@ VM_BUG_ON(addr != -ENOMEM); info.flags = 0; info.low_limit = current->mm->mmap_base; + info.high_limit = TASK_SIZE; - info.high_limit = arch_get_mmap_end(addr); addr = vm_unmapped_area(&info); } @@ -251,7 +251,6 @@ struct mm_struct *mm = current->mm; struct vm_area_struct *vma; struct hstate *h = hstate_file(file); - const unsigned long mmap_end = arch_get_mmap_end(addr); if (len & ~huge_page_mask(h)) return -EINVAL; @@ -267,7 +266,7 @@ if (addr) { addr = ALIGN(addr, huge_page_size(h)); vma = find_vma(mm, addr); + if (TASK_SIZE - len >= addr && - if (mmap_end - len >= addr && (!vma || addr + len <= vm_start_gap(vma))) return addr; } diff -u linux-oem-5.17-5.17.0/fs/io_uring.c linux-oem-5.17-5.17.0/fs/io_uring.c --- linux-oem-5.17-5.17.0/fs/io_uring.c +++ linux-oem-5.17-5.17.0/fs/io_uring.c @@ -864,11 +864,7 @@ u64 user_data; u32 result; - /* fd initially, then cflags for completion */ - union { - u32 cflags; - int fd; - }; + u32 cflags; struct io_ring_ctx *ctx; struct task_struct *task; @@ -2612,10 +2608,11 @@ /* order with io_complete_rw_iopoll(), e.g. ->result updates */ if (!smp_load_acquire(&req->iopoll_completed)) break; - nr_events++; if (unlikely(req->flags & REQ_F_CQE_SKIP)) continue; + __io_fill_cqe(ctx, req->user_data, req->result, io_put_kbuf(req)); + nr_events++; } if (unlikely(!nr_events)) @@ -3584,7 +3581,6 @@ if (!(kiocb->ki_flags & IOCB_DIRECT) || !file->f_op->iopoll) return -EOPNOTSUPP; - kiocb->private = NULL; kiocb->ki_flags |= IOCB_HIPRI | IOCB_ALLOC_CACHE; kiocb->ki_complete = io_complete_rw_iopoll; req->iopoll_completed = 0; @@ -3622,10 +3618,8 @@ iovec = NULL; } ret = io_rw_init_file(req, FMODE_READ); - if (unlikely(ret)) { - kfree(iovec); + if (unlikely(ret)) return ret; - } req->result = iov_iter_count(&s->iter); if (force_nonblock) { @@ -3744,10 +3738,8 @@ iovec = NULL; } ret = io_rw_init_file(req, FMODE_WRITE); - if (unlikely(ret)) { - kfree(iovec); + if (unlikely(ret)) return ret; - } req->result = iov_iter_count(&s->iter); if (force_nonblock) { @@ -4144,7 +4136,7 @@ return -EAGAIN; if (sp->flags & SPLICE_F_FD_IN_FIXED) - in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags); + in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED); else in = io_file_get_normal(req, sp->splice_fd_in); if (!in) { @@ -4186,7 +4178,7 @@ return -EAGAIN; if (sp->flags & SPLICE_F_FD_IN_FIXED) - in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags); + in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED); else in = io_file_get_normal(req, sp->splice_fd_in); if (!in) { @@ -4891,8 +4883,6 @@ if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; - if (unlikely(sqe->addr2 || sqe->file_index)) - return -EINVAL; sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->len = READ_ONCE(sqe->len); @@ -5104,8 +5094,6 @@ if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; - if (unlikely(sqe->addr2 || sqe->file_index)) - return -EINVAL; sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->len = READ_ONCE(sqe->len); @@ -5518,11 +5506,11 @@ if (!req->result) { struct poll_table_struct pt = { ._key = poll->events }; - unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED; - if (unlikely(!io_assign_file(req, flags))) - return -EBADF; - req->result = vfs_poll(req->file, &pt) & poll->events; + if (unlikely(!io_assign_file(req, IO_URING_F_UNLOCKED))) + req->result = -EBADF; + else + req->result = vfs_poll(req->file, &pt) & poll->events; } /* multishot, just fill an CQE and proceed */ @@ -6474,7 +6462,6 @@ up.nr = 0; up.tags = 0; up.resv = 0; - up.resv2 = 0; io_ring_submit_lock(ctx, needs_lock); ret = __io_register_rsrc_update(ctx, IORING_RSRC_FILE, @@ -6721,9 +6708,9 @@ return true; if (req->flags & REQ_F_FIXED_FILE) - req->file = io_file_get_fixed(req, req->fd, issue_flags); + req->file = io_file_get_fixed(req, req->work.fd, issue_flags); else - req->file = io_file_get_normal(req, req->fd); + req->file = io_file_get_normal(req, req->work.fd); if (req->file) return true; @@ -6737,14 +6724,13 @@ const struct cred *creds = NULL; int ret; - if (unlikely(!io_assign_file(req, issue_flags))) - return -EBADF; - if (unlikely((req->flags & REQ_F_CREDS) && req->creds != current_cred())) creds = override_creds(req->creds); if (!io_op_defs[req->opcode].audit_skip) audit_uring_entry(req->opcode); + if (unlikely(!io_assign_file(req, issue_flags))) + return -EBADF; switch (req->opcode) { case IORING_OP_NOP: @@ -6902,18 +6888,16 @@ if (timeout) io_queue_linked_timeout(timeout); + if (!io_assign_file(req, issue_flags)) { + err = -EBADF; + work->flags |= IO_WQ_WORK_CANCEL; + } /* either cancelled or io-wq is dying, so don't touch tctx->iowq */ if (work->flags & IO_WQ_WORK_CANCEL) { -fail: io_req_task_queue_fail(req, err); return; } - if (!io_assign_file(req, issue_flags)) { - err = -EBADF; - work->flags |= IO_WQ_WORK_CANCEL; - goto fail; - } if (req->flags & REQ_F_FORCE_ASYNC) { bool opcode_poll = def->pollin || def->pollout; @@ -7259,7 +7243,7 @@ if (io_op_defs[opcode].needs_file) { struct io_submit_state *state = &ctx->submit_state; - req->fd = READ_ONCE(sqe->fd); + req->work.fd = READ_ONCE(sqe->fd); /* * Plug now if we have more than 2 IO left after this, and the @@ -8544,15 +8528,13 @@ static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, struct io_rsrc_node *node, void *rsrc) { - u64 *tag_slot = io_get_tag_slot(data, idx); struct io_rsrc_put *prsrc; prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL); if (!prsrc) return -ENOMEM; - prsrc->tag = *tag_slot; - *tag_slot = 0; + prsrc->tag = *io_get_tag_slot(data, idx); prsrc->rsrc = rsrc; list_add(&prsrc->list, &node->rsrc_list); return 0; @@ -8621,7 +8603,7 @@ bool needs_lock = issue_flags & IO_URING_F_UNLOCKED; struct io_fixed_file *file_slot; struct file *file; - int ret; + int ret, i; io_ring_submit_lock(ctx, needs_lock); ret = -ENXIO; @@ -8634,8 +8616,8 @@ if (ret) goto out; - offset = array_index_nospec(offset, ctx->nr_user_files); - file_slot = io_fixed_file_slot(&ctx->file_table, offset); + i = array_index_nospec(offset, ctx->nr_user_files); + file_slot = io_fixed_file_slot(&ctx->file_table, i); ret = -EBADF; if (!file_slot->file_ptr) goto out; @@ -8691,7 +8673,8 @@ if (file_slot->file_ptr) { file = (struct file *)(file_slot->file_ptr & FFS_MASK); - err = io_queue_rsrc_removal(data, i, ctx->rsrc_node, file); + err = io_queue_rsrc_removal(data, up->offset + done, + ctx->rsrc_node, file); if (err) break; file_slot->file_ptr = 0; @@ -9364,7 +9347,7 @@ i = array_index_nospec(offset, ctx->nr_user_bufs); if (ctx->user_bufs[i] != ctx->dummy_ubuf) { - err = io_queue_rsrc_removal(ctx->buf_data, i, + err = io_queue_rsrc_removal(ctx->buf_data, offset, ctx->rsrc_node, ctx->user_bufs[i]); if (unlikely(err)) { io_buffer_unmap(ctx, &imu); @@ -10119,8 +10102,6 @@ return -EINVAL; if (copy_from_user(&arg, argp, sizeof(arg))) return -EFAULT; - if (arg.pad) - return -EINVAL; *sig = u64_to_user_ptr(arg.sigmask); *argsz = arg.sigmask_sz; *ts = u64_to_user_ptr(arg.ts); @@ -10585,8 +10566,7 @@ IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL | IORING_FEAT_POLL_32BITS | IORING_FEAT_SQPOLL_NONFIXED | IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS | - IORING_FEAT_RSRC_TAGS | IORING_FEAT_CQE_SKIP | - IORING_FEAT_LINKED_FILE; + IORING_FEAT_RSRC_TAGS | IORING_FEAT_CQE_SKIP; if (copy_to_user(params, p, sizeof(*p))) { ret = -EFAULT; @@ -10797,6 +10777,8 @@ __u32 tmp; int err; + if (up->resv) + return -EINVAL; if (check_add_overflow(up->offset, nr_args, &tmp)) return -EOVERFLOW; err = io_rsrc_node_switch_start(ctx); @@ -10822,8 +10804,6 @@ memset(&up, 0, sizeof(up)); if (copy_from_user(&up, arg, sizeof(struct io_uring_rsrc_update))) return -EFAULT; - if (up.resv || up.resv2) - return -EINVAL; return __io_register_rsrc_update(ctx, IORING_RSRC_FILE, &up, nr_args); } @@ -10836,7 +10816,7 @@ return -EINVAL; if (copy_from_user(&up, arg, sizeof(up))) return -EFAULT; - if (!up.nr || up.resv || up.resv2) + if (!up.nr || up.resv) return -EINVAL; return __io_register_rsrc_update(ctx, type, &up, up.nr); } reverted: --- linux-oem-5.17-5.17.0/fs/jbd2/commit.c +++ linux-oem-5.17-5.17.0.orig/fs/jbd2/commit.c @@ -488,6 +488,7 @@ jbd2_journal_wait_updates(journal); commit_transaction->t_state = T_SWITCH; + write_unlock(&journal->j_state_lock); J_ASSERT (atomic_read(&commit_transaction->t_outstanding_credits) <= journal->j_max_transaction_buffers); @@ -507,8 +508,6 @@ * has reserved. This is consistent with the existing behaviour * that multiple jbd2_journal_get_write_access() calls to the same * buffer are perfectly permissible. - * We use journal->j_state_lock here to serialize processing of - * t_reserved_list with eviction of buffers from journal_unmap_buffer(). */ while (commit_transaction->t_reserved_list) { jh = commit_transaction->t_reserved_list; @@ -528,7 +527,6 @@ jbd2_journal_refile_buffer(journal, jh); } - write_unlock(&journal->j_state_lock); /* * Now try to drop any written-back buffers from the journal's * checkpoint lists. We do this *before* commit because it potentially reverted: --- linux-oem-5.17-5.17.0/fs/kernfs/dir.c +++ linux-oem-5.17-5.17.0.orig/fs/kernfs/dir.c @@ -1397,12 +1397,7 @@ */ void kernfs_remove(struct kernfs_node *kn) { + struct kernfs_root *root = kernfs_root(kn); - struct kernfs_root *root; - - if (!kn) - return; - - root = kernfs_root(kn); down_write(&root->kernfs_rwsem); __kernfs_remove(kn); reverted: --- linux-oem-5.17-5.17.0/fs/ksmbd/smb2pdu.c +++ linux-oem-5.17-5.17.0.orig/fs/ksmbd/smb2pdu.c @@ -11,7 +11,6 @@ #include #include #include -#include #include "glob.h" #include "smbfsctl.h" @@ -5006,17 +5005,15 @@ case FS_SECTOR_SIZE_INFORMATION: { struct smb3_fs_ss_info *info; - unsigned int sector_size = - min_t(unsigned int, path.mnt->mnt_sb->s_blocksize, 4096); info = (struct smb3_fs_ss_info *)(rsp->Buffer); + info->LogicalBytesPerSector = cpu_to_le32(stfs.f_bsize); - info->LogicalBytesPerSector = cpu_to_le32(sector_size); info->PhysicalBytesPerSectorForAtomicity = + cpu_to_le32(stfs.f_bsize); + info->PhysicalBytesPerSectorForPerf = cpu_to_le32(stfs.f_bsize); - cpu_to_le32(sector_size); - info->PhysicalBytesPerSectorForPerf = cpu_to_le32(sector_size); info->FSEffPhysicalBytesPerSectorForAtomicity = + cpu_to_le32(stfs.f_bsize); - cpu_to_le32(sector_size); info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE | SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE); info->ByteOffsetForSectorAlignment = 0; @@ -5774,10 +5771,8 @@ if (parent_fp) { if (parent_fp->daccess & FILE_DELETE_LE) { pr_err("parent dir is opened with delete access\n"); - ksmbd_fd_put(work, parent_fp); return -ESHARE; } - ksmbd_fd_put(work, parent_fp); } next: return smb2_rename(work, fp, user_ns, rename_info, reverted: --- linux-oem-5.17-5.17.0/fs/ksmbd/vfs_cache.c +++ linux-oem-5.17-5.17.0.orig/fs/ksmbd/vfs_cache.c @@ -497,7 +497,6 @@ list_for_each_entry(lfp, &ci->m_fp_list, node) { if (inode == file_inode(lfp->filp)) { atomic_dec(&ci->m_count); - lfp = ksmbd_fp_get(lfp); read_unlock(&ci->m_lock); return lfp; } diff -u linux-oem-5.17-5.17.0/fs/namei.c linux-oem-5.17-5.17.0/fs/namei.c --- linux-oem-5.17-5.17.0/fs/namei.c +++ linux-oem-5.17-5.17.0/fs/namei.c @@ -3673,14 +3673,18 @@ { struct dentry *dentry = ERR_PTR(-EEXIST); struct qstr last; - bool want_dir = lookup_flags & LOOKUP_DIRECTORY; - unsigned int reval_flag = lookup_flags & LOOKUP_REVAL; - unsigned int create_flags = LOOKUP_CREATE | LOOKUP_EXCL; int type; int err2; int error; + bool is_dir = (lookup_flags & LOOKUP_DIRECTORY); - error = filename_parentat(dfd, name, reval_flag, path, &last, &type); + /* + * Note that only LOOKUP_REVAL and LOOKUP_DIRECTORY matter here. Any + * other flags passed in are ignored! + */ + lookup_flags &= LOOKUP_REVAL; + + error = filename_parentat(dfd, name, lookup_flags, path, &last, &type); if (error) return ERR_PTR(error); @@ -3694,13 +3698,11 @@ /* don't fail immediately if it's r/o, at least try to report other errors */ err2 = mnt_want_write(path->mnt); /* - * Do the final lookup. Suppress 'create' if there is a trailing - * '/', and a directory wasn't requested. + * Do the final lookup. */ - if (last.name[last.len] && !want_dir) - create_flags = 0; + lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL; inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); - dentry = __lookup_hash(&last, path->dentry, reval_flag | create_flags); + dentry = __lookup_hash(&last, path->dentry, lookup_flags); if (IS_ERR(dentry)) goto unlock; @@ -3714,7 +3716,7 @@ * all is fine. Let's be bastards - you had / on the end, you've * been asking for (non-existent) directory. -ENOENT for you. */ - if (unlikely(!create_flags)) { + if (unlikely(!is_dir && last.name[last.len])) { error = -ENOENT; goto fail; } diff -u linux-oem-5.17-5.17.0/fs/nfs/nfs4proc.c linux-oem-5.17-5.17.0/fs/nfs/nfs4proc.c --- linux-oem-5.17-5.17.0/fs/nfs/nfs4proc.c +++ linux-oem-5.17-5.17.0/fs/nfs/nfs4proc.c @@ -367,14 +367,6 @@ kunmap_atomic(start); } -static void nfs4_fattr_set_prechange(struct nfs_fattr *fattr, u64 version) -{ - if (!(fattr->valid & NFS_ATTR_FATTR_PRECHANGE)) { - fattr->pre_change_attr = version; - fattr->valid |= NFS_ATTR_FATTR_PRECHANGE; - } -} - static void nfs4_test_and_free_stateid(struct nfs_server *server, nfs4_stateid *stateid, const struct cred *cred) @@ -6568,9 +6560,7 @@ pnfs_roc_release(&data->lr.arg, &data->lr.res, data->res.lr_ret); if (inode) { - nfs4_fattr_set_prechange(&data->fattr, - inode_peek_iversion_raw(inode)); - nfs_refresh_inode(inode, &data->fattr); + nfs_post_op_update_inode_force_wcc(inode, &data->fattr); nfs_iput_and_deactive(inode); } kfree(calldata); diff -u linux-oem-5.17-5.17.0/fs/nfsd/filecache.c linux-oem-5.17-5.17.0/fs/nfsd/filecache.c --- linux-oem-5.17-5.17.0/fs/nfsd/filecache.c +++ linux-oem-5.17-5.17.0/fs/nfsd/filecache.c @@ -236,13 +236,6 @@ } static void -nfsd_file_flush(struct nfsd_file *nf) -{ - if (nf->nf_file && vfs_fsync(nf->nf_file, 1) != 0) - nfsd_reset_write_verifier(net_generic(nf->nf_net, nfsd_net_id)); -} - -static void nfsd_file_do_unhash(struct nfsd_file *nf) { lockdep_assert_held(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); @@ -309,14 +302,11 @@ return; } + filemap_flush(nf->nf_file->f_mapping); is_hashed = test_bit(NFSD_FILE_HASHED, &nf->nf_flags) != 0; - if (!is_hashed) { - nfsd_file_flush(nf); - nfsd_file_put_noref(nf); - } else { - nfsd_file_put_noref(nf); + nfsd_file_put_noref(nf); + if (is_hashed) nfsd_file_schedule_laundrette(); - } if (atomic_long_read(&nfsd_filecache_count) >= NFSD_FILE_LRU_LIMIT) nfsd_file_gc(); } @@ -337,7 +327,6 @@ while(!list_empty(dispose)) { nf = list_first_entry(dispose, struct nfsd_file, nf_lru); list_del(&nf->nf_lru); - nfsd_file_flush(nf); nfsd_file_put_noref(nf); } } @@ -351,7 +340,6 @@ while(!list_empty(dispose)) { nf = list_first_entry(dispose, struct nfsd_file, nf_lru); list_del(&nf->nf_lru); - nfsd_file_flush(nf); if (!refcount_dec_and_test(&nf->nf_ref)) continue; if (nfsd_file_free(nf)) reverted: --- linux-oem-5.17-5.17.0/fs/posix_acl.c +++ linux-oem-5.17-5.17.0.orig/fs/posix_acl.c @@ -759,14 +759,9 @@ } void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size) { struct user_namespace *user_ns = current_user_ns(); - - /* Leave ids untouched on non-idmapped mounts. */ - if (no_idmapping(mnt_userns, i_user_ns(inode))) - mnt_userns = &init_user_ns; if ((user_ns == &init_user_ns) && (mnt_userns == &init_user_ns)) return; posix_acl_fix_xattr_userns(&init_user_ns, user_ns, mnt_userns, value, @@ -774,14 +769,9 @@ } void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size) { struct user_namespace *user_ns = current_user_ns(); - - /* Leave ids untouched on non-idmapped mounts. */ - if (no_idmapping(mnt_userns, i_user_ns(inode))) - mnt_userns = &init_user_ns; if ((user_ns == &init_user_ns) && (mnt_userns == &init_user_ns)) return; posix_acl_fix_xattr_userns(user_ns, &init_user_ns, mnt_userns, value, reverted: --- linux-oem-5.17-5.17.0/fs/stat.c +++ linux-oem-5.17-5.17.0.orig/fs/stat.c @@ -334,6 +334,9 @@ # define choose_32_64(a,b) b #endif +#define valid_dev(x) choose_32_64(old_valid_dev(x),true) +#define encode_dev(x) choose_32_64(old_encode_dev,new_encode_dev)(x) + #ifndef INIT_STRUCT_STAT_PADDING # define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st)) #endif @@ -342,9 +345,7 @@ { struct stat tmp; + if (!valid_dev(stat->dev) || !valid_dev(stat->rdev)) - if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev)) - return -EOVERFLOW; - if (sizeof(tmp.st_rdev) < 4 && !old_valid_dev(stat->rdev)) return -EOVERFLOW; #if BITS_PER_LONG == 32 if (stat->size > MAX_NON_LFS) @@ -352,7 +353,7 @@ #endif INIT_STRUCT_STAT_PADDING(tmp); + tmp.st_dev = encode_dev(stat->dev); - tmp.st_dev = new_encode_dev(stat->dev); tmp.st_ino = stat->ino; if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) return -EOVERFLOW; @@ -362,7 +363,7 @@ return -EOVERFLOW; SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid)); SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid)); + tmp.st_rdev = encode_dev(stat->rdev); - tmp.st_rdev = new_encode_dev(stat->rdev); tmp.st_size = stat->size; tmp.st_atime = stat->atime.tv_sec; tmp.st_mtime = stat->mtime.tv_sec; @@ -643,13 +644,11 @@ { struct compat_stat tmp; + if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) - if (sizeof(tmp.st_dev) < 4 && !old_valid_dev(stat->dev)) - return -EOVERFLOW; - if (sizeof(tmp.st_rdev) < 4 && !old_valid_dev(stat->rdev)) return -EOVERFLOW; memset(&tmp, 0, sizeof(tmp)); + tmp.st_dev = old_encode_dev(stat->dev); - tmp.st_dev = new_encode_dev(stat->dev); tmp.st_ino = stat->ino; if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) return -EOVERFLOW; @@ -659,7 +658,7 @@ return -EOVERFLOW; SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid)); SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid)); + tmp.st_rdev = old_encode_dev(stat->rdev); - tmp.st_rdev = new_encode_dev(stat->rdev); if ((u64) stat->size > MAX_NON_LFS) return -EOVERFLOW; tmp.st_size = stat->size; diff -u linux-oem-5.17-5.17.0/fs/xattr.c linux-oem-5.17-5.17.0/fs/xattr.c --- linux-oem-5.17-5.17.0/fs/xattr.c +++ linux-oem-5.17-5.17.0/fs/xattr.c @@ -593,8 +593,7 @@ } if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) || (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0)) - posix_acl_fix_xattr_from_user(mnt_userns, d_inode(d), - kvalue, size); + posix_acl_fix_xattr_from_user(mnt_userns, kvalue, size); } error = vfs_setxattr(mnt_userns, d, kname, kvalue, size, flags); @@ -692,8 +691,7 @@ if (error > 0) { if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) || (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0)) - posix_acl_fix_xattr_to_user(mnt_userns, d_inode(d), - kvalue, error); + posix_acl_fix_xattr_to_user(mnt_userns, kvalue, error); if (size && copy_to_user(value, kvalue, error)) error = -EFAULT; } else if (error == -ERANGE && size >= XATTR_SIZE_MAX) { reverted: --- linux-oem-5.17-5.17.0/fs/zonefs/super.c +++ linux-oem-5.17-5.17.0.orig/fs/zonefs/super.c @@ -35,17 +35,6 @@ lockdep_assert_held(&zi->i_truncate_mutex); - /* - * With ZNS drives, closing an explicitly open zone that has not been - * written will change the zone state to "closed", that is, the zone - * will remain active. Since this can then cause failure of explicit - * open operation on other zones if the drive active zone resources - * are exceeded, make sure that the zone does not remain active by - * resetting it. - */ - if (op == REQ_OP_ZONE_CLOSE && !zi->i_wpoffset) - op = REQ_OP_ZONE_RESET; - trace_zonefs_zone_mgmt(inode, op); ret = blkdev_zone_mgmt(inode->i_sb->s_bdev, op, zi->i_zsector, zi->i_zone_size >> SECTOR_SHIFT, GFP_NOFS); @@ -1155,7 +1144,6 @@ inode_init_once(&zi->i_vnode); mutex_init(&zi->i_truncate_mutex); zi->i_wr_refcnt = 0; - zi->i_flags = 0; return &zi->i_vnode; } @@ -1307,13 +1295,12 @@ inc_nlink(parent); } +static void zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, + enum zonefs_ztype type) -static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, - enum zonefs_ztype type) { struct super_block *sb = inode->i_sb; struct zonefs_sb_info *sbi = ZONEFS_SB(sb); struct zonefs_inode_info *zi = ZONEFS_I(inode); - int ret = 0; inode->i_ino = zone->start >> sbi->s_zone_sectors_shift; inode->i_mode = S_IFREG | sbi->s_perm; @@ -1338,22 +1325,6 @@ sb->s_maxbytes = max(zi->i_max_size, sb->s_maxbytes); sbi->s_blocks += zi->i_max_size >> sb->s_blocksize_bits; sbi->s_used_blocks += zi->i_wpoffset >> sb->s_blocksize_bits; - - /* - * For sequential zones, make sure that any open zone is closed first - * to ensure that the initial number of open zones is 0, in sync with - * the open zone accounting done when the mount option - * ZONEFS_MNTOPT_EXPLICIT_OPEN is used. - */ - if (type == ZONEFS_ZTYPE_SEQ && - (zone->cond == BLK_ZONE_COND_IMP_OPEN || - zone->cond == BLK_ZONE_COND_EXP_OPEN)) { - mutex_lock(&zi->i_truncate_mutex); - ret = zonefs_zone_mgmt(inode, REQ_OP_ZONE_CLOSE); - mutex_unlock(&zi->i_truncate_mutex); - } - - return ret; } static struct dentry *zonefs_create_inode(struct dentry *parent, @@ -1363,7 +1334,6 @@ struct inode *dir = d_inode(parent); struct dentry *dentry; struct inode *inode; - int ret; dentry = d_alloc_name(parent, name); if (!dentry) @@ -1374,16 +1344,10 @@ goto dput; inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime; + if (zone) + zonefs_init_file_inode(inode, zone, type); + else - if (zone) { - ret = zonefs_init_file_inode(inode, zone, type); - if (ret) { - iput(inode); - goto dput; - } - } else { zonefs_init_dir_inode(dir, inode, type); - } - d_add(dentry, inode); dir->i_size++; reverted: --- linux-oem-5.17-5.17.0/include/asm-generic/mshyperv.h +++ linux-oem-5.17-5.17.0.orig/include/asm-generic/mshyperv.h @@ -269,7 +269,6 @@ u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size); void hyperv_cleanup(void); bool hv_query_ext_cap(u64 cap_query); -void hv_setup_dma_ops(struct device *dev, bool coherent); void *hv_map_memory(void *addr, unsigned long size); void hv_unmap_memory(void *addr); #else /* CONFIG_HYPERV */ reverted: --- linux-oem-5.17-5.17.0/include/asm-generic/tlb.h +++ linux-oem-5.17-5.17.0.orig/include/asm-generic/tlb.h @@ -565,14 +565,10 @@ #define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \ do { \ unsigned long _sz = huge_page_size(h); \ + if (_sz == PMD_SIZE) \ + tlb_flush_pmd_range(tlb, address, _sz); \ + else if (_sz == PUD_SIZE) \ - if (_sz >= P4D_SIZE) \ - tlb_flush_p4d_range(tlb, address, _sz); \ - else if (_sz >= PUD_SIZE) \ tlb_flush_pud_range(tlb, address, _sz); \ - else if (_sz >= PMD_SIZE) \ - tlb_flush_pmd_range(tlb, address, _sz); \ - else \ - tlb_flush_pte_range(tlb, address, _sz); \ __tlb_remove_tlb_entry(tlb, ptep, address); \ } while (0) reverted: --- linux-oem-5.17-5.17.0/include/linux/etherdevice.h +++ linux-oem-5.17-5.17.0.orig/include/linux/etherdevice.h @@ -134,7 +134,7 @@ #endif } +static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2]) -static inline bool is_multicast_ether_addr_64bits(const u8 *addr) { #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 #ifdef __BIG_ENDIAN @@ -372,7 +372,8 @@ * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits. */ +static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], + const u8 addr2[6+2]) -static inline bool ether_addr_equal_64bits(const u8 *addr1, const u8 *addr2) { #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2); reverted: --- linux-oem-5.17-5.17.0/include/linux/kernel.h +++ linux-oem-5.17-5.17.0.orig/include/linux/kernel.h @@ -280,7 +280,7 @@ return buf; } +extern int hex_to_bin(char ch); -extern int hex_to_bin(unsigned char ch); extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); extern char *bin2hex(char *dst, const void *src, size_t count); reverted: --- linux-oem-5.17-5.17.0/include/linux/kfence.h +++ linux-oem-5.17-5.17.0.orig/include/linux/kfence.h @@ -204,22 +204,6 @@ */ bool __must_check kfence_handle_page_fault(unsigned long addr, bool is_write, struct pt_regs *regs); -#ifdef CONFIG_PRINTK -struct kmem_obj_info; -/** - * __kfence_obj_info() - fill kmem_obj_info struct - * @kpp: kmem_obj_info to be filled - * @object: the object - * - * Return: - * * false - not a KFENCE object - * * true - a KFENCE object, filled @kpp - * - * Copies information to @kpp for KFENCE objects. - */ -bool __kfence_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab); -#endif - #else /* CONFIG_KFENCE */ static inline bool is_kfence_address(const void *addr) { return false; } @@ -237,14 +221,6 @@ return false; } -#ifdef CONFIG_PRINTK -struct kmem_obj_info; -static inline bool __kfence_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) -{ - return false; -} -#endif - #endif #endif /* _LINUX_KFENCE_H */ reverted: --- linux-oem-5.17-5.17.0/include/linux/memcontrol.h +++ linux-oem-5.17-5.17.0.orig/include/linux/memcontrol.h @@ -999,7 +999,6 @@ } void mem_cgroup_flush_stats(void); -void mem_cgroup_flush_stats_delayed(void); void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val); @@ -1443,10 +1442,6 @@ { } -static inline void mem_cgroup_flush_stats_delayed(void) -{ -} - static inline void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val) { reverted: --- linux-oem-5.17-5.17.0/include/linux/mtd/mtd.h +++ linux-oem-5.17-5.17.0.orig/include/linux/mtd/mtd.h @@ -392,8 +392,10 @@ /* List of partitions attached to this MTD device */ struct list_head partitions; + union { + struct mtd_part part; + struct mtd_master master; + }; - struct mtd_part part; - struct mtd_master master; }; static inline struct mtd_info *mtd_get_master(struct mtd_info *mtd) reverted: --- linux-oem-5.17-5.17.0/include/linux/posix_acl_xattr.h +++ linux-oem-5.17-5.17.0.orig/include/linux/posix_acl_xattr.h @@ -34,19 +34,15 @@ #ifdef CONFIG_FS_POSIX_ACL void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size); void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size); #else static inline void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size) { } static inline void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns, - struct inode *inode, void *value, size_t size) { } diff -u linux-oem-5.17-5.17.0/include/linux/sched.h linux-oem-5.17-5.17.0/include/linux/sched.h --- linux-oem-5.17-5.17.0/include/linux/sched.h +++ linux-oem-5.17-5.17.0/include/linux/sched.h @@ -1440,7 +1440,6 @@ int pagefault_disabled; #ifdef CONFIG_MMU struct task_struct *oom_reaper_list; - struct timer_list oom_reaper_timer; #endif #ifdef CONFIG_VMAP_STACK struct vm_struct *stack_vm_area; reverted: --- linux-oem-5.17-5.17.0/include/linux/sched/mm.h +++ linux-oem-5.17-5.17.0.orig/include/linux/sched/mm.h @@ -135,14 +135,6 @@ #endif /* CONFIG_MEMCG */ #ifdef CONFIG_MMU -#ifndef arch_get_mmap_end -#define arch_get_mmap_end(addr) (TASK_SIZE) -#endif - -#ifndef arch_get_mmap_base -#define arch_get_mmap_base(addr, base) (base) -#endif - extern void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack); extern unsigned long diff -u linux-oem-5.17-5.17.0/include/linux/static_call.h linux-oem-5.17-5.17.0/include/linux/static_call.h --- linux-oem-5.17-5.17.0/include/linux/static_call.h +++ linux-oem-5.17-5.17.0/include/linux/static_call.h @@ -196,14 +196,6 @@ }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) -#define DEFINE_STATIC_CALL_RET0(name, _func) \ - DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ - .func = __static_call_return0, \ - .type = 1, \ - }; \ - ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) - #define static_call_cond(name) (void)__static_call(name) #define EXPORT_STATIC_CALL(name) \ @@ -239,12 +231,6 @@ }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) -#define DEFINE_STATIC_CALL_RET0(name, _func) \ - DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ - .func = __static_call_return0, \ - }; \ - ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) #define static_call_cond(name) (void)__static_call(name) @@ -298,9 +284,6 @@ .func = NULL, \ } -#define DEFINE_STATIC_CALL_RET0(name, _func) \ - __DEFINE_STATIC_CALL(name, _func, __static_call_return0) - static inline void __static_call_nop(void) { } /* @@ -346,2 +329,5 @@ +#define DEFINE_STATIC_CALL_RET0(name, _func) \ + __DEFINE_STATIC_CALL(name, _func, __static_call_return0) + #endif /* _LINUX_STATIC_CALL_H */ reverted: --- linux-oem-5.17-5.17.0/include/linux/stmmac.h +++ linux-oem-5.17-5.17.0.orig/include/linux/stmmac.h @@ -270,6 +270,5 @@ int msi_rx_base_vec; int msi_tx_base_vec; bool use_phy_wol; - bool sph_disable; }; #endif reverted: --- linux-oem-5.17-5.17.0/include/linux/sunrpc/svc.h +++ linux-oem-5.17-5.17.0.orig/include/linux/sunrpc/svc.h @@ -412,7 +412,6 @@ size_t addrlen; struct sockaddr_storage daddr; /* where reply must come from */ size_t daddrlen; - void *xprt_ctxt; struct cache_deferred_req handle; size_t xprt_hlen; int argslen; diff -u linux-oem-5.17-5.17.0/include/linux/vfio_pci_core.h linux-oem-5.17-5.17.0/include/linux/vfio_pci_core.h --- linux-oem-5.17-5.17.0/include/linux/vfio_pci_core.h +++ linux-oem-5.17-5.17.0/include/linux/vfio_pci_core.h @@ -133,8 +133,6 @@ struct mutex ioeventfds_lock; struct list_head ioeventfds_list; struct vfio_pci_vf_token *vf_token; - struct list_head sriov_pfs_item; - struct vfio_pci_core_device *sriov_pf_core_dev; struct notifier_block nb; struct mutex vma_lock; struct list_head vma_list; reverted: --- linux-oem-5.17-5.17.0/include/memory/renesas-rpc-if.h +++ linux-oem-5.17-5.17.0.orig/include/memory/renesas-rpc-if.h @@ -72,7 +72,6 @@ enum rpcif_type type; enum rpcif_data_dir dir; u8 bus_size; - u8 xfer_size; void *buffer; u32 xferlen; u32 smcr; diff -u linux-oem-5.17-5.17.0/include/net/bluetooth/hci.h linux-oem-5.17-5.17.0/include/net/bluetooth/hci.h --- linux-oem-5.17-5.17.0/include/net/bluetooth/hci.h +++ linux-oem-5.17-5.17.0/include/net/bluetooth/hci.h @@ -578,7 +578,6 @@ #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 #define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d #define HCI_ERROR_REJ_BAD_ADDR 0x0f -#define HCI_ERROR_INVALID_PARAMETERS 0x12 #define HCI_ERROR_REMOTE_USER_TERM 0x13 #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 #define HCI_ERROR_REMOTE_POWER_OFF 0x15 reverted: --- linux-oem-5.17-5.17.0/include/net/esp.h +++ linux-oem-5.17-5.17.0.orig/include/net/esp.h @@ -4,6 +4,8 @@ #include +#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER) + struct ip_esp_hdr; static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) reverted: --- linux-oem-5.17-5.17.0/include/net/flow_dissector.h +++ linux-oem-5.17-5.17.0.orig/include/net/flow_dissector.h @@ -59,8 +59,6 @@ __be16 vlan_tci; }; __be16 vlan_tpid; - __be16 vlan_eth_type; - u16 padding; }; struct flow_dissector_mpls_lse { reverted: --- linux-oem-5.17-5.17.0/include/net/ip6_tunnel.h +++ linux-oem-5.17-5.17.0.orig/include/net/ip6_tunnel.h @@ -58,7 +58,7 @@ /* These fields used only by GRE */ __u32 i_seqno; /* The last seen seqno */ + __u32 o_seqno; /* The last output seqno */ - atomic_t o_seqno; /* The last output seqno */ int hlen; /* tun_hlen + encap_hlen */ int tun_hlen; /* Precalculated header length */ int encap_hlen; /* Encap header length (FOU,GUE) */ diff -u linux-oem-5.17-5.17.0/include/net/ip_tunnels.h linux-oem-5.17-5.17.0/include/net/ip_tunnels.h --- linux-oem-5.17-5.17.0/include/net/ip_tunnels.h +++ linux-oem-5.17-5.17.0/include/net/ip_tunnels.h @@ -138,7 +138,7 @@ /* These four fields used only by GRE */ u32 i_seqno; /* The last seen seqno */ - atomic_t o_seqno; /* The last output seqno */ + u32 o_seqno; /* The last output seqno */ int tun_hlen; /* Precalculated header length */ /* These four fields used only by ERSPAN */ reverted: --- linux-oem-5.17-5.17.0/include/net/netns/ipv6.h +++ linux-oem-5.17-5.17.0.orig/include/net/netns/ipv6.h @@ -75,8 +75,8 @@ struct list_head fib6_walkers; rwlock_t fib6_walker_lock; spinlock_t fib6_gc_lock; + unsigned int ip6_rt_gc_expire; + unsigned long ip6_rt_last_gc; - atomic_t ip6_rt_gc_expire; - unsigned long ip6_rt_last_gc; unsigned char flowlabel_has_excl; #ifdef CONFIG_IPV6_MULTIPLE_TABLES bool fib6_has_custom_rules; reverted: --- linux-oem-5.17-5.17.0/include/net/tcp.h +++ linux-oem-5.17-5.17.0.orig/include/net/tcp.h @@ -480,7 +480,6 @@ u32 cookie); struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb); struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops, - const struct tcp_request_sock_ops *af_ops, struct sock *sk, struct sk_buff *skb); #ifdef CONFIG_SYN_COOKIES @@ -621,7 +620,6 @@ void tcp_reset(struct sock *sk, struct sk_buff *skb); void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); void tcp_fin(struct sock *sk); -void tcp_check_space(struct sock *sk); /* tcp_timer.c */ void tcp_init_xmit_timers(struct sock *); @@ -1044,7 +1042,6 @@ int losses; /* number of packets marked lost upon ACK */ u32 acked_sacked; /* number of packets newly (S)ACKed upon ACK */ u32 prior_in_flight; /* in flight before this ACK */ - u32 last_end_seq; /* end_seq of most recently ACKed packet */ bool is_app_limited; /* is sample from packet with bubble in pipe? */ bool is_retrans; /* is sample from retransmission? */ bool is_ack_delayed; /* is this (likely) a delayed ACK? */ @@ -1167,11 +1164,6 @@ bool is_sack_reneg, struct rate_sample *rs); void tcp_rate_check_app_limited(struct sock *sk); -static inline bool tcp_skb_sent_after(u64 t1, u64 t2, u32 seq1, u32 seq2) -{ - return t1 > t2 || (t1 == t2 && after(seq1, seq2)); -} - /* These functions determine how the current flow behaves in respect of SACK * handling. SACK is negotiated with the peer, and therefore it can vary * between different flows. reverted: --- linux-oem-5.17-5.17.0/include/scsi/libiscsi.h +++ linux-oem-5.17-5.17.0.orig/include/scsi/libiscsi.h @@ -52,10 +52,8 @@ #define ISID_SIZE 6 +/* Connection suspend "bit" */ +#define ISCSI_SUSPEND_BIT 1 -/* Connection flags */ -#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0) -#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1) -#define ISCSI_CONN_FLAG_BOUND BIT(2) #define ISCSI_ITT_MASK 0x1fff #define ISCSI_TOTAL_CMDS_MAX 4096 @@ -201,7 +199,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 */ + unsigned long suspend_tx; /* suspend Tx */ + unsigned long suspend_rx; /* suspend Rx */ - unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ reverted: --- linux-oem-5.17-5.17.0/include/scsi/scsi_transport_iscsi.h +++ linux-oem-5.17-5.17.0.orig/include/scsi/scsi_transport_iscsi.h @@ -211,8 +211,6 @@ struct mutex ep_mutex; struct iscsi_endpoint *ep; - /* Used when accessing flags and queueing work. */ - spinlock_t lock; unsigned long flags; struct work_struct cleanup_work; @@ -296,7 +294,7 @@ struct iscsi_endpoint { void *dd_data; /* LLD private data */ struct device dev; + uint64_t id; - int id; struct iscsi_cls_conn *conn; }; reverted: --- linux-oem-5.17-5.17.0/include/sound/core.h +++ linux-oem-5.17-5.17.0.orig/include/sound/core.h @@ -284,7 +284,6 @@ void snd_card_disconnect_sync(struct snd_card *card); int snd_card_free(struct snd_card *card); int snd_card_free_when_closed(struct snd_card *card); -int snd_card_free_on_error(struct device *dev, int ret); void snd_card_set_id(struct snd_card *card, const char *id); int snd_card_register(struct snd_card *card); int snd_card_info_init(void); reverted: --- linux-oem-5.17-5.17.0/include/sound/cs42l42.h +++ linux-oem-5.17-5.17.0.orig/include/sound/cs42l42.h @@ -1,810 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * linux/sound/cs42l42.h -- Platform data for CS42L42 ALSA SoC audio driver header - * - * Copyright 2016-2022 Cirrus Logic, Inc. - * - * Author: James Schulman - * Author: Brian Austin - * Author: Michael White - */ - -#ifndef __CS42L42_H -#define __CS42L42_H - -#define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */ -#define CS42L42_WIN_START 0x00 -#define CS42L42_WIN_LEN 0x100 -#define CS42L42_RANGE_MIN 0x00 -#define CS42L42_RANGE_MAX 0x7F - -#define CS42L42_PAGE_10 0x1000 -#define CS42L42_PAGE_11 0x1100 -#define CS42L42_PAGE_12 0x1200 -#define CS42L42_PAGE_13 0x1300 -#define CS42L42_PAGE_15 0x1500 -#define CS42L42_PAGE_19 0x1900 -#define CS42L42_PAGE_1B 0x1B00 -#define CS42L42_PAGE_1C 0x1C00 -#define CS42L42_PAGE_1D 0x1D00 -#define CS42L42_PAGE_1F 0x1F00 -#define CS42L42_PAGE_20 0x2000 -#define CS42L42_PAGE_21 0x2100 -#define CS42L42_PAGE_23 0x2300 -#define CS42L42_PAGE_24 0x2400 -#define CS42L42_PAGE_25 0x2500 -#define CS42L42_PAGE_26 0x2600 -#define CS42L42_PAGE_28 0x2800 -#define CS42L42_PAGE_29 0x2900 -#define CS42L42_PAGE_2A 0x2A00 -#define CS42L42_PAGE_30 0x3000 - -#define CS42L42_CHIP_ID 0x42A42 - -/* Page 0x10 Global Registers */ -#define CS42L42_DEVID_AB (CS42L42_PAGE_10 + 0x01) -#define CS42L42_DEVID_CD (CS42L42_PAGE_10 + 0x02) -#define CS42L42_DEVID_E (CS42L42_PAGE_10 + 0x03) -#define CS42L42_FABID (CS42L42_PAGE_10 + 0x04) -#define CS42L42_REVID (CS42L42_PAGE_10 + 0x05) -#define CS42L42_FRZ_CTL (CS42L42_PAGE_10 + 0x06) - -#define CS42L42_SRC_CTL (CS42L42_PAGE_10 + 0x07) -#define CS42L42_SRC_BYPASS_DAC_SHIFT 1 -#define CS42L42_SRC_BYPASS_DAC_MASK (1 << CS42L42_SRC_BYPASS_DAC_SHIFT) - -#define CS42L42_MCLK_STATUS (CS42L42_PAGE_10 + 0x08) - -#define CS42L42_MCLK_CTL (CS42L42_PAGE_10 + 0x09) -#define CS42L42_INTERNAL_FS_SHIFT 1 -#define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT) - -#define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A) -#define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B) -#define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4) -#define CS42L42_SLOW_START_EN_SHIFT 4 -#define CS42L42_I2C_DEBOUNCE (CS42L42_PAGE_10 + 0x0E) -#define CS42L42_I2C_STRETCH (CS42L42_PAGE_10 + 0x0F) -#define CS42L42_I2C_TIMEOUT (CS42L42_PAGE_10 + 0x10) - -/* Page 0x11 Power and Headset Detect Registers */ -#define CS42L42_PWR_CTL1 (CS42L42_PAGE_11 + 0x01) -#define CS42L42_ASP_DAO_PDN_SHIFT 7 -#define CS42L42_ASP_DAO_PDN_MASK (1 << CS42L42_ASP_DAO_PDN_SHIFT) -#define CS42L42_ASP_DAI_PDN_SHIFT 6 -#define CS42L42_ASP_DAI_PDN_MASK (1 << CS42L42_ASP_DAI_PDN_SHIFT) -#define CS42L42_MIXER_PDN_SHIFT 5 -#define CS42L42_MIXER_PDN_MASK (1 << CS42L42_MIXER_PDN_SHIFT) -#define CS42L42_EQ_PDN_SHIFT 4 -#define CS42L42_EQ_PDN_MASK (1 << CS42L42_EQ_PDN_SHIFT) -#define CS42L42_HP_PDN_SHIFT 3 -#define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) -#define CS42L42_ADC_PDN_SHIFT 2 -#define CS42L42_ADC_PDN_MASK (1 << CS42L42_ADC_PDN_SHIFT) -#define CS42L42_PDN_ALL_SHIFT 0 -#define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT) - -#define CS42L42_PWR_CTL2 (CS42L42_PAGE_11 + 0x02) -#define CS42L42_ADC_SRC_PDNB_SHIFT 0 -#define CS42L42_ADC_SRC_PDNB_MASK (1 << CS42L42_ADC_SRC_PDNB_SHIFT) -#define CS42L42_DAC_SRC_PDNB_SHIFT 1 -#define CS42L42_DAC_SRC_PDNB_MASK (1 << CS42L42_DAC_SRC_PDNB_SHIFT) -#define CS42L42_ASP_DAI1_PDN_SHIFT 2 -#define CS42L42_ASP_DAI1_PDN_MASK (1 << CS42L42_ASP_DAI1_PDN_SHIFT) -#define CS42L42_SRC_PDN_OVERRIDE_SHIFT 3 -#define CS42L42_SRC_PDN_OVERRIDE_MASK (1 << CS42L42_SRC_PDN_OVERRIDE_SHIFT) -#define CS42L42_DISCHARGE_FILT_SHIFT 4 -#define CS42L42_DISCHARGE_FILT_MASK (1 << CS42L42_DISCHARGE_FILT_SHIFT) - -#define CS42L42_PWR_CTL3 (CS42L42_PAGE_11 + 0x03) -#define CS42L42_RING_SENSE_PDNB_SHIFT 1 -#define CS42L42_RING_SENSE_PDNB_MASK (1 << CS42L42_RING_SENSE_PDNB_SHIFT) -#define CS42L42_VPMON_PDNB_SHIFT 2 -#define CS42L42_VPMON_PDNB_MASK (1 << CS42L42_VPMON_PDNB_SHIFT) -#define CS42L42_SW_CLK_STP_STAT_SEL_SHIFT 5 -#define CS42L42_SW_CLK_STP_STAT_SEL_MASK (3 << CS42L42_SW_CLK_STP_STAT_SEL_SHIFT) - -#define CS42L42_RSENSE_CTL1 (CS42L42_PAGE_11 + 0x04) -#define CS42L42_RS_TRIM_R_SHIFT 0 -#define CS42L42_RS_TRIM_R_MASK (1 << CS42L42_RS_TRIM_R_SHIFT) -#define CS42L42_RS_TRIM_T_SHIFT 1 -#define CS42L42_RS_TRIM_T_MASK (1 << CS42L42_RS_TRIM_T_SHIFT) -#define CS42L42_HPREF_RS_SHIFT 2 -#define CS42L42_HPREF_RS_MASK (1 << CS42L42_HPREF_RS_SHIFT) -#define CS42L42_HSBIAS_FILT_REF_RS_SHIFT 3 -#define CS42L42_HSBIAS_FILT_REF_RS_MASK (1 << CS42L42_HSBIAS_FILT_REF_RS_SHIFT) -#define CS42L42_RING_SENSE_PU_HIZ_SHIFT 6 -#define CS42L42_RING_SENSE_PU_HIZ_MASK (1 << CS42L42_RING_SENSE_PU_HIZ_SHIFT) - -#define CS42L42_RSENSE_CTL2 (CS42L42_PAGE_11 + 0x05) -#define CS42L42_TS_RS_GATE_SHIFT 7 -#define CS42L42_TS_RS_GATE_MAS (1 << CS42L42_TS_RS_GATE_SHIFT) - -#define CS42L42_OSC_SWITCH (CS42L42_PAGE_11 + 0x07) -#define CS42L42_SCLK_PRESENT_SHIFT 0 -#define CS42L42_SCLK_PRESENT_MASK (1 << CS42L42_SCLK_PRESENT_SHIFT) - -#define CS42L42_OSC_SWITCH_STATUS (CS42L42_PAGE_11 + 0x09) -#define CS42L42_OSC_SW_SEL_STAT_SHIFT 0 -#define CS42L42_OSC_SW_SEL_STAT_MASK (3 << CS42L42_OSC_SW_SEL_STAT_SHIFT) -#define CS42L42_OSC_PDNB_STAT_SHIFT 2 -#define CS42L42_OSC_PDNB_STAT_MASK (1 << CS42L42_OSC_SW_SEL_STAT_SHIFT) - -#define CS42L42_RSENSE_CTL3 (CS42L42_PAGE_11 + 0x12) -#define CS42L42_RS_RISE_DBNCE_TIME_SHIFT 0 -#define CS42L42_RS_RISE_DBNCE_TIME_MASK (7 << CS42L42_RS_RISE_DBNCE_TIME_SHIFT) -#define CS42L42_RS_FALL_DBNCE_TIME_SHIFT 3 -#define CS42L42_RS_FALL_DBNCE_TIME_MASK (7 << CS42L42_RS_FALL_DBNCE_TIME_SHIFT) -#define CS42L42_RS_PU_EN_SHIFT 6 -#define CS42L42_RS_PU_EN_MASK (1 << CS42L42_RS_PU_EN_SHIFT) -#define CS42L42_RS_INV_SHIFT 7 -#define CS42L42_RS_INV_MASK (1 << CS42L42_RS_INV_SHIFT) - -#define CS42L42_TSENSE_CTL (CS42L42_PAGE_11 + 0x13) -#define CS42L42_TS_RISE_DBNCE_TIME_SHIFT 0 -#define CS42L42_TS_RISE_DBNCE_TIME_MASK (7 << CS42L42_TS_RISE_DBNCE_TIME_SHIFT) -#define CS42L42_TS_FALL_DBNCE_TIME_SHIFT 3 -#define CS42L42_TS_FALL_DBNCE_TIME_MASK (7 << CS42L42_TS_FALL_DBNCE_TIME_SHIFT) -#define CS42L42_TS_INV_SHIFT 7 -#define CS42L42_TS_INV_MASK (1 << CS42L42_TS_INV_SHIFT) - -#define CS42L42_TSRS_INT_DISABLE (CS42L42_PAGE_11 + 0x14) -#define CS42L42_D_RS_PLUG_DBNC_SHIFT 0 -#define CS42L42_D_RS_PLUG_DBNC_MASK (1 << CS42L42_D_RS_PLUG_DBNC_SHIFT) -#define CS42L42_D_RS_UNPLUG_DBNC_SHIFT 1 -#define CS42L42_D_RS_UNPLUG_DBNC_MASK (1 << CS42L42_D_RS_UNPLUG_DBNC_SHIFT) -#define CS42L42_D_TS_PLUG_DBNC_SHIFT 2 -#define CS42L42_D_TS_PLUG_DBNC_MASK (1 << CS42L42_D_TS_PLUG_DBNC_SHIFT) -#define CS42L42_D_TS_UNPLUG_DBNC_SHIFT 3 -#define CS42L42_D_TS_UNPLUG_DBNC_MASK (1 << CS42L42_D_TS_UNPLUG_DBNC_SHIFT) - -#define CS42L42_TRSENSE_STATUS (CS42L42_PAGE_11 + 0x15) -#define CS42L42_RS_PLUG_DBNC_SHIFT 0 -#define CS42L42_RS_PLUG_DBNC_MASK (1 << CS42L42_RS_PLUG_DBNC_SHIFT) -#define CS42L42_RS_UNPLUG_DBNC_SHIFT 1 -#define CS42L42_RS_UNPLUG_DBNC_MASK (1 << CS42L42_RS_UNPLUG_DBNC_SHIFT) -#define CS42L42_TS_PLUG_DBNC_SHIFT 2 -#define CS42L42_TS_PLUG_DBNC_MASK (1 << CS42L42_TS_PLUG_DBNC_SHIFT) -#define CS42L42_TS_UNPLUG_DBNC_SHIFT 3 -#define CS42L42_TS_UNPLUG_DBNC_MASK (1 << CS42L42_TS_UNPLUG_DBNC_SHIFT) - -#define CS42L42_HSDET_CTL1 (CS42L42_PAGE_11 + 0x1F) -#define CS42L42_HSDET_COMP1_LVL_SHIFT 0 -#define CS42L42_HSDET_COMP1_LVL_MASK (15 << CS42L42_HSDET_COMP1_LVL_SHIFT) -#define CS42L42_HSDET_COMP2_LVL_SHIFT 4 -#define CS42L42_HSDET_COMP2_LVL_MASK (15 << CS42L42_HSDET_COMP2_LVL_SHIFT) - -#define CS42L42_HSDET_COMP1_LVL_VAL 12 /* 1.25V Comparator */ -#define CS42L42_HSDET_COMP2_LVL_VAL 2 /* 1.75V Comparator */ -#define CS42L42_HSDET_COMP1_LVL_DEFAULT 7 /* 1V Comparator */ -#define CS42L42_HSDET_COMP2_LVL_DEFAULT 7 /* 2V Comparator */ - -#define CS42L42_HSDET_CTL2 (CS42L42_PAGE_11 + 0x20) -#define CS42L42_HSDET_AUTO_TIME_SHIFT 0 -#define CS42L42_HSDET_AUTO_TIME_MASK (3 << CS42L42_HSDET_AUTO_TIME_SHIFT) -#define CS42L42_HSBIAS_REF_SHIFT 3 -#define CS42L42_HSBIAS_REF_MASK (1 << CS42L42_HSBIAS_REF_SHIFT) -#define CS42L42_HSDET_SET_SHIFT 4 -#define CS42L42_HSDET_SET_MASK (3 << CS42L42_HSDET_SET_SHIFT) -#define CS42L42_HSDET_CTRL_SHIFT 6 -#define CS42L42_HSDET_CTRL_MASK (3 << CS42L42_HSDET_CTRL_SHIFT) - -#define CS42L42_HS_SWITCH_CTL (CS42L42_PAGE_11 + 0x21) -#define CS42L42_SW_GNDHS_HS4_SHIFT 0 -#define CS42L42_SW_GNDHS_HS4_MASK (1 << CS42L42_SW_GNDHS_HS4_SHIFT) -#define CS42L42_SW_GNDHS_HS3_SHIFT 1 -#define CS42L42_SW_GNDHS_HS3_MASK (1 << CS42L42_SW_GNDHS_HS3_SHIFT) -#define CS42L42_SW_HSB_HS4_SHIFT 2 -#define CS42L42_SW_HSB_HS4_MASK (1 << CS42L42_SW_HSB_HS4_SHIFT) -#define CS42L42_SW_HSB_HS3_SHIFT 3 -#define CS42L42_SW_HSB_HS3_MASK (1 << CS42L42_SW_HSB_HS3_SHIFT) -#define CS42L42_SW_HSB_FILT_HS4_SHIFT 4 -#define CS42L42_SW_HSB_FILT_HS4_MASK (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) -#define CS42L42_SW_HSB_FILT_HS3_SHIFT 5 -#define CS42L42_SW_HSB_FILT_HS3_MASK (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) -#define CS42L42_SW_REF_HS4_SHIFT 6 -#define CS42L42_SW_REF_HS4_MASK (1 << CS42L42_SW_REF_HS4_SHIFT) -#define CS42L42_SW_REF_HS3_SHIFT 7 -#define CS42L42_SW_REF_HS3_MASK (1 << CS42L42_SW_REF_HS3_SHIFT) - -#define CS42L42_HS_DET_STATUS (CS42L42_PAGE_11 + 0x24) -#define CS42L42_HSDET_TYPE_SHIFT 0 -#define CS42L42_HSDET_TYPE_MASK (3 << CS42L42_HSDET_TYPE_SHIFT) -#define CS42L42_HSDET_COMP1_OUT_SHIFT 6 -#define CS42L42_HSDET_COMP1_OUT_MASK (1 << CS42L42_HSDET_COMP1_OUT_SHIFT) -#define CS42L42_HSDET_COMP2_OUT_SHIFT 7 -#define CS42L42_HSDET_COMP2_OUT_MASK (1 << CS42L42_HSDET_COMP2_OUT_SHIFT) -#define CS42L42_PLUG_CTIA 0 -#define CS42L42_PLUG_OMTP 1 -#define CS42L42_PLUG_HEADPHONE 2 -#define CS42L42_PLUG_INVALID 3 - -#define CS42L42_HSDET_SW_COMP1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (0 << CS42L42_SW_REF_HS4_SHIFT) | \ - (1 << CS42L42_SW_REF_HS3_SHIFT)) -#define CS42L42_HSDET_SW_COMP2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (1 << CS42L42_SW_REF_HS4_SHIFT) | \ - (0 << CS42L42_SW_REF_HS3_SHIFT)) -#define CS42L42_HSDET_SW_TYPE1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (0 << CS42L42_SW_REF_HS4_SHIFT) | \ - (1 << CS42L42_SW_REF_HS3_SHIFT)) -#define CS42L42_HSDET_SW_TYPE2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (1 << CS42L42_SW_REF_HS4_SHIFT) | \ - (0 << CS42L42_SW_REF_HS3_SHIFT)) -#define CS42L42_HSDET_SW_TYPE3 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (1 << CS42L42_SW_REF_HS4_SHIFT) | \ - (1 << CS42L42_SW_REF_HS3_SHIFT)) -#define CS42L42_HSDET_SW_TYPE4 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ - (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ - (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ - (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ - (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ - (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ - (0 << CS42L42_SW_REF_HS4_SHIFT) | \ - (1 << CS42L42_SW_REF_HS3_SHIFT)) - -#define CS42L42_HSDET_COMP_TYPE1 1 -#define CS42L42_HSDET_COMP_TYPE2 2 -#define CS42L42_HSDET_COMP_TYPE3 0 -#define CS42L42_HSDET_COMP_TYPE4 3 - -#define CS42L42_HS_CLAMP_DISABLE (CS42L42_PAGE_11 + 0x29) -#define CS42L42_HS_CLAMP_DISABLE_SHIFT 0 -#define CS42L42_HS_CLAMP_DISABLE_MASK (1 << CS42L42_HS_CLAMP_DISABLE_SHIFT) - -/* Page 0x12 Clocking Registers */ -#define CS42L42_MCLK_SRC_SEL (CS42L42_PAGE_12 + 0x01) -#define CS42L42_MCLKDIV_SHIFT 1 -#define CS42L42_MCLKDIV_MASK (1 << CS42L42_MCLKDIV_SHIFT) -#define CS42L42_MCLK_SRC_SEL_SHIFT 0 -#define CS42L42_MCLK_SRC_SEL_MASK (1 << CS42L42_MCLK_SRC_SEL_SHIFT) - -#define CS42L42_SPDIF_CLK_CFG (CS42L42_PAGE_12 + 0x02) -#define CS42L42_FSYNC_PW_LOWER (CS42L42_PAGE_12 + 0x03) - -#define CS42L42_FSYNC_PW_UPPER (CS42L42_PAGE_12 + 0x04) -#define CS42L42_FSYNC_PULSE_WIDTH_SHIFT 0 -#define CS42L42_FSYNC_PULSE_WIDTH_MASK (0xff << \ - CS42L42_FSYNC_PULSE_WIDTH_SHIFT) - -#define CS42L42_FSYNC_P_LOWER (CS42L42_PAGE_12 + 0x05) - -#define CS42L42_FSYNC_P_UPPER (CS42L42_PAGE_12 + 0x06) -#define CS42L42_FSYNC_PERIOD_SHIFT 0 -#define CS42L42_FSYNC_PERIOD_MASK (0xff << CS42L42_FSYNC_PERIOD_SHIFT) - -#define CS42L42_ASP_CLK_CFG (CS42L42_PAGE_12 + 0x07) -#define CS42L42_ASP_SCLK_EN_SHIFT 5 -#define CS42L42_ASP_SCLK_EN_MASK (1 << CS42L42_ASP_SCLK_EN_SHIFT) -#define CS42L42_ASP_MASTER_MODE 0x01 -#define CS42L42_ASP_SLAVE_MODE 0x00 -#define CS42L42_ASP_MODE_SHIFT 4 -#define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) -#define CS42L42_ASP_SCPOL_SHIFT 2 -#define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) -#define CS42L42_ASP_SCPOL_NOR 3 -#define CS42L42_ASP_LCPOL_SHIFT 0 -#define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) -#define CS42L42_ASP_LCPOL_INV 3 - -#define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) -#define CS42L42_ASP_STP_SHIFT 4 -#define CS42L42_ASP_STP_MASK (1 << CS42L42_ASP_STP_SHIFT) -#define CS42L42_ASP_5050_SHIFT 3 -#define CS42L42_ASP_5050_MASK (1 << CS42L42_ASP_5050_SHIFT) -#define CS42L42_ASP_FSD_SHIFT 0 -#define CS42L42_ASP_FSD_MASK (7 << CS42L42_ASP_FSD_SHIFT) -#define CS42L42_ASP_FSD_0_5 1 -#define CS42L42_ASP_FSD_1_0 2 -#define CS42L42_ASP_FSD_1_5 3 -#define CS42L42_ASP_FSD_2_0 4 - -#define CS42L42_FS_RATE_EN (CS42L42_PAGE_12 + 0x09) -#define CS42L42_FS_EN_SHIFT 0 -#define CS42L42_FS_EN_MASK (0xf << CS42L42_FS_EN_SHIFT) -#define CS42L42_FS_EN_IASRC_96K 0x1 -#define CS42L42_FS_EN_OASRC_96K 0x2 - -#define CS42L42_IN_ASRC_CLK (CS42L42_PAGE_12 + 0x0A) -#define CS42L42_CLK_IASRC_SEL_SHIFT 0 -#define CS42L42_CLK_IASRC_SEL_MASK (1 << CS42L42_CLK_IASRC_SEL_SHIFT) -#define CS42L42_CLK_IASRC_SEL_6 0 -#define CS42L42_CLK_IASRC_SEL_12 1 - -#define CS42L42_OUT_ASRC_CLK (CS42L42_PAGE_12 + 0x0B) -#define CS42L42_CLK_OASRC_SEL_SHIFT 0 -#define CS42L42_CLK_OASRC_SEL_MASK (1 << CS42L42_CLK_OASRC_SEL_SHIFT) -#define CS42L42_CLK_OASRC_SEL_12 1 - -#define CS42L42_PLL_DIV_CFG1 (CS42L42_PAGE_12 + 0x0C) -#define CS42L42_SCLK_PREDIV_SHIFT 0 -#define CS42L42_SCLK_PREDIV_MASK (3 << CS42L42_SCLK_PREDIV_SHIFT) - -/* Page 0x13 Interrupt Registers */ -/* Interrupts */ -#define CS42L42_ADC_OVFL_STATUS (CS42L42_PAGE_13 + 0x01) -#define CS42L42_MIXER_STATUS (CS42L42_PAGE_13 + 0x02) -#define CS42L42_SRC_STATUS (CS42L42_PAGE_13 + 0x03) -#define CS42L42_ASP_RX_STATUS (CS42L42_PAGE_13 + 0x04) -#define CS42L42_ASP_TX_STATUS (CS42L42_PAGE_13 + 0x05) -#define CS42L42_CODEC_STATUS (CS42L42_PAGE_13 + 0x08) -#define CS42L42_DET_INT_STATUS1 (CS42L42_PAGE_13 + 0x09) -#define CS42L42_DET_INT_STATUS2 (CS42L42_PAGE_13 + 0x0A) -#define CS42L42_SRCPL_INT_STATUS (CS42L42_PAGE_13 + 0x0B) -#define CS42L42_VPMON_STATUS (CS42L42_PAGE_13 + 0x0D) -#define CS42L42_PLL_LOCK_STATUS (CS42L42_PAGE_13 + 0x0E) -#define CS42L42_TSRS_PLUG_STATUS (CS42L42_PAGE_13 + 0x0F) -/* Masks */ -#define CS42L42_ADC_OVFL_INT_MASK (CS42L42_PAGE_13 + 0x16) -#define CS42L42_ADC_OVFL_SHIFT 0 -#define CS42L42_ADC_OVFL_MASK (1 << CS42L42_ADC_OVFL_SHIFT) -#define CS42L42_ADC_OVFL_VAL_MASK CS42L42_ADC_OVFL_MASK - -#define CS42L42_MIXER_INT_MASK (CS42L42_PAGE_13 + 0x17) -#define CS42L42_MIX_CHB_OVFL_SHIFT 0 -#define CS42L42_MIX_CHB_OVFL_MASK (1 << CS42L42_MIX_CHB_OVFL_SHIFT) -#define CS42L42_MIX_CHA_OVFL_SHIFT 1 -#define CS42L42_MIX_CHA_OVFL_MASK (1 << CS42L42_MIX_CHA_OVFL_SHIFT) -#define CS42L42_EQ_OVFL_SHIFT 2 -#define CS42L42_EQ_OVFL_MASK (1 << CS42L42_EQ_OVFL_SHIFT) -#define CS42L42_EQ_BIQUAD_OVFL_SHIFT 3 -#define CS42L42_EQ_BIQUAD_OVFL_MASK (1 << CS42L42_EQ_BIQUAD_OVFL_SHIFT) -#define CS42L42_MIXER_VAL_MASK (CS42L42_MIX_CHB_OVFL_MASK | \ - CS42L42_MIX_CHA_OVFL_MASK | \ - CS42L42_EQ_OVFL_MASK | \ - CS42L42_EQ_BIQUAD_OVFL_MASK) - -#define CS42L42_SRC_INT_MASK (CS42L42_PAGE_13 + 0x18) -#define CS42L42_SRC_ILK_SHIFT 0 -#define CS42L42_SRC_ILK_MASK (1 << CS42L42_SRC_ILK_SHIFT) -#define CS42L42_SRC_OLK_SHIFT 1 -#define CS42L42_SRC_OLK_MASK (1 << CS42L42_SRC_OLK_SHIFT) -#define CS42L42_SRC_IUNLK_SHIFT 2 -#define CS42L42_SRC_IUNLK_MASK (1 << CS42L42_SRC_IUNLK_SHIFT) -#define CS42L42_SRC_OUNLK_SHIFT 3 -#define CS42L42_SRC_OUNLK_MASK (1 << CS42L42_SRC_OUNLK_SHIFT) -#define CS42L42_SRC_VAL_MASK (CS42L42_SRC_ILK_MASK | \ - CS42L42_SRC_OLK_MASK | \ - CS42L42_SRC_IUNLK_MASK | \ - CS42L42_SRC_OUNLK_MASK) - -#define CS42L42_ASP_RX_INT_MASK (CS42L42_PAGE_13 + 0x19) -#define CS42L42_ASPRX_NOLRCK_SHIFT 0 -#define CS42L42_ASPRX_NOLRCK_MASK (1 << CS42L42_ASPRX_NOLRCK_SHIFT) -#define CS42L42_ASPRX_EARLY_SHIFT 1 -#define CS42L42_ASPRX_EARLY_MASK (1 << CS42L42_ASPRX_EARLY_SHIFT) -#define CS42L42_ASPRX_LATE_SHIFT 2 -#define CS42L42_ASPRX_LATE_MASK (1 << CS42L42_ASPRX_LATE_SHIFT) -#define CS42L42_ASPRX_ERROR_SHIFT 3 -#define CS42L42_ASPRX_ERROR_MASK (1 << CS42L42_ASPRX_ERROR_SHIFT) -#define CS42L42_ASPRX_OVLD_SHIFT 4 -#define CS42L42_ASPRX_OVLD_MASK (1 << CS42L42_ASPRX_OVLD_SHIFT) -#define CS42L42_ASP_RX_VAL_MASK (CS42L42_ASPRX_NOLRCK_MASK | \ - CS42L42_ASPRX_EARLY_MASK | \ - CS42L42_ASPRX_LATE_MASK | \ - CS42L42_ASPRX_ERROR_MASK | \ - CS42L42_ASPRX_OVLD_MASK) - -#define CS42L42_ASP_TX_INT_MASK (CS42L42_PAGE_13 + 0x1A) -#define CS42L42_ASPTX_NOLRCK_SHIFT 0 -#define CS42L42_ASPTX_NOLRCK_MASK (1 << CS42L42_ASPTX_NOLRCK_SHIFT) -#define CS42L42_ASPTX_EARLY_SHIFT 1 -#define CS42L42_ASPTX_EARLY_MASK (1 << CS42L42_ASPTX_EARLY_SHIFT) -#define CS42L42_ASPTX_LATE_SHIFT 2 -#define CS42L42_ASPTX_LATE_MASK (1 << CS42L42_ASPTX_LATE_SHIFT) -#define CS42L42_ASPTX_SMERROR_SHIFT 3 -#define CS42L42_ASPTX_SMERROR_MASK (1 << CS42L42_ASPTX_SMERROR_SHIFT) -#define CS42L42_ASP_TX_VAL_MASK (CS42L42_ASPTX_NOLRCK_MASK | \ - CS42L42_ASPTX_EARLY_MASK | \ - CS42L42_ASPTX_LATE_MASK | \ - CS42L42_ASPTX_SMERROR_MASK) - -#define CS42L42_CODEC_INT_MASK (CS42L42_PAGE_13 + 0x1B) -#define CS42L42_PDN_DONE_SHIFT 0 -#define CS42L42_PDN_DONE_MASK (1 << CS42L42_PDN_DONE_SHIFT) -#define CS42L42_HSDET_AUTO_DONE_SHIFT 1 -#define CS42L42_HSDET_AUTO_DONE_MASK (1 << CS42L42_HSDET_AUTO_DONE_SHIFT) -#define CS42L42_CODEC_VAL_MASK (CS42L42_PDN_DONE_MASK | \ - CS42L42_HSDET_AUTO_DONE_MASK) - -#define CS42L42_SRCPL_INT_MASK (CS42L42_PAGE_13 + 0x1C) -#define CS42L42_SRCPL_ADC_LK_SHIFT 0 -#define CS42L42_SRCPL_ADC_LK_MASK (1 << CS42L42_SRCPL_ADC_LK_SHIFT) -#define CS42L42_SRCPL_DAC_LK_SHIFT 2 -#define CS42L42_SRCPL_DAC_LK_MASK (1 << CS42L42_SRCPL_DAC_LK_SHIFT) -#define CS42L42_SRCPL_ADC_UNLK_SHIFT 5 -#define CS42L42_SRCPL_ADC_UNLK_MASK (1 << CS42L42_SRCPL_ADC_UNLK_SHIFT) -#define CS42L42_SRCPL_DAC_UNLK_SHIFT 6 -#define CS42L42_SRCPL_DAC_UNLK_MASK (1 << CS42L42_SRCPL_DAC_UNLK_SHIFT) -#define CS42L42_SRCPL_VAL_MASK (CS42L42_SRCPL_ADC_LK_MASK | \ - CS42L42_SRCPL_DAC_LK_MASK | \ - CS42L42_SRCPL_ADC_UNLK_MASK | \ - CS42L42_SRCPL_DAC_UNLK_MASK) - -#define CS42L42_VPMON_INT_MASK (CS42L42_PAGE_13 + 0x1E) -#define CS42L42_VPMON_SHIFT 0 -#define CS42L42_VPMON_MASK (1 << CS42L42_VPMON_SHIFT) -#define CS42L42_VPMON_VAL_MASK CS42L42_VPMON_MASK - -#define CS42L42_PLL_LOCK_INT_MASK (CS42L42_PAGE_13 + 0x1F) -#define CS42L42_PLL_LOCK_SHIFT 0 -#define CS42L42_PLL_LOCK_MASK (1 << CS42L42_PLL_LOCK_SHIFT) -#define CS42L42_PLL_LOCK_VAL_MASK CS42L42_PLL_LOCK_MASK - -#define CS42L42_TSRS_PLUG_INT_MASK (CS42L42_PAGE_13 + 0x20) -#define CS42L42_RS_PLUG_SHIFT 0 -#define CS42L42_RS_PLUG_MASK (1 << CS42L42_RS_PLUG_SHIFT) -#define CS42L42_RS_UNPLUG_SHIFT 1 -#define CS42L42_RS_UNPLUG_MASK (1 << CS42L42_RS_UNPLUG_SHIFT) -#define CS42L42_TS_PLUG_SHIFT 2 -#define CS42L42_TS_PLUG_MASK (1 << CS42L42_TS_PLUG_SHIFT) -#define CS42L42_TS_UNPLUG_SHIFT 3 -#define CS42L42_TS_UNPLUG_MASK (1 << CS42L42_TS_UNPLUG_SHIFT) -#define CS42L42_TSRS_PLUG_VAL_MASK (CS42L42_RS_PLUG_MASK | \ - CS42L42_RS_UNPLUG_MASK | \ - CS42L42_TS_PLUG_MASK | \ - CS42L42_TS_UNPLUG_MASK) -#define CS42L42_TS_PLUG 3 -#define CS42L42_TS_UNPLUG 0 -#define CS42L42_TS_TRANS 1 - -/* - * NOTE: PLL_START must be 0 while both ADC_PDN=1 and HP_PDN=1. - * Otherwise it will prevent FILT+ from charging properly. - */ -#define CS42L42_PLL_CTL1 (CS42L42_PAGE_15 + 0x01) -#define CS42L42_PLL_START_SHIFT 0 -#define CS42L42_PLL_START_MASK (1 << CS42L42_PLL_START_SHIFT) - -#define CS42L42_PLL_DIV_FRAC0 (CS42L42_PAGE_15 + 0x02) -#define CS42L42_PLL_DIV_FRAC_SHIFT 0 -#define CS42L42_PLL_DIV_FRAC_MASK (0xff << CS42L42_PLL_DIV_FRAC_SHIFT) - -#define CS42L42_PLL_DIV_FRAC1 (CS42L42_PAGE_15 + 0x03) -#define CS42L42_PLL_DIV_FRAC2 (CS42L42_PAGE_15 + 0x04) - -#define CS42L42_PLL_DIV_INT (CS42L42_PAGE_15 + 0x05) -#define CS42L42_PLL_DIV_INT_SHIFT 0 -#define CS42L42_PLL_DIV_INT_MASK (0xff << CS42L42_PLL_DIV_INT_SHIFT) - -#define CS42L42_PLL_CTL3 (CS42L42_PAGE_15 + 0x08) -#define CS42L42_PLL_DIVOUT_SHIFT 0 -#define CS42L42_PLL_DIVOUT_MASK (0xff << CS42L42_PLL_DIVOUT_SHIFT) - -#define CS42L42_PLL_CAL_RATIO (CS42L42_PAGE_15 + 0x0A) -#define CS42L42_PLL_CAL_RATIO_SHIFT 0 -#define CS42L42_PLL_CAL_RATIO_MASK (0xff << CS42L42_PLL_CAL_RATIO_SHIFT) - -#define CS42L42_PLL_CTL4 (CS42L42_PAGE_15 + 0x1B) -#define CS42L42_PLL_MODE_SHIFT 0 -#define CS42L42_PLL_MODE_MASK (3 << CS42L42_PLL_MODE_SHIFT) - -/* Page 0x19 HP Load Detect Registers */ -#define CS42L42_LOAD_DET_RCSTAT (CS42L42_PAGE_19 + 0x25) -#define CS42L42_RLA_STAT_SHIFT 0 -#define CS42L42_RLA_STAT_MASK (3 << CS42L42_RLA_STAT_SHIFT) -#define CS42L42_RLA_STAT_15_OHM 0 - -#define CS42L42_LOAD_DET_DONE (CS42L42_PAGE_19 + 0x26) -#define CS42L42_HPLOAD_DET_DONE_SHIFT 0 -#define CS42L42_HPLOAD_DET_DONE_MASK (1 << CS42L42_HPLOAD_DET_DONE_SHIFT) - -#define CS42L42_LOAD_DET_EN (CS42L42_PAGE_19 + 0x27) -#define CS42L42_HP_LD_EN_SHIFT 0 -#define CS42L42_HP_LD_EN_MASK (1 << CS42L42_HP_LD_EN_SHIFT) - -/* Page 0x1B Headset Interface Registers */ -#define CS42L42_HSBIAS_SC_AUTOCTL (CS42L42_PAGE_1B + 0x70) -#define CS42L42_HSBIAS_SENSE_TRIP_SHIFT 0 -#define CS42L42_HSBIAS_SENSE_TRIP_MASK (7 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT) -#define CS42L42_TIP_SENSE_EN_SHIFT 5 -#define CS42L42_TIP_SENSE_EN_MASK (1 << CS42L42_TIP_SENSE_EN_SHIFT) -#define CS42L42_AUTO_HSBIAS_HIZ_SHIFT 6 -#define CS42L42_AUTO_HSBIAS_HIZ_MASK (1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) -#define CS42L42_HSBIAS_SENSE_EN_SHIFT 7 -#define CS42L42_HSBIAS_SENSE_EN_MASK (1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) - -#define CS42L42_WAKE_CTL (CS42L42_PAGE_1B + 0x71) -#define CS42L42_WAKEB_CLEAR_SHIFT 0 -#define CS42L42_WAKEB_CLEAR_MASK (1 << CS42L42_WAKEB_CLEAR_SHIFT) -#define CS42L42_WAKEB_MODE_SHIFT 5 -#define CS42L42_WAKEB_MODE_MASK (1 << CS42L42_WAKEB_MODE_SHIFT) -#define CS42L42_M_HP_WAKE_SHIFT 6 -#define CS42L42_M_HP_WAKE_MASK (1 << CS42L42_M_HP_WAKE_SHIFT) -#define CS42L42_M_MIC_WAKE_SHIFT 7 -#define CS42L42_M_MIC_WAKE_MASK (1 << CS42L42_M_MIC_WAKE_SHIFT) - -#define CS42L42_ADC_DISABLE_MUTE (CS42L42_PAGE_1B + 0x72) -#define CS42L42_ADC_DISABLE_S0_MUTE_SHIFT 7 -#define CS42L42_ADC_DISABLE_S0_MUTE_MASK (1 << CS42L42_ADC_DISABLE_S0_MUTE_SHIFT) - -#define CS42L42_TIPSENSE_CTL (CS42L42_PAGE_1B + 0x73) -#define CS42L42_TIP_SENSE_DEBOUNCE_SHIFT 0 -#define CS42L42_TIP_SENSE_DEBOUNCE_MASK (3 << CS42L42_TIP_SENSE_DEBOUNCE_SHIFT) -#define CS42L42_TIP_SENSE_INV_SHIFT 5 -#define CS42L42_TIP_SENSE_INV_MASK (1 << CS42L42_TIP_SENSE_INV_SHIFT) -#define CS42L42_TIP_SENSE_CTRL_SHIFT 6 -#define CS42L42_TIP_SENSE_CTRL_MASK (3 << CS42L42_TIP_SENSE_CTRL_SHIFT) - -/* - * NOTE: DETECT_MODE must be 0 while both ADC_PDN=1 and HP_PDN=1. - * Otherwise it will prevent FILT+ from charging properly. - */ -#define CS42L42_MISC_DET_CTL (CS42L42_PAGE_1B + 0x74) -#define CS42L42_PDN_MIC_LVL_DET_SHIFT 0 -#define CS42L42_PDN_MIC_LVL_DET_MASK (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT) -#define CS42L42_HSBIAS_CTL_SHIFT 1 -#define CS42L42_HSBIAS_CTL_MASK (3 << CS42L42_HSBIAS_CTL_SHIFT) -#define CS42L42_DETECT_MODE_SHIFT 3 -#define CS42L42_DETECT_MODE_MASK (3 << CS42L42_DETECT_MODE_SHIFT) - -#define CS42L42_MIC_DET_CTL1 (CS42L42_PAGE_1B + 0x75) -#define CS42L42_HS_DET_LEVEL_SHIFT 0 -#define CS42L42_HS_DET_LEVEL_MASK (0x3F << CS42L42_HS_DET_LEVEL_SHIFT) -#define CS42L42_EVENT_STAT_SEL_SHIFT 6 -#define CS42L42_EVENT_STAT_SEL_MASK (1 << CS42L42_EVENT_STAT_SEL_SHIFT) -#define CS42L42_LATCH_TO_VP_SHIFT 7 -#define CS42L42_LATCH_TO_VP_MASK (1 << CS42L42_LATCH_TO_VP_SHIFT) - -#define CS42L42_MIC_DET_CTL2 (CS42L42_PAGE_1B + 0x76) -#define CS42L42_DEBOUNCE_TIME_SHIFT 5 -#define CS42L42_DEBOUNCE_TIME_MASK (0x07 << CS42L42_DEBOUNCE_TIME_SHIFT) - -#define CS42L42_DET_STATUS1 (CS42L42_PAGE_1B + 0x77) -#define CS42L42_HSBIAS_HIZ_MODE_SHIFT 6 -#define CS42L42_HSBIAS_HIZ_MODE_MASK (1 << CS42L42_HSBIAS_HIZ_MODE_SHIFT) -#define CS42L42_TIP_SENSE_SHIFT 7 -#define CS42L42_TIP_SENSE_MASK (1 << CS42L42_TIP_SENSE_SHIFT) - -#define CS42L42_DET_STATUS2 (CS42L42_PAGE_1B + 0x78) -#define CS42L42_SHORT_TRUE_SHIFT 0 -#define CS42L42_SHORT_TRUE_MASK (1 << CS42L42_SHORT_TRUE_SHIFT) -#define CS42L42_HS_TRUE_SHIFT 1 -#define CS42L42_HS_TRUE_MASK (1 << CS42L42_HS_TRUE_SHIFT) - -#define CS42L42_DET_INT1_MASK (CS42L42_PAGE_1B + 0x79) -#define CS42L42_TIP_SENSE_UNPLUG_SHIFT 5 -#define CS42L42_TIP_SENSE_UNPLUG_MASK (1 << CS42L42_TIP_SENSE_UNPLUG_SHIFT) -#define CS42L42_TIP_SENSE_PLUG_SHIFT 6 -#define CS42L42_TIP_SENSE_PLUG_MASK (1 << CS42L42_TIP_SENSE_PLUG_SHIFT) -#define CS42L42_HSBIAS_SENSE_SHIFT 7 -#define CS42L42_HSBIAS_SENSE_MASK (1 << CS42L42_HSBIAS_SENSE_SHIFT) -#define CS42L42_DET_INT_VAL1_MASK (CS42L42_TIP_SENSE_UNPLUG_MASK | \ - CS42L42_TIP_SENSE_PLUG_MASK | \ - CS42L42_HSBIAS_SENSE_MASK) - -#define CS42L42_DET_INT2_MASK (CS42L42_PAGE_1B + 0x7A) -#define CS42L42_M_SHORT_DET_SHIFT 0 -#define CS42L42_M_SHORT_DET_MASK (1 << CS42L42_M_SHORT_DET_SHIFT) -#define CS42L42_M_SHORT_RLS_SHIFT 1 -#define CS42L42_M_SHORT_RLS_MASK (1 << CS42L42_M_SHORT_RLS_SHIFT) -#define CS42L42_M_HSBIAS_HIZ_SHIFT 2 -#define CS42L42_M_HSBIAS_HIZ_MASK (1 << CS42L42_M_HSBIAS_HIZ_SHIFT) -#define CS42L42_M_DETECT_FT_SHIFT 6 -#define CS42L42_M_DETECT_FT_MASK (1 << CS42L42_M_DETECT_FT_SHIFT) -#define CS42L42_M_DETECT_TF_SHIFT 7 -#define CS42L42_M_DETECT_TF_MASK (1 << CS42L42_M_DETECT_TF_SHIFT) -#define CS42L42_DET_INT_VAL2_MASK (CS42L42_M_SHORT_DET_MASK | \ - CS42L42_M_SHORT_RLS_MASK | \ - CS42L42_M_HSBIAS_HIZ_MASK | \ - CS42L42_M_DETECT_FT_MASK | \ - CS42L42_M_DETECT_TF_MASK) - -/* Page 0x1C Headset Bias Registers */ -#define CS42L42_HS_BIAS_CTL (CS42L42_PAGE_1C + 0x03) -#define CS42L42_HSBIAS_RAMP_SHIFT 0 -#define CS42L42_HSBIAS_RAMP_MASK (3 << CS42L42_HSBIAS_RAMP_SHIFT) -#define CS42L42_HSBIAS_PD_SHIFT 4 -#define CS42L42_HSBIAS_PD_MASK (1 << CS42L42_HSBIAS_PD_SHIFT) -#define CS42L42_HSBIAS_CAPLESS_SHIFT 7 -#define CS42L42_HSBIAS_CAPLESS_MASK (1 << CS42L42_HSBIAS_CAPLESS_SHIFT) - -/* Page 0x1D ADC Registers */ -#define CS42L42_ADC_CTL (CS42L42_PAGE_1D + 0x01) -#define CS42L42_ADC_NOTCH_DIS_SHIFT 5 -#define CS42L42_ADC_FORCE_WEAK_VCM_SHIFT 4 -#define CS42L42_ADC_INV_SHIFT 2 -#define CS42L42_ADC_DIG_BOOST_SHIFT 0 - -#define CS42L42_ADC_VOLUME (CS42L42_PAGE_1D + 0x03) -#define CS42L42_ADC_VOL_SHIFT 0 - -#define CS42L42_ADC_WNF_HPF_CTL (CS42L42_PAGE_1D + 0x04) -#define CS42L42_ADC_WNF_CF_SHIFT 4 -#define CS42L42_ADC_WNF_EN_SHIFT 3 -#define CS42L42_ADC_HPF_CF_SHIFT 1 -#define CS42L42_ADC_HPF_EN_SHIFT 0 - -/* Page 0x1F DAC Registers */ -#define CS42L42_DAC_CTL1 (CS42L42_PAGE_1F + 0x01) -#define CS42L42_DACB_INV_SHIFT 1 -#define CS42L42_DACA_INV_SHIFT 0 - -#define CS42L42_DAC_CTL2 (CS42L42_PAGE_1F + 0x06) -#define CS42L42_HPOUT_PULLDOWN_SHIFT 4 -#define CS42L42_HPOUT_PULLDOWN_MASK (15 << CS42L42_HPOUT_PULLDOWN_SHIFT) -#define CS42L42_HPOUT_LOAD_SHIFT 3 -#define CS42L42_HPOUT_LOAD_MASK (1 << CS42L42_HPOUT_LOAD_SHIFT) -#define CS42L42_HPOUT_CLAMP_SHIFT 2 -#define CS42L42_HPOUT_CLAMP_MASK (1 << CS42L42_HPOUT_CLAMP_SHIFT) -#define CS42L42_DAC_HPF_EN_SHIFT 1 -#define CS42L42_DAC_HPF_EN_MASK (1 << CS42L42_DAC_HPF_EN_SHIFT) -#define CS42L42_DAC_MON_EN_SHIFT 0 -#define CS42L42_DAC_MON_EN_MASK (1 << CS42L42_DAC_MON_EN_SHIFT) - -/* Page 0x20 HP CTL Registers */ -#define CS42L42_HP_CTL (CS42L42_PAGE_20 + 0x01) -#define CS42L42_HP_ANA_BMUTE_SHIFT 3 -#define CS42L42_HP_ANA_BMUTE_MASK (1 << CS42L42_HP_ANA_BMUTE_SHIFT) -#define CS42L42_HP_ANA_AMUTE_SHIFT 2 -#define CS42L42_HP_ANA_AMUTE_MASK (1 << CS42L42_HP_ANA_AMUTE_SHIFT) -#define CS42L42_HP_FULL_SCALE_VOL_SHIFT 1 -#define CS42L42_HP_FULL_SCALE_VOL_MASK (1 << CS42L42_HP_FULL_SCALE_VOL_SHIFT) - -/* Page 0x21 Class H Registers */ -#define CS42L42_CLASSH_CTL (CS42L42_PAGE_21 + 0x01) - -/* Page 0x23 Mixer Volume Registers */ -#define CS42L42_MIXER_CHA_VOL (CS42L42_PAGE_23 + 0x01) -#define CS42L42_MIXER_ADC_VOL (CS42L42_PAGE_23 + 0x02) - -#define CS42L42_MIXER_CHB_VOL (CS42L42_PAGE_23 + 0x03) -#define CS42L42_MIXER_CH_VOL_SHIFT 0 -#define CS42L42_MIXER_CH_VOL_MASK (0x3f << CS42L42_MIXER_CH_VOL_SHIFT) - -/* Page 0x24 EQ Registers */ -#define CS42L42_EQ_COEF_IN0 (CS42L42_PAGE_24 + 0x01) -#define CS42L42_EQ_COEF_IN1 (CS42L42_PAGE_24 + 0x02) -#define CS42L42_EQ_COEF_IN2 (CS42L42_PAGE_24 + 0x03) -#define CS42L42_EQ_COEF_IN3 (CS42L42_PAGE_24 + 0x04) -#define CS42L42_EQ_COEF_RW (CS42L42_PAGE_24 + 0x06) -#define CS42L42_EQ_COEF_OUT0 (CS42L42_PAGE_24 + 0x07) -#define CS42L42_EQ_COEF_OUT1 (CS42L42_PAGE_24 + 0x08) -#define CS42L42_EQ_COEF_OUT2 (CS42L42_PAGE_24 + 0x09) -#define CS42L42_EQ_COEF_OUT3 (CS42L42_PAGE_24 + 0x0A) -#define CS42L42_EQ_INIT_STAT (CS42L42_PAGE_24 + 0x0B) -#define CS42L42_EQ_START_FILT (CS42L42_PAGE_24 + 0x0C) -#define CS42L42_EQ_MUTE_CTL (CS42L42_PAGE_24 + 0x0E) - -/* Page 0x25 Audio Port Registers */ -#define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01) -#define CS42L42_SP_RX_CHB_SEL_SHIFT 2 -#define CS42L42_SP_RX_CHB_SEL_MASK (3 << CS42L42_SP_RX_CHB_SEL_SHIFT) - -#define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02) -#define CS42L42_SP_RX_RSYNC_SHIFT 6 -#define CS42L42_SP_RX_RSYNC_MASK (1 << CS42L42_SP_RX_RSYNC_SHIFT) -#define CS42L42_SP_RX_NSB_POS_SHIFT 3 -#define CS42L42_SP_RX_NSB_POS_MASK (7 << CS42L42_SP_RX_NSB_POS_SHIFT) -#define CS42L42_SP_RX_NFS_NSBB_SHIFT 2 -#define CS42L42_SP_RX_NFS_NSBB_MASK (1 << CS42L42_SP_RX_NFS_NSBB_SHIFT) -#define CS42L42_SP_RX_ISOC_MODE_SHIFT 0 -#define CS42L42_SP_RX_ISOC_MODE_MASK (3 << CS42L42_SP_RX_ISOC_MODE_SHIFT) - -#define CS42L42_SP_RX_FS (CS42L42_PAGE_25 + 0x03) -#define CS42l42_SPDIF_CH_SEL (CS42L42_PAGE_25 + 0x04) -#define CS42L42_SP_TX_ISOC_CTL (CS42L42_PAGE_25 + 0x05) -#define CS42L42_SP_TX_FS (CS42L42_PAGE_25 + 0x06) -#define CS42L42_SPDIF_SW_CTL1 (CS42L42_PAGE_25 + 0x07) - -/* Page 0x26 SRC Registers */ -#define CS42L42_SRC_SDIN_FS (CS42L42_PAGE_26 + 0x01) -#define CS42L42_SRC_SDIN_FS_SHIFT 0 -#define CS42L42_SRC_SDIN_FS_MASK (0x1f << CS42L42_SRC_SDIN_FS_SHIFT) - -#define CS42L42_SRC_SDOUT_FS (CS42L42_PAGE_26 + 0x09) - -/* Page 0x28 S/PDIF Registers */ -#define CS42L42_SPDIF_CTL1 (CS42L42_PAGE_28 + 0x01) -#define CS42L42_SPDIF_CTL2 (CS42L42_PAGE_28 + 0x02) -#define CS42L42_SPDIF_CTL3 (CS42L42_PAGE_28 + 0x03) -#define CS42L42_SPDIF_CTL4 (CS42L42_PAGE_28 + 0x04) - -/* Page 0x29 Serial Port TX Registers */ -#define CS42L42_ASP_TX_SZ_EN (CS42L42_PAGE_29 + 0x01) -#define CS42L42_ASP_TX_EN_SHIFT 0 -#define CS42L42_ASP_TX_CH_EN (CS42L42_PAGE_29 + 0x02) -#define CS42L42_ASP_TX0_CH2_SHIFT 1 -#define CS42L42_ASP_TX0_CH1_SHIFT 0 - -#define CS42L42_ASP_TX_CH_AP_RES (CS42L42_PAGE_29 + 0x03) -#define CS42L42_ASP_TX_CH1_AP_SHIFT 7 -#define CS42L42_ASP_TX_CH1_AP_MASK (1 << CS42L42_ASP_TX_CH1_AP_SHIFT) -#define CS42L42_ASP_TX_CH2_AP_SHIFT 6 -#define CS42L42_ASP_TX_CH2_AP_MASK (1 << CS42L42_ASP_TX_CH2_AP_SHIFT) -#define CS42L42_ASP_TX_CH2_RES_SHIFT 2 -#define CS42L42_ASP_TX_CH2_RES_MASK (3 << CS42L42_ASP_TX_CH2_RES_SHIFT) -#define CS42L42_ASP_TX_CH1_RES_SHIFT 0 -#define CS42L42_ASP_TX_CH1_RES_MASK (3 << CS42L42_ASP_TX_CH1_RES_SHIFT) -#define CS42L42_ASP_TX_CH1_BIT_MSB (CS42L42_PAGE_29 + 0x04) -#define CS42L42_ASP_TX_CH1_BIT_LSB (CS42L42_PAGE_29 + 0x05) -#define CS42L42_ASP_TX_HIZ_DLY_CFG (CS42L42_PAGE_29 + 0x06) -#define CS42L42_ASP_TX_CH2_BIT_MSB (CS42L42_PAGE_29 + 0x0A) -#define CS42L42_ASP_TX_CH2_BIT_LSB (CS42L42_PAGE_29 + 0x0B) - -/* Page 0x2A Serial Port RX Registers */ -#define CS42L42_ASP_RX_DAI0_EN (CS42L42_PAGE_2A + 0x01) -#define CS42L42_ASP_RX0_CH_EN_SHIFT 2 -#define CS42L42_ASP_RX0_CH_EN_MASK (0xf << CS42L42_ASP_RX0_CH_EN_SHIFT) -#define CS42L42_ASP_RX0_CH1_SHIFT 2 -#define CS42L42_ASP_RX0_CH2_SHIFT 3 -#define CS42L42_ASP_RX0_CH3_SHIFT 4 -#define CS42L42_ASP_RX0_CH4_SHIFT 5 - -#define CS42L42_ASP_RX_DAI0_CH1_AP_RES (CS42L42_PAGE_2A + 0x02) -#define CS42L42_ASP_RX_DAI0_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x03) -#define CS42L42_ASP_RX_DAI0_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x04) -#define CS42L42_ASP_RX_DAI0_CH2_AP_RES (CS42L42_PAGE_2A + 0x05) -#define CS42L42_ASP_RX_DAI0_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x06) -#define CS42L42_ASP_RX_DAI0_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x07) -#define CS42L42_ASP_RX_DAI0_CH3_AP_RES (CS42L42_PAGE_2A + 0x08) -#define CS42L42_ASP_RX_DAI0_CH3_BIT_MSB (CS42L42_PAGE_2A + 0x09) -#define CS42L42_ASP_RX_DAI0_CH3_BIT_LSB (CS42L42_PAGE_2A + 0x0A) -#define CS42L42_ASP_RX_DAI0_CH4_AP_RES (CS42L42_PAGE_2A + 0x0B) -#define CS42L42_ASP_RX_DAI0_CH4_BIT_MSB (CS42L42_PAGE_2A + 0x0C) -#define CS42L42_ASP_RX_DAI0_CH4_BIT_LSB (CS42L42_PAGE_2A + 0x0D) -#define CS42L42_ASP_RX_DAI1_CH1_AP_RES (CS42L42_PAGE_2A + 0x0E) -#define CS42L42_ASP_RX_DAI1_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x0F) -#define CS42L42_ASP_RX_DAI1_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x10) -#define CS42L42_ASP_RX_DAI1_CH2_AP_RES (CS42L42_PAGE_2A + 0x11) -#define CS42L42_ASP_RX_DAI1_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x12) -#define CS42L42_ASP_RX_DAI1_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x13) - -#define CS42L42_ASP_RX_CH_AP_SHIFT 6 -#define CS42L42_ASP_RX_CH_AP_MASK (1 << CS42L42_ASP_RX_CH_AP_SHIFT) -#define CS42L42_ASP_RX_CH_AP_LOW 0 -#define CS42L42_ASP_RX_CH_AP_HI 1 -#define CS42L42_ASP_RX_CH_RES_SHIFT 0 -#define CS42L42_ASP_RX_CH_RES_MASK (3 << CS42L42_ASP_RX_CH_RES_SHIFT) -#define CS42L42_ASP_RX_CH_RES_32 3 -#define CS42L42_ASP_RX_CH_RES_16 1 -#define CS42L42_ASP_RX_CH_BIT_ST_SHIFT 0 -#define CS42L42_ASP_RX_CH_BIT_ST_MASK (0xff << CS42L42_ASP_RX_CH_BIT_ST_SHIFT) - -/* Page 0x30 ID Registers */ -#define CS42L42_SUB_REVID (CS42L42_PAGE_30 + 0x14) -#define CS42L42_MAX_REGISTER (CS42L42_PAGE_30 + 0x14) - -/* Defines for fracturing values spread across multiple registers */ -#define CS42L42_FRAC0_VAL(val) ((val) & 0x0000ff) -#define CS42L42_FRAC1_VAL(val) (((val) & 0x00ff00) >> 8) -#define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) - -#define CS42L42_NUM_SUPPLIES 5 -#define CS42L42_BOOT_TIME_US 3000 -#define CS42L42_PLL_DIVOUT_TIME_US 800 -#define CS42L42_CLOCK_SWITCH_DELAY_US 150 -#define CS42L42_PLL_LOCK_POLL_US 250 -#define CS42L42_PLL_LOCK_TIMEOUT_US 1250 -#define CS42L42_HP_ADC_EN_TIME_US 20000 -#define CS42L42_PDN_DONE_POLL_US 1000 -#define CS42L42_PDN_DONE_TIMEOUT_US 200000 -#define CS42L42_PDN_DONE_TIME_MS 100 -#define CS42L42_FILT_DISCHARGE_TIME_MS 46 - -#endif /* __CS42L42_H */ reverted: --- linux-oem-5.17-5.17.0/include/sound/memalloc.h +++ linux-oem-5.17-5.17.0.orig/include/sound/memalloc.h @@ -51,11 +51,6 @@ #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC #endif -/* fallback types, don't use those directly */ -#ifdef CONFIG_SND_DMA_SGBUF -#define SNDRV_DMA_TYPE_DEV_SG_FALLBACK 10 -#define SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK 11 -#endif /* * info for buffer allocation diff -u linux-oem-5.17-5.17.0/include/trace/events/sunrpc.h linux-oem-5.17-5.17.0/include/trace/events/sunrpc.h --- linux-oem-5.17-5.17.0/include/trace/events/sunrpc.h +++ linux-oem-5.17-5.17.0/include/trace/events/sunrpc.h @@ -1956,18 +1956,17 @@ TP_STRUCT__entry( __field(const void *, dr) __field(u32, xid) - __array(__u8, addr, INET6_ADDRSTRLEN + 10) + __string(addr, dr->xprt->xpt_remotebuf) ), TP_fast_assign( __entry->dr = dr; __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + (dr->xprt_hlen>>2))); - snprintf(__entry->addr, sizeof(__entry->addr) - 1, - "%pISpc", (struct sockaddr *)&dr->addr); + __assign_str(addr, dr->xprt->xpt_remotebuf); ), - TP_printk("addr=%s dr=%p xid=0x%08x", __entry->addr, __entry->dr, + TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr, __entry->xid) ); reverted: --- linux-oem-5.17-5.17.0/include/uapi/linux/io_uring.h +++ linux-oem-5.17-5.17.0.orig/include/uapi/linux/io_uring.h @@ -293,7 +293,6 @@ #define IORING_FEAT_NATIVE_WORKERS (1U << 9) #define IORING_FEAT_RSRC_TAGS (1U << 10) #define IORING_FEAT_CQE_SKIP (1U << 11) -#define IORING_FEAT_LINKED_FILE (1U << 12) /* * io_uring_register(2) opcodes and arguments reverted: --- linux-oem-5.17-5.17.0/include/uapi/linux/stddef.h +++ linux-oem-5.17-5.17.0.orig/include/uapi/linux/stddef.h @@ -1,7 +1,4 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_LINUX_STDDEF_H -#define _UAPI_LINUX_STDDEF_H - #include #ifndef __always_inline @@ -44,4 +41,3 @@ struct { } __empty_ ## NAME; \ TYPE NAME[]; \ } -#endif reverted: --- linux-oem-5.17-5.17.0/kernel/cpu.c +++ linux-oem-5.17-5.17.0.orig/kernel/cpu.c @@ -70,6 +70,7 @@ bool rollback; bool single; bool bringup; + int cpu; struct hlist_node *node; struct hlist_node *last; enum cpuhp_state cb_state; @@ -473,7 +474,7 @@ #endif static inline enum cpuhp_state +cpuhp_set_state(struct cpuhp_cpu_state *st, enum cpuhp_state target) -cpuhp_set_state(int cpu, struct cpuhp_cpu_state *st, enum cpuhp_state target) { enum cpuhp_state prev_state = st->state; bool bringup = st->state < target; @@ -484,15 +485,14 @@ st->target = target; st->single = false; st->bringup = bringup; + if (cpu_dying(st->cpu) != !bringup) + set_cpu_dying(st->cpu, !bringup); - if (cpu_dying(cpu) != !bringup) - set_cpu_dying(cpu, !bringup); return prev_state; } static inline void +cpuhp_reset_state(struct cpuhp_cpu_state *st, enum cpuhp_state prev_state) -cpuhp_reset_state(int cpu, struct cpuhp_cpu_state *st, - enum cpuhp_state prev_state) { bool bringup = !st->bringup; @@ -519,8 +519,8 @@ } st->bringup = bringup; + if (cpu_dying(st->cpu) != !bringup) + set_cpu_dying(st->cpu, !bringup); - if (cpu_dying(cpu) != !bringup) - set_cpu_dying(cpu, !bringup); } /* Regular hotplug invocation of the AP hotplug thread */ @@ -540,16 +540,15 @@ wait_for_ap_thread(st, st->bringup); } +static int cpuhp_kick_ap(struct cpuhp_cpu_state *st, enum cpuhp_state target) -static int cpuhp_kick_ap(int cpu, struct cpuhp_cpu_state *st, - enum cpuhp_state target) { enum cpuhp_state prev_state; int ret; + prev_state = cpuhp_set_state(st, target); - prev_state = cpuhp_set_state(cpu, st, target); __cpuhp_kick_ap(st); if ((ret = st->result)) { + cpuhp_reset_state(st, prev_state); - cpuhp_reset_state(cpu, st, prev_state); __cpuhp_kick_ap(st); } @@ -581,7 +580,7 @@ if (st->target <= CPUHP_AP_ONLINE_IDLE) return 0; + return cpuhp_kick_ap(st, st->target); - return cpuhp_kick_ap(cpu, st, st->target); } static int bringup_cpu(unsigned int cpu) @@ -704,7 +703,7 @@ ret, cpu, cpuhp_get_step(st->state)->name, st->state); + cpuhp_reset_state(st, prev_state); - cpuhp_reset_state(cpu, st, prev_state); if (can_rollback_cpu(st)) WARN_ON(cpuhp_invoke_callback_range(false, cpu, st, prev_state)); @@ -721,6 +720,7 @@ init_completion(&st->done_up); init_completion(&st->done_down); + st->cpu = cpu; } static int cpuhp_should_run(unsigned int cpu) @@ -874,7 +874,7 @@ cpuhp_lock_release(true); trace_cpuhp_enter(cpu, st->target, prev_state, cpuhp_kick_ap_work); + ret = cpuhp_kick_ap(st, st->target); - ret = cpuhp_kick_ap(cpu, st, st->target); trace_cpuhp_exit(cpu, st->state, prev_state, ret); return ret; @@ -1106,7 +1106,7 @@ ret, cpu, cpuhp_get_step(st->state)->name, st->state); + cpuhp_reset_state(st, prev_state); - cpuhp_reset_state(cpu, st, prev_state); if (st->state < prev_state) WARN_ON(cpuhp_invoke_callback_range(true, cpu, st, @@ -1133,7 +1133,7 @@ cpuhp_tasks_frozen = tasks_frozen; + prev_state = cpuhp_set_state(st, target); - prev_state = cpuhp_set_state(cpu, st, target); /* * If the current CPU state is in the range of the AP hotplug thread, * then we need to kick the thread. @@ -1164,7 +1164,7 @@ ret = cpuhp_down_callbacks(cpu, st, target); if (ret && st->state < prev_state) { if (st->state == CPUHP_TEARDOWN_CPU) { + cpuhp_reset_state(st, prev_state); - cpuhp_reset_state(cpu, st, prev_state); __cpuhp_kick_ap(st); } else { WARN(1, "DEAD callback error for CPU%d", cpu); @@ -1351,7 +1351,7 @@ cpuhp_tasks_frozen = tasks_frozen; + cpuhp_set_state(st, target); - cpuhp_set_state(cpu, st, target); /* * If the current CPU state is in the range of the AP hotplug thread, * then we need to kick the thread once more. reverted: --- linux-oem-5.17-5.17.0/kernel/dma/direct.h +++ linux-oem-5.17-5.17.0.orig/kernel/dma/direct.h @@ -114,7 +114,6 @@ dma_direct_sync_single_for_cpu(dev, addr, size, dir); if (unlikely(is_swiotlb_buffer(dev, phys))) + swiotlb_tbl_unmap_single(dev, phys, size, dir, attrs); - swiotlb_tbl_unmap_single(dev, phys, size, dir, - attrs | DMA_ATTR_SKIP_CPU_SYNC); } #endif /* _KERNEL_DMA_DIRECT_H */ diff -u linux-oem-5.17-5.17.0/kernel/events/core.c linux-oem-5.17-5.17.0/kernel/events/core.c --- linux-oem-5.17-5.17.0/kernel/events/core.c +++ linux-oem-5.17-5.17.0/kernel/events/core.c @@ -6357,7 +6357,7 @@ again: mutex_lock(&event->mmap_mutex); if (event->rb) { - if (data_page_nr(event->rb) != nr_pages) { + if (event->rb->nr_pages != nr_pages) { ret = -EINVAL; goto unlock; } reverted: --- linux-oem-5.17-5.17.0/kernel/events/internal.h +++ linux-oem-5.17-5.17.0.orig/kernel/events/internal.h @@ -116,11 +116,6 @@ } #endif -static inline int data_page_nr(struct perf_buffer *rb) -{ - return rb->nr_pages << page_order(rb); -} - static inline unsigned long perf_data_size(struct perf_buffer *rb) { return rb->nr_pages << (PAGE_SHIFT + page_order(rb)); reverted: --- linux-oem-5.17-5.17.0/kernel/events/ring_buffer.c +++ linux-oem-5.17-5.17.0.orig/kernel/events/ring_buffer.c @@ -859,6 +859,11 @@ } #else +static int data_page_nr(struct perf_buffer *rb) +{ + return rb->nr_pages << page_order(rb); +} + static struct page * __perf_mmap_to_page(struct perf_buffer *rb, unsigned long pgoff) { reverted: --- linux-oem-5.17-5.17.0/kernel/irq/affinity.c +++ linux-oem-5.17-5.17.0.orig/kernel/irq/affinity.c @@ -269,9 +269,8 @@ */ if (numvecs <= nodes) { for_each_node_mask(n, nodemsk) { + cpumask_or(&masks[curvec].mask, &masks[curvec].mask, + node_to_cpumask[n]); - /* Ensure that only CPUs which are in both masks are set */ - cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]); - cpumask_or(&masks[curvec].mask, &masks[curvec].mask, nmsk); if (++curvec == last_affv) curvec = firstvec; } reverted: --- linux-oem-5.17-5.17.0/kernel/irq/internals.h +++ linux-oem-5.17-5.17.0.orig/kernel/irq/internals.h @@ -29,14 +29,12 @@ * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed * IRQTF_AFFINITY - irq thread is requested to adjust affinity * IRQTF_FORCED_THREAD - irq action is force threaded - * IRQTF_READY - signals that irq thread is ready */ enum { IRQTF_RUNTHREAD, IRQTF_WARNED, IRQTF_AFFINITY, IRQTF_FORCED_THREAD, - IRQTF_READY, }; /* reverted: --- linux-oem-5.17-5.17.0/kernel/irq/irqdesc.c +++ linux-oem-5.17-5.17.0.orig/kernel/irq/irqdesc.c @@ -407,7 +407,6 @@ lockdep_set_class(&desc->lock, &irq_desc_lock_class); mutex_init(&desc->request_mutex); init_rcu_head(&desc->rcu); - init_waitqueue_head(&desc->wait_for_threads); desc_set_defaults(irq, desc, node, affinity, owner); irqd_set(&desc->irq_data, flags); @@ -576,7 +575,6 @@ raw_spin_lock_init(&desc[i].lock); lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); mutex_init(&desc[i].request_mutex); - init_waitqueue_head(&desc[i].wait_for_threads); desc_set_defaults(i, &desc[i], node, NULL, NULL); } return arch_early_irq_init(); reverted: --- linux-oem-5.17-5.17.0/kernel/irq/manage.c +++ linux-oem-5.17-5.17.0.orig/kernel/irq/manage.c @@ -1249,31 +1249,6 @@ } /* - * Internal function to notify that a interrupt thread is ready. - */ -static void irq_thread_set_ready(struct irq_desc *desc, - struct irqaction *action) -{ - set_bit(IRQTF_READY, &action->thread_flags); - wake_up(&desc->wait_for_threads); -} - -/* - * Internal function to wake up a interrupt thread and wait until it is - * ready. - */ -static void wake_up_and_wait_for_irq_thread_ready(struct irq_desc *desc, - struct irqaction *action) -{ - if (!action || !action->thread) - return; - - wake_up_process(action->thread); - wait_event(desc->wait_for_threads, - test_bit(IRQTF_READY, &action->thread_flags)); -} - -/* * Interrupt handler thread */ static int irq_thread(void *data) @@ -1284,8 +1259,6 @@ irqreturn_t (*handler_fn)(struct irq_desc *desc, struct irqaction *action); - irq_thread_set_ready(desc, action); - sched_set_fifo(current); if (force_irqthreads() && test_bit(IRQTF_FORCED_THREAD, @@ -1710,6 +1683,8 @@ } if (!shared) { + init_waitqueue_head(&desc->wait_for_threads); + /* Setup the type (level, edge polarity) if configured: */ if (new->flags & IRQF_TRIGGER_MASK) { ret = __irq_set_trigger(desc, @@ -1805,8 +1780,14 @@ irq_setup_timings(desc, new); + /* + * Strictly no need to wake it up, but hung_task complains + * when no hard interrupt wakes the thread up. + */ + if (new->thread) + wake_up_process(new->thread); + if (new->secondary) + wake_up_process(new->secondary->thread); - wake_up_and_wait_for_irq_thread_ready(desc, new); - wake_up_and_wait_for_irq_thread_ready(desc, new->secondary); register_irq_proc(irq, desc); new->dir = NULL; reverted: --- linux-oem-5.17-5.17.0/kernel/irq_work.c +++ linux-oem-5.17-5.17.0.orig/kernel/irq_work.c @@ -137,7 +137,7 @@ if (!irq_work_claim(work)) return false; + kasan_record_aux_stack(work); - kasan_record_aux_stack_noalloc(work); preempt_disable(); if (cpu != smp_processor_id()) { diff -u linux-oem-5.17-5.17.0/kernel/sched/fair.c linux-oem-5.17-5.17.0/kernel/sched/fair.c --- linux-oem-5.17-5.17.0/kernel/sched/fair.c +++ linux-oem-5.17-5.17.0/kernel/sched/fair.c @@ -3776,11 +3776,11 @@ se->avg.runnable_sum = se->avg.runnable_avg * divider; - se->avg.load_sum = se->avg.load_avg * divider; - if (se_weight(se) < se->avg.load_sum) - se->avg.load_sum = div_u64(se->avg.load_sum, se_weight(se)); - else - se->avg.load_sum = 1; + se->avg.load_sum = divider; + if (se_weight(se)) { + se->avg.load_sum = + div_u64(se->avg.load_avg * se->avg.load_sum, se_weight(se)); + } enqueue_load_avg(cfs_rq, se); cfs_rq->avg.util_avg += se->avg.util_avg; reverted: --- linux-oem-5.17-5.17.0/kernel/smp.c +++ linux-oem-5.17-5.17.0.orig/kernel/smp.c @@ -579,7 +579,7 @@ /* There shouldn't be any pending callbacks on an offline CPU. */ if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) && + !warned && !llist_empty(head))) { - !warned && entry != NULL)) { warned = true; WARN(1, "IPI on offline CPU %d\n", smp_processor_id()); reverted: --- linux-oem-5.17-5.17.0/kernel/time/tick-sched.c +++ linux-oem-5.17-5.17.0.orig/kernel/time/tick-sched.c @@ -186,7 +186,7 @@ */ if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) { #ifdef CONFIG_NO_HZ_FULL + WARN_ON(tick_nohz_full_running); - WARN_ON_ONCE(tick_nohz_full_running); #endif tick_do_timer_cpu = cpu; } reverted: --- linux-oem-5.17-5.17.0/kernel/time/timekeeping.c +++ linux-oem-5.17-5.17.0.orig/kernel/time/timekeeping.c @@ -482,7 +482,7 @@ * of the following timestamps. Callers need to be aware of that and * deal with it. */ +u64 ktime_get_mono_fast_ns(void) -u64 notrace ktime_get_mono_fast_ns(void) { return __ktime_get_fast_ns(&tk_fast_mono); } @@ -494,7 +494,7 @@ * Contrary to ktime_get_mono_fast_ns() this is always correct because the * conversion factor is not affected by NTP/PTP correction. */ +u64 ktime_get_raw_fast_ns(void) -u64 notrace ktime_get_raw_fast_ns(void) { return __ktime_get_fast_ns(&tk_fast_raw); } reverted: --- linux-oem-5.17-5.17.0/kernel/time/timer.c +++ linux-oem-5.17-5.17.0.orig/kernel/time/timer.c @@ -1722,14 +1722,11 @@ time_after_eq(jiffies, base->next_expiry)) { levels = collect_expired_timers(base, heads); /* + * The only possible reason for not finding any expired + * timer at this clk is that all matching timers have been + * dequeued. - * The two possible reasons for not finding any expired - * timer at this clk are that all matching timers have been - * dequeued or no timer has been queued since - * base::next_expiry was set to base::clk + - * NEXT_TIMER_MAX_DELTA. */ + WARN_ON_ONCE(!levels && !base->next_expiry_recalc); - WARN_ON_ONCE(!levels && !base->next_expiry_recalc - && base->timers_pending); base->clk++; base->next_expiry = __next_timer_interrupt(base); reverted: --- linux-oem-5.17-5.17.0/lib/hexdump.c +++ linux-oem-5.17-5.17.0.orig/lib/hexdump.c @@ -22,33 +22,15 @@ * * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad * input. - * - * This function is used to load cryptographic keys, so it is coded in such a - * way that there are no conditions or memory accesses that depend on data. - * - * Explanation of the logic: - * (ch - '9' - 1) is negative if ch <= '9' - * ('0' - 1 - ch) is negative if ch >= '0' - * we "and" these two values, so the result is negative if ch is in the range - * '0' ... '9' - * we are only interested in the sign, so we do a shift ">> 8"; note that right - * shift of a negative value is implementation-defined, so we cast the - * value to (unsigned) before the shift --- we have 0xffffff if ch is in - * the range '0' ... '9', 0 otherwise - * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is - * in the range '0' ... '9', 0 otherwise - * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0' - * ... '9', -1 otherwise - * the next line is similar to the previous one, but we need to decode both - * uppercase and lowercase letters, so we use (ch & 0xdf), which converts - * lowercase to uppercase */ +int hex_to_bin(char ch) -int hex_to_bin(unsigned char ch) { + if ((ch >= '0') && (ch <= '9')) + return ch - '0'; + ch = tolower(ch); + if ((ch >= 'a') && (ch <= 'f')) + return ch - 'a' + 10; + return -1; - unsigned char cu = ch & 0xdf; - return -1 + - ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) + - ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8); } EXPORT_SYMBOL(hex_to_bin); @@ -63,13 +45,10 @@ int hex2bin(u8 *dst, const char *src, size_t count) { while (count--) { + int hi = hex_to_bin(*src++); + int lo = hex_to_bin(*src++); - int hi, lo; + if ((hi < 0) || (lo < 0)) - hi = hex_to_bin(*src++); - if (unlikely(hi < 0)) - return -EINVAL; - lo = hex_to_bin(*src++); - if (unlikely(lo < 0)) return -EINVAL; *dst++ = (hi << 4) | lo; diff -u linux-oem-5.17-5.17.0/lib/xarray.c linux-oem-5.17-5.17.0/lib/xarray.c --- linux-oem-5.17-5.17.0/lib/xarray.c +++ linux-oem-5.17-5.17.0/lib/xarray.c @@ -207,8 +207,6 @@ if (xa_is_sibling(entry)) { offset = xa_to_sibling(entry); entry = xa_entry(xas->xa, node, offset); - if (node->shift && xa_is_node(entry)) - entry = XA_RETRY_ENTRY; } xas->xa_offset = offset; reverted: --- linux-oem-5.17-5.17.0/mm/hugetlb.c +++ linux-oem-5.17-5.17.0.orig/mm/hugetlb.c @@ -3469,6 +3469,7 @@ { int nr_nodes, node; struct page *page; + int rc = 0; lockdep_assert_held(&hugetlb_lock); @@ -3479,19 +3480,15 @@ } for_each_node_mask_to_free(h, nr_nodes, node, nodes_allowed) { + if (!list_empty(&h->hugepage_freelists[node])) { + page = list_entry(h->hugepage_freelists[node].next, + struct page, lru); + rc = demote_free_huge_page(h, page); + break; - list_for_each_entry(page, &h->hugepage_freelists[node], lru) { - if (PageHWPoison(page)) - continue; - - return demote_free_huge_page(h, page); } } + return rc; - /* - * Only way to get here is if all pages on free lists are poisoned. - * Return -EBUSY so that caller will not retry. - */ - return -EBUSY; } #define HSTATE_ATTR_RO(_name) \ reverted: --- linux-oem-5.17-5.17.0/mm/kasan/quarantine.c +++ linux-oem-5.17-5.17.0.orig/mm/kasan/quarantine.c @@ -315,13 +315,6 @@ struct qlist_head *q; q = this_cpu_ptr(&cpu_quarantine); - /* - * Ensure the ordering between the writing to q->offline and - * per_cpu_remove_cache. Prevent cpu_quarantine from being corrupted - * by interrupt. - */ - if (READ_ONCE(q->offline)) - return; qlist_move_cache(q, &to_free, cache); qlist_free_all(&to_free, cache); } diff -u linux-oem-5.17-5.17.0/mm/kfence/core.c linux-oem-5.17-5.17.0/mm/kfence/core.c --- linux-oem-5.17-5.17.0/mm/kfence/core.c +++ linux-oem-5.17-5.17.0/mm/kfence/core.c @@ -222,6 +222,27 @@ return !KFENCE_WARN_ON(!kfence_protect_page(ALIGN_DOWN(addr, PAGE_SIZE), false)); } +static inline struct kfence_metadata *addr_to_metadata(unsigned long addr) +{ + long index; + + /* The checks do not affect performance; only called from slow-paths. */ + + if (!is_kfence_address((void *)addr)) + return NULL; + + /* + * May be an invalid index if called with an address at the edge of + * __kfence_pool, in which case we would report an "invalid access" + * error. + */ + index = (addr - (unsigned long)__kfence_pool) / (PAGE_SIZE * 2) - 1; + if (index < 0 || index >= CONFIG_KFENCE_NUM_OBJECTS) + return NULL; + + return &kfence_metadata[index]; +} + static inline unsigned long metadata_to_pageaddr(const struct kfence_metadata *meta) { unsigned long offset = (meta - kfence_metadata + 1) * PAGE_SIZE * 2; diff -u linux-oem-5.17-5.17.0/mm/kfence/kfence.h linux-oem-5.17-5.17.0/mm/kfence/kfence.h --- linux-oem-5.17-5.17.0/mm/kfence/kfence.h +++ linux-oem-5.17-5.17.0/mm/kfence/kfence.h @@ -96,27 +96,6 @@ extern struct kfence_metadata kfence_metadata[CONFIG_KFENCE_NUM_OBJECTS]; -static inline struct kfence_metadata *addr_to_metadata(unsigned long addr) -{ - long index; - - /* The checks do not affect performance; only called from slow-paths. */ - - if (!is_kfence_address((void *)addr)) - return NULL; - - /* - * May be an invalid index if called with an address at the edge of - * __kfence_pool, in which case we would report an "invalid access" - * error. - */ - index = (addr - (unsigned long)__kfence_pool) / (PAGE_SIZE * 2) - 1; - if (index < 0 || index >= CONFIG_KFENCE_NUM_OBJECTS) - return NULL; - - return &kfence_metadata[index]; -} - /* KFENCE error types for report generation. */ enum kfence_error_type { KFENCE_ERROR_OOB, /* Detected a out-of-bounds access. */ reverted: --- linux-oem-5.17-5.17.0/mm/kfence/report.c +++ linux-oem-5.17-5.17.0.orig/mm/kfence/report.c @@ -273,50 +273,3 @@ /* We encountered a memory safety error, taint the kernel! */ add_taint(TAINT_BAD_PAGE, LOCKDEP_STILL_OK); } - -#ifdef CONFIG_PRINTK -static void kfence_to_kp_stack(const struct kfence_track *track, void **kp_stack) -{ - int i, j; - - i = get_stack_skipnr(track->stack_entries, track->num_stack_entries, NULL); - for (j = 0; i < track->num_stack_entries && j < KS_ADDRS_COUNT; ++i, ++j) - kp_stack[j] = (void *)track->stack_entries[i]; - if (j < KS_ADDRS_COUNT) - kp_stack[j] = NULL; -} - -bool __kfence_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) -{ - struct kfence_metadata *meta = addr_to_metadata((unsigned long)object); - unsigned long flags; - - if (!meta) - return false; - - /* - * If state is UNUSED at least show the pointer requested; the rest - * would be garbage data. - */ - kpp->kp_ptr = object; - - /* Requesting info an a never-used object is almost certainly a bug. */ - if (WARN_ON(meta->state == KFENCE_OBJECT_UNUSED)) - return true; - - raw_spin_lock_irqsave(&meta->lock, flags); - - kpp->kp_slab = slab; - kpp->kp_slab_cache = meta->cache; - kpp->kp_objp = (void *)meta->addr; - kfence_to_kp_stack(&meta->alloc_track, kpp->kp_stack); - if (meta->state == KFENCE_OBJECT_FREED) - kfence_to_kp_stack(&meta->free_track, kpp->kp_free_stack); - /* get_stack_skipnr() ensures the first entry is outside allocator. */ - kpp->kp_ret = kpp->kp_stack[0]; - - raw_spin_unlock_irqrestore(&meta->lock, flags); - - return true; -} -#endif diff -u linux-oem-5.17-5.17.0/mm/kmemleak.c linux-oem-5.17-5.17.0/mm/kmemleak.c --- linux-oem-5.17-5.17.0/mm/kmemleak.c +++ linux-oem-5.17-5.17.0/mm/kmemleak.c @@ -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 -u linux-oem-5.17-5.17.0/mm/memcontrol.c linux-oem-5.17-5.17.0/mm/memcontrol.c --- linux-oem-5.17-5.17.0/mm/memcontrol.c +++ linux-oem-5.17-5.17.0/mm/memcontrol.c @@ -628,9 +628,6 @@ static DEFINE_SPINLOCK(stats_flush_lock); static DEFINE_PER_CPU(unsigned int, stats_updates); static atomic_t stats_flush_threshold = ATOMIC_INIT(0); -static u64 flush_next_time; - -#define FLUSH_TIME (2UL*HZ) static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val) { @@ -652,7 +649,6 @@ if (!spin_trylock_irqsave(&stats_flush_lock, flag)) return; - flush_next_time = jiffies_64 + 2*FLUSH_TIME; cgroup_rstat_flush_irqsafe(root_mem_cgroup->css.cgroup); atomic_set(&stats_flush_threshold, 0); spin_unlock_irqrestore(&stats_flush_lock, flag); @@ -664,16 +660,10 @@ __mem_cgroup_flush_stats(); } -void mem_cgroup_flush_stats_delayed(void) -{ - if (time_after64(jiffies_64, flush_next_time)) - mem_cgroup_flush_stats(); -} - static void flush_memcg_stats_dwork(struct work_struct *w) { __mem_cgroup_flush_stats(); - queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME); + queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); } /** reverted: --- linux-oem-5.17-5.17.0/mm/memory-failure.c +++ linux-oem-5.17-5.17.0.orig/mm/memory-failure.c @@ -1780,19 +1780,6 @@ if (PageTransHuge(hpage)) { /* - * Bail out before SetPageHasHWPoisoned() if hpage is - * huge_zero_page, although PG_has_hwpoisoned is not - * checked in set_huge_zero_page(). - * - * TODO: Handle memory failure of huge_zero_page thoroughly. - */ - if (is_huge_zero_page(hpage)) { - action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); - res = -EBUSY; - goto unlock_mutex; - } - - /* * The flag must be set after the refcount is bumped * otherwise it may race with THP split. * And the flag can't be set in get_hwpoison_page() since diff -u linux-oem-5.17-5.17.0/mm/mmap.c linux-oem-5.17-5.17.0/mm/mmap.c --- linux-oem-5.17-5.17.0/mm/mmap.c +++ linux-oem-5.17-5.17.0/mm/mmap.c @@ -2119,6 +2119,14 @@ return addr; } +#ifndef arch_get_mmap_end +#define arch_get_mmap_end(addr) (TASK_SIZE) +#endif + +#ifndef arch_get_mmap_base +#define arch_get_mmap_base(addr, base) (base) +#endif + /* Get an address range which is currently unmapped. * For shmat() with addr=0. * reverted: --- linux-oem-5.17-5.17.0/mm/mmu_notifier.c +++ linux-oem-5.17-5.17.0.orig/mm/mmu_notifier.c @@ -1036,18 +1036,6 @@ } EXPORT_SYMBOL_GPL(mmu_interval_notifier_insert_locked); -static bool -mmu_interval_seq_released(struct mmu_notifier_subscriptions *subscriptions, - unsigned long seq) -{ - bool ret; - - spin_lock(&subscriptions->lock); - ret = subscriptions->invalidate_seq != seq; - spin_unlock(&subscriptions->lock); - return ret; -} - /** * mmu_interval_notifier_remove - Remove a interval notifier * @interval_sub: Interval subscription to unregister @@ -1095,7 +1083,7 @@ lock_map_release(&__mmu_notifier_invalidate_range_start_map); if (seq) wait_event(subscriptions->wq, + READ_ONCE(subscriptions->invalidate_seq) != seq); - mmu_interval_seq_released(subscriptions, seq)); /* pairs with mmgrab in mmu_interval_notifier_insert() */ mmdrop(mm); reverted: --- linux-oem-5.17-5.17.0/mm/oom_kill.c +++ linux-oem-5.17-5.17.0.orig/mm/oom_kill.c @@ -635,7 +635,7 @@ */ set_bit(MMF_OOM_SKIP, &mm->flags); + /* Drop a reference taken by wake_oom_reaper */ - /* Drop a reference taken by queue_oom_reaper */ put_task_struct(tsk); } @@ -647,12 +647,12 @@ struct task_struct *tsk = NULL; wait_event_freezable(oom_reaper_wait, oom_reaper_list != NULL); + spin_lock(&oom_reaper_lock); - spin_lock_irq(&oom_reaper_lock); if (oom_reaper_list != NULL) { tsk = oom_reaper_list; oom_reaper_list = tsk->oom_reaper_list; } + spin_unlock(&oom_reaper_lock); - spin_unlock_irq(&oom_reaper_lock); if (tsk) oom_reap_task(tsk); @@ -661,48 +661,22 @@ return 0; } +static void wake_oom_reaper(struct task_struct *tsk) -static void wake_oom_reaper(struct timer_list *timer) { + /* mm is already queued? */ + if (test_and_set_bit(MMF_OOM_REAP_QUEUED, &tsk->signal->oom_mm->flags)) - struct task_struct *tsk = container_of(timer, struct task_struct, - oom_reaper_timer); - struct mm_struct *mm = tsk->signal->oom_mm; - unsigned long flags; - - /* The victim managed to terminate on its own - see exit_mmap */ - if (test_bit(MMF_OOM_SKIP, &mm->flags)) { - put_task_struct(tsk); return; - } + get_task_struct(tsk); + + spin_lock(&oom_reaper_lock); - spin_lock_irqsave(&oom_reaper_lock, flags); tsk->oom_reaper_list = oom_reaper_list; oom_reaper_list = tsk; + spin_unlock(&oom_reaper_lock); - spin_unlock_irqrestore(&oom_reaper_lock, flags); trace_wake_reaper(tsk->pid); wake_up(&oom_reaper_wait); } -/* - * Give the OOM victim time to exit naturally before invoking the oom_reaping. - * The timers timeout is arbitrary... the longer it is, the longer the worst - * case scenario for the OOM can take. If it is too small, the oom_reaper can - * get in the way and release resources needed by the process exit path. - * e.g. The futex robust list can sit in Anon|Private memory that gets reaped - * before the exit path is able to wake the futex waiters. - */ -#define OOM_REAPER_DELAY (2*HZ) -static void queue_oom_reaper(struct task_struct *tsk) -{ - /* mm is already queued? */ - if (test_and_set_bit(MMF_OOM_REAP_QUEUED, &tsk->signal->oom_mm->flags)) - return; - - get_task_struct(tsk); - timer_setup(&tsk->oom_reaper_timer, wake_oom_reaper, 0); - tsk->oom_reaper_timer.expires = jiffies + OOM_REAPER_DELAY; - add_timer(&tsk->oom_reaper_timer); -} - static int __init oom_init(void) { oom_reaper_th = kthread_run(oom_reaper, NULL, "oom_reaper"); @@ -710,7 +684,7 @@ } subsys_initcall(oom_init) #else +static inline void wake_oom_reaper(struct task_struct *tsk) -static inline void queue_oom_reaper(struct task_struct *tsk) { } #endif /* CONFIG_MMU */ @@ -961,7 +935,7 @@ rcu_read_unlock(); if (can_oom_reap) + wake_oom_reaper(victim); - queue_oom_reaper(victim); mmdrop(mm); put_task_struct(victim); @@ -997,7 +971,7 @@ task_lock(victim); if (task_will_free_mem(victim)) { mark_oom_victim(victim); + wake_oom_reaper(victim); - queue_oom_reaper(victim); task_unlock(victim); put_task_struct(victim); return; @@ -1096,7 +1070,7 @@ */ if (task_will_free_mem(current)) { mark_oom_victim(current); + wake_oom_reaper(current); - queue_oom_reaper(current); return true; } diff -u linux-oem-5.17-5.17.0/mm/page_alloc.c linux-oem-5.17-5.17.0/mm/page_alloc.c --- linux-oem-5.17-5.17.0/mm/page_alloc.c +++ linux-oem-5.17-5.17.0/mm/page_alloc.c @@ -6112,7 +6112,7 @@ do { zone_type--; zone = pgdat->node_zones + zone_type; - if (populated_zone(zone)) { + if (managed_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); } reverted: --- linux-oem-5.17-5.17.0/mm/page_io.c +++ linux-oem-5.17-5.17.0.orig/mm/page_io.c @@ -51,6 +51,54 @@ bio_put(bio); } +static void swap_slot_free_notify(struct page *page) +{ + struct swap_info_struct *sis; + struct gendisk *disk; + swp_entry_t entry; + + /* + * There is no guarantee that the page is in swap cache - the software + * suspend code (at least) uses end_swap_bio_read() against a non- + * swapcache page. So we must check PG_swapcache before proceeding with + * this optimization. + */ + if (unlikely(!PageSwapCache(page))) + return; + + sis = page_swap_info(page); + if (data_race(!(sis->flags & SWP_BLKDEV))) + return; + + /* + * The swap subsystem performs lazy swap slot freeing, + * expecting that the page will be swapped out again. + * So we can avoid an unnecessary write if the page + * isn't redirtied. + * This is good for real swap storage because we can + * reduce unnecessary I/O and enhance wear-leveling + * if an SSD is used as the as swap device. + * But if in-memory swap device (eg zram) is used, + * this causes a duplicated copy between uncompressed + * data in VM-owned memory and compressed data in + * zram-owned memory. So let's free zram-owned memory + * and make the VM-owned decompressed page *dirty*, + * so the page should be swapped out somewhere again if + * we again wish to reclaim it. + */ + disk = sis->bdev->bd_disk; + entry.val = page_private(page); + if (disk->fops->swap_slot_free_notify && __swap_count(entry) == 1) { + unsigned long offset; + + offset = swp_offset(entry); + + SetPageDirty(page); + disk->fops->swap_slot_free_notify(sis->bdev, + offset); + } +} + static void end_swap_bio_read(struct bio *bio) { struct page *page = bio_first_page_all(bio); @@ -66,6 +114,7 @@ } SetPageUptodate(page); + swap_slot_free_notify(page); out: unlock_page(page); WRITE_ONCE(bio->bi_private, NULL); @@ -343,6 +392,11 @@ if (sis->flags & SWP_SYNCHRONOUS_IO) { ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); if (!ret) { + if (trylock_page(page)) { + swap_slot_free_notify(page); + unlock_page(page); + } + count_vm_event(PSWPIN); goto out; } reverted: --- linux-oem-5.17-5.17.0/mm/secretmem.c +++ linux-oem-5.17-5.17.0.orig/mm/secretmem.c @@ -158,22 +158,6 @@ .isolate_page = secretmem_isolate_page, }; -static int secretmem_setattr(struct user_namespace *mnt_userns, - struct dentry *dentry, struct iattr *iattr) -{ - struct inode *inode = d_inode(dentry); - unsigned int ia_valid = iattr->ia_valid; - - if ((ia_valid & ATTR_SIZE) && inode->i_size) - return -EINVAL; - - return simple_setattr(mnt_userns, dentry, iattr); -} - -static const struct inode_operations secretmem_iops = { - .setattr = secretmem_setattr, -}; - static struct vfsmount *secretmem_mnt; static struct file *secretmem_file_create(unsigned long flags) @@ -193,7 +177,6 @@ mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); mapping_set_unevictable(inode->i_mapping); - inode->i_op = &secretmem_iops; inode->i_mapping->a_ops = &secretmem_aops; /* pretend we are a normal file with zero size */ diff -u linux-oem-5.17-5.17.0/mm/slab.c linux-oem-5.17-5.17.0/mm/slab.c --- linux-oem-5.17-5.17.0/mm/slab.c +++ linux-oem-5.17-5.17.0/mm/slab.c @@ -3650,7 +3650,7 @@ #endif /* CONFIG_NUMA */ #ifdef CONFIG_PRINTK -void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) +void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) { struct kmem_cache *cachep; unsigned int objnr; reverted: --- linux-oem-5.17-5.17.0/mm/slab.h +++ linux-oem-5.17-5.17.0.orig/mm/slab.h @@ -851,7 +851,7 @@ void *kp_stack[KS_ADDRS_COUNT]; void *kp_free_stack[KS_ADDRS_COUNT]; }; +void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab); -void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab); #endif #ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR reverted: --- linux-oem-5.17-5.17.0/mm/slab_common.c +++ linux-oem-5.17-5.17.0.orig/mm/slab_common.c @@ -555,13 +555,6 @@ } EXPORT_SYMBOL_GPL(kmem_valid_obj); -static void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) -{ - if (__kfence_obj_info(kpp, object, slab)) - return; - __kmem_obj_info(kpp, object, slab); -} - /** * kmem_dump_obj - Print available slab provenance information * @object: slab object for which to find provenance information. @@ -597,8 +590,6 @@ pr_cont(" slab%s %s", cp, kp.kp_slab_cache->name); else pr_cont(" slab%s", cp); - if (is_kfence_address(object)) - pr_cont(" (kfence)"); if (kp.kp_objp) pr_cont(" start %px", kp.kp_objp); if (kp.kp_data_offset) reverted: --- linux-oem-5.17-5.17.0/mm/slob.c +++ linux-oem-5.17-5.17.0.orig/mm/slob.c @@ -463,7 +463,7 @@ } #ifdef CONFIG_PRINTK +void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) -void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) { kpp->kp_ptr = object; kpp->kp_slab = slab; reverted: --- linux-oem-5.17-5.17.0/mm/slub.c +++ linux-oem-5.17-5.17.0.orig/mm/slub.c @@ -4322,7 +4322,7 @@ } #ifdef CONFIG_PRINTK +void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) -void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) { void *base; int __maybe_unused i; reverted: --- linux-oem-5.17-5.17.0/mm/userfaultfd.c +++ linux-oem-5.17-5.17.0.orig/mm/userfaultfd.c @@ -72,15 +72,12 @@ _dst_pte = pte_mkdirty(_dst_pte); if (page_in_cache && !vm_shared) writable = false; + if (writable) { + if (wp_copy) + _dst_pte = pte_mkuffd_wp(_dst_pte); + else + _dst_pte = pte_mkwrite(_dst_pte); + } - - /* - * Always mark a PTE as write-protected when needed, regardless of - * VM_WRITE, which the user might change. - */ - if (wp_copy) - _dst_pte = pte_mkuffd_wp(_dst_pte); - else if (writable) - _dst_pte = pte_mkwrite(_dst_pte); dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl); reverted: --- linux-oem-5.17-5.17.0/mm/workingset.c +++ linux-oem-5.17-5.17.0.orig/mm/workingset.c @@ -354,7 +354,7 @@ mod_lruvec_state(lruvec, WORKINGSET_REFAULT_BASE + file, nr); + mem_cgroup_flush_stats(); - mem_cgroup_flush_stats_delayed(); /* * Compare the distance to the existing workingset size. We * don't activate pages that couldn't stay resident even if diff -u linux-oem-5.17-5.17.0/net/ax25/af_ax25.c linux-oem-5.17-5.17.0/net/ax25/af_ax25.c --- linux-oem-5.17-5.17.0/net/ax25/af_ax25.c +++ linux-oem-5.17-5.17.0/net/ax25/af_ax25.c @@ -1053,11 +1053,6 @@ ax25_destroy_socket(ax25); } if (ax25_dev) { - del_timer_sync(&ax25->timer); - del_timer_sync(&ax25->t1timer); - del_timer_sync(&ax25->t2timer); - del_timer_sync(&ax25->t3timer); - del_timer_sync(&ax25->idletimer); dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker); ax25_dev_put(ax25_dev); } diff -u linux-oem-5.17-5.17.0/net/bluetooth/hci_event.c linux-oem-5.17-5.17.0/net/bluetooth/hci_event.c --- linux-oem-5.17-5.17.0/net/bluetooth/hci_event.c +++ linux-oem-5.17-5.17.0/net/bluetooth/hci_event.c @@ -3067,9 +3067,13 @@ { struct hci_ev_conn_complete *ev = data; struct hci_conn *conn; - u8 status = ev->status; - bt_dev_dbg(hdev, "status 0x%2.2x", status); + if (__le16_to_cpu(ev->handle) > HCI_CONN_HANDLE_MAX) { + bt_dev_err(hdev, "Ignoring HCI_Connection_Complete for invalid handle"); + return; + } + + bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); hci_dev_lock(hdev); @@ -3118,14 +3122,8 @@ goto unlock; } - if (!status) { + if (!ev->status) { conn->handle = __le16_to_cpu(ev->handle); - if (conn->handle > HCI_CONN_HANDLE_MAX) { - bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", - conn->handle, HCI_CONN_HANDLE_MAX); - status = HCI_ERROR_INVALID_PARAMETERS; - goto done; - } if (conn->type == ACL_LINK) { conn->state = BT_CONFIG; @@ -3166,18 +3164,18 @@ hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), &cp); } + } else { + conn->state = BT_CLOSED; + if (conn->type == ACL_LINK) + mgmt_connect_failed(hdev, &conn->dst, conn->type, + conn->dst_type, ev->status); } if (conn->type == ACL_LINK) hci_sco_setup(conn, ev->status); -done: - if (status) { - conn->state = BT_CLOSED; - if (conn->type == ACL_LINK) - mgmt_connect_failed(hdev, &conn->dst, conn->type, - conn->dst_type, status); - hci_connect_cfm(conn, status); + if (ev->status) { + hci_connect_cfm(conn, ev->status); hci_conn_del(conn); } else if (ev->link_type == SCO_LINK) { switch (conn->setting & SCO_AIRMODE_MASK) { @@ -3187,7 +3185,7 @@ break; } - hci_connect_cfm(conn, status); + hci_connect_cfm(conn, ev->status); } unlock: @@ -4678,7 +4676,6 @@ { struct hci_ev_sync_conn_complete *ev = data; struct hci_conn *conn; - u8 status = ev->status; switch (ev->link_type) { case SCO_LINK: @@ -4693,7 +4690,12 @@ return; } - bt_dev_dbg(hdev, "status 0x%2.2x", status); + if (__le16_to_cpu(ev->handle) > HCI_CONN_HANDLE_MAX) { + bt_dev_err(hdev, "Ignoring HCI_Sync_Conn_Complete for invalid handle"); + return; + } + + bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); hci_dev_lock(hdev); @@ -4727,17 +4729,9 @@ goto unlock; } - switch (status) { + switch (ev->status) { case 0x00: conn->handle = __le16_to_cpu(ev->handle); - if (conn->handle > HCI_CONN_HANDLE_MAX) { - bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", - conn->handle, HCI_CONN_HANDLE_MAX); - status = HCI_ERROR_INVALID_PARAMETERS; - conn->state = BT_CLOSED; - break; - } - conn->state = BT_CONNECTED; conn->type = ev->link_type; @@ -4781,8 +4775,8 @@ } } - hci_connect_cfm(conn, status); - if (status) + hci_connect_cfm(conn, ev->status); + if (ev->status) hci_conn_del(conn); unlock: @@ -5533,6 +5527,11 @@ struct smp_irk *irk; u8 addr_type; + if (handle > HCI_CONN_HANDLE_MAX) { + bt_dev_err(hdev, "Ignoring HCI_LE_Connection_Complete for invalid handle"); + return; + } + hci_dev_lock(hdev); /* All controllers implicitly stop advertising in the event of a @@ -5604,12 +5603,6 @@ conn->dst_type = ev_bdaddr_type(hdev, conn->dst_type, NULL); - if (handle > HCI_CONN_HANDLE_MAX) { - bt_dev_err(hdev, "Invalid handle: 0x%4.4x > 0x%4.4x", handle, - HCI_CONN_HANDLE_MAX); - status = HCI_ERROR_INVALID_PARAMETERS; - } - if (status) { hci_le_conn_failed(conn, status); goto unlock; diff -u linux-oem-5.17-5.17.0/net/can/isotp.c linux-oem-5.17-5.17.0/net/can/isotp.c --- linux-oem-5.17-5.17.0/net/can/isotp.c +++ linux-oem-5.17-5.17.0/net/can/isotp.c @@ -866,7 +866,6 @@ struct canfd_frame *cf; int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0; int wait_tx_done = (so->opt.flags & CAN_ISOTP_WAIT_TX_DONE) ? 1 : 0; - s64 hrtimer_sec = 0; int off; int err; @@ -965,9 +964,7 @@ isotp_create_fframe(cf, so, ae); /* start timeout for FC */ - hrtimer_sec = 1; - hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0), - HRTIMER_MODE_REL_SOFT); + hrtimer_start(&so->txtimer, ktime_set(1, 0), HRTIMER_MODE_REL_SOFT); } /* send the first or only CAN frame */ @@ -980,11 +977,6 @@ if (err) { pr_notice_once("can-isotp: %s: can_send_ret %pe\n", __func__, ERR_PTR(err)); - - /* no transmission -> no timeout monitoring */ - if (hrtimer_sec) - hrtimer_cancel(&so->txtimer); - goto err_out_drop; } @@ -1146,11 +1138,6 @@ lock_sock(sk); - if (so->bound) { - err = -EINVAL; - goto out; - } - /* do not register frame reception for functional addressing */ if (so->opt.flags & CAN_ISOTP_SF_BROADCAST) do_rx_reg = 0; @@ -1162,4 +1149,8 @@ } + if (so->bound && addr->can_ifindex == so->ifindex && + rx_id == so->rxid && tx_id == so->txid) + goto out; + dev = dev_get_by_index(net, addr->can_ifindex); if (!dev) { @@ -1187,6 +1178,19 @@ dev_put(dev); + if (so->bound && do_rx_reg) { + /* unregister old filter */ + if (so->ifindex) { + dev = dev_get_by_index(net, so->ifindex); + if (dev) { + can_rx_unregister(net, dev, so->rxid, + SINGLE_MASK(so->rxid), + isotp_rcv, sk); + dev_put(dev); + } + } + } + /* switch to new settings */ so->ifindex = ifindex; so->rxid = rx_id; reverted: --- linux-oem-5.17-5.17.0/net/core/flow_dissector.c +++ linux-oem-5.17-5.17.0.orig/net/core/flow_dissector.c @@ -1182,7 +1182,6 @@ VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; } key_vlan->vlan_tpid = saved_vlan_tpid; - key_vlan->vlan_eth_type = proto; } fdret = FLOW_DISSECT_RET_PROTO_AGAIN; reverted: --- linux-oem-5.17-5.17.0/net/core/lwt_bpf.c +++ linux-oem-5.17-5.17.0.orig/net/core/lwt_bpf.c @@ -159,8 +159,10 @@ return dst->lwtstate->orig_output(net, sk, skb); } +static int xmit_check_hhlen(struct sk_buff *skb) -static int xmit_check_hhlen(struct sk_buff *skb, int hh_len) { + int hh_len = skb_dst(skb)->dev->hard_header_len; + if (skb_headroom(skb) < hh_len) { int nhead = HH_DATA_ALIGN(hh_len - skb_headroom(skb)); @@ -272,7 +274,6 @@ bpf = bpf_lwt_lwtunnel(dst->lwtstate); if (bpf->xmit.prog) { - int hh_len = dst->dev->hard_header_len; __be16 proto = skb->protocol; int ret; @@ -290,7 +291,7 @@ /* If the header was expanded, headroom might be too * small for L2 header to come, expand as needed. */ + ret = xmit_check_hhlen(skb); - ret = xmit_check_hhlen(skb, hh_len); if (unlikely(ret)) return ret; diff -u linux-oem-5.17-5.17.0/net/dsa/dsa2.c linux-oem-5.17-5.17.0/net/dsa/dsa2.c --- linux-oem-5.17-5.17.0/net/dsa/dsa2.c +++ linux-oem-5.17-5.17.0/net/dsa/dsa2.c @@ -561,6 +561,7 @@ struct devlink_port *dlp = &dp->devlink_port; struct dsa_switch *ds = dp->ds; struct dsa_mac_addr *a, *tmp; + struct net_device *slave; if (!dp->setup) return; @@ -582,9 +583,11 @@ dsa_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_USER: - if (dp->slave) { - dsa_slave_destroy(dp->slave); + slave = dp->slave; + + if (slave) { dp->slave = NULL; + dsa_slave_destroy(slave); } break; } @@ -1134,17 +1137,17 @@ if (err) goto teardown_cpu_ports; - err = dsa_tree_setup_ports(dst); + err = dsa_tree_setup_master(dst); if (err) goto teardown_switches; - err = dsa_tree_setup_master(dst); + err = dsa_tree_setup_ports(dst); if (err) - goto teardown_ports; + goto teardown_master; err = dsa_tree_setup_lags(dst); if (err) - goto teardown_master; + goto teardown_ports; dst->setup = true; @@ -1152,10 +1155,10 @@ return 0; -teardown_master: - dsa_tree_teardown_master(dst); teardown_ports: dsa_tree_teardown_ports(dst); +teardown_master: + dsa_tree_teardown_master(dst); teardown_switches: dsa_tree_teardown_switches(dst); teardown_cpu_ports: @@ -1173,10 +1176,10 @@ dsa_tree_teardown_lags(dst); - dsa_tree_teardown_master(dst); - dsa_tree_teardown_ports(dst); + dsa_tree_teardown_master(dst); + dsa_tree_teardown_switches(dst); dsa_tree_teardown_cpu_ports(dst); reverted: --- linux-oem-5.17-5.17.0/net/dsa/port.c +++ linux-oem-5.17-5.17.0.orig/net/dsa/port.c @@ -1240,10 +1240,8 @@ if (ds->ops->phylink_mac_link_down) ds->ops->phylink_mac_link_down(ds, port, MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); - of_node_put(phy_np); return dsa_port_phylink_register(dp); } - of_node_put(phy_np); return 0; } reverted: --- linux-oem-5.17-5.17.0/net/dsa/tag_hellcreek.c +++ linux-oem-5.17-5.17.0.orig/net/dsa/tag_hellcreek.c @@ -21,14 +21,6 @@ struct dsa_port *dp = dsa_slave_to_port(dev); u8 *tag; - /* Calculate checksums (if required) before adding the trailer tag to - * avoid including it in calculations. That would lead to wrong - * checksums after the switch strips the tag. - */ - if (skb->ip_summed == CHECKSUM_PARTIAL && - skb_checksum_help(skb)) - return NULL; - /* Tag encoding */ tag = skb_put(skb, HELLCREEK_TAG_LEN); *tag = BIT(dp->index); reverted: --- linux-oem-5.17-5.17.0/net/ipv4/esp4.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/esp4.c @@ -446,6 +446,7 @@ struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; /* this is non-NULL only with TCP/UDP Encapsulation */ if (x->encap) { @@ -455,8 +456,8 @@ return err; } + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) - if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE || - ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE) goto cow; if (!skb_cloned(skb)) { reverted: --- linux-oem-5.17-5.17.0/net/ipv4/igmp.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/igmp.c @@ -2403,10 +2403,9 @@ /* decrease mem now to avoid the memleak warning */ atomic_sub(struct_size(psl, sl_addr, psl->sl_max), &sk->sk_omem_alloc); + kfree_rcu(psl, rcu); } rcu_assign_pointer(pmc->sflist, newpsl); - if (psl) - kfree_rcu(psl, rcu); psl = newpsl; } rv = 1; /* > 0 for insert logic below if sl_count is 0 */ @@ -2508,13 +2507,11 @@ /* decrease mem now to avoid the memleak warning */ atomic_sub(struct_size(psl, sl_addr, psl->sl_max), &sk->sk_omem_alloc); + kfree_rcu(psl, rcu); + } else - } else { (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode, 0, NULL, 0); - } rcu_assign_pointer(pmc->sflist, newpsl); - if (psl) - kfree_rcu(psl, rcu); pmc->sfmode = msf->imsf_fmode; err = 0; done: reverted: --- linux-oem-5.17-5.17.0/net/ipv4/ip_gre.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/ip_gre.c @@ -459,12 +459,14 @@ __be16 proto) { struct ip_tunnel *tunnel = netdev_priv(dev); + + if (tunnel->parms.o_flags & TUNNEL_SEQ) + tunnel->o_seqno++; - __be16 flags = tunnel->parms.o_flags; /* Push GRE header. */ gre_build_header(skb, tunnel->tun_hlen, + tunnel->parms.o_flags, proto, tunnel->parms.o_key, + htonl(tunnel->o_seqno)); - flags, proto, tunnel->parms.o_key, - (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) : 0); ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol); } @@ -502,7 +504,7 @@ (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ); gre_build_header(skb, tunnel_hlen, flags, proto, tunnel_id_to_key32(tun_info->key.tun_id), + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); - (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) : 0); ip_md_tunnel_xmit(skb, dev, IPPROTO_GRE, tunnel_hlen); @@ -579,7 +581,7 @@ } gre_build_header(skb, 8, TUNNEL_SEQ, + proto, 0, htonl(tunnel->o_seqno++)); - proto, 0, htonl(atomic_fetch_inc(&tunnel->o_seqno))); ip_md_tunnel_xmit(skb, dev, IPPROTO_GRE, tunnel_hlen); reverted: --- linux-oem-5.17-5.17.0/net/ipv4/syncookies.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/syncookies.c @@ -281,7 +281,6 @@ EXPORT_SYMBOL(cookie_ecn_ok); struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops, - const struct tcp_request_sock_ops *af_ops, struct sock *sk, struct sk_buff *skb) { @@ -298,10 +297,6 @@ return NULL; treq = tcp_rsk(req); - - /* treq->af_specific might be used to perform TCP_MD5 lookup */ - treq->af_specific = af_ops; - treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield; #if IS_ENABLED(CONFIG_MPTCP) treq->is_mptcp = sk_is_mptcp(sk); @@ -369,8 +364,7 @@ goto out; ret = NULL; + req = cookie_tcp_reqsk_alloc(&tcp_request_sock_ops, sk, skb); - req = cookie_tcp_reqsk_alloc(&tcp_request_sock_ops, - &tcp_request_sock_ipv4_ops, sk, skb); if (!req) goto out; reverted: --- linux-oem-5.17-5.17.0/net/ipv4/tcp_input.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/tcp_input.c @@ -3867,8 +3867,7 @@ tcp_process_tlp_ack(sk, ack, flag); if (tcp_ack_is_dubious(sk, flag)) { + if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) { - if (!(flag & (FLAG_SND_UNA_ADVANCED | - FLAG_NOT_DUP | FLAG_DSACKING_ACK))) { num_dupack = 1; /* Consider if pure acks were aggregated in tcp_add_backlog() */ if (!(flag & FLAG_DATA)) @@ -5438,17 +5437,7 @@ INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk); } +static void tcp_check_space(struct sock *sk) -/* Caller made space either from: - * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced) - * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt) - * - * We might be able to generate EPOLLOUT to the application if: - * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2 - * 2) notsent amount (tp->write_seq - tp->snd_nxt) became - * small enough that tcp_stream_memory_free() decides it - * is time to generate EPOLLOUT. - */ -void tcp_check_space(struct sock *sk) { /* pairs with tcp_poll() */ smp_mb(); reverted: --- linux-oem-5.17-5.17.0/net/ipv4/tcp_minisocks.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/tcp_minisocks.c @@ -531,7 +531,7 @@ newtp->tsoffset = treq->ts_off; #ifdef CONFIG_TCP_MD5SIG newtp->md5sig_info = NULL; /*XXX*/ + if (newtp->af_specific->md5_lookup(sk, newsk)) - if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req))) newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED; #endif if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len) diff -u linux-oem-5.17-5.17.0/net/ipv4/tcp_output.c linux-oem-5.17-5.17.0/net/ipv4/tcp_output.c --- linux-oem-5.17-5.17.0/net/ipv4/tcp_output.c +++ linux-oem-5.17-5.17.0/net/ipv4/tcp_output.c @@ -82,7 +82,6 @@ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT, tcp_skb_pcount(skb)); - tcp_check_space(sk); } /* SND.NXT, if window was not shrunk or the amount of shrunk was less than one reverted: --- linux-oem-5.17-5.17.0/net/ipv4/tcp_rate.c +++ linux-oem-5.17-5.17.0.orig/net/ipv4/tcp_rate.c @@ -74,32 +74,27 @@ * * If an ACK (s)acks multiple skbs (e.g., stretched-acks), this function is * called multiple times. We favor the information from the most recently + * sent skb, i.e., the skb with the highest prior_delivered count. - * sent skb, i.e., the skb with the most recently sent time and the highest - * sequence. */ void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb, struct rate_sample *rs) { struct tcp_sock *tp = tcp_sk(sk); struct tcp_skb_cb *scb = TCP_SKB_CB(skb); - u64 tx_tstamp; if (!scb->tx.delivered_mstamp) return; - tx_tstamp = tcp_skb_timestamp_us(skb); if (!rs->prior_delivered || + after(scb->tx.delivered, rs->prior_delivered)) { - tcp_skb_sent_after(tx_tstamp, tp->first_tx_mstamp, - scb->end_seq, rs->last_end_seq)) { rs->prior_delivered_ce = scb->tx.delivered_ce; rs->prior_delivered = scb->tx.delivered; rs->prior_mstamp = scb->tx.delivered_mstamp; rs->is_app_limited = scb->tx.is_app_limited; rs->is_retrans = scb->sacked & TCPCB_RETRANS; - rs->last_end_seq = scb->end_seq; /* Record send time of most recently ACKed packet: */ + tp->first_tx_mstamp = tcp_skb_timestamp_us(skb); - tp->first_tx_mstamp = tx_tstamp; /* Find the duration of the "send phase" of this window: */ rs->interval_us = tcp_stamp_us_delta(tp->first_tx_mstamp, scb->tx.first_tx_mstamp); reverted: --- linux-oem-5.17-5.17.0/net/ipv6/esp6.c +++ linux-oem-5.17-5.17.0.orig/net/ipv6/esp6.c @@ -482,6 +482,7 @@ struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; if (x->encap) { int err = esp6_output_encap(x, skb, esp); @@ -490,8 +491,8 @@ return err; } + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) - if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE || - ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE) goto cow; if (!skb_cloned(skb)) { reverted: --- linux-oem-5.17-5.17.0/net/ipv6/ip6_gre.c +++ linux-oem-5.17-5.17.0.orig/net/ipv6/ip6_gre.c @@ -724,7 +724,6 @@ { struct ip6_tnl *tunnel = netdev_priv(dev); __be16 protocol; - __be16 flags; if (dev->type == ARPHRD_ETHER) IPCB(skb)->flags = 0; @@ -734,13 +733,16 @@ else fl6->daddr = tunnel->parms.raddr; + if (skb_cow_head(skb, dev->needed_headroom ?: tunnel->hlen)) + return -ENOMEM; + /* Push GRE header. */ protocol = (dev->type == ARPHRD_ETHER) ? htons(ETH_P_TEB) : proto; if (tunnel->parms.collect_md) { struct ip_tunnel_info *tun_info; const struct ip_tunnel_key *key; + __be16 flags; - int tun_hlen; tun_info = skb_tunnel_info_txcheck(skb); if (IS_ERR(tun_info) || @@ -758,27 +760,21 @@ dsfield = key->tos; flags = key->tun_flags & (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ); + tunnel->tun_hlen = gre_calc_hlen(flags); - tun_hlen = gre_calc_hlen(flags); - - if (skb_cow_head(skb, dev->needed_headroom ?: tun_hlen + tunnel->encap_hlen)) - return -ENOMEM; + gre_build_header(skb, tunnel->tun_hlen, - gre_build_header(skb, tun_hlen, flags, protocol, tunnel_id_to_key32(tun_info->key.tun_id), + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) - (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) : 0); } else { + if (tunnel->parms.o_flags & TUNNEL_SEQ) + tunnel->o_seqno++; - if (skb_cow_head(skb, dev->needed_headroom ?: tunnel->hlen)) - return -ENOMEM; + gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, - flags = tunnel->parms.o_flags; - - gre_build_header(skb, tunnel->tun_hlen, flags, protocol, tunnel->parms.o_key, + htonl(tunnel->o_seqno)); - (flags & TUNNEL_SEQ) ? htonl(atomic_fetch_inc(&tunnel->o_seqno)) - : 0); } return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, @@ -1056,7 +1052,7 @@ /* Push GRE header. */ proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN) : htons(ETH_P_ERSPAN2); + gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(t->o_seqno++)); - gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(atomic_fetch_inc(&t->o_seqno))); /* TooBig packet may have updated dst->dev's mtu */ if (!t->parms.collect_md && dst && dst_mtu(dst) > dst->dev->mtu) diff -u linux-oem-5.17-5.17.0/net/ipv6/ip6_output.c linux-oem-5.17-5.17.0/net/ipv6/ip6_output.c --- linux-oem-5.17-5.17.0/net/ipv6/ip6_output.c +++ linux-oem-5.17-5.17.0/net/ipv6/ip6_output.c @@ -488,7 +488,7 @@ goto drop; if (!net->ipv6.devconf_all->disable_policy && - (!idev || !idev->cnf.disable_policy) && + !idev->cnf.disable_policy && !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); goto drop; reverted: --- linux-oem-5.17-5.17.0/net/ipv6/mcast.c +++ linux-oem-5.17-5.17.0.orig/net/ipv6/mcast.c @@ -460,10 +460,10 @@ newpsl->sl_addr[i] = psl->sl_addr[i]; atomic_sub(struct_size(psl, sl_addr, psl->sl_max), &sk->sk_omem_alloc); + kfree_rcu(psl, rcu); } - rcu_assign_pointer(pmc->sflist, newpsl); - kfree_rcu(psl, rcu); psl = newpsl; + rcu_assign_pointer(pmc->sflist, psl); } rv = 1; /* > 0 for insert logic below if sl_count is 0 */ for (i = 0; i < psl->sl_count; i++) { @@ -565,12 +565,12 @@ psl->sl_count, psl->sl_addr, 0); atomic_sub(struct_size(psl, sl_addr, psl->sl_max), &sk->sk_omem_alloc); + kfree_rcu(psl, rcu); } else { ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0); } + mutex_unlock(&idev->mc_lock); rcu_assign_pointer(pmc->sflist, newpsl); - mutex_unlock(&idev->mc_lock); - kfree_rcu(psl, rcu); pmc->sfmode = gsf->gf_fmode; err = 0; done: reverted: --- linux-oem-5.17-5.17.0/net/ipv6/netfilter.c +++ linux-oem-5.17-5.17.0.orig/net/ipv6/netfilter.c @@ -24,13 +24,14 @@ { const struct ipv6hdr *iph = ipv6_hdr(skb); struct sock *sk = sk_to_full_sk(sk_partial); - struct net_device *dev = skb_dst(skb)->dev; struct flow_keys flkeys; unsigned int hh_len; struct dst_entry *dst; int strict = (ipv6_addr_type(&iph->daddr) & (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); struct flowi6 fl6 = { + .flowi6_oif = sk && sk->sk_bound_dev_if ? sk->sk_bound_dev_if : + strict ? skb_dst(skb)->dev->ifindex : 0, .flowi6_mark = skb->mark, .flowi6_uid = sock_net_uid(net, sk), .daddr = iph->daddr, @@ -38,13 +39,6 @@ }; int err; - if (sk && sk->sk_bound_dev_if) - fl6.flowi6_oif = sk->sk_bound_dev_if; - else if (strict) - fl6.flowi6_oif = dev->ifindex; - else - fl6.flowi6_oif = l3mdev_master_ifindex(dev); - fib6_rules_early_flow_dissect(net, skb, &fl6, &flkeys); dst = ip6_route_output(net, sk, &fl6); err = dst->error; diff -u linux-oem-5.17-5.17.0/net/ipv6/route.c linux-oem-5.17-5.17.0/net/ipv6/route.c --- linux-oem-5.17-5.17.0/net/ipv6/route.c +++ linux-oem-5.17-5.17.0/net/ipv6/route.c @@ -3303,7 +3303,6 @@ int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout; unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc; - unsigned int val; int entries; entries = dst_entries_get_fast(ops); @@ -3314,13 +3313,13 @@ entries <= rt_max_size) goto out; - fib6_run_gc(atomic_inc_return(&net->ipv6.ip6_rt_gc_expire), net, true); + net->ipv6.ip6_rt_gc_expire++; + fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true); entries = dst_entries_get_slow(ops); if (entries < ops->gc_thresh) - atomic_set(&net->ipv6.ip6_rt_gc_expire, rt_gc_timeout >> 1); + net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; out: - val = atomic_read(&net->ipv6.ip6_rt_gc_expire); - atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity)); + net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity; return entries > rt_max_size; } @@ -6515,7 +6514,7 @@ net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; net->ipv6.sysctl.skip_notify_on_dev_down = 0; - atomic_set(&net->ipv6.ip6_rt_gc_expire, 30*HZ); + net->ipv6.ip6_rt_gc_expire = 30*HZ; ret = 0; out: reverted: --- linux-oem-5.17-5.17.0/net/ipv6/syncookies.c +++ linux-oem-5.17-5.17.0.orig/net/ipv6/syncookies.c @@ -170,8 +170,7 @@ goto out; ret = NULL; + req = cookie_tcp_reqsk_alloc(&tcp6_request_sock_ops, sk, skb); - req = cookie_tcp_reqsk_alloc(&tcp6_request_sock_ops, - &tcp_request_sock_ipv6_ops, sk, skb); if (!req) goto out; reverted: --- linux-oem-5.17-5.17.0/net/l3mdev/l3mdev.c +++ linux-oem-5.17-5.17.0.orig/net/l3mdev/l3mdev.c @@ -147,7 +147,7 @@ dev = dev_get_by_index_rcu(net, ifindex); while (dev && !netif_is_l3_master(dev)) + dev = netdev_master_upper_dev_get(dev); - dev = netdev_master_upper_dev_get_rcu(dev); return dev ? dev->ifindex : 0; } reverted: --- linux-oem-5.17-5.17.0/net/mac80211/debugfs_sta.c +++ linux-oem-5.17-5.17.0.orig/net/mac80211/debugfs_sta.c @@ -441,7 +441,7 @@ #define PRINT_HT_CAP(_cond, _str) \ do { \ if (_cond) \ + p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \ - p += scnprintf(p, bufsz + buf - p, "\t" _str "\n"); \ } while (0) char *buf, *p; int i; diff -u linux-oem-5.17-5.17.0/net/mctp/device.c linux-oem-5.17-5.17.0/net/mctp/device.c --- linux-oem-5.17-5.17.0/net/mctp/device.c +++ linux-oem-5.17-5.17.0/net/mctp/device.c @@ -312,7 +312,6 @@ void mctp_dev_put(struct mctp_dev *mdev) { if (mdev && refcount_dec_and_test(&mdev->refs)) { - kfree(mdev->addrs); dev_put(mdev->dev); kfree_rcu(mdev, rcu); } @@ -441,6 +440,7 @@ mctp_route_remove_dev(mdev); mctp_neigh_remove_dev(mdev); + kfree(mdev->addrs); mctp_dev_put(mdev); } reverted: --- linux-oem-5.17-5.17.0/net/netfilter/ipvs/ip_vs_conn.c +++ linux-oem-5.17-5.17.0.orig/net/netfilter/ipvs/ip_vs_conn.c @@ -1495,7 +1495,7 @@ pr_info("Connection hash table configured " "(size=%d, memory=%ldKbytes)\n", ip_vs_conn_tab_size, + (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024); - (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024); IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n", sizeof(struct ip_vs_conn)); diff -u linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_proto_tcp.c linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_proto_tcp.c --- linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_proto_tcp.c +++ linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_proto_tcp.c @@ -556,14 +556,24 @@ } } - } else if (tcph->syn && - after(end, sender->td_end) && - (state->state == TCP_CONNTRACK_SYN_SENT || - state->state == TCP_CONNTRACK_SYN_RECV)) { + } else if (((state->state == TCP_CONNTRACK_SYN_SENT + && dir == IP_CT_DIR_ORIGINAL) + || (state->state == TCP_CONNTRACK_SYN_RECV + && dir == IP_CT_DIR_REPLY)) + && after(end, sender->td_end)) { /* * RFC 793: "if a TCP is reinitialized ... then it need * not wait at all; it must only be sure to use sequence * numbers larger than those recently used." + */ + sender->td_end = + sender->td_maxend = end; + sender->td_maxwin = (win == 0 ? 1 : win); + + tcp_options(skb, dataoff, tcph, sender); + } else if (tcph->syn && dir == IP_CT_DIR_REPLY && + state->state == TCP_CONNTRACK_SYN_SENT) { + /* Retransmitted syn-ack, or syn (simultaneous open). * * Re-init state for this direction, just like for the first * syn(-ack) reply, it might differ in seq, ack or tcp options. @@ -571,8 +581,7 @@ tcp_init_sender(sender, receiver, skb, dataoff, tcph, end, win); - - if (dir == IP_CT_DIR_REPLY && !tcph->ack) + if (!tcph->ack) return true; } diff -u linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_standalone.c linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_standalone.c --- linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_standalone.c +++ linux-oem-5.17-5.17.0/net/netfilter/nf_conntrack_standalone.c @@ -824,7 +824,7 @@ .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, -#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) +#if IS_ENABLED(CONFIG_NFT_FLOW_OFFLOAD) [NF_SYSCTL_CT_PROTO_TIMEOUT_UDP_OFFLOAD] = { .procname = "nf_flowtable_udp_timeout", .maxlen = sizeof(unsigned int), diff -u linux-oem-5.17-5.17.0/net/netfilter/nf_tables_api.c linux-oem-5.17-5.17.0/net/netfilter/nf_tables_api.c --- linux-oem-5.17-5.17.0/net/netfilter/nf_tables_api.c +++ linux-oem-5.17-5.17.0/net/netfilter/nf_tables_api.c @@ -9275,7 +9275,7 @@ } EXPORT_SYMBOL_GPL(nft_parse_u32_check); -static int nft_parse_register(const struct nlattr *attr, u32 *preg) +static unsigned int nft_parse_register(const struct nlattr *attr, u32 *preg) { unsigned int reg; reverted: --- linux-oem-5.17-5.17.0/net/netfilter/nft_set_rbtree.c +++ linux-oem-5.17-5.17.0.orig/net/netfilter/nft_set_rbtree.c @@ -349,11 +349,7 @@ *ext = &rbe->ext; return -EEXIST; } else { + p = &parent->rb_left; - overlap = false; - if (nft_rbtree_interval_end(rbe)) - p = &parent->rb_left; - else - p = &parent->rb_right; } } reverted: --- linux-oem-5.17-5.17.0/net/netfilter/nft_socket.c +++ linux-oem-5.17-5.17.0.orig/net/netfilter/nft_socket.c @@ -36,11 +36,12 @@ #ifdef CONFIG_SOCK_CGROUP_DATA static noinline bool +nft_sock_get_eval_cgroupv2(u32 *dest, const struct nft_pktinfo *pkt, u32 level) -nft_sock_get_eval_cgroupv2(u32 *dest, struct sock *sk, const struct nft_pktinfo *pkt, u32 level) { + struct sock *sk = skb_to_full_sk(pkt->skb); struct cgroup *cgrp; + if (!sk || !sk_fullsock(sk) || !net_eq(nft_net(pkt), sock_net(sk))) - if (!sk_fullsock(sk)) return false; cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); @@ -53,32 +54,6 @@ } #endif -static struct sock *nft_socket_do_lookup(const struct nft_pktinfo *pkt) -{ - const struct net_device *indev = nft_in(pkt); - const struct sk_buff *skb = pkt->skb; - struct sock *sk = NULL; - - if (!indev) - return NULL; - - switch (nft_pf(pkt)) { - case NFPROTO_IPV4: - sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, indev); - break; -#if IS_ENABLED(CONFIG_NF_TABLES_IPV6) - case NFPROTO_IPV6: - sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, indev); - break; -#endif - default: - WARN_ON_ONCE(1); - break; - } - - return sk; -} - static void nft_socket_eval(const struct nft_expr *expr, struct nft_regs *regs, const struct nft_pktinfo *pkt) @@ -92,7 +67,20 @@ sk = NULL; if (!sk) + switch(nft_pf(pkt)) { + case NFPROTO_IPV4: + sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, nft_in(pkt)); + break; +#if IS_ENABLED(CONFIG_NF_TABLES_IPV6) + case NFPROTO_IPV6: + sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, nft_in(pkt)); + break; +#endif + default: + WARN_ON_ONCE(1); + regs->verdict.code = NFT_BREAK; + return; + } - sk = nft_socket_do_lookup(pkt); if (!sk) { regs->verdict.code = NFT_BREAK; @@ -120,7 +108,7 @@ break; #ifdef CONFIG_SOCK_CGROUP_DATA case NFT_SOCKET_CGROUPV2: + if (!nft_sock_get_eval_cgroupv2(dest, pkt, priv->level)) { - if (!nft_sock_get_eval_cgroupv2(dest, sk, pkt, priv->level)) { regs->verdict.code = NFT_BREAK; return; } @@ -210,16 +198,6 @@ return 0; } -static int nft_socket_validate(const struct nft_ctx *ctx, - const struct nft_expr *expr, - const struct nft_data **data) -{ - return nft_chain_validate_hooks(ctx->chain, - (1 << NF_INET_PRE_ROUTING) | - (1 << NF_INET_LOCAL_IN) | - (1 << NF_INET_LOCAL_OUT)); -} - static struct nft_expr_type nft_socket_type; static const struct nft_expr_ops nft_socket_ops = { .type = &nft_socket_type, @@ -227,7 +205,6 @@ .eval = nft_socket_eval, .init = nft_socket_init, .dump = nft_socket_dump, - .validate = nft_socket_validate, }; static struct nft_expr_type nft_socket_type __read_mostly = { diff -u linux-oem-5.17-5.17.0/net/netlink/af_netlink.c linux-oem-5.17-5.17.0/net/netlink/af_netlink.c --- linux-oem-5.17-5.17.0/net/netlink/af_netlink.c +++ linux-oem-5.17-5.17.0/net/netlink/af_netlink.c @@ -2263,13 +2263,6 @@ * single netdev. The outcome is MSG_TRUNC error. */ skb_reserve(skb, skb_tailroom(skb) - alloc_size); - - /* Make sure malicious BPF programs can not read unitialized memory - * from skb->head -> skb->data - */ - skb_reset_network_header(skb); - skb_reset_mac_header(skb); - netlink_skb_set_owner_r(skb, sk); if (nlk->dump_done_errno > 0) { reverted: --- linux-oem-5.17-5.17.0/net/nfc/core.c +++ linux-oem-5.17-5.17.0.orig/net/nfc/core.c @@ -38,7 +38,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -94,7 +94,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -142,7 +142,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -207,7 +207,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -246,7 +246,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -291,7 +291,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -335,7 +335,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -401,7 +401,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -448,7 +448,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -495,7 +495,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; kfree_skb(skb); goto error; @@ -552,7 +552,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -601,7 +601,7 @@ device_lock(&dev->dev); + if (!device_is_registered(&dev->dev)) { - if (dev->shutting_down) { rc = -ENODEV; goto error; } @@ -1134,7 +1134,6 @@ dev->rfkill = NULL; } } - dev->shutting_down = false; device_unlock(&dev->dev); rc = nfc_genl_device_added(dev); @@ -1167,10 +1166,12 @@ rfkill_unregister(dev->rfkill); rfkill_destroy(dev->rfkill); } - dev->shutting_down = true; device_unlock(&dev->dev); if (dev->ops->check_presence) { + device_lock(&dev->dev); + dev->shutting_down = true; + device_unlock(&dev->dev); del_timer_sync(&dev->check_pres_timer); cancel_work_sync(&dev->check_pres_work); } reverted: --- linux-oem-5.17-5.17.0/net/nfc/nci/core.c +++ linux-oem-5.17-5.17.0.orig/net/nfc/nci/core.c @@ -560,10 +560,6 @@ mutex_lock(&ndev->req_lock); if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { - /* Need to flush the cmd wq in case - * there is a queued/running cmd_work - */ - flush_workqueue(ndev->cmd_wq); del_timer_sync(&ndev->cmd_timer); del_timer_sync(&ndev->data_timer); mutex_unlock(&ndev->req_lock); reverted: --- linux-oem-5.17-5.17.0/net/nfc/netlink.c +++ linux-oem-5.17-5.17.0.orig/net/nfc/netlink.c @@ -1244,7 +1244,7 @@ struct sk_buff *msg; void *hdr; + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); if (!msg) return -ENOMEM; @@ -1260,7 +1260,7 @@ genlmsg_end(msg, hdr); + genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); - genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); return 0; diff -u linux-oem-5.17-5.17.0/net/openvswitch/flow_netlink.c linux-oem-5.17-5.17.0/net/openvswitch/flow_netlink.c --- linux-oem-5.17-5.17.0/net/openvswitch/flow_netlink.c +++ linux-oem-5.17-5.17.0/net/openvswitch/flow_netlink.c @@ -2436,7 +2436,7 @@ new_acts_size = max(next_offset + req_size, ksize(*sfa) * 2); if (new_acts_size > MAX_ACTIONS_BUFSIZE) { - if ((next_offset + req_size) > MAX_ACTIONS_BUFSIZE) { + if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) { OVS_NLERR(log, "Flow action size exceeds max %u", MAX_ACTIONS_BUFSIZE); return ERR_PTR(-EMSGSIZE); reverted: --- linux-oem-5.17-5.17.0/net/packet/af_packet.c +++ linux-oem-5.17-5.17.0.orig/net/packet/af_packet.c @@ -2856,9 +2856,8 @@ status = TP_STATUS_SEND_REQUEST; err = po->xmit(skb); + if (unlikely(err > 0)) { + err = net_xmit_errno(err); - if (unlikely(err != 0)) { - if (err > 0) - err = net_xmit_errno(err); if (err && __packet_get_status(po, ph) == TP_STATUS_AVAILABLE) { /* skb was destructed already */ @@ -3059,12 +3058,8 @@ skb->no_fcs = 1; err = po->xmit(skb); + if (err > 0 && (err = net_xmit_errno(err)) != 0) + goto out_unlock; - if (unlikely(err != 0)) { - if (err > 0) - err = net_xmit_errno(err); - if (err) - goto out_unlock; - } dev_put(dev); reverted: --- linux-oem-5.17-5.17.0/net/rds/tcp.c +++ linux-oem-5.17-5.17.0.orig/net/rds/tcp.c @@ -495,14 +495,6 @@ tcp_sock_set_nodelay(sock->sk); lock_sock(sk); - /* TCP timer functions might access net namespace even after - * a process which created this net namespace terminated. - */ - if (!sk->sk_net_refcnt) { - sk->sk_net_refcnt = 1; - get_net_track(net, &sk->ns_tracker, GFP_KERNEL); - sock_inuse_add(net, 1); - } if (rtn->sndbuf_size > 0) { sk->sk_sndbuf = rtn->sndbuf_size; sk->sk_userlocks |= SOCK_SNDBUF_LOCK; reverted: --- linux-oem-5.17-5.17.0/net/rxrpc/local_object.c +++ linux-oem-5.17-5.17.0.orig/net/rxrpc/local_object.c @@ -117,7 +117,6 @@ local, srx->transport_type, srx->transport.family); udp_conf.family = srx->transport.family; - udp_conf.use_udp_checksums = true; if (udp_conf.family == AF_INET) { udp_conf.local_ip = srx->transport.sin.sin_addr; udp_conf.local_udp_port = srx->transport.sin.sin_port; @@ -125,8 +124,6 @@ } else { udp_conf.local_ip6 = srx->transport.sin6.sin6_addr; udp_conf.local_udp_port = srx->transport.sin6.sin6_port; - udp_conf.use_udp6_tx_checksums = true; - udp_conf.use_udp6_rx_checksums = true; #endif } ret = udp_sock_create(net, &udp_conf, &local->socket); diff -u linux-oem-5.17-5.17.0/net/rxrpc/net_ns.c linux-oem-5.17-5.17.0/net/rxrpc/net_ns.c --- linux-oem-5.17-5.17.0/net/rxrpc/net_ns.c +++ linux-oem-5.17-5.17.0/net/rxrpc/net_ns.c @@ -113,9 +113,7 @@ struct rxrpc_net *rxnet = rxrpc_net(net); rxnet->live = false; - del_timer_sync(&rxnet->peer_keepalive_timer); cancel_work_sync(&rxnet->peer_keepalive_work); - /* Remove the timer again as the worker may have restarted it. */ del_timer_sync(&rxnet->peer_keepalive_timer); rxrpc_destroy_all_calls(rxnet); rxrpc_destroy_all_connections(rxnet); reverted: --- linux-oem-5.17-5.17.0/net/sched/cls_api.c +++ linux-oem-5.17-5.17.0.orig/net/sched/cls_api.c @@ -1653,10 +1653,10 @@ if (chain->flushing) return -EAGAIN; - RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); if (*chain_info->pprev == chain->filter_chain) tcf_chain0_head_change(chain, tp); tcf_proto_get(tp); + RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); rcu_assign_pointer(*chain_info->pprev, tp); return 0; reverted: --- linux-oem-5.17-5.17.0/net/sched/cls_flower.c +++ linux-oem-5.17-5.17.0.orig/net/sched/cls_flower.c @@ -1005,7 +1005,6 @@ static void fl_set_key_vlan(struct nlattr **tb, __be16 ethertype, int vlan_id_key, int vlan_prio_key, - int vlan_next_eth_type_key, struct flow_dissector_key_vlan *key_val, struct flow_dissector_key_vlan *key_mask) { @@ -1024,11 +1023,6 @@ } key_val->vlan_tpid = ethertype; key_mask->vlan_tpid = cpu_to_be16(~0); - if (tb[vlan_next_eth_type_key]) { - key_val->vlan_eth_type = - nla_get_be16(tb[vlan_next_eth_type_key]); - key_mask->vlan_eth_type = cpu_to_be16(~0); - } } static void fl_set_key_flag(u32 flower_key, u32 flower_mask, @@ -1525,9 +1519,8 @@ if (eth_type_vlan(ethertype)) { fl_set_key_vlan(tb, ethertype, TCA_FLOWER_KEY_VLAN_ID, + TCA_FLOWER_KEY_VLAN_PRIO, &key->vlan, + &mask->vlan); - TCA_FLOWER_KEY_VLAN_PRIO, - TCA_FLOWER_KEY_VLAN_ETH_TYPE, - &key->vlan, &mask->vlan); if (tb[TCA_FLOWER_KEY_VLAN_ETH_TYPE]) { ethertype = nla_get_be16(tb[TCA_FLOWER_KEY_VLAN_ETH_TYPE]); @@ -1535,7 +1528,6 @@ fl_set_key_vlan(tb, ethertype, TCA_FLOWER_KEY_CVLAN_ID, TCA_FLOWER_KEY_CVLAN_PRIO, - TCA_FLOWER_KEY_CVLAN_ETH_TYPE, &key->cvlan, &mask->cvlan); fl_set_key_val(tb, &key->basic.n_proto, TCA_FLOWER_KEY_CVLAN_ETH_TYPE, @@ -2894,13 +2886,13 @@ goto nla_put_failure; if (mask->basic.n_proto) { + if (mask->cvlan.vlan_tpid) { - if (mask->cvlan.vlan_eth_type) { if (nla_put_be16(skb, TCA_FLOWER_KEY_CVLAN_ETH_TYPE, key->basic.n_proto)) goto nla_put_failure; + } else if (mask->vlan.vlan_tpid) { - } else if (mask->vlan.vlan_eth_type) { if (nla_put_be16(skb, TCA_FLOWER_KEY_VLAN_ETH_TYPE, + key->basic.n_proto)) - key->vlan.vlan_eth_type)) goto nla_put_failure; } } diff -u linux-oem-5.17-5.17.0/net/sched/cls_u32.c linux-oem-5.17-5.17.0/net/sched/cls_u32.c --- linux-oem-5.17-5.17.0/net/sched/cls_u32.c +++ linux-oem-5.17-5.17.0/net/sched/cls_u32.c @@ -815,6 +815,10 @@ new->flags = n->flags; RCU_INIT_POINTER(new->ht_down, ht); + /* bump reference count as long as we hold pointer to structure */ + if (ht) + ht->refcnt++; + #ifdef CONFIG_CLS_U32_PERF /* Statistics may be incremented by readers during update * so we must keep them in tact. When the node is later destroyed @@ -836,10 +840,6 @@ return NULL; } - /* bump reference count as long as we hold pointer to structure */ - if (ht) - ht->refcnt++; - return new; } reverted: --- linux-oem-5.17-5.17.0/net/sched/sch_taprio.c +++ linux-oem-5.17-5.17.0.orig/net/sched/sch_taprio.c @@ -417,8 +417,7 @@ { struct taprio_sched *q = qdisc_priv(sch); + if (skb->sk && sock_flag(skb->sk, SOCK_TXTIME)) { - /* sk_flags are only safe to use on full sockets. */ - if (skb->sk && sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_TXTIME)) { if (!is_valid_interval(skb, sch)) return qdisc_drop(skb, sch, to_free); } else if (TXTIME_ASSIST_IS_ENABLED(q->flags)) { reverted: --- linux-oem-5.17-5.17.0/net/sctp/sm_sideeffect.c +++ linux-oem-5.17-5.17.0.orig/net/sctp/sm_sideeffect.c @@ -458,10 +458,6 @@ goto out_unlock; } - /* This happens when the response arrives after the timer is triggered. */ - if (!asoc->strreset_chunk) - goto out_unlock; - error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT, SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_RECONF), asoc->state, asoc->ep, asoc, diff -u linux-oem-5.17-5.17.0/net/sctp/sm_statefuns.c linux-oem-5.17-5.17.0/net/sctp/sm_statefuns.c --- linux-oem-5.17-5.17.0/net/sctp/sm_statefuns.c +++ linux-oem-5.17-5.17.0/net/sctp/sm_statefuns.c @@ -781,7 +781,7 @@ } } - if (security_sctp_assoc_request(new_asoc, chunk->head_skb ?: chunk->skb)) { + if (security_sctp_assoc_request(new_asoc, chunk->skb)) { sctp_association_free(new_asoc); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); } @@ -932,7 +932,7 @@ /* Set peer label for connection. */ if (security_sctp_assoc_established((struct sctp_association *)asoc, - chunk->head_skb ?: chunk->skb)) + chunk->skb)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* Verify that the chunk length for the COOKIE-ACK is OK. @@ -2262,7 +2262,7 @@ } /* Update socket peer label if first association. */ - if (security_sctp_assoc_request(new_asoc, chunk->head_skb ?: chunk->skb)) { + if (security_sctp_assoc_request(new_asoc, chunk->skb)) { sctp_association_free(new_asoc); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); } reverted: --- linux-oem-5.17-5.17.0/net/sctp/socket.c +++ linux-oem-5.17-5.17.0.orig/net/sctp/socket.c @@ -5636,7 +5636,7 @@ * Set the daddr and initialize id to something more random and also * copy over any ip options. */ + sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk); - sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sock->sk); sp->pf->copy_ip_options(sk, sock->sk); /* Populate the fields of the newsk from the oldsk and migrate the diff -u linux-oem-5.17-5.17.0/net/smc/af_smc.c linux-oem-5.17-5.17.0/net/smc/af_smc.c --- linux-oem-5.17-5.17.0/net/smc/af_smc.c +++ linux-oem-5.17-5.17.0/net/smc/af_smc.c @@ -1357,8 +1357,6 @@ smc->sk.sk_state = SMC_CLOSED; if (rc == -EPIPE || rc == -EAGAIN) smc->sk.sk_err = EPIPE; - else if (rc == -ECONNREFUSED) - smc->sk.sk_err = ECONNREFUSED; else if (signal_pending(current)) smc->sk.sk_err = -sock_intr_errno(timeo); sock_put(&smc->sk); /* passive closing */ @@ -2540,10 +2538,8 @@ if (smc->use_fallback) { rc = kernel_sock_shutdown(smc->clcsock, how); sk->sk_shutdown = smc->clcsock->sk->sk_shutdown; - if (sk->sk_shutdown == SHUTDOWN_MASK) { + if (sk->sk_shutdown == SHUTDOWN_MASK) sk->sk_state = SMC_CLOSED; - sock_put(sk); - } goto out; } switch (how) { reverted: --- linux-oem-5.17-5.17.0/net/smc/smc_clc.c +++ linux-oem-5.17-5.17.0.orig/net/smc/smc_clc.c @@ -191,8 +191,7 @@ flags, SMC_NETLINK_DUMP_UEID); if (!hdr) return -ENOMEM; + snprintf(ueid_str, sizeof(ueid_str), "%s", ueid); - memcpy(ueid_str, ueid, SMC_MAX_EID_LEN); - ueid_str[SMC_MAX_EID_LEN] = 0; if (nla_put_string(skb, SMC_NLA_EID_TABLE_ENTRY, ueid_str)) { genlmsg_cancel(skb, hdr); return -EMSGSIZE; @@ -253,8 +252,7 @@ goto end; smc_ism_get_system_eid(&seid); + snprintf(seid_str, sizeof(seid_str), "%s", seid); - memcpy(seid_str, seid, SMC_MAX_EID_LEN); - seid_str[SMC_MAX_EID_LEN] = 0; if (nla_put_string(skb, SMC_NLA_SEID_ENTRY, seid_str)) goto err; read_lock(&smc_clc_eid_table.lock); reverted: --- linux-oem-5.17-5.17.0/net/smc/smc_pnet.c +++ linux-oem-5.17-5.17.0.orig/net/smc/smc_pnet.c @@ -311,9 +311,8 @@ list_for_each_entry(ibdev, &smc_ib_devices.list, list) { if (!strncmp(ibdev->ibdev->name, ib_name, sizeof(ibdev->ibdev->name)) || + !strncmp(dev_name(ibdev->ibdev->dev.parent), ib_name, + IB_DEVICE_NAME_MAX - 1)) { - (ibdev->ibdev->dev.parent && - !strncmp(dev_name(ibdev->ibdev->dev.parent), ib_name, - IB_DEVICE_NAME_MAX - 1))) { goto out; } } diff -u linux-oem-5.17-5.17.0/net/sunrpc/clnt.c linux-oem-5.17-5.17.0/net/sunrpc/clnt.c --- linux-oem-5.17-5.17.0/net/sunrpc/clnt.c +++ linux-oem-5.17-5.17.0/net/sunrpc/clnt.c @@ -1065,13 +1065,10 @@ static void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt) { - if (task->tk_xprt) { - if (!(test_bit(XPRT_OFFLINE, &task->tk_xprt->state) && - (task->tk_flags & RPC_TASK_MOVEABLE))) - return; - xprt_release(task); - xprt_put(task->tk_xprt); - } + if (task->tk_xprt && + !(test_bit(XPRT_OFFLINE, &task->tk_xprt->state) && + (task->tk_flags & RPC_TASK_MOVEABLE))) + return; if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN) task->tk_xprt = rpc_task_get_first_xprt(clnt); else reverted: --- linux-oem-5.17-5.17.0/net/sunrpc/svc_xprt.c +++ linux-oem-5.17-5.17.0.orig/net/sunrpc/svc_xprt.c @@ -1213,8 +1213,6 @@ dr->daddr = rqstp->rq_daddr; dr->argslen = rqstp->rq_arg.len >> 2; dr->xprt_hlen = rqstp->rq_xprt_hlen; - dr->xprt_ctxt = rqstp->rq_xprt_ctxt; - rqstp->rq_xprt_ctxt = NULL; /* back up head to the start of the buffer and copy */ skip = rqstp->rq_arg.len - rqstp->rq_arg.head[0].iov_len; @@ -1253,7 +1251,6 @@ rqstp->rq_xprt_hlen = dr->xprt_hlen; rqstp->rq_daddr = dr->daddr; rqstp->rq_respages = rqstp->rq_pages; - rqstp->rq_xprt_ctxt = dr->xprt_ctxt; svc_xprt_received(rqstp->rq_xprt); return (dr->argslen<<2) - dr->xprt_hlen; } reverted: --- linux-oem-5.17-5.17.0/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ linux-oem-5.17-5.17.0.orig/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -831,7 +831,7 @@ goto out_err; if (ret == 0) goto out_drop; + rqstp->rq_xprt_hlen = ret; - rqstp->rq_xprt_hlen = 0; if (svc_rdma_is_reverse_direction_reply(xprt, ctxt)) goto out_backchannel; diff -u linux-oem-5.17-5.17.0/net/sunrpc/xprtsock.c linux-oem-5.17-5.17.0/net/sunrpc/xprtsock.c --- linux-oem-5.17-5.17.0/net/sunrpc/xprtsock.c +++ linux-oem-5.17-5.17.0/net/sunrpc/xprtsock.c @@ -1967,9 +1967,6 @@ struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); int ret; - if (transport->file) - goto force_disconnect; - if (RPC_IS_ASYNC(task)) { /* * We want the AF_LOCAL connect to be resolved in the @@ -1982,17 +1979,11 @@ */ task->tk_rpc_status = -ENOTCONN; rpc_exit(task, -ENOTCONN); - goto out_wake; + return; } ret = xs_local_setup_socket(transport); if (ret && !RPC_IS_SOFTCONN(task)) msleep_interruptible(15000); - return; -force_disconnect: - xprt_force_disconnect(xprt); -out_wake: - xprt_clear_connecting(xprt); - xprt_wake_pending_tasks(xprt, -ENOTCONN); } #if IS_ENABLED(CONFIG_SUNRPC_SWAP) @@ -2876,6 +2867,9 @@ } xprt_set_bound(xprt); xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); + ret = ERR_PTR(xs_local_setup_socket(transport)); + if (ret) + goto out_err; break; default: ret = ERR_PTR(-EAFNOSUPPORT); reverted: --- linux-oem-5.17-5.17.0/net/tls/tls_device.c +++ linux-oem-5.17-5.17.0.orig/net/tls/tls_device.c @@ -483,13 +483,11 @@ copy = min_t(size_t, size, (pfrag->size - pfrag->offset)); copy = min_t(size_t, copy, (max_open_record_len - record->len)); + rc = tls_device_copy_data(page_address(pfrag->page) + + pfrag->offset, copy, msg_iter); + if (rc) + goto handle_error; + tls_append_frag(record, pfrag, copy); - if (copy) { - rc = tls_device_copy_data(page_address(pfrag->page) + - pfrag->offset, copy, msg_iter); - if (rc) - goto handle_error; - tls_append_frag(record, pfrag, copy); - } size -= copy; if (!size) { reverted: --- linux-oem-5.17-5.17.0/net/wireless/nl80211.c +++ linux-oem-5.17-5.17.0.orig/net/wireless/nl80211.c @@ -519,8 +519,7 @@ .len = IEEE80211_MAX_MESH_ID_LEN }, [NL80211_ATTR_MPATH_NEXT_HOP] = NLA_POLICY_ETH_ADDR_COMPAT, + [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, - /* allow 3 for NUL-termination, we used to declare this NLA_STRING */ - [NL80211_ATTR_REG_ALPHA2] = NLA_POLICY_RANGE(NLA_BINARY, 2, 3), [NL80211_ATTR_REG_RULES] = { .type = NLA_NESTED }, [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, diff -u linux-oem-5.17-5.17.0/net/wireless/scan.c linux-oem-5.17-5.17.0/net/wireless/scan.c --- linux-oem-5.17-5.17.0/net/wireless/scan.c +++ linux-oem-5.17-5.17.0/net/wireless/scan.c @@ -2018,13 +2018,11 @@ /* this is a nontransmitting bss, we need to add it to * transmitting bss' list if it is not there */ - spin_lock_bh(&rdev->bss_lock); if (cfg80211_add_nontrans_list(non_tx_data->tx_bss, &res->pub)) { if (__cfg80211_unlink_bss(rdev, res)) rdev->bss_generation++; } - spin_unlock_bh(&rdev->bss_lock); } trace_cfg80211_return_bss(&res->pub); diff -u linux-oem-5.17-5.17.0/net/xdp/xsk.c linux-oem-5.17-5.17.0/net/xdp/xsk.c --- linux-oem-5.17-5.17.0/net/xdp/xsk.c +++ linux-oem-5.17-5.17.0/net/xdp/xsk.c @@ -640,7 +640,7 @@ if (sk_can_busy_loop(sk)) sk_busy_loop(sk, 1); /* only support non-blocking sockets */ - if (xs->zc && xsk_no_wakeup(sk)) + if (xsk_no_wakeup(sk)) return 0; pool = xs->pool; reverted: --- linux-oem-5.17-5.17.0/scripts/gcc-plugins/latent_entropy_plugin.c +++ linux-oem-5.17-5.17.0.orig/scripts/gcc-plugins/latent_entropy_plugin.c @@ -86,31 +86,25 @@ .help = "disable\tturn off latent entropy instrumentation\n", }; +static unsigned HOST_WIDE_INT seed; +/* + * get_random_seed() (this is a GCC function) generates the seed. + * This is a simple random generator without any cryptographic security because + * the entropy doesn't come from here. + */ -static unsigned HOST_WIDE_INT deterministic_seed; -static unsigned HOST_WIDE_INT rnd_buf[32]; -static size_t rnd_idx = ARRAY_SIZE(rnd_buf); -static int urandom_fd = -1; - static unsigned HOST_WIDE_INT get_random_const(void) { + unsigned int i; + unsigned HOST_WIDE_INT ret = 0; + + for (i = 0; i < 8 * sizeof(ret); i++) { + ret = (ret << 1) | (seed & 1); + seed >>= 1; + if (ret & 1) + seed ^= 0xD800000000000000ULL; - if (deterministic_seed) { - unsigned HOST_WIDE_INT w = deterministic_seed; - w ^= w << 13; - w ^= w >> 7; - w ^= w << 17; - deterministic_seed = w; - return deterministic_seed; } + return ret; - if (urandom_fd < 0) { - urandom_fd = open("/dev/urandom", O_RDONLY); - gcc_assert(urandom_fd >= 0); - } - if (rnd_idx >= ARRAY_SIZE(rnd_buf)) { - gcc_assert(read(urandom_fd, rnd_buf, sizeof(rnd_buf)) == sizeof(rnd_buf)); - rnd_idx = 0; - } - return rnd_buf[rnd_idx++]; } static tree tree_get_random_const(tree type) @@ -543,6 +537,8 @@ tree type, id; int quals; + seed = get_random_seed(false); + if (in_lto_p) return; @@ -577,12 +573,6 @@ const struct plugin_argument * const argv = plugin_info->argv; int i; - /* - * Call get_random_seed() with noinit=true, so that this returns - * 0 in the case where no seed has been passed via -frandom-seed. - */ - deterministic_seed = get_random_seed(true); - static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { { .base = &latent_entropy_decl, reverted: --- linux-oem-5.17-5.17.0/sound/core/init.c +++ linux-oem-5.17-5.17.0.orig/sound/core/init.c @@ -209,12 +209,6 @@ * snd_card_register(), the very first devres action to call snd_card_free() * is added automatically. In that way, the resource disconnection is assured * at first, then released in the expected order. - * - * If an error happens at the probe before snd_card_register() is called and - * there have been other devres resources, you'd need to free the card manually - * via snd_card_free() call in the error; otherwise it may lead to UAF due to - * devres call orders. You can use snd_card_free_on_error() helper for - * handling it more easily. */ int snd_devm_card_new(struct device *parent, int idx, const char *xid, struct module *module, size_t extra_size, @@ -241,28 +235,6 @@ } EXPORT_SYMBOL_GPL(snd_devm_card_new); -/** - * snd_card_free_on_error - a small helper for handling devm probe errors - * @dev: the managed device object - * @ret: the return code from the probe callback - * - * This function handles the explicit snd_card_free() call at the error from - * the probe callback. It's just a small helper for simplifying the error - * handling with the managed devices. - */ -int snd_card_free_on_error(struct device *dev, int ret) -{ - struct snd_card *card; - - if (!ret) - return 0; - card = devres_find(dev, __snd_card_release, NULL, NULL); - if (card) - snd_card_free(card); - return ret; -} -EXPORT_SYMBOL_GPL(snd_card_free_on_error); - static int snd_card_init(struct snd_card *card, struct device *parent, int idx, const char *xid, struct module *module, size_t extra_size) reverted: --- linux-oem-5.17-5.17.0/sound/core/memalloc.c +++ linux-oem-5.17-5.17.0.orig/sound/core/memalloc.c @@ -499,10 +499,6 @@ }; #endif /* CONFIG_X86 */ -#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 */ @@ -513,18 +509,8 @@ sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir, DEFAULT_GFP, 0); + if (!sgt) - if (!sgt) { -#ifdef CONFIG_SND_DMA_SGBUF - if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG) - dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK; - else - dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK; - return snd_dma_sg_fallback_alloc(dmab, size); -#else return NULL; -#endif - } - dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, sg_dma_address(sgt->sgl)); p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt); @@ -647,8 +633,6 @@ if (!p) return NULL; - if (dmab->dev.type != SNDRV_DMA_TYPE_DEV_WC_SG) - return p; for_each_sgtable_page(sgt, &iter, 0) set_memory_wc(sg_wc_address(&iter), 1); return p; @@ -681,95 +665,6 @@ .get_page = snd_dma_noncontig_get_page, .get_chunk_size = snd_dma_noncontig_get_chunk_size, }; - -/* Fallback SG-buffer allocations for x86 */ -struct snd_dma_sg_fallback { - size_t count; - struct page **pages; - dma_addr_t *addrs; -}; - -static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab, - struct snd_dma_sg_fallback *sgbuf) -{ - 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]); - kvfree(sgbuf->pages); - kvfree(sgbuf->addrs); - kfree(sgbuf); -} - -static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size) -{ - struct snd_dma_sg_fallback *sgbuf; - struct page **pages; - size_t i, count; - void *p; - - sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL); - if (!sgbuf) - return NULL; - count = PAGE_ALIGN(size) >> PAGE_SHIFT; - pages = kvcalloc(count, sizeof(*pages), GFP_KERNEL); - if (!pages) - goto error; - sgbuf->pages = pages; - sgbuf->addrs = kvcalloc(count, sizeof(*sgbuf->addrs), GFP_KERNEL); - if (!sgbuf->addrs) - goto error; - - for (i = 0; i < count; sgbuf->count++, i++) { - p = dma_alloc_coherent(dmab->dev.dev, PAGE_SIZE, - &sgbuf->addrs[i], DEFAULT_GFP); - 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; - return p; - - error: - __snd_dma_sg_fallback_free(dmab, sgbuf); - return NULL; -} - -static void snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab) -{ - vunmap(dmab->area); - __snd_dma_sg_fallback_free(dmab, dmab->private_data); -} - -static int snd_dma_sg_fallback_mmap(struct snd_dma_buffer *dmab, - struct vm_area_struct *area) -{ - struct snd_dma_sg_fallback *sgbuf = dmab->private_data; - - if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK) - area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); - return vm_map_pages(area, sgbuf->pages, sgbuf->count); -} - -static const struct snd_malloc_ops snd_dma_sg_fallback_ops = { - .alloc = snd_dma_sg_fallback_alloc, - .free = snd_dma_sg_fallback_free, - .mmap = snd_dma_sg_fallback_mmap, - /* reuse vmalloc helpers */ - .get_addr = snd_dma_vmalloc_get_addr, - .get_page = snd_dma_vmalloc_get_page, - .get_chunk_size = snd_dma_vmalloc_get_chunk_size, -}; #endif /* CONFIG_SND_DMA_SGBUF */ /* @@ -841,10 +736,6 @@ #ifdef CONFIG_GENERIC_ALLOCATOR [SNDRV_DMA_TYPE_DEV_IRAM] = &snd_dma_iram_ops, #endif /* CONFIG_GENERIC_ALLOCATOR */ -#ifdef CONFIG_SND_DMA_SGBUF - [SNDRV_DMA_TYPE_DEV_SG_FALLBACK] = &snd_dma_sg_fallback_ops, - [SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK] = &snd_dma_sg_fallback_ops, -#endif #endif /* CONFIG_HAS_DMA */ }; reverted: --- linux-oem-5.17-5.17.0/sound/core/pcm_misc.c +++ linux-oem-5.17-5.17.0.orig/sound/core/pcm_misc.c @@ -433,7 +433,7 @@ return 0; width = pcm_formats[(INT)format].phys; /* physical width */ pat = pcm_formats[(INT)format].silence; + if (! width) - if (!width || !pat) return -EINVAL; /* signed or 1 byte data */ if (pcm_formats[(INT)format].signd == 1 || width <= 8) { reverted: --- linux-oem-5.17-5.17.0/sound/drivers/mtpav.c +++ linux-oem-5.17-5.17.0.orig/sound/drivers/mtpav.c @@ -693,6 +693,8 @@ mtp_card->outmidihwport = 0xffffffff; timer_setup(&mtp_card->timer, snd_mtpav_output_timer, 0); + card->private_free = snd_mtpav_free; + err = snd_mtpav_get_RAWMIDI(mtp_card); if (err < 0) return err; @@ -714,8 +716,6 @@ if (err < 0) return err; - card->private_free = snd_mtpav_free; - platform_set_drvdata(dev, card); printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port); return 0; reverted: --- linux-oem-5.17-5.17.0/sound/firewire/fireworks/fireworks_hwdep.c +++ linux-oem-5.17-5.17.0.orig/sound/firewire/fireworks/fireworks_hwdep.c @@ -34,7 +34,6 @@ type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE; if (copy_to_user(buf, &type, sizeof(type))) return -EFAULT; - count += sizeof(type); remained -= sizeof(type); buf += sizeof(type); diff -u linux-oem-5.17-5.17.0/sound/hda/intel-dsp-config.c linux-oem-5.17-5.17.0/sound/hda/intel-dsp-config.c --- linux-oem-5.17-5.17.0/sound/hda/intel-dsp-config.c +++ linux-oem-5.17-5.17.0/sound/hda/intel-dsp-config.c @@ -390,48 +390,25 @@ /* Alder Lake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_ALDERLAKE) - /* Alderlake-S */ { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x7ad0, }, - /* RaptorLake-S */ - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x7a50, - }, - /* Alderlake-P */ { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c8, }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x51cd, - }, - /* Alderlake-PS */ - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x51c9, - }, - /* Alderlake-M */ - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51cc, }, - /* Alderlake-N */ - { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x54c8, - }, - /* RaptorLake-P */ { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x51ca, + .device = 0x51cd, }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, - .device = 0x51cb, + .device = 0x54c8, }, #endif reverted: --- linux-oem-5.17-5.17.0/sound/isa/galaxy/galaxy.c +++ linux-oem-5.17-5.17.0.orig/sound/isa/galaxy/galaxy.c @@ -478,7 +478,7 @@ galaxy_set_config(galaxy, galaxy->config); } +static int snd_galaxy_probe(struct device *dev, unsigned int n) -static int __snd_galaxy_probe(struct device *dev, unsigned int n) { struct snd_galaxy *galaxy; struct snd_wss *chip; @@ -598,11 +598,6 @@ return 0; } -static int snd_galaxy_probe(struct device *dev, unsigned int n) -{ - return snd_card_free_on_error(dev, __snd_galaxy_probe(dev, n)); -} - static struct isa_driver snd_galaxy_driver = { .match = snd_galaxy_match, .probe = snd_galaxy_probe, reverted: --- linux-oem-5.17-5.17.0/sound/isa/sc6000.c +++ linux-oem-5.17-5.17.0.orig/sound/isa/sc6000.c @@ -537,7 +537,7 @@ sc6000_setup_board(vport, 0); } +static int snd_sc6000_probe(struct device *devptr, unsigned int dev) -static int __snd_sc6000_probe(struct device *devptr, unsigned int dev) { static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; static const int possible_dmas[] = { 1, 3, 0, -1 }; @@ -662,11 +662,6 @@ return 0; } -static int snd_sc6000_probe(struct device *devptr, unsigned int dev) -{ - return snd_card_free_on_error(devptr, __snd_sc6000_probe(devptr, dev)); -} - static struct isa_driver snd_sc6000_driver = { .match = snd_sc6000_match, .probe = snd_sc6000_probe, reverted: --- linux-oem-5.17-5.17.0/sound/pci/ad1889.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/ad1889.c @@ -844,8 +844,8 @@ } static int +snd_ad1889_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -__snd_ad1889_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { int err; static int devno; @@ -904,12 +904,6 @@ return 0; } -static int snd_ad1889_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_ad1889_probe(pci, pci_id)); -} - static const struct pci_device_id snd_ad1889_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) }, { 0, }, reverted: --- linux-oem-5.17-5.17.0/sound/pci/ali5451/ali5451.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/ali5451/ali5451.c @@ -2124,8 +2124,8 @@ return 0; } +static int snd_ali_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_ali_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct snd_ali *codec; @@ -2170,12 +2170,6 @@ return 0; } -static int snd_ali_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_ali_probe(pci, pci_id)); -} - static struct pci_driver ali5451_driver = { .name = KBUILD_MODNAME, .id_table = snd_ali_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/als300.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/als300.c @@ -708,7 +708,7 @@ err = snd_als300_create(card, pci, chip_type); if (err < 0) + return err; - goto error; strcpy(card->driver, "ALS300"); if (chip->chip_type == DEVICE_ALS300_PLUS) @@ -723,15 +723,11 @@ err = snd_card_register(card); if (err < 0) + return err; - goto error; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver als300_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/als4000.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/als4000.c @@ -806,8 +806,8 @@ snd_als4000_free_gameport(acard); } +static int snd_card_als4000_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_card_als4000_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -930,12 +930,6 @@ return 0; } -static int snd_card_als4000_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_card_als4000_probe(pci, pci_id)); -} - #ifdef CONFIG_PM_SLEEP static int snd_als4000_suspend(struct device *dev) { reverted: --- linux-oem-5.17-5.17.0/sound/pci/atiixp.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/atiixp.c @@ -1572,8 +1572,8 @@ } +static int snd_atiixp_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_atiixp_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct atiixp *chip; @@ -1623,12 +1623,6 @@ return 0; } -static int snd_atiixp_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id)); -} - static struct pci_driver atiixp_driver = { .name = KBUILD_MODNAME, .id_table = snd_atiixp_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/atiixp_modem.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/atiixp_modem.c @@ -1201,8 +1201,8 @@ } +static int snd_atiixp_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_atiixp_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct atiixp_modem *chip; @@ -1247,12 +1247,6 @@ return 0; } -static int snd_atiixp_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id)); -} - static struct pci_driver atiixp_modem_driver = { .name = KBUILD_MODNAME, .id_table = snd_atiixp_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/au88x0/au88x0.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/au88x0/au88x0.c @@ -193,7 +193,7 @@ // constructor -- see "Constructor" sub-section static int +snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -__snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -310,12 +310,6 @@ return 0; } -static int -snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_vortex_probe(pci, pci_id)); -} - // pci_driver definition static struct pci_driver vortex_driver = { .name = KBUILD_MODNAME, reverted: --- linux-oem-5.17-5.17.0/sound/pci/aw2/aw2-alsa.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/aw2/aw2-alsa.c @@ -275,7 +275,7 @@ /* (3) Create main component */ err = snd_aw2_create(card, pci); if (err < 0) + return err; - goto error; /* initialize mutex */ mutex_init(&chip->mtx); @@ -294,17 +294,13 @@ /* (6) Register card instance */ err = snd_card_register(card); if (err < 0) + return err; - goto error; /* (7) Set PCI driver data */ pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } /* open callback */ reverted: --- linux-oem-5.17-5.17.0/sound/pci/azt3328.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/azt3328.c @@ -2427,7 +2427,7 @@ } static int +snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -__snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2520,12 +2520,6 @@ return 0; } -static int -snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_azf3328_probe(pci, pci_id)); -} - #ifdef CONFIG_PM_SLEEP static inline void snd_azf3328_suspend_regs(const struct snd_azf3328 *chip, reverted: --- linux-oem-5.17-5.17.0/sound/pci/bt87x.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/bt87x.c @@ -805,8 +805,8 @@ return SND_BT87X_BOARD_UNKNOWN; } +static int snd_bt87x_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_bt87x_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -889,12 +889,6 @@ return 0; } -static int snd_bt87x_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_bt87x_probe(pci, pci_id)); -} - /* default entries for all Bt87x cards - it's not exported */ /* driver_data is set to 0 to call detection */ static const struct pci_device_id snd_bt87x_default_ids[] = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/ca0106/ca0106_main.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/ca0106/ca0106_main.c @@ -1725,8 +1725,8 @@ } +static int snd_ca0106_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_ca0106_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1786,12 +1786,6 @@ return 0; } -static int snd_ca0106_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_ca0106_probe(pci, pci_id)); -} - #ifdef CONFIG_PM_SLEEP static int snd_ca0106_suspend(struct device *dev) { diff -u linux-oem-5.17-5.17.0/sound/pci/cmipci.c linux-oem-5.17-5.17.0/sound/pci/cmipci.c --- linux-oem-5.17-5.17.0/sound/pci/cmipci.c +++ linux-oem-5.17-5.17.0/sound/pci/cmipci.c @@ -3247,19 +3247,15 @@ err = snd_cmipci_create(card, pci, dev); if (err < 0) - goto error; + return err; err = snd_card_register(card); if (err < 0) - goto error; + return err; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } #ifdef CONFIG_PM_SLEEP reverted: --- linux-oem-5.17-5.17.0/sound/pci/cs4281.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/cs4281.c @@ -1827,8 +1827,8 @@ spin_unlock_irqrestore(&opl3->reg_lock, flags); } +static int snd_cs4281_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_cs4281_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1888,12 +1888,6 @@ return 0; } -static int snd_cs4281_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_cs4281_probe(pci, pci_id)); -} - /* * Power Management */ reverted: --- linux-oem-5.17-5.17.0/sound/pci/cs5535audio/cs5535audio.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/cs5535audio/cs5535audio.c @@ -281,8 +281,8 @@ return 0; } +static int snd_cs5535audio_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_cs5535audio_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -331,12 +331,6 @@ return 0; } -static int snd_cs5535audio_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_cs5535audio_probe(pci, pci_id)); -} - static struct pci_driver cs5535audio_driver = { .name = KBUILD_MODNAME, .id_table = snd_cs5535audio_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/echoaudio/echoaudio.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/echoaudio/echoaudio.c @@ -1970,8 +1970,8 @@ } /* constructor */ +static int snd_echo_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_echo_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2139,11 +2139,6 @@ return 0; } -static int snd_echo_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_echo_probe(pci, pci_id)); -} #if defined(CONFIG_PM_SLEEP) reverted: --- linux-oem-5.17-5.17.0/sound/pci/emu10k1/emu10k1x.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/emu10k1/emu10k1x.c @@ -1491,8 +1491,8 @@ return 0; } +static int snd_emu10k1x_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_emu10k1x_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1554,12 +1554,6 @@ return 0; } -static int snd_emu10k1x_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_emu10k1x_probe(pci, pci_id)); -} - // PCI IDs static const struct pci_device_id snd_emu10k1x_ids[] = { { PCI_VDEVICE(CREATIVE, 0x0006), 0 }, /* Dell OEM version (EMU10K1) */ reverted: --- linux-oem-5.17-5.17.0/sound/pci/ens1370.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/ens1370.c @@ -2304,8 +2304,8 @@ return IRQ_HANDLED; } +static int snd_audiopci_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_audiopci_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2369,12 +2369,6 @@ return 0; } -static int snd_audiopci_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_audiopci_probe(pci, pci_id)); -} - static struct pci_driver ens137x_driver = { .name = KBUILD_MODNAME, .id_table = snd_audiopci_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/es1938.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/es1938.c @@ -1716,8 +1716,8 @@ } +static int snd_es1938_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_es1938_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1796,12 +1796,6 @@ return 0; } -static int snd_es1938_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_es1938_probe(pci, pci_id)); -} - static struct pci_driver es1938_driver = { .name = KBUILD_MODNAME, .id_table = snd_es1938_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/es1968.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/es1968.c @@ -2741,8 +2741,8 @@ /* */ +static int snd_es1968_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_es1968_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2848,12 +2848,6 @@ return 0; } -static int snd_es1968_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_es1968_probe(pci, pci_id)); -} - static struct pci_driver es1968_driver = { .name = KBUILD_MODNAME, .id_table = snd_es1968_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/fm801.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/fm801.c @@ -1268,8 +1268,8 @@ return 0; } +static int snd_card_fm801_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_card_fm801_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1333,12 +1333,6 @@ return 0; } -static int snd_card_fm801_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_card_fm801_probe(pci, pci_id)); -} - #ifdef CONFIG_PM_SLEEP static const unsigned char saved_regs[] = { FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, reverted: --- linux-oem-5.17-5.17.0/sound/pci/hda/patch_cs8409-tables.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/hda/patch_cs8409-tables.c @@ -76,74 +76,67 @@ {} /* terminator */ }; -const struct hda_pintbl cs8409_cs42l42_pincfgs_no_dmic[] = { - { CS8409_PIN_ASP1_TRANSMITTER_A, 0x042120f0 }, /* ASP-1-TX */ - { CS8409_PIN_ASP1_RECEIVER_A, 0x04a12050 }, /* ASP-1-RX */ - { CS8409_PIN_ASP2_TRANSMITTER_A, 0x901000f0 }, /* ASP-2-TX */ - {} /* terminator */ -}; - /* Vendor specific HW configuration for CS42L42 */ static const struct cs8409_i2c_param cs42l42_init_reg_seq[] = { + { 0x1010, 0xB0 }, + { 0x1D01, 0x00 }, - { CS42L42_I2C_TIMEOUT, 0xB0 }, - { CS42L42_ADC_CTL, 0x00 }, { 0x1D02, 0x06 }, + { 0x1D03, 0x9F }, + { 0x1107, 0x01 }, + { 0x1009, 0x02 }, + { 0x1007, 0x03 }, + { 0x1201, 0x00 }, + { 0x1208, 0x13 }, + { 0x1205, 0xFF }, + { 0x1206, 0x00 }, + { 0x1207, 0x20 }, + { 0x1202, 0x0D }, + { 0x2A02, 0x02 }, + { 0x2A03, 0x00 }, + { 0x2A04, 0x00 }, + { 0x2A05, 0x02 }, + { 0x2A06, 0x00 }, + { 0x2A07, 0x20 }, + { 0x2A08, 0x02 }, + { 0x2A09, 0x00 }, + { 0x2A0A, 0x80 }, + { 0x2A0B, 0x02 }, + { 0x2A0C, 0x00 }, + { 0x2A0D, 0xA0 }, + { 0x2A01, 0x0C }, + { 0x2902, 0x01 }, + { 0x2903, 0x02 }, + { 0x2904, 0x00 }, + { 0x2905, 0x00 }, + { 0x2901, 0x01 }, + { 0x1101, 0x0A }, + { 0x1102, 0x84 }, + { 0x2301, 0x3F }, + { 0x2303, 0x3F }, + { 0x2302, 0x3f }, + { 0x2001, 0x03 }, + { 0x1B75, 0xB6 }, + { 0x1B73, 0xC2 }, + { 0x1129, 0x01 }, + { 0x1121, 0xF3 }, + { 0x1103, 0x20 }, + { 0x1105, 0x00 }, + { 0x1112, 0x00 }, + { 0x1113, 0x80 }, + { 0x1C03, 0xC0 }, + { 0x1101, 0x02 }, + { 0x1316, 0xff }, + { 0x1317, 0xff }, + { 0x1318, 0xff }, + { 0x1319, 0xff }, + { 0x131a, 0xff }, + { 0x131b, 0xff }, + { 0x131c, 0xff }, + { 0x131e, 0xff }, + { 0x131f, 0xff }, + { 0x1320, 0xff }, + { 0x1b79, 0xff }, + { 0x1b7a, 0xff }, - { CS42L42_ADC_VOLUME, 0x9F }, - { CS42L42_OSC_SWITCH, 0x01 }, - { CS42L42_MCLK_CTL, 0x02 }, - { CS42L42_SRC_CTL, 0x03 }, - { CS42L42_MCLK_SRC_SEL, 0x00 }, - { CS42L42_ASP_FRM_CFG, 0x13 }, - { CS42L42_FSYNC_P_LOWER, 0xFF }, - { CS42L42_FSYNC_P_UPPER, 0x00 }, - { CS42L42_ASP_CLK_CFG, 0x20 }, - { CS42L42_SPDIF_CLK_CFG, 0x0D }, - { CS42L42_ASP_RX_DAI0_CH1_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_LSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH2_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_LSB, 0x20 }, - { CS42L42_ASP_RX_DAI0_CH3_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH3_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH3_BIT_LSB, 0x80 }, - { CS42L42_ASP_RX_DAI0_CH4_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH4_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH4_BIT_LSB, 0xA0 }, - { CS42L42_ASP_RX_DAI0_EN, 0x0C }, - { CS42L42_ASP_TX_CH_EN, 0x01 }, - { CS42L42_ASP_TX_CH_AP_RES, 0x02 }, - { CS42L42_ASP_TX_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_TX_CH1_BIT_LSB, 0x00 }, - { CS42L42_ASP_TX_SZ_EN, 0x01 }, - { CS42L42_PWR_CTL1, 0x0A }, - { CS42L42_PWR_CTL2, 0x84 }, - { CS42L42_MIXER_CHA_VOL, 0x3F }, - { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_MIXER_ADC_VOL, 0x3f }, - { CS42L42_HP_CTL, 0x03 }, - { CS42L42_MIC_DET_CTL1, 0xB6 }, - { CS42L42_TIPSENSE_CTL, 0xC2 }, - { CS42L42_HS_CLAMP_DISABLE, 0x01 }, - { CS42L42_HS_SWITCH_CTL, 0xF3 }, - { CS42L42_PWR_CTL3, 0x20 }, - { CS42L42_RSENSE_CTL2, 0x00 }, - { CS42L42_RSENSE_CTL3, 0x00 }, - { CS42L42_TSENSE_CTL, 0x80 }, - { CS42L42_HS_BIAS_CTL, 0xC0 }, - { CS42L42_PWR_CTL1, 0x02 }, - { CS42L42_ADC_OVFL_INT_MASK, 0xff }, - { CS42L42_MIXER_INT_MASK, 0xff }, - { CS42L42_SRC_INT_MASK, 0xff }, - { CS42L42_ASP_RX_INT_MASK, 0xff }, - { CS42L42_ASP_TX_INT_MASK, 0xff }, - { CS42L42_CODEC_INT_MASK, 0xff }, - { CS42L42_SRCPL_INT_MASK, 0xff }, - { CS42L42_VPMON_INT_MASK, 0xff }, - { CS42L42_PLL_LOCK_INT_MASK, 0xff }, - { CS42L42_TSRS_PLUG_INT_MASK, 0xff }, - { CS42L42_DET_INT1_MASK, 0xff }, - { CS42L42_DET_INT2_MASK, 0xff }, }; /* Vendor specific hw configuration for CS8409 */ @@ -259,6 +252,7 @@ .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -288,115 +282,115 @@ /* Vendor specific HW configuration for CS42L42 */ static const struct cs8409_i2c_param dolphin_c0_init_reg_seq[] = { + { 0x1010, 0xB0 }, + { 0x1D01, 0x00 }, - { CS42L42_I2C_TIMEOUT, 0xB0 }, - { CS42L42_ADC_CTL, 0x00 }, { 0x1D02, 0x06 }, + { 0x1D03, 0x9F }, + { 0x1107, 0x01 }, + { 0x1009, 0x02 }, + { 0x1007, 0x03 }, + { 0x1201, 0x00 }, + { 0x1208, 0x13 }, + { 0x1205, 0xFF }, + { 0x1206, 0x00 }, + { 0x1207, 0x20 }, + { 0x1202, 0x0D }, + { 0x2A02, 0x02 }, + { 0x2A03, 0x00 }, + { 0x2A04, 0x00 }, + { 0x2A05, 0x02 }, + { 0x2A06, 0x00 }, + { 0x2A07, 0x20 }, + { 0x2A01, 0x0C }, + { 0x2902, 0x01 }, + { 0x2903, 0x02 }, + { 0x2904, 0x00 }, + { 0x2905, 0x00 }, + { 0x2901, 0x01 }, + { 0x1101, 0x0A }, + { 0x1102, 0x84 }, + { 0x2001, 0x03 }, + { 0x2301, 0x3F }, + { 0x2303, 0x3F }, + { 0x2302, 0x3f }, + { 0x1B75, 0xB6 }, + { 0x1B73, 0xC2 }, + { 0x1129, 0x01 }, + { 0x1121, 0xF3 }, + { 0x1103, 0x20 }, + { 0x1105, 0x00 }, + { 0x1112, 0x00 }, + { 0x1113, 0x80 }, + { 0x1C03, 0xC0 }, + { 0x1101, 0x02 }, + { 0x1316, 0xff }, + { 0x1317, 0xff }, + { 0x1318, 0xff }, + { 0x1319, 0xff }, + { 0x131a, 0xff }, + { 0x131b, 0xff }, + { 0x131c, 0xff }, + { 0x131e, 0xff }, + { 0x131f, 0xff }, + { 0x1320, 0xff }, + { 0x1b79, 0xff }, + { 0x1b7a, 0xff } - { CS42L42_ADC_VOLUME, 0x9F }, - { CS42L42_OSC_SWITCH, 0x01 }, - { CS42L42_MCLK_CTL, 0x02 }, - { CS42L42_SRC_CTL, 0x03 }, - { CS42L42_MCLK_SRC_SEL, 0x00 }, - { CS42L42_ASP_FRM_CFG, 0x13 }, - { CS42L42_FSYNC_P_LOWER, 0xFF }, - { CS42L42_FSYNC_P_UPPER, 0x00 }, - { CS42L42_ASP_CLK_CFG, 0x20 }, - { CS42L42_SPDIF_CLK_CFG, 0x0D }, - { CS42L42_ASP_RX_DAI0_CH1_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_LSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH2_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_LSB, 0x20 }, - { CS42L42_ASP_RX_DAI0_EN, 0x0C }, - { CS42L42_ASP_TX_CH_EN, 0x01 }, - { CS42L42_ASP_TX_CH_AP_RES, 0x02 }, - { CS42L42_ASP_TX_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_TX_CH1_BIT_LSB, 0x00 }, - { CS42L42_ASP_TX_SZ_EN, 0x01 }, - { CS42L42_PWR_CTL1, 0x0A }, - { CS42L42_PWR_CTL2, 0x84 }, - { CS42L42_HP_CTL, 0x03 }, - { CS42L42_MIXER_CHA_VOL, 0x3F }, - { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_MIXER_ADC_VOL, 0x3f }, - { CS42L42_MIC_DET_CTL1, 0xB6 }, - { CS42L42_TIPSENSE_CTL, 0xC2 }, - { CS42L42_HS_CLAMP_DISABLE, 0x01 }, - { CS42L42_HS_SWITCH_CTL, 0xF3 }, - { CS42L42_PWR_CTL3, 0x20 }, - { CS42L42_RSENSE_CTL2, 0x00 }, - { CS42L42_RSENSE_CTL3, 0x00 }, - { CS42L42_TSENSE_CTL, 0x80 }, - { CS42L42_HS_BIAS_CTL, 0xC0 }, - { CS42L42_PWR_CTL1, 0x02 }, - { CS42L42_ADC_OVFL_INT_MASK, 0xff }, - { CS42L42_MIXER_INT_MASK, 0xff }, - { CS42L42_SRC_INT_MASK, 0xff }, - { CS42L42_ASP_RX_INT_MASK, 0xff }, - { CS42L42_ASP_TX_INT_MASK, 0xff }, - { CS42L42_CODEC_INT_MASK, 0xff }, - { CS42L42_SRCPL_INT_MASK, 0xff }, - { CS42L42_VPMON_INT_MASK, 0xff }, - { CS42L42_PLL_LOCK_INT_MASK, 0xff }, - { CS42L42_TSRS_PLUG_INT_MASK, 0xff }, - { CS42L42_DET_INT1_MASK, 0xff }, - { CS42L42_DET_INT2_MASK, 0xff } }; static const struct cs8409_i2c_param dolphin_c1_init_reg_seq[] = { + { 0x1010, 0xB0 }, + { 0x1D01, 0x00 }, - { CS42L42_I2C_TIMEOUT, 0xB0 }, - { CS42L42_ADC_CTL, 0x00 }, { 0x1D02, 0x06 }, + { 0x1D03, 0x9F }, + { 0x1107, 0x01 }, + { 0x1009, 0x02 }, + { 0x1007, 0x03 }, + { 0x1201, 0x00 }, + { 0x1208, 0x13 }, + { 0x1205, 0xFF }, + { 0x1206, 0x00 }, + { 0x1207, 0x20 }, + { 0x1202, 0x0D }, + { 0x2A02, 0x02 }, + { 0x2A03, 0x00 }, + { 0x2A04, 0x80 }, + { 0x2A05, 0x02 }, + { 0x2A06, 0x00 }, + { 0x2A07, 0xA0 }, + { 0x2A01, 0x0C }, + { 0x2902, 0x00 }, + { 0x2903, 0x02 }, + { 0x2904, 0x00 }, + { 0x2905, 0x00 }, + { 0x2901, 0x00 }, + { 0x1101, 0x0E }, + { 0x1102, 0x84 }, + { 0x2001, 0x01 }, + { 0x2301, 0x3F }, + { 0x2303, 0x3F }, + { 0x2302, 0x3f }, + { 0x1B75, 0xB6 }, + { 0x1B73, 0xC2 }, + { 0x1129, 0x01 }, + { 0x1121, 0xF3 }, + { 0x1103, 0x20 }, + { 0x1105, 0x00 }, + { 0x1112, 0x00 }, + { 0x1113, 0x80 }, + { 0x1C03, 0xC0 }, + { 0x1101, 0x06 }, + { 0x1316, 0xff }, + { 0x1317, 0xff }, + { 0x1318, 0xff }, + { 0x1319, 0xff }, + { 0x131a, 0xff }, + { 0x131b, 0xff }, + { 0x131c, 0xff }, + { 0x131e, 0xff }, + { 0x131f, 0xff }, + { 0x1320, 0xff }, + { 0x1b79, 0xff }, + { 0x1b7a, 0xff } - { CS42L42_ADC_VOLUME, 0x9F }, - { CS42L42_OSC_SWITCH, 0x01 }, - { CS42L42_MCLK_CTL, 0x02 }, - { CS42L42_SRC_CTL, 0x03 }, - { CS42L42_MCLK_SRC_SEL, 0x00 }, - { CS42L42_ASP_FRM_CFG, 0x13 }, - { CS42L42_FSYNC_P_LOWER, 0xFF }, - { CS42L42_FSYNC_P_UPPER, 0x00 }, - { CS42L42_ASP_CLK_CFG, 0x20 }, - { CS42L42_SPDIF_CLK_CFG, 0x0D }, - { CS42L42_ASP_RX_DAI0_CH1_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH1_BIT_LSB, 0x80 }, - { CS42L42_ASP_RX_DAI0_CH2_AP_RES, 0x02 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_MSB, 0x00 }, - { CS42L42_ASP_RX_DAI0_CH2_BIT_LSB, 0xA0 }, - { CS42L42_ASP_RX_DAI0_EN, 0x0C }, - { CS42L42_ASP_TX_CH_EN, 0x00 }, - { CS42L42_ASP_TX_CH_AP_RES, 0x02 }, - { CS42L42_ASP_TX_CH1_BIT_MSB, 0x00 }, - { CS42L42_ASP_TX_CH1_BIT_LSB, 0x00 }, - { CS42L42_ASP_TX_SZ_EN, 0x00 }, - { CS42L42_PWR_CTL1, 0x0E }, - { CS42L42_PWR_CTL2, 0x84 }, - { CS42L42_HP_CTL, 0x01 }, - { CS42L42_MIXER_CHA_VOL, 0x3F }, - { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_MIXER_ADC_VOL, 0x3f }, - { CS42L42_MIC_DET_CTL1, 0xB6 }, - { CS42L42_TIPSENSE_CTL, 0xC2 }, - { CS42L42_HS_CLAMP_DISABLE, 0x01 }, - { CS42L42_HS_SWITCH_CTL, 0xF3 }, - { CS42L42_PWR_CTL3, 0x20 }, - { CS42L42_RSENSE_CTL2, 0x00 }, - { CS42L42_RSENSE_CTL3, 0x00 }, - { CS42L42_TSENSE_CTL, 0x80 }, - { CS42L42_HS_BIAS_CTL, 0xC0 }, - { CS42L42_PWR_CTL1, 0x06 }, - { CS42L42_ADC_OVFL_INT_MASK, 0xff }, - { CS42L42_MIXER_INT_MASK, 0xff }, - { CS42L42_SRC_INT_MASK, 0xff }, - { CS42L42_ASP_RX_INT_MASK, 0xff }, - { CS42L42_ASP_TX_INT_MASK, 0xff }, - { CS42L42_CODEC_INT_MASK, 0xff }, - { CS42L42_SRCPL_INT_MASK, 0xff }, - { CS42L42_VPMON_INT_MASK, 0xff }, - { CS42L42_PLL_LOCK_INT_MASK, 0xff }, - { CS42L42_TSRS_PLUG_INT_MASK, 0xff }, - { CS42L42_DET_INT1_MASK, 0xff }, - { CS42L42_DET_INT2_MASK, 0xff } }; /* Vendor specific hw configuration for CS8409 */ @@ -450,6 +444,7 @@ .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0, @@ -463,6 +458,7 @@ .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 1, @@ -482,29 +478,28 @@ SND_PCI_QUIRK(0x1028, 0x0A29, "Bullseye", CS8409_BULLSEYE), SND_PCI_QUIRK(0x1028, 0x0A2A, "Bullseye", CS8409_BULLSEYE), SND_PCI_QUIRK(0x1028, 0x0A2B, "Bullseye", CS8409_BULLSEYE), - SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG), - SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0AB0, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AB2, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AB1, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AB3, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AB4, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0AB5, "Warlock", CS8409_WARLOCK), - SND_PCI_QUIRK(0x1028, 0x0ACF, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0AD0, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0AD1, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0AD2, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0AD3, "Dolphin", CS8409_DOLPHIN), SND_PCI_QUIRK(0x1028, 0x0AD9, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0ADA, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0ADB, "Warlock", CS8409_WARLOCK), SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK), + SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK), + SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK), + SND_PCI_QUIRK(0x1028, 0x0BB5, "Warlock N3 15 TGL-U Nuvoton EC", CS8409_WARLOCK), + SND_PCI_QUIRK(0x1028, 0x0BB6, "Warlock V3 15 TGL-U Nuvoton EC", CS8409_WARLOCK), + SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0ADF, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0AE0, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0AE1, "Cyborg", CS8409_CYBORG), @@ -517,35 +512,11 @@ SND_PCI_QUIRK(0x1028, 0x0AEE, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0AEF, "Cyborg", CS8409_CYBORG), SND_PCI_QUIRK(0x1028, 0x0AF0, "Cyborg", CS8409_CYBORG), + SND_PCI_QUIRK(0x1028, 0x0AD0, "Dolphin", CS8409_DOLPHIN), + SND_PCI_QUIRK(0x1028, 0x0AD1, "Dolphin", CS8409_DOLPHIN), + SND_PCI_QUIRK(0x1028, 0x0AD2, "Dolphin", CS8409_DOLPHIN), + SND_PCI_QUIRK(0x1028, 0x0AD3, "Dolphin", CS8409_DOLPHIN), + SND_PCI_QUIRK(0x1028, 0x0ACF, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK), - SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK), - SND_PCI_QUIRK(0x1028, 0x0B92, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0B93, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0B94, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0B95, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0B96, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0B97, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0BA5, "Odin", CS8409_ODIN), - SND_PCI_QUIRK(0x1028, 0x0BA6, "Odin", CS8409_ODIN), - SND_PCI_QUIRK(0x1028, 0x0BA8, "Odin", CS8409_ODIN), - SND_PCI_QUIRK(0x1028, 0x0BAA, "Odin", CS8409_ODIN), - SND_PCI_QUIRK(0x1028, 0x0BAE, "Odin", CS8409_ODIN), - SND_PCI_QUIRK(0x1028, 0x0BB2, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BB3, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BB4, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BB5, "Warlock N3 15 TGL-U Nuvoton EC", CS8409_WARLOCK), - SND_PCI_QUIRK(0x1028, 0x0BB6, "Warlock V3 15 TGL-U Nuvoton EC", CS8409_WARLOCK), - SND_PCI_QUIRK(0x1028, 0x0BB8, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BB9, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0BBA, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BBB, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0BBC, "Warlock MLK", CS8409_WARLOCK_MLK), - SND_PCI_QUIRK(0x1028, 0x0BBD, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC), - SND_PCI_QUIRK(0x1028, 0x0BD4, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0BD5, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0BD6, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0BD7, "Dolphin", CS8409_DOLPHIN), - SND_PCI_QUIRK(0x1028, 0x0BD8, "Dolphin", CS8409_DOLPHIN), {} /* terminator */ }; @@ -553,11 +524,8 @@ const struct hda_model_fixup cs8409_models[] = { { .id = CS8409_BULLSEYE, .name = "bullseye" }, { .id = CS8409_WARLOCK, .name = "warlock" }, - { .id = CS8409_WARLOCK_MLK, .name = "warlock mlk" }, - { .id = CS8409_WARLOCK_MLK_DUAL_MIC, .name = "warlock mlk dual mic" }, { .id = CS8409_CYBORG, .name = "cyborg" }, { .id = CS8409_DOLPHIN, .name = "dolphin" }, - { .id = CS8409_ODIN, .name = "odin" }, {} }; @@ -574,18 +542,6 @@ .chained = true, .chain_id = CS8409_FIXUPS, }, - [CS8409_WARLOCK_MLK] = { - .type = HDA_FIXUP_PINS, - .v.pins = cs8409_cs42l42_pincfgs, - .chained = true, - .chain_id = CS8409_FIXUPS, - }, - [CS8409_WARLOCK_MLK_DUAL_MIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = cs8409_cs42l42_pincfgs, - .chained = true, - .chain_id = CS8409_FIXUPS, - }, [CS8409_CYBORG] = { .type = HDA_FIXUP_PINS, .v.pins = cs8409_cs42l42_pincfgs, @@ -606,10 +562,4 @@ .type = HDA_FIXUP_FUNC, .v.func = dolphin_fixups, }, - [CS8409_ODIN] = { - .type = HDA_FIXUP_PINS, - .v.pins = cs8409_cs42l42_pincfgs_no_dmic, - .chained = true, - .chain_id = CS8409_FIXUPS, - }, }; reverted: --- linux-oem-5.17-5.17.0/sound/pci/hda/patch_cs8409.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/hda/patch_cs8409.c @@ -419,38 +419,6 @@ snd_hda_override_wcaps(codec, nid, (get_wcaps(codec, nid) | AC_WCAP_UNSOL_CAP)); } -static int cs8409_spk_sw_gpio_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs8409_spec *spec = codec->spec; - ucontrol->value.integer.value[0] = !!(spec->gpio_data & spec->speaker_pdn_gpio); - return 0; -} - -static int cs8409_spk_sw_gpio_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs8409_spec *spec = codec->spec; - unsigned int gpio_data; - - gpio_data = (spec->gpio_data & ~spec->speaker_pdn_gpio) | - (ucontrol->value.integer.value[0] ? spec->speaker_pdn_gpio : 0); - if (gpio_data == spec->gpio_data) - return 0; - spec->gpio_data = gpio_data; - snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); - return 1; -} - -static const struct snd_kcontrol_new cs8409_spk_sw_ctrl = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .info = snd_ctl_boolean_mono_info, - .get = cs8409_spk_sw_gpio_get, - .put = cs8409_spk_sw_gpio_put, -}; - /****************************************************************************** * CS42L42 Specific Functions ******************************************************************************/ @@ -513,26 +481,26 @@ if (mute) { if (vol_type == CS42L42_VOL_DAC) { if (chs & BIT(0)) + cs8409_i2c_write(cs42l42, CS42L42_REG_HS_VOL_CHA, 0x3f); - cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHA_VOL, 0x3f); if (chs & BIT(1)) + cs8409_i2c_write(cs42l42, CS42L42_REG_HS_VOL_CHB, 0x3f); - cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHB_VOL, 0x3f); } else if (vol_type == CS42L42_VOL_ADC) { if (chs & BIT(0)) + cs8409_i2c_write(cs42l42, CS42L42_REG_AMIC_VOL, 0x9f); - cs8409_i2c_write(cs42l42, CS42L42_ADC_VOLUME, 0x9f); } } else { if (vol_type == CS42L42_VOL_DAC) { if (chs & BIT(0)) + cs8409_i2c_write(cs42l42, CS42L42_REG_HS_VOL_CHA, - cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHA_VOL, -(cs42l42->vol[CS42L42_DAC_CH0_VOL_OFFSET]) + & CS42L42_REG_HS_VOL_MASK); - & CS42L42_MIXER_CH_VOL_MASK); if (chs & BIT(1)) + cs8409_i2c_write(cs42l42, CS42L42_REG_HS_VOL_CHB, - cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHB_VOL, -(cs42l42->vol[CS42L42_DAC_CH1_VOL_OFFSET]) + & CS42L42_REG_HS_VOL_MASK); - & CS42L42_MIXER_CH_VOL_MASK); } else if (vol_type == CS42L42_VOL_ADC) { if (chs & BIT(0)) + cs8409_i2c_write(cs42l42, CS42L42_REG_AMIC_VOL, - cs8409_i2c_write(cs42l42, CS42L42_ADC_VOLUME, cs42l42->vol[CS42L42_ADC_VOL_OFFSET] & CS42L42_REG_AMIC_VOL_MASK); } @@ -633,167 +601,76 @@ /* Configure CS42L42 slave codec for jack autodetect */ static void cs42l42_enable_jack_detect(struct sub_codec *cs42l42) { + cs8409_i2c_write(cs42l42, 0x1b70, cs42l42->hsbias_hiz); - cs8409_i2c_write(cs42l42, CS42L42_HSBIAS_SC_AUTOCTL, cs42l42->hsbias_hiz); /* Clear WAKE# */ + cs8409_i2c_write(cs42l42, 0x1b71, 0x00C1); - cs8409_i2c_write(cs42l42, CS42L42_WAKE_CTL, 0x00C1); /* Wait ~2.5ms */ usleep_range(2500, 3000); /* Set mode WAKE# output follows the combination logic directly */ + cs8409_i2c_write(cs42l42, 0x1b71, 0x00C0); - cs8409_i2c_write(cs42l42, CS42L42_WAKE_CTL, 0x00C0); /* Clear interrupts status */ + cs8409_i2c_read(cs42l42, 0x130f); - cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); /* Enable interrupt */ + cs8409_i2c_write(cs42l42, 0x1320, 0xF3); - cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xF3); } /* Enable and run CS42L42 slave codec jack auto detect */ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42) { /* Clear interrupts */ + cs8409_i2c_read(cs42l42, 0x1308); + cs8409_i2c_read(cs42l42, 0x1b77); + cs8409_i2c_write(cs42l42, 0x1320, 0xFF); + cs8409_i2c_read(cs42l42, 0x130f); + + cs8409_i2c_write(cs42l42, 0x1102, 0x87); + cs8409_i2c_write(cs42l42, 0x1f06, 0x86); + cs8409_i2c_write(cs42l42, 0x1b74, 0x07); + cs8409_i2c_write(cs42l42, 0x131b, 0xFD); + cs8409_i2c_write(cs42l42, 0x1120, 0x80); - cs8409_i2c_read(cs42l42, CS42L42_CODEC_STATUS); - cs8409_i2c_read(cs42l42, CS42L42_DET_STATUS1); - cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xFF); - cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); - - cs8409_i2c_write(cs42l42, CS42L42_PWR_CTL2, 0x87); - cs8409_i2c_write(cs42l42, CS42L42_DAC_CTL2, 0x86); - cs8409_i2c_write(cs42l42, CS42L42_MISC_DET_CTL, 0x07); - cs8409_i2c_write(cs42l42, CS42L42_CODEC_INT_MASK, 0xFD); - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0x80); /* Wait ~20ms*/ usleep_range(20000, 25000); + cs8409_i2c_write(cs42l42, 0x111f, 0x77); + cs8409_i2c_write(cs42l42, 0x1120, 0xc0); - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, 0x77); - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0xc0); } +static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) -static int cs42l42_manual_hs_det(struct sub_codec *cs42l42) { + int status_changed = cs42l42->force_status_change; - unsigned int hs_det_status; - unsigned int hs_det_comp1; - unsigned int hs_det_comp2; - unsigned int hs_det_sw; - unsigned int hs_type; + cs42l42->force_status_change = 0; - /* Set hs detect to manual, active mode */ - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, - (1 << CS42L42_HSDET_CTRL_SHIFT) | - (0 << CS42L42_HSDET_SET_SHIFT) | - (0 << CS42L42_HSBIAS_REF_SHIFT) | - (0 << CS42L42_HSDET_AUTO_TIME_SHIFT)); + /* TIP_SENSE INSERT/REMOVE */ + switch (reg_ts_status) { + case CS42L42_JACK_INSERTED: + if (!cs42l42->hp_jack_in) { + if (cs42l42->no_type_dect) { + status_changed = 1; + cs42l42->hp_jack_in = 1; + cs42l42->mic_jack_in = 0; + } else { + cs42l42_run_jack_detect(cs42l42); + } + } - /* Configure HS DET comparator reference levels. */ - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, - (CS42L42_HSDET_COMP1_LVL_VAL << CS42L42_HSDET_COMP1_LVL_SHIFT) | - (CS42L42_HSDET_COMP2_LVL_VAL << CS42L42_HSDET_COMP2_LVL_SHIFT)); - - /* Open the SW_HSB_HS3 switch and close SW_HSB_HS4 for a Type 1 headset. */ - cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, CS42L42_HSDET_SW_COMP1); - - msleep(100); - - hs_det_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); - - hs_det_comp1 = (hs_det_status & CS42L42_HSDET_COMP1_OUT_MASK) >> - CS42L42_HSDET_COMP1_OUT_SHIFT; - hs_det_comp2 = (hs_det_status & CS42L42_HSDET_COMP2_OUT_MASK) >> - CS42L42_HSDET_COMP2_OUT_SHIFT; - - /* Close the SW_HSB_HS3 switch for a Type 2 headset. */ - cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, CS42L42_HSDET_SW_COMP2); - - msleep(100); - - hs_det_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); - - hs_det_comp1 |= ((hs_det_status & CS42L42_HSDET_COMP1_OUT_MASK) >> - CS42L42_HSDET_COMP1_OUT_SHIFT) << 1; - hs_det_comp2 |= ((hs_det_status & CS42L42_HSDET_COMP2_OUT_MASK) >> - CS42L42_HSDET_COMP2_OUT_SHIFT) << 1; - - /* Use Comparator 1 with 1.25V Threshold. */ - switch (hs_det_comp1) { - case CS42L42_HSDET_COMP_TYPE1: - hs_type = CS42L42_PLUG_CTIA; - hs_det_sw = CS42L42_HSDET_SW_TYPE1; break; - case CS42L42_HSDET_COMP_TYPE2: - hs_type = CS42L42_PLUG_OMTP; - hs_det_sw = CS42L42_HSDET_SW_TYPE2; - break; - default: - /* Fallback to Comparator 2 with 1.75V Threshold. */ - switch (hs_det_comp2) { - case CS42L42_HSDET_COMP_TYPE1: - hs_type = CS42L42_PLUG_CTIA; - hs_det_sw = CS42L42_HSDET_SW_TYPE1; - break; - case CS42L42_HSDET_COMP_TYPE2: - hs_type = CS42L42_PLUG_OMTP; - hs_det_sw = CS42L42_HSDET_SW_TYPE2; - break; - case CS42L42_HSDET_COMP_TYPE3: - hs_type = CS42L42_PLUG_HEADPHONE; - hs_det_sw = CS42L42_HSDET_SW_TYPE3; - break; - default: - hs_type = CS42L42_PLUG_INVALID; - hs_det_sw = CS42L42_HSDET_SW_TYPE4; - break; - } - } - - /* Set Switches */ - cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, hs_det_sw); + case CS42L42_JACK_REMOVED: + if (cs42l42->hp_jack_in || cs42l42->mic_jack_in) { - /* Set HSDET mode to Manual—Disabled */ - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, - (0 << CS42L42_HSDET_CTRL_SHIFT) | - (0 << CS42L42_HSDET_SET_SHIFT) | - (0 << CS42L42_HSBIAS_REF_SHIFT) | - (0 << CS42L42_HSDET_AUTO_TIME_SHIFT)); - - /* Configure HS DET comparator reference levels. */ - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, - (CS42L42_HSDET_COMP1_LVL_DEFAULT << CS42L42_HSDET_COMP1_LVL_SHIFT) | - (CS42L42_HSDET_COMP2_LVL_DEFAULT << CS42L42_HSDET_COMP2_LVL_SHIFT)); - - return hs_type; -} - -static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) -{ - int status_changed = 0; - - /* TIP_SENSE INSERT/REMOVE */ - switch (reg_ts_status) { - case CS42L42_TS_PLUG: - if (cs42l42->no_type_dect) { status_changed = 1; + cs42l42->hp_jack_in = 0; - cs42l42->hp_jack_in = 1; cs42l42->mic_jack_in = 0; - } else { - cs42l42_run_jack_detect(cs42l42); } break; - - case CS42L42_TS_UNPLUG: - status_changed = 1; - cs42l42->hp_jack_in = 0; - cs42l42->mic_jack_in = 0; - break; default: /* jack in transition */ break; } - codec_dbg(cs42l42->codec, "Tip Sense Detection: (%d)\n", reg_ts_status); - return status_changed; } static int cs42l42_jack_unsol_event(struct sub_codec *cs42l42) { - int current_plug_status; int status_changed = 0; int reg_cdc_status; int reg_hs_status; @@ -801,65 +678,46 @@ int type; /* Read jack detect status registers */ + reg_cdc_status = cs8409_i2c_read(cs42l42, 0x1308); + reg_hs_status = cs8409_i2c_read(cs42l42, 0x1124); + reg_ts_status = cs8409_i2c_read(cs42l42, 0x130f); - reg_cdc_status = cs8409_i2c_read(cs42l42, CS42L42_CODEC_STATUS); - reg_hs_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); - reg_ts_status = cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); /* If status values are < 0, read error has occurred. */ if (reg_cdc_status < 0 || reg_hs_status < 0 || reg_ts_status < 0) return -EIO; - current_plug_status = (reg_ts_status & (CS42L42_TS_PLUG_MASK | CS42L42_TS_UNPLUG_MASK)) - >> CS42L42_TS_PLUG_SHIFT; - /* HSDET_AUTO_DONE */ + if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE) { - if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE_MASK) { /* Disable HSDET_AUTO_DONE */ + cs8409_i2c_write(cs42l42, 0x131b, 0xFF); - cs8409_i2c_write(cs42l42, CS42L42_CODEC_INT_MASK, 0xFF); + type = ((reg_hs_status & CS42L42_HSTYPE_MASK) + 1); - type = (reg_hs_status & CS42L42_HSDET_TYPE_MASK) >> CS42L42_HSDET_TYPE_SHIFT; - - /* Configure the HSDET mode. */ - cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0x80); if (cs42l42->no_type_dect) { + status_changed = cs42l42_handle_tip_sense(cs42l42, reg_ts_status); + } else if (type == 4) { + /* Type 4 not supported */ + status_changed = cs42l42_handle_tip_sense(cs42l42, CS42L42_JACK_REMOVED); - status_changed = cs42l42_handle_tip_sense(cs42l42, current_plug_status); } else { + if (!cs42l42->hp_jack_in) { + status_changed = 1; + cs42l42->hp_jack_in = 1; - if (type == CS42L42_PLUG_INVALID || type == CS42L42_PLUG_HEADPHONE) { - codec_dbg(cs42l42->codec, - "Auto detect value not valid (%d), running manual det\n", - type); - type = cs42l42_manual_hs_det(cs42l42); } + /* type = 3 has no mic */ + if ((!cs42l42->mic_jack_in) && (type != 3)) { - - switch (type) { - case CS42L42_PLUG_CTIA: - case CS42L42_PLUG_OMTP: status_changed = 1; - cs42l42->hp_jack_in = 1; cs42l42->mic_jack_in = 1; - break; - case CS42L42_PLUG_HEADPHONE: - status_changed = 1; - cs42l42->hp_jack_in = 1; - cs42l42->mic_jack_in = 0; - break; - default: - status_changed = 1; - cs42l42->hp_jack_in = 0; - cs42l42->mic_jack_in = 0; - break; } - codec_dbg(cs42l42->codec, "Detection done (%d)\n", type); } + /* Configure the HSDET mode. */ + cs8409_i2c_write(cs42l42, 0x1120, 0x80); - /* Enable the HPOUT ground clamp and configure the HP pull-down */ + cs8409_i2c_write(cs42l42, 0x1F06, 0x02); - cs8409_i2c_write(cs42l42, CS42L42_DAC_CTL2, 0x02); /* Re-Enable Tip Sense Interrupt */ + cs8409_i2c_write(cs42l42, 0x1320, 0xF3); - cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xF3); } else { + status_changed = cs42l42_handle_tip_sense(cs42l42, reg_ts_status); - status_changed = cs42l42_handle_tip_sense(cs42l42, current_plug_status); } return status_changed; @@ -868,19 +726,18 @@ static void cs42l42_resume(struct sub_codec *cs42l42) { struct hda_codec *codec = cs42l42->codec; + unsigned int gpio_data; - struct cs8409_spec *spec = codec->spec; struct cs8409_i2c_param irq_regs[] = { + { 0x1308, 0x00 }, + { 0x1309, 0x00 }, + { 0x130A, 0x00 }, + { 0x130F, 0x00 }, - { CS42L42_CODEC_STATUS, 0x00 }, - { CS42L42_DET_INT_STATUS1, 0x00 }, - { CS42L42_DET_INT_STATUS2, 0x00 }, - { CS42L42_TSRS_PLUG_STATUS, 0x00 }, }; - int fsv_old, fsv_new; /* Bring CS42L42 out of Reset */ + gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); + gpio_data |= cs42l42->reset_gpio; + snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, gpio_data); - spec->gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); - spec->gpio_data |= cs42l42->reset_gpio; - snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); usleep_range(10000, 15000); cs42l42->suspended = 0; @@ -892,13 +749,8 @@ /* Clear interrupts, by reading interrupt status registers */ cs8409_i2c_bulk_read(cs42l42, irq_regs, ARRAY_SIZE(irq_regs)); + if (cs42l42->full_scale_vol) + cs8409_i2c_write(cs42l42, 0x2001, 0x01); - fsv_old = cs8409_i2c_read(cs42l42, CS42L42_HP_CTL); - if (cs42l42->full_scale_vol == CS42L42_FULL_SCALE_VOL_0DB) - fsv_new = fsv_old & ~CS42L42_FULL_SCALE_VOL_MASK; - else - fsv_new = fsv_old & CS42L42_FULL_SCALE_VOL_MASK; - if (fsv_new != fsv_old) - cs8409_i2c_write(cs42l42, CS42L42_HP_CTL, fsv_new); /* we have to explicitly allow unsol event handling even during the * resume phase so that the jack event is processed properly @@ -912,40 +764,41 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) { struct hda_codec *codec = cs42l42->codec; + unsigned int gpio_data; - struct cs8409_spec *spec = codec->spec; int reg_cdc_status = 0; const struct cs8409_i2c_param cs42l42_pwr_down_seq[] = { + { 0x1F06, 0x02 }, + { 0x1129, 0x00 }, + { 0x2301, 0x3F }, + { 0x2302, 0x3F }, + { 0x2303, 0x3F }, + { 0x2001, 0x0F }, + { 0x2A01, 0x00 }, + { 0x1207, 0x00 }, + { 0x1101, 0xFE }, + { 0x1102, 0x8C }, + { 0x1101, 0xFF }, - { CS42L42_DAC_CTL2, 0x02 }, - { CS42L42_HS_CLAMP_DISABLE, 0x00 }, - { CS42L42_MIXER_CHA_VOL, 0x3F }, - { CS42L42_MIXER_ADC_VOL, 0x3F }, - { CS42L42_MIXER_CHB_VOL, 0x3F }, - { CS42L42_HP_CTL, 0x0F }, - { CS42L42_ASP_RX_DAI0_EN, 0x00 }, - { CS42L42_ASP_CLK_CFG, 0x00 }, - { CS42L42_PWR_CTL1, 0xFE }, - { CS42L42_PWR_CTL2, 0x8C }, - { CS42L42_PWR_CTL1, 0xFF }, }; cs8409_i2c_bulk_write(cs42l42, cs42l42_pwr_down_seq, ARRAY_SIZE(cs42l42_pwr_down_seq)); if (read_poll_timeout(cs8409_i2c_read, reg_cdc_status, (reg_cdc_status & 0x1), CS42L42_PDN_SLEEP_US, CS42L42_PDN_TIMEOUT_US, + true, cs42l42, 0x1308) < 0) - true, cs42l42, CS42L42_CODEC_STATUS) < 0) codec_warn(codec, "Timeout waiting for PDN_DONE for CS42L42\n"); /* Power down CS42L42 ASP/EQ/MIX/HP */ + cs8409_i2c_write(cs42l42, 0x1102, 0x9C); - cs8409_i2c_write(cs42l42, CS42L42_PWR_CTL2, 0x9C); cs42l42->suspended = 1; cs42l42->last_page = 0; cs42l42->hp_jack_in = 0; cs42l42->mic_jack_in = 0; + cs42l42->force_status_change = 1; /* Put CS42L42 into Reset */ + gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); + gpio_data &= ~cs42l42->reset_gpio; + snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, gpio_data); - spec->gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); - spec->gpio_data &= ~cs42l42->reset_gpio; - snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); } #endif @@ -1053,18 +906,9 @@ cs8409_vendor_coef_set(codec, seq_bullseye->cir, seq_bullseye->coeff); } + /* DMIC1_MO=00b, DMIC1/2_SR=1 */ + if (codec->fixup_id == CS8409_WARLOCK || codec->fixup_id == CS8409_CYBORG) + cs8409_vendor_coef_set(codec, 0x09, 0x0003); - switch (codec->fixup_id) { - case CS8409_CYBORG: - case CS8409_WARLOCK_MLK_DUAL_MIC: - /* DMIC1_MO=00b, DMIC1/2_SR=1 */ - cs8409_vendor_coef_set(codec, CS8409_DMIC_CFG, 0x0003); - break; - case CS8409_ODIN: - /* ASP1/2_xxx_EN=1, ASP1/2_MCLK_EN=0, DMIC1_SCL_EN=0 */ - cs8409_vendor_coef_set(codec, CS8409_PAD_CFG_SLW_RATE_CTRL, 0xfc00); - default: - break; - } cs42l42_resume(cs42l42); @@ -1138,8 +982,6 @@ spec->gen.no_primary_hp = 1; spec->gen.suppress_vmaster = 1; - spec->speaker_pdn_gpio = 0; - /* GPIO 5 out, 3,4 in */ spec->gpio_dir = spec->scodecs[CS8409_CODEC0]->reset_gpio; spec->gpio_data = 0; @@ -1151,32 +993,28 @@ cs8409_fix_caps(codec, CS8409_CS42L42_HP_PIN_NID); cs8409_fix_caps(codec, CS8409_CS42L42_AMIC_PIN_NID); + /* Set TIP_SENSE_EN for analog front-end of tip sense. + * Additionally set HSBIAS_SENSE_EN and Full Scale volume for some variants. + */ - spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020; - switch (codec->fixup_id) { + case CS8409_WARLOCK: + spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020; + spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1; - case CS8409_CYBORG: - spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB; - spec->speaker_pdn_gpio = CS8409_CYBORG_SPEAKER_PDN; break; + case CS8409_BULLSEYE: + spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020; + spec->scodecs[CS8409_CODEC0]->full_scale_vol = 0; - case CS8409_ODIN: - spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB; - spec->speaker_pdn_gpio = CS8409_CYBORG_SPEAKER_PDN; break; + case CS8409_CYBORG: + spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x00a0; + spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1; - case CS8409_WARLOCK_MLK: - case CS8409_WARLOCK_MLK_DUAL_MIC: - spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB; break; default: + spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0003; + spec->scodecs[CS8409_CODEC0]->full_scale_vol = 1; - spec->scodecs[CS8409_CODEC0]->full_scale_vol = - CS42L42_FULL_SCALE_VOL_MINUS6DB; break; } - if (spec->speaker_pdn_gpio > 0) { - spec->gpio_dir |= spec->speaker_pdn_gpio; - spec->gpio_data |= spec->speaker_pdn_gpio; - } - break; case HDA_FIXUP_ACT_PROBE: /* Fix Sample Rate to 48kHz */ @@ -1185,17 +1023,13 @@ /* add hooks */ spec->gen.pcm_playback_hook = cs42l42_playback_pcm_hook; spec->gen.pcm_capture_hook = cs42l42_capture_pcm_hook; + /* Set initial DMIC volume to -26 dB */ + snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID, + HDA_INPUT, 0, 0xff, 0x19); - if (codec->fixup_id != CS8409_ODIN) - /* Set initial DMIC volume to -26 dB */ - snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID, - HDA_INPUT, 0, 0xff, 0x19); snd_hda_gen_add_kctl(&spec->gen, "Headphone Playback Volume", &cs42l42_dac_volume_mixer); snd_hda_gen_add_kctl(&spec->gen, "Mic Capture Volume", &cs42l42_adc_volume_mixer); - if (spec->speaker_pdn_gpio > 0) - snd_hda_gen_add_kctl(&spec->gen, "Speaker Playback Switch", - &cs8409_spk_sw_ctrl); /* Disable Unsolicited Response during boot */ cs8409_enable_ur(codec, 0); snd_hda_codec_set_name(codec, "CS8409/CS42L42"); @@ -1388,9 +1222,6 @@ cs8409_fix_caps(codec, DOLPHIN_LO_PIN_NID); cs8409_fix_caps(codec, DOLPHIN_AMIC_PIN_NID); - spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB; - spec->scodecs[CS8409_CODEC1]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB; - break; case HDA_FIXUP_ACT_PROBE: /* Fix Sample Rate to 48kHz */ reverted: --- linux-oem-5.17-5.17.0/sound/pci/hda/patch_cs8409.h +++ linux-oem-5.17-5.17.0.orig/sound/pci/hda/patch_cs8409.h @@ -12,7 +12,6 @@ #include #include #include -#include #include #include "hda_local.h" #include "hda_auto_parser.h" @@ -223,22 +222,25 @@ #define CS42L42_HP_VOL_REAL_MAX (0) #define CS42L42_AMIC_VOL_REAL_MIN (-97) #define CS42L42_AMIC_VOL_REAL_MAX (12) +#define CS42L42_REG_HS_VOL_CHA (0x2301) +#define CS42L42_REG_HS_VOL_CHB (0x2303) +#define CS42L42_REG_HS_VOL_MASK (0x003F) +#define CS42L42_REG_AMIC_VOL (0x1D03) #define CS42L42_REG_AMIC_VOL_MASK (0x00FF) +#define CS42L42_HSDET_AUTO_DONE (0x02) #define CS42L42_HSTYPE_MASK (0x03) +#define CS42L42_JACK_INSERTED (0x0C) +#define CS42L42_JACK_REMOVED (0x00) #define CS42L42_I2C_TIMEOUT_US (20000) #define CS42L42_I2C_SLEEP_US (2000) #define CS42L42_PDN_TIMEOUT_US (250000) #define CS42L42_PDN_SLEEP_US (2000) -#define CS42L42_FULL_SCALE_VOL_MASK (2) -#define CS42L42_FULL_SCALE_VOL_0DB (1) -#define CS42L42_FULL_SCALE_VOL_MINUS6DB (0) /* Dell BULLSEYE / WARLOCK / CYBORG Specific Definitions */ #define CS42L42_I2C_ADDR (0x48 << 1) #define CS8409_CS42L42_RESET GENMASK(5, 5) /* CS8409_GPIO5 */ #define CS8409_CS42L42_INT GENMASK(4, 4) /* CS8409_GPIO4 */ -#define CS8409_CYBORG_SPEAKER_PDN GENMASK(2, 2) /* CS8409_GPIO2 */ #define CS8409_CS42L42_HP_PIN_NID CS8409_PIN_ASP1_TRANSMITTER_A #define CS8409_CS42L42_SPK_PIN_NID CS8409_PIN_ASP2_TRANSMITTER_A #define CS8409_CS42L42_AMIC_PIN_NID CS8409_PIN_ASP1_RECEIVER_A @@ -262,13 +264,10 @@ enum { CS8409_BULLSEYE, CS8409_WARLOCK, - CS8409_WARLOCK_MLK, - CS8409_WARLOCK_MLK_DUAL_MIC, CS8409_CYBORG, CS8409_FIXUPS, CS8409_DOLPHIN, CS8409_DOLPHIN_FIXUPS, - CS8409_ODIN, }; enum { @@ -306,6 +305,7 @@ unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; + unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1; unsigned int last_page; @@ -327,8 +327,6 @@ unsigned int gpio_dir; unsigned int gpio_data; - int speaker_pdn_gpio; - struct mutex i2c_mux; unsigned int i2c_clck_enabled; unsigned int dev_addr; diff -u linux-oem-5.17-5.17.0/sound/pci/hda/patch_hdmi.c linux-oem-5.17-5.17.0/sound/pci/hda/patch_hdmi.c --- linux-oem-5.17-5.17.0/sound/pci/hda/patch_hdmi.c +++ linux-oem-5.17-5.17.0/sound/pci/hda/patch_hdmi.c @@ -1387,7 +1387,7 @@ last_try: /* the last try; check the empty slots in pins */ - for (i = 0; i < spec->pcm_used; i++) { + for (i = 0; i < spec->num_nids; i++) { if (!test_bit(i, &spec->pcm_bitmap)) return i; } @@ -2263,9 +2263,7 @@ * dev_num is the device entry number in a pin */ - if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms) - pcm_num = spec->num_cvts; - else if (codec->mst_no_extra_pcms) + if (codec->mst_no_extra_pcms) pcm_num = spec->num_nids; else pcm_num = spec->num_nids + spec->dev_num - 1; diff -u linux-oem-5.17-5.17.0/sound/pci/hda/patch_realtek.c linux-oem-5.17-5.17.0/sound/pci/hda/patch_realtek.c --- linux-oem-5.17-5.17.0/sound/pci/hda/patch_realtek.c +++ linux-oem-5.17-5.17.0/sound/pci/hda/patch_realtek.c @@ -2619,7 +2619,6 @@ SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), @@ -8773,8 +8772,6 @@ [ALC287_FIXUP_CS35L41_I2C_2] = { .type = HDA_FIXUP_FUNC, .v.func = cs35l41_fixup_i2c_two, - .chained = true, - .chain_id = ALC269_FIXUP_THINKPAD_ACPI, }, [ALC245_FIXUP_CS35L41_SPI_2] = { .type = HDA_FIXUP_FUNC, @@ -9166,7 +9163,6 @@ SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC), SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME), @@ -9241,7 +9237,6 @@ SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS), - SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), @@ -9270,7 +9265,6 @@ SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), - SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), reverted: --- linux-oem-5.17-5.17.0/sound/pci/ice1712/ice1724.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/ice1712/ice1724.c @@ -2519,8 +2519,8 @@ * */ +static int snd_vt1724_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_vt1724_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2662,12 +2662,6 @@ return 0; } -static int snd_vt1724_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_vt1724_probe(pci, pci_id)); -} - #ifdef CONFIG_PM_SLEEP static int snd_vt1724_suspend(struct device *dev) { reverted: --- linux-oem-5.17-5.17.0/sound/pci/intel8x0.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/intel8x0.c @@ -3109,8 +3109,8 @@ return 0; } +static int snd_intel8x0_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_intel8x0_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct intel8x0 *chip; @@ -3189,12 +3189,6 @@ return 0; } -static int snd_intel8x0_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_intel8x0_probe(pci, pci_id)); -} - static struct pci_driver intel8x0_driver = { .name = KBUILD_MODNAME, .id_table = snd_intel8x0_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/intel8x0m.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/intel8x0m.c @@ -1178,8 +1178,8 @@ { 0 }, }; +static int snd_intel8x0m_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_intel8x0m_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct intel8x0m *chip; @@ -1225,12 +1225,6 @@ return 0; } -static int snd_intel8x0m_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_intel8x0m_probe(pci, pci_id)); -} - static struct pci_driver intel8x0m_driver = { .name = KBUILD_MODNAME, .id_table = snd_intel8x0m_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/korg1212/korg1212.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/korg1212/korg1212.c @@ -2355,7 +2355,7 @@ err = snd_korg1212_create(card, pci); if (err < 0) + return err; - goto error; strcpy(card->driver, "korg1212"); strcpy(card->shortname, "korg1212"); @@ -2366,14 +2366,10 @@ err = snd_card_register(card); if (err < 0) + return err; - goto error; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver korg1212_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/lola/lola.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/lola/lola.c @@ -637,8 +637,8 @@ return 0; } +static int lola_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __lola_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -687,12 +687,6 @@ return 0; } -static int lola_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __lola_probe(pci, pci_id)); -} - /* PCI IDs */ static const struct pci_device_id lola_ids[] = { { PCI_VDEVICE(DIGIGRAM, 0x0001) }, reverted: --- linux-oem-5.17-5.17.0/sound/pci/lx6464es/lx6464es.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/lx6464es/lx6464es.c @@ -1019,7 +1019,7 @@ err = snd_lx6464es_create(card, pci); if (err < 0) { dev_err(card->dev, "error during snd_lx6464es_create\n"); + return err; - goto error; } strcpy(card->driver, "LX6464ES"); @@ -1036,16 +1036,12 @@ err = snd_card_register(card); if (err < 0) + return err; - goto error; dev_dbg(chip->card->dev, "initialization successful\n"); pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver lx6464es_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/maestro3.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/maestro3.c @@ -2637,7 +2637,7 @@ /* */ static int +snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -__snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2702,12 +2702,6 @@ return 0; } -static int -snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_m3_probe(pci, pci_id)); -} - static struct pci_driver m3_driver = { .name = KBUILD_MODNAME, .id_table = snd_m3_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/nm256/nm256.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/nm256/nm256.c @@ -1573,6 +1573,7 @@ chip->coeffs_current = 0; snd_nm256_init_chip(chip); + card->private_free = snd_nm256_free; // pci_set_master(pci); /* needed? */ return 0; @@ -1679,7 +1680,6 @@ err = snd_card_register(card); if (err < 0) return err; - card->private_free = snd_nm256_free; pci_set_drvdata(pci, card); return 0; reverted: --- linux-oem-5.17-5.17.0/sound/pci/oxygen/oxygen_lib.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/oxygen/oxygen_lib.c @@ -576,7 +576,7 @@ mutex_destroy(&chip->mutex); } +int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, -static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct module *owner, const struct pci_device_id *ids, int (*get_model)(struct oxygen *chip, @@ -701,16 +701,6 @@ pci_set_drvdata(pci, card); return 0; } - -int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, - struct module *owner, - const struct pci_device_id *ids, - int (*get_model)(struct oxygen *chip, - const struct pci_device_id *id)) -{ - return snd_card_free_on_error(&pci->dev, - __oxygen_pci_probe(pci, index, id, owner, ids, get_model)); -} EXPORT_SYMBOL(oxygen_pci_probe); #ifdef CONFIG_PM_SLEEP reverted: --- linux-oem-5.17-5.17.0/sound/pci/riptide/riptide.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/riptide/riptide.c @@ -2023,7 +2023,7 @@ #endif static int +snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -__snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2124,12 +2124,6 @@ return 0; } -static int -snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_card_riptide_probe(pci, pci_id)); -} - static struct pci_driver driver = { .name = KBUILD_MODNAME, .id_table = snd_riptide_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/rme32.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/rme32.c @@ -1875,7 +1875,7 @@ } static int +snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -__snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct rme32 *rme32; @@ -1927,12 +1927,6 @@ return 0; } -static int -snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_rme32_probe(pci, pci_id)); -} - static struct pci_driver rme32_driver = { .name = KBUILD_MODNAME, .id_table = snd_rme32_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/rme96.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/rme96.c @@ -2430,8 +2430,8 @@ } static int +snd_rme96_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -__snd_rme96_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct rme96 *rme96; @@ -2498,12 +2498,6 @@ return 0; } -static int snd_rme96_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_rme96_probe(pci, pci_id)); -} - static struct pci_driver rme96_driver = { .name = KBUILD_MODNAME, .id_table = snd_rme96_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/rme9652/hdsp.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/rme9652/hdsp.c @@ -5444,21 +5444,17 @@ hdsp->pci = pci; err = snd_hdsp_create(card, hdsp); if (err) + return err; - goto error; strcpy(card->shortname, "Hammerfall DSP"); sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, hdsp->port, hdsp->irq); err = snd_card_register(card); if (err) + return err; - goto error; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver hdsp_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/rme9652/hdspm.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/rme9652/hdspm.c @@ -6895,7 +6895,7 @@ err = snd_hdspm_create(card, hdspm); if (err < 0) + return err; - goto error; if (hdspm->io_type != MADIface) { snprintf(card->shortname, sizeof(card->shortname), "%s_%x", @@ -6914,16 +6914,12 @@ err = snd_card_register(card); if (err < 0) + return err; - goto error; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver hdspm_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/rme9652/rme9652.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/rme9652/rme9652.c @@ -2572,7 +2572,7 @@ rme9652->pci = pci; err = snd_rme9652_create(card, rme9652, precise_ptr[dev]); if (err) + return err; - goto error; strcpy(card->shortname, rme9652->card_name); @@ -2580,14 +2580,10 @@ card->shortname, rme9652->port, rme9652->irq); err = snd_card_register(card); if (err) + return err; - goto error; pci_set_drvdata(pci, card); dev++; return 0; - - error: - snd_card_free(card); - return err; } static struct pci_driver rme9652_driver = { reverted: --- linux-oem-5.17-5.17.0/sound/pci/sis7019.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/sis7019.c @@ -1331,8 +1331,8 @@ return 0; } +static int snd_sis7019_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_sis7019_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct sis7019 *sis; @@ -1352,8 +1352,8 @@ if (!codecs) codecs = SIS_PRIMARY_CODEC_PRESENT; + rc = snd_card_new(&pci->dev, index, id, THIS_MODULE, + sizeof(*sis), &card); - rc = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE, - sizeof(*sis), &card); if (rc < 0) return rc; @@ -1386,12 +1386,6 @@ return 0; } -static int snd_sis7019_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_sis7019_probe(pci, pci_id)); -} - static struct pci_driver sis7019_driver = { .name = KBUILD_MODNAME, .id_table = snd_sis7019_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/sonicvibes.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/sonicvibes.c @@ -1387,8 +1387,8 @@ return 0; } +static int snd_sonic_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_sonic_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -1459,12 +1459,6 @@ return 0; } -static int snd_sonic_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_sonic_probe(pci, pci_id)); -} - static struct pci_driver sonicvibes_driver = { .name = KBUILD_MODNAME, .id_table = snd_sonic_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/via82xx.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/via82xx.c @@ -2458,8 +2458,8 @@ return VIA_DXS_48K; }; +static int snd_via82xx_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_via82xx_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct via82xx *chip; @@ -2569,12 +2569,6 @@ return 0; } -static int snd_via82xx_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id)); -} - static struct pci_driver via82xx_driver = { .name = KBUILD_MODNAME, .id_table = snd_via82xx_ids, reverted: --- linux-oem-5.17-5.17.0/sound/pci/via82xx_modem.c +++ linux-oem-5.17-5.17.0.orig/sound/pci/via82xx_modem.c @@ -1103,8 +1103,8 @@ } +static int snd_via82xx_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) -static int __snd_via82xx_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) { struct snd_card *card; struct via82xx_modem *chip; @@ -1157,12 +1157,6 @@ return 0; } -static int snd_via82xx_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) -{ - return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id)); -} - static struct pci_driver via82xx_modem_driver = { .name = KBUILD_MODNAME, .id_table = snd_via82xx_modem_ids, diff -u linux-oem-5.17-5.17.0/sound/soc/atmel/sam9g20_wm8731.c linux-oem-5.17-5.17.0/sound/soc/atmel/sam9g20_wm8731.c --- linux-oem-5.17-5.17.0/sound/soc/atmel/sam9g20_wm8731.c +++ linux-oem-5.17-5.17.0/sound/soc/atmel/sam9g20_wm8731.c @@ -46,6 +46,35 @@ */ #undef ENABLE_MIC_INPUT +static struct clk *mclk; + +static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + static int mclk_on; + int ret = 0; + + switch (level) { + case SND_SOC_BIAS_ON: + case SND_SOC_BIAS_PREPARE: + if (!mclk_on) + ret = clk_enable(mclk); + if (ret == 0) + mclk_on = 1; + break; + + case SND_SOC_BIAS_OFF: + case SND_SOC_BIAS_STANDBY: + if (mclk_on) + clk_disable(mclk); + mclk_on = 0; + break; + } + + return ret; +} + static const struct snd_soc_dapm_widget at91sam9g20ek_dapm_widgets[] = { SND_SOC_DAPM_MIC("Int Mic", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), @@ -106,6 +135,7 @@ .owner = THIS_MODULE, .dai_link = &at91sam9g20ek_dai, .num_links = 1, + .set_bias_level = at91sam9g20ek_set_bias_level, .dapm_widgets = at91sam9g20ek_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets), @@ -118,6 +148,7 @@ { struct device_node *np = pdev->dev.of_node; struct device_node *codec_np, *cpu_np; + struct clk *pllb; struct snd_soc_card *card = &snd_soc_at91sam9g20ek; int ret; @@ -131,6 +162,31 @@ return -EINVAL; } + /* + * Codec MCLK is supplied by PCK0 - set it up. + */ + mclk = clk_get(NULL, "pck0"); + if (IS_ERR(mclk)) { + dev_err(&pdev->dev, "Failed to get MCLK\n"); + ret = PTR_ERR(mclk); + goto err; + } + + pllb = clk_get(NULL, "pllb"); + if (IS_ERR(pllb)) { + dev_err(&pdev->dev, "Failed to get PLLB\n"); + ret = PTR_ERR(pllb); + goto err_mclk; + } + ret = clk_set_parent(mclk, pllb); + clk_put(pllb); + if (ret != 0) { + dev_err(&pdev->dev, "Failed to set MCLK parent\n"); + goto err_mclk; + } + + clk_set_rate(mclk, MCLK_RATE); + card->dev = &pdev->dev; /* Parse device node info */ @@ -174,6 +230,9 @@ return ret; +err_mclk: + clk_put(mclk); + mclk = NULL; err: atmel_ssc_put_audio(0); return ret; @@ -183,6 +242,8 @@ { struct snd_soc_card *card = platform_get_drvdata(pdev); + clk_disable(mclk); + mclk = NULL; snd_soc_unregister_card(card); atmel_ssc_put_audio(0); reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/cs35l41-lib.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/cs35l41-lib.c @@ -831,14 +831,12 @@ GENMASK(bit_offset + otp_map[i].size - 33, 0)) << (32 - bit_offset); bit_offset += otp_map[i].size - 32; + } else { - } else if (bit_offset + otp_map[i].size - 1 >= 0) { otp_val = (otp_mem[word_offset] & GENMASK(bit_offset + otp_map[i].size - 1, bit_offset) ) >> bit_offset; bit_offset += otp_map[i].size; + } - } else /* both bit_offset and otp_map[i].size are 0 */ - otp_val = 0; - bit_sum += otp_map[i].size; if (bit_offset == 32) { reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/cs42l42.h +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/cs42l42.h @@ -2,7 +2,7 @@ /* * cs42l42.h -- CS42L42 ALSA SoC audio driver header * + * Copyright 2016 Cirrus Logic, Inc. - * Copyright 2016-2022 Cirrus Logic, Inc. * * Author: James Schulman * Author: Brian Austin @@ -14,7 +14,818 @@ #include #include + +#define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */ +#define CS42L42_WIN_START 0x00 +#define CS42L42_WIN_LEN 0x100 +#define CS42L42_RANGE_MIN 0x00 +#define CS42L42_RANGE_MAX 0x7F + +#define CS42L42_PAGE_10 0x1000 +#define CS42L42_PAGE_11 0x1100 +#define CS42L42_PAGE_12 0x1200 +#define CS42L42_PAGE_13 0x1300 +#define CS42L42_PAGE_15 0x1500 +#define CS42L42_PAGE_19 0x1900 +#define CS42L42_PAGE_1B 0x1B00 +#define CS42L42_PAGE_1C 0x1C00 +#define CS42L42_PAGE_1D 0x1D00 +#define CS42L42_PAGE_1F 0x1F00 +#define CS42L42_PAGE_20 0x2000 +#define CS42L42_PAGE_21 0x2100 +#define CS42L42_PAGE_23 0x2300 +#define CS42L42_PAGE_24 0x2400 +#define CS42L42_PAGE_25 0x2500 +#define CS42L42_PAGE_26 0x2600 +#define CS42L42_PAGE_28 0x2800 +#define CS42L42_PAGE_29 0x2900 +#define CS42L42_PAGE_2A 0x2A00 +#define CS42L42_PAGE_30 0x3000 + +#define CS42L42_CHIP_ID 0x42A42 + +/* Page 0x10 Global Registers */ +#define CS42L42_DEVID_AB (CS42L42_PAGE_10 + 0x01) +#define CS42L42_DEVID_CD (CS42L42_PAGE_10 + 0x02) +#define CS42L42_DEVID_E (CS42L42_PAGE_10 + 0x03) +#define CS42L42_FABID (CS42L42_PAGE_10 + 0x04) +#define CS42L42_REVID (CS42L42_PAGE_10 + 0x05) +#define CS42L42_FRZ_CTL (CS42L42_PAGE_10 + 0x06) + +#define CS42L42_SRC_CTL (CS42L42_PAGE_10 + 0x07) +#define CS42L42_SRC_BYPASS_DAC_SHIFT 1 +#define CS42L42_SRC_BYPASS_DAC_MASK (1 << CS42L42_SRC_BYPASS_DAC_SHIFT) + +#define CS42L42_MCLK_STATUS (CS42L42_PAGE_10 + 0x08) + +#define CS42L42_MCLK_CTL (CS42L42_PAGE_10 + 0x09) +#define CS42L42_INTERNAL_FS_SHIFT 1 +#define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT) + +#define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A) +#define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B) +#define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4) +#define CS42L42_SLOW_START_EN_SHIFT 4 +#define CS42L42_I2C_DEBOUNCE (CS42L42_PAGE_10 + 0x0E) +#define CS42L42_I2C_STRETCH (CS42L42_PAGE_10 + 0x0F) +#define CS42L42_I2C_TIMEOUT (CS42L42_PAGE_10 + 0x10) + +/* Page 0x11 Power and Headset Detect Registers */ +#define CS42L42_PWR_CTL1 (CS42L42_PAGE_11 + 0x01) +#define CS42L42_ASP_DAO_PDN_SHIFT 7 +#define CS42L42_ASP_DAO_PDN_MASK (1 << CS42L42_ASP_DAO_PDN_SHIFT) +#define CS42L42_ASP_DAI_PDN_SHIFT 6 +#define CS42L42_ASP_DAI_PDN_MASK (1 << CS42L42_ASP_DAI_PDN_SHIFT) +#define CS42L42_MIXER_PDN_SHIFT 5 +#define CS42L42_MIXER_PDN_MASK (1 << CS42L42_MIXER_PDN_SHIFT) +#define CS42L42_EQ_PDN_SHIFT 4 +#define CS42L42_EQ_PDN_MASK (1 << CS42L42_EQ_PDN_SHIFT) +#define CS42L42_HP_PDN_SHIFT 3 +#define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) +#define CS42L42_ADC_PDN_SHIFT 2 +#define CS42L42_ADC_PDN_MASK (1 << CS42L42_ADC_PDN_SHIFT) +#define CS42L42_PDN_ALL_SHIFT 0 +#define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT) + +#define CS42L42_PWR_CTL2 (CS42L42_PAGE_11 + 0x02) +#define CS42L42_ADC_SRC_PDNB_SHIFT 0 +#define CS42L42_ADC_SRC_PDNB_MASK (1 << CS42L42_ADC_SRC_PDNB_SHIFT) +#define CS42L42_DAC_SRC_PDNB_SHIFT 1 +#define CS42L42_DAC_SRC_PDNB_MASK (1 << CS42L42_DAC_SRC_PDNB_SHIFT) +#define CS42L42_ASP_DAI1_PDN_SHIFT 2 +#define CS42L42_ASP_DAI1_PDN_MASK (1 << CS42L42_ASP_DAI1_PDN_SHIFT) +#define CS42L42_SRC_PDN_OVERRIDE_SHIFT 3 +#define CS42L42_SRC_PDN_OVERRIDE_MASK (1 << CS42L42_SRC_PDN_OVERRIDE_SHIFT) +#define CS42L42_DISCHARGE_FILT_SHIFT 4 +#define CS42L42_DISCHARGE_FILT_MASK (1 << CS42L42_DISCHARGE_FILT_SHIFT) + +#define CS42L42_PWR_CTL3 (CS42L42_PAGE_11 + 0x03) +#define CS42L42_RING_SENSE_PDNB_SHIFT 1 +#define CS42L42_RING_SENSE_PDNB_MASK (1 << \ + CS42L42_RING_SENSE_PDNB_SHIFT) +#define CS42L42_VPMON_PDNB_SHIFT 2 +#define CS42L42_VPMON_PDNB_MASK (1 << \ + CS42L42_VPMON_PDNB_SHIFT) +#define CS42L42_SW_CLK_STP_STAT_SEL_SHIFT 5 +#define CS42L42_SW_CLK_STP_STAT_SEL_MASK (3 << \ + CS42L42_SW_CLK_STP_STAT_SEL_SHIFT) + +#define CS42L42_RSENSE_CTL1 (CS42L42_PAGE_11 + 0x04) +#define CS42L42_RS_TRIM_R_SHIFT 0 +#define CS42L42_RS_TRIM_R_MASK (1 << \ + CS42L42_RS_TRIM_R_SHIFT) +#define CS42L42_RS_TRIM_T_SHIFT 1 +#define CS42L42_RS_TRIM_T_MASK (1 << \ + CS42L42_RS_TRIM_T_SHIFT) +#define CS42L42_HPREF_RS_SHIFT 2 +#define CS42L42_HPREF_RS_MASK (1 << \ + CS42L42_HPREF_RS_SHIFT) +#define CS42L42_HSBIAS_FILT_REF_RS_SHIFT 3 +#define CS42L42_HSBIAS_FILT_REF_RS_MASK (1 << \ + CS42L42_HSBIAS_FILT_REF_RS_SHIFT) +#define CS42L42_RING_SENSE_PU_HIZ_SHIFT 6 +#define CS42L42_RING_SENSE_PU_HIZ_MASK (1 << \ + CS42L42_RING_SENSE_PU_HIZ_SHIFT) + +#define CS42L42_RSENSE_CTL2 (CS42L42_PAGE_11 + 0x05) +#define CS42L42_TS_RS_GATE_SHIFT 7 +#define CS42L42_TS_RS_GATE_MAS (1 << CS42L42_TS_RS_GATE_SHIFT) + +#define CS42L42_OSC_SWITCH (CS42L42_PAGE_11 + 0x07) +#define CS42L42_SCLK_PRESENT_SHIFT 0 +#define CS42L42_SCLK_PRESENT_MASK (1 << CS42L42_SCLK_PRESENT_SHIFT) + +#define CS42L42_OSC_SWITCH_STATUS (CS42L42_PAGE_11 + 0x09) +#define CS42L42_OSC_SW_SEL_STAT_SHIFT 0 +#define CS42L42_OSC_SW_SEL_STAT_MASK (3 << CS42L42_OSC_SW_SEL_STAT_SHIFT) +#define CS42L42_OSC_PDNB_STAT_SHIFT 2 +#define CS42L42_OSC_PDNB_STAT_MASK (1 << CS42L42_OSC_SW_SEL_STAT_SHIFT) + +#define CS42L42_RSENSE_CTL3 (CS42L42_PAGE_11 + 0x12) +#define CS42L42_RS_RISE_DBNCE_TIME_SHIFT 0 +#define CS42L42_RS_RISE_DBNCE_TIME_MASK (7 << \ + CS42L42_RS_RISE_DBNCE_TIME_SHIFT) +#define CS42L42_RS_FALL_DBNCE_TIME_SHIFT 3 +#define CS42L42_RS_FALL_DBNCE_TIME_MASK (7 << \ + CS42L42_RS_FALL_DBNCE_TIME_SHIFT) +#define CS42L42_RS_PU_EN_SHIFT 6 +#define CS42L42_RS_PU_EN_MASK (1 << \ + CS42L42_RS_PU_EN_SHIFT) +#define CS42L42_RS_INV_SHIFT 7 +#define CS42L42_RS_INV_MASK (1 << \ + CS42L42_RS_INV_SHIFT) + +#define CS42L42_TSENSE_CTL (CS42L42_PAGE_11 + 0x13) +#define CS42L42_TS_RISE_DBNCE_TIME_SHIFT 0 +#define CS42L42_TS_RISE_DBNCE_TIME_MASK (7 << \ + CS42L42_TS_RISE_DBNCE_TIME_SHIFT) +#define CS42L42_TS_FALL_DBNCE_TIME_SHIFT 3 +#define CS42L42_TS_FALL_DBNCE_TIME_MASK (7 << \ + CS42L42_TS_FALL_DBNCE_TIME_SHIFT) +#define CS42L42_TS_INV_SHIFT 7 +#define CS42L42_TS_INV_MASK (1 << \ + CS42L42_TS_INV_SHIFT) + +#define CS42L42_TSRS_INT_DISABLE (CS42L42_PAGE_11 + 0x14) +#define CS42L42_D_RS_PLUG_DBNC_SHIFT 0 +#define CS42L42_D_RS_PLUG_DBNC_MASK (1 << CS42L42_D_RS_PLUG_DBNC_SHIFT) +#define CS42L42_D_RS_UNPLUG_DBNC_SHIFT 1 +#define CS42L42_D_RS_UNPLUG_DBNC_MASK (1 << CS42L42_D_RS_UNPLUG_DBNC_SHIFT) +#define CS42L42_D_TS_PLUG_DBNC_SHIFT 2 +#define CS42L42_D_TS_PLUG_DBNC_MASK (1 << CS42L42_D_TS_PLUG_DBNC_SHIFT) +#define CS42L42_D_TS_UNPLUG_DBNC_SHIFT 3 +#define CS42L42_D_TS_UNPLUG_DBNC_MASK (1 << CS42L42_D_TS_UNPLUG_DBNC_SHIFT) + +#define CS42L42_TRSENSE_STATUS (CS42L42_PAGE_11 + 0x15) +#define CS42L42_RS_PLUG_DBNC_SHIFT 0 +#define CS42L42_RS_PLUG_DBNC_MASK (1 << CS42L42_RS_PLUG_DBNC_SHIFT) +#define CS42L42_RS_UNPLUG_DBNC_SHIFT 1 +#define CS42L42_RS_UNPLUG_DBNC_MASK (1 << CS42L42_RS_UNPLUG_DBNC_SHIFT) +#define CS42L42_TS_PLUG_DBNC_SHIFT 2 +#define CS42L42_TS_PLUG_DBNC_MASK (1 << CS42L42_TS_PLUG_DBNC_SHIFT) +#define CS42L42_TS_UNPLUG_DBNC_SHIFT 3 +#define CS42L42_TS_UNPLUG_DBNC_MASK (1 << CS42L42_TS_UNPLUG_DBNC_SHIFT) + +#define CS42L42_HSDET_CTL1 (CS42L42_PAGE_11 + 0x1F) +#define CS42L42_HSDET_COMP1_LVL_SHIFT 0 +#define CS42L42_HSDET_COMP1_LVL_MASK (15 << CS42L42_HSDET_COMP1_LVL_SHIFT) +#define CS42L42_HSDET_COMP2_LVL_SHIFT 4 +#define CS42L42_HSDET_COMP2_LVL_MASK (15 << CS42L42_HSDET_COMP2_LVL_SHIFT) + +#define CS42L42_HSDET_COMP1_LVL_VAL 12 /* 1.25V Comparator */ +#define CS42L42_HSDET_COMP2_LVL_VAL 2 /* 1.75V Comparator */ +#define CS42L42_HSDET_COMP1_LVL_DEFAULT 7 /* 1V Comparator */ +#define CS42L42_HSDET_COMP2_LVL_DEFAULT 7 /* 2V Comparator */ + +#define CS42L42_HSDET_CTL2 (CS42L42_PAGE_11 + 0x20) +#define CS42L42_HSDET_AUTO_TIME_SHIFT 0 +#define CS42L42_HSDET_AUTO_TIME_MASK (3 << CS42L42_HSDET_AUTO_TIME_SHIFT) +#define CS42L42_HSBIAS_REF_SHIFT 3 +#define CS42L42_HSBIAS_REF_MASK (1 << CS42L42_HSBIAS_REF_SHIFT) +#define CS42L42_HSDET_SET_SHIFT 4 +#define CS42L42_HSDET_SET_MASK (3 << CS42L42_HSDET_SET_SHIFT) +#define CS42L42_HSDET_CTRL_SHIFT 6 +#define CS42L42_HSDET_CTRL_MASK (3 << CS42L42_HSDET_CTRL_SHIFT) + +#define CS42L42_HS_SWITCH_CTL (CS42L42_PAGE_11 + 0x21) +#define CS42L42_SW_GNDHS_HS4_SHIFT 0 +#define CS42L42_SW_GNDHS_HS4_MASK (1 << CS42L42_SW_GNDHS_HS4_SHIFT) +#define CS42L42_SW_GNDHS_HS3_SHIFT 1 +#define CS42L42_SW_GNDHS_HS3_MASK (1 << CS42L42_SW_GNDHS_HS3_SHIFT) +#define CS42L42_SW_HSB_HS4_SHIFT 2 +#define CS42L42_SW_HSB_HS4_MASK (1 << CS42L42_SW_HSB_HS4_SHIFT) +#define CS42L42_SW_HSB_HS3_SHIFT 3 +#define CS42L42_SW_HSB_HS3_MASK (1 << CS42L42_SW_HSB_HS3_SHIFT) +#define CS42L42_SW_HSB_FILT_HS4_SHIFT 4 +#define CS42L42_SW_HSB_FILT_HS4_MASK (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) +#define CS42L42_SW_HSB_FILT_HS3_SHIFT 5 +#define CS42L42_SW_HSB_FILT_HS3_MASK (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) +#define CS42L42_SW_REF_HS4_SHIFT 6 +#define CS42L42_SW_REF_HS4_MASK (1 << CS42L42_SW_REF_HS4_SHIFT) +#define CS42L42_SW_REF_HS3_SHIFT 7 +#define CS42L42_SW_REF_HS3_MASK (1 << CS42L42_SW_REF_HS3_SHIFT) + +#define CS42L42_HS_DET_STATUS (CS42L42_PAGE_11 + 0x24) +#define CS42L42_HSDET_TYPE_SHIFT 0 +#define CS42L42_HSDET_TYPE_MASK (3 << CS42L42_HSDET_TYPE_SHIFT) +#define CS42L42_HSDET_COMP1_OUT_SHIFT 6 +#define CS42L42_HSDET_COMP1_OUT_MASK (1 << CS42L42_HSDET_COMP1_OUT_SHIFT) +#define CS42L42_HSDET_COMP2_OUT_SHIFT 7 +#define CS42L42_HSDET_COMP2_OUT_MASK (1 << CS42L42_HSDET_COMP2_OUT_SHIFT) +#define CS42L42_PLUG_CTIA 0 +#define CS42L42_PLUG_OMTP 1 +#define CS42L42_PLUG_HEADPHONE 2 +#define CS42L42_PLUG_INVALID 3 + +#define CS42L42_HSDET_SW_COMP1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (0 << CS42L42_SW_REF_HS4_SHIFT) | \ + (1 << CS42L42_SW_REF_HS3_SHIFT)) +#define CS42L42_HSDET_SW_COMP2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (1 << CS42L42_SW_REF_HS4_SHIFT) | \ + (0 << CS42L42_SW_REF_HS3_SHIFT)) +#define CS42L42_HSDET_SW_TYPE1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (0 << CS42L42_SW_REF_HS4_SHIFT) | \ + (1 << CS42L42_SW_REF_HS3_SHIFT)) +#define CS42L42_HSDET_SW_TYPE2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (1 << CS42L42_SW_REF_HS4_SHIFT) | \ + (0 << CS42L42_SW_REF_HS3_SHIFT)) +#define CS42L42_HSDET_SW_TYPE3 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (1 << CS42L42_SW_REF_HS4_SHIFT) | \ + (1 << CS42L42_SW_REF_HS3_SHIFT)) +#define CS42L42_HSDET_SW_TYPE4 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ + (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ + (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ + (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ + (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ + (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ + (0 << CS42L42_SW_REF_HS4_SHIFT) | \ + (1 << CS42L42_SW_REF_HS3_SHIFT)) + +#define CS42L42_HSDET_COMP_TYPE1 1 +#define CS42L42_HSDET_COMP_TYPE2 2 +#define CS42L42_HSDET_COMP_TYPE3 0 +#define CS42L42_HSDET_COMP_TYPE4 3 + +#define CS42L42_HS_CLAMP_DISABLE (CS42L42_PAGE_11 + 0x29) +#define CS42L42_HS_CLAMP_DISABLE_SHIFT 0 +#define CS42L42_HS_CLAMP_DISABLE_MASK (1 << CS42L42_HS_CLAMP_DISABLE_SHIFT) + +/* Page 0x12 Clocking Registers */ +#define CS42L42_MCLK_SRC_SEL (CS42L42_PAGE_12 + 0x01) +#define CS42L42_MCLKDIV_SHIFT 1 +#define CS42L42_MCLKDIV_MASK (1 << CS42L42_MCLKDIV_SHIFT) +#define CS42L42_MCLK_SRC_SEL_SHIFT 0 +#define CS42L42_MCLK_SRC_SEL_MASK (1 << CS42L42_MCLK_SRC_SEL_SHIFT) + +#define CS42L42_SPDIF_CLK_CFG (CS42L42_PAGE_12 + 0x02) +#define CS42L42_FSYNC_PW_LOWER (CS42L42_PAGE_12 + 0x03) + +#define CS42L42_FSYNC_PW_UPPER (CS42L42_PAGE_12 + 0x04) +#define CS42L42_FSYNC_PULSE_WIDTH_SHIFT 0 +#define CS42L42_FSYNC_PULSE_WIDTH_MASK (0xff << \ + CS42L42_FSYNC_PULSE_WIDTH_SHIFT) + +#define CS42L42_FSYNC_P_LOWER (CS42L42_PAGE_12 + 0x05) + +#define CS42L42_FSYNC_P_UPPER (CS42L42_PAGE_12 + 0x06) +#define CS42L42_FSYNC_PERIOD_SHIFT 0 +#define CS42L42_FSYNC_PERIOD_MASK (0xff << CS42L42_FSYNC_PERIOD_SHIFT) + +#define CS42L42_ASP_CLK_CFG (CS42L42_PAGE_12 + 0x07) +#define CS42L42_ASP_SCLK_EN_SHIFT 5 +#define CS42L42_ASP_SCLK_EN_MASK (1 << CS42L42_ASP_SCLK_EN_SHIFT) +#define CS42L42_ASP_MASTER_MODE 0x01 +#define CS42L42_ASP_SLAVE_MODE 0x00 +#define CS42L42_ASP_MODE_SHIFT 4 +#define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) +#define CS42L42_ASP_SCPOL_SHIFT 2 +#define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) +#define CS42L42_ASP_SCPOL_NOR 3 +#define CS42L42_ASP_LCPOL_SHIFT 0 +#define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) +#define CS42L42_ASP_LCPOL_INV 3 + +#define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) +#define CS42L42_ASP_STP_SHIFT 4 +#define CS42L42_ASP_STP_MASK (1 << CS42L42_ASP_STP_SHIFT) +#define CS42L42_ASP_5050_SHIFT 3 +#define CS42L42_ASP_5050_MASK (1 << CS42L42_ASP_5050_SHIFT) +#define CS42L42_ASP_FSD_SHIFT 0 +#define CS42L42_ASP_FSD_MASK (7 << CS42L42_ASP_FSD_SHIFT) +#define CS42L42_ASP_FSD_0_5 1 +#define CS42L42_ASP_FSD_1_0 2 +#define CS42L42_ASP_FSD_1_5 3 +#define CS42L42_ASP_FSD_2_0 4 + +#define CS42L42_FS_RATE_EN (CS42L42_PAGE_12 + 0x09) +#define CS42L42_FS_EN_SHIFT 0 +#define CS42L42_FS_EN_MASK (0xf << CS42L42_FS_EN_SHIFT) +#define CS42L42_FS_EN_IASRC_96K 0x1 +#define CS42L42_FS_EN_OASRC_96K 0x2 + +#define CS42L42_IN_ASRC_CLK (CS42L42_PAGE_12 + 0x0A) +#define CS42L42_CLK_IASRC_SEL_SHIFT 0 +#define CS42L42_CLK_IASRC_SEL_MASK (1 << CS42L42_CLK_IASRC_SEL_SHIFT) +#define CS42L42_CLK_IASRC_SEL_6 0 +#define CS42L42_CLK_IASRC_SEL_12 1 + +#define CS42L42_OUT_ASRC_CLK (CS42L42_PAGE_12 + 0x0B) +#define CS42L42_CLK_OASRC_SEL_SHIFT 0 +#define CS42L42_CLK_OASRC_SEL_MASK (1 << CS42L42_CLK_OASRC_SEL_SHIFT) +#define CS42L42_CLK_OASRC_SEL_12 1 + +#define CS42L42_PLL_DIV_CFG1 (CS42L42_PAGE_12 + 0x0C) +#define CS42L42_SCLK_PREDIV_SHIFT 0 +#define CS42L42_SCLK_PREDIV_MASK (3 << CS42L42_SCLK_PREDIV_SHIFT) + +/* Page 0x13 Interrupt Registers */ +/* Interrupts */ +#define CS42L42_ADC_OVFL_STATUS (CS42L42_PAGE_13 + 0x01) +#define CS42L42_MIXER_STATUS (CS42L42_PAGE_13 + 0x02) +#define CS42L42_SRC_STATUS (CS42L42_PAGE_13 + 0x03) +#define CS42L42_ASP_RX_STATUS (CS42L42_PAGE_13 + 0x04) +#define CS42L42_ASP_TX_STATUS (CS42L42_PAGE_13 + 0x05) +#define CS42L42_CODEC_STATUS (CS42L42_PAGE_13 + 0x08) +#define CS42L42_DET_INT_STATUS1 (CS42L42_PAGE_13 + 0x09) +#define CS42L42_DET_INT_STATUS2 (CS42L42_PAGE_13 + 0x0A) +#define CS42L42_SRCPL_INT_STATUS (CS42L42_PAGE_13 + 0x0B) +#define CS42L42_VPMON_STATUS (CS42L42_PAGE_13 + 0x0D) +#define CS42L42_PLL_LOCK_STATUS (CS42L42_PAGE_13 + 0x0E) +#define CS42L42_TSRS_PLUG_STATUS (CS42L42_PAGE_13 + 0x0F) +/* Masks */ +#define CS42L42_ADC_OVFL_INT_MASK (CS42L42_PAGE_13 + 0x16) +#define CS42L42_ADC_OVFL_SHIFT 0 +#define CS42L42_ADC_OVFL_MASK (1 << CS42L42_ADC_OVFL_SHIFT) +#define CS42L42_ADC_OVFL_VAL_MASK CS42L42_ADC_OVFL_MASK + +#define CS42L42_MIXER_INT_MASK (CS42L42_PAGE_13 + 0x17) +#define CS42L42_MIX_CHB_OVFL_SHIFT 0 +#define CS42L42_MIX_CHB_OVFL_MASK (1 << CS42L42_MIX_CHB_OVFL_SHIFT) +#define CS42L42_MIX_CHA_OVFL_SHIFT 1 +#define CS42L42_MIX_CHA_OVFL_MASK (1 << CS42L42_MIX_CHA_OVFL_SHIFT) +#define CS42L42_EQ_OVFL_SHIFT 2 +#define CS42L42_EQ_OVFL_MASK (1 << CS42L42_EQ_OVFL_SHIFT) +#define CS42L42_EQ_BIQUAD_OVFL_SHIFT 3 +#define CS42L42_EQ_BIQUAD_OVFL_MASK (1 << CS42L42_EQ_BIQUAD_OVFL_SHIFT) +#define CS42L42_MIXER_VAL_MASK (CS42L42_MIX_CHB_OVFL_MASK | \ + CS42L42_MIX_CHA_OVFL_MASK | \ + CS42L42_EQ_OVFL_MASK | \ + CS42L42_EQ_BIQUAD_OVFL_MASK) + +#define CS42L42_SRC_INT_MASK (CS42L42_PAGE_13 + 0x18) +#define CS42L42_SRC_ILK_SHIFT 0 +#define CS42L42_SRC_ILK_MASK (1 << CS42L42_SRC_ILK_SHIFT) +#define CS42L42_SRC_OLK_SHIFT 1 +#define CS42L42_SRC_OLK_MASK (1 << CS42L42_SRC_OLK_SHIFT) +#define CS42L42_SRC_IUNLK_SHIFT 2 +#define CS42L42_SRC_IUNLK_MASK (1 << CS42L42_SRC_IUNLK_SHIFT) +#define CS42L42_SRC_OUNLK_SHIFT 3 +#define CS42L42_SRC_OUNLK_MASK (1 << CS42L42_SRC_OUNLK_SHIFT) +#define CS42L42_SRC_VAL_MASK (CS42L42_SRC_ILK_MASK | \ + CS42L42_SRC_OLK_MASK | \ + CS42L42_SRC_IUNLK_MASK | \ + CS42L42_SRC_OUNLK_MASK) + +#define CS42L42_ASP_RX_INT_MASK (CS42L42_PAGE_13 + 0x19) +#define CS42L42_ASPRX_NOLRCK_SHIFT 0 +#define CS42L42_ASPRX_NOLRCK_MASK (1 << CS42L42_ASPRX_NOLRCK_SHIFT) +#define CS42L42_ASPRX_EARLY_SHIFT 1 +#define CS42L42_ASPRX_EARLY_MASK (1 << CS42L42_ASPRX_EARLY_SHIFT) +#define CS42L42_ASPRX_LATE_SHIFT 2 +#define CS42L42_ASPRX_LATE_MASK (1 << CS42L42_ASPRX_LATE_SHIFT) +#define CS42L42_ASPRX_ERROR_SHIFT 3 +#define CS42L42_ASPRX_ERROR_MASK (1 << CS42L42_ASPRX_ERROR_SHIFT) +#define CS42L42_ASPRX_OVLD_SHIFT 4 +#define CS42L42_ASPRX_OVLD_MASK (1 << CS42L42_ASPRX_OVLD_SHIFT) +#define CS42L42_ASP_RX_VAL_MASK (CS42L42_ASPRX_NOLRCK_MASK | \ + CS42L42_ASPRX_EARLY_MASK | \ + CS42L42_ASPRX_LATE_MASK | \ + CS42L42_ASPRX_ERROR_MASK | \ + CS42L42_ASPRX_OVLD_MASK) + +#define CS42L42_ASP_TX_INT_MASK (CS42L42_PAGE_13 + 0x1A) +#define CS42L42_ASPTX_NOLRCK_SHIFT 0 +#define CS42L42_ASPTX_NOLRCK_MASK (1 << CS42L42_ASPTX_NOLRCK_SHIFT) +#define CS42L42_ASPTX_EARLY_SHIFT 1 +#define CS42L42_ASPTX_EARLY_MASK (1 << CS42L42_ASPTX_EARLY_SHIFT) +#define CS42L42_ASPTX_LATE_SHIFT 2 +#define CS42L42_ASPTX_LATE_MASK (1 << CS42L42_ASPTX_LATE_SHIFT) +#define CS42L42_ASPTX_SMERROR_SHIFT 3 +#define CS42L42_ASPTX_SMERROR_MASK (1 << CS42L42_ASPTX_SMERROR_SHIFT) +#define CS42L42_ASP_TX_VAL_MASK (CS42L42_ASPTX_NOLRCK_MASK | \ + CS42L42_ASPTX_EARLY_MASK | \ + CS42L42_ASPTX_LATE_MASK | \ + CS42L42_ASPTX_SMERROR_MASK) + +#define CS42L42_CODEC_INT_MASK (CS42L42_PAGE_13 + 0x1B) +#define CS42L42_PDN_DONE_SHIFT 0 +#define CS42L42_PDN_DONE_MASK (1 << CS42L42_PDN_DONE_SHIFT) +#define CS42L42_HSDET_AUTO_DONE_SHIFT 1 +#define CS42L42_HSDET_AUTO_DONE_MASK (1 << CS42L42_HSDET_AUTO_DONE_SHIFT) +#define CS42L42_CODEC_VAL_MASK (CS42L42_PDN_DONE_MASK | \ + CS42L42_HSDET_AUTO_DONE_MASK) + +#define CS42L42_SRCPL_INT_MASK (CS42L42_PAGE_13 + 0x1C) +#define CS42L42_SRCPL_ADC_LK_SHIFT 0 +#define CS42L42_SRCPL_ADC_LK_MASK (1 << CS42L42_SRCPL_ADC_LK_SHIFT) +#define CS42L42_SRCPL_DAC_LK_SHIFT 2 +#define CS42L42_SRCPL_DAC_LK_MASK (1 << CS42L42_SRCPL_DAC_LK_SHIFT) +#define CS42L42_SRCPL_ADC_UNLK_SHIFT 5 +#define CS42L42_SRCPL_ADC_UNLK_MASK (1 << CS42L42_SRCPL_ADC_UNLK_SHIFT) +#define CS42L42_SRCPL_DAC_UNLK_SHIFT 6 +#define CS42L42_SRCPL_DAC_UNLK_MASK (1 << CS42L42_SRCPL_DAC_UNLK_SHIFT) +#define CS42L42_SRCPL_VAL_MASK (CS42L42_SRCPL_ADC_LK_MASK | \ + CS42L42_SRCPL_DAC_LK_MASK | \ + CS42L42_SRCPL_ADC_UNLK_MASK | \ + CS42L42_SRCPL_DAC_UNLK_MASK) + +#define CS42L42_VPMON_INT_MASK (CS42L42_PAGE_13 + 0x1E) +#define CS42L42_VPMON_SHIFT 0 +#define CS42L42_VPMON_MASK (1 << CS42L42_VPMON_SHIFT) +#define CS42L42_VPMON_VAL_MASK CS42L42_VPMON_MASK + +#define CS42L42_PLL_LOCK_INT_MASK (CS42L42_PAGE_13 + 0x1F) +#define CS42L42_PLL_LOCK_SHIFT 0 +#define CS42L42_PLL_LOCK_MASK (1 << CS42L42_PLL_LOCK_SHIFT) +#define CS42L42_PLL_LOCK_VAL_MASK CS42L42_PLL_LOCK_MASK + +#define CS42L42_TSRS_PLUG_INT_MASK (CS42L42_PAGE_13 + 0x20) +#define CS42L42_RS_PLUG_SHIFT 0 +#define CS42L42_RS_PLUG_MASK (1 << CS42L42_RS_PLUG_SHIFT) +#define CS42L42_RS_UNPLUG_SHIFT 1 +#define CS42L42_RS_UNPLUG_MASK (1 << CS42L42_RS_UNPLUG_SHIFT) +#define CS42L42_TS_PLUG_SHIFT 2 +#define CS42L42_TS_PLUG_MASK (1 << CS42L42_TS_PLUG_SHIFT) +#define CS42L42_TS_UNPLUG_SHIFT 3 +#define CS42L42_TS_UNPLUG_MASK (1 << CS42L42_TS_UNPLUG_SHIFT) +#define CS42L42_TSRS_PLUG_VAL_MASK (CS42L42_RS_PLUG_MASK | \ + CS42L42_RS_UNPLUG_MASK | \ + CS42L42_TS_PLUG_MASK | \ + CS42L42_TS_UNPLUG_MASK) +#define CS42L42_TS_PLUG 3 +#define CS42L42_TS_UNPLUG 0 +#define CS42L42_TS_TRANS 1 + +/* Page 0x15 Fractional-N PLL Registers */ +#define CS42L42_PLL_CTL1 (CS42L42_PAGE_15 + 0x01) +#define CS42L42_PLL_START_SHIFT 0 +#define CS42L42_PLL_START_MASK (1 << CS42L42_PLL_START_SHIFT) + +#define CS42L42_PLL_DIV_FRAC0 (CS42L42_PAGE_15 + 0x02) +#define CS42L42_PLL_DIV_FRAC_SHIFT 0 +#define CS42L42_PLL_DIV_FRAC_MASK (0xff << CS42L42_PLL_DIV_FRAC_SHIFT) + +#define CS42L42_PLL_DIV_FRAC1 (CS42L42_PAGE_15 + 0x03) +#define CS42L42_PLL_DIV_FRAC2 (CS42L42_PAGE_15 + 0x04) + +#define CS42L42_PLL_DIV_INT (CS42L42_PAGE_15 + 0x05) +#define CS42L42_PLL_DIV_INT_SHIFT 0 +#define CS42L42_PLL_DIV_INT_MASK (0xff << CS42L42_PLL_DIV_INT_SHIFT) + +#define CS42L42_PLL_CTL3 (CS42L42_PAGE_15 + 0x08) +#define CS42L42_PLL_DIVOUT_SHIFT 0 +#define CS42L42_PLL_DIVOUT_MASK (0xff << CS42L42_PLL_DIVOUT_SHIFT) + +#define CS42L42_PLL_CAL_RATIO (CS42L42_PAGE_15 + 0x0A) +#define CS42L42_PLL_CAL_RATIO_SHIFT 0 +#define CS42L42_PLL_CAL_RATIO_MASK (0xff << CS42L42_PLL_CAL_RATIO_SHIFT) + +#define CS42L42_PLL_CTL4 (CS42L42_PAGE_15 + 0x1B) +#define CS42L42_PLL_MODE_SHIFT 0 +#define CS42L42_PLL_MODE_MASK (3 << CS42L42_PLL_MODE_SHIFT) + +/* Page 0x19 HP Load Detect Registers */ +#define CS42L42_LOAD_DET_RCSTAT (CS42L42_PAGE_19 + 0x25) +#define CS42L42_RLA_STAT_SHIFT 0 +#define CS42L42_RLA_STAT_MASK (3 << CS42L42_RLA_STAT_SHIFT) +#define CS42L42_RLA_STAT_15_OHM 0 + +#define CS42L42_LOAD_DET_DONE (CS42L42_PAGE_19 + 0x26) +#define CS42L42_HPLOAD_DET_DONE_SHIFT 0 +#define CS42L42_HPLOAD_DET_DONE_MASK (1 << CS42L42_HPLOAD_DET_DONE_SHIFT) + +#define CS42L42_LOAD_DET_EN (CS42L42_PAGE_19 + 0x27) +#define CS42L42_HP_LD_EN_SHIFT 0 +#define CS42L42_HP_LD_EN_MASK (1 << CS42L42_HP_LD_EN_SHIFT) + +/* Page 0x1B Headset Interface Registers */ +#define CS42L42_HSBIAS_SC_AUTOCTL (CS42L42_PAGE_1B + 0x70) +#define CS42L42_HSBIAS_SENSE_TRIP_SHIFT 0 +#define CS42L42_HSBIAS_SENSE_TRIP_MASK (7 << \ + CS42L42_HSBIAS_SENSE_TRIP_SHIFT) +#define CS42L42_TIP_SENSE_EN_SHIFT 5 +#define CS42L42_TIP_SENSE_EN_MASK (1 << \ + CS42L42_TIP_SENSE_EN_SHIFT) +#define CS42L42_AUTO_HSBIAS_HIZ_SHIFT 6 +#define CS42L42_AUTO_HSBIAS_HIZ_MASK (1 << \ + CS42L42_AUTO_HSBIAS_HIZ_SHIFT) +#define CS42L42_HSBIAS_SENSE_EN_SHIFT 7 +#define CS42L42_HSBIAS_SENSE_EN_MASK (1 << \ + CS42L42_HSBIAS_SENSE_EN_SHIFT) + +#define CS42L42_WAKE_CTL (CS42L42_PAGE_1B + 0x71) +#define CS42L42_WAKEB_CLEAR_SHIFT 0 +#define CS42L42_WAKEB_CLEAR_MASK (1 << CS42L42_WAKEB_CLEAR_SHIFT) +#define CS42L42_WAKEB_MODE_SHIFT 5 +#define CS42L42_WAKEB_MODE_MASK (1 << CS42L42_WAKEB_MODE_SHIFT) +#define CS42L42_M_HP_WAKE_SHIFT 6 +#define CS42L42_M_HP_WAKE_MASK (1 << CS42L42_M_HP_WAKE_SHIFT) +#define CS42L42_M_MIC_WAKE_SHIFT 7 +#define CS42L42_M_MIC_WAKE_MASK (1 << CS42L42_M_MIC_WAKE_SHIFT) + +#define CS42L42_ADC_DISABLE_MUTE (CS42L42_PAGE_1B + 0x72) +#define CS42L42_ADC_DISABLE_S0_MUTE_SHIFT 7 +#define CS42L42_ADC_DISABLE_S0_MUTE_MASK (1 << \ + CS42L42_ADC_DISABLE_S0_MUTE_SHIFT) + +#define CS42L42_TIPSENSE_CTL (CS42L42_PAGE_1B + 0x73) +#define CS42L42_TIP_SENSE_DEBOUNCE_SHIFT 0 +#define CS42L42_TIP_SENSE_DEBOUNCE_MASK (3 << \ + CS42L42_TIP_SENSE_DEBOUNCE_SHIFT) +#define CS42L42_TIP_SENSE_INV_SHIFT 5 +#define CS42L42_TIP_SENSE_INV_MASK (1 << \ + CS42L42_TIP_SENSE_INV_SHIFT) +#define CS42L42_TIP_SENSE_CTRL_SHIFT 6 +#define CS42L42_TIP_SENSE_CTRL_MASK (3 << \ + CS42L42_TIP_SENSE_CTRL_SHIFT) + +#define CS42L42_MISC_DET_CTL (CS42L42_PAGE_1B + 0x74) +#define CS42L42_PDN_MIC_LVL_DET_SHIFT 0 +#define CS42L42_PDN_MIC_LVL_DET_MASK (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT) +#define CS42L42_HSBIAS_CTL_SHIFT 1 +#define CS42L42_HSBIAS_CTL_MASK (3 << CS42L42_HSBIAS_CTL_SHIFT) +#define CS42L42_DETECT_MODE_SHIFT 3 +#define CS42L42_DETECT_MODE_MASK (3 << CS42L42_DETECT_MODE_SHIFT) + +#define CS42L42_MIC_DET_CTL1 (CS42L42_PAGE_1B + 0x75) +#define CS42L42_HS_DET_LEVEL_SHIFT 0 +#define CS42L42_HS_DET_LEVEL_MASK (0x3F << CS42L42_HS_DET_LEVEL_SHIFT) +#define CS42L42_EVENT_STAT_SEL_SHIFT 6 +#define CS42L42_EVENT_STAT_SEL_MASK (1 << CS42L42_EVENT_STAT_SEL_SHIFT) +#define CS42L42_LATCH_TO_VP_SHIFT 7 +#define CS42L42_LATCH_TO_VP_MASK (1 << CS42L42_LATCH_TO_VP_SHIFT) + +#define CS42L42_MIC_DET_CTL2 (CS42L42_PAGE_1B + 0x76) +#define CS42L42_DEBOUNCE_TIME_SHIFT 5 +#define CS42L42_DEBOUNCE_TIME_MASK (0x07 << CS42L42_DEBOUNCE_TIME_SHIFT) + +#define CS42L42_DET_STATUS1 (CS42L42_PAGE_1B + 0x77) +#define CS42L42_HSBIAS_HIZ_MODE_SHIFT 6 +#define CS42L42_HSBIAS_HIZ_MODE_MASK (1 << CS42L42_HSBIAS_HIZ_MODE_SHIFT) +#define CS42L42_TIP_SENSE_SHIFT 7 +#define CS42L42_TIP_SENSE_MASK (1 << CS42L42_TIP_SENSE_SHIFT) + +#define CS42L42_DET_STATUS2 (CS42L42_PAGE_1B + 0x78) +#define CS42L42_SHORT_TRUE_SHIFT 0 +#define CS42L42_SHORT_TRUE_MASK (1 << CS42L42_SHORT_TRUE_SHIFT) +#define CS42L42_HS_TRUE_SHIFT 1 +#define CS42L42_HS_TRUE_MASK (1 << CS42L42_HS_TRUE_SHIFT) + +#define CS42L42_DET_INT1_MASK (CS42L42_PAGE_1B + 0x79) +#define CS42L42_TIP_SENSE_UNPLUG_SHIFT 5 +#define CS42L42_TIP_SENSE_UNPLUG_MASK (1 << CS42L42_TIP_SENSE_UNPLUG_SHIFT) +#define CS42L42_TIP_SENSE_PLUG_SHIFT 6 +#define CS42L42_TIP_SENSE_PLUG_MASK (1 << CS42L42_TIP_SENSE_PLUG_SHIFT) +#define CS42L42_HSBIAS_SENSE_SHIFT 7 +#define CS42L42_HSBIAS_SENSE_MASK (1 << CS42L42_HSBIAS_SENSE_SHIFT) +#define CS42L42_DET_INT_VAL1_MASK (CS42L42_TIP_SENSE_UNPLUG_MASK | \ + CS42L42_TIP_SENSE_PLUG_MASK | \ + CS42L42_HSBIAS_SENSE_MASK) + +#define CS42L42_DET_INT2_MASK (CS42L42_PAGE_1B + 0x7A) +#define CS42L42_M_SHORT_DET_SHIFT 0 +#define CS42L42_M_SHORT_DET_MASK (1 << \ + CS42L42_M_SHORT_DET_SHIFT) +#define CS42L42_M_SHORT_RLS_SHIFT 1 +#define CS42L42_M_SHORT_RLS_MASK (1 << \ + CS42L42_M_SHORT_RLS_SHIFT) +#define CS42L42_M_HSBIAS_HIZ_SHIFT 2 +#define CS42L42_M_HSBIAS_HIZ_MASK (1 << \ + CS42L42_M_HSBIAS_HIZ_SHIFT) +#define CS42L42_M_DETECT_FT_SHIFT 6 +#define CS42L42_M_DETECT_FT_MASK (1 << \ + CS42L42_M_DETECT_FT_SHIFT) +#define CS42L42_M_DETECT_TF_SHIFT 7 +#define CS42L42_M_DETECT_TF_MASK (1 << \ + CS42L42_M_DETECT_TF_SHIFT) +#define CS42L42_DET_INT_VAL2_MASK (CS42L42_M_SHORT_DET_MASK | \ + CS42L42_M_SHORT_RLS_MASK | \ + CS42L42_M_HSBIAS_HIZ_MASK | \ + CS42L42_M_DETECT_FT_MASK | \ + CS42L42_M_DETECT_TF_MASK) + +/* Page 0x1C Headset Bias Registers */ +#define CS42L42_HS_BIAS_CTL (CS42L42_PAGE_1C + 0x03) +#define CS42L42_HSBIAS_RAMP_SHIFT 0 +#define CS42L42_HSBIAS_RAMP_MASK (3 << CS42L42_HSBIAS_RAMP_SHIFT) +#define CS42L42_HSBIAS_PD_SHIFT 4 +#define CS42L42_HSBIAS_PD_MASK (1 << CS42L42_HSBIAS_PD_SHIFT) +#define CS42L42_HSBIAS_CAPLESS_SHIFT 7 +#define CS42L42_HSBIAS_CAPLESS_MASK (1 << CS42L42_HSBIAS_CAPLESS_SHIFT) + +/* Page 0x1D ADC Registers */ +#define CS42L42_ADC_CTL (CS42L42_PAGE_1D + 0x01) +#define CS42L42_ADC_NOTCH_DIS_SHIFT 5 +#define CS42L42_ADC_FORCE_WEAK_VCM_SHIFT 4 +#define CS42L42_ADC_INV_SHIFT 2 +#define CS42L42_ADC_DIG_BOOST_SHIFT 0 + +#define CS42L42_ADC_VOLUME (CS42L42_PAGE_1D + 0x03) +#define CS42L42_ADC_VOL_SHIFT 0 + +#define CS42L42_ADC_WNF_HPF_CTL (CS42L42_PAGE_1D + 0x04) +#define CS42L42_ADC_WNF_CF_SHIFT 4 +#define CS42L42_ADC_WNF_EN_SHIFT 3 +#define CS42L42_ADC_HPF_CF_SHIFT 1 +#define CS42L42_ADC_HPF_EN_SHIFT 0 + +/* Page 0x1F DAC Registers */ +#define CS42L42_DAC_CTL1 (CS42L42_PAGE_1F + 0x01) +#define CS42L42_DACB_INV_SHIFT 1 +#define CS42L42_DACA_INV_SHIFT 0 + +#define CS42L42_DAC_CTL2 (CS42L42_PAGE_1F + 0x06) +#define CS42L42_HPOUT_PULLDOWN_SHIFT 4 +#define CS42L42_HPOUT_PULLDOWN_MASK (15 << CS42L42_HPOUT_PULLDOWN_SHIFT) +#define CS42L42_HPOUT_LOAD_SHIFT 3 +#define CS42L42_HPOUT_LOAD_MASK (1 << CS42L42_HPOUT_LOAD_SHIFT) +#define CS42L42_HPOUT_CLAMP_SHIFT 2 +#define CS42L42_HPOUT_CLAMP_MASK (1 << CS42L42_HPOUT_CLAMP_SHIFT) +#define CS42L42_DAC_HPF_EN_SHIFT 1 +#define CS42L42_DAC_HPF_EN_MASK (1 << CS42L42_DAC_HPF_EN_SHIFT) +#define CS42L42_DAC_MON_EN_SHIFT 0 +#define CS42L42_DAC_MON_EN_MASK (1 << CS42L42_DAC_MON_EN_SHIFT) + +/* Page 0x20 HP CTL Registers */ +#define CS42L42_HP_CTL (CS42L42_PAGE_20 + 0x01) +#define CS42L42_HP_ANA_BMUTE_SHIFT 3 +#define CS42L42_HP_ANA_BMUTE_MASK (1 << CS42L42_HP_ANA_BMUTE_SHIFT) +#define CS42L42_HP_ANA_AMUTE_SHIFT 2 +#define CS42L42_HP_ANA_AMUTE_MASK (1 << CS42L42_HP_ANA_AMUTE_SHIFT) +#define CS42L42_HP_FULL_SCALE_VOL_SHIFT 1 +#define CS42L42_HP_FULL_SCALE_VOL_MASK (1 << CS42L42_HP_FULL_SCALE_VOL_SHIFT) + +/* Page 0x21 Class H Registers */ +#define CS42L42_CLASSH_CTL (CS42L42_PAGE_21 + 0x01) + +/* Page 0x23 Mixer Volume Registers */ +#define CS42L42_MIXER_CHA_VOL (CS42L42_PAGE_23 + 0x01) +#define CS42L42_MIXER_ADC_VOL (CS42L42_PAGE_23 + 0x02) + +#define CS42L42_MIXER_CHB_VOL (CS42L42_PAGE_23 + 0x03) +#define CS42L42_MIXER_CH_VOL_SHIFT 0 +#define CS42L42_MIXER_CH_VOL_MASK (0x3f << CS42L42_MIXER_CH_VOL_SHIFT) + +/* Page 0x24 EQ Registers */ +#define CS42L42_EQ_COEF_IN0 (CS42L42_PAGE_24 + 0x01) +#define CS42L42_EQ_COEF_IN1 (CS42L42_PAGE_24 + 0x02) +#define CS42L42_EQ_COEF_IN2 (CS42L42_PAGE_24 + 0x03) +#define CS42L42_EQ_COEF_IN3 (CS42L42_PAGE_24 + 0x04) +#define CS42L42_EQ_COEF_RW (CS42L42_PAGE_24 + 0x06) +#define CS42L42_EQ_COEF_OUT0 (CS42L42_PAGE_24 + 0x07) +#define CS42L42_EQ_COEF_OUT1 (CS42L42_PAGE_24 + 0x08) +#define CS42L42_EQ_COEF_OUT2 (CS42L42_PAGE_24 + 0x09) +#define CS42L42_EQ_COEF_OUT3 (CS42L42_PAGE_24 + 0x0A) +#define CS42L42_EQ_INIT_STAT (CS42L42_PAGE_24 + 0x0B) +#define CS42L42_EQ_START_FILT (CS42L42_PAGE_24 + 0x0C) +#define CS42L42_EQ_MUTE_CTL (CS42L42_PAGE_24 + 0x0E) + +/* Page 0x25 Audio Port Registers */ +#define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01) +#define CS42L42_SP_RX_CHB_SEL_SHIFT 2 +#define CS42L42_SP_RX_CHB_SEL_MASK (3 << CS42L42_SP_RX_CHB_SEL_SHIFT) + +#define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02) +#define CS42L42_SP_RX_RSYNC_SHIFT 6 +#define CS42L42_SP_RX_RSYNC_MASK (1 << CS42L42_SP_RX_RSYNC_SHIFT) +#define CS42L42_SP_RX_NSB_POS_SHIFT 3 +#define CS42L42_SP_RX_NSB_POS_MASK (7 << CS42L42_SP_RX_NSB_POS_SHIFT) +#define CS42L42_SP_RX_NFS_NSBB_SHIFT 2 +#define CS42L42_SP_RX_NFS_NSBB_MASK (1 << CS42L42_SP_RX_NFS_NSBB_SHIFT) +#define CS42L42_SP_RX_ISOC_MODE_SHIFT 0 +#define CS42L42_SP_RX_ISOC_MODE_MASK (3 << CS42L42_SP_RX_ISOC_MODE_SHIFT) + +#define CS42L42_SP_RX_FS (CS42L42_PAGE_25 + 0x03) +#define CS42l42_SPDIF_CH_SEL (CS42L42_PAGE_25 + 0x04) +#define CS42L42_SP_TX_ISOC_CTL (CS42L42_PAGE_25 + 0x05) +#define CS42L42_SP_TX_FS (CS42L42_PAGE_25 + 0x06) +#define CS42L42_SPDIF_SW_CTL1 (CS42L42_PAGE_25 + 0x07) + +/* Page 0x26 SRC Registers */ +#define CS42L42_SRC_SDIN_FS (CS42L42_PAGE_26 + 0x01) +#define CS42L42_SRC_SDIN_FS_SHIFT 0 +#define CS42L42_SRC_SDIN_FS_MASK (0x1f << CS42L42_SRC_SDIN_FS_SHIFT) + +#define CS42L42_SRC_SDOUT_FS (CS42L42_PAGE_26 + 0x09) + +/* Page 0x28 S/PDIF Registers */ +#define CS42L42_SPDIF_CTL1 (CS42L42_PAGE_28 + 0x01) +#define CS42L42_SPDIF_CTL2 (CS42L42_PAGE_28 + 0x02) +#define CS42L42_SPDIF_CTL3 (CS42L42_PAGE_28 + 0x03) +#define CS42L42_SPDIF_CTL4 (CS42L42_PAGE_28 + 0x04) + +/* Page 0x29 Serial Port TX Registers */ +#define CS42L42_ASP_TX_SZ_EN (CS42L42_PAGE_29 + 0x01) +#define CS42L42_ASP_TX_EN_SHIFT 0 +#define CS42L42_ASP_TX_CH_EN (CS42L42_PAGE_29 + 0x02) +#define CS42L42_ASP_TX0_CH2_SHIFT 1 +#define CS42L42_ASP_TX0_CH1_SHIFT 0 + +#define CS42L42_ASP_TX_CH_AP_RES (CS42L42_PAGE_29 + 0x03) +#define CS42L42_ASP_TX_CH1_AP_SHIFT 7 +#define CS42L42_ASP_TX_CH1_AP_MASK (1 << CS42L42_ASP_TX_CH1_AP_SHIFT) +#define CS42L42_ASP_TX_CH2_AP_SHIFT 6 +#define CS42L42_ASP_TX_CH2_AP_MASK (1 << CS42L42_ASP_TX_CH2_AP_SHIFT) +#define CS42L42_ASP_TX_CH2_RES_SHIFT 2 +#define CS42L42_ASP_TX_CH2_RES_MASK (3 << CS42L42_ASP_TX_CH2_RES_SHIFT) +#define CS42L42_ASP_TX_CH1_RES_SHIFT 0 +#define CS42L42_ASP_TX_CH1_RES_MASK (3 << CS42L42_ASP_TX_CH1_RES_SHIFT) +#define CS42L42_ASP_TX_CH1_BIT_MSB (CS42L42_PAGE_29 + 0x04) +#define CS42L42_ASP_TX_CH1_BIT_LSB (CS42L42_PAGE_29 + 0x05) +#define CS42L42_ASP_TX_HIZ_DLY_CFG (CS42L42_PAGE_29 + 0x06) +#define CS42L42_ASP_TX_CH2_BIT_MSB (CS42L42_PAGE_29 + 0x0A) +#define CS42L42_ASP_TX_CH2_BIT_LSB (CS42L42_PAGE_29 + 0x0B) + +/* Page 0x2A Serial Port RX Registers */ +#define CS42L42_ASP_RX_DAI0_EN (CS42L42_PAGE_2A + 0x01) +#define CS42L42_ASP_RX0_CH_EN_SHIFT 2 +#define CS42L42_ASP_RX0_CH_EN_MASK (0xf << CS42L42_ASP_RX0_CH_EN_SHIFT) +#define CS42L42_ASP_RX0_CH1_SHIFT 2 +#define CS42L42_ASP_RX0_CH2_SHIFT 3 +#define CS42L42_ASP_RX0_CH3_SHIFT 4 +#define CS42L42_ASP_RX0_CH4_SHIFT 5 + +#define CS42L42_ASP_RX_DAI0_CH1_AP_RES (CS42L42_PAGE_2A + 0x02) +#define CS42L42_ASP_RX_DAI0_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x03) +#define CS42L42_ASP_RX_DAI0_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x04) +#define CS42L42_ASP_RX_DAI0_CH2_AP_RES (CS42L42_PAGE_2A + 0x05) +#define CS42L42_ASP_RX_DAI0_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x06) +#define CS42L42_ASP_RX_DAI0_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x07) +#define CS42L42_ASP_RX_DAI0_CH3_AP_RES (CS42L42_PAGE_2A + 0x08) +#define CS42L42_ASP_RX_DAI0_CH3_BIT_MSB (CS42L42_PAGE_2A + 0x09) +#define CS42L42_ASP_RX_DAI0_CH3_BIT_LSB (CS42L42_PAGE_2A + 0x0A) +#define CS42L42_ASP_RX_DAI0_CH4_AP_RES (CS42L42_PAGE_2A + 0x0B) +#define CS42L42_ASP_RX_DAI0_CH4_BIT_MSB (CS42L42_PAGE_2A + 0x0C) +#define CS42L42_ASP_RX_DAI0_CH4_BIT_LSB (CS42L42_PAGE_2A + 0x0D) +#define CS42L42_ASP_RX_DAI1_CH1_AP_RES (CS42L42_PAGE_2A + 0x0E) +#define CS42L42_ASP_RX_DAI1_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x0F) +#define CS42L42_ASP_RX_DAI1_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x10) +#define CS42L42_ASP_RX_DAI1_CH2_AP_RES (CS42L42_PAGE_2A + 0x11) +#define CS42L42_ASP_RX_DAI1_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x12) +#define CS42L42_ASP_RX_DAI1_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x13) + +#define CS42L42_ASP_RX_CH_AP_SHIFT 6 +#define CS42L42_ASP_RX_CH_AP_MASK (1 << CS42L42_ASP_RX_CH_AP_SHIFT) +#define CS42L42_ASP_RX_CH_AP_LOW 0 +#define CS42L42_ASP_RX_CH_AP_HI 1 +#define CS42L42_ASP_RX_CH_RES_SHIFT 0 +#define CS42L42_ASP_RX_CH_RES_MASK (3 << CS42L42_ASP_RX_CH_RES_SHIFT) +#define CS42L42_ASP_RX_CH_RES_32 3 +#define CS42L42_ASP_RX_CH_RES_16 1 +#define CS42L42_ASP_RX_CH_BIT_ST_SHIFT 0 +#define CS42L42_ASP_RX_CH_BIT_ST_MASK (0xff << CS42L42_ASP_RX_CH_BIT_ST_SHIFT) + +/* Page 0x30 ID Registers */ +#define CS42L42_SUB_REVID (CS42L42_PAGE_30 + 0x14) +#define CS42L42_MAX_REGISTER (CS42L42_PAGE_30 + 0x14) + +/* Defines for fracturing values spread across multiple registers */ +#define CS42L42_FRAC0_VAL(val) ((val) & 0x0000ff) +#define CS42L42_FRAC1_VAL(val) (((val) & 0x00ff00) >> 8) +#define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) + +#define CS42L42_NUM_SUPPLIES 5 +#define CS42L42_BOOT_TIME_US 3000 +#define CS42L42_PLL_DIVOUT_TIME_US 800 +#define CS42L42_CLOCK_SWITCH_DELAY_US 150 +#define CS42L42_PLL_LOCK_POLL_US 250 +#define CS42L42_PLL_LOCK_TIMEOUT_US 1250 +#define CS42L42_HP_ADC_EN_TIME_US 20000 -#include static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { "VA", reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/da7219.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/da7219.c @@ -446,7 +446,7 @@ struct soc_mixer_control *mixer_ctrl = (struct soc_mixer_control *) kcontrol->private_value; unsigned int reg = mixer_ctrl->reg; + __le16 val; - __le16 val_new, val_old; int ret; /* @@ -454,19 +454,13 @@ * Therefore we need to convert to little endian here to align with * HW registers. */ + val = cpu_to_le16(ucontrol->value.integer.value[0]); - val_new = cpu_to_le16(ucontrol->value.integer.value[0]); mutex_lock(&da7219->ctrl_lock); + ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val)); - ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old)); - if (ret == 0 && (val_old != val_new)) - ret = regmap_raw_write(da7219->regmap, reg, - &val_new, sizeof(val_new)); mutex_unlock(&da7219->ctrl_lock); + return ret; - if (ret < 0) - return ret; - - return val_old != val_new; } diff -u linux-oem-5.17-5.17.0/sound/soc/codecs/msm8916-wcd-digital.c linux-oem-5.17-5.17.0/sound/soc/codecs/msm8916-wcd-digital.c --- linux-oem-5.17-5.17.0/sound/soc/codecs/msm8916-wcd-digital.c +++ linux-oem-5.17-5.17.0/sound/soc/codecs/msm8916-wcd-digital.c @@ -1206,16 +1206,9 @@ dev_set_drvdata(dev, priv); - ret = devm_snd_soc_register_component(dev, &msm8916_wcd_digital, + return devm_snd_soc_register_component(dev, &msm8916_wcd_digital, msm8916_wcd_digital_dai, ARRAY_SIZE(msm8916_wcd_digital_dai)); - if (ret) - goto err_mclk; - - return 0; - -err_mclk: - clk_disable_unprepare(priv->mclk); err_clk: clk_disable_unprepare(priv->ahbclk); return ret; diff -u linux-oem-5.17-5.17.0/sound/soc/codecs/rk817_codec.c linux-oem-5.17-5.17.0/sound/soc/codecs/rk817_codec.c --- linux-oem-5.17-5.17.0/sound/soc/codecs/rk817_codec.c +++ linux-oem-5.17-5.17.0/sound/soc/codecs/rk817_codec.c @@ -489,7 +489,7 @@ rk817_codec_parse_dt_property(&pdev->dev, rk817_codec_data); - rk817_codec_data->mclk = devm_clk_get(pdev->dev.parent, "mclk"); + rk817_codec_data->mclk = clk_get(pdev->dev.parent, "mclk"); if (IS_ERR(rk817_codec_data->mclk)) { dev_dbg(&pdev->dev, "Unable to get mclk\n"); ret = -ENXIO; reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/rt5682.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/rt5682.c @@ -1100,15 +1100,6 @@ return; } - if (rt5682->is_sdw) { - if (pm_runtime_status_suspended(rt5682->slave->dev.parent)) { - dev_dbg(&rt5682->slave->dev, - "%s: parent device is pm_runtime_status_suspended, skipping jack detection\n", - __func__); - return; - } - } - dapm = snd_soc_component_get_dapm(rt5682->component); snd_soc_dapm_mutex_lock(dapm); @@ -2831,11 +2822,14 @@ for_each_component_dais(component, dai) if (dai->id == RT5682_AIF1) + break; + if (!dai) { + dev_err(rt5682->i2c_dev, "dai %d not found in component\n", + RT5682_AIF1); + return -ENODEV; + } - return rt5682_set_bclk1_ratio(dai, factor); + return rt5682_set_bclk1_ratio(dai, factor); - dev_err(rt5682->i2c_dev, "dai %d not found in component\n", - RT5682_AIF1); - return -ENODEV; } static const struct clk_ops rt5682_dai_clk_ops[RT5682_DAI_NUM_CLKS] = { diff -u linux-oem-5.17-5.17.0/sound/soc/codecs/rt5682s.c linux-oem-5.17-5.17.0/sound/soc/codecs/rt5682s.c --- linux-oem-5.17-5.17.0/sound/soc/codecs/rt5682s.c +++ linux-oem-5.17-5.17.0/sound/soc/codecs/rt5682s.c @@ -2679,11 +2679,14 @@ for_each_component_dais(component, dai) if (dai->id == RT5682S_AIF1) - return rt5682s_set_bclk1_ratio(dai, factor); + break; + if (!dai) { + dev_err(component->dev, "dai %d not found in component\n", + RT5682S_AIF1); + return -ENODEV; + } - dev_err(component->dev, "dai %d not found in component\n", - RT5682S_AIF1); - return -ENODEV; + return rt5682s_set_bclk1_ratio(dai, factor); } static const struct clk_ops rt5682s_dai_clk_ops[RT5682S_DAI_NUM_CLKS] = { reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/rt711.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/rt711.c @@ -245,13 +245,6 @@ if (!rt711->component->card->instantiated) return; - if (pm_runtime_status_suspended(rt711->slave->dev.parent)) { - dev_dbg(&rt711->slave->dev, - "%s: parent device is pm_runtime_status_suspended, skipping jack detection\n", - __func__); - return; - } - reg = RT711_VERB_GET_PIN_SENSE | RT711_HP_OUT; ret = regmap_read(rt711->regmap, reg, &jack_status); if (ret < 0) reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/rt9120.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/rt9120.c @@ -341,6 +341,7 @@ { switch (reg) { case 0x00: + case 0x09: case 0x20 ... 0x27: return 2; case 0x30 ... 0x3D: diff -u linux-oem-5.17-5.17.0/sound/soc/codecs/wcd934x.c linux-oem-5.17-5.17.0/sound/soc/codecs/wcd934x.c --- linux-oem-5.17-5.17.0/sound/soc/codecs/wcd934x.c +++ linux-oem-5.17-5.17.0/sound/soc/codecs/wcd934x.c @@ -1274,7 +1274,29 @@ if (sido_src == wcd->sido_input_src) return 0; - if (sido_src == SIDO_SOURCE_RCO_BG) { + if (sido_src == SIDO_SOURCE_INTERNAL) { + regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, + WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, 0); + usleep_range(100, 110); + regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, + WCD934X_ANA_BUCK_HI_ACCU_PRE_ENX_MASK, 0x0); + usleep_range(100, 110); + regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, + WCD934X_ANA_RCO_BG_EN_MASK, 0); + usleep_range(100, 110); + regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, + WCD934X_ANA_BUCK_PRE_EN1_MASK, + WCD934X_ANA_BUCK_PRE_EN1_ENABLE); + usleep_range(100, 110); + regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, + WCD934X_ANA_BUCK_PRE_EN2_MASK, + WCD934X_ANA_BUCK_PRE_EN2_ENABLE); + usleep_range(100, 110); + regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, + WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, + WCD934X_ANA_BUCK_HI_ACCU_ENABLE); + usleep_range(100, 110); + } else if (sido_src == SIDO_SOURCE_RCO_BG) { regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, WCD934X_ANA_RCO_BG_EN_MASK, WCD934X_ANA_RCO_BG_ENABLE); @@ -1360,6 +1382,8 @@ regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, WCD934X_EXT_CLK_BUF_EN_MASK | WCD934X_MCLK_EN_MASK, 0x0); + wcd934x_set_sido_input_src(wcd, SIDO_SOURCE_INTERNAL); + regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, WCD934X_ANA_BIAS_EN_MASK, 0); regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/wm8731.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/wm8731.c @@ -602,7 +602,7 @@ ret = wm8731_reset(wm8731->regmap); if (ret < 0) { dev_err(dev, "Failed to issue reset: %d\n", ret); + goto err_regulator_enable; - goto err; } /* Clear POWEROFF, keep everything else disabled */ @@ -619,7 +619,10 @@ regcache_mark_dirty(wm8731->regmap); +err_regulator_enable: + /* Regulators will be enabled by bias management */ + regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); + -err: return ret; } @@ -757,27 +760,21 @@ ret = PTR_ERR(wm8731->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); + return ret; - goto err_regulator_enable; } ret = wm8731_hw_init(&i2c->dev, wm8731); if (ret != 0) + return ret; - goto err_regulator_enable; ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_wm8731, &wm8731_dai, 1); if (ret != 0) { dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); + return ret; - goto err_regulator_enable; } return 0; - -err_regulator_enable: - /* Regulators will be enabled by bias management */ - regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); - - return ret; } static int wm8731_i2c_remove(struct i2c_client *client) reverted: --- linux-oem-5.17-5.17.0/sound/soc/codecs/wm8958-dsp2.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/codecs/wm8958-dsp2.c @@ -530,7 +530,7 @@ wm8958_dsp_apply(component, mbc, wm8994->mbc_ena[mbc]); + return 0; - return 1; } #define WM8958_MBC_SWITCH(xname, xval) {\ @@ -656,7 +656,7 @@ wm8958_dsp_apply(component, vss, wm8994->vss_ena[vss]); + return 0; - return 1; } @@ -730,7 +730,7 @@ wm8958_dsp_apply(component, hpf % 3, ucontrol->value.integer.value[0]); + return 0; - return 1; } #define WM8958_HPF_SWITCH(xname, xval) {\ @@ -824,7 +824,7 @@ wm8958_dsp_apply(component, eq, ucontrol->value.integer.value[0]); + return 0; - return 1; } #define WM8958_ENH_EQ_SWITCH(xname, xval) {\ diff -u linux-oem-5.17-5.17.0/sound/soc/intel/common/soc-acpi-intel-tgl-match.c linux-oem-5.17-5.17.0/sound/soc/intel/common/soc-acpi-intel-tgl-match.c --- linux-oem-5.17-5.17.0/sound/soc/intel/common/soc-acpi-intel-tgl-match.c +++ linux-oem-5.17-5.17.0/sound/soc/intel/common/soc-acpi-intel-tgl-match.c @@ -132,13 +132,13 @@ { .adr = 0x000123019F837300ull, .num_endpoints = 1, - .endpoints = &spk_r_endpoint, + .endpoints = &spk_l_endpoint, .name_prefix = "Right" }, { .adr = 0x000127019F837300ull, .num_endpoints = 1, - .endpoints = &spk_l_endpoint, + .endpoints = &spk_r_endpoint, .name_prefix = "Left" } }; reverted: --- linux-oem-5.17-5.17.0/sound/soc/meson/aiu-acodec-ctrl.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/meson/aiu-acodec-ctrl.c @@ -58,7 +58,7 @@ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + return 0; - return 1; } static SOC_ENUM_SINGLE_DECL(aiu_acodec_ctrl_mux_enum, AIU_ACODEC_CTRL, reverted: --- linux-oem-5.17-5.17.0/sound/soc/meson/aiu-codec-ctrl.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/meson/aiu-codec-ctrl.c @@ -57,7 +57,7 @@ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + return 0; - return 1; } static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL, reverted: --- linux-oem-5.17-5.17.0/sound/soc/meson/axg-card.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/meson/axg-card.c @@ -320,6 +320,7 @@ dai_link->cpus = cpu; dai_link->num_cpus = 1; + dai_link->nonatomic = true; ret = meson_card_parse_dai(card, np, &dai_link->cpus->of_node, &dai_link->cpus->dai_name); reverted: --- linux-oem-5.17-5.17.0/sound/soc/meson/axg-tdm-interface.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/meson/axg-tdm-interface.c @@ -351,13 +351,29 @@ return 0; } +static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream, + int cmd, -static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct axg_tdm_stream *ts = + snd_soc_dai_get_dma_data(dai, substream); - struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + axg_tdm_stream_start(ts); + break; + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + case SNDRV_PCM_TRIGGER_STOP: + axg_tdm_stream_stop(ts); + break; + default: + return -EINVAL; + } + + return 0; - /* Force all attached formatters to update */ - return axg_tdm_stream_reset(ts); } static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) @@ -397,8 +413,8 @@ .set_fmt = axg_tdm_iface_set_fmt, .startup = axg_tdm_iface_startup, .hw_params = axg_tdm_iface_hw_params, - .prepare = axg_tdm_iface_prepare, .hw_free = axg_tdm_iface_hw_free, + .trigger = axg_tdm_iface_trigger, }; /* TDM Backend DAIs */ reverted: --- linux-oem-5.17-5.17.0/sound/soc/meson/g12a-tohdmitx.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/meson/g12a-tohdmitx.c @@ -67,7 +67,7 @@ snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + return 0; - return 1; } static SOC_ENUM_SINGLE_DECL(g12a_tohdmitx_i2s_mux_enum, TOHDMITX_CTRL0, reverted: --- linux-oem-5.17-5.17.0/sound/soc/soc-dapm.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/soc-dapm.c @@ -1687,7 +1687,8 @@ switch (w->id) { case snd_soc_dapm_pre: if (!w->event) + list_for_each_entry_safe_continue(w, n, list, + power_list); - continue; if (event == SND_SOC_DAPM_STREAM_START) ret = w->event(w, @@ -1699,7 +1700,8 @@ case snd_soc_dapm_post: if (!w->event) + list_for_each_entry_safe_continue(w, n, list, + power_list); - continue; if (event == SND_SOC_DAPM_STREAM_START) ret = w->event(w, reverted: --- linux-oem-5.17-5.17.0/sound/soc/soc-ops.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/soc-ops.c @@ -461,7 +461,7 @@ ret = err; } } + return err; - return ret; } EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx); reverted: --- linux-oem-5.17-5.17.0/sound/soc/soc-pcm.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/soc-pcm.c @@ -1214,7 +1214,7 @@ be_substream->pcm->nonatomic = 1; } + dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_ATOMIC); - dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL); if (!dpcm) return -ENOMEM; diff -u linux-oem-5.17-5.17.0/sound/soc/soc-topology.c linux-oem-5.17-5.17.0/sound/soc/soc-topology.c --- linux-oem-5.17-5.17.0/sound/soc/soc-topology.c +++ linux-oem-5.17-5.17.0/sound/soc/soc-topology.c @@ -1479,12 +1479,12 @@ template.num_kcontrols = le32_to_cpu(w->num_kcontrols); kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL); if (!kc) - goto hdr_err; + goto err; kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), GFP_KERNEL); if (!kcontrol_type) - goto hdr_err; + goto err; for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) { control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos; reverted: --- linux-oem-5.17-5.17.0/sound/soc/sof/topology.c +++ linux-oem-5.17-5.17.0.orig/sound/soc/sof/topology.c @@ -1569,46 +1569,6 @@ return 0; } -static void sof_disconnect_dai_widget(struct snd_soc_component *scomp, - struct snd_soc_dapm_widget *w) -{ - struct snd_soc_card *card = scomp->card; - struct snd_soc_pcm_runtime *rtd; - struct snd_soc_dai *cpu_dai; - int i; - - if (!w->sname) - return; - - list_for_each_entry(rtd, &card->rtd_list, list) { - /* does stream match DAI link ? */ - if (!rtd->dai_link->stream_name || - strcmp(w->sname, rtd->dai_link->stream_name)) - continue; - - switch (w->id) { - case snd_soc_dapm_dai_out: - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - if (cpu_dai->capture_widget == w) { - cpu_dai->capture_widget = NULL; - break; - } - } - break; - case snd_soc_dapm_dai_in: - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - if (cpu_dai->playback_widget == w) { - cpu_dai->playback_widget = NULL; - break; - } - } - break; - default: - break; - } - } -} - /* bind PCM ID to host component ID */ static int spcm_bind(struct snd_soc_component *scomp, struct snd_sof_pcm *spcm, int dir) @@ -2489,9 +2449,6 @@ kfree(dai->dai_config); list_del(&dai->list); } - - sof_disconnect_dai_widget(scomp, widget); - break; default: break; reverted: --- linux-oem-5.17-5.17.0/sound/usb/midi.c +++ linux-oem-5.17-5.17.0.orig/sound/usb/midi.c @@ -1194,7 +1194,6 @@ } while (drain_urbs && timeout); finish_wait(&ep->drain_wait, &wait); } - port->active = 0; spin_unlock_irq(&ep->buffer_lock); } diff -u linux-oem-5.17-5.17.0/sound/usb/mixer_maps.c linux-oem-5.17-5.17.0/sound/usb/mixer_maps.c --- linux-oem-5.17-5.17.0/sound/usb/mixer_maps.c +++ linux-oem-5.17-5.17.0/sound/usb/mixer_maps.c @@ -599,10 +599,6 @@ .id = USB_ID(0x0db0, 0x419c), .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, }, - { /* MSI MAG X570S Torpedo Max */ - .id = USB_ID(0x0db0, 0xa073), - .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, - }, { /* MSI TRX40 */ .id = USB_ID(0x0db0, 0x543d), .map = trx40_mobo_map, reverted: --- linux-oem-5.17-5.17.0/sound/usb/pcm.c +++ linux-oem-5.17-5.17.0.orig/sound/usb/pcm.c @@ -669,9 +669,9 @@ SNDRV_PCM_INFO_PAUSE, .channels_min = 1, .channels_max = 256, + .buffer_bytes_max = 1024 * 1024, - .buffer_bytes_max = INT_MAX, /* limited by BUFFER_TIME later */ .period_bytes_min = 64, + .period_bytes_max = 512 * 1024, - .period_bytes_max = INT_MAX, /* limited by PERIOD_TIME later */ .periods_min = 2, .periods_max = 1024, }; @@ -1064,18 +1064,6 @@ return err; } - /* set max period and buffer sizes for 1 and 2 seconds, respectively */ - err = snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_TIME, - 0, 1000000); - if (err < 0) - return err; - err = snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_BUFFER_TIME, - 0, 2000000); - if (err < 0) - return err; - /* additional hw constraints for implicit fb */ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, hw_rule_format_implicit_fb, subs, reverted: --- linux-oem-5.17-5.17.0/sound/usb/usbaudio.h +++ linux-oem-5.17-5.17.0.orig/sound/usb/usbaudio.h @@ -8,7 +8,7 @@ */ /* handling of USB vendor/product ID pairs as 32-bit numbers */ +#define USB_ID(vendor, product) (((vendor) << 16) | (product)) -#define USB_ID(vendor, product) (((unsigned int)(vendor) << 16) | (product)) #define USB_ID_VENDOR(id) ((id) >> 16) #define USB_ID_PRODUCT(id) ((u16)(id)) reverted: --- linux-oem-5.17-5.17.0/sound/x86/intel_hdmi_audio.c +++ linux-oem-5.17-5.17.0.orig/sound/x86/intel_hdmi_audio.c @@ -1665,7 +1665,7 @@ * This function is called when the i915 driver creates the * hdmi-lpe-audio platform device. */ +static int hdmi_lpe_audio_probe(struct platform_device *pdev) -static int __hdmi_lpe_audio_probe(struct platform_device *pdev) { struct snd_card *card; struct snd_intelhad_card *card_ctx; @@ -1828,11 +1828,6 @@ return 0; } -static int hdmi_lpe_audio_probe(struct platform_device *pdev) -{ - return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev)); -} - static const struct dev_pm_ops hdmi_lpe_audio_pm = { SET_SYSTEM_SLEEP_PM_OPS(hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) }; reverted: --- linux-oem-5.17-5.17.0/tools/arch/x86/include/asm/msr-index.h +++ linux-oem-5.17-5.17.0.orig/tools/arch/x86/include/asm/msr-index.h @@ -128,9 +128,9 @@ #define TSX_CTRL_RTM_DISABLE BIT(0) /* Disable RTM feature */ #define TSX_CTRL_CPUID_CLEAR BIT(1) /* Disable TSX enumeration */ +/* SRBDS support */ #define MSR_IA32_MCU_OPT_CTRL 0x00000123 +#define RNGDS_MITG_DIS BIT(0) -#define RNGDS_MITG_DIS BIT(0) /* SRBDS support */ -#define RTM_ALLOW BIT(1) /* TSX development mode */ #define MSR_IA32_SYSENTER_CS 0x00000174 #define MSR_IA32_SYSENTER_ESP 0x00000175 reverted: --- linux-oem-5.17-5.17.0/tools/lib/perf/evlist.c +++ linux-oem-5.17-5.17.0.orig/tools/lib/perf/evlist.c @@ -577,6 +577,7 @@ { struct perf_evsel *evsel; const struct perf_cpu_map *cpus = evlist->cpus; + const struct perf_thread_map *threads = evlist->threads; if (!ops || !ops->get || !ops->mmap) return -EINVAL; @@ -588,7 +589,7 @@ perf_evlist__for_each_entry(evlist, evsel) { if ((evsel->attr.read_format & PERF_FORMAT_ID) && evsel->sample_id == NULL && + perf_evsel__alloc_id(evsel, perf_cpu_map__nr(cpus), threads->nr) < 0) - perf_evsel__alloc_id(evsel, evsel->fd->max_x, evsel->fd->max_y) < 0) return -ENOMEM; } diff -u linux-oem-5.17-5.17.0/tools/objtool/check.c linux-oem-5.17-5.17.0/tools/objtool/check.c --- linux-oem-5.17-5.17.0/tools/objtool/check.c +++ linux-oem-5.17-5.17.0/tools/objtool/check.c @@ -546,12 +546,12 @@ else if (reloc->addend == reloc->sym->sec->sh.sh_size) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find unreachable insn at %s+0x%lx", + WARN("can't find unreachable insn at %s+0x%x", reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find unreachable insn at %s+0x%lx", + WARN("can't find unreachable insn at %s+0x%x", reloc->sym->sec->name, reloc->addend); return -1; } @@ -581,12 +581,12 @@ else if (reloc->addend == reloc->sym->sec->sh.sh_size) { insn = find_last_insn(file, reloc->sym->sec); if (!insn) { - WARN("can't find reachable insn at %s+0x%lx", + WARN("can't find reachable insn at %s+0x%x", reloc->sym->sec->name, reloc->addend); return -1; } } else { - WARN("can't find reachable insn at %s+0x%lx", + WARN("can't find reachable insn at %s+0x%x", reloc->sym->sec->name, reloc->addend); return -1; } reverted: --- linux-oem-5.17-5.17.0/tools/objtool/elf.c +++ linux-oem-5.17-5.17.0.orig/tools/objtool/elf.c @@ -486,7 +486,7 @@ int reltype); int elf_add_reloc(struct elf *elf, struct section *sec, unsigned long offset, + unsigned int type, struct symbol *sym, int addend) - unsigned int type, struct symbol *sym, long addend) { struct reloc *reloc; @@ -515,180 +515,37 @@ return 0; } +int elf_add_reloc_to_insn(struct elf *elf, struct section *sec, + unsigned long offset, unsigned int type, + struct section *insn_sec, unsigned long insn_off) -/* - * Ensure that any reloc section containing references to @sym is marked - * changed such that it will get re-generated in elf_rebuild_reloc_sections() - * with the new symbol index. - */ -static void elf_dirty_reloc_sym(struct elf *elf, struct symbol *sym) { - struct section *sec; - - list_for_each_entry(sec, &elf->sections, list) { - struct reloc *reloc; - - if (sec->changed) - continue; - - list_for_each_entry(reloc, &sec->reloc_list, list) { - if (reloc->sym == sym) { - sec->changed = true; - break; - } - } - } -} - -/* - * Move the first global symbol, as per sh_info, into a new, higher symbol - * index. This fees up the shndx for a new local symbol. - */ -static int elf_move_global_symbol(struct elf *elf, struct section *symtab, - struct section *symtab_shndx) -{ - Elf_Data *data, *shndx_data = NULL; - Elf32_Word first_non_local; struct symbol *sym; + int addend; - Elf_Scn *s; + if (insn_sec->sym) { + sym = insn_sec->sym; + addend = insn_off; - first_non_local = symtab->sh.sh_info; + } else { + /* + * The Clang assembler strips section symbols, so we have to + * reference the function symbol instead: + */ + sym = find_symbol_containing(insn_sec, insn_off); + if (!sym) { + /* + * Hack alert. This happens when we need to reference + * the NOP pad insn immediately after the function. + */ + sym = find_symbol_containing(insn_sec, insn_off - 1); - sym = find_symbol_by_index(elf, first_non_local); - if (!sym) { - WARN("no non-local symbols !?"); - return first_non_local; - } - - s = elf_getscn(elf->elf, symtab->idx); - if (!s) { - WARN_ELF("elf_getscn"); - return -1; - } - - data = elf_newdata(s); - if (!data) { - WARN_ELF("elf_newdata"); - return -1; - } - - data->d_buf = &sym->sym; - data->d_size = sizeof(sym->sym); - data->d_align = 1; - data->d_type = ELF_T_SYM; - - sym->idx = symtab->sh.sh_size / sizeof(sym->sym); - elf_dirty_reloc_sym(elf, sym); - - symtab->sh.sh_info += 1; - symtab->sh.sh_size += data->d_size; - symtab->changed = true; - - if (symtab_shndx) { - s = elf_getscn(elf->elf, symtab_shndx->idx); - if (!s) { - WARN_ELF("elf_getscn"); - return -1; } + if (!sym) { + WARN("can't find symbol containing %s+0x%lx", insn_sec->name, insn_off); - shndx_data = elf_newdata(s); - if (!shndx_data) { - WARN_ELF("elf_newshndx_data"); return -1; } + addend = insn_off - sym->offset; - shndx_data->d_buf = &sym->sec->idx; - shndx_data->d_size = sizeof(Elf32_Word); - shndx_data->d_align = 4; - shndx_data->d_type = ELF_T_WORD; - - symtab_shndx->sh.sh_size += 4; - symtab_shndx->changed = true; - } - - return first_non_local; -} - -static struct symbol * -elf_create_section_symbol(struct elf *elf, struct section *sec) -{ - struct section *symtab, *symtab_shndx; - Elf_Data *shndx_data = NULL; - struct symbol *sym; - Elf32_Word shndx; - - symtab = find_section_by_name(elf, ".symtab"); - if (symtab) { - symtab_shndx = find_section_by_name(elf, ".symtab_shndx"); - if (symtab_shndx) - shndx_data = symtab_shndx->data; - } else { - WARN("no .symtab"); - return NULL; - } - - sym = malloc(sizeof(*sym)); - if (!sym) { - perror("malloc"); - return NULL; - } - memset(sym, 0, sizeof(*sym)); - - sym->idx = elf_move_global_symbol(elf, symtab, symtab_shndx); - if (sym->idx < 0) { - WARN("elf_move_global_symbol"); - return NULL; - } - - sym->name = sec->name; - sym->sec = sec; - - // st_name 0 - sym->sym.st_info = GELF_ST_INFO(STB_LOCAL, STT_SECTION); - // st_other 0 - // st_value 0 - // st_size 0 - shndx = sec->idx; - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { - sym->sym.st_shndx = shndx; - if (!shndx_data) - shndx = 0; - } else { - sym->sym.st_shndx = SHN_XINDEX; - if (!shndx_data) { - WARN("no .symtab_shndx"); - return NULL; - } - } - - if (!gelf_update_symshndx(symtab->data, shndx_data, sym->idx, &sym->sym, shndx)) { - WARN_ELF("gelf_update_symshndx"); - return NULL; - } - - elf_add_symbol(elf, sym); - - return sym; -} - -int elf_add_reloc_to_insn(struct elf *elf, struct section *sec, - unsigned long offset, unsigned int type, - struct section *insn_sec, unsigned long insn_off) -{ - struct symbol *sym = insn_sec->sym; - int addend = insn_off; - - if (!sym) { - /* - * Due to how weak functions work, we must use section based - * relocations. Symbol based relocations would result in the - * weak and non-weak function annotations being overlaid on the - * non-weak function after linking. - */ - sym = elf_create_section_symbol(elf, insn_sec); - if (!sym) - return -1; - - insn_sec->sym = sym; } return elf_add_reloc(elf, sec, offset, type, sym, addend); reverted: --- linux-oem-5.17-5.17.0/tools/objtool/include/objtool/elf.h +++ linux-oem-5.17-5.17.0.orig/tools/objtool/include/objtool/elf.h @@ -73,7 +73,7 @@ struct symbol *sym; unsigned long offset; unsigned int type; + int addend; - long addend; int idx; bool jump_table_start; }; @@ -135,7 +135,7 @@ struct section *elf_create_section(struct elf *elf, const char *name, unsigned int sh_flags, size_t entsize, int nr); int elf_add_reloc(struct elf *elf, struct section *sec, unsigned long offset, + unsigned int type, struct symbol *sym, int addend); - unsigned int type, struct symbol *sym, long addend); int elf_add_reloc_to_insn(struct elf *elf, struct section *sec, unsigned long offset, unsigned int type, struct section *insn_sec, unsigned long insn_off); reverted: --- linux-oem-5.17-5.17.0/tools/perf/arch/arm64/util/machine.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/arch/arm64/util/machine.c @@ -8,6 +8,27 @@ #include "callchain.h" #include "record.h" +/* On arm64, kernel text segment starts at high memory address, + * for example 0xffff 0000 8xxx xxxx. Modules start at a low memory + * address, like 0xffff 0000 00ax xxxx. When only small amount of + * memory is used by modules, gap between end of module's text segment + * and start of kernel text segment may reach 2G. + * Therefore do not fill this gap and do not assign it to the kernel dso map. + */ + +#define SYMBOL_LIMIT (1 << 12) /* 4K */ + +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c) +{ + if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) || + (strchr(p->name, '[') == NULL && strchr(c->name, '['))) + /* Limit range of last symbol in module and kernel */ + p->end += SYMBOL_LIMIT; + else + p->end = c->start; + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); +} + void arch__add_leaf_frame_record_opts(struct record_opts *opts) { opts->sample_user_regs |= sample_reg_masks[PERF_REG_ARM64_LR].mask; reverted: --- linux-oem-5.17-5.17.0/tools/perf/arch/powerpc/util/Build +++ linux-oem-5.17-5.17.0.orig/tools/perf/arch/powerpc/util/Build @@ -1,4 +1,5 @@ perf-y += header.o +perf-y += machine.o perf-y += kvm-stat.o perf-y += perf_regs.o perf-y += mem-events.o reverted: --- linux-oem-5.17-5.17.0/tools/perf/arch/s390/util/machine.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/arch/s390/util/machine.c @@ -35,3 +35,19 @@ return 0; } + +/* On s390 kernel text segment start is located at very low memory addresses, + * for example 0x10000. Modules are located at very high memory addresses, + * for example 0x3ff xxxx xxxx. The gap between end of kernel text segment + * and beginning of first module's text segment is very big. + * Therefore do not fill this gap and do not assign it to the kernel dso map. + */ +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c) +{ + if (strchr(p->name, '[') == NULL && strchr(c->name, '[')) + /* Last kernel symbol mapped to end of page */ + p->end = roundup(p->end, page_size); + else + p->end = c->start; + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); +} reverted: --- linux-oem-5.17-5.17.0/tools/perf/builtin-report.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/builtin-report.c @@ -349,7 +349,6 @@ struct perf_session *session = rep->session; u64 sample_type = evlist__combined_sample_type(session->evlist); bool is_pipe = perf_data__is_pipe(session->data); - struct evsel *evsel; if (session->itrace_synth_opts->callchain || session->itrace_synth_opts->add_callchain || @@ -404,19 +403,6 @@ } if (sort__mode == SORT_MODE__MEMORY) { - /* - * FIXUP: prior to kernel 5.18, Arm SPE missed to set - * PERF_SAMPLE_DATA_SRC bit in sample type. For backward - * compatibility, set the bit if it's an old perf data file. - */ - evlist__for_each_entry(session->evlist, evsel) { - if (strstr(evsel->name, "arm_spe") && - !(sample_type & PERF_SAMPLE_DATA_SRC)) { - evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC; - sample_type |= PERF_SAMPLE_DATA_SRC; - } - } - if (!is_pipe && !(sample_type & PERF_SAMPLE_DATA_SRC)) { ui__error("Selected --mem-mode but no mem data. " "Did you call perf record without -d?\n"); reverted: --- linux-oem-5.17-5.17.0/tools/perf/builtin-script.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/builtin-script.c @@ -459,7 +459,7 @@ return -EINVAL; if (PRINT_FIELD(DATA_SRC) && + evsel__check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC)) - evsel__do_check_stype(evsel, PERF_SAMPLE_DATA_SRC, "DATA_SRC", PERF_OUTPUT_DATA_SRC, allow_user_set)) return -EINVAL; if (PRINT_FIELD(WEIGHT) && reverted: --- linux-oem-5.17-5.17.0/tools/perf/util/arm-spe.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/util/arm-spe.c @@ -1036,7 +1036,7 @@ attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK; attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC | + PERF_SAMPLE_WEIGHT; - PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR; if (spe->timeless_decoding) attr.sample_type &= ~(u64)PERF_SAMPLE_TIME; else reverted: --- linux-oem-5.17-5.17.0/tools/perf/util/parse-events.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/util/parse-events.c @@ -1523,9 +1523,7 @@ bool use_uncore_alias; LIST_HEAD(config_terms); + if (verbose > 1) { - pmu = parse_state->fake_pmu ?: perf_pmu__find(name); - - if (verbose > 1 && !(pmu && pmu->selectable)) { fprintf(stderr, "Attempting to add event pmu '%s' with '", name); if (head_config) { @@ -1538,6 +1536,7 @@ fprintf(stderr, "' that may result in non-fatal errors\n"); } + pmu = parse_state->fake_pmu ?: perf_pmu__find(name); if (!pmu) { char *err_str; reverted: --- linux-oem-5.17-5.17.0/tools/perf/util/symbol-elf.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/util/symbol-elf.c @@ -1290,7 +1290,7 @@ * For misannotated, zeroed, ASM function sizes. */ if (nr > 0) { + symbols__fixup_end(&dso->symbols); - symbols__fixup_end(&dso->symbols, false); symbols__fixup_duplicate(&dso->symbols); if (kmap) { /* reverted: --- linux-oem-5.17-5.17.0/tools/perf/util/symbol.c +++ linux-oem-5.17-5.17.0.orig/tools/perf/util/symbol.c @@ -101,6 +101,11 @@ return tail - str; } +void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c) +{ + p->end = c->start; +} + const char * __weak arch__normalize_symbol_name(const char *name) { return name; @@ -212,8 +217,7 @@ } } +void symbols__fixup_end(struct rb_root_cached *symbols) -/* Update zero-sized symbols using the address of the next symbol */ -void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kallsyms) { struct rb_node *nd, *prevnd = rb_first_cached(symbols); struct symbol *curr, *prev; @@ -227,29 +231,8 @@ prev = curr; curr = rb_entry(nd, struct symbol, rb_node); + if (prev->end == prev->start || prev->end != curr->start) + arch__symbols__fixup_end(prev, curr); - /* - * On some architecture kernel text segment start is located at - * some low memory address, while modules are located at high - * memory addresses (or vice versa). The gap between end of - * kernel text segment and beginning of first module's text - * segment is very big. Therefore do not fill this gap and do - * not assign it to the kernel dso map (kallsyms). - * - * In kallsyms, it determines module symbols using '[' character - * like in: - * ffffffffc1937000 T hdmi_driver_init [snd_hda_codec_hdmi] - */ - if (prev->end == prev->start) { - /* Last kernel/module symbol mapped to end of page */ - if (is_kallsyms && (!strchr(prev->name, '[') != - !strchr(curr->name, '['))) - prev->end = roundup(prev->end + 4096, 4096); - else - prev->end = curr->start; - - pr_debug4("%s sym:%s end:%#" PRIx64 "\n", - __func__, prev->name, prev->end); - } } /* Last entry */ @@ -1484,7 +1467,7 @@ if (kallsyms__delta(kmap, filename, &delta)) return -1; + symbols__fixup_end(&dso->symbols); - symbols__fixup_end(&dso->symbols, true); symbols__fixup_duplicate(&dso->symbols); if (dso->kernel == DSO_SPACE__KERNEL_GUEST) @@ -1676,7 +1659,7 @@ #undef bfd_asymbol_section #endif + symbols__fixup_end(&dso->symbols); - symbols__fixup_end(&dso->symbols, false); symbols__fixup_duplicate(&dso->symbols); dso->adjust_symbols = 1; reverted: --- linux-oem-5.17-5.17.0/tools/perf/util/symbol.h +++ linux-oem-5.17-5.17.0.orig/tools/perf/util/symbol.h @@ -203,7 +203,7 @@ bool kernel); void symbols__insert(struct rb_root_cached *symbols, struct symbol *sym); void symbols__fixup_duplicate(struct rb_root_cached *symbols); +void symbols__fixup_end(struct rb_root_cached *symbols); -void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kallsyms); void maps__fixup_end(struct maps *maps); typedef int (*mapfn_t)(u64 start, u64 len, u64 pgoff, void *data); @@ -241,6 +241,7 @@ #define SYMBOL_A 0 #define SYMBOL_B 1 +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c); int arch__compare_symbol_names(const char *namea, const char *nameb); int arch__compare_symbol_names_n(const char *namea, const char *nameb, unsigned int n); reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/vxlan_flooding_ipv6.sh +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/vxlan_flooding_ipv6.sh @@ -159,17 +159,6 @@ local lsb local i - # Prevent unwanted packets from entering the bridge and interfering - # with the test. - tc qdisc add dev br0 clsact - tc filter add dev br0 egress protocol all pref 1 handle 1 \ - matchall skip_hw action drop - tc qdisc add dev $h1 clsact - tc filter add dev $h1 egress protocol all pref 1 handle 1 \ - flower skip_hw dst_mac de:ad:be:ef:13:37 action pass - tc filter add dev $h1 egress protocol all pref 2 handle 2 \ - matchall skip_hw action drop - for i in $(eval echo {1..$num_remotes}); do lsb=$((i + 1)) @@ -206,12 +195,6 @@ done tc qdisc del dev $rp2 clsact - - tc filter del dev $h1 egress protocol all pref 2 handle 2 matchall - tc filter del dev $h1 egress protocol all pref 1 handle 1 flower - tc qdisc del dev $h1 clsact - tc filter del dev br0 egress protocol all pref 1 handle 1 matchall - tc qdisc del dev br0 clsact } flooding_check_packets() reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/drivers/net/mlxsw/vxlan_flooding.sh +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/drivers/net/mlxsw/vxlan_flooding.sh @@ -172,17 +172,6 @@ local lsb local i - # Prevent unwanted packets from entering the bridge and interfering - # with the test. - tc qdisc add dev br0 clsact - tc filter add dev br0 egress protocol all pref 1 handle 1 \ - matchall skip_hw action drop - tc qdisc add dev $h1 clsact - tc filter add dev $h1 egress protocol all pref 1 handle 1 \ - flower skip_hw dst_mac de:ad:be:ef:13:37 action pass - tc filter add dev $h1 egress protocol all pref 2 handle 2 \ - matchall skip_hw action drop - tc qdisc add dev $rp2 clsact for i in $(eval echo {1..$num_remotes}); do @@ -205,12 +194,6 @@ done tc qdisc del dev $rp2 clsact - - tc filter del dev $h1 egress protocol all pref 2 handle 2 matchall - tc filter del dev $h1 egress protocol all pref 1 handle 1 flower - tc qdisc del dev $h1 clsact - tc filter del dev br0 egress protocol all pref 1 handle 1 matchall - tc qdisc del dev br0 clsact } flooding_check_packets() reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh @@ -190,7 +190,7 @@ tc filter add dev $eth0 ingress chain $(IS2 0 0) pref 1 \ protocol ipv4 flower skip_sw ip_proto udp dst_port 5201 \ + action police rate 50mbit burst 64k \ - action police rate 50mbit burst 64k conform-exceed drop/pipe \ action goto chain $(IS2 1 0) } reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/aarch64/arch_timer.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/aarch64/arch_timer.c @@ -362,12 +362,11 @@ pr_debug("ptimer_irq: %d; vtimer_irq: %d\n", ptimer_irq, vtimer_irq); } -static int gic_fd; - static struct kvm_vm *test_vm_create(void) { struct kvm_vm *vm; unsigned int i; + int ret; int nr_vcpus = test_args.nr_vcpus; vm = vm_create_default_with_vcpus(nr_vcpus, 0, 0, guest_code, NULL); @@ -384,8 +383,8 @@ ucall_init(vm, NULL); test_init_timer_irq(vm); + ret = vgic_v3_setup(vm, nr_vcpus, 64, GICD_BASE_GPA, GICR_BASE_GPA); + if (ret < 0) { - gic_fd = vgic_v3_setup(vm, nr_vcpus, 64, GICD_BASE_GPA, GICR_BASE_GPA); - if (gic_fd < 0) { print_skip("Failed to create vgic-v3"); exit(KSFT_SKIP); } @@ -396,12 +395,6 @@ return vm; } -static void test_vm_cleanup(struct kvm_vm *vm) -{ - close(gic_fd); - kvm_vm_free(vm); -} - static void test_print_help(char *name) { pr_info("Usage: %s [-h] [-n nr_vcpus] [-i iterations] [-p timer_period_ms]\n", @@ -485,7 +478,7 @@ vm = test_vm_create(); test_run(vm); + kvm_vm_free(vm); - test_vm_cleanup(vm); return 0; } reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/include/riscv/processor.h +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/include/riscv/processor.h @@ -101,9 +101,7 @@ #define PGTBL_PTE_WRITE_SHIFT 2 #define PGTBL_PTE_READ_MASK 0x0000000000000002ULL #define PGTBL_PTE_READ_SHIFT 1 +#define PGTBL_PTE_PERM_MASK (PGTBL_PTE_EXECUTE_MASK | \ -#define PGTBL_PTE_PERM_MASK (PGTBL_PTE_ACCESSED_MASK | \ - PGTBL_PTE_DIRTY_MASK | \ - PGTBL_PTE_EXECUTE_MASK | \ PGTBL_PTE_WRITE_MASK | \ PGTBL_PTE_READ_MASK) #define PGTBL_PTE_VALID_MASK 0x0000000000000001ULL reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/include/x86_64/processor.h +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -60,21 +60,6 @@ /* CPUID.0x8000_0001.EDX */ #define CPUID_GBPAGES (1ul << 26) -/* Page table bitfield declarations */ -#define PTE_PRESENT_MASK BIT_ULL(0) -#define PTE_WRITABLE_MASK BIT_ULL(1) -#define PTE_USER_MASK BIT_ULL(2) -#define PTE_ACCESSED_MASK BIT_ULL(5) -#define PTE_DIRTY_MASK BIT_ULL(6) -#define PTE_LARGE_MASK BIT_ULL(7) -#define PTE_GLOBAL_MASK BIT_ULL(8) -#define PTE_NX_MASK BIT_ULL(63) - -#define PAGE_SHIFT 12 - -#define PHYSICAL_PAGE_MASK GENMASK_ULL(51, 12) -#define PTE_GET_PFN(pte) (((pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) - /* General Registers in 64-Bit Mode */ struct gpr64_regs { u64 rax; reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/kvm_page_table_test.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/kvm_page_table_test.c @@ -278,7 +278,7 @@ else guest_test_phys_mem = p->phys_offset; #ifdef __s390x__ + alignment = max(0x100000, alignment); - alignment = max(0x100000UL, alignment); #endif guest_test_phys_mem = align_down(guest_test_phys_mem, alignment); reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/lib/riscv/processor.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/lib/riscv/processor.c @@ -268,7 +268,7 @@ core.regs.t3, core.regs.t4, core.regs.t5, core.regs.t6); } +static void guest_hang(void) -static void __aligned(16) guest_hang(void) { while (1) ; reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -19,6 +19,38 @@ vm_vaddr_t exception_handlers; +/* Virtual translation table structure declarations */ +struct pageUpperEntry { + uint64_t present:1; + uint64_t writable:1; + uint64_t user:1; + uint64_t write_through:1; + uint64_t cache_disable:1; + uint64_t accessed:1; + uint64_t ignored_06:1; + uint64_t page_size:1; + uint64_t ignored_11_08:4; + uint64_t pfn:40; + uint64_t ignored_62_52:11; + uint64_t execute_disable:1; +}; + +struct pageTableEntry { + uint64_t present:1; + uint64_t writable:1; + uint64_t user:1; + uint64_t write_through:1; + uint64_t cache_disable:1; + uint64_t accessed:1; + uint64_t dirty:1; + uint64_t reserved_07:1; + uint64_t global:1; + uint64_t ignored_11_09:3; + uint64_t pfn:40; + uint64_t ignored_62_52:11; + uint64_t execute_disable:1; +}; + void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent) { @@ -163,21 +195,23 @@ return &page_table[index]; } +static struct pageUpperEntry *virt_create_upper_pte(struct kvm_vm *vm, + uint64_t pt_pfn, + uint64_t vaddr, + uint64_t paddr, + int level, + enum x86_page_size page_size) +{ + struct pageUpperEntry *pte = virt_get_pte(vm, pt_pfn, vaddr, level); + + if (!pte->present) { + pte->writable = true; + pte->present = true; + pte->page_size = (level == page_size); + if (pte->page_size) + pte->pfn = paddr >> vm->page_shift; -static uint64_t *virt_create_upper_pte(struct kvm_vm *vm, - uint64_t pt_pfn, - uint64_t vaddr, - uint64_t paddr, - int level, - enum x86_page_size page_size) -{ - uint64_t *pte = virt_get_pte(vm, pt_pfn, vaddr, level); - - if (!(*pte & PTE_PRESENT_MASK)) { - *pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK; - if (level == page_size) - *pte |= PTE_LARGE_MASK | (paddr & PHYSICAL_PAGE_MASK); else + pte->pfn = vm_alloc_page_table(vm) >> vm->page_shift; - *pte |= vm_alloc_page_table(vm) & PHYSICAL_PAGE_MASK; } else { /* * Entry already present. Assert that the caller doesn't want @@ -187,7 +221,7 @@ TEST_ASSERT(level != page_size, "Cannot create hugepage at level: %u, vaddr: 0x%lx\n", page_size, vaddr); + TEST_ASSERT(!pte->page_size, - TEST_ASSERT(!(*pte & PTE_LARGE_MASK), "Cannot create page table at level: %u, vaddr: 0x%lx\n", level, vaddr); } @@ -198,8 +232,8 @@ enum x86_page_size page_size) { const uint64_t pg_size = 1ull << ((page_size * 9) + 12); + struct pageUpperEntry *pml4e, *pdpe, *pde; + struct pageTableEntry *pte; - uint64_t *pml4e, *pdpe, *pde; - uint64_t *pte; TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Unknown or unsupported guest mode, mode: 0x%x", vm->mode); @@ -223,22 +257,24 @@ */ pml4e = virt_create_upper_pte(vm, vm->pgd >> vm->page_shift, vaddr, paddr, 3, page_size); + if (pml4e->page_size) - if (*pml4e & PTE_LARGE_MASK) return; + pdpe = virt_create_upper_pte(vm, pml4e->pfn, vaddr, paddr, 2, page_size); + if (pdpe->page_size) - pdpe = virt_create_upper_pte(vm, PTE_GET_PFN(*pml4e), vaddr, paddr, 2, page_size); - if (*pdpe & PTE_LARGE_MASK) return; + pde = virt_create_upper_pte(vm, pdpe->pfn, vaddr, paddr, 1, page_size); + if (pde->page_size) - pde = virt_create_upper_pte(vm, PTE_GET_PFN(*pdpe), vaddr, paddr, 1, page_size); - if (*pde & PTE_LARGE_MASK) return; /* Fill in page table entry. */ + pte = virt_get_pte(vm, pde->pfn, vaddr, 0); + TEST_ASSERT(!pte->present, - pte = virt_get_pte(vm, PTE_GET_PFN(*pde), vaddr, 0); - TEST_ASSERT(!(*pte & PTE_PRESENT_MASK), "PTE already present for 4k page at vaddr: 0x%lx\n", vaddr); + pte->pfn = paddr >> vm->page_shift; + pte->writable = true; + pte->present = 1; - *pte = PTE_PRESENT_MASK | PTE_WRITABLE_MASK | (paddr & PHYSICAL_PAGE_MASK); } void virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr) @@ -246,12 +282,12 @@ __virt_pg_map(vm, vaddr, paddr, X86_PAGE_SIZE_4K); } +static struct pageTableEntry *_vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, -static uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr) { uint16_t index[4]; + struct pageUpperEntry *pml4e, *pdpe, *pde; + struct pageTableEntry *pte; - uint64_t *pml4e, *pdpe, *pde; - uint64_t *pte; struct kvm_cpuid_entry2 *entry; struct kvm_sregs sregs; int max_phy_addr; @@ -293,29 +329,30 @@ index[3] = (vaddr >> 39) & 0x1ffu; pml4e = addr_gpa2hva(vm, vm->pgd); + TEST_ASSERT(pml4e[index[3]].present, - TEST_ASSERT(pml4e[index[3]] & PTE_PRESENT_MASK, "Expected pml4e to be present for gva: 0x%08lx", vaddr); + TEST_ASSERT((*(uint64_t*)(&pml4e[index[3]]) & + (rsvd_mask | (1ull << 7))) == 0, - TEST_ASSERT((pml4e[index[3]] & (rsvd_mask | PTE_LARGE_MASK)) == 0, "Unexpected reserved bits set."); + pdpe = addr_gpa2hva(vm, pml4e[index[3]].pfn * vm->page_size); + TEST_ASSERT(pdpe[index[2]].present, - pdpe = addr_gpa2hva(vm, PTE_GET_PFN(pml4e[index[3]]) * vm->page_size); - TEST_ASSERT(pdpe[index[2]] & PTE_PRESENT_MASK, "Expected pdpe to be present for gva: 0x%08lx", vaddr); + TEST_ASSERT(pdpe[index[2]].page_size == 0, - TEST_ASSERT(!(pdpe[index[2]] & PTE_LARGE_MASK), "Expected pdpe to map a pde not a 1-GByte page."); + TEST_ASSERT((*(uint64_t*)(&pdpe[index[2]]) & rsvd_mask) == 0, - TEST_ASSERT((pdpe[index[2]] & rsvd_mask) == 0, "Unexpected reserved bits set."); + pde = addr_gpa2hva(vm, pdpe[index[2]].pfn * vm->page_size); + TEST_ASSERT(pde[index[1]].present, - pde = addr_gpa2hva(vm, PTE_GET_PFN(pdpe[index[2]]) * vm->page_size); - TEST_ASSERT(pde[index[1]] & PTE_PRESENT_MASK, "Expected pde to be present for gva: 0x%08lx", vaddr); + TEST_ASSERT(pde[index[1]].page_size == 0, - TEST_ASSERT(!(pde[index[1]] & PTE_LARGE_MASK), "Expected pde to map a pte not a 2-MByte page."); + TEST_ASSERT((*(uint64_t*)(&pde[index[1]]) & rsvd_mask) == 0, - TEST_ASSERT((pde[index[1]] & rsvd_mask) == 0, "Unexpected reserved bits set."); + pte = addr_gpa2hva(vm, pde[index[1]].pfn * vm->page_size); + TEST_ASSERT(pte[index[0]].present, - pte = addr_gpa2hva(vm, PTE_GET_PFN(pde[index[1]]) * vm->page_size); - TEST_ASSERT(pte[index[0]] & PTE_PRESENT_MASK, "Expected pte to be present for gva: 0x%08lx", vaddr); return &pte[index[0]]; @@ -323,7 +360,7 @@ uint64_t vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr) { + struct pageTableEntry *pte = _vm_get_page_table_entry(vm, vcpuid, vaddr); - uint64_t *pte = _vm_get_page_table_entry(vm, vcpuid, vaddr); return *(uint64_t *)pte; } @@ -331,17 +368,18 @@ void vm_set_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr, uint64_t pte) { + struct pageTableEntry *new_pte = _vm_get_page_table_entry(vm, vcpuid, + vaddr); - uint64_t *new_pte = _vm_get_page_table_entry(vm, vcpuid, vaddr); *(uint64_t *)new_pte = pte; } void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent) { + struct pageUpperEntry *pml4e, *pml4e_start; + struct pageUpperEntry *pdpe, *pdpe_start; + struct pageUpperEntry *pde, *pde_start; + struct pageTableEntry *pte, *pte_start; - uint64_t *pml4e, *pml4e_start; - uint64_t *pdpe, *pdpe_start; - uint64_t *pde, *pde_start; - uint64_t *pte, *pte_start; if (!vm->pgd_created) return; @@ -351,58 +389,58 @@ fprintf(stream, "%*s index hvaddr gpaddr " "addr w exec dirty\n", indent, ""); + pml4e_start = (struct pageUpperEntry *) addr_gpa2hva(vm, vm->pgd); - pml4e_start = (uint64_t *) addr_gpa2hva(vm, vm->pgd); for (uint16_t n1 = 0; n1 <= 0x1ffu; n1++) { pml4e = &pml4e_start[n1]; + if (!pml4e->present) - if (!(*pml4e & PTE_PRESENT_MASK)) continue; + fprintf(stream, "%*spml4e 0x%-3zx %p 0x%-12lx 0x%-10lx %u " - fprintf(stream, "%*spml4e 0x%-3zx %p 0x%-12lx 0x%-10llx %u " " %u\n", indent, "", pml4e - pml4e_start, pml4e, + addr_hva2gpa(vm, pml4e), (uint64_t) pml4e->pfn, + pml4e->writable, pml4e->execute_disable); - addr_hva2gpa(vm, pml4e), PTE_GET_PFN(*pml4e), - !!(*pml4e & PTE_WRITABLE_MASK), !!(*pml4e & PTE_NX_MASK)); + pdpe_start = addr_gpa2hva(vm, pml4e->pfn * vm->page_size); - pdpe_start = addr_gpa2hva(vm, *pml4e & PHYSICAL_PAGE_MASK); for (uint16_t n2 = 0; n2 <= 0x1ffu; n2++) { pdpe = &pdpe_start[n2]; + if (!pdpe->present) - if (!(*pdpe & PTE_PRESENT_MASK)) continue; + fprintf(stream, "%*spdpe 0x%-3zx %p 0x%-12lx 0x%-10lx " - fprintf(stream, "%*spdpe 0x%-3zx %p 0x%-12lx 0x%-10llx " "%u %u\n", indent, "", pdpe - pdpe_start, pdpe, addr_hva2gpa(vm, pdpe), + (uint64_t) pdpe->pfn, pdpe->writable, + pdpe->execute_disable); - PTE_GET_PFN(*pdpe), !!(*pdpe & PTE_WRITABLE_MASK), - !!(*pdpe & PTE_NX_MASK)); + pde_start = addr_gpa2hva(vm, pdpe->pfn * vm->page_size); - pde_start = addr_gpa2hva(vm, *pdpe & PHYSICAL_PAGE_MASK); for (uint16_t n3 = 0; n3 <= 0x1ffu; n3++) { pde = &pde_start[n3]; + if (!pde->present) - if (!(*pde & PTE_PRESENT_MASK)) continue; fprintf(stream, "%*spde 0x%-3zx %p " + "0x%-12lx 0x%-10lx %u %u\n", - "0x%-12lx 0x%-10llx %u %u\n", indent, "", pde - pde_start, pde, addr_hva2gpa(vm, pde), + (uint64_t) pde->pfn, pde->writable, + pde->execute_disable); - PTE_GET_PFN(*pde), !!(*pde & PTE_WRITABLE_MASK), - !!(*pde & PTE_NX_MASK)); + pte_start = addr_gpa2hva(vm, pde->pfn * vm->page_size); - pte_start = addr_gpa2hva(vm, *pde & PHYSICAL_PAGE_MASK); for (uint16_t n4 = 0; n4 <= 0x1ffu; n4++) { pte = &pte_start[n4]; + if (!pte->present) - if (!(*pte & PTE_PRESENT_MASK)) continue; fprintf(stream, "%*spte 0x%-3zx %p " + "0x%-12lx 0x%-10lx %u %u " - "0x%-12lx 0x%-10llx %u %u " " %u 0x%-10lx\n", indent, "", pte - pte_start, pte, addr_hva2gpa(vm, pte), + (uint64_t) pte->pfn, + pte->writable, + pte->execute_disable, + pte->dirty, - PTE_GET_PFN(*pte), - !!(*pte & PTE_WRITABLE_MASK), - !!(*pte & PTE_NX_MASK), - !!(*pte & PTE_DIRTY_MASK), ((uint64_t) n1 << 27) | ((uint64_t) n2 << 18) | ((uint64_t) n3 << 9) @@ -520,8 +558,8 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva) { uint16_t index[4]; + struct pageUpperEntry *pml4e, *pdpe, *pde; + struct pageTableEntry *pte; - uint64_t *pml4e, *pdpe, *pde; - uint64_t *pte; TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use " "unknown or unsupported guest mode, mode: 0x%x", vm->mode); @@ -534,22 +572,22 @@ if (!vm->pgd_created) goto unmapped_gva; pml4e = addr_gpa2hva(vm, vm->pgd); + if (!pml4e[index[3]].present) - if (!(pml4e[index[3]] & PTE_PRESENT_MASK)) goto unmapped_gva; + pdpe = addr_gpa2hva(vm, pml4e[index[3]].pfn * vm->page_size); + if (!pdpe[index[2]].present) - pdpe = addr_gpa2hva(vm, PTE_GET_PFN(pml4e[index[3]]) * vm->page_size); - if (!(pdpe[index[2]] & PTE_PRESENT_MASK)) goto unmapped_gva; + pde = addr_gpa2hva(vm, pdpe[index[2]].pfn * vm->page_size); + if (!pde[index[1]].present) - pde = addr_gpa2hva(vm, PTE_GET_PFN(pdpe[index[2]]) * vm->page_size); - if (!(pde[index[1]] & PTE_PRESENT_MASK)) goto unmapped_gva; + pte = addr_gpa2hva(vm, pde[index[1]].pfn * vm->page_size); + if (!pte[index[0]].present) - pte = addr_gpa2hva(vm, PTE_GET_PFN(pde[index[1]]) * vm->page_size); - if (!(pte[index[0]] & PTE_PRESENT_MASK)) goto unmapped_gva; + return (pte[index[0]].pfn * vm->page_size) + (gva & 0xfffu); - return (PTE_GET_PFN(pte[index[0]]) * vm->page_size) + (gva & 0xfffu); unmapped_gva: TEST_FAIL("No mapping for vm virtual address, gva: 0x%lx", gva); reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/mqueue/mq_perf_tests.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -180,9 +180,6 @@ if (in_shutdown++) return; - /* Free the cpu_set allocated using CPU_ALLOC in main function */ - CPU_FREE(cpu_set); - for (i = 0; i < num_cpus_to_pin; i++) if (cpu_threads[i]) { pthread_kill(cpu_threads[i], SIGUSR1); @@ -554,12 +551,6 @@ perror("sysconf(_SC_NPROCESSORS_ONLN)"); exit(1); } - - if (getuid() != 0) - ksft_exit_skip("Not running as root, but almost all tests " - "require root in order to modify\nsystem settings. " - "Exiting.\n"); - cpus_online = min(MAX_CPUS, sysconf(_SC_NPROCESSORS_ONLN)); cpu_set = CPU_ALLOC(cpus_online); if (cpu_set == NULL) { @@ -598,7 +589,7 @@ cpu_set)) { fprintf(stderr, "Any given CPU may " "only be given once.\n"); + exit(1); - goto err_code; } else CPU_SET_S(cpus_to_pin[cpu], cpu_set_size, cpu_set); @@ -616,7 +607,7 @@ queue_path = malloc(strlen(option) + 2); if (!queue_path) { perror("malloc()"); + exit(1); - goto err_code; } queue_path[0] = '/'; queue_path[1] = 0; @@ -631,12 +622,17 @@ fprintf(stderr, "Must pass at least one CPU to continuous " "mode.\n"); poptPrintUsage(popt_context, stderr, 0); + exit(1); - goto err_code; } else if (!continuous_mode) { num_cpus_to_pin = 1; cpus_to_pin[0] = cpus_online - 1; } + if (getuid() != 0) + ksft_exit_skip("Not running as root, but almost all tests " + "require root in order to modify\nsystem settings. " + "Exiting.\n"); + max_msgs = fopen(MAX_MSGS, "r+"); max_msgsize = fopen(MAX_MSGSIZE, "r+"); if (!max_msgs) @@ -744,9 +740,4 @@ sleep(1); } shutdown(0, "", 0); - -err_code: - CPU_FREE(cpu_set); - exit(1); - } reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh @@ -61,12 +61,9 @@ vrf_prepare mirror_gre_topo_create - # Avoid changing br1's PVID while it is operational as a L3 interface. - ip link set dev br1 down ip link set dev $swp3 master br1 bridge vlan add dev br1 vid 555 pvid untagged self - ip link set dev br1 up ip address add dev br1 192.0.2.129/28 ip address add dev br1 2001:db8:2::1/64 reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/net/so_txtime.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/net/so_txtime.c @@ -421,7 +421,7 @@ "Options:\n" " -4 only IPv4\n" " -6 only IPv6\n" + " -c monotonic (default) or tai\n" - " -c monotonic or tai (default)\n" " -D destination IP address (server)\n" " -S source IP address (client)\n" " -r run rx mode\n" @@ -475,7 +475,7 @@ cfg_rx = true; break; case 't': + cfg_start_time_ns = strtol(optarg, NULL, 0); - cfg_start_time_ns = strtoll(optarg, NULL, 0); break; case 'm': cfg_mark = strtol(optarg, NULL, 0); diff -u linux-oem-5.17-5.17.0/tools/testing/selftests/seccomp/seccomp_bpf.c linux-oem-5.17-5.17.0/tools/testing/selftests/seccomp/seccomp_bpf.c --- linux-oem-5.17-5.17.0/tools/testing/selftests/seccomp/seccomp_bpf.c +++ linux-oem-5.17-5.17.0/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -955,7 +955,7 @@ ASSERT_EQ(0, ret); EXPECT_EQ(parent, syscall(__NR_getppid)); - EXPECT_EQ(-1, read(-1, NULL, 0)); + EXPECT_EQ(-1, read(0, NULL, 0)); EXPECT_EQ(E2BIG, errno); } @@ -974,7 +974,7 @@ EXPECT_EQ(parent, syscall(__NR_getppid)); /* "errno" of 0 is ok. */ - EXPECT_EQ(0, read(-1, NULL, 0)); + EXPECT_EQ(0, read(0, NULL, 0)); } /* @@ -995,7 +995,7 @@ ASSERT_EQ(0, ret); EXPECT_EQ(parent, syscall(__NR_getppid)); - EXPECT_EQ(-1, read(-1, NULL, 0)); + EXPECT_EQ(-1, read(0, NULL, 0)); EXPECT_EQ(4095, errno); } @@ -1026,7 +1026,7 @@ ASSERT_EQ(0, ret); EXPECT_EQ(parent, syscall(__NR_getppid)); - EXPECT_EQ(-1, read(-1, NULL, 0)); + EXPECT_EQ(-1, read(0, NULL, 0)); EXPECT_EQ(12, errno); } @@ -2623,7 +2623,7 @@ ret = prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0); if (!ret) return (void *)SIBLING_EXIT_NEWPRIVS; - read(-1, NULL, 0); + read(0, NULL, 0); return (void *)SIBLING_EXIT_UNKILLED; } reverted: --- linux-oem-5.17-5.17.0/tools/testing/selftests/vm/mremap_test.c +++ linux-oem-5.17-5.17.0.orig/tools/testing/selftests/vm/mremap_test.c @@ -6,11 +6,9 @@ #include #include -#include #include #include #include -#include #include "../kselftest.h" @@ -66,112 +64,6 @@ } /* - * Returns false if the requested remap region overlaps with an - * existing mapping (e.g text, stack) else returns true. - */ -static bool is_remap_region_valid(void *addr, unsigned long long size) -{ - void *remap_addr = NULL; - bool ret = true; - - /* Use MAP_FIXED_NOREPLACE flag to ensure region is not mapped */ - remap_addr = mmap(addr, size, PROT_READ | PROT_WRITE, - MAP_FIXED_NOREPLACE | MAP_ANONYMOUS | MAP_SHARED, - -1, 0); - - if (remap_addr == MAP_FAILED) { - if (errno == EEXIST) - ret = false; - } else { - munmap(remap_addr, size); - } - - return ret; -} - -/* Returns mmap_min_addr sysctl tunable from procfs */ -static unsigned long long get_mmap_min_addr(void) -{ - FILE *fp; - int n_matched; - static unsigned long long addr; - - if (addr) - return addr; - - fp = fopen("/proc/sys/vm/mmap_min_addr", "r"); - if (fp == NULL) { - ksft_print_msg("Failed to open /proc/sys/vm/mmap_min_addr: %s\n", - strerror(errno)); - exit(KSFT_SKIP); - } - - n_matched = fscanf(fp, "%llu", &addr); - if (n_matched != 1) { - ksft_print_msg("Failed to read /proc/sys/vm/mmap_min_addr: %s\n", - strerror(errno)); - fclose(fp); - exit(KSFT_SKIP); - } - - fclose(fp); - return addr; -} - -/* - * Returns false if the requested remap region overlaps with an - * existing mapping (e.g text, stack) else returns true. - */ -static bool is_remap_region_valid(void *addr, unsigned long long size) -{ - void *remap_addr = NULL; - bool ret = true; - - /* Use MAP_FIXED_NOREPLACE flag to ensure region is not mapped */ - remap_addr = mmap(addr, size, PROT_READ | PROT_WRITE, - MAP_FIXED_NOREPLACE | MAP_ANONYMOUS | MAP_SHARED, - -1, 0); - - if (remap_addr == MAP_FAILED) { - if (errno == EEXIST) - ret = false; - } else { - munmap(remap_addr, size); - } - - return ret; -} - -/* Returns mmap_min_addr sysctl tunable from procfs */ -static unsigned long long get_mmap_min_addr(void) -{ - FILE *fp; - int n_matched; - static unsigned long long addr; - - if (addr) - return addr; - - fp = fopen("/proc/sys/vm/mmap_min_addr", "r"); - if (fp == NULL) { - ksft_print_msg("Failed to open /proc/sys/vm/mmap_min_addr: %s\n", - strerror(errno)); - exit(KSFT_SKIP); - } - - n_matched = fscanf(fp, "%llu", &addr); - if (n_matched != 1) { - ksft_print_msg("Failed to read /proc/sys/vm/mmap_min_addr: %s\n", - strerror(errno)); - fclose(fp); - exit(KSFT_SKIP); - } - - fclose(fp); - return addr; -} - -/* * Returns the start address of the mapping on success, else returns * NULL on failure. */ @@ -179,18 +71,11 @@ { unsigned long long addr = 0ULL; void *src_addr = NULL; - unsigned long long mmap_min_addr; - - mmap_min_addr = get_mmap_min_addr(); - retry: addr += c.src_alignment; - if (addr < mmap_min_addr) - goto retry; - src_addr = mmap((void *) addr, c.region_size, PROT_READ | PROT_WRITE, + MAP_FIXED_NOREPLACE | MAP_ANONYMOUS | MAP_SHARED, + -1, 0); - MAP_FIXED_NOREPLACE | MAP_ANONYMOUS | MAP_SHARED, - -1, 0); if (src_addr == MAP_FAILED) { if (errno == EPERM || errno == EEXIST) goto retry; @@ -205,10 +90,8 @@ * alignment in the tests. */ if (((unsigned long long) src_addr & (c.src_alignment - 1)) || + !((unsigned long long) src_addr & c.src_alignment)) - !((unsigned long long) src_addr & c.src_alignment)) { - munmap(src_addr, c.region_size); goto retry; - } if (!src_addr) goto error; @@ -257,20 +140,9 @@ if (!((unsigned long long) addr & c.dest_alignment)) addr = (void *) ((unsigned long long) addr | c.dest_alignment); - /* Don't destroy existing mappings unless expected to overlap */ - while (!is_remap_region_valid(addr, c.region_size) && !c.overlapping) { - /* Check for unsigned overflow */ - if (addr + c.dest_alignment < addr) { - ksft_print_msg("Couldn't find a valid region to remap to\n"); - ret = -1; - goto out; - } - addr += c.dest_alignment; - } - clock_gettime(CLOCK_MONOTONIC, &t_start); dest_addr = mremap(src_addr, c.region_size, c.region_size, + MREMAP_MAYMOVE|MREMAP_FIXED, (char *) addr); - MREMAP_MAYMOVE|MREMAP_FIXED, (char *) addr); clock_gettime(CLOCK_MONOTONIC, &t_end); if (dest_addr == MAP_FAILED) { only in patch2: unchanged: --- linux-oem-5.17-5.17.0.orig/fs/io-wq.h +++ linux-oem-5.17-5.17.0/fs/io-wq.h @@ -155,6 +155,7 @@ struct io_wq_work { struct io_wq_work_node list; unsigned flags; + int fd; }; static inline struct io_wq_work *wq_next_work(struct io_wq_work *work) only in patch2: unchanged: --- linux-oem-5.17-5.17.0.orig/sound/soc/soc-generic-dmaengine-pcm.c +++ linux-oem-5.17-5.17.0/sound/soc/soc-generic-dmaengine-pcm.c @@ -86,10 +86,10 @@ memset(&slave_config, 0, sizeof(slave_config)); - if (!pcm->config) - prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; - else + if (pcm->config && pcm->config->prepare_slave_config) prepare_slave_config = pcm->config->prepare_slave_config; + else + prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; if (prepare_slave_config) { int ret = prepare_slave_config(substream, params, &slave_config);